@astralyn/pi 0.85.3 → 0.86.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 +52 -0
- package/dist/bundle/chunks/anthropic-messages-R2LYJUDD.js +6 -0
- package/dist/bundle/chunks/azure-openai-responses-HS35BQV6.js +2 -0
- package/dist/bundle/chunks/bedrock-converse-stream.js +36 -32
- package/dist/bundle/chunks/{chunk-S2DJQQI2.js → chunk-2IO5GDBS.js} +10 -1
- package/dist/bundle/chunks/chunk-DAEM5JIZ.js +2 -0
- package/dist/bundle/chunks/{chunk-LB4P77SH.js → chunk-GTBMYBFG.js} +777 -762
- package/dist/bundle/chunks/{chunk-7LO5Z4WE.js → chunk-I5IVW2WS.js} +1 -1
- package/dist/bundle/chunks/chunk-JI4WGISU.js +2 -0
- package/dist/bundle/chunks/chunk-LPQCB2VJ.js +44 -0
- package/dist/bundle/chunks/chunk-NW5FIDD7.js +11 -0
- package/dist/bundle/chunks/chunk-PJVFYVHE.js +42 -0
- package/dist/bundle/chunks/github-copilot.js +1 -1
- package/dist/bundle/chunks/google-generative-ai-NOVAJBFC.js +2 -0
- package/dist/bundle/chunks/google-vertex-4VHCZJV5.js +2 -0
- package/dist/bundle/chunks/https-proxy-agent-JOOPB4RE.js +16 -0
- package/dist/bundle/chunks/jiti-loader-BFSSLU7G.js +21 -0
- package/dist/bundle/chunks/jiti-static-loader-CLT3YR3B.js +2 -0
- package/dist/bundle/chunks/mistral-conversations-WC6A2WCJ.js +5 -0
- package/dist/bundle/chunks/{node-G4XOIDPH.js → node-CXWYTK2I.js} +1 -1
- package/dist/bundle/chunks/openai-codex-responses-XCDG75W2.js +10 -0
- package/dist/bundle/chunks/openai-completions-6SMWQWQN.js +7 -0
- package/dist/bundle/chunks/openai-responses-UT6XFKC7.js +2 -0
- package/dist/bundle/chunks/{pi-messages-PE6B42TG.js → pi-messages-MQMPIPNC.js} +1 -1
- package/dist/bundle/chunks/virtual-modules-OHUZ2T7X.js +2 -0
- package/dist/bundle/cli.js +1 -1
- package/dist/bundle/index.js +1 -1
- package/dist/bundle/rpc-entry.js +1 -1
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +1 -0
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/session-picker.d.ts +1 -1
- package/dist/cli/session-picker.d.ts.map +1 -1
- package/dist/cli/session-picker.js +13 -11
- package/dist/cli/session-picker.js.map +1 -1
- package/dist/config.js +1 -1
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session.d.ts +56 -14
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +305 -176
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/bug-report-upload.d.ts +12 -0
- package/dist/core/bug-report-upload.d.ts.map +1 -0
- package/dist/core/bug-report-upload.js +22 -0
- package/dist/core/bug-report-upload.js.map +1 -0
- package/dist/core/bug-report.d.ts +176 -0
- package/dist/core/bug-report.d.ts.map +1 -0
- package/dist/core/bug-report.js +292 -0
- package/dist/core/bug-report.js.map +1 -0
- package/dist/core/cache-stats.d.ts.map +1 -1
- package/dist/core/cache-stats.js +12 -1
- package/dist/core/cache-stats.js.map +1 -1
- package/dist/core/cache-warmer.d.ts +102 -0
- package/dist/core/cache-warmer.d.ts.map +1 -0
- package/dist/core/cache-warmer.js +333 -0
- package/dist/core/cache-warmer.js.map +1 -0
- package/dist/core/compaction/branch-summarization.js +2 -2
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts +14 -9
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +30 -23
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/compaction/settings.d.ts +17 -20
- package/dist/core/compaction/settings.d.ts.map +1 -1
- package/dist/core/compaction/settings.js +19 -26
- package/dist/core/compaction/settings.js.map +1 -1
- package/dist/core/context-snapshot.d.ts +16 -5
- package/dist/core/context-snapshot.d.ts.map +1 -1
- package/dist/core/context-snapshot.js +20 -10
- package/dist/core/context-snapshot.js.map +1 -1
- package/dist/core/crash-log.d.ts +22 -0
- package/dist/core/crash-log.d.ts.map +1 -0
- package/dist/core/crash-log.js +71 -0
- package/dist/core/crash-log.js.map +1 -0
- package/dist/core/experimental.d.ts +0 -4
- package/dist/core/experimental.d.ts.map +1 -1
- package/dist/core/experimental.js +0 -4
- package/dist/core/experimental.js.map +1 -1
- package/dist/core/extensions/index.d.ts +1 -1
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/jiti-loader.d.ts +2 -0
- package/dist/core/extensions/jiti-loader.d.ts.map +1 -0
- package/dist/core/extensions/jiti-loader.js +4 -0
- package/dist/core/extensions/jiti-loader.js.map +1 -0
- package/dist/core/extensions/jiti-static-loader.d.ts +2 -0
- package/dist/core/extensions/jiti-static-loader.d.ts.map +1 -0
- package/dist/core/extensions/jiti-static-loader.js +4 -0
- package/dist/core/extensions/jiti-static-loader.js.map +1 -0
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +38 -51
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +10 -7
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +85 -67
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +60 -50
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/extensions/virtual-modules.d.ts +3 -0
- package/dist/core/extensions/virtual-modules.d.ts.map +1 -0
- package/dist/core/extensions/virtual-modules.js +39 -0
- package/dist/core/extensions/virtual-modules.js.map +1 -0
- package/dist/core/extensions/wrapper.d.ts.map +1 -1
- package/dist/core/extensions/wrapper.js +1 -20
- package/dist/core/extensions/wrapper.js.map +1 -1
- package/dist/core/index.d.ts +2 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/keybindings.d.ts +1 -1
- package/dist/core/keybindings.js +1 -1
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/messages.d.ts.map +1 -1
- package/dist/core/messages.js +1 -0
- package/dist/core/messages.js.map +1 -1
- package/dist/core/model-config.d.ts +101 -20
- package/dist/core/model-config.d.ts.map +1 -1
- package/dist/core/model-config.js +25 -18
- package/dist/core/model-config.js.map +1 -1
- package/dist/core/model-registry.d.ts +5 -1
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +8 -0
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +2 -1
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +5 -3
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/provider-composer.d.ts +3 -2
- package/dist/core/provider-composer.d.ts.map +1 -1
- package/dist/core/provider-composer.js +2 -0
- package/dist/core/provider-composer.js.map +1 -1
- package/dist/core/radius.d.ts +3 -0
- package/dist/core/radius.d.ts.map +1 -1
- package/dist/core/radius.js +6 -0
- package/dist/core/radius.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +46 -18
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-export.d.ts +6 -2
- package/dist/core/session-export.d.ts.map +1 -1
- package/dist/core/session-export.js +14 -13
- package/dist/core/session-export.js.map +1 -1
- package/dist/core/session-manager.d.ts +29 -6
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +159 -96
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-manager.d.ts +31 -4
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +65 -8
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +1 -0
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/system-prompt.d.ts +49 -6
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +121 -92
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tools/bash.d.ts +2 -1
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +6 -3
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +1 -2
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +1 -2
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/shell-execution.js +2 -2
- package/dist/core/tools/shell-execution.js.map +1 -1
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js +1 -2
- package/dist/core/tools/write.js.map +1 -1
- package/dist/core/usage-totals.d.ts +1 -1
- package/dist/core/usage-totals.d.ts.map +1 -1
- package/dist/core/usage-totals.js +4 -1
- package/dist/core/usage-totals.js.map +1 -1
- package/dist/extensions/background/schema.d.ts +1 -1
- package/dist/extensions/btw/agent.d.ts.map +1 -1
- package/dist/extensions/btw/agent.js +3 -2
- package/dist/extensions/btw/agent.js.map +1 -1
- package/dist/extensions/llama/client.d.ts +2 -0
- package/dist/extensions/llama/client.d.ts.map +1 -1
- package/dist/extensions/llama/client.js +7 -3
- package/dist/extensions/llama/client.js.map +1 -1
- package/dist/extensions/llama/provider.d.ts.map +1 -1
- package/dist/extensions/llama/provider.js +20 -5
- package/dist/extensions/llama/provider.js.map +1 -1
- package/dist/extensions/provider/compat-fields.d.ts.map +1 -1
- package/dist/extensions/provider/compat-fields.js +5 -2
- package/dist/extensions/provider/compat-fields.js.map +1 -1
- package/dist/extensions/provider/ui/app.js +2 -2
- package/dist/extensions/provider/ui/app.js.map +1 -1
- package/dist/extensions/todo/schema.d.ts +1 -1
- package/dist/index.d.ts +3 -2
- 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 +13 -9
- package/dist/main.js.map +1 -1
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +2 -2
- package/dist/migrations.js.map +1 -1
- package/dist/modes/interactive/bug-report.d.ts +16 -0
- package/dist/modes/interactive/bug-report.d.ts.map +1 -0
- package/dist/modes/interactive/bug-report.js +206 -0
- package/dist/modes/interactive/bug-report.js.map +1 -0
- package/dist/modes/interactive/chat-viewport.js +1 -1
- package/dist/modes/interactive/chat-viewport.js.map +1 -1
- package/dist/modes/interactive/components/armin.d.ts.map +1 -1
- package/dist/modes/interactive/components/armin.js +0 -5
- package/dist/modes/interactive/components/armin.js.map +1 -1
- package/dist/modes/interactive/components/bash-execution.d.ts +0 -1
- package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/bash-execution.js +2 -3
- package/dist/modes/interactive/components/bash-execution.js.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.js +12 -5
- package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.js +12 -5
- package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/countdown-timer.d.ts +6 -13
- package/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -1
- package/dist/modes/interactive/components/countdown-timer.js +15 -51
- package/dist/modes/interactive/components/countdown-timer.js.map +1 -1
- package/dist/modes/interactive/components/custom-editor.d.ts +3 -3
- package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-editor.js.map +1 -1
- package/dist/modes/interactive/components/extension-editor.d.ts +4 -1
- package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-editor.js +7 -2
- package/dist/modes/interactive/components/extension-editor.js.map +1 -1
- package/dist/modes/interactive/components/extension-input.d.ts +2 -0
- package/dist/modes/interactive/components/extension-input.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-input.js +6 -0
- package/dist/modes/interactive/components/extension-input.js.map +1 -1
- package/dist/modes/interactive/components/extension-selector.d.ts +1 -2
- package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-selector.js +4 -2
- package/dist/modes/interactive/components/extension-selector.js.map +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts +5 -8
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector.js +72 -95
- package/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +3 -1
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +11 -0
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.js +11 -4
- package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
- package/dist/modes/interactive/components/status-indicator.d.ts +2 -2
- package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -1
- package/dist/modes/interactive/components/status-indicator.js +7 -7
- package/dist/modes/interactive/components/status-indicator.js.map +1 -1
- package/dist/modes/interactive/components/tool-chrome.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-chrome.js +4 -1
- package/dist/modes/interactive/components/tool-chrome.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +4 -3
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector.d.ts +1 -10
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector.js +4 -51
- package/dist/modes/interactive/components/tree-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +15 -2
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +234 -91
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/session-share.d.ts +2 -0
- package/dist/modes/interactive/session-share.d.ts.map +1 -1
- package/dist/modes/interactive/session-share.js +8 -4
- package/dist/modes/interactive/session-share.js.map +1 -1
- package/dist/modes/interactive/tui-renderer.js +2 -2
- package/dist/modes/interactive/tui-renderer.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +2 -2
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/utils/clipboard-command.d.ts +7 -0
- package/dist/utils/clipboard-command.d.ts.map +1 -0
- package/dist/utils/clipboard-command.js +45 -0
- package/dist/utils/clipboard-command.js.map +1 -0
- package/dist/utils/clipboard-image.d.ts.map +1 -1
- package/dist/utils/clipboard-image.js +53 -81
- package/dist/utils/clipboard-image.js.map +1 -1
- package/dist/utils/clipboard.d.ts.map +1 -1
- package/dist/utils/clipboard.js +111 -121
- package/dist/utils/clipboard.js.map +1 -1
- package/dist/utils/wsl.d.ts +3 -0
- package/dist/utils/wsl.d.ts.map +1 -0
- package/dist/utils/wsl.js +15 -0
- package/dist/utils/wsl.js.map +1 -0
- package/dist/utils/zip.d.ts +7 -0
- package/dist/utils/zip.d.ts.map +1 -0
- package/dist/utils/zip.js +60 -0
- package/dist/utils/zip.js.map +1 -0
- package/docs/compaction.md +32 -11
- package/docs/custom-provider.md +19 -8
- package/docs/environment-variables.md +1 -0
- package/docs/extensions.md +50 -34
- package/docs/models.md +38 -3
- package/docs/providers.md +9 -1
- package/docs/sdk.md +4 -2
- package/docs/session-format.md +63 -24
- package/docs/sessions.md +28 -1
- package/docs/settings.md +58 -4
- package/docs/termux.md +0 -1
- package/docs/tui.md +2 -0
- package/docs/usage.md +1 -0
- package/examples/extensions/README.md +0 -1
- package/examples/extensions/custom-provider-anthropic/index.ts +18 -12
- package/examples/extensions/custom-provider-gitlab-duo/index.ts +2 -2
- package/examples/extensions/prompt-customizer.ts +19 -67
- package/npm-shrinkwrap.json +275 -1028
- package/package.json +17 -23
- package/dist/bundle/chunks/anthropic-messages-IHRRITCV.js +0 -6
- package/dist/bundle/chunks/azure-openai-responses-QXBIDYXO.js +0 -2
- package/dist/bundle/chunks/chunk-JSJPY26N.js +0 -2
- package/dist/bundle/chunks/chunk-KI6LC764.js +0 -42
- package/dist/bundle/chunks/chunk-OWESLY5T.js +0 -11
- package/dist/bundle/chunks/chunk-RRBI7OUG.js +0 -50
- package/dist/bundle/chunks/chunk-YZJWMPUI.js +0 -2
- package/dist/bundle/chunks/google-generative-ai-NBOR3IQR.js +0 -2
- package/dist/bundle/chunks/google-vertex-VTHX3SUB.js +0 -2
- package/dist/bundle/chunks/https-proxy-agent-2VXB7436.js +0 -13
- package/dist/bundle/chunks/mistral-conversations-NO4ANAA5.js +0 -5
- package/dist/bundle/chunks/openai-codex-responses-5S3T3HMA.js +0 -10
- package/dist/bundle/chunks/openai-completions-CXRRTRWE.js +0 -7
- package/dist/bundle/chunks/openai-responses-CV3MH6VP.js +0 -2
- package/dist/utils/clipboard-native.d.ts +0 -11
- package/dist/utils/clipboard-native.d.ts.map +0 -1
- package/dist/utils/clipboard-native.js +0 -20
- package/dist/utils/clipboard-native.js.map +0 -1
- package/examples/extensions/kimi-deferred-tools.ts +0 -61
|
@@ -52,7 +52,6 @@ class SessionSelectorHeader {
|
|
|
52
52
|
this.statusMessage = null;
|
|
53
53
|
this.statusTimeout = null;
|
|
54
54
|
this.showRenameHint = false;
|
|
55
|
-
this.disposed = false;
|
|
56
55
|
this.scope = scope;
|
|
57
56
|
this.sortMode = sortMode;
|
|
58
57
|
this.nameFilter = nameFilter;
|
|
@@ -91,8 +90,6 @@ class SessionSelectorHeader {
|
|
|
91
90
|
this.statusTimeout = null;
|
|
92
91
|
}
|
|
93
92
|
setStatusMessage(msg, autoHideMs) {
|
|
94
|
-
if (this.disposed)
|
|
95
|
-
return;
|
|
96
93
|
this.clearStatusTimeout();
|
|
97
94
|
this.statusMessage = msg;
|
|
98
95
|
if (!msg || !autoHideMs)
|
|
@@ -102,15 +99,8 @@ class SessionSelectorHeader {
|
|
|
102
99
|
this.statusTimeout = null;
|
|
103
100
|
this.requestRender();
|
|
104
101
|
}, autoHideMs);
|
|
105
|
-
this.statusTimeout.unref?.();
|
|
106
102
|
}
|
|
107
103
|
invalidate() { }
|
|
108
|
-
dispose() {
|
|
109
|
-
if (this.disposed)
|
|
110
|
-
return;
|
|
111
|
-
this.disposed = true;
|
|
112
|
-
this.clearStatusTimeout();
|
|
113
|
-
}
|
|
114
104
|
render(width) {
|
|
115
105
|
const title = this.scope === "current" ? "Resume Session (Current Folder)" : "Resume Session (All)";
|
|
116
106
|
const leftText = theme.bold(title);
|
|
@@ -247,6 +237,7 @@ class SessionList {
|
|
|
247
237
|
this.allSessions = [];
|
|
248
238
|
this.filteredSessions = [];
|
|
249
239
|
this.selectedIndex = 0;
|
|
240
|
+
this.selectionTouched = false;
|
|
250
241
|
this.showCwd = false;
|
|
251
242
|
this.sortMode = "threaded";
|
|
252
243
|
this.nameFilter = "all";
|
|
@@ -284,9 +275,18 @@ class SessionList {
|
|
|
284
275
|
this.filterSessions(this.searchInput.getValue());
|
|
285
276
|
}
|
|
286
277
|
setSessions(sessions, showCwd) {
|
|
278
|
+
const selectedPath = this.selectionTouched ? this.getSelectedSessionPath() : undefined;
|
|
287
279
|
this.allSessions = sessions;
|
|
288
280
|
this.showCwd = showCwd;
|
|
289
281
|
this.filterSessions(this.searchInput.getValue());
|
|
282
|
+
if (!this.selectionTouched) {
|
|
283
|
+
this.selectedIndex = 0;
|
|
284
|
+
}
|
|
285
|
+
else if (selectedPath) {
|
|
286
|
+
const selectedIndex = this.filteredSessions.findIndex((node) => node.session.path === selectedPath);
|
|
287
|
+
if (selectedIndex >= 0)
|
|
288
|
+
this.selectedIndex = selectedIndex;
|
|
289
|
+
}
|
|
290
290
|
}
|
|
291
291
|
filterSessions(query) {
|
|
292
292
|
const trimmed = query.trim();
|
|
@@ -492,6 +492,7 @@ class SessionList {
|
|
|
492
492
|
this.startDeleteConfirmationForSelectedSession();
|
|
493
493
|
return;
|
|
494
494
|
}
|
|
495
|
+
this.selectionTouched = true;
|
|
495
496
|
// Up arrow
|
|
496
497
|
if (kb.matches(keyData, "tui.select.up")) {
|
|
497
498
|
this.selectedIndex = Math.max(0, this.selectedIndex - 1);
|
|
@@ -612,10 +613,8 @@ export class SessionSelectorComponent extends Container {
|
|
|
612
613
|
this.nameFilter = "all";
|
|
613
614
|
this.currentSessions = null;
|
|
614
615
|
this.allSessions = null;
|
|
615
|
-
this.
|
|
616
|
-
this.
|
|
617
|
-
this.allLoadSeq = 0;
|
|
618
|
-
this.disposed = false;
|
|
616
|
+
this.currentLoad = null;
|
|
617
|
+
this.allLoad = null;
|
|
619
618
|
this.mode = "list";
|
|
620
619
|
this.renameInput = new Input();
|
|
621
620
|
this.renameTargetPath = null;
|
|
@@ -624,20 +623,12 @@ export class SessionSelectorComponent extends Container {
|
|
|
624
623
|
this.keybindings = options?.keybindings ?? KeybindingsManager.create();
|
|
625
624
|
this.currentSessionsLoader = currentSessionsLoader;
|
|
626
625
|
this.allSessionsLoader = allSessionsLoader;
|
|
627
|
-
this.requestRender =
|
|
628
|
-
if (!this.disposed)
|
|
629
|
-
requestRender();
|
|
630
|
-
};
|
|
626
|
+
this.requestRender = requestRender;
|
|
631
627
|
this.header = new SessionSelectorHeader(this.scope, this.sortMode, this.nameFilter, this.requestRender);
|
|
632
628
|
const renameSession = options?.renameSession;
|
|
633
629
|
this.renameSession = renameSession;
|
|
634
630
|
this.canRename = !!renameSession;
|
|
635
631
|
this.header.setShowRenameHint(options?.showRenameHint ?? this.canRename);
|
|
636
|
-
this.relativeAgeInterval = setInterval(() => {
|
|
637
|
-
if (!this.disposed)
|
|
638
|
-
this.requestRender();
|
|
639
|
-
}, 60_000);
|
|
640
|
-
this.relativeAgeInterval.unref?.();
|
|
641
632
|
// Create session list (starts empty, will be populated after load)
|
|
642
633
|
this.sessionList = new SessionList([], false, this.sortMode, this.nameFilter, this.keybindings, currentSessionFilePath);
|
|
643
634
|
this.buildBaseLayout(this.sessionList);
|
|
@@ -648,14 +639,17 @@ export class SessionSelectorComponent extends Container {
|
|
|
648
639
|
const clearStatusMessage = () => this.header.setStatusMessage(null);
|
|
649
640
|
this.sessionList.onSelect = (sessionPath) => {
|
|
650
641
|
clearStatusMessage();
|
|
642
|
+
this.cancelLoads();
|
|
651
643
|
onSelect(sessionPath);
|
|
652
644
|
};
|
|
653
645
|
this.sessionList.onCancel = () => {
|
|
654
646
|
clearStatusMessage();
|
|
647
|
+
this.cancelLoads();
|
|
655
648
|
onCancel();
|
|
656
649
|
};
|
|
657
650
|
this.sessionList.onExit = () => {
|
|
658
651
|
clearStatusMessage();
|
|
652
|
+
this.cancelLoads();
|
|
659
653
|
onExit();
|
|
660
654
|
};
|
|
661
655
|
this.sessionList.onToggleScope = () => this.toggleScope();
|
|
@@ -664,9 +658,7 @@ export class SessionSelectorComponent extends Container {
|
|
|
664
658
|
this.sessionList.onRenameSession = (sessionPath) => {
|
|
665
659
|
if (!renameSession)
|
|
666
660
|
return;
|
|
667
|
-
if (this.scope === "current"
|
|
668
|
-
return;
|
|
669
|
-
if (this.scope === "all" && this.allLoading)
|
|
661
|
+
if (this.scope === "current" ? this.currentLoad : this.allLoad)
|
|
670
662
|
return;
|
|
671
663
|
const sessions = this.scope === "all" ? (this.allSessions ?? []) : (this.currentSessions ?? []);
|
|
672
664
|
const session = sessions.find((s) => s.path === sessionPath);
|
|
@@ -688,8 +680,6 @@ export class SessionSelectorComponent extends Container {
|
|
|
688
680
|
// Handle session deletion
|
|
689
681
|
this.sessionList.onDeleteSession = async (sessionPath) => {
|
|
690
682
|
const result = await deleteSessionFile(sessionPath);
|
|
691
|
-
if (this.disposed)
|
|
692
|
-
return;
|
|
693
683
|
if (result.ok) {
|
|
694
684
|
if (this.currentSessions) {
|
|
695
685
|
this.currentSessions = this.currentSessions.filter((s) => s.path !== sessionPath);
|
|
@@ -703,8 +693,6 @@ export class SessionSelectorComponent extends Container {
|
|
|
703
693
|
const msg = result.method === "trash" ? "Session moved to trash" : "Session deleted";
|
|
704
694
|
this.header.setStatusMessage({ type: "info", message: msg }, 2000);
|
|
705
695
|
await this.refreshSessionsAfterMutation();
|
|
706
|
-
if (this.disposed)
|
|
707
|
-
return;
|
|
708
696
|
}
|
|
709
697
|
else {
|
|
710
698
|
const errorMessage = result.error ?? "Unknown error";
|
|
@@ -713,14 +701,21 @@ export class SessionSelectorComponent extends Container {
|
|
|
713
701
|
this.requestRender();
|
|
714
702
|
};
|
|
715
703
|
// Start loading current sessions immediately
|
|
716
|
-
this.
|
|
704
|
+
void this.loadScope("current");
|
|
717
705
|
}
|
|
718
|
-
|
|
719
|
-
|
|
706
|
+
cancelLoads() {
|
|
707
|
+
if (this.currentLoad) {
|
|
708
|
+
this.currentLoad.abort();
|
|
709
|
+
this.currentLoad = null;
|
|
710
|
+
this.currentSessions = null;
|
|
711
|
+
}
|
|
712
|
+
if (this.allLoad) {
|
|
713
|
+
this.allLoad.abort();
|
|
714
|
+
this.allLoad = null;
|
|
715
|
+
this.allSessions = null;
|
|
716
|
+
}
|
|
720
717
|
}
|
|
721
718
|
enterRenameMode(sessionPath, currentName) {
|
|
722
|
-
if (this.disposed)
|
|
723
|
-
return;
|
|
724
719
|
this.mode = "rename";
|
|
725
720
|
this.renameTargetPath = sessionPath;
|
|
726
721
|
this.renameInput.setValue(currentName ?? "");
|
|
@@ -735,8 +730,6 @@ export class SessionSelectorComponent extends Container {
|
|
|
735
730
|
this.requestRender();
|
|
736
731
|
}
|
|
737
732
|
exitRenameMode() {
|
|
738
|
-
if (this.disposed)
|
|
739
|
-
return;
|
|
740
733
|
this.mode = "list";
|
|
741
734
|
this.renameTargetPath = null;
|
|
742
735
|
this.buildBaseLayout(this.sessionList);
|
|
@@ -759,81 +752,83 @@ export class SessionSelectorComponent extends Container {
|
|
|
759
752
|
}
|
|
760
753
|
try {
|
|
761
754
|
await renameSession(target, next);
|
|
762
|
-
if (this.disposed)
|
|
763
|
-
return;
|
|
764
755
|
await this.refreshSessionsAfterMutation();
|
|
765
756
|
}
|
|
766
757
|
finally {
|
|
767
|
-
|
|
768
|
-
this.exitRenameMode();
|
|
758
|
+
this.exitRenameMode();
|
|
769
759
|
}
|
|
770
760
|
}
|
|
771
|
-
async loadScope(scope
|
|
772
|
-
if (this.
|
|
761
|
+
async loadScope(scope) {
|
|
762
|
+
if (scope === "current" ? this.currentLoad : this.allLoad)
|
|
773
763
|
return;
|
|
774
764
|
const showCwd = scope === "all";
|
|
775
|
-
|
|
765
|
+
const controller = new AbortController();
|
|
776
766
|
if (scope === "current") {
|
|
777
|
-
this.
|
|
767
|
+
this.currentLoad = controller;
|
|
778
768
|
}
|
|
779
769
|
else {
|
|
780
|
-
this.
|
|
770
|
+
this.allLoad = controller;
|
|
781
771
|
}
|
|
782
|
-
const seq = scope === "all" ? ++this.allLoadSeq : undefined;
|
|
783
772
|
this.header.setScope(scope);
|
|
784
773
|
this.header.setLoading(true);
|
|
785
774
|
this.requestRender();
|
|
786
|
-
const
|
|
787
|
-
|
|
775
|
+
const isActive = () => (scope === "current" ? this.currentLoad : this.allLoad) === controller;
|
|
776
|
+
const onProgress = (loaded, total, partialSessions) => {
|
|
777
|
+
if (!isActive())
|
|
788
778
|
return;
|
|
779
|
+
if (partialSessions) {
|
|
780
|
+
const sessions = [...partialSessions];
|
|
781
|
+
if (scope === "current") {
|
|
782
|
+
this.currentSessions = sessions;
|
|
783
|
+
}
|
|
784
|
+
else {
|
|
785
|
+
this.allSessions = sessions;
|
|
786
|
+
}
|
|
787
|
+
if (scope === this.scope)
|
|
788
|
+
this.sessionList.setSessions(sessions, showCwd);
|
|
789
|
+
}
|
|
789
790
|
if (scope !== this.scope)
|
|
790
791
|
return;
|
|
791
|
-
if (seq !== undefined && seq !== this.allLoadSeq)
|
|
792
|
-
return;
|
|
793
792
|
this.header.setProgress(loaded, total);
|
|
794
793
|
this.requestRender();
|
|
795
794
|
};
|
|
796
795
|
try {
|
|
797
796
|
const sessions = await (scope === "current"
|
|
798
|
-
? this.currentSessionsLoader(onProgress)
|
|
799
|
-
: this.allSessionsLoader(onProgress));
|
|
800
|
-
if (
|
|
797
|
+
? this.currentSessionsLoader(onProgress, controller.signal)
|
|
798
|
+
: this.allSessionsLoader(onProgress, controller.signal));
|
|
799
|
+
if (!isActive())
|
|
801
800
|
return;
|
|
802
801
|
if (scope === "current") {
|
|
803
802
|
this.currentSessions = sessions;
|
|
804
|
-
this.
|
|
803
|
+
this.currentLoad = null;
|
|
805
804
|
}
|
|
806
805
|
else {
|
|
807
806
|
this.allSessions = sessions;
|
|
808
|
-
this.
|
|
807
|
+
this.allLoad = null;
|
|
809
808
|
}
|
|
810
809
|
if (scope !== this.scope)
|
|
811
810
|
return;
|
|
812
|
-
if (seq !== undefined && seq !== this.allLoadSeq)
|
|
813
|
-
return;
|
|
814
811
|
this.header.setLoading(false);
|
|
815
812
|
this.sessionList.setSessions(sessions, showCwd);
|
|
816
813
|
this.requestRender();
|
|
817
814
|
}
|
|
818
815
|
catch (err) {
|
|
819
|
-
if (
|
|
816
|
+
if (!isActive())
|
|
820
817
|
return;
|
|
821
818
|
if (scope === "current") {
|
|
822
|
-
this.
|
|
819
|
+
this.currentLoad = null;
|
|
820
|
+
this.currentSessions = null;
|
|
823
821
|
}
|
|
824
822
|
else {
|
|
825
|
-
this.
|
|
823
|
+
this.allLoad = null;
|
|
824
|
+
this.allSessions = null;
|
|
826
825
|
}
|
|
827
826
|
if (scope !== this.scope)
|
|
828
827
|
return;
|
|
829
|
-
if (seq !== undefined && seq !== this.allLoadSeq)
|
|
830
|
-
return;
|
|
831
828
|
const message = err instanceof Error ? err.message : String(err);
|
|
832
829
|
this.header.setLoading(false);
|
|
833
830
|
this.header.setStatusMessage({ type: "error", message: `Failed to load sessions: ${message}` }, 4000);
|
|
834
|
-
|
|
835
|
-
this.sessionList.setSessions([], showCwd);
|
|
836
|
-
}
|
|
831
|
+
this.sessionList.setSessions([], showCwd);
|
|
837
832
|
this.requestRender();
|
|
838
833
|
}
|
|
839
834
|
}
|
|
@@ -851,42 +846,24 @@ export class SessionSelectorComponent extends Container {
|
|
|
851
846
|
this.requestRender();
|
|
852
847
|
}
|
|
853
848
|
async refreshSessionsAfterMutation() {
|
|
854
|
-
|
|
849
|
+
this.cancelLoads();
|
|
850
|
+
this.currentSessions = null;
|
|
851
|
+
this.allSessions = null;
|
|
852
|
+
await this.loadScope(this.scope);
|
|
855
853
|
}
|
|
856
854
|
toggleScope() {
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
if (this.allSessions !== null) {
|
|
861
|
-
this.header.setLoading(false);
|
|
862
|
-
this.sessionList.setSessions(this.allSessions, true);
|
|
863
|
-
this.requestRender();
|
|
864
|
-
return;
|
|
865
|
-
}
|
|
866
|
-
if (!this.allLoading) {
|
|
867
|
-
void this.loadScope("all", "toggle");
|
|
868
|
-
}
|
|
869
|
-
return;
|
|
870
|
-
}
|
|
871
|
-
this.scope = "current";
|
|
855
|
+
this.scope = this.scope === "current" ? "all" : "current";
|
|
856
|
+
const sessions = this.scope === "current" ? this.currentSessions : this.allSessions;
|
|
857
|
+
const loading = (this.scope === "current" ? this.currentLoad : this.allLoad) !== null;
|
|
872
858
|
this.header.setScope(this.scope);
|
|
873
|
-
this.header.setLoading(
|
|
874
|
-
this.sessionList.setSessions(
|
|
859
|
+
this.header.setLoading(loading);
|
|
860
|
+
this.sessionList.setSessions(sessions ?? [], this.scope === "all");
|
|
875
861
|
this.requestRender();
|
|
862
|
+
if (sessions === null && !loading)
|
|
863
|
+
void this.loadScope(this.scope);
|
|
876
864
|
}
|
|
877
865
|
getSessionList() {
|
|
878
866
|
return this.sessionList;
|
|
879
867
|
}
|
|
880
|
-
dispose() {
|
|
881
|
-
if (this.disposed)
|
|
882
|
-
return;
|
|
883
|
-
this.disposed = true;
|
|
884
|
-
this.allLoadSeq++;
|
|
885
|
-
this.header.dispose();
|
|
886
|
-
if (this.relativeAgeInterval !== undefined) {
|
|
887
|
-
clearInterval(this.relativeAgeInterval);
|
|
888
|
-
this.relativeAgeInterval = undefined;
|
|
889
|
-
}
|
|
890
|
-
}
|
|
891
868
|
}
|
|
892
869
|
//# sourceMappingURL=session-selector.js.map
|