Skip to content

Commit 4d6daaa

Browse files
committed
feat(chat): remove the concurrent session limit
All sessions now share the SDK's process-wide daemon, so the 3-10 tab cap no longer protects against per-session CLI processes. Drop the cap, the maxTabs setting (stale stored values are discarded on load), the limit notices, and the over-limit button hiding; tabs are unlimited.
1 parent 126524d commit 4d6daaa

26 files changed

Lines changed: 44 additions & 404 deletions

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ Open **Settings → Qoderian**:
141141
| Group | Contents |
142142
|-------|----------|
143143
| **Setup** | Qoder CLI edition and path to the `qodercli` executable (auto-detected by default) |
144-
| **Display** | Chat view placement, maximum tabs, auto-scroll, deferred math rendering during streaming, and default expansion of file edits (the language selector sits above this group) |
144+
| **Display** | Chat view placement, auto-scroll, deferred math rendering during streaming, and default expansion of file edits (the language selector sits above this group) |
145145
| **Conversations** | Auto-generated titles and the model that writes them |
146146
| **Content** | User name, custom system prompt, excluded tags, media folder |
147147
| **Input** | Send-key behavior and vim-style navigation mappings |

‎README.zh-CN.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ QODER_CLI_PATH=/absolute/path/to/qodercli npm run smoke:qoder
139139
| 分组 | 内容 |
140140
|-------|----------|
141141
| **设置** | Qoder CLI 版本与 `qodercli` 可执行文件路径(默认自动探测) |
142-
| **显示** | Qoderian 打开位置、最大聊天标签数、流式传输时自动滚动、流式传输时延迟渲染数学公式、默认展开文件编辑(语言选择器在该组上方) |
142+
| **显示** | Qoderian 打开位置、流式传输时自动滚动、流式传输时延迟渲染数学公式、默认展开文件编辑(语言选择器在该组上方) |
143143
| **对话** | 自动生成对话标题与标题生成模型 |
144144
| **内容** | 用户名、自定义系统提示词、排除的标签、媒体文件夹 |
145145
| **输入** | 需要 Command/Ctrl+Enter 发送与 Vim 风格导航映射 |

