@bastani/atomic 0.9.5-alpha.6 → 0.9.5-alpha.8
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 +35 -2
- package/dist/builtin/cursor/package.json +2 -2
- package/dist/builtin/intercom/CHANGELOG.md +17 -0
- package/dist/builtin/intercom/README.md +27 -21
- package/dist/builtin/intercom/broker/broker.ts +3 -6
- package/dist/builtin/intercom/broker/paths.ts +42 -5
- package/dist/builtin/intercom/broker/spawn.ts +78 -10
- package/dist/builtin/intercom/config.ts +6 -3
- package/dist/builtin/intercom/contact-supervisor-tool.ts +6 -4
- package/dist/builtin/intercom/index-heavy.ts +1 -1
- package/dist/builtin/intercom/index.ts +162 -130
- package/dist/builtin/intercom/intercom-tool.ts +9 -3
- package/dist/builtin/intercom/package.json +10 -1
- package/dist/builtin/intercom/result-renderers.ts +1 -1
- package/dist/builtin/intercom/ui/compose.ts +2 -2
- package/dist/builtin/intercom/ui/inline-message.ts +2 -2
- package/dist/builtin/intercom/ui/session-list.ts +2 -2
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/CHANGELOG.md +6 -0
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/subagents/src/tui/render-event-formatting.ts +15 -48
- package/dist/builtin/subagents/src/tui/render-layout.ts +9 -0
- package/dist/builtin/subagents/src/tui/render-widget-graph.ts +27 -25
- package/dist/builtin/subagents/src/tui/render-widget.ts +46 -69
- package/dist/builtin/subagents/src/tui/render.ts +1 -1
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/builtin/workflows/CHANGELOG.md +11 -0
- package/dist/builtin/workflows/README.md +3 -1
- package/dist/builtin/workflows/builtin/goal-artifacts.ts +3 -1
- package/dist/builtin/workflows/builtin/goal-prompts.ts +23 -2
- package/dist/builtin/workflows/builtin/goal-reducer.ts +21 -0
- package/dist/builtin/workflows/builtin/goal-review.ts +60 -6
- package/dist/builtin/workflows/builtin/goal-runner.ts +32 -21
- package/dist/builtin/workflows/builtin/goal-types.ts +7 -1
- package/dist/builtin/workflows/builtin/ralph-core.ts +52 -4
- package/dist/builtin/workflows/builtin/ralph-review-gate.ts +10 -3
- package/dist/builtin/workflows/builtin/ralph-reviewer-prompt.ts +23 -2
- package/dist/builtin/workflows/builtin/ralph-runner.ts +38 -16
- package/dist/builtin/workflows/builtin/review-convergence.ts +111 -0
- package/dist/builtin/workflows/package.json +1 -1
- package/dist/builtin/workflows/skills/create-spec/SKILL.md +2 -0
- package/dist/builtin/workflows/src/durable/child-primitive.ts +12 -8
- package/dist/builtin/workflows/src/durable/dbos-backend.ts +47 -2
- package/dist/builtin/workflows/src/durable/dbos-envelope.ts +28 -0
- package/dist/builtin/workflows/src/durable/stage-primitive.ts +165 -27
- package/dist/builtin/workflows/src/durable/types.ts +14 -1
- package/dist/builtin/workflows/src/engine/run.ts +12 -13
- package/dist/builtin/workflows/src/extension/workflow-prompts.ts +2 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-continuation.ts +13 -3
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-factory.ts +1 -1
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-controller.ts +18 -19
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-unresolved-overflow.ts +38 -0
- package/dist/builtin/workflows/src/shared/persistence-restore-helpers.ts +18 -1
- package/dist/builtin/workflows/src/shared/persistence-restore.ts +23 -5
- package/dist/builtin/workflows/src/shared/persistence-session-entries.ts +4 -0
- package/dist/bun/internal-intercom-broker.d.ts +6 -0
- package/dist/bun/internal-intercom-broker.d.ts.map +1 -0
- package/dist/bun/internal-intercom-broker.js +39 -0
- package/dist/bun/internal-intercom-broker.js.map +1 -0
- package/dist/bun/split-loader.d.ts +2 -0
- package/dist/bun/split-loader.d.ts.map +1 -0
- package/dist/bun/split-loader.js +50 -0
- package/dist/bun/split-loader.js.map +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +6 -4
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session-auto-compaction.d.ts +7 -7
- package/dist/core/agent-session-auto-compaction.d.ts.map +1 -1
- package/dist/core/agent-session-auto-compaction.js +62 -16
- package/dist/core/agent-session-auto-compaction.js.map +1 -1
- package/dist/core/agent-session-events.d.ts.map +1 -1
- package/dist/core/agent-session-events.js +3 -1
- package/dist/core/agent-session-events.js.map +1 -1
- package/dist/core/agent-session-extension-bindings.d.ts.map +1 -1
- package/dist/core/agent-session-extension-bindings.js +1 -1
- package/dist/core/agent-session-extension-bindings.js.map +1 -1
- package/dist/core/agent-session-methods.d.ts +10 -4
- package/dist/core/agent-session-methods.d.ts.map +1 -1
- package/dist/core/agent-session-methods.js.map +1 -1
- package/dist/core/agent-session-models.d.ts +2 -2
- package/dist/core/agent-session-models.d.ts.map +1 -1
- package/dist/core/agent-session-models.js.map +1 -1
- package/dist/core/agent-session-prompt.d.ts.map +1 -1
- package/dist/core/agent-session-prompt.js +1 -0
- package/dist/core/agent-session-prompt.js.map +1 -1
- package/dist/core/agent-session-retry.d.ts +2 -0
- package/dist/core/agent-session-retry.d.ts.map +1 -1
- package/dist/core/agent-session-retry.js +152 -4
- package/dist/core/agent-session-retry.js.map +1 -1
- package/dist/core/agent-session-services.d.ts +1 -0
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +1 -0
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session-types.d.ts +15 -1
- package/dist/core/agent-session-types.d.ts.map +1 -1
- package/dist/core/agent-session-types.js.map +1 -1
- package/dist/core/agent-session.d.ts +4 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +4 -0
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/builtin-packages.d.ts.map +1 -1
- package/dist/core/builtin-packages.js +8 -4
- package/dist/core/builtin-packages.js.map +1 -1
- package/dist/core/compaction/context-compaction-runner.d.ts.map +1 -1
- package/dist/core/compaction/context-compaction-runner.js +36 -20
- package/dist/core/compaction/context-compaction-runner.js.map +1 -1
- package/dist/core/copilot-anthropic-sse-repair.d.ts +23 -0
- package/dist/core/copilot-anthropic-sse-repair.d.ts.map +1 -0
- package/dist/core/copilot-anthropic-sse-repair.js +340 -0
- package/dist/core/copilot-anthropic-sse-repair.js.map +1 -0
- package/dist/core/copilot-gemini-reasoning.d.ts +16 -8
- package/dist/core/copilot-gemini-reasoning.d.ts.map +1 -1
- package/dist/core/copilot-gemini-reasoning.js +27 -22
- package/dist/core/copilot-gemini-reasoning.js.map +1 -1
- package/dist/core/copilot-hosts.d.ts +12 -0
- package/dist/core/copilot-hosts.d.ts.map +1 -0
- package/dist/core/copilot-hosts.js +33 -0
- package/dist/core/copilot-hosts.js.map +1 -0
- package/dist/core/copilot-model-catalog.d.ts.map +1 -1
- package/dist/core/copilot-model-catalog.js +3 -2
- package/dist/core/copilot-model-catalog.js.map +1 -1
- package/dist/core/extensions/agent-events.d.ts +1 -1
- package/dist/core/extensions/agent-events.d.ts.map +1 -1
- package/dist/core/extensions/agent-events.js.map +1 -1
- package/dist/core/extensions/loader-virtual-modules.d.ts.map +1 -1
- package/dist/core/extensions/loader-virtual-modules.js +8 -3
- package/dist/core/extensions/loader-virtual-modules.js.map +1 -1
- package/dist/core/http-dispatcher.d.ts.map +1 -1
- package/dist/core/http-dispatcher.js +5 -5
- package/dist/core/http-dispatcher.js.map +1 -1
- package/dist/core/openai-responses-payload-sanitizer.d.ts +6 -0
- package/dist/core/openai-responses-payload-sanitizer.d.ts.map +1 -0
- package/dist/core/openai-responses-payload-sanitizer.js +59 -0
- package/dist/core/openai-responses-payload-sanitizer.js.map +1 -0
- package/dist/core/package-manager-auto-resources.d.ts +2 -2
- package/dist/core/package-manager-auto-resources.d.ts.map +1 -1
- package/dist/core/package-manager-auto-resources.js +32 -52
- package/dist/core/package-manager-auto-resources.js.map +1 -1
- package/dist/core/package-manager-resolver.d.ts.map +1 -1
- package/dist/core/package-manager-resolver.js +23 -14
- package/dist/core/package-manager-resolver.js.map +1 -1
- package/dist/core/package-manager-resource-collector.d.ts +3 -3
- package/dist/core/package-manager-resource-collector.d.ts.map +1 -1
- package/dist/core/package-manager-resource-collector.js +76 -73
- package/dist/core/package-manager-resource-collector.js.map +1 -1
- package/dist/core/package-manager-resource-files.d.ts +9 -8
- package/dist/core/package-manager-resource-files.d.ts.map +1 -1
- package/dist/core/package-manager-resource-files.js +92 -81
- package/dist/core/package-manager-resource-files.js.map +1 -1
- package/dist/core/prompt-templates-async.d.ts +3 -0
- package/dist/core/prompt-templates-async.d.ts.map +1 -0
- package/dist/core/prompt-templates-async.js +118 -0
- package/dist/core/prompt-templates-async.js.map +1 -0
- package/dist/core/provider-context-usage.d.ts +11 -0
- package/dist/core/provider-context-usage.d.ts.map +1 -0
- package/dist/core/provider-context-usage.js +58 -0
- package/dist/core/provider-context-usage.js.map +1 -0
- package/dist/core/resource-loader-assets.d.ts +3 -3
- package/dist/core/resource-loader-assets.d.ts.map +1 -1
- package/dist/core/resource-loader-assets.js +66 -83
- package/dist/core/resource-loader-assets.js.map +1 -1
- package/dist/core/resource-loader-core.d.ts +1 -1
- package/dist/core/resource-loader-core.d.ts.map +1 -1
- package/dist/core/resource-loader-core.js +5 -5
- package/dist/core/resource-loader-core.js.map +1 -1
- package/dist/core/resource-loader-reload.d.ts.map +1 -1
- package/dist/core/resource-loader-reload.js +43 -7
- package/dist/core/resource-loader-reload.js.map +1 -1
- package/dist/core/resource-loader-types.d.ts +7 -1
- package/dist/core/resource-loader-types.d.ts.map +1 -1
- package/dist/core/resource-loader-types.js.map +1 -1
- package/dist/core/sdk-types.d.ts +2 -0
- package/dist/core/sdk-types.d.ts.map +1 -1
- package/dist/core/sdk-types.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +7 -4
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/settings-manager-basic-accessors.d.ts +1 -0
- package/dist/core/settings-manager-basic-accessors.d.ts.map +1 -1
- package/dist/core/settings-manager-basic-accessors.js +6 -0
- package/dist/core/settings-manager-basic-accessors.js.map +1 -1
- package/dist/core/settings-types.d.ts +1 -0
- package/dist/core/settings-types.d.ts.map +1 -1
- package/dist/core/settings-types.js.map +1 -1
- package/dist/core/skills-async.d.ts +3 -0
- package/dist/core/skills-async.d.ts.map +1 -0
- package/dist/core/skills-async.js +269 -0
- package/dist/core/skills-async.js.map +1 -0
- package/dist/index-extensions.d.ts +1 -1
- package/dist/index-extensions.d.ts.map +1 -1
- package/dist/index-extensions.js.map +1 -1
- package/dist/main-deferred-startup.d.ts +14 -0
- package/dist/main-deferred-startup.d.ts.map +1 -1
- package/dist/main-deferred-startup.js +23 -0
- package/dist/main-deferred-startup.js.map +1 -1
- package/dist/main-early-input.d.ts +41 -0
- package/dist/main-early-input.d.ts.map +1 -0
- package/dist/main-early-input.js +147 -0
- package/dist/main-early-input.js.map +1 -0
- package/dist/main.d.ts +0 -6
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +23 -17
- package/dist/main.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 +15 -0
- package/dist/modes/interactive/components/chat-session-host-events.js.map +1 -1
- package/dist/modes/interactive/interactive-agent-events.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-agent-events.js +34 -1
- package/dist/modes/interactive/interactive-agent-events.js.map +1 -1
- package/dist/modes/interactive/interactive-deferred-startup.d.ts +6 -0
- package/dist/modes/interactive/interactive-deferred-startup.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-deferred-startup.js +27 -13
- package/dist/modes/interactive/interactive-deferred-startup.js.map +1 -1
- package/dist/modes/interactive/interactive-editor-actions.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-editor-actions.js +13 -13
- package/dist/modes/interactive/interactive-editor-actions.js.map +1 -1
- package/dist/modes/interactive/interactive-extension-runtime.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-extension-runtime.js +16 -0
- package/dist/modes/interactive/interactive-extension-runtime.js.map +1 -1
- package/dist/modes/interactive/interactive-input-handling.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-input-handling.js +324 -178
- package/dist/modes/interactive/interactive-input-handling.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-base.d.ts +14 -0
- package/dist/modes/interactive/interactive-mode-base.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-base.js +41 -0
- package/dist/modes/interactive/interactive-mode-base.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-surface.d.ts +22 -6
- package/dist/modes/interactive/interactive-mode-surface.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-surface.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-types.d.ts +3 -0
- package/dist/modes/interactive/interactive-mode-types.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-types.js.map +1 -1
- package/dist/modes/interactive/interactive-model-routing.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-model-routing.js +3 -3
- package/dist/modes/interactive/interactive-model-routing.js.map +1 -1
- package/dist/modes/interactive/interactive-onboarding.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-onboarding.js +1 -0
- package/dist/modes/interactive/interactive-onboarding.js.map +1 -1
- package/dist/modes/interactive/interactive-process-lifecycle.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-process-lifecycle.js +43 -6
- package/dist/modes/interactive/interactive-process-lifecycle.js.map +1 -1
- package/dist/modes/interactive/interactive-render-chat.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-render-chat.js +78 -9
- package/dist/modes/interactive/interactive-render-chat.js.map +1 -1
- package/dist/modes/interactive/interactive-resource-disclosure.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-resource-disclosure.js +3 -2
- package/dist/modes/interactive/interactive-resource-disclosure.js.map +1 -1
- package/dist/modes/interactive/interactive-resource-rendering.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-resource-rendering.js +10 -8
- package/dist/modes/interactive/interactive-resource-rendering.js.map +1 -1
- package/dist/modes/interactive/interactive-session-runtime.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-session-runtime.js +1 -1
- package/dist/modes/interactive/interactive-session-runtime.js.map +1 -1
- package/dist/modes/interactive/interactive-startup.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-startup.js +65 -53
- package/dist/modes/interactive/interactive-startup.js.map +1 -1
- package/dist/modes/interactive/theme/theme-loading.d.ts +1 -0
- package/dist/modes/interactive/theme/theme-loading.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme-loading.js +3 -0
- package/dist/modes/interactive/theme/theme-loading.js.map +1 -1
- package/dist/modes/interactive/theme/theme.d.ts +1 -1
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +1 -1
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/utils/module-require.d.ts +11 -0
- package/dist/utils/module-require.d.ts.map +1 -1
- package/dist/utils/module-require.js +14 -1
- package/dist/utils/module-require.js.map +1 -1
- package/dist/utils/split-launcher.d.ts +38 -0
- package/dist/utils/split-launcher.d.ts.map +1 -0
- package/dist/utils/split-launcher.js +63 -0
- package/dist/utils/split-launcher.js.map +1 -0
- package/docs/compaction.md +7 -0
- package/docs/json.md +3 -1
- package/docs/keybindings.md +2 -2
- package/docs/providers.md +2 -1
- package/docs/rpc.md +3 -1
- package/docs/settings.md +28 -2
- package/docs/terminal-setup.md +4 -0
- package/docs/usage.md +3 -3
- package/docs/workflows.md +13 -3
- package/npm-shrinkwrap.json +513 -23
- package/package.json +5 -4
|
@@ -1,6 +1,51 @@
|
|
|
1
|
-
import { InteractiveModeBase } from "./interactive-mode-base.js";
|
|
1
|
+
import { InteractiveModeBase, seedStartupInput } from "./interactive-mode-base.js";
|
|
2
2
|
import { pasteClipboardImageToEditor } from "./interactive-mode-deps.js";
|
|
3
|
+
import { yieldToEventLoop } from "../../utils/event-loop.js";
|
|
4
|
+
InteractiveModeBase.prototype.runUserPromptTurn = async function (userInput) {
|
|
5
|
+
// Show the working spinner immediately on submit so there is no visible gap
|
|
6
|
+
// while prompt preflight runs before the agent emits `agent_start`.
|
|
7
|
+
this.showWorkingLoaderNow();
|
|
8
|
+
if (this.deferredStartupPending) {
|
|
9
|
+
this.deferLoadedResourcesDisclosureUntilAgentEnd = true;
|
|
10
|
+
}
|
|
11
|
+
// Yield once so the freshly-mounted spinner paints before synchronous
|
|
12
|
+
// preflight work can block the event loop.
|
|
13
|
+
await yieldToEventLoop();
|
|
14
|
+
try {
|
|
15
|
+
await this.ensureDeferredStartupComplete();
|
|
16
|
+
await this.session.prompt(userInput);
|
|
17
|
+
this.deferLoadedResourcesDisclosureUntilAgentEnd = false;
|
|
18
|
+
if (this.pendingLoadedResourcesDisclosure) {
|
|
19
|
+
this.pendingLoadedResourcesDisclosure = false;
|
|
20
|
+
this.showLoadedResources({ force: true, showDiagnosticsWhenQuiet: true, targetContainer: this.startupNoticesContainer });
|
|
21
|
+
void this.maybeWarnAboutAnthropicSubscriptionAuth(undefined, this.startupNoticesContainer);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
this.deferLoadedResourcesDisclosureUntilAgentEnd = false;
|
|
26
|
+
this.discardDeferredRenderedUserInput(userInput);
|
|
27
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown error occurred";
|
|
28
|
+
this.showError(errorMessage);
|
|
29
|
+
}
|
|
30
|
+
finally {
|
|
31
|
+
// A submission that resolves without starting an agent turn (e.g. an
|
|
32
|
+
// extension slash-command) never emits `agent_end`, so clear the
|
|
33
|
+
// pre-shown spinner here when idle to avoid a lingering indicator.
|
|
34
|
+
if (!this.session.isStreaming) {
|
|
35
|
+
this.stopWorkingLoader();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
3
39
|
InteractiveModeBase.prototype.setupKeyHandlers = function () {
|
|
40
|
+
this.ui.addInputListener((data) => {
|
|
41
|
+
if (!this.keybindings.matches(data, "app.clear"))
|
|
42
|
+
return undefined;
|
|
43
|
+
if (this.ui.hasOverlay())
|
|
44
|
+
return undefined;
|
|
45
|
+
this.handleCtrlC();
|
|
46
|
+
this.ui.requestRender();
|
|
47
|
+
return { consume: true };
|
|
48
|
+
});
|
|
4
49
|
// Set up handlers on defaultEditor - they use this.editor for text access
|
|
5
50
|
// so they work correctly regardless of which editor is active
|
|
6
51
|
this.defaultEditor.onEscape = () => {
|
|
@@ -71,205 +116,306 @@ InteractiveModeBase.prototype.handleClipboardImagePaste = async function () {
|
|
|
71
116
|
showWarning: (message) => this.showWarning(message),
|
|
72
117
|
});
|
|
73
118
|
};
|
|
74
|
-
InteractiveModeBase.prototype.
|
|
75
|
-
this.
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}
|
|
133
|
-
if (text === "/changelog") {
|
|
134
|
-
this.handleChangelogCommand();
|
|
135
|
-
this.editor.setText("");
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
if (text === "/atomic" || text.startsWith("/atomic ")) {
|
|
139
|
-
this.editor.setText("");
|
|
140
|
-
await this.session.prompt(text);
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
if (text === "/hotkeys") {
|
|
144
|
-
this.handleHotkeysCommand();
|
|
145
|
-
this.editor.setText("");
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
if (text === "/fork") {
|
|
149
|
-
this.showUserMessageSelector();
|
|
150
|
-
this.editor.setText("");
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
if (text === "/clone") {
|
|
154
|
-
this.editor.setText("");
|
|
155
|
-
await this.handleCloneCommand();
|
|
156
|
-
return;
|
|
157
|
-
}
|
|
158
|
-
if (text === "/tree") {
|
|
159
|
-
this.showTreeSelector();
|
|
160
|
-
this.editor.setText("");
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
if (text === "/trust") {
|
|
164
|
-
this.showTrustSelector();
|
|
119
|
+
InteractiveModeBase.prototype.deliverStartupReplayPrompt = function (text) {
|
|
120
|
+
if (this.onInputCallback) {
|
|
121
|
+
if (!text.startsWith("/")) {
|
|
122
|
+
this.renderDeferredUserInput(text);
|
|
123
|
+
}
|
|
124
|
+
const callback = this.onInputCallback;
|
|
125
|
+
this.onInputCallback = undefined;
|
|
126
|
+
callback(text);
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
this.pendingUserInputs.push(text);
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
InteractiveModeBase.prototype.recoverCookedStartupInput = function () {
|
|
133
|
+
if (this.startupCookedInputRecovered || this.pendingUserInputs.length > 0)
|
|
134
|
+
return true;
|
|
135
|
+
const text = this.editor.getText();
|
|
136
|
+
const cookedLines = text.split(/\r?\n/).map((line) => line.trim()).filter(Boolean);
|
|
137
|
+
const isCommandLike = (line) => line !== undefined && (line.startsWith("/") || line.startsWith("!"));
|
|
138
|
+
const singleCommandLike = cookedLines.length === 1 && isCommandLike(cookedLines[0]);
|
|
139
|
+
if (cookedLines.length < 2 && !singleCommandLike)
|
|
140
|
+
return false;
|
|
141
|
+
this.startupCookedInputRecovered = true;
|
|
142
|
+
const activeInput = this.startupReplayActiveInput?.trim();
|
|
143
|
+
let draftText = "";
|
|
144
|
+
let submissions = cookedLines;
|
|
145
|
+
if (activeInput === undefined &&
|
|
146
|
+
cookedLines.length > 1 &&
|
|
147
|
+
!isCommandLike(cookedLines[cookedLines.length - 1]) &&
|
|
148
|
+
(!isCommandLike(cookedLines[0]) || cookedLines.length > 2)) {
|
|
149
|
+
draftText = cookedLines[cookedLines.length - 1] ?? "";
|
|
150
|
+
submissions = cookedLines.slice(0, -1);
|
|
151
|
+
}
|
|
152
|
+
else if (activeInput && cookedLines.length > 1 && !isCommandLike(cookedLines[cookedLines.length - 1])) {
|
|
153
|
+
draftText = cookedLines[cookedLines.length - 1] ?? "";
|
|
154
|
+
submissions = cookedLines.slice(0, -1);
|
|
155
|
+
}
|
|
156
|
+
if (submissions.length === 0)
|
|
157
|
+
return true;
|
|
158
|
+
if (activeInput) {
|
|
159
|
+
const queuedSubmissions = submissions[0] === activeInput ? submissions.slice(1) : submissions;
|
|
160
|
+
this.editor.setText(draftText);
|
|
161
|
+
this.startupReplayInputs.push(...queuedSubmissions);
|
|
162
|
+
return true;
|
|
163
|
+
}
|
|
164
|
+
this.editor.setText("");
|
|
165
|
+
seedStartupInput(this.pendingUserInputs, this.editor, { text: draftText, submissions }, this.startupReplayInputs, (draft) => {
|
|
166
|
+
this.startupDraftText = draft;
|
|
167
|
+
}, (active) => {
|
|
168
|
+
this.startupReplayActiveInput = active;
|
|
169
|
+
});
|
|
170
|
+
return true;
|
|
171
|
+
};
|
|
172
|
+
InteractiveModeBase.prototype.drainStartupReplayCommands = async function () {
|
|
173
|
+
while (this.pendingUserInputs.length === 0 && this.startupReplayActiveInput) {
|
|
174
|
+
const activeInput = this.startupReplayActiveInput;
|
|
175
|
+
await this.defaultEditor.onSubmit?.(activeInput);
|
|
176
|
+
if (this.editor.getText().trim() === activeInput.trim()) {
|
|
165
177
|
this.editor.setText("");
|
|
166
|
-
return;
|
|
167
178
|
}
|
|
168
|
-
if (
|
|
169
|
-
|
|
170
|
-
|
|
179
|
+
if (this.startupReplayActiveInput?.trim() === activeInput.trim())
|
|
180
|
+
break;
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
InteractiveModeBase.prototype.advanceStartupInputReplay = function (submittedText) {
|
|
184
|
+
if (this.startupReplayActiveInput?.trim() !== submittedText.trim())
|
|
185
|
+
return;
|
|
186
|
+
this.startupReplayActiveInput = undefined;
|
|
187
|
+
while (this.startupReplayInputs.length > 0) {
|
|
188
|
+
const nextInput = this.startupReplayInputs.shift();
|
|
189
|
+
if (nextInput === undefined)
|
|
190
|
+
break;
|
|
191
|
+
const trimmed = nextInput.trimStart();
|
|
192
|
+
if (trimmed.startsWith("/") || trimmed.startsWith("!")) {
|
|
193
|
+
this.startupReplayActiveInput = nextInput.trim();
|
|
194
|
+
this.editor.setText(this.startupReplayActiveInput);
|
|
195
|
+
this.ui.requestRender();
|
|
171
196
|
return;
|
|
172
197
|
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
198
|
+
this.deliverStartupReplayPrompt(nextInput);
|
|
199
|
+
}
|
|
200
|
+
if (this.startupDraftText !== undefined) {
|
|
201
|
+
this.editor.setText(this.startupDraftText);
|
|
202
|
+
this.startupDraftText = undefined;
|
|
203
|
+
this.ui.requestRender();
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
InteractiveModeBase.prototype.setupEditorSubmitHandler = function () {
|
|
207
|
+
this.defaultEditor.onSubmit = async (text) => {
|
|
208
|
+
text = text.trim();
|
|
209
|
+
if (!text)
|
|
176
210
|
return;
|
|
177
|
-
|
|
178
|
-
|
|
211
|
+
if (this.startupReplayActiveInput && this.startupReplayActiveInput.trim() !== text.trim()) {
|
|
212
|
+
this.startupReplayInputs.push(text);
|
|
213
|
+
this.editor.addToHistory?.(text);
|
|
179
214
|
this.editor.setText("");
|
|
180
|
-
await this.handleClearCommand();
|
|
181
215
|
return;
|
|
182
216
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
if (text
|
|
186
|
-
this.
|
|
217
|
+
try {
|
|
218
|
+
// Handle commands
|
|
219
|
+
if (text === "/settings") {
|
|
220
|
+
this.showSettingsSelector();
|
|
221
|
+
this.editor.setText("");
|
|
187
222
|
return;
|
|
188
223
|
}
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
224
|
+
if (text === "/fast") {
|
|
225
|
+
this.editor.setText("");
|
|
226
|
+
this.showFastModeSelector();
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
if (text === "/scoped-models") {
|
|
230
|
+
this.editor.setText("");
|
|
231
|
+
await this.showModelsSelector();
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
if (text === "/model" || text.startsWith("/model ")) {
|
|
235
|
+
const searchTerm = text.startsWith("/model ")
|
|
236
|
+
? text.slice(7).trim()
|
|
237
|
+
: undefined;
|
|
238
|
+
this.editor.setText("");
|
|
239
|
+
await this.handleModelCommand(searchTerm);
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
if (text === "/export" || text.startsWith("/export ")) {
|
|
243
|
+
await this.handleExportCommand(text);
|
|
244
|
+
this.editor.setText("");
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
if (text === "/import" || text.startsWith("/import ")) {
|
|
248
|
+
await this.handleImportCommand(text);
|
|
249
|
+
this.editor.setText("");
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
if (text === "/share") {
|
|
253
|
+
await this.handleShareCommand();
|
|
254
|
+
this.editor.setText("");
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
if (text === "/copy") {
|
|
258
|
+
await this.handleCopyCommand();
|
|
259
|
+
this.editor.setText("");
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
if (text === "/name" || text.startsWith("/name ")) {
|
|
263
|
+
this.handleNameCommand(text);
|
|
264
|
+
this.editor.setText("");
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
if (text === "/session") {
|
|
268
|
+
this.handleSessionCommand();
|
|
269
|
+
this.editor.setText("");
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
if (text === "/changelog") {
|
|
273
|
+
this.handleChangelogCommand();
|
|
274
|
+
this.editor.setText("");
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
if (text === "/atomic" || text.startsWith("/atomic ")) {
|
|
278
|
+
this.editor.setText("");
|
|
279
|
+
await this.session.prompt(text);
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
if (text === "/hotkeys") {
|
|
283
|
+
this.handleHotkeysCommand();
|
|
284
|
+
this.editor.setText("");
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
if (text === "/fork") {
|
|
288
|
+
this.showUserMessageSelector();
|
|
289
|
+
this.editor.setText("");
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
if (text === "/clone") {
|
|
293
|
+
this.editor.setText("");
|
|
294
|
+
await this.handleCloneCommand();
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
if (text === "/tree") {
|
|
298
|
+
this.showTreeSelector();
|
|
299
|
+
this.editor.setText("");
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
if (text === "/trust") {
|
|
303
|
+
this.showTrustSelector();
|
|
304
|
+
this.editor.setText("");
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
if (text === "/login") {
|
|
308
|
+
this.showOAuthSelector("login");
|
|
309
|
+
this.editor.setText("");
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
if (text === "/logout") {
|
|
313
|
+
this.showOAuthSelector("logout");
|
|
314
|
+
this.editor.setText("");
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
if (text === "/new") {
|
|
318
|
+
this.editor.setText("");
|
|
319
|
+
await this.handleClearCommand();
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
if (/^\/compact(?:\s|$)/.test(text)) {
|
|
323
|
+
this.editor.setText("");
|
|
324
|
+
if (text !== "/compact") {
|
|
325
|
+
this.showWarning("Usage: /compact");
|
|
232
326
|
return;
|
|
233
327
|
}
|
|
234
|
-
this.
|
|
235
|
-
await this.handleBashCommand(command, isExcluded);
|
|
236
|
-
this.isBashMode = false;
|
|
237
|
-
this.updateEditorBorderColor();
|
|
328
|
+
await this.handleCompactCommand();
|
|
238
329
|
return;
|
|
239
330
|
}
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
331
|
+
if (text === "/reload") {
|
|
332
|
+
this.editor.setText("");
|
|
333
|
+
await this.handleReloadCommand();
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
if (text === "/debug") {
|
|
337
|
+
this.handleDebugCommand();
|
|
338
|
+
this.editor.setText("");
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
341
|
+
if (text === "/arminsayshi") {
|
|
342
|
+
this.handleArminSaysHi();
|
|
343
|
+
this.editor.setText("");
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
if (text === "/dementedelves") {
|
|
347
|
+
this.handleDementedDelves();
|
|
348
|
+
this.editor.setText("");
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
351
|
+
if (text === "/resume") {
|
|
352
|
+
this.showSessionSelector();
|
|
353
|
+
this.editor.setText("");
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
356
|
+
if (text === "/quit" || text === "/exit") {
|
|
357
|
+
this.editor.setText("");
|
|
358
|
+
await this.shutdown();
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
361
|
+
// Handle bash command (! for normal, !! for excluded from context)
|
|
362
|
+
if (text.startsWith("!")) {
|
|
363
|
+
const isExcluded = text.startsWith("!!");
|
|
364
|
+
const command = isExcluded
|
|
365
|
+
? text.slice(2).trim()
|
|
366
|
+
: text.slice(1).trim();
|
|
367
|
+
if (command) {
|
|
368
|
+
if (this.session.isBashRunning) {
|
|
369
|
+
this.showWarning("A bash command is already running. esc cancel first.");
|
|
370
|
+
this.editor.setText(text);
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
this.editor.addToHistory?.(text);
|
|
374
|
+
await this.handleBashCommand(command, isExcluded);
|
|
375
|
+
this.isBashMode = false;
|
|
376
|
+
this.updateEditorBorderColor();
|
|
377
|
+
return;
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
// Queue input during compaction (extension commands execute immediately)
|
|
381
|
+
if (this.session.isCompacting) {
|
|
382
|
+
if (this.isExtensionCommand(text)) {
|
|
383
|
+
this.editor.addToHistory?.(text);
|
|
384
|
+
this.editor.setText("");
|
|
385
|
+
await this.session.prompt(text);
|
|
386
|
+
}
|
|
387
|
+
else {
|
|
388
|
+
this.queueCompactionMessage(text, "steer");
|
|
389
|
+
}
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
392
|
+
// If streaming, use prompt() with steer behavior
|
|
393
|
+
// This handles extension commands (execute immediately), prompt template expansion, and queueing
|
|
394
|
+
if (this.session.isStreaming) {
|
|
244
395
|
this.editor.addToHistory?.(text);
|
|
245
396
|
this.editor.setText("");
|
|
246
|
-
await this.session.prompt(text);
|
|
397
|
+
await this.session.prompt(text, { streamingBehavior: "steer" });
|
|
398
|
+
this.updatePendingMessagesDisplay();
|
|
399
|
+
this.ui.requestRender();
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
// Normal message submission
|
|
403
|
+
// First, move any pending bash components to chat
|
|
404
|
+
this.flushPendingBashComponents();
|
|
405
|
+
if (this.onInputCallback) {
|
|
406
|
+
if (!text.startsWith("/")) {
|
|
407
|
+
this.renderDeferredUserInput(text);
|
|
408
|
+
}
|
|
409
|
+
this.onInputCallback(text);
|
|
247
410
|
}
|
|
248
411
|
else {
|
|
249
|
-
this.
|
|
412
|
+
this.pendingUserInputs.push(text);
|
|
250
413
|
}
|
|
251
|
-
return;
|
|
252
|
-
}
|
|
253
|
-
// If streaming, use prompt() with steer behavior
|
|
254
|
-
// This handles extension commands (execute immediately), prompt template expansion, and queueing
|
|
255
|
-
if (this.session.isStreaming) {
|
|
256
414
|
this.editor.addToHistory?.(text);
|
|
257
|
-
this.editor.setText("");
|
|
258
|
-
await this.session.prompt(text, { streamingBehavior: "steer" });
|
|
259
|
-
this.updatePendingMessagesDisplay();
|
|
260
|
-
this.ui.requestRender();
|
|
261
|
-
return;
|
|
262
|
-
}
|
|
263
|
-
// Normal message submission
|
|
264
|
-
// First, move any pending bash components to chat
|
|
265
|
-
this.flushPendingBashComponents();
|
|
266
|
-
if (this.onInputCallback) {
|
|
267
|
-
this.onInputCallback(text);
|
|
268
415
|
}
|
|
269
|
-
|
|
270
|
-
this.
|
|
416
|
+
finally {
|
|
417
|
+
this.advanceStartupInputReplay?.(text);
|
|
271
418
|
}
|
|
272
|
-
this.editor.addToHistory?.(text);
|
|
273
419
|
};
|
|
274
420
|
};
|
|
275
421
|
//# sourceMappingURL=interactive-input-handling.js.map
|