@bastani/atomic 0.9.80 → 0.9.81-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -0
- package/dist/builtin/intercom/CHANGELOG.md +6 -0
- package/dist/builtin/intercom/broker/client.ts +12 -1
- package/dist/builtin/intercom/index.bundle.mjs +16 -4
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/CHANGELOG.md +10 -0
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/subagents/skills/agent-desktop/SKILL.md +40 -2
- package/dist/builtin/subagents/src/extension/index.bundle.mjs +123 -25
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/builtin/workflows/CHANGELOG.md +10 -0
- package/dist/builtin/workflows/builtin/{chunk-m56qhe4b.js → chunk-zpkcqyhr.js} +2 -0
- package/dist/builtin/workflows/builtin/index.js +1 -1
- package/dist/builtin/workflows/builtin/ralph.js +1 -1
- package/dist/builtin/workflows/package.json +1 -1
- package/dist/builtin/workflows/src/extension/index.bundle.mjs +16 -4
- package/dist/builtin/workflows/src/extension/local-worker-entry.mjs +12 -2
- package/dist/builtin/workflows/src/index.js +12 -2
- package/dist/builtin/workflows/src/local-worker-entry.mjs +12 -2
- package/dist/builtin/workflows/src/shared/authoring-contract-stage.d.ts +8 -1
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +4 -2
- package/dist/cli/args.js.map +1 -1
- package/dist/core/cache-stats.d.ts +21 -0
- package/dist/core/cache-stats.d.ts.map +1 -1
- package/dist/core/cache-stats.js +42 -2
- package/dist/core/cache-stats.js.map +1 -1
- package/dist/core/exec.d.ts +1 -0
- package/dist/core/exec.d.ts.map +1 -1
- package/dist/core/exec.js +2 -1
- package/dist/core/exec.js.map +1 -1
- package/dist/core/execution-model-router.d.ts +17 -0
- package/dist/core/execution-model-router.d.ts.map +1 -1
- package/dist/core/execution-model-router.js +52 -23
- package/dist/core/execution-model-router.js.map +1 -1
- package/dist/core/model-fallback-failures.d.ts.map +1 -1
- package/dist/core/model-fallback-failures.js +1 -0
- package/dist/core/model-fallback-failures.js.map +1 -1
- package/dist/core/model-resolver-scope.d.ts +0 -1
- package/dist/core/model-resolver-scope.d.ts.map +1 -1
- package/dist/core/model-resolver-scope.js +0 -8
- package/dist/core/model-resolver-scope.js.map +1 -1
- package/dist/core/model-resolver.d.ts +1 -1
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +1 -1
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/model-routing-candidates.d.ts +30 -5
- package/dist/core/model-routing-candidates.d.ts.map +1 -1
- package/dist/core/model-routing-candidates.js +381 -105
- package/dist/core/model-routing-candidates.js.map +1 -1
- package/dist/core/model-routing-estimates.d.ts +70 -0
- package/dist/core/model-routing-estimates.d.ts.map +1 -0
- package/dist/core/model-routing-estimates.js +244 -0
- package/dist/core/model-routing-estimates.js.map +1 -0
- package/dist/core/model-routing-needs.d.ts +1 -0
- package/dist/core/model-routing-needs.d.ts.map +1 -1
- package/dist/core/model-routing-needs.js +1 -1
- package/dist/core/model-routing-needs.js.map +1 -1
- package/dist/core/provider-display-names.js +2 -2
- package/dist/core/provider-display-names.js.map +1 -1
- package/dist/core/remote-catalog-provider.d.ts.map +1 -1
- package/dist/core/remote-catalog-provider.js +6 -0
- package/dist/core/remote-catalog-provider.js.map +1 -1
- package/dist/core/tasks/supervisor.d.ts +1 -1
- package/dist/core/tasks/supervisor.d.ts.map +1 -1
- package/dist/core/tasks/supervisor.js.map +1 -1
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js +20 -11
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/output-accumulator.d.ts.map +1 -1
- package/dist/core/tools/output-accumulator.js +2 -1
- package/dist/core/tools/output-accumulator.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +30 -10
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-actions.d.ts +5 -0
- package/dist/modes/interactive/components/chat-session-host-actions.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-actions.js +86 -9
- package/dist/modes/interactive/components/chat-session-host-actions.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-events.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-events.js +6 -3
- package/dist/modes/interactive/components/chat-session-host-events.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-rendering.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-rendering.js +5 -2
- package/dist/modes/interactive/components/chat-session-host-rendering.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-state.d.ts +5 -0
- package/dist/modes/interactive/components/chat-session-host-state.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-state.js +2 -0
- package/dist/modes/interactive/components/chat-session-host-state.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts +4 -2
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +11 -4
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/session-selector-list.d.ts +4 -1
- package/dist/modes/interactive/components/session-selector-list.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector-list.js +24 -1
- package/dist/modes/interactive/components/session-selector-list.js.map +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts +1 -0
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector.js +29 -36
- package/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-agent-events.js +6 -6
- package/dist/modes/interactive/interactive-agent-events.js.map +1 -1
- package/dist/modes/interactive/interactive-deferred-startup.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-deferred-startup.js +11 -3
- package/dist/modes/interactive/interactive-deferred-startup.js.map +1 -1
- package/dist/modes/interactive/interactive-input-handling.js +11 -1
- package/dist/modes/interactive/interactive-input-handling.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-deps.d.ts +1 -1
- package/dist/modes/interactive/interactive-mode-deps.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-deps.js +1 -1
- package/dist/modes/interactive/interactive-mode-deps.js.map +1 -1
- package/dist/modes/interactive/interactive-process-lifecycle.js +34 -7
- package/dist/modes/interactive/interactive-process-lifecycle.js.map +1 -1
- package/dist/modes/interactive/interactive-queueing.d.ts +24 -0
- package/dist/modes/interactive/interactive-queueing.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-queueing.js +61 -0
- package/dist/modes/interactive/interactive-queueing.js.map +1 -1
- package/dist/modes/interactive/interactive-render-chat.js +2 -3
- package/dist/modes/interactive/interactive-render-chat.js.map +1 -1
- package/dist/modes/interactive/interactive-slash-commands.js +2 -2
- package/dist/modes/interactive/interactive-slash-commands.js.map +1 -1
- package/dist/modes/interactive-engine/isolated-runtime.d.ts +2 -0
- package/dist/modes/interactive-engine/isolated-runtime.d.ts.map +1 -1
- package/dist/modes/interactive-engine/isolated-runtime.js +10 -0
- package/dist/modes/interactive-engine/isolated-runtime.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts +2 -0
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +1 -0
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-session-binding.d.ts +3 -1
- package/dist/modes/rpc/rpc-session-binding.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-session-binding.js +4 -1
- package/dist/modes/rpc/rpc-session-binding.js.map +1 -1
- package/docs/background-tasks.md +2 -2
- package/docs/extensions/api-reference.md +1 -1
- package/docs/models/model-selection.md +7 -7
- package/docs/providers.md +12 -17
- package/docs/skills.md +1 -1
- package/docs/subagents.md +3 -1
- package/docs/tools.md +1 -1
- package/docs/usage.md +1 -1
- package/docs/workflows/authoring.md +2 -0
- package/docs/workflows/operations.md +1 -1
- package/npm-shrinkwrap.json +57 -33
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-selector-list.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/session-selector-list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAGN,cAAc,EACd,KAAK,EACL,eAAe,EACf,YAAY,GACZ,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAkC,MAAM,8BAA8B,CAAC;AACrH,OAAO,EAAE,gBAAgB,EAAwB,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACxG,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAEnH;;GAEG;AACH,MAAM,OAAO,WAAW;IAChB,oBAAoB;QAC1B,MAAM,QAAQ,GAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC3D,OAAO,QAAQ,EAAE,OAAO,CAAC,EAAE,CAAC;IAC7B,CAAC;IACO,WAAW,GAAkB,EAAE,CAAC;IAChC,gBAAgB,GAAsB,EAAE,CAAC;IACzC,aAAa,GAAW,CAAC,CAAC;IAC1B,WAAW,CAAQ;IACnB,OAAO,GAAG,KAAK,CAAC;IAChB,QAAQ,GAAa,UAAU,CAAC;IAChC,UAAU,GAAe,KAAK,CAAC;IAC/B,WAAW,CAAqB;IAChC,QAAQ,GAAG,KAAK,CAAC;IACjB,uBAAuB,GAAuB,IAAI,CAAC;IACnD,cAAc,CAAsC;IACrD,QAAQ,CAAkC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G,CAAC;QACD,QAAQ;aACH,IAAI,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,oBAAoB,CAAC,EAAE,CAAC;YACpD,MAAM,QAAQ,GAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YAC3D,IAAI,QAAQ,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;gBAC/B,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;YACjC,CAAC;QACF,CAAC;QACD,kBAAkB;aACb,IAAI,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,mBAAmB,CAAC,EAAE,CAAC;YACnD,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACnB,IAAI,CAAC,QAAQ,EAAE,CAAC;YACjB,CAAC;QACF,CAAC;QACD,uCAAuC;aAClC,CAAC;YACL,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;YACtC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,CAAC;QAClD,CAAC;QACD,OAAO,IAAI,CAAC;IACb,CAAC;CACD","sourcesContent":["import { dirname } from \"node:path\";\nimport {\n\ttype Component,\n\ttype Focusable,\n\tgetKeybindings,\n\tInput,\n\ttruncateToWidth,\n\tvisibleWidth,\n} from \"@earendil-works/pi-tui\";\nimport type { KeybindingsManager } from \"../../../core/keybindings.ts\";\nimport type { SessionInfo } from \"../../../core/session-manager.ts\";\nimport { theme } from \"../theme/theme.js\";\nimport { keyText } from \"./keybinding-hints.js\";\nimport { filterAndSortSessions, hasSessionName, type NameFilter, type SortMode } from \"./session-selector-search.ts\";\nimport { buildSessionTree, type FlatSessionNode, flattenSessionTree } from \"./session-selector-tree.ts\";\nimport { formatSessionDate, getSessionPathKey, shortenPath, truncatePathStart } from \"./session-selector-utils.ts\";\n\n/**\n * Custom session list component with multi-line items and search\n */\nexport class SessionList implements Component, Focusable {\n\tpublic getSelectedSessionId(): string | undefined {\n\t\tconst selected = this.filteredSessions[this.selectedIndex];\n\t\treturn selected?.session.id;\n\t}\n\tprivate allSessions: SessionInfo[] = [];\n\tprivate filteredSessions: FlatSessionNode[] = [];\n\tprivate selectedIndex: number = 0;\n\tprivate searchInput: Input;\n\tprivate showCwd = false;\n\tprivate sortMode: SortMode = \"threaded\";\n\tprivate nameFilter: NameFilter = \"all\";\n\tprivate keybindings: KeybindingsManager;\n\tprivate showPath = false;\n\tprivate confirmingDeleteSession: SessionInfo | null = null;\n\tprivate currentSession?: { id: string; directory?: string };\n\tpublic onSelect?: (session: SessionInfo) => void;\n\tpublic onCancel?: () => void;\n\tpublic onExit: () => void = () => {};\n\tpublic onToggleScope?: () => void;\n\tpublic onToggleSort?: () => void;\n\tpublic onToggleNameFilter?: () => void;\n\tpublic onTogglePath?: (showPath: boolean) => void;\n\tpublic onDeleteConfirmationChange?: (path: string | null) => void;\n\tpublic onDeleteSession?: (sessionPath: string, session: SessionInfo) => Promise<void>;\n\tpublic onRenameSession?: (session: SessionInfo) => void;\n\tpublic onError?: (message: string) => void;\n\tprivate maxVisible: number = 10; // Max sessions visible (one line each)\n\n\t// Focusable implementation - propagate to searchInput for IME cursor positioning\n\tprivate _focused = false;\n\tget focused(): boolean {\n\t\treturn this._focused;\n\t}\n\tset focused(value: boolean) {\n\t\tthis._focused = value;\n\t\tthis.searchInput.focused = value;\n\t}\n\n\tconstructor(\n\t\tsessions: SessionInfo[],\n\t\tshowCwd: boolean,\n\t\tsortMode: SortMode,\n\t\tnameFilter: NameFilter,\n\t\tkeybindings: KeybindingsManager,\n\t\tcurrentSession?: { id: string; directory?: string },\n\t) {\n\t\tthis.allSessions = sessions;\n\t\tthis.filteredSessions = [];\n\t\tthis.searchInput = new Input();\n\t\tthis.showCwd = showCwd;\n\t\tthis.sortMode = sortMode;\n\t\tthis.nameFilter = nameFilter;\n\t\tthis.keybindings = keybindings;\n\t\tthis.currentSession = currentSession;\n\t\tthis.filterSessions(\"\");\n\n\t\t// Handle Enter in search input - select current item\n\t\tthis.searchInput.onSubmit = () => {\n\t\t\tif (this.filteredSessions[this.selectedIndex]) {\n\t\t\t\tconst selected = this.filteredSessions[this.selectedIndex];\n\t\t\t\tif (this.onSelect) {\n\t\t\t\t\tthis.onSelect(selected.session);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t}\n\n\tsetSortMode(sortMode: SortMode): void {\n\t\tthis.sortMode = sortMode;\n\t\tthis.filterSessions(this.searchInput.getValue());\n\t}\n\n\tsetNameFilter(nameFilter: NameFilter): void {\n\t\tthis.nameFilter = nameFilter;\n\t\tthis.filterSessions(this.searchInput.getValue());\n\t}\n\n\tsetSessions(sessions: SessionInfo[], showCwd: boolean): void {\n\t\tthis.allSessions = sessions;\n\t\tthis.showCwd = showCwd;\n\t\tthis.filterSessions(this.searchInput.getValue());\n\t}\n\n\tprivate filterSessions(query: string): void {\n\t\tconst trimmed = query.trim();\n\t\tconst nameFiltered =\n\t\t\tthis.nameFilter === \"all\" ? this.allSessions : this.allSessions.filter((session) => hasSessionName(session));\n\n\t\tif (this.sortMode === \"threaded\" && !trimmed) {\n\t\t\t// Threaded mode without search: show tree structure\n\t\t\tconst roots = buildSessionTree(nameFiltered);\n\t\t\tthis.filteredSessions = flattenSessionTree(roots);\n\t\t} else {\n\t\t\t// Other modes or with search: flat list\n\t\t\tconst filtered = filterAndSortSessions(nameFiltered, query, this.sortMode, \"all\");\n\t\t\tthis.filteredSessions = filtered.map((session) => ({\n\t\t\t\tsession,\n\t\t\t\tdepth: 0,\n\t\t\t\tisLast: true,\n\t\t\t\tancestorContinues: [],\n\t\t\t}));\n\t\t}\n\t\tthis.selectedIndex = Math.min(this.selectedIndex, Math.max(0, this.filteredSessions.length - 1));\n\t}\n\n\tprivate setConfirmingDeleteSession(session: SessionInfo | null): void {\n\t\tthis.confirmingDeleteSession = session;\n\t\tthis.onDeleteConfirmationChange?.(session?.path ?? null);\n\t}\n\n\tprivate startDeleteConfirmationForSelectedSession(): void {\n\t\tconst selected = this.filteredSessions[this.selectedIndex];\n\t\tif (!selected) return;\n\n\t\t// Prevent deleting current session\n\t\tif (this.isCurrentSession(selected.session)) {\n\t\t\tthis.onError?.(\"Cannot delete the currently active session\");\n\t\t\treturn;\n\t\t}\n\n\t\tthis.setConfirmingDeleteSession(selected.session);\n\t}\n\n\tprivate isCurrentSession(session: SessionInfo): boolean {\n\t\treturn (\n\t\t\tthis.currentSession !== undefined &&\n\t\t\tsession.id === this.currentSession.id &&\n\t\t\t(this.currentSession.directory === undefined ||\n\t\t\t\tgetSessionPathKey(dirname(session.path)) === getSessionPathKey(this.currentSession.directory))\n\t\t);\n\t}\n\n\tinvalidate(): void {}\n\n\trender(width: number): string[] {\n\t\tconst lines: string[] = [];\n\n\t\t// Render search input\n\t\tlines.push(...this.searchInput.render(width));\n\t\tlines.push(\"\"); // Blank line after search\n\n\t\tif (this.filteredSessions.length === 0) {\n\t\t\tlet emptyMessage: string;\n\t\t\tif (this.nameFilter === \"named\") {\n\t\t\t\tconst toggleKey = keyText(\"app.session.toggleNamedFilter\");\n\t\t\t\tif (this.showCwd) {\n\t\t\t\t\temptyMessage = ` No named sessions found. Press ${toggleKey} to show all.`;\n\t\t\t\t} else {\n\t\t\t\t\temptyMessage = ` No named sessions in current folder. ${toggleKey} show all · tab view all.`;\n\t\t\t\t}\n\t\t\t} else if (this.showCwd) {\n\t\t\t\t// \"All\" scope - no sessions anywhere that match filter\n\t\t\t\temptyMessage = \" No sessions found\";\n\t\t\t} else {\n\t\t\t\t// \"Current folder\" scope - hint to try \"all\"\n\t\t\t\temptyMessage = \" No sessions in current folder. tab view all.\";\n\t\t\t}\n\t\t\tlines.push(theme.fg(\"muted\", truncateToWidth(emptyMessage, width, \"…\")));\n\t\t\treturn lines;\n\t\t}\n\n\t\t// Calculate visible range with scrolling\n\t\tconst startIndex = Math.max(\n\t\t\t0,\n\t\t\tMath.min(this.selectedIndex - Math.floor(this.maxVisible / 2), this.filteredSessions.length - this.maxVisible),\n\t\t);\n\t\tconst endIndex = Math.min(startIndex + this.maxVisible, this.filteredSessions.length);\n\n\t\t// The summary column only exists when at least one listed row has a summary. Lists that\n\t\t// reuse this component for rows that never carry summaries (durable workflow runs, fresh\n\t\t// installs) keep the single-column layout instead of a screenful of placeholders.\n\t\tconst showSummaryColumn = this.filteredSessions.some((n) => !!n.session.summary?.trim());\n\n\t\t// Render visible sessions (one line each with tree structure)\n\t\tfor (let i = startIndex; i < endIndex; i++) {\n\t\t\tconst node = this.filteredSessions[i]!;\n\t\t\tconst session = node.session;\n\t\t\tconst isSelected = i === this.selectedIndex;\n\t\t\tconst isConfirmingDelete = session === this.confirmingDeleteSession;\n\t\t\tconst isCurrent = this.isCurrentSession(session);\n\n\t\t\t// Build tree prefix\n\t\t\tconst prefix = this.buildTreePrefix(node);\n\n\t\t\t// Session display text (name or first message). A generated summary renders in its\n\t\t\t// own column beside it, so a summary never displaces the identity of the row; rows\n\t\t\t// missing a usable summary show an explicit placeholder there instead.\n\t\t\tconst hasName = !!session.name;\n\t\t\tconst displayText = session.name ?? session.firstMessage;\n\t\t\tconst normalizedMessage = displayText.replace(/[\\x00-\\x1f\\x7f]/g, \" \").trim();\n\t\t\tconst rawSummary = session.summary?.replace(/[\\x00-\\x1f\\x7f]/g, \" \").trim();\n\t\t\tconst hasSummary = !!rawSummary;\n\t\t\tconst summaryText = rawSummary || \"No summary available.\";\n\n\t\t\t// Right side: message count and age\n\t\t\tconst age = formatSessionDate(session.modified);\n\t\t\tconst msgCount = String(session.messageCount);\n\t\t\tconst stats = `${msgCount} ${age}`;\n\t\t\tconst locations: string[] = [];\n\t\t\tif (this.showPath) locations.push(shortenPath(session.path));\n\t\t\tif (this.showCwd && session.cwd) locations.push(shortenPath(session.cwd));\n\n\t\t\t// Cursor\n\t\t\tconst cursor = isSelected ? theme.fg(\"accent\", \"› \") : \" \";\n\n\t\t\t// Calculate available width, split between the identity column and the summary column\n\t\t\tconst prefixWidth = visibleWidth(prefix);\n\t\t\tconst summaryGutter = 2;\n\t\t\tconst identityWidth =\n\t\t\t\tMath.max(10, visibleWidth(normalizedMessage)) +\n\t\t\t\t(showSummaryColumn ? summaryGutter + Math.max(10, visibleWidth(summaryText)) : 0);\n\t\t\tconst identityAndLocationWidth = width - 2 - prefixWidth - (visibleWidth(stats) + 2) - 1;\n\t\t\tconst location = truncatePathStart(\n\t\t\t\tlocations.join(\" \"),\n\t\t\t\tMath.max(Math.floor(identityAndLocationWidth / 2), identityAndLocationWidth - identityWidth),\n\t\t\t);\n\t\t\tconst rightPart = location ? `${location} ${stats}` : stats;\n\t\t\tconst rightWidth = visibleWidth(rightPart) + 2; // +2 for spacing\n\t\t\tconst availableForMsg = width - 2 - prefixWidth - rightWidth; // -2 for cursor\n\t\t\tconst defaultMsgColWidth = Math.max(10, Math.floor(availableForMsg * 0.45));\n\t\t\tconst msgColWidth = showSummaryColumn\n\t\t\t\t? Math.max(defaultMsgColWidth, availableForMsg - summaryGutter - Math.max(10, visibleWidth(summaryText)))\n\t\t\t\t: Math.max(10, availableForMsg);\n\t\t\tconst summaryColWidth = showSummaryColumn ? availableForMsg - msgColWidth - summaryGutter : 0;\n\n\t\t\tconst truncatedMsg = truncateToWidth(normalizedMessage, msgColWidth, \"…\");\n\n\t\t\t// Style message\n\t\t\tlet messageColor: \"error\" | \"warning\" | \"accent\" | \"success\" | null = null;\n\t\t\tif (isConfirmingDelete) {\n\t\t\t\tmessageColor = \"error\";\n\t\t\t} else if (isCurrent) {\n\t\t\t\tmessageColor = \"accent\";\n\t\t\t} else if (session.messageColor !== undefined) {\n\t\t\t\tmessageColor = session.messageColor;\n\t\t\t} else if (hasName) {\n\t\t\t\tmessageColor = \"warning\";\n\t\t\t}\n\t\t\tlet styledMsg = messageColor ? theme.fg(messageColor, truncatedMsg) : truncatedMsg;\n\t\t\tif (isSelected) {\n\t\t\t\tstyledMsg = theme.bold(styledMsg);\n\t\t\t}\n\n\t\t\t// Summary column: dim for a real summary, muted italic for the placeholder. Skipped\n\t\t\t// entirely when the terminal is too narrow to show anything useful.\n\t\t\tlet summaryCell = \"\";\n\t\t\tif (summaryColWidth >= 10) {\n\t\t\t\tconst truncatedSummary = truncateToWidth(summaryText, summaryColWidth, \"…\");\n\t\t\t\tconst styledSummary = hasSummary\n\t\t\t\t\t? theme.fg(\"dim\", truncatedSummary)\n\t\t\t\t\t: theme.italic(theme.fg(\"muted\", truncatedSummary));\n\t\t\t\tconst pad = \" \".repeat(Math.max(0, msgColWidth - visibleWidth(truncatedMsg)) + summaryGutter);\n\t\t\t\tsummaryCell = pad + styledSummary;\n\t\t\t}\n\n\t\t\t// Build line\n\t\t\tconst leftPart = cursor + theme.fg(\"dim\", prefix) + styledMsg + summaryCell;\n\t\t\tconst leftWidth = visibleWidth(leftPart);\n\t\t\tconst spacing = Math.max(1, width - leftWidth - visibleWidth(rightPart));\n\t\t\tconst styledRight = theme.fg(isConfirmingDelete ? \"error\" : \"dim\", rightPart);\n\n\t\t\tlet line = leftPart + \" \".repeat(spacing) + styledRight;\n\t\t\tif (isSelected) {\n\t\t\t\tline = theme.bg(\"selectedBg\", line);\n\t\t\t}\n\t\t\tlines.push(truncateToWidth(line, width));\n\t\t}\n\n\t\t// Add scroll indicator if needed\n\t\tif (startIndex > 0 || endIndex < this.filteredSessions.length) {\n\t\t\tconst scrollText = ` (${this.selectedIndex + 1}/${this.filteredSessions.length})`;\n\t\t\tconst scrollInfo = theme.fg(\"muted\", truncateToWidth(scrollText, width, \"\"));\n\t\t\tlines.push(scrollInfo);\n\t\t}\n\n\t\treturn lines;\n\t}\n\n\tprivate buildTreePrefix(node: FlatSessionNode): string {\n\t\tif (node.depth === 0) {\n\t\t\treturn \"\";\n\t\t}\n\n\t\tconst parts = node.ancestorContinues.map((continues) => (continues ? \"│ \" : \" \"));\n\t\tconst branch = node.isLast ? \"└─ \" : \"├─ \";\n\t\treturn parts.join(\"\") + branch;\n\t}\n\n\thandleInput(keyData: string): boolean {\n\t\tconst kb = getKeybindings();\n\n\t\t// Handle delete confirmation state first - intercept all keys\n\t\tif (this.confirmingDeleteSession !== null) {\n\t\t\tif (kb.matches(keyData, \"tui.select.confirm\")) {\n\t\t\t\tconst session = this.confirmingDeleteSession;\n\t\t\t\tthis.setConfirmingDeleteSession(null);\n\t\t\t\tvoid this.onDeleteSession?.(session.path, session);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tif (kb.matches(keyData, \"tui.select.cancel\")) {\n\t\t\t\tthis.setConfirmingDeleteSession(null);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t// Ignore all other keys while confirming\n\t\t\treturn true;\n\t\t}\n\n\t\tif (kb.matches(keyData, \"tui.input.tab\")) {\n\t\t\tif (this.onToggleScope) {\n\t\t\t\tthis.onToggleScope();\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\n\t\tif (kb.matches(keyData, \"app.session.toggleSort\")) {\n\t\t\tthis.onToggleSort?.();\n\t\t\treturn true;\n\t\t}\n\n\t\tif (this.keybindings.matches(keyData, \"app.session.toggleNamedFilter\")) {\n\t\t\tthis.onToggleNameFilter?.();\n\t\t\treturn true;\n\t\t}\n\n\t\t// Ctrl+P: toggle path display\n\t\tif (kb.matches(keyData, \"app.session.togglePath\")) {\n\t\t\tthis.showPath = !this.showPath;\n\t\t\tthis.onTogglePath?.(this.showPath);\n\t\t\treturn true;\n\t\t}\n\n\t\t// Ctrl+D: initiate delete confirmation (useful on terminals that don't distinguish Ctrl+Backspace from Backspace)\n\t\tif (kb.matches(keyData, \"app.session.delete\")) {\n\t\t\tthis.startDeleteConfirmationForSelectedSession();\n\t\t\treturn true;\n\t\t}\n\n\t\t// Rename selected session\n\t\tif (kb.matches(keyData, \"app.session.rename\")) {\n\t\t\tconst selected = this.filteredSessions[this.selectedIndex];\n\t\t\tif (selected) {\n\t\t\t\tthis.onRenameSession?.(selected.session);\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\n\t\t// Ctrl+Backspace: non-invasive convenience alias for delete\n\t\t// Only triggers deletion when the query is empty; otherwise it is forwarded to the input\n\t\tif (kb.matches(keyData, \"app.session.deleteNoninvasive\")) {\n\t\t\tif (this.searchInput.getValue().length > 0) {\n\t\t\t\tthis.searchInput.handleInput(keyData);\n\t\t\t\tthis.filterSessions(this.searchInput.getValue());\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tthis.startDeleteConfirmationForSelectedSession();\n\t\t\treturn true;\n\t\t}\n\n\t\t// Up arrow\n\t\tif (kb.matches(keyData, \"tui.select.up\")) {\n\t\t\tthis.selectedIndex = Math.max(0, this.selectedIndex - 1);\n\t\t}\n\t\t// Down arrow\n\t\telse if (kb.matches(keyData, \"tui.select.down\")) {\n\t\t\tthis.selectedIndex = Math.min(this.filteredSessions.length - 1, this.selectedIndex + 1);\n\t\t}\n\t\t// Page up - jump up by maxVisible items\n\t\telse if (kb.matches(keyData, \"tui.select.pageUp\")) {\n\t\t\tthis.selectedIndex = Math.max(0, this.selectedIndex - this.maxVisible);\n\t\t}\n\t\t// Page down - jump down by maxVisible items\n\t\telse if (kb.matches(keyData, \"tui.select.pageDown\")) {\n\t\t\tthis.selectedIndex = Math.min(this.filteredSessions.length - 1, this.selectedIndex + this.maxVisible);\n\t\t}\n\t\t// Enter\n\t\telse if (kb.matches(keyData, \"tui.select.confirm\")) {\n\t\t\tconst selected = this.filteredSessions[this.selectedIndex];\n\t\t\tif (selected && this.onSelect) {\n\t\t\t\tthis.onSelect(selected.session);\n\t\t\t}\n\t\t}\n\t\t// Escape - cancel\n\t\telse if (kb.matches(keyData, \"tui.select.cancel\")) {\n\t\t\tif (this.onCancel) {\n\t\t\t\tthis.onCancel();\n\t\t\t}\n\t\t}\n\t\t// Pass everything else to search input\n\t\telse {\n\t\t\tthis.searchInput.handleInput(keyData);\n\t\t\tthis.filterSessions(this.searchInput.getValue());\n\t\t}\n\t\treturn true;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"session-selector-list.js","sourceRoot":"","sources":["../../../../src/modes/interact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AAE,CAAC;YACnD,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACnB,IAAI,CAAC,QAAQ,EAAE,CAAC;YACjB,CAAC;QACF,CAAC;QACD,uCAAuC;aAClC,CAAC;YACL,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;YACtC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,CAAC;QAClD,CAAC;QACD,OAAO,IAAI,CAAC;IACb,CAAC;CACD","sourcesContent":["import { dirname } from \"node:path\";\nimport {\n\ttype Component,\n\ttype Focusable,\n\tgetKeybindings,\n\tInput,\n\ttruncateToWidth,\n\tvisibleWidth,\n} from \"@earendil-works/pi-tui\";\nimport type { KeybindingsManager } from \"../../../core/keybindings.ts\";\nimport type { SessionInfo } from \"../../../core/session-manager.ts\";\nimport { theme } from \"../theme/theme.js\";\nimport { keyText } from \"./keybinding-hints.js\";\nimport { filterAndSortSessions, hasSessionName, type NameFilter, type SortMode } from \"./session-selector-search.ts\";\nimport { buildSessionTree, type FlatSessionNode, flattenSessionTree } from \"./session-selector-tree.ts\";\nimport { formatSessionDate, getSessionPathKey, shortenPath, truncatePathStart } from \"./session-selector-utils.ts\";\n\n/**\n * Custom session list component with multi-line items and search\n */\nexport class SessionList implements Component, Focusable {\n\tpublic getSelectedSessionId(): string | undefined {\n\t\tconst selected = this.filteredSessions[this.selectedIndex];\n\t\treturn selected?.session.id;\n\t}\n\tpublic getSelectedSessionPath(): string | undefined {\n\t\tconst selected = this.filteredSessions[this.selectedIndex];\n\t\treturn selected?.session.path;\n\t}\n\tprivate allSessions: SessionInfo[] = [];\n\tprivate filteredSessions: FlatSessionNode[] = [];\n\tprivate selectedIndex: number = 0;\n\tprivate selectionTouched = false;\n\tprivate pendingSelectedPath?: string;\n\tprivate searchInput: Input;\n\tprivate showCwd = false;\n\tprivate sortMode: SortMode = \"threaded\";\n\tprivate nameFilter: NameFilter = \"all\";\n\tprivate keybindings: KeybindingsManager;\n\tprivate showPath = false;\n\tprivate confirmingDeleteSession: SessionInfo | null = null;\n\tprivate currentSession?: { id: string; directory?: string };\n\tpublic onSelect?: (session: SessionInfo) => void;\n\tpublic onCancel?: () => void;\n\tpublic onExit: () => void = () => {};\n\tpublic onToggleScope?: () => void;\n\tpublic onToggleSort?: () => void;\n\tpublic onToggleNameFilter?: () => void;\n\tpublic onTogglePath?: (showPath: boolean) => void;\n\tpublic onDeleteConfirmationChange?: (path: string | null) => void;\n\tpublic onDeleteSession?: (sessionPath: string, session: SessionInfo) => Promise<void>;\n\tpublic onRenameSession?: (session: SessionInfo) => void;\n\tpublic onError?: (message: string) => void;\n\tprivate maxVisible: number = 10; // Max sessions visible (one line each)\n\n\t// Focusable implementation - propagate to searchInput for IME cursor positioning\n\tprivate _focused = false;\n\tget focused(): boolean {\n\t\treturn this._focused;\n\t}\n\tset focused(value: boolean) {\n\t\tthis._focused = value;\n\t\tthis.searchInput.focused = value;\n\t}\n\n\tconstructor(\n\t\tsessions: SessionInfo[],\n\t\tshowCwd: boolean,\n\t\tsortMode: SortMode,\n\t\tnameFilter: NameFilter,\n\t\tkeybindings: KeybindingsManager,\n\t\tcurrentSession?: { id: string; directory?: string },\n\t) {\n\t\tthis.allSessions = sessions;\n\t\tthis.filteredSessions = [];\n\t\tthis.searchInput = new Input();\n\t\tthis.showCwd = showCwd;\n\t\tthis.sortMode = sortMode;\n\t\tthis.nameFilter = nameFilter;\n\t\tthis.keybindings = keybindings;\n\t\tthis.currentSession = currentSession;\n\t\tthis.filterSessions(\"\");\n\n\t\t// Handle Enter in search input - select current item\n\t\tthis.searchInput.onSubmit = () => {\n\t\t\tif (this.filteredSessions[this.selectedIndex]) {\n\t\t\t\tconst selected = this.filteredSessions[this.selectedIndex];\n\t\t\t\tif (this.onSelect) {\n\t\t\t\t\tthis.onSelect(selected.session);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t}\n\n\tsetSortMode(sortMode: SortMode): void {\n\t\tthis.sortMode = sortMode;\n\t\tthis.filterSessions(this.searchInput.getValue());\n\t}\n\n\tsetNameFilter(nameFilter: NameFilter): void {\n\t\tthis.nameFilter = nameFilter;\n\t\tthis.filterSessions(this.searchInput.getValue());\n\t}\n\n\tsetSessions(sessions: SessionInfo[], showCwd: boolean, partial = false): void {\n\t\tconst selectedPath = this.selectionTouched\n\t\t\t? (this.pendingSelectedPath ?? this.getSelectedSessionPath())\n\t\t\t: undefined;\n\t\tthis.allSessions = sessions;\n\t\tthis.showCwd = showCwd;\n\t\tthis.filterSessions(this.searchInput.getValue());\n\t\tif (!selectedPath) return;\n\t\tconst selectedIndex = this.filteredSessions.findIndex((node) => node.session.path === selectedPath);\n\t\tif (selectedIndex >= 0) {\n\t\t\tthis.selectedIndex = selectedIndex;\n\t\t\tthis.pendingSelectedPath = undefined;\n\t\t} else {\n\t\t\tthis.pendingSelectedPath = partial ? selectedPath : undefined;\n\t\t}\n\t}\n\n\tprivate filterSessions(query: string): void {\n\t\tconst trimmed = query.trim();\n\t\tconst nameFiltered =\n\t\t\tthis.nameFilter === \"all\" ? this.allSessions : this.allSessions.filter((session) => hasSessionName(session));\n\n\t\tif (this.sortMode === \"threaded\" && !trimmed) {\n\t\t\t// Threaded mode without search: show tree structure\n\t\t\tconst roots = buildSessionTree(nameFiltered);\n\t\t\tthis.filteredSessions = flattenSessionTree(roots);\n\t\t} else {\n\t\t\t// Other modes or with search: flat list\n\t\t\tconst filtered = filterAndSortSessions(nameFiltered, query, this.sortMode, \"all\");\n\t\t\tthis.filteredSessions = filtered.map((session) => ({\n\t\t\t\tsession,\n\t\t\t\tdepth: 0,\n\t\t\t\tisLast: true,\n\t\t\t\tancestorContinues: [],\n\t\t\t}));\n\t\t}\n\t\tthis.selectedIndex = Math.min(this.selectedIndex, Math.max(0, this.filteredSessions.length - 1));\n\t}\n\n\tprivate setConfirmingDeleteSession(session: SessionInfo | null): void {\n\t\tthis.confirmingDeleteSession = session;\n\t\tthis.onDeleteConfirmationChange?.(session?.path ?? null);\n\t}\n\n\tprivate startDeleteConfirmationForSelectedSession(): void {\n\t\tconst selected = this.filteredSessions[this.selectedIndex];\n\t\tif (!selected) return;\n\n\t\t// Prevent deleting current session\n\t\tif (this.isCurrentSession(selected.session)) {\n\t\t\tthis.onError?.(\"Cannot delete the currently active session\");\n\t\t\treturn;\n\t\t}\n\n\t\tthis.setConfirmingDeleteSession(selected.session);\n\t}\n\n\tprivate isCurrentSession(session: SessionInfo): boolean {\n\t\treturn (\n\t\t\tthis.currentSession !== undefined &&\n\t\t\tsession.id === this.currentSession.id &&\n\t\t\t(this.currentSession.directory === undefined ||\n\t\t\t\tgetSessionPathKey(dirname(session.path)) === getSessionPathKey(this.currentSession.directory))\n\t\t);\n\t}\n\n\tinvalidate(): void {}\n\n\trender(width: number): string[] {\n\t\tconst lines: string[] = [];\n\n\t\t// Render search input\n\t\tlines.push(...this.searchInput.render(width));\n\t\tlines.push(\"\"); // Blank line after search\n\n\t\tif (this.filteredSessions.length === 0) {\n\t\t\tlet emptyMessage: string;\n\t\t\tif (this.nameFilter === \"named\") {\n\t\t\t\tconst toggleKey = keyText(\"app.session.toggleNamedFilter\");\n\t\t\t\tif (this.showCwd) {\n\t\t\t\t\temptyMessage = ` No named sessions found. Press ${toggleKey} to show all.`;\n\t\t\t\t} else {\n\t\t\t\t\temptyMessage = ` No named sessions in current folder. ${toggleKey} show all · tab view all.`;\n\t\t\t\t}\n\t\t\t} else if (this.showCwd) {\n\t\t\t\t// \"All\" scope - no sessions anywhere that match filter\n\t\t\t\temptyMessage = \" No sessions found\";\n\t\t\t} else {\n\t\t\t\t// \"Current folder\" scope - hint to try \"all\"\n\t\t\t\temptyMessage = \" No sessions in current folder. tab view all.\";\n\t\t\t}\n\t\t\tlines.push(theme.fg(\"muted\", truncateToWidth(emptyMessage, width, \"…\")));\n\t\t\treturn lines;\n\t\t}\n\n\t\t// Calculate visible range with scrolling\n\t\tconst startIndex = Math.max(\n\t\t\t0,\n\t\t\tMath.min(this.selectedIndex - Math.floor(this.maxVisible / 2), this.filteredSessions.length - this.maxVisible),\n\t\t);\n\t\tconst endIndex = Math.min(startIndex + this.maxVisible, this.filteredSessions.length);\n\n\t\t// The summary column only exists when at least one listed row has a summary. Lists that\n\t\t// reuse this component for rows that never carry summaries (durable workflow runs, fresh\n\t\t// installs) keep the single-column layout instead of a screenful of placeholders.\n\t\tconst showSummaryColumn = this.filteredSessions.some((n) => !!n.session.summary?.trim());\n\n\t\t// Render visible sessions (one line each with tree structure)\n\t\tfor (let i = startIndex; i < endIndex; i++) {\n\t\t\tconst node = this.filteredSessions[i]!;\n\t\t\tconst session = node.session;\n\t\t\tconst isSelected = i === this.selectedIndex;\n\t\t\tconst isConfirmingDelete = session === this.confirmingDeleteSession;\n\t\t\tconst isCurrent = this.isCurrentSession(session);\n\n\t\t\t// Build tree prefix\n\t\t\tconst prefix = this.buildTreePrefix(node);\n\n\t\t\t// Session display text (name or first message). A generated summary renders in its\n\t\t\t// own column beside it, so a summary never displaces the identity of the row; rows\n\t\t\t// missing a usable summary show an explicit placeholder there instead.\n\t\t\tconst hasName = !!session.name;\n\t\t\tconst displayText = session.name ?? session.firstMessage;\n\t\t\tconst normalizedMessage = displayText.replace(/[\\x00-\\x1f\\x7f]/g, \" \").trim();\n\t\t\tconst rawSummary = session.summary?.replace(/[\\x00-\\x1f\\x7f]/g, \" \").trim();\n\t\t\tconst hasSummary = !!rawSummary;\n\t\t\tconst summaryText = rawSummary || \"No summary available.\";\n\n\t\t\t// Right side: message count and age\n\t\t\tconst age = formatSessionDate(session.modified);\n\t\t\tconst msgCount = String(session.messageCount);\n\t\t\tconst stats = `${msgCount} ${age}`;\n\t\t\tconst locations: string[] = [];\n\t\t\tif (this.showPath) locations.push(shortenPath(session.path));\n\t\t\tif (this.showCwd && session.cwd) locations.push(shortenPath(session.cwd));\n\n\t\t\t// Cursor\n\t\t\tconst cursor = isSelected ? theme.fg(\"accent\", \"› \") : \" \";\n\n\t\t\t// Calculate available width, split between the identity column and the summary column\n\t\t\tconst prefixWidth = visibleWidth(prefix);\n\t\t\tconst summaryGutter = 2;\n\t\t\tconst identityWidth =\n\t\t\t\tMath.max(10, visibleWidth(normalizedMessage)) +\n\t\t\t\t(showSummaryColumn ? summaryGutter + Math.max(10, visibleWidth(summaryText)) : 0);\n\t\t\tconst identityAndLocationWidth = width - 2 - prefixWidth - (visibleWidth(stats) + 2) - 1;\n\t\t\tconst location = truncatePathStart(\n\t\t\t\tlocations.join(\" \"),\n\t\t\t\tMath.max(Math.floor(identityAndLocationWidth / 2), identityAndLocationWidth - identityWidth),\n\t\t\t);\n\t\t\tconst rightPart = location ? `${location} ${stats}` : stats;\n\t\t\tconst rightWidth = visibleWidth(rightPart) + 2; // +2 for spacing\n\t\t\tconst availableForMsg = width - 2 - prefixWidth - rightWidth; // -2 for cursor\n\t\t\tconst defaultMsgColWidth = Math.max(10, Math.floor(availableForMsg * 0.45));\n\t\t\tconst msgColWidth = showSummaryColumn\n\t\t\t\t? Math.max(defaultMsgColWidth, availableForMsg - summaryGutter - Math.max(10, visibleWidth(summaryText)))\n\t\t\t\t: Math.max(10, availableForMsg);\n\t\t\tconst summaryColWidth = showSummaryColumn ? availableForMsg - msgColWidth - summaryGutter : 0;\n\n\t\t\tconst truncatedMsg = truncateToWidth(normalizedMessage, msgColWidth, \"…\");\n\n\t\t\t// Style message\n\t\t\tlet messageColor: \"error\" | \"warning\" | \"accent\" | \"success\" | null = null;\n\t\t\tif (isConfirmingDelete) {\n\t\t\t\tmessageColor = \"error\";\n\t\t\t} else if (isCurrent) {\n\t\t\t\tmessageColor = \"accent\";\n\t\t\t} else if (session.messageColor !== undefined) {\n\t\t\t\tmessageColor = session.messageColor;\n\t\t\t} else if (hasName) {\n\t\t\t\tmessageColor = \"warning\";\n\t\t\t}\n\t\t\tlet styledMsg = messageColor ? theme.fg(messageColor, truncatedMsg) : truncatedMsg;\n\t\t\tif (isSelected) {\n\t\t\t\tstyledMsg = theme.bold(styledMsg);\n\t\t\t}\n\n\t\t\t// Summary column: dim for a real summary, muted italic for the placeholder. Skipped\n\t\t\t// entirely when the terminal is too narrow to show anything useful.\n\t\t\tlet summaryCell = \"\";\n\t\t\tif (summaryColWidth >= 10) {\n\t\t\t\tconst truncatedSummary = truncateToWidth(summaryText, summaryColWidth, \"…\");\n\t\t\t\tconst styledSummary = hasSummary\n\t\t\t\t\t? theme.fg(\"dim\", truncatedSummary)\n\t\t\t\t\t: theme.italic(theme.fg(\"muted\", truncatedSummary));\n\t\t\t\tconst pad = \" \".repeat(Math.max(0, msgColWidth - visibleWidth(truncatedMsg)) + summaryGutter);\n\t\t\t\tsummaryCell = pad + styledSummary;\n\t\t\t}\n\n\t\t\t// Build line\n\t\t\tconst leftPart = cursor + theme.fg(\"dim\", prefix) + styledMsg + summaryCell;\n\t\t\tconst leftWidth = visibleWidth(leftPart);\n\t\t\tconst spacing = Math.max(1, width - leftWidth - visibleWidth(rightPart));\n\t\t\tconst styledRight = theme.fg(isConfirmingDelete ? \"error\" : \"dim\", rightPart);\n\n\t\t\tlet line = leftPart + \" \".repeat(spacing) + styledRight;\n\t\t\tif (isSelected) {\n\t\t\t\tline = theme.bg(\"selectedBg\", line);\n\t\t\t}\n\t\t\tlines.push(truncateToWidth(line, width));\n\t\t}\n\n\t\t// Add scroll indicator if needed\n\t\tif (startIndex > 0 || endIndex < this.filteredSessions.length) {\n\t\t\tconst scrollText = ` (${this.selectedIndex + 1}/${this.filteredSessions.length})`;\n\t\t\tconst scrollInfo = theme.fg(\"muted\", truncateToWidth(scrollText, width, \"\"));\n\t\t\tlines.push(scrollInfo);\n\t\t}\n\n\t\treturn lines;\n\t}\n\n\tprivate buildTreePrefix(node: FlatSessionNode): string {\n\t\tif (node.depth === 0) {\n\t\t\treturn \"\";\n\t\t}\n\n\t\tconst parts = node.ancestorContinues.map((continues) => (continues ? \"│ \" : \" \"));\n\t\tconst branch = node.isLast ? \"└─ \" : \"├─ \";\n\t\treturn parts.join(\"\") + branch;\n\t}\n\n\thandleInput(keyData: string): boolean {\n\t\tconst kb = getKeybindings();\n\n\t\t// Handle delete confirmation state first - intercept all keys\n\t\tif (this.confirmingDeleteSession !== null) {\n\t\t\tif (kb.matches(keyData, \"tui.select.confirm\")) {\n\t\t\t\tconst session = this.confirmingDeleteSession;\n\t\t\t\tthis.setConfirmingDeleteSession(null);\n\t\t\t\tvoid this.onDeleteSession?.(session.path, session);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tif (kb.matches(keyData, \"tui.select.cancel\")) {\n\t\t\t\tthis.setConfirmingDeleteSession(null);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t// Ignore all other keys while confirming\n\t\t\treturn true;\n\t\t}\n\n\t\tif (kb.matches(keyData, \"tui.input.tab\")) {\n\t\t\tif (this.onToggleScope) {\n\t\t\t\tthis.onToggleScope();\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\n\t\tif (kb.matches(keyData, \"app.session.toggleSort\")) {\n\t\t\tthis.onToggleSort?.();\n\t\t\treturn true;\n\t\t}\n\n\t\tif (this.keybindings.matches(keyData, \"app.session.toggleNamedFilter\")) {\n\t\t\tthis.onToggleNameFilter?.();\n\t\t\treturn true;\n\t\t}\n\n\t\t// Ctrl+P: toggle path display\n\t\tif (kb.matches(keyData, \"app.session.togglePath\")) {\n\t\t\tthis.showPath = !this.showPath;\n\t\t\tthis.onTogglePath?.(this.showPath);\n\t\t\treturn true;\n\t\t}\n\n\t\t// Ctrl+D: initiate delete confirmation (useful on terminals that don't distinguish Ctrl+Backspace from Backspace)\n\t\tif (kb.matches(keyData, \"app.session.delete\")) {\n\t\t\tthis.startDeleteConfirmationForSelectedSession();\n\t\t\treturn true;\n\t\t}\n\n\t\t// Rename selected session\n\t\tif (kb.matches(keyData, \"app.session.rename\")) {\n\t\t\tconst selected = this.filteredSessions[this.selectedIndex];\n\t\t\tif (selected) {\n\t\t\t\tthis.selectionTouched = true;\n\t\t\t\tthis.pendingSelectedPath = selected.session.path;\n\t\t\t\tthis.onRenameSession?.(selected.session);\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\n\t\t// Ctrl+Backspace: non-invasive convenience alias for delete\n\t\t// Only triggers deletion when the query is empty; otherwise it is forwarded to the input\n\t\tif (kb.matches(keyData, \"app.session.deleteNoninvasive\")) {\n\t\t\tif (this.searchInput.getValue().length > 0) {\n\t\t\t\tthis.searchInput.handleInput(keyData);\n\t\t\t\tthis.filterSessions(this.searchInput.getValue());\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tthis.startDeleteConfirmationForSelectedSession();\n\t\t\treturn true;\n\t\t}\n\n\t\tthis.selectionTouched = true;\n\t\tthis.pendingSelectedPath = undefined;\n\t\t// Up arrow\n\t\tif (kb.matches(keyData, \"tui.select.up\")) {\n\t\t\tthis.selectedIndex = Math.max(0, this.selectedIndex - 1);\n\t\t}\n\t\t// Down arrow\n\t\telse if (kb.matches(keyData, \"tui.select.down\")) {\n\t\t\tthis.selectedIndex = Math.min(this.filteredSessions.length - 1, this.selectedIndex + 1);\n\t\t}\n\t\t// Page up - jump up by maxVisible items\n\t\telse if (kb.matches(keyData, \"tui.select.pageUp\")) {\n\t\t\tthis.selectedIndex = Math.max(0, this.selectedIndex - this.maxVisible);\n\t\t}\n\t\t// Page down - jump down by maxVisible items\n\t\telse if (kb.matches(keyData, \"tui.select.pageDown\")) {\n\t\t\tthis.selectedIndex = Math.min(this.filteredSessions.length - 1, this.selectedIndex + this.maxVisible);\n\t\t}\n\t\t// Enter\n\t\telse if (kb.matches(keyData, \"tui.select.confirm\")) {\n\t\t\tconst selected = this.filteredSessions[this.selectedIndex];\n\t\t\tif (selected && this.onSelect) {\n\t\t\t\tthis.onSelect(selected.session);\n\t\t\t}\n\t\t}\n\t\t// Escape - cancel\n\t\telse if (kb.matches(keyData, \"tui.select.cancel\")) {\n\t\t\tif (this.onCancel) {\n\t\t\t\tthis.onCancel();\n\t\t\t}\n\t\t}\n\t\t// Pass everything else to search input\n\t\telse {\n\t\t\tthis.searchInput.handleInput(keyData);\n\t\t\tthis.filterSessions(this.searchInput.getValue());\n\t\t}\n\t\treturn true;\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-selector.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/session-selector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,SAAS,EAAE,KAAK,SAAS,EAAuC,MAAM,wBAAwB,CAAC;AACxH,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"session-selector.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/session-selector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,SAAS,EAAE,KAAK,SAAS,EAAuC,MAAM,wBAAwB,CAAC;AACxH,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EAAE,WAAW,EAAuB,MAAM,kCAAkC,CAAC;AAMzF,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEzD,OAAO,KAAK,EAAgB,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAEhF;;GAEG;AACH,qBAAa,wBAAyB,SAAQ,SAAU,YAAW,SAAS;IAC3E,IAAI,qBAAqB,IAAI,OAAO,CAEnC;IAED,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAYjC;IAED,OAAO,CAAC,SAAS,CAAQ;IACzB,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,MAAM,CAAwB;IACtC,OAAO,CAAC,WAAW,CAAqB;IACxC,OAAO,CAAC,KAAK,CAA2B;IACxC,OAAO,CAAC,QAAQ,CAAwB;IACxC,OAAO,CAAC,UAAU,CAAqB;IACvC,OAAO,CAAC,eAAe,CAA8B;IACrD,OAAO,CAAC,WAAW,CAA8B;IACjD,OAAO,CAAC,qBAAqB,CAAiB;IAC9C,OA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e;IAuBvB,OAAO,CAAC,cAAc;YASR,aAAa;YAwBb,SAAS;IAoFvB,OAAO,CAAC,cAAc;IAQtB,OAAO,CAAC,gBAAgB;YAOV,4BAA4B;IAI1C,OAAO,CAAC,WAAW;IAanB,cAAc,IAAI,WAAW,CAE5B;IAED;;;;OAIG;IACH,OAAO,IAAI,IAAI,CAMd;CACD"}
|
|
@@ -41,6 +41,7 @@ export class SessionSelectorComponent extends Container {
|
|
|
41
41
|
renameSession;
|
|
42
42
|
currentLoading = false;
|
|
43
43
|
allLoading = false;
|
|
44
|
+
currentLoadSeq = 0;
|
|
44
45
|
allLoadSeq = 0;
|
|
45
46
|
disposed = false;
|
|
46
47
|
mode = "list";
|
|
@@ -116,10 +117,6 @@ export class SessionSelectorComponent extends Container {
|
|
|
116
117
|
this.sessionList.onRenameSession = (session) => {
|
|
117
118
|
if (!renameSession)
|
|
118
119
|
return;
|
|
119
|
-
if (this.scope === "current" && this.currentLoading)
|
|
120
|
-
return;
|
|
121
|
-
if (this.scope === "all" && this.allLoading)
|
|
122
|
-
return;
|
|
123
120
|
this.enterRenameMode(session);
|
|
124
121
|
};
|
|
125
122
|
// Sync list events to header
|
|
@@ -227,22 +224,35 @@ export class SessionSelectorComponent extends Container {
|
|
|
227
224
|
else {
|
|
228
225
|
this.allLoading = true;
|
|
229
226
|
}
|
|
230
|
-
const seq = scope === "
|
|
227
|
+
const seq = scope === "current" ? ++this.currentLoadSeq : ++this.allLoadSeq;
|
|
228
|
+
const isActive = () => !this.disposed && (scope === "current" ? this.currentLoadSeq : this.allLoadSeq) === seq;
|
|
231
229
|
this.header.setScope(scope);
|
|
232
230
|
this.header.setLoading(true);
|
|
233
231
|
this.requestRender();
|
|
234
|
-
const onProgress = (loaded, total) => {
|
|
235
|
-
if (
|
|
232
|
+
const onProgress = (loaded, total, partialSessions) => {
|
|
233
|
+
if (!isActive())
|
|
236
234
|
return;
|
|
235
|
+
if (partialSessions) {
|
|
236
|
+
const sessions = partialSessions.filter(isResumableSession);
|
|
237
|
+
if (scope === "current") {
|
|
238
|
+
this.currentSessions = sessions;
|
|
239
|
+
}
|
|
240
|
+
else {
|
|
241
|
+
this.allSessions = sessions;
|
|
242
|
+
}
|
|
243
|
+
if (scope === this.scope) {
|
|
244
|
+
this.sessionList.setSessions(sessions, showCwd, true);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
237
247
|
if (scope !== this.scope)
|
|
238
248
|
return;
|
|
239
|
-
if (seq !== undefined && seq !== this.allLoadSeq)
|
|
240
|
-
return;
|
|
241
249
|
this.header.setProgress(loaded, total);
|
|
242
250
|
this.requestRender();
|
|
243
251
|
};
|
|
244
252
|
try {
|
|
245
253
|
const sessions = (await (scope === "current" ? this.currentSessionsLoader(onProgress) : this.allSessionsLoader(onProgress))).filter(isResumableSession);
|
|
254
|
+
if (!isActive())
|
|
255
|
+
return;
|
|
246
256
|
if (scope === "current") {
|
|
247
257
|
this.currentSessions = sessions;
|
|
248
258
|
this.currentLoading = false;
|
|
@@ -251,14 +261,8 @@ export class SessionSelectorComponent extends Container {
|
|
|
251
261
|
this.allSessions = sessions;
|
|
252
262
|
this.allLoading = false;
|
|
253
263
|
}
|
|
254
|
-
// Stale-result guards: ignore a resolved load after the selector was
|
|
255
|
-
// closed, the visible scope changed, or a newer all-scope load started.
|
|
256
|
-
if (this.disposed)
|
|
257
|
-
return;
|
|
258
264
|
if (scope !== this.scope)
|
|
259
265
|
return;
|
|
260
|
-
if (seq !== undefined && seq !== this.allLoadSeq)
|
|
261
|
-
return;
|
|
262
266
|
this.header.setLoading(false);
|
|
263
267
|
this.sessionList.setSessions(sessions, showCwd);
|
|
264
268
|
this.requestRender();
|
|
@@ -267,18 +271,16 @@ export class SessionSelectorComponent extends Container {
|
|
|
267
271
|
}
|
|
268
272
|
}
|
|
269
273
|
catch (err) {
|
|
274
|
+
if (!isActive())
|
|
275
|
+
return;
|
|
270
276
|
if (scope === "current") {
|
|
271
277
|
this.currentLoading = false;
|
|
272
278
|
}
|
|
273
279
|
else {
|
|
274
280
|
this.allLoading = false;
|
|
275
281
|
}
|
|
276
|
-
if (this.disposed)
|
|
277
|
-
return;
|
|
278
282
|
if (scope !== this.scope)
|
|
279
283
|
return;
|
|
280
|
-
if (seq !== undefined && seq !== this.allLoadSeq)
|
|
281
|
-
return;
|
|
282
284
|
const message = err instanceof Error ? err.message : String(err);
|
|
283
285
|
this.header.setLoading(false);
|
|
284
286
|
this.header.setStatusMessage({ type: "error", message: `Failed to load sessions: ${message}` }, 4000);
|
|
@@ -309,25 +311,16 @@ export class SessionSelectorComponent extends Container {
|
|
|
309
311
|
await this.loadScope(this.scope, "refresh");
|
|
310
312
|
}
|
|
311
313
|
toggleScope() {
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
if (this.allSessions !== null) {
|
|
316
|
-
this.header.setLoading(false);
|
|
317
|
-
this.sessionList.setSessions(this.allSessions, true);
|
|
318
|
-
this.requestRender();
|
|
319
|
-
return;
|
|
320
|
-
}
|
|
321
|
-
if (!this.allLoading) {
|
|
322
|
-
void this.loadScope("all", "toggle");
|
|
323
|
-
}
|
|
324
|
-
return;
|
|
325
|
-
}
|
|
326
|
-
this.scope = "current";
|
|
314
|
+
this.scope = this.scope === "current" ? "all" : "current";
|
|
315
|
+
const sessions = this.scope === "current" ? this.currentSessions : this.allSessions;
|
|
316
|
+
const loading = this.scope === "current" ? this.currentLoading : this.allLoading;
|
|
327
317
|
this.header.setScope(this.scope);
|
|
328
|
-
this.header.setLoading(
|
|
329
|
-
this.sessionList.setSessions(
|
|
318
|
+
this.header.setLoading(loading);
|
|
319
|
+
this.sessionList.setSessions(sessions ?? [], this.scope === "all", loading || sessions === null);
|
|
330
320
|
this.requestRender();
|
|
321
|
+
if (sessions === null && !loading) {
|
|
322
|
+
void this.loadScope(this.scope, "toggle");
|
|
323
|
+
}
|
|
331
324
|
}
|
|
332
325
|
getSessionList() {
|
|
333
326
|
return this.sessionList;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-selector.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/session-selector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,SAAS,EAAkB,cAAc,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AACxH,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAElE,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAgC,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAC/F,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAIzD;;GAEG;AACH,MAAM,OAAO,wBAAyB,SAAQ,SAAS;IACtD,IAAI,qBAAqB;QACxB,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC;IAC/B,CAAC;IAED,WAAW,CAAC,IAAY;QACvB,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC5B,MAAM,EAAE,GAAG,cAAc,EAAE,CAAC;YAC5B,IAAI,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,mBAAmB,CAAC,EAAE,CAAC;gBAC3C,IAAI,CAAC,cAAc,EAAE,CAAC;gBACtB,OAAO,IAAI,CAAC;YACb,CAAC;YACD,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;YACnC,OAAO,IAAI,CAAC;QACb,CAAC;QAED,OAAO,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;IAEO,SAAS,GAAG,IAAI,CAAC;IACjB,WAAW,CAAc;IACzB,MAAM,CAAwB;IAC9B,WAAW,CAAqB;IAChC,KAAK,GAAi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R,CAAC;YAED,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;gBACtB,KAAK,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;YACtC,CAAC;YACD,OAAO;QACR,CAAC;QAED,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;QACvB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACjC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAC5C,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,IAAI,CAAC,eAAe,IAAI,EAAE,EAAE,KAAK,CAAC,CAAC;QAChE,IAAI,CAAC,aAAa,EAAE,CAAC;IACtB,CAAC;IAED,cAAc;QACb,OAAO,IAAI,CAAC,WAAW,CAAC;IACzB,CAAC;IAED;;;;OAIG;IACH,OAAO;QACN,IAAI,IAAI,CAAC,QAAQ;YAAE,OAAO;QAC1B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,2EAA2E;QAC3E,IAAI,CAAC,UAAU,IAAI,CAAC,CAAC;QACrB,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC;CACD;AAED,SAAS,kBAAkB,CAAC,OAAoB;IAC/C,OAAO,OAAO,CAAC,YAAY,GAAG,CAAC,IAAI,OAAO,CAAC,OAAO,KAAK,IAAI,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,CAAC;AAC9F,CAAC","sourcesContent":["import { type Component, Container, type Focusable, getKeybindings, Input, Spacer, Text } from \"@earendil-works/pi-tui\";\nimport { KeybindingsManager } from \"../../../core/keybindings.ts\";\nimport type { SessionInfo } from \"../../../core/session-manager.ts\";\nimport { theme } from \"../theme/theme.js\";\nimport { DynamicBorder } from \"./dynamic-border.ts\";\nimport { keyText } from \"./keybinding-hints.js\";\nimport { type DeleteSessionFileResult, deleteSessionFile } from \"./session-selector-delete.ts\";\nimport { SessionSelectorHeader } from \"./session-selector-header.ts\";\nimport { SessionList } from \"./session-selector-list.ts\";\nimport type { NameFilter, SortMode } from \"./session-selector-search.ts\";\nimport type { SessionScope, SessionsLoader } from \"./session-selector-types.ts\";\n\n/**\n * Component that renders a session selector\n */\nexport class SessionSelectorComponent extends Container implements Focusable {\n\tget capturesViewportInput(): boolean {\n\t\treturn this.mode !== \"rename\";\n\t}\n\n\thandleInput(data: string): boolean {\n\t\tif (this.mode === \"rename\") {\n\t\t\tconst kb = getKeybindings();\n\t\t\tif (kb.matches(data, \"tui.select.cancel\")) {\n\t\t\t\tthis.exitRenameMode();\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tthis.renameInput.handleInput(data);\n\t\t\treturn true;\n\t\t}\n\n\t\treturn this.sessionList.handleInput(data);\n\t}\n\n\tprivate canRename = true;\n\tprivate sessionList: SessionList;\n\tprivate header: SessionSelectorHeader;\n\tprivate keybindings: KeybindingsManager;\n\tprivate scope: SessionScope = \"current\";\n\tprivate sortMode: SortMode = \"threaded\";\n\tprivate nameFilter: NameFilter = \"all\";\n\tprivate currentSessions: SessionInfo[] | null = null;\n\tprivate allSessions: SessionInfo[] | null = null;\n\tprivate currentSessionsLoader: SessionsLoader;\n\tprivate allSessionsLoader: SessionsLoader;\n\tprivate onCancel: () => void;\n\tprivate requestRender: () => void;\n\tprivate renameSession?: (session: SessionInfo, currentName: string | undefined) => Promise<void>;\n\tprivate currentLoading = false;\n\tprivate allLoading = false;\n\tprivate allLoadSeq = 0;\n\tprivate disposed = false;\n\n\tprivate mode: \"list\" | \"rename\" = \"list\";\n\tprivate renameInput = new Input();\n\tprivate renameTarget: SessionInfo | null = null;\n\n\t// Focusable implementation - propagate to sessionList for IME cursor positioning\n\tprivate _focused = false;\n\tget focused(): boolean {\n\t\treturn this._focused;\n\t}\n\tset focused(value: boolean) {\n\t\tthis._focused = value;\n\t\tthis.sessionList.focused = value;\n\t\tthis.renameInput.focused = value;\n\t\tif (value && this.mode === \"rename\") {\n\t\t\tthis.renameInput.focused = true;\n\t\t}\n\t}\n\n\tprivate buildBaseLayout(content: Component, options?: { showHeader?: boolean }): void {\n\t\tthis.clear();\n\t\tthis.addChild(new Spacer(1));\n\t\tthis.addChild(new DynamicBorder((s) => theme.fg(\"accent\", s)));\n\t\tthis.addChild(new Spacer(1));\n\t\tif (options?.showHeader ?? true) {\n\t\t\tthis.addChild(this.header);\n\t\t\tthis.addChild(new Spacer(1));\n\t\t}\n\t\tthis.addChild(content);\n\t\tthis.addChild(new Spacer(1));\n\t\tthis.addChild(new DynamicBorder((s) => theme.fg(\"accent\", s)));\n\t}\n\n\tconstructor(\n\t\tcurrentSessionsLoader: SessionsLoader,\n\t\tallSessionsLoader: SessionsLoader,\n\t\tonSelect: (session: SessionInfo) => void,\n\t\tonCancel: () => void,\n\t\tonExit: () => void,\n\t\trequestRender: () => void,\n\t\toptions?: {\n\t\t\trenameSession?: (session: SessionInfo, currentName: string | undefined) => Promise<void>;\n\t\t\tdeleteSession?: (sessionId: string) => Promise<void>;\n\t\t\tshowRenameHint?: boolean;\n\t\t\tkeybindings?: KeybindingsManager;\n\t\t\t/**\n\t\t\t * Rows to display in the first rendered frame before the async loader\n\t\t\t * resolves (e.g. cheap in-memory live workflow runs). Seeding lets the\n\t\t\t * selector mount and stay interactive while durable/on-disk rows load,\n\t\t\t * and keeps live rows visible if the loader later errors.\n\t\t\t */\n\t\t\tinitialSessions?: SessionInfo[];\n\t\t},\n\t\tcurrentSession?: { id: string; directory: string },\n\t) {\n\t\tsuper();\n\t\tthis.keybindings = options?.keybindings ?? KeybindingsManager.create();\n\t\tthis.currentSessionsLoader = currentSessionsLoader;\n\t\tthis.allSessionsLoader = allSessionsLoader;\n\t\tthis.onCancel = onCancel;\n\t\tthis.requestRender = requestRender;\n\t\tthis.header = new SessionSelectorHeader(this.scope, this.sortMode, this.nameFilter, this.requestRender);\n\t\tconst renameSession = options?.renameSession;\n\t\tthis.renameSession = renameSession;\n\t\tthis.canRename = !!renameSession;\n\t\tthis.header.setShowRenameHint(options?.showRenameHint ?? this.canRename);\n\n\t\t// Create the session list. Seed with any provided initial rows so the very\n\t\t// first frame is populated (kept minimal/in-memory by the caller) while the\n\t\t// async loader resolves the full catalog off the host hot path.\n\t\tconst initialSessions = options?.initialSessions;\n\t\tthis.sessionList = new SessionList(\n\t\t\tinitialSessions ?? [],\n\t\t\tfalse,\n\t\t\tthis.sortMode,\n\t\t\tthis.nameFilter,\n\t\t\tthis.keybindings,\n\t\t\toptions?.deleteSession && currentSession ? { id: currentSession.id } : currentSession,\n\t\t);\n\t\tif (initialSessions !== undefined) {\n\t\t\tthis.currentSessions = initialSessions;\n\t\t}\n\n\t\tthis.buildBaseLayout(this.sessionList);\n\n\t\tthis.renameInput.onSubmit = (value) => {\n\t\t\tvoid this.confirmRename(value);\n\t\t};\n\n\t\t// Ensure header status timeouts are cleared when leaving the selector\n\t\tconst clearStatusMessage = () => this.header.setStatusMessage(null);\n\t\tthis.sessionList.onSelect = (session) => {\n\t\t\tclearStatusMessage();\n\t\t\tonSelect(session);\n\t\t};\n\t\tthis.sessionList.onCancel = () => {\n\t\t\tclearStatusMessage();\n\t\t\tonCancel();\n\t\t};\n\t\tthis.sessionList.onExit = () => {\n\t\t\tclearStatusMessage();\n\t\t\tonExit();\n\t\t};\n\t\tthis.sessionList.onToggleScope = () => this.toggleScope();\n\t\tthis.sessionList.onToggleSort = () => this.toggleSortMode();\n\t\tthis.sessionList.onToggleNameFilter = () => this.toggleNameFilter();\n\t\tthis.sessionList.onRenameSession = (session) => {\n\t\t\tif (!renameSession) return;\n\t\t\tif (this.scope === \"current\" && this.currentLoading) return;\n\t\t\tif (this.scope === \"all\" && this.allLoading) return;\n\t\t\tthis.enterRenameMode(session);\n\t\t};\n\n\t\t// Sync list events to header\n\t\tthis.sessionList.onTogglePath = (showPath) => {\n\t\t\tthis.header.setShowPath(showPath);\n\t\t\tthis.requestRender();\n\t\t};\n\t\tthis.sessionList.onDeleteConfirmationChange = (path) => {\n\t\t\tthis.header.setConfirmingDeletePath(path);\n\t\t\tthis.requestRender();\n\t\t};\n\t\tthis.sessionList.onError = (msg) => {\n\t\t\tthis.header.setStatusMessage({ type: \"error\", message: msg }, 3000);\n\t\t\tthis.requestRender();\n\t\t};\n\n\t\t// Handle session deletion\n\t\tthis.sessionList.onDeleteSession = async (sessionPath, session) => {\n\t\t\tlet result: DeleteSessionFileResult;\n\t\t\ttry {\n\t\t\t\tif (options?.deleteSession) {\n\t\t\t\t\tawait options.deleteSession(session.id);\n\t\t\t\t\tresult = { ok: true, method: \"store\" };\n\t\t\t\t} else result = await deleteSessionFile(sessionPath);\n\t\t\t} catch (error) {\n\t\t\t\tresult = { ok: false, method: \"store\", error: error instanceof Error ? error.message : String(error) };\n\t\t\t}\n\n\t\t\tif (result.ok) {\n\t\t\t\tif (this.currentSessions) {\n\t\t\t\t\tthis.currentSessions = this.currentSessions.filter((s) =>\n\t\t\t\t\t\toptions?.deleteSession ? s.id !== session.id : s.path !== sessionPath,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tif (this.allSessions) {\n\t\t\t\t\tthis.allSessions = this.allSessions.filter((s) =>\n\t\t\t\t\t\toptions?.deleteSession ? s.id !== session.id : s.path !== sessionPath,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tconst sessions = this.scope === \"all\" ? (this.allSessions ?? []) : (this.currentSessions ?? []);\n\t\t\t\tconst showCwd = this.scope === \"all\";\n\t\t\t\tthis.sessionList.setSessions(sessions, showCwd);\n\n\t\t\t\tconst msg = result.method === \"trash\" ? \"Session moved to trash\" : \"Session deleted\";\n\t\t\t\tthis.header.setStatusMessage({ type: \"info\", message: msg }, 2000);\n\t\t\t\tawait this.refreshSessionsAfterMutation();\n\t\t\t} else {\n\t\t\t\tconst errorMessage = result.error ?? \"Unknown error\";\n\t\t\t\tthis.header.setStatusMessage({ type: \"error\", message: `Failed to delete: ${errorMessage}` }, 3000);\n\t\t\t}\n\n\t\t\tthis.requestRender();\n\t\t};\n\n\t\t// Start loading current sessions immediately\n\t\tthis.loadCurrentSessions();\n\t}\n\n\tprivate loadCurrentSessions(): void {\n\t\tvoid this.loadScope(\"current\", \"initial\");\n\t}\n\n\tprivate enterRenameMode(session: SessionInfo): void {\n\t\tthis.mode = \"rename\";\n\t\tthis.renameTarget = session;\n\t\tthis.renameInput.setValue(session.name ?? \"\");\n\t\tthis.renameInput.focused = true;\n\n\t\tconst panel = new Container();\n\t\tpanel.addChild(new Text(theme.bold(\"Rename Session\"), 1, 0));\n\t\tpanel.addChild(new Spacer(1));\n\t\tpanel.addChild(this.renameInput);\n\t\tpanel.addChild(new Spacer(1));\n\t\tpanel.addChild(\n\t\t\tnew Text(\n\t\t\t\ttheme.fg(\"muted\", `${keyText(\"tui.select.confirm\")} Save · ${keyText(\"tui.select.cancel\")} Cancel`),\n\t\t\t\t1,\n\t\t\t\t0,\n\t\t\t),\n\t\t);\n\n\t\tthis.buildBaseLayout(panel, { showHeader: false });\n\t\tthis.requestRender();\n\t}\n\n\tprivate exitRenameMode(): void {\n\t\tthis.mode = \"list\";\n\t\tthis.renameTarget = null;\n\n\t\tthis.buildBaseLayout(this.sessionList);\n\n\t\tthis.requestRender();\n\t}\n\n\tprivate async confirmRename(value: string): Promise<void> {\n\t\tconst next = value.trim();\n\t\tif (!next) return;\n\t\tconst target = this.renameTarget;\n\t\tif (!target) {\n\t\t\tthis.exitRenameMode();\n\t\t\treturn;\n\t\t}\n\n\t\t// Find current name for callback\n\t\tconst renameSession = this.renameSession;\n\t\tif (!renameSession) {\n\t\t\tthis.exitRenameMode();\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tawait renameSession(target, next);\n\t\t\tawait this.refreshSessionsAfterMutation();\n\t\t} finally {\n\t\t\tthis.exitRenameMode();\n\t\t}\n\t}\n\n\tprivate async loadScope(scope: SessionScope, reason: \"initial\" | \"refresh\" | \"toggle\"): Promise<void> {\n\t\tconst showCwd = scope === \"all\";\n\n\t\t// Mark loading\n\t\tif (scope === \"current\") {\n\t\t\tthis.currentLoading = true;\n\t\t} else {\n\t\t\tthis.allLoading = true;\n\t\t}\n\n\t\tconst seq = scope === \"all\" ? ++this.allLoadSeq : undefined;\n\t\tthis.header.setScope(scope);\n\t\tthis.header.setLoading(true);\n\t\tthis.requestRender();\n\n\t\tconst onProgress = (loaded: number, total: number) => {\n\t\t\tif (this.disposed) return;\n\t\t\tif (scope !== this.scope) return;\n\t\t\tif (seq !== undefined && seq !== this.allLoadSeq) return;\n\t\t\tthis.header.setProgress(loaded, total);\n\t\t\tthis.requestRender();\n\t\t};\n\n\t\ttry {\n\t\t\tconst sessions = (\n\t\t\t\tawait (scope === \"current\" ? this.currentSessionsLoader(onProgress) : this.allSessionsLoader(onProgress))\n\t\t\t).filter(isResumableSession);\n\n\t\t\tif (scope === \"current\") {\n\t\t\t\tthis.currentSessions = sessions;\n\t\t\t\tthis.currentLoading = false;\n\t\t\t} else {\n\t\t\t\tthis.allSessions = sessions;\n\t\t\t\tthis.allLoading = false;\n\t\t\t}\n\n\t\t\t// Stale-result guards: ignore a resolved load after the selector was\n\t\t\t// closed, the visible scope changed, or a newer all-scope load started.\n\t\t\tif (this.disposed) return;\n\t\t\tif (scope !== this.scope) return;\n\t\t\tif (seq !== undefined && seq !== this.allLoadSeq) return;\n\n\t\t\tthis.header.setLoading(false);\n\t\t\tthis.sessionList.setSessions(sessions, showCwd);\n\t\t\tthis.requestRender();\n\n\t\t\tif (scope === \"all\" && sessions.length === 0 && (this.currentSessions?.length ?? 0) === 0) {\n\t\t\t\tthis.onCancel();\n\t\t\t}\n\t\t} catch (err) {\n\t\t\tif (scope === \"current\") {\n\t\t\t\tthis.currentLoading = false;\n\t\t\t} else {\n\t\t\t\tthis.allLoading = false;\n\t\t\t}\n\n\t\t\tif (this.disposed) return;\n\t\t\tif (scope !== this.scope) return;\n\t\t\tif (seq !== undefined && seq !== this.allLoadSeq) return;\n\n\t\t\tconst message = err instanceof Error ? err.message : String(err);\n\t\t\tthis.header.setLoading(false);\n\t\t\tthis.header.setStatusMessage({ type: \"error\", message: `Failed to load sessions: ${message}` }, 4000);\n\n\t\t\t// Only blank the list on the initial load when there is nothing already\n\t\t\t// on screen. Seeded live rows must survive a loader failure so errors\n\t\t\t// render inside the still-usable picker (contract §2).\n\t\t\tconst seeded = scope === \"current\" ? this.currentSessions : this.allSessions;\n\t\t\tif (reason === \"initial\" && (seeded === null || seeded.length === 0)) {\n\t\t\t\tthis.sessionList.setSessions([], showCwd);\n\t\t\t}\n\t\t\tthis.requestRender();\n\t\t}\n\t}\n\n\tprivate toggleSortMode(): void {\n\t\t// Cycle: threaded -> recent -> relevance -> threaded\n\t\tthis.sortMode = this.sortMode === \"threaded\" ? \"recent\" : this.sortMode === \"recent\" ? \"relevance\" : \"threaded\";\n\t\tthis.header.setSortMode(this.sortMode);\n\t\tthis.sessionList.setSortMode(this.sortMode);\n\t\tthis.requestRender();\n\t}\n\n\tprivate toggleNameFilter(): void {\n\t\tthis.nameFilter = this.nameFilter === \"all\" ? \"named\" : \"all\";\n\t\tthis.header.setNameFilter(this.nameFilter);\n\t\tthis.sessionList.setNameFilter(this.nameFilter);\n\t\tthis.requestRender();\n\t}\n\n\tprivate async refreshSessionsAfterMutation(): Promise<void> {\n\t\tawait this.loadScope(this.scope, \"refresh\");\n\t}\n\n\tprivate toggleScope(): void {\n\t\tif (this.scope === \"current\") {\n\t\t\tthis.scope = \"all\";\n\t\t\tthis.header.setScope(this.scope);\n\n\t\t\tif (this.allSessions !== null) {\n\t\t\t\tthis.header.setLoading(false);\n\t\t\t\tthis.sessionList.setSessions(this.allSessions, true);\n\t\t\t\tthis.requestRender();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (!this.allLoading) {\n\t\t\t\tvoid this.loadScope(\"all\", \"toggle\");\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tthis.scope = \"current\";\n\t\tthis.header.setScope(this.scope);\n\t\tthis.header.setLoading(this.currentLoading);\n\t\tthis.sessionList.setSessions(this.currentSessions ?? [], false);\n\t\tthis.requestRender();\n\t}\n\n\tgetSessionList(): SessionList {\n\t\treturn this.sessionList;\n\t}\n\n\t/**\n\t * Mark the selector closed so any in-flight or late-resolving loads are\n\t * ignored (stale-result guard) and status timeouts are cleared. Idempotent;\n\t * safe to call from close/select/cancel/dispose paths.\n\t */\n\tdispose(): void {\n\t\tif (this.disposed) return;\n\t\tthis.disposed = true;\n\t\t// Invalidate any pending all-scope load so its seq check fails on resolve.\n\t\tthis.allLoadSeq += 1;\n\t\tthis.header.setStatusMessage(null);\n\t}\n}\n\nfunction isResumableSession(session: SessionInfo): boolean {\n\treturn session.messageCount > 0 || session.hasName === true || session.summary !== undefined;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"session-selector.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/session-selector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,SAAS,EAAkB,cAAc,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AACxH,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAElE,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAgC,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAC/F,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAIzD;;GAEG;AACH,MAAM,OAAO,wBAAyB,SAAQ,SAAS;IACtD,IAAI,qBAAqB;QACxB,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC;IAC/B,CAAC;IAED,WAAW,CAAC,IAAY;QACvB,IAAI,IAAI,CAAC,IAAI,KAAK,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AAC;IACzB,CAAC;IAED;;;;OAIG;IACH,OAAO;QACN,IAAI,IAAI,CAAC,QAAQ;YAAE,OAAO;QAC1B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,2EAA2E;QAC3E,IAAI,CAAC,UAAU,IAAI,CAAC,CAAC;QACrB,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC;CACD;AAED,SAAS,kBAAkB,CAAC,OAAoB;IAC/C,OAAO,OAAO,CAAC,YAAY,GAAG,CAAC,IAAI,OAAO,CAAC,OAAO,KAAK,IAAI,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,CAAC;AAC9F,CAAC","sourcesContent":["import { type Component, Container, type Focusable, getKeybindings, Input, Spacer, Text } from \"@earendil-works/pi-tui\";\nimport { KeybindingsManager } from \"../../../core/keybindings.ts\";\nimport type { SessionInfo, SessionListProgress } from \"../../../core/session-manager.ts\";\nimport { theme } from \"../theme/theme.js\";\nimport { DynamicBorder } from \"./dynamic-border.ts\";\nimport { keyText } from \"./keybinding-hints.js\";\nimport { type DeleteSessionFileResult, deleteSessionFile } from \"./session-selector-delete.ts\";\nimport { SessionSelectorHeader } from \"./session-selector-header.ts\";\nimport { SessionList } from \"./session-selector-list.ts\";\nimport type { NameFilter, SortMode } from \"./session-selector-search.ts\";\nimport type { SessionScope, SessionsLoader } from \"./session-selector-types.ts\";\n\n/**\n * Component that renders a session selector\n */\nexport class SessionSelectorComponent extends Container implements Focusable {\n\tget capturesViewportInput(): boolean {\n\t\treturn this.mode !== \"rename\";\n\t}\n\n\thandleInput(data: string): boolean {\n\t\tif (this.mode === \"rename\") {\n\t\t\tconst kb = getKeybindings();\n\t\t\tif (kb.matches(data, \"tui.select.cancel\")) {\n\t\t\t\tthis.exitRenameMode();\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tthis.renameInput.handleInput(data);\n\t\t\treturn true;\n\t\t}\n\n\t\treturn this.sessionList.handleInput(data);\n\t}\n\n\tprivate canRename = true;\n\tprivate sessionList: SessionList;\n\tprivate header: SessionSelectorHeader;\n\tprivate keybindings: KeybindingsManager;\n\tprivate scope: SessionScope = \"current\";\n\tprivate sortMode: SortMode = \"threaded\";\n\tprivate nameFilter: NameFilter = \"all\";\n\tprivate currentSessions: SessionInfo[] | null = null;\n\tprivate allSessions: SessionInfo[] | null = null;\n\tprivate currentSessionsLoader: SessionsLoader;\n\tprivate allSessionsLoader: SessionsLoader;\n\tprivate onCancel: () => void;\n\tprivate requestRender: () => void;\n\tprivate renameSession?: (session: SessionInfo, currentName: string | undefined) => Promise<void>;\n\tprivate currentLoading = false;\n\tprivate allLoading = false;\n\tprivate currentLoadSeq = 0;\n\tprivate allLoadSeq = 0;\n\tprivate disposed = false;\n\n\tprivate mode: \"list\" | \"rename\" = \"list\";\n\tprivate renameInput = new Input();\n\tprivate renameTarget: SessionInfo | null = null;\n\n\t// Focusable implementation - propagate to sessionList for IME cursor positioning\n\tprivate _focused = false;\n\tget focused(): boolean {\n\t\treturn this._focused;\n\t}\n\tset focused(value: boolean) {\n\t\tthis._focused = value;\n\t\tthis.sessionList.focused = value;\n\t\tthis.renameInput.focused = value;\n\t\tif (value && this.mode === \"rename\") {\n\t\t\tthis.renameInput.focused = true;\n\t\t}\n\t}\n\n\tprivate buildBaseLayout(content: Component, options?: { showHeader?: boolean }): void {\n\t\tthis.clear();\n\t\tthis.addChild(new Spacer(1));\n\t\tthis.addChild(new DynamicBorder((s) => theme.fg(\"accent\", s)));\n\t\tthis.addChild(new Spacer(1));\n\t\tif (options?.showHeader ?? true) {\n\t\t\tthis.addChild(this.header);\n\t\t\tthis.addChild(new Spacer(1));\n\t\t}\n\t\tthis.addChild(content);\n\t\tthis.addChild(new Spacer(1));\n\t\tthis.addChild(new DynamicBorder((s) => theme.fg(\"accent\", s)));\n\t}\n\n\tconstructor(\n\t\tcurrentSessionsLoader: SessionsLoader,\n\t\tallSessionsLoader: SessionsLoader,\n\t\tonSelect: (session: SessionInfo) => void,\n\t\tonCancel: () => void,\n\t\tonExit: () => void,\n\t\trequestRender: () => void,\n\t\toptions?: {\n\t\t\trenameSession?: (session: SessionInfo, currentName: string | undefined) => Promise<void>;\n\t\t\tdeleteSession?: (sessionId: string) => Promise<void>;\n\t\t\tshowRenameHint?: boolean;\n\t\t\tkeybindings?: KeybindingsManager;\n\t\t\t/**\n\t\t\t * Rows to display in the first rendered frame before the async loader\n\t\t\t * resolves (e.g. cheap in-memory live workflow runs). Seeding lets the\n\t\t\t * selector mount and stay interactive while durable/on-disk rows load,\n\t\t\t * and keeps live rows visible if the loader later errors.\n\t\t\t */\n\t\t\tinitialSessions?: SessionInfo[];\n\t\t},\n\t\tcurrentSession?: { id: string; directory: string },\n\t) {\n\t\tsuper();\n\t\tthis.keybindings = options?.keybindings ?? KeybindingsManager.create();\n\t\tthis.currentSessionsLoader = currentSessionsLoader;\n\t\tthis.allSessionsLoader = allSessionsLoader;\n\t\tthis.onCancel = onCancel;\n\t\tthis.requestRender = requestRender;\n\t\tthis.header = new SessionSelectorHeader(this.scope, this.sortMode, this.nameFilter, this.requestRender);\n\t\tconst renameSession = options?.renameSession;\n\t\tthis.renameSession = renameSession;\n\t\tthis.canRename = !!renameSession;\n\t\tthis.header.setShowRenameHint(options?.showRenameHint ?? this.canRename);\n\n\t\t// Create the session list. Seed with any provided initial rows so the very\n\t\t// first frame is populated (kept minimal/in-memory by the caller) while the\n\t\t// async loader resolves the full catalog off the host hot path.\n\t\tconst initialSessions = options?.initialSessions;\n\t\tthis.sessionList = new SessionList(\n\t\t\tinitialSessions ?? [],\n\t\t\tfalse,\n\t\t\tthis.sortMode,\n\t\t\tthis.nameFilter,\n\t\t\tthis.keybindings,\n\t\t\toptions?.deleteSession && currentSession ? { id: currentSession.id } : currentSession,\n\t\t);\n\t\tif (initialSessions !== undefined) {\n\t\t\tthis.currentSessions = initialSessions;\n\t\t}\n\n\t\tthis.buildBaseLayout(this.sessionList);\n\n\t\tthis.renameInput.onSubmit = (value) => {\n\t\t\tvoid this.confirmRename(value);\n\t\t};\n\n\t\t// Ensure header status timeouts are cleared when leaving the selector\n\t\tconst clearStatusMessage = () => this.header.setStatusMessage(null);\n\t\tthis.sessionList.onSelect = (session) => {\n\t\t\tclearStatusMessage();\n\t\t\tonSelect(session);\n\t\t};\n\t\tthis.sessionList.onCancel = () => {\n\t\t\tclearStatusMessage();\n\t\t\tonCancel();\n\t\t};\n\t\tthis.sessionList.onExit = () => {\n\t\t\tclearStatusMessage();\n\t\t\tonExit();\n\t\t};\n\t\tthis.sessionList.onToggleScope = () => this.toggleScope();\n\t\tthis.sessionList.onToggleSort = () => this.toggleSortMode();\n\t\tthis.sessionList.onToggleNameFilter = () => this.toggleNameFilter();\n\t\tthis.sessionList.onRenameSession = (session) => {\n\t\t\tif (!renameSession) return;\n\t\t\tthis.enterRenameMode(session);\n\t\t};\n\n\t\t// Sync list events to header\n\t\tthis.sessionList.onTogglePath = (showPath) => {\n\t\t\tthis.header.setShowPath(showPath);\n\t\t\tthis.requestRender();\n\t\t};\n\t\tthis.sessionList.onDeleteConfirmationChange = (path) => {\n\t\t\tthis.header.setConfirmingDeletePath(path);\n\t\t\tthis.requestRender();\n\t\t};\n\t\tthis.sessionList.onError = (msg) => {\n\t\t\tthis.header.setStatusMessage({ type: \"error\", message: msg }, 3000);\n\t\t\tthis.requestRender();\n\t\t};\n\n\t\t// Handle session deletion\n\t\tthis.sessionList.onDeleteSession = async (sessionPath, session) => {\n\t\t\tlet result: DeleteSessionFileResult;\n\t\t\ttry {\n\t\t\t\tif (options?.deleteSession) {\n\t\t\t\t\tawait options.deleteSession(session.id);\n\t\t\t\t\tresult = { ok: true, method: \"store\" };\n\t\t\t\t} else result = await deleteSessionFile(sessionPath);\n\t\t\t} catch (error) {\n\t\t\t\tresult = { ok: false, method: \"store\", error: error instanceof Error ? error.message : String(error) };\n\t\t\t}\n\n\t\t\tif (result.ok) {\n\t\t\t\tif (this.currentSessions) {\n\t\t\t\t\tthis.currentSessions = this.currentSessions.filter((s) =>\n\t\t\t\t\t\toptions?.deleteSession ? s.id !== session.id : s.path !== sessionPath,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tif (this.allSessions) {\n\t\t\t\t\tthis.allSessions = this.allSessions.filter((s) =>\n\t\t\t\t\t\toptions?.deleteSession ? s.id !== session.id : s.path !== sessionPath,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tconst sessions = this.scope === \"all\" ? (this.allSessions ?? []) : (this.currentSessions ?? []);\n\t\t\t\tconst showCwd = this.scope === \"all\";\n\t\t\t\tthis.sessionList.setSessions(sessions, showCwd);\n\n\t\t\t\tconst msg = result.method === \"trash\" ? \"Session moved to trash\" : \"Session deleted\";\n\t\t\t\tthis.header.setStatusMessage({ type: \"info\", message: msg }, 2000);\n\t\t\t\tawait this.refreshSessionsAfterMutation();\n\t\t\t} else {\n\t\t\t\tconst errorMessage = result.error ?? \"Unknown error\";\n\t\t\t\tthis.header.setStatusMessage({ type: \"error\", message: `Failed to delete: ${errorMessage}` }, 3000);\n\t\t\t}\n\n\t\t\tthis.requestRender();\n\t\t};\n\n\t\t// Start loading current sessions immediately\n\t\tthis.loadCurrentSessions();\n\t}\n\n\tprivate loadCurrentSessions(): void {\n\t\tvoid this.loadScope(\"current\", \"initial\");\n\t}\n\n\tprivate enterRenameMode(session: SessionInfo): void {\n\t\tthis.mode = \"rename\";\n\t\tthis.renameTarget = session;\n\t\tthis.renameInput.setValue(session.name ?? \"\");\n\t\tthis.renameInput.focused = true;\n\n\t\tconst panel = new Container();\n\t\tpanel.addChild(new Text(theme.bold(\"Rename Session\"), 1, 0));\n\t\tpanel.addChild(new Spacer(1));\n\t\tpanel.addChild(this.renameInput);\n\t\tpanel.addChild(new Spacer(1));\n\t\tpanel.addChild(\n\t\t\tnew Text(\n\t\t\t\ttheme.fg(\"muted\", `${keyText(\"tui.select.confirm\")} Save · ${keyText(\"tui.select.cancel\")} Cancel`),\n\t\t\t\t1,\n\t\t\t\t0,\n\t\t\t),\n\t\t);\n\n\t\tthis.buildBaseLayout(panel, { showHeader: false });\n\t\tthis.requestRender();\n\t}\n\n\tprivate exitRenameMode(): void {\n\t\tthis.mode = \"list\";\n\t\tthis.renameTarget = null;\n\n\t\tthis.buildBaseLayout(this.sessionList);\n\n\t\tthis.requestRender();\n\t}\n\n\tprivate async confirmRename(value: string): Promise<void> {\n\t\tconst next = value.trim();\n\t\tif (!next) return;\n\t\tconst target = this.renameTarget;\n\t\tif (!target) {\n\t\t\tthis.exitRenameMode();\n\t\t\treturn;\n\t\t}\n\n\t\t// Find current name for callback\n\t\tconst renameSession = this.renameSession;\n\t\tif (!renameSession) {\n\t\t\tthis.exitRenameMode();\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tawait renameSession(target, next);\n\t\t\tawait this.refreshSessionsAfterMutation();\n\t\t} finally {\n\t\t\tthis.exitRenameMode();\n\t\t}\n\t}\n\n\tprivate async loadScope(scope: SessionScope, reason: \"initial\" | \"refresh\" | \"toggle\"): Promise<void> {\n\t\tconst showCwd = scope === \"all\";\n\n\t\t// Mark loading\n\t\tif (scope === \"current\") {\n\t\t\tthis.currentLoading = true;\n\t\t} else {\n\t\t\tthis.allLoading = true;\n\t\t}\n\n\t\tconst seq = scope === \"current\" ? ++this.currentLoadSeq : ++this.allLoadSeq;\n\t\tconst isActive = () => !this.disposed && (scope === \"current\" ? this.currentLoadSeq : this.allLoadSeq) === seq;\n\t\tthis.header.setScope(scope);\n\t\tthis.header.setLoading(true);\n\t\tthis.requestRender();\n\n\t\tconst onProgress: SessionListProgress = (loaded, total, partialSessions) => {\n\t\t\tif (!isActive()) return;\n\t\t\tif (partialSessions) {\n\t\t\t\tconst sessions = partialSessions.filter(isResumableSession);\n\t\t\t\tif (scope === \"current\") {\n\t\t\t\t\tthis.currentSessions = sessions;\n\t\t\t\t} else {\n\t\t\t\t\tthis.allSessions = sessions;\n\t\t\t\t}\n\t\t\t\tif (scope === this.scope) {\n\t\t\t\t\tthis.sessionList.setSessions(sessions, showCwd, true);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (scope !== this.scope) return;\n\t\t\tthis.header.setProgress(loaded, total);\n\t\t\tthis.requestRender();\n\t\t};\n\n\t\ttry {\n\t\t\tconst sessions = (\n\t\t\t\tawait (scope === \"current\" ? this.currentSessionsLoader(onProgress) : this.allSessionsLoader(onProgress))\n\t\t\t).filter(isResumableSession);\n\n\t\t\tif (!isActive()) return;\n\n\t\t\tif (scope === \"current\") {\n\t\t\t\tthis.currentSessions = sessions;\n\t\t\t\tthis.currentLoading = false;\n\t\t\t} else {\n\t\t\t\tthis.allSessions = sessions;\n\t\t\t\tthis.allLoading = false;\n\t\t\t}\n\n\t\t\tif (scope !== this.scope) return;\n\n\t\t\tthis.header.setLoading(false);\n\t\t\tthis.sessionList.setSessions(sessions, showCwd);\n\t\t\tthis.requestRender();\n\n\t\t\tif (scope === \"all\" && sessions.length === 0 && (this.currentSessions?.length ?? 0) === 0) {\n\t\t\t\tthis.onCancel();\n\t\t\t}\n\t\t} catch (err) {\n\t\t\tif (!isActive()) return;\n\n\t\t\tif (scope === \"current\") {\n\t\t\t\tthis.currentLoading = false;\n\t\t\t} else {\n\t\t\t\tthis.allLoading = false;\n\t\t\t}\n\n\t\t\tif (scope !== this.scope) return;\n\n\t\t\tconst message = err instanceof Error ? err.message : String(err);\n\t\t\tthis.header.setLoading(false);\n\t\t\tthis.header.setStatusMessage({ type: \"error\", message: `Failed to load sessions: ${message}` }, 4000);\n\n\t\t\t// Only blank the list on the initial load when there is nothing already\n\t\t\t// on screen. Seeded live rows must survive a loader failure so errors\n\t\t\t// render inside the still-usable picker (contract §2).\n\t\t\tconst seeded = scope === \"current\" ? this.currentSessions : this.allSessions;\n\t\t\tif (reason === \"initial\" && (seeded === null || seeded.length === 0)) {\n\t\t\t\tthis.sessionList.setSessions([], showCwd);\n\t\t\t}\n\t\t\tthis.requestRender();\n\t\t}\n\t}\n\n\tprivate toggleSortMode(): void {\n\t\t// Cycle: threaded -> recent -> relevance -> threaded\n\t\tthis.sortMode = this.sortMode === \"threaded\" ? \"recent\" : this.sortMode === \"recent\" ? \"relevance\" : \"threaded\";\n\t\tthis.header.setSortMode(this.sortMode);\n\t\tthis.sessionList.setSortMode(this.sortMode);\n\t\tthis.requestRender();\n\t}\n\n\tprivate toggleNameFilter(): void {\n\t\tthis.nameFilter = this.nameFilter === \"all\" ? \"named\" : \"all\";\n\t\tthis.header.setNameFilter(this.nameFilter);\n\t\tthis.sessionList.setNameFilter(this.nameFilter);\n\t\tthis.requestRender();\n\t}\n\n\tprivate async refreshSessionsAfterMutation(): Promise<void> {\n\t\tawait this.loadScope(this.scope, \"refresh\");\n\t}\n\n\tprivate toggleScope(): void {\n\t\tthis.scope = this.scope === \"current\" ? \"all\" : \"current\";\n\t\tconst sessions = this.scope === \"current\" ? this.currentSessions : this.allSessions;\n\t\tconst loading = this.scope === \"current\" ? this.currentLoading : this.allLoading;\n\t\tthis.header.setScope(this.scope);\n\t\tthis.header.setLoading(loading);\n\t\tthis.sessionList.setSessions(sessions ?? [], this.scope === \"all\", loading || sessions === null);\n\t\tthis.requestRender();\n\t\tif (sessions === null && !loading) {\n\t\t\tvoid this.loadScope(this.scope, \"toggle\");\n\t\t}\n\t}\n\n\tgetSessionList(): SessionList {\n\t\treturn this.sessionList;\n\t}\n\n\t/**\n\t * Mark the selector closed so any in-flight or late-resolving loads are\n\t * ignored (stale-result guard) and status timeouts are cleared. Idempotent;\n\t * safe to call from close/select/cancel/dispose paths.\n\t */\n\tdispose(): void {\n\t\tif (this.disposed) return;\n\t\tthis.disposed = true;\n\t\t// Invalidate any pending all-scope load so its seq check fails on resolve.\n\t\tthis.allLoadSeq += 1;\n\t\tthis.header.setStatusMessage(null);\n\t}\n}\n\nfunction isResumableSession(session: SessionInfo): boolean {\n\treturn session.messageCount > 0 || session.hasName === true || session.summary !== undefined;\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { APP_NAME, detectInstallChange, VERSION } from "../../config.js";
|
|
2
|
-
import { createCacheMissModelSource,
|
|
2
|
+
import { createCacheMissModelSource, detectCacheMiss, formatCacheMissNotice, formatCompactionCacheMissNotice, } from "../../core/cache-stats.js";
|
|
3
3
|
import { createCustomMessage } from "../../core/messages.js";
|
|
4
4
|
import { formatModelLabel } from "../../core/model-label.js";
|
|
5
5
|
import { observeLocalWorkflowActivity } from "../interactive-engine/extension-ui-bridge.js";
|
|
@@ -12,6 +12,7 @@ import { appendNewChildrenBeforeAttachedChild } from "./interactive-child-orderi
|
|
|
12
12
|
import { InteractiveModeBase } from "./interactive-mode-base.js";
|
|
13
13
|
import { AssistantMessageComponent, CountdownTimer, keyText, Loader, pickWhimsicalWorkingMessage, Spacer, Text, ToolExecutionComponent, theme, } from "./interactive-mode-deps.js";
|
|
14
14
|
import { formatResumeCommand } from "./interactive-mode-helpers.js";
|
|
15
|
+
import { reconcileQueuedSubmissions } from "./interactive-queueing.js";
|
|
15
16
|
import { handleSummarizationRetryEvent } from "./interactive-summarization-retry-events.js";
|
|
16
17
|
import { disposeInteractiveTasks, refreshInteractiveTasks } from "./interactive-task-projection.js";
|
|
17
18
|
import { applyAssistantMessageDelta, beginStreamingAssistantMessage } from "./streaming-assistant-message.js";
|
|
@@ -125,6 +126,7 @@ InteractiveModeBase.prototype.handleEvent = async function (event) {
|
|
|
125
126
|
break;
|
|
126
127
|
}
|
|
127
128
|
case "queue_update":
|
|
129
|
+
reconcileQueuedSubmissions(this, event);
|
|
128
130
|
this.updatePendingMessagesDisplay();
|
|
129
131
|
this.ui.requestRender();
|
|
130
132
|
break;
|
|
@@ -255,10 +257,8 @@ InteractiveModeBase.prototype.handleEvent = async function (event) {
|
|
|
255
257
|
}
|
|
256
258
|
if (event.message.role === "assistant" && this.settingsManager.getShowCacheMissNotices()) {
|
|
257
259
|
const miss = detectCacheMiss(this.sessionManager.getEntries(), event.message, createCacheMissModelSource(this.session.modelRuntime));
|
|
258
|
-
if (miss)
|
|
259
|
-
|
|
260
|
-
this.chatContainer.addChild(new Text(theme.fg("warning", `Prompt cache miss${cause}: ${miss.missedTokens.toLocaleString()} tokens re-billed ($${miss.missedCost.toFixed(3)})`), 1, 0));
|
|
261
|
-
}
|
|
260
|
+
if (miss)
|
|
261
|
+
this.chatContainer.addChild(new Text(theme.fg("warning", formatCacheMissNotice(miss)), 1, 0));
|
|
262
262
|
}
|
|
263
263
|
this.ui.requestRender();
|
|
264
264
|
break;
|
|
@@ -384,7 +384,7 @@ InteractiveModeBase.prototype.handleEvent = async function (event) {
|
|
|
384
384
|
if (event.result.usage)
|
|
385
385
|
this.addCompactionCostNotice("compaction", event.result.usage);
|
|
386
386
|
if (event.cacheMiss && this.settingsManager.getShowCacheMissNotices()) {
|
|
387
|
-
this.chatContainer.addChild(new Text(theme.fg("warning",
|
|
387
|
+
this.chatContainer.addChild(new Text(theme.fg("warning", formatCompactionCacheMissNotice(event.cacheMiss)), 1, 0));
|
|
388
388
|
}
|
|
389
389
|
this.footer.invalidate();
|
|
390
390
|
}
|