‎src/app/settings/settings-storage.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ export const DEFAULT_QODERIAN_SETTINGS: QoderianSettings = {
4242

4343
qoder: { ...DEFAULT_QODER_SETTINGS },
4444

45-
maxTabs: 3,
4645
enableAutoScroll: true,
4746
deferMathRenderingDuringStreaming: true,
4847
expandFileEditsByDefault: false,
@@ -155,6 +154,7 @@ export class QoderianSettingsStorage {
155154
envSnippets: _removedEnvironmentSnippets,
156155
customModelAliases: _removedModelAliases,
157156
hiddenCommands: _removedHiddenCommands,
157+
maxTabs: _removedMaxTabs,
158158
...storedWithoutRemovedSettings
159159
} = stored;
160160
const merged = {

‎src/core/types/settings.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,6 @@ export interface QoderianSettings {
188188
qoder: QoderSettings;
189189

190190
// UI preferences
191-
maxTabs: number;
192191
enableAutoScroll: boolean;
193192
deferMathRenderingDuringStreaming: boolean;
194193
expandFileEditsByDefault: boolean;

‎src/features/chat/chat-view.ts‎

Lines changed: 4 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import {
2222
} from './tabs/tab';
2323
import { TabBar } from './tabs/tab-bar';
2424
import { TabManager } from './tabs/tab-manager';
25-
import { DEFAULT_MAX_TABS, type TabData, type TabId } from './tabs/types';
25+
import { type TabData, type TabId } from './tabs/types';
2626
import { CreditsUsageButton } from './ui/credits-usage-button';
2727

2828
type LoadableView = {
@@ -411,11 +411,6 @@ export class QoderianView extends ItemView {
411411
return this.sessionTabsRedesignEnabled() ? t('nav.newSession') : t('commands.newTab');
412412
}
413413

414-
/** Refreshes tab controls after settings that affect tab availability change. */
415-
refreshTabControls(): void {
416-
this.updateTabBarVisibility();
417-
}
418-
419414
/** Re-renders tab chrome after the experimental session-tab mode changes. */
420415
refreshSessionTabsMode(): void {
421416
this.newConversationButtonEl?.toggleClass(
@@ -470,12 +465,7 @@ export class QoderianView extends ItemView {
470465
}
471466

472467
async createNewTab(): Promise<void> {
473-
const tab = await this.tabManager?.createTab();
474-
if (!tab) {
475-
this.noticeSessionLimit();
476-
this.updateTabBarVisibility();
477-
return;
478-
}
468+
await this.tabManager?.createTab();
479469
this.updateTabBarVisibility();
480470
}
481471

@@ -506,24 +496,6 @@ export class QoderianView extends ItemView {
506496
const showTabBar = tabCount >= 2;
507497

508498
this.tabBarContainerEl.toggleClass('qoderian-hidden', !showTabBar);
509-
510-
this.updateNewTabButtonVisibility();
511-
}
512-
513-
private updateNewTabButtonVisibility(): void {
514-
if (!this.newTabButtonEl || !this.tabManager) return;
515-
if (this.sessionTabsRedesignEnabled()) return;
516-
517-
const canCreateTab = this.tabManager.canCreateTab();
518-
this.newTabButtonEl.toggleClass('qoderian-hidden', !canCreateTab);
519-
if (canCreateTab) {
520-
this.newTabButtonEl.removeAttribute('aria-disabled');
521-
this.newTabButtonEl.removeAttribute('aria-hidden');
522-
return;
523-
}
524-
525-
this.newTabButtonEl.setAttribute('aria-disabled', 'true');
526-
this.newTabButtonEl.setAttribute('aria-hidden', 'true');
527499
}
528500

529501
/** Ensures the fixed Qoder logo is mounted in the header. */
@@ -576,34 +548,23 @@ export class QoderianView extends ItemView {
576548
private async openHistoryConversation(conversationId: string): Promise<void> {
577549
// With the redesigned tabs, resuming a conversation must not replace the
578550
// session in the active tab; legacy keeps opening it in the current tab.
579-
const opened = await this.tabManager?.openConversation(conversationId, {
551+
await this.tabManager?.openConversation(conversationId, {
580552
preferNewTab: this.sessionTabsRedesignEnabled(),
581553
});
582-
if (opened === false) {
583-
this.noticeSessionLimit();
584-
}
585554
this.historyDropdown?.removeClass('visible');
586555
}
587556

588557
private async openHistoryConversationInNewTab(
589558
conversationId: string,
590559
activate = true,
591560
): Promise<void> {
592-
const opened = await this.tabManager?.openConversation(conversationId, {
561+
await this.tabManager?.openConversation(conversationId, {
593562
preferNewTab: true,
594563
activate,
595564
});
596-
if (opened === false) {
597-
this.noticeSessionLimit();
598-
}
599565
this.historyDropdown?.removeClass('visible');
600566
}
601567

602-
private noticeSessionLimit(): void {
603-
const maxTabs = this.plugin.settings.maxTabs ?? DEFAULT_MAX_TABS;
604-
new Notice(t('chat.tabs.maxTabsReached', { count: String(maxTabs) }));
605-
}
606-
607568
private getHistoryConversationStatus(conversationId: string): HistoryConversationStatus {
608569
const activeTab = this.tabManager?.getActiveTab();
609570
if (activeTab?.conversationId === conversationId) {

‎src/features/chat/tabs/tab-manager.ts‎

Lines changed: 10 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ import {
1818
wireTabInputEvents,
1919
} from './tab';
2020
import {
21-
DEFAULT_MAX_TABS,
22-
MAX_TABS,
23-
MIN_TABS,
2421
type PersistedTabManagerState,
2522
type PersistedTabState,
2623
type TabBarItem,
@@ -57,15 +54,6 @@ export class TabManager implements TabManagerInterface {
5754
/** Guard to prevent concurrent tab switches. */
5855
private isSwitchingTab = false;
5956

60-
/**
61-
* Gets the current max tabs limit from settings.
62-
* Clamps to MIN_TABS and MAX_TABS bounds.
63-
*/
64-
private getMaxTabs(): number {
65-
const settingsValue = this.plugin.settings.maxTabs ?? DEFAULT_MAX_TABS;
66-
return Math.max(MIN_TABS, Math.min(MAX_TABS, settingsValue));
67-
}
68-
6957
/** Whether the experimental session-tab interaction (own tab per session) is on. */
7058
private sessionTabsRedesignEnabled(): boolean {
7159
return this.plugin.settings.enableSessionTabsRedesign === true;
@@ -92,26 +80,20 @@ export class TabManager implements TabManagerInterface {
9280
* @param conversationId Optional conversation to load into the tab.
9381
* @param tabId Optional tab ID (for restoration).
9482
* @param options Controls whether the new tab becomes active immediately.
95-
* @returns The created tab, or null if max tabs reached.
9683
*/
9784
async createTab(
9885
conversationId?: string | null,
9986
tabId?: TabId,
10087
options: CreateTabOptions = {},
101-
): Promise<TabData | null> {
88+
): Promise<TabData> {
10289
return this.createTabInner(conversationId, tabId, options);
10390
}
10491

10592
private async createTabInner(
10693
conversationId?: string | null,
10794
tabId?: TabId,
10895
options: CreateTabOptions = {},
109-
): Promise<TabData | null> {
110-
const maxTabs = this.getMaxTabs();
111-
if (this.tabs.size >= maxTabs) {
112-
return null;
113-
}
114-
96+
): Promise<TabData> {
11597
const { activate = true, draftModel } = options;
11698

11799
const conversation = conversationId
@@ -150,7 +132,7 @@ export class TabManager implements TabManagerInterface {
150132
this.plugin,
151133
this.view,
152134
(forkContext) => this.handleForkRequest(forkContext),
153-
(conversationId) => this.openConversation(conversationId).then(() => undefined),
135+
(conversationId) => this.openConversation(conversationId),
154136
() => this.getQoderCatalogConfig(tab),
155137
);
156138

@@ -320,11 +302,6 @@ export class TabManager implements TabManagerInterface {
320302
return this.tabs.size;
321303
}
322304

323-
/** Checks if more tabs can be created. */
324-
canCreateTab(): boolean {
325-
return this.tabs.size < this.getMaxTabs();
326-
}
327-
328305
// ============================================
329306
// Tab Bar Data
330307
// ============================================
@@ -361,12 +338,11 @@ export class TabManager implements TabManagerInterface {
361338
* Opens a conversation in a new tab or existing tab.
362339
* @param conversationId The conversation to open.
363340
* @param options Controls tab creation behavior (backward-compatible with boolean).
364-
* @returns False when a new tab was requested but the tab limit is reached.
365341
*/
366342
async openConversation(
367343
conversationId: string,
368344
options: boolean | OpenConversationOptions = false,
369-
): Promise<boolean> {
345+
): Promise<void> {
370346
const preferNewTab = typeof options === 'boolean'
371347
? options
372348
: options.preferNewTab ?? false;
@@ -378,7 +354,7 @@ export class TabManager implements TabManagerInterface {
378354
for (const tab of this.tabs.values()) {
379355
if (tab.conversationId === conversationId) {
380356
await this.switchToTab(tab.id);
381-
return true;
357+
return;
382358
}
383359
}
384360

@@ -390,19 +366,12 @@ export class TabManager implements TabManagerInterface {
390366
// Focus the other view and switch to its tab instead of opening duplicate
391367
await revealWorkspaceLeaf(this.plugin.app.workspace, crossViewResult.view.leaf);
392368
await crossViewResult.view.getTabManager()?.switchToTab(crossViewResult.tabId);
393-
return true;
369+
return;
394370
}
395371

396-
// Open in a new tab when requested. The redesigned tabs never replace the
397-
// active tab silently; the legacy behavior keeps the old fallback.
398372
if (preferNewTab) {
399-
if (this.canCreateTab()) {
400-
await this.createTab(conversationId, undefined, { activate });
401-
return true;
402-
}
403-
if (this.sessionTabsRedesignEnabled()) {
404-
return false;
405-
}
373+
await this.createTab(conversationId, undefined, { activate });
374+
return;
406375
}
407376

408377
// Open in current tab
@@ -413,7 +382,6 @@ export class TabManager implements TabManagerInterface {
413382
if (activeTab) {
414383
await activeTab.controllers.conversationController?.switchTo(conversationId);
415384
}
416-
return true;
417385
}
418386

419387
/**
@@ -444,12 +412,7 @@ export class TabManager implements TabManagerInterface {
444412
if (!target) return;
445413

446414
if (target === 'new-tab') {
447-
const tab = await this.forkToNewTab(context);
448-
if (!tab) {
449-
const maxTabs = this.getMaxTabs();
450-
new Notice(t('chat.fork.maxTabsReached', { count: String(maxTabs) }));
451-
return;
452-
}
415+
await this.forkToNewTab(context);
453416
new Notice(t('chat.fork.notice'));
454417
} else {
455418
const success = await this.forkInCurrentTab(context);
@@ -461,12 +424,7 @@ export class TabManager implements TabManagerInterface {
461424
}
462425
}
463426

464-
async forkToNewTab(context: ForkContext): Promise<TabData | null> {
465-
const maxTabs = this.getMaxTabs();
466-
if (this.tabs.size >= maxTabs) {
467-
return null;
468-
}
469-
427+
async forkToNewTab(context: ForkContext): Promise<TabData> {
470428
const conversationId = await this.createForkConversation(context);
471429
try {
472430
return await this.createTab(conversationId);

‎src/features/chat/tabs/types.ts‎

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -32,27 +32,6 @@ import type { NavigationSidebar } from '../ui/navigation-sidebar';
3232
import type { StatusPanel } from '../ui/status-panel';
3333
import type { VaultDropController } from '../ui/vault-drop';
3434

35-
/**
36-
* Default number of tabs allowed.
37-
*
38-
* Set to 3 to balance usability with resource usage:
39-
* - Each tab has its own chat runtime and persistent query
40-
* - More tabs = more memory and potential SDK processes
41-
* - 3 tabs allows multi-tasking without excessive overhead
42-
*/
43-
export const DEFAULT_MAX_TABS = 3;
44-
45-
/**
46-
* Minimum number of tabs allowed (settings floor).
47-
*/
48-
export const MIN_TABS = 3;
49-
50-
/**
51-
* Maximum number of tabs allowed (settings ceiling).
52-
* Users can configure up to this many tabs via settings.
53-
*/
54-
export const MAX_TABS = 10;
55-
5635
/**
5736
* Minimal interface for the QoderianView methods used by TabManager and Tab.
5837
* Extends Component for Obsidian integration (event handling, cleanup).

0 commit comments

Comments
 (0)