@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,7 @@
|
|
|
1
1
|
import { InteractiveModeBase } from "./interactive-mode-base.js";
|
|
2
2
|
import { Spacer, Text, theme } from "./interactive-mode-deps.js";
|
|
3
3
|
InteractiveModeBase.prototype.showLoadedResources = function (options) {
|
|
4
|
+
const targetContainer = options?.targetContainer ?? this.chatContainer;
|
|
4
5
|
const showListing = options?.force ||
|
|
5
6
|
this.options.verbose ||
|
|
6
7
|
!this.settingsManager.getQuietStartup();
|
|
@@ -134,20 +135,21 @@ InteractiveModeBase.prototype.showLoadedResources = function (options) {
|
|
|
134
135
|
themesResult.diagnostics,
|
|
135
136
|
]),
|
|
136
137
|
expandedBody: this.options.verbose ? expandedSections.join("\n\n") : "",
|
|
138
|
+
targetContainer,
|
|
137
139
|
});
|
|
138
140
|
}
|
|
139
141
|
if (showDiagnostics) {
|
|
140
142
|
const skillDiagnostics = skillsResult.diagnostics;
|
|
141
143
|
if (skillDiagnostics.length > 0) {
|
|
142
144
|
const warningLines = this.formatDiagnostics(skillDiagnostics, sourceInfos);
|
|
143
|
-
|
|
144
|
-
|
|
145
|
+
targetContainer.addChild(new Text(`${theme.fg("warning", "[Skill conflicts]")}\n${warningLines}`, 0, 0));
|
|
146
|
+
targetContainer.addChild(new Spacer(1));
|
|
145
147
|
}
|
|
146
148
|
const promptDiagnostics = promptsResult.diagnostics;
|
|
147
149
|
if (promptDiagnostics.length > 0) {
|
|
148
150
|
const warningLines = this.formatDiagnostics(promptDiagnostics, sourceInfos);
|
|
149
|
-
|
|
150
|
-
|
|
151
|
+
targetContainer.addChild(new Text(`${theme.fg("warning", "[Prompt conflicts]")}\n${warningLines}`, 0, 0));
|
|
152
|
+
targetContainer.addChild(new Spacer(1));
|
|
151
153
|
}
|
|
152
154
|
const extensionDiagnostics = [];
|
|
153
155
|
const extensionErrors = this.session.resourceLoader.getExtensions().errors;
|
|
@@ -167,14 +169,14 @@ InteractiveModeBase.prototype.showLoadedResources = function (options) {
|
|
|
167
169
|
extensionDiagnostics.push(...shortcutDiagnostics);
|
|
168
170
|
if (extensionDiagnostics.length > 0) {
|
|
169
171
|
const warningLines = this.formatDiagnostics(extensionDiagnostics, sourceInfos);
|
|
170
|
-
|
|
171
|
-
|
|
172
|
+
targetContainer.addChild(new Text(`${theme.fg("warning", "[Extension issues]")}\n${warningLines}`, 0, 0));
|
|
173
|
+
targetContainer.addChild(new Spacer(1));
|
|
172
174
|
}
|
|
173
175
|
const themeDiagnostics = themesResult.diagnostics;
|
|
174
176
|
if (themeDiagnostics.length > 0) {
|
|
175
177
|
const warningLines = this.formatDiagnostics(themeDiagnostics, sourceInfos);
|
|
176
|
-
|
|
177
|
-
|
|
178
|
+
targetContainer.addChild(new Text(`${theme.fg("warning", "[Theme conflicts]")}\n${warningLines}`, 0, 0));
|
|
179
|
+
targetContainer.addChild(new Spacer(1));
|
|
178
180
|
}
|
|
179
181
|
}
|
|
180
182
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactive-resource-rendering.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-resource-rendering.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAA4C,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAE3G,mBAAmB,CAAC,SAAS,CAAC,mBAAmB,GAAG,UAAoC,OAIrF;IACC,MAAM,WAAW,GACf,OAAO,EAAE,KAAK;QACd,IAAI,CAAC,OAAO,CAAC,OAAO;QACpB,CAAC,IAAI,CAAC,eAAe,CAAC,eAAe,EAAE,CAAC;IAC1C,MAAM,eAAe,GACnB,WAAW,IAAI,OAAO,EAAE,wBAAwB,KAAK,IAAI,CAAC;IAC5D,IAAI,CAAC,WAAW,IAAI,CAAC,eAAe,EAAE,CAAC;QACrC,OAAO;IACT,CAAC;IAED,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,SAAS,EAAE,CAAC;IAC7D,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,UAAU,EAAE,CAAC;IAC/D,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,SAAS,EAAE,CAAC;IAC7D,MAAM,UAAU,GACd,OAAO,EAAE,UAAU;QACnB,IAAI,CAAC,OAAO,CAAC,cAAc;aACxB,aAAa,EAAE;aACf,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CAAC,eAAe,CAC7B,CACF,CAAC;QAEF,MAAM,mBAAmB,GACvB,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,sBAAsB,EAAE,CAAC;QACxD,oBAAoB,CAAC,IAAI,CAAC,GAAG,mBAAmB,CAAC,CAAC;QAElD,IAAI,oBAAoB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACpC,MAAM,YAAY,GAAG,IAAI,CAAC,iBAAiB,CACzC,oBAAoB,EACpB,WAAW,CACZ,CAAC;YACF,IAAI,CAAC,aAAa,CAAC,QAAQ,CACzB,IAAI,IAAI,CACN,GAAG,KAAK,CAAC,EAAE,CAAC,SAAS,EAAE,oBAAoB,CAAC,KAAK,YAAY,EAAE,EAC/D,CAAC,EACD,CAAC,CACF,CACF,CAAC;YACF,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7C,CAAC;QAED,MAAM,gBAAgB,GAAG,YAAY,CAAC,WAAW,CAAC;QAClD,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAChC,MAAM,YAAY,GAAG,IAAI,CAAC,iBAAiB,CACzC,gBAAgB,EAChB,WAAW,CACZ,CAAC;YACF,IAAI,CAAC,aAAa,CAAC,QAAQ,CACzB,IAAI,IAAI,CACN,GAAG,KAAK,CAAC,EAAE,CAAC,SAAS,EAAE,mBAAmB,CAAC,KAAK,YAAY,EAAE,EAC9D,CAAC,EACD,CAAC,CACF,CACF,CAAC;YACF,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7C,CAAC;IACH,CAAC;AACH,CAAC,CAAC","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { type ResourceDiagnostic, type SourceInfo, Spacer, Text, theme } from \"./interactive-mode-deps.ts\";\n\nInteractiveModeBase.prototype.showLoadedResources = function(this: InteractiveModeBase, options?: {\n extensions?: Array<{ path: string; sourceInfo?: SourceInfo }>;\n force?: boolean;\n showDiagnosticsWhenQuiet?: boolean;\n }): void {\n const showListing =\n options?.force ||\n this.options.verbose ||\n !this.settingsManager.getQuietStartup();\n const showDiagnostics =\n showListing || options?.showDiagnosticsWhenQuiet === true;\n if (!showListing && !showDiagnostics) {\n return;\n }\n\n const skillsResult = this.session.resourceLoader.getSkills();\n const promptsResult = this.session.resourceLoader.getPrompts();\n const themesResult = this.session.resourceLoader.getThemes();\n const extensions =\n options?.extensions ??\n this.session.resourceLoader\n .getExtensions()\n .extensions.map((extension) => ({\n path: extension.path,\n sourceInfo: extension.sourceInfo,\n }));\n const sourceInfos = new Map<string, SourceInfo>();\n for (const extension of extensions) {\n if (extension.sourceInfo) {\n sourceInfos.set(extension.path, extension.sourceInfo);\n }\n }\n for (const skill of skillsResult.skills) {\n if (skill.sourceInfo) {\n sourceInfos.set(skill.filePath, skill.sourceInfo);\n }\n }\n for (const prompt of promptsResult.prompts) {\n if (prompt.sourceInfo) {\n sourceInfos.set(prompt.filePath, prompt.sourceInfo);\n }\n }\n for (const loadedTheme of themesResult.themes) {\n if (loadedTheme.sourcePath && loadedTheme.sourceInfo) {\n sourceInfos.set(loadedTheme.sourcePath, loadedTheme.sourceInfo);\n }\n }\n\n if (showListing) {\n const contextFiles =\n this.session.resourceLoader.getAgentsFiles().agentsFiles;\n const templates = this.session.promptTemplates;\n const customThemes = themesResult.themes.filter((t) => t.sourcePath);\n\n const expandedSections: string[] = [];\n if (contextFiles.length > 0) {\n expandedSections.push(\n `${theme.bold(theme.fg(\"muted\", \"CONTEXT\"))}\\n${contextFiles\n .map((contextFile) => theme.fg(\"dim\", ` ${this.formatDisplayPath(contextFile.path)}`))\n .join(\"\\n\")}`,\n );\n }\n\n const skills = skillsResult.skills;\n if (skills.length > 0) {\n const groups = this.buildScopeGroups(\n skills.map((skill) => ({\n path: skill.filePath,\n sourceInfo: skill.sourceInfo,\n })),\n );\n expandedSections.push(\n `${theme.bold(theme.fg(\"muted\", \"SKILLS\"))}\\n${this.formatScopeGroups(groups, {\n formatPath: (item) => this.formatDisplayPath(item.path),\n formatPackagePath: (item) =>\n this.getShortPath(item.path, item.sourceInfo),\n })}`,\n );\n }\n\n if (templates.length > 0) {\n const groups = this.buildScopeGroups(\n templates.map((template) => ({\n path: template.filePath,\n sourceInfo: template.sourceInfo,\n })),\n );\n const templateByPath = new Map(templates.map((t) => [t.filePath, t]));\n expandedSections.push(\n `${theme.bold(theme.fg(\"muted\", \"PROMPTS\"))}\\n${this.formatScopeGroups(groups, {\n formatPath: (item) => {\n const template = templateByPath.get(item.path);\n return template\n ? `/${template.name}`\n : this.formatDisplayPath(item.path);\n },\n formatPackagePath: (item) => {\n const template = templateByPath.get(item.path);\n return template\n ? `/${template.name}`\n : this.formatDisplayPath(item.path);\n },\n })}`,\n );\n }\n\n const prompts = promptsResult.prompts;\n if (prompts.length > 0) {\n const groups = this.buildScopeGroups(\n prompts.map((prompt) => ({\n path: prompt.filePath,\n sourceInfo: prompt.sourceInfo,\n })),\n );\n const promptByPath = new Map(prompts.map((prompt) => [prompt.filePath, prompt]));\n expandedSections.push(\n `${theme.bold(theme.fg(\"muted\", \"PROMPTS\"))}\\n${this.formatScopeGroups(groups, {\n formatPath: (item) => promptByPath.get(item.path)?.name ?? this.formatDisplayPath(item.path),\n formatPackagePath: (item) => promptByPath.get(item.path)?.name ?? this.formatDisplayPath(item.path),\n })}`,\n );\n }\n\n if (extensions.length > 0) {\n const groups = this.buildScopeGroups(extensions);\n expandedSections.push(\n `${theme.bold(theme.fg(\"muted\", \"EXTENSIONS\"))}\\n${this.formatScopeGroups(groups, {\n formatPath: (item) => this.formatExtensionDisplayPath(item.path),\n formatPackagePath: (item) =>\n this.formatExtensionDisplayPath(\n this.getShortPath(item.path, item.sourceInfo),\n ),\n })}`,\n );\n }\n\n if (customThemes.length > 0) {\n const groups = this.buildScopeGroups(\n customThemes.map((loadedTheme) => ({\n path: loadedTheme.sourcePath!,\n sourceInfo: loadedTheme.sourceInfo,\n })),\n );\n expandedSections.push(\n `${theme.bold(theme.fg(\"muted\", \"THEMES\"))}\\n${this.formatScopeGroups(groups, {\n formatPath: (item) => this.formatDisplayPath(item.path),\n formatPackagePath: (item) =>\n this.getShortPath(item.path, item.sourceInfo),\n })}`,\n );\n }\n\n const extensionDiagnostics: ResourceDiagnostic[] = [];\n const extensionErrors =\n this.session.resourceLoader.getExtensions().errors;\n for (const error of extensionErrors) {\n extensionDiagnostics.push({\n type: \"error\",\n message: error.error,\n path: error.path,\n });\n }\n extensionDiagnostics.push(\n ...this.session.extensionRunner.getCommandDiagnostics(),\n ...this.getBuiltInCommandConflictDiagnostics(\n this.session.extensionRunner,\n ),\n ...this.session.extensionRunner.getShortcutDiagnostics(),\n );\n\n this.addResourceDisclosure({\n contextFiles,\n skills,\n prompts,\n templates,\n extensions,\n themes: customThemes,\n diagnosticsTotal: this.getResourceDiagnosticsTotal([\n skillsResult.diagnostics,\n promptsResult.diagnostics,\n extensionDiagnostics,\n themesResult.diagnostics,\n ]),\n expandedBody: this.options.verbose ? expandedSections.join(\"\\n\\n\") : \"\",\n });\n }\n\n if (showDiagnostics) {\n const skillDiagnostics = skillsResult.diagnostics;\n if (skillDiagnostics.length > 0) {\n const warningLines = this.formatDiagnostics(\n skillDiagnostics,\n sourceInfos,\n );\n this.chatContainer.addChild(\n new Text(\n `${theme.fg(\"warning\", \"[Skill conflicts]\")}\\n${warningLines}`,\n 0,\n 0,\n ),\n );\n this.chatContainer.addChild(new Spacer(1));\n }\n\n const promptDiagnostics = promptsResult.diagnostics;\n if (promptDiagnostics.length > 0) {\n const warningLines = this.formatDiagnostics(\n promptDiagnostics,\n sourceInfos,\n );\n this.chatContainer.addChild(\n new Text(\n `${theme.fg(\"warning\", \"[Prompt conflicts]\")}\\n${warningLines}`,\n 0,\n 0,\n ),\n );\n this.chatContainer.addChild(new Spacer(1));\n }\n\n const extensionDiagnostics: ResourceDiagnostic[] = [];\n const extensionErrors =\n this.session.resourceLoader.getExtensions().errors;\n if (extensionErrors.length > 0) {\n for (const error of extensionErrors) {\n extensionDiagnostics.push({\n type: \"error\",\n message: error.error,\n path: error.path,\n });\n }\n }\n\n const commandDiagnostics =\n this.session.extensionRunner.getCommandDiagnostics();\n extensionDiagnostics.push(...commandDiagnostics);\n extensionDiagnostics.push(\n ...this.getBuiltInCommandConflictDiagnostics(\n this.session.extensionRunner,\n ),\n );\n\n const shortcutDiagnostics =\n this.session.extensionRunner.getShortcutDiagnostics();\n extensionDiagnostics.push(...shortcutDiagnostics);\n\n if (extensionDiagnostics.length > 0) {\n const warningLines = this.formatDiagnostics(\n extensionDiagnostics,\n sourceInfos,\n );\n this.chatContainer.addChild(\n new Text(\n `${theme.fg(\"warning\", \"[Extension issues]\")}\\n${warningLines}`,\n 0,\n 0,\n ),\n );\n this.chatContainer.addChild(new Spacer(1));\n }\n\n const themeDiagnostics = themesResult.diagnostics;\n if (themeDiagnostics.length > 0) {\n const warningLines = this.formatDiagnostics(\n themeDiagnostics,\n sourceInfos,\n );\n this.chatContainer.addChild(\n new Text(\n `${theme.fg(\"warning\", \"[Theme conflicts]\")}\\n${warningLines}`,\n 0,\n 0,\n ),\n );\n this.chatContainer.addChild(new Spacer(1));\n }\n }\n };\n"]}
|
|
1
|
+
{"version":3,"file":"interactive-resource-rendering.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-resource-rendering.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAA4D,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAE3H,mBAAmB,CAAC,SAAS,CAAC,mBAAmB,GAAG,UAAoC,OAKrF;IACC,MAAM,eAAe,GAAG,OAAO,EAAE,eAAe,IAAI,IAAI,CAAC,aAAa,CAAC;IACvE,MAAM,WAAW,GACf,OAAO,EAAE,KAAK;QACd,IAAI,CAAC,OAAO,CAAC,OAA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B,EAChB,WAAW,CACZ,CAAC;YACF,eAAe,CAAC,QAAQ,CACtB,IAAI,IAAI,CACN,GAAG,KAAK,CAAC,EAAE,CAAC,SAAS,EAAE,mBAAmB,CAAC,KAAK,YAAY,EAAE,EAC9D,CAAC,EACD,CAAC,CACF,CACF,CAAC;YACF,eAAe,CAAC,QAAQ,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QAC1C,CAAC;IACH,CAAC;AACH,CAAC,CAAC","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { type Container, type ResourceDiagnostic, type SourceInfo, Spacer, Text, theme } from \"./interactive-mode-deps.ts\";\n\nInteractiveModeBase.prototype.showLoadedResources = function(this: InteractiveModeBase, options?: {\n extensions?: Array<{ path: string; sourceInfo?: SourceInfo }>;\n force?: boolean;\n showDiagnosticsWhenQuiet?: boolean;\n targetContainer?: Container;\n }): void {\n const targetContainer = options?.targetContainer ?? this.chatContainer;\n const showListing =\n options?.force ||\n this.options.verbose ||\n !this.settingsManager.getQuietStartup();\n const showDiagnostics =\n showListing || options?.showDiagnosticsWhenQuiet === true;\n if (!showListing && !showDiagnostics) {\n return;\n }\n\n const skillsResult = this.session.resourceLoader.getSkills();\n const promptsResult = this.session.resourceLoader.getPrompts();\n const themesResult = this.session.resourceLoader.getThemes();\n const extensions =\n options?.extensions ??\n this.session.resourceLoader\n .getExtensions()\n .extensions.map((extension) => ({\n path: extension.path,\n sourceInfo: extension.sourceInfo,\n }));\n const sourceInfos = new Map<string, SourceInfo>();\n for (const extension of extensions) {\n if (extension.sourceInfo) {\n sourceInfos.set(extension.path, extension.sourceInfo);\n }\n }\n for (const skill of skillsResult.skills) {\n if (skill.sourceInfo) {\n sourceInfos.set(skill.filePath, skill.sourceInfo);\n }\n }\n for (const prompt of promptsResult.prompts) {\n if (prompt.sourceInfo) {\n sourceInfos.set(prompt.filePath, prompt.sourceInfo);\n }\n }\n for (const loadedTheme of themesResult.themes) {\n if (loadedTheme.sourcePath && loadedTheme.sourceInfo) {\n sourceInfos.set(loadedTheme.sourcePath, loadedTheme.sourceInfo);\n }\n }\n\n if (showListing) {\n const contextFiles =\n this.session.resourceLoader.getAgentsFiles().agentsFiles;\n const templates = this.session.promptTemplates;\n const customThemes = themesResult.themes.filter((t) => t.sourcePath);\n\n const expandedSections: string[] = [];\n if (contextFiles.length > 0) {\n expandedSections.push(\n `${theme.bold(theme.fg(\"muted\", \"CONTEXT\"))}\\n${contextFiles\n .map((contextFile) => theme.fg(\"dim\", ` ${this.formatDisplayPath(contextFile.path)}`))\n .join(\"\\n\")}`,\n );\n }\n\n const skills = skillsResult.skills;\n if (skills.length > 0) {\n const groups = this.buildScopeGroups(\n skills.map((skill) => ({\n path: skill.filePath,\n sourceInfo: skill.sourceInfo,\n })),\n );\n expandedSections.push(\n `${theme.bold(theme.fg(\"muted\", \"SKILLS\"))}\\n${this.formatScopeGroups(groups, {\n formatPath: (item) => this.formatDisplayPath(item.path),\n formatPackagePath: (item) =>\n this.getShortPath(item.path, item.sourceInfo),\n })}`,\n );\n }\n\n if (templates.length > 0) {\n const groups = this.buildScopeGroups(\n templates.map((template) => ({\n path: template.filePath,\n sourceInfo: template.sourceInfo,\n })),\n );\n const templateByPath = new Map(templates.map((t) => [t.filePath, t]));\n expandedSections.push(\n `${theme.bold(theme.fg(\"muted\", \"PROMPTS\"))}\\n${this.formatScopeGroups(groups, {\n formatPath: (item) => {\n const template = templateByPath.get(item.path);\n return template\n ? `/${template.name}`\n : this.formatDisplayPath(item.path);\n },\n formatPackagePath: (item) => {\n const template = templateByPath.get(item.path);\n return template\n ? `/${template.name}`\n : this.formatDisplayPath(item.path);\n },\n })}`,\n );\n }\n\n const prompts = promptsResult.prompts;\n if (prompts.length > 0) {\n const groups = this.buildScopeGroups(\n prompts.map((prompt) => ({\n path: prompt.filePath,\n sourceInfo: prompt.sourceInfo,\n })),\n );\n const promptByPath = new Map(prompts.map((prompt) => [prompt.filePath, prompt]));\n expandedSections.push(\n `${theme.bold(theme.fg(\"muted\", \"PROMPTS\"))}\\n${this.formatScopeGroups(groups, {\n formatPath: (item) => promptByPath.get(item.path)?.name ?? this.formatDisplayPath(item.path),\n formatPackagePath: (item) => promptByPath.get(item.path)?.name ?? this.formatDisplayPath(item.path),\n })}`,\n );\n }\n\n if (extensions.length > 0) {\n const groups = this.buildScopeGroups(extensions);\n expandedSections.push(\n `${theme.bold(theme.fg(\"muted\", \"EXTENSIONS\"))}\\n${this.formatScopeGroups(groups, {\n formatPath: (item) => this.formatExtensionDisplayPath(item.path),\n formatPackagePath: (item) =>\n this.formatExtensionDisplayPath(\n this.getShortPath(item.path, item.sourceInfo),\n ),\n })}`,\n );\n }\n\n if (customThemes.length > 0) {\n const groups = this.buildScopeGroups(\n customThemes.map((loadedTheme) => ({\n path: loadedTheme.sourcePath!,\n sourceInfo: loadedTheme.sourceInfo,\n })),\n );\n expandedSections.push(\n `${theme.bold(theme.fg(\"muted\", \"THEMES\"))}\\n${this.formatScopeGroups(groups, {\n formatPath: (item) => this.formatDisplayPath(item.path),\n formatPackagePath: (item) =>\n this.getShortPath(item.path, item.sourceInfo),\n })}`,\n );\n }\n\n const extensionDiagnostics: ResourceDiagnostic[] = [];\n const extensionErrors =\n this.session.resourceLoader.getExtensions().errors;\n for (const error of extensionErrors) {\n extensionDiagnostics.push({\n type: \"error\",\n message: error.error,\n path: error.path,\n });\n }\n extensionDiagnostics.push(\n ...this.session.extensionRunner.getCommandDiagnostics(),\n ...this.getBuiltInCommandConflictDiagnostics(\n this.session.extensionRunner,\n ),\n ...this.session.extensionRunner.getShortcutDiagnostics(),\n );\n\n this.addResourceDisclosure({\n contextFiles,\n skills,\n prompts,\n templates,\n extensions,\n themes: customThemes,\n diagnosticsTotal: this.getResourceDiagnosticsTotal([\n skillsResult.diagnostics,\n promptsResult.diagnostics,\n extensionDiagnostics,\n themesResult.diagnostics,\n ]),\n expandedBody: this.options.verbose ? expandedSections.join(\"\\n\\n\") : \"\",\n targetContainer,\n });\n }\n\n if (showDiagnostics) {\n const skillDiagnostics = skillsResult.diagnostics;\n if (skillDiagnostics.length > 0) {\n const warningLines = this.formatDiagnostics(\n skillDiagnostics,\n sourceInfos,\n );\n targetContainer.addChild(\n new Text(\n `${theme.fg(\"warning\", \"[Skill conflicts]\")}\\n${warningLines}`,\n 0,\n 0,\n ),\n );\n targetContainer.addChild(new Spacer(1));\n }\n\n const promptDiagnostics = promptsResult.diagnostics;\n if (promptDiagnostics.length > 0) {\n const warningLines = this.formatDiagnostics(\n promptDiagnostics,\n sourceInfos,\n );\n targetContainer.addChild(\n new Text(\n `${theme.fg(\"warning\", \"[Prompt conflicts]\")}\\n${warningLines}`,\n 0,\n 0,\n ),\n );\n targetContainer.addChild(new Spacer(1));\n }\n\n const extensionDiagnostics: ResourceDiagnostic[] = [];\n const extensionErrors =\n this.session.resourceLoader.getExtensions().errors;\n if (extensionErrors.length > 0) {\n for (const error of extensionErrors) {\n extensionDiagnostics.push({\n type: \"error\",\n message: error.error,\n path: error.path,\n });\n }\n }\n\n const commandDiagnostics =\n this.session.extensionRunner.getCommandDiagnostics();\n extensionDiagnostics.push(...commandDiagnostics);\n extensionDiagnostics.push(\n ...this.getBuiltInCommandConflictDiagnostics(\n this.session.extensionRunner,\n ),\n );\n\n const shortcutDiagnostics =\n this.session.extensionRunner.getShortcutDiagnostics();\n extensionDiagnostics.push(...shortcutDiagnostics);\n\n if (extensionDiagnostics.length > 0) {\n const warningLines = this.formatDiagnostics(\n extensionDiagnostics,\n sourceInfos,\n );\n targetContainer.addChild(\n new Text(\n `${theme.fg(\"warning\", \"[Extension issues]\")}\\n${warningLines}`,\n 0,\n 0,\n ),\n );\n targetContainer.addChild(new Spacer(1));\n }\n\n const themeDiagnostics = themesResult.diagnostics;\n if (themeDiagnostics.length > 0) {\n const warningLines = this.formatDiagnostics(\n themeDiagnostics,\n sourceInfos,\n );\n targetContainer.addChild(\n new Text(\n `${theme.fg(\"warning\", \"[Theme conflicts]\")}\\n${warningLines}`,\n 0,\n 0,\n ),\n );\n targetContainer.addChild(new Spacer(1));\n }\n }\n };\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactive-session-runtime.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-session-runtime.ts"],"names":[],"mappings":"","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { type AgentSession, setRegisteredThemes, stopThemeWatcher } from \"./interactive-mode-deps.ts\";\n\nInteractiveModeBase.prototype.bindCurrentSessionExtensions = async function(this: InteractiveModeBase): Promise<void> {\n const uiContext = this.createExtensionUIContext();\n await this.session.bindExtensions({\n uiContext,\n mode: \"tui\",\n commandContextActions: {\n waitForIdle: () => this.session.agent.waitForIdle(),\n newSession: async (options) => {\n if (this.loadingAnimation) {\n this.loadingAnimation.stop();\n this.loadingAnimation = undefined;\n }\n this.statusContainer.clear();\n try {\n const result = await this.runtimeHost.newSession(options);\n if (!result.cancelled) {\n this.renderCurrentSessionState();\n this.ui.requestRender();\n }\n return result;\n } catch (error: unknown) {\n return this.handleFatalRuntimeError(\n \"Failed to create session\",\n error,\n );\n }\n },\n fork: async (entryId, options) => {\n try {\n const result = await this.runtimeHost.fork(entryId, options);\n if (!result.cancelled) {\n this.renderCurrentSessionState();\n this.editor.setText(result.selectedText ?? \"\");\n this.showStatus(\"Forked to new session\");\n }\n return { cancelled: result.cancelled };\n } catch (error: unknown) {\n return this.handleFatalRuntimeError(\n \"Failed to fork session\",\n error,\n );\n }\n },\n navigateTree: async (targetId, options) => {\n const result = await this.session.navigateTree(targetId, {\n summarize: options?.summarize,\n customInstructions: options?.customInstructions,\n replaceInstructions: options?.replaceInstructions,\n label: options?.label,\n });\n if (result.cancelled) {\n return { cancelled: true };\n }\n\n this.chatContainer.clear();\n this.renderInitialMessages();\n if (result.editorText && !this.editor.getText().trim()) {\n this.editor.setText(result.editorText);\n }\n this.showStatus(\"Navigated to selected point\");\n void this.flushCompactionQueue({ willRetry: false });\n return { cancelled: false };\n },\n switchSession: async (sessionPath, options) => {\n return this.handleResumeSession(sessionPath, options);\n },\n reload: async () => {\n await this.handleReloadCommand();\n },\n },\n shutdownHandler: () => {\n this.shutdownRequested = true;\n if (!this.session.isStreaming) {\n void this.shutdown();\n }\n },\n onError: (error) => {\n this.showExtensionError(error.extensionPath, error.error, error.stack);\n },\n });\n\n setRegisteredThemes(this.session.resourceLoader.getThemes().themes);\n this.setupAutocompleteProvider();\n\n const extensionRunner = this.session.extensionRunner;\n this.setupExtensionShortcuts(extensionRunner);\n if (!this.deferredStartupPending) {\n this.showLoadedResources({ force:
|
|
1
|
+
{"version":3,"file":"interactive-session-runtime.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-session-runtime.ts"],"names":[],"mappings":"","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { type AgentSession, setRegisteredThemes, stopThemeWatcher } from \"./interactive-mode-deps.ts\";\n\nInteractiveModeBase.prototype.bindCurrentSessionExtensions = async function(this: InteractiveModeBase): Promise<void> {\n const uiContext = this.createExtensionUIContext();\n await this.session.bindExtensions({\n uiContext,\n mode: \"tui\",\n commandContextActions: {\n waitForIdle: () => this.session.agent.waitForIdle(),\n newSession: async (options) => {\n if (this.loadingAnimation) {\n this.loadingAnimation.stop();\n this.loadingAnimation = undefined;\n }\n this.statusContainer.clear();\n try {\n const result = await this.runtimeHost.newSession(options);\n if (!result.cancelled) {\n this.renderCurrentSessionState();\n this.ui.requestRender();\n }\n return result;\n } catch (error: unknown) {\n return this.handleFatalRuntimeError(\n \"Failed to create session\",\n error,\n );\n }\n },\n fork: async (entryId, options) => {\n try {\n const result = await this.runtimeHost.fork(entryId, options);\n if (!result.cancelled) {\n this.renderCurrentSessionState();\n this.editor.setText(result.selectedText ?? \"\");\n this.showStatus(\"Forked to new session\");\n }\n return { cancelled: result.cancelled };\n } catch (error: unknown) {\n return this.handleFatalRuntimeError(\n \"Failed to fork session\",\n error,\n );\n }\n },\n navigateTree: async (targetId, options) => {\n const result = await this.session.navigateTree(targetId, {\n summarize: options?.summarize,\n customInstructions: options?.customInstructions,\n replaceInstructions: options?.replaceInstructions,\n label: options?.label,\n });\n if (result.cancelled) {\n return { cancelled: true };\n }\n\n this.chatContainer.clear();\n this.renderInitialMessages();\n if (result.editorText && !this.editor.getText().trim()) {\n this.editor.setText(result.editorText);\n }\n this.showStatus(\"Navigated to selected point\");\n void this.flushCompactionQueue({ willRetry: false });\n return { cancelled: false };\n },\n switchSession: async (sessionPath, options) => {\n return this.handleResumeSession(sessionPath, options);\n },\n reload: async () => {\n await this.handleReloadCommand();\n },\n },\n shutdownHandler: () => {\n this.shutdownRequested = true;\n if (!this.session.isStreaming) {\n void this.shutdown();\n }\n },\n onError: (error) => {\n this.showExtensionError(error.extensionPath, error.error, error.stack);\n },\n });\n\n setRegisteredThemes(this.session.resourceLoader.getThemes().themes);\n this.setupAutocompleteProvider();\n\n const extensionRunner = this.session.extensionRunner;\n this.setupExtensionShortcuts(extensionRunner);\n if (!this.deferredStartupPending) {\n this.showLoadedResources({ force: true, showDiagnosticsWhenQuiet: true });\n this.showStartupNoticesIfNeeded();\n }\n };\n\nInteractiveModeBase.prototype.applyRuntimeSettings = function(this: InteractiveModeBase): void {\n this.footer.setSession(this.session);\n this.usageMeter.setSession(this.session);\n this.usageMeter.setAutoCompactEnabled(this.session.autoCompactionEnabled);\n this.footerDataProvider.setCwd(this.sessionManager.getCwd());\n this.hideThinkingBlock = this.settingsManager.getHideThinkingBlock();\n this.outputPad = this.settingsManager.getOutputPad();\n this.ui.setShowHardwareCursor(this.settingsManager.getShowHardwareCursor());\n this.ui.setClearOnShrink(this.settingsManager.getClearOnShrink());\n const editorPaddingX = this.settingsManager.getEditorPaddingX();\n const autocompleteMaxVisible =\n this.settingsManager.getAutocompleteMaxVisible();\n this.defaultEditor.setPaddingX(editorPaddingX);\n this.defaultEditor.setAutocompleteMaxVisible(autocompleteMaxVisible);\n if (this.editor !== this.defaultEditor) {\n this.editor.setPaddingX?.(editorPaddingX);\n this.editor.setAutocompleteMaxVisible?.(autocompleteMaxVisible);\n }\n };\n\nInteractiveModeBase.prototype.rebindCurrentSession = async function(this: InteractiveModeBase): Promise<void> {\n this.unsubscribe?.();\n this.unsubscribe = undefined;\n this.applyRuntimeSettings();\n await this.bindCurrentSessionExtensions();\n this.subscribeToAgent();\n await this.updateAvailableProviderCount();\n this.updateEditorBorderColor();\n this.updateTerminalTitle();\n };\n\nInteractiveModeBase.prototype.handleFatalRuntimeError = async function(this: InteractiveModeBase, prefix: string, error: unknown): Promise<never> {\n const message = error instanceof Error ? error.message : String(error);\n this.showError(`${prefix}: ${message}`);\n stopThemeWatcher();\n this.stop();\n process.exit(1);\n };\n\nInteractiveModeBase.prototype.renderCurrentSessionState = function(this: InteractiveModeBase): void {\n this.chatContainer.clear();\n this.pendingMessagesContainer.clear();\n this.compactionQueuedMessages = [];\n this.streamingComponent = undefined;\n this.streamingMessage = undefined;\n this.pendingTools.clear();\n this.renderInitialMessages();\n };\n\nInteractiveModeBase.prototype.getRegisteredToolDefinition = function(this: InteractiveModeBase, toolName: string): ReturnType<AgentSession[\"getToolDefinition\"]> {\n return this.session.getToolDefinition(toolName);\n };\n"]}
|
|
@@ -80,7 +80,7 @@ InteractiveModeBase.prototype.bindCurrentSessionExtensions = async function () {
|
|
|
80
80
|
const extensionRunner = this.session.extensionRunner;
|
|
81
81
|
this.setupExtensionShortcuts(extensionRunner);
|
|
82
82
|
if (!this.deferredStartupPending) {
|
|
83
|
-
this.showLoadedResources({ force:
|
|
83
|
+
this.showLoadedResources({ force: true, showDiagnosticsWhenQuiet: true });
|
|
84
84
|
this.showStartupNoticesIfNeeded();
|
|
85
85
|
}
|
|
86
86
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactive-session-runtime.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-session-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,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AAgB;IAC5G,OAAO,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;AAClD,CAAC,CAAC","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { type AgentSession, setRegisteredThemes, stopThemeWatcher } from \"./interactive-mode-deps.ts\";\n\nInteractiveModeBase.prototype.bindCurrentSessionExtensions = async function(this: InteractiveModeBase): Promise<void> {\n const uiContext = this.createExtensionUIContext();\n await this.session.bindExtensions({\n uiContext,\n mode: \"tui\",\n commandContextActions: {\n waitForIdle: () => this.session.agent.waitForIdle(),\n newSession: async (options) => {\n if (this.loadingAnimation) {\n this.loadingAnimation.stop();\n this.loadingAnimation = undefined;\n }\n this.statusContainer.clear();\n try {\n const result = await this.runtimeHost.newSession(options);\n if (!result.cancelled) {\n this.renderCurrentSessionState();\n this.ui.requestRender();\n }\n return result;\n } catch (error: unknown) {\n return this.handleFatalRuntimeError(\n \"Failed to create session\",\n error,\n );\n }\n },\n fork: async (entryId, options) => {\n try {\n const result = await this.runtimeHost.fork(entryId, options);\n if (!result.cancelled) {\n this.renderCurrentSessionState();\n this.editor.setText(result.selectedText ?? \"\");\n this.showStatus(\"Forked to new session\");\n }\n return { cancelled: result.cancelled };\n } catch (error: unknown) {\n return this.handleFatalRuntimeError(\n \"Failed to fork session\",\n error,\n );\n }\n },\n navigateTree: async (targetId, options) => {\n const result = await this.session.navigateTree(targetId, {\n summarize: options?.summarize,\n customInstructions: options?.customInstructions,\n replaceInstructions: options?.replaceInstructions,\n label: options?.label,\n });\n if (result.cancelled) {\n return { cancelled: true };\n }\n\n this.chatContainer.clear();\n this.renderInitialMessages();\n if (result.editorText && !this.editor.getText().trim()) {\n this.editor.setText(result.editorText);\n }\n this.showStatus(\"Navigated to selected point\");\n void this.flushCompactionQueue({ willRetry: false });\n return { cancelled: false };\n },\n switchSession: async (sessionPath, options) => {\n return this.handleResumeSession(sessionPath, options);\n },\n reload: async () => {\n await this.handleReloadCommand();\n },\n },\n shutdownHandler: () => {\n this.shutdownRequested = true;\n if (!this.session.isStreaming) {\n void this.shutdown();\n }\n },\n onError: (error) => {\n this.showExtensionError(error.extensionPath, error.error, error.stack);\n },\n });\n\n setRegisteredThemes(this.session.resourceLoader.getThemes().themes);\n this.setupAutocompleteProvider();\n\n const extensionRunner = this.session.extensionRunner;\n this.setupExtensionShortcuts(extensionRunner);\n if (!this.deferredStartupPending) {\n this.showLoadedResources({ force: false, showDiagnosticsWhenQuiet: true });\n this.showStartupNoticesIfNeeded();\n }\n };\n\nInteractiveModeBase.prototype.applyRuntimeSettings = function(this: InteractiveModeBase): void {\n this.footer.setSession(this.session);\n this.usageMeter.setSession(this.session);\n this.usageMeter.setAutoCompactEnabled(this.session.autoCompactionEnabled);\n this.footerDataProvider.setCwd(this.sessionManager.getCwd());\n this.hideThinkingBlock = this.settingsManager.getHideThinkingBlock();\n this.outputPad = this.settingsManager.getOutputPad();\n this.ui.setShowHardwareCursor(this.settingsManager.getShowHardwareCursor());\n this.ui.setClearOnShrink(this.settingsManager.getClearOnShrink());\n const editorPaddingX = this.settingsManager.getEditorPaddingX();\n const autocompleteMaxVisible =\n this.settingsManager.getAutocompleteMaxVisible();\n this.defaultEditor.setPaddingX(editorPaddingX);\n this.defaultEditor.setAutocompleteMaxVisible(autocompleteMaxVisible);\n if (this.editor !== this.defaultEditor) {\n this.editor.setPaddingX?.(editorPaddingX);\n this.editor.setAutocompleteMaxVisible?.(autocompleteMaxVisible);\n }\n };\n\nInteractiveModeBase.prototype.rebindCurrentSession = async function(this: InteractiveModeBase): Promise<void> {\n this.unsubscribe?.();\n this.unsubscribe = undefined;\n this.applyRuntimeSettings();\n await this.bindCurrentSessionExtensions();\n this.subscribeToAgent();\n await this.updateAvailableProviderCount();\n this.updateEditorBorderColor();\n this.updateTerminalTitle();\n };\n\nInteractiveModeBase.prototype.handleFatalRuntimeError = async function(this: InteractiveModeBase, prefix: string, error: unknown): Promise<never> {\n const message = error instanceof Error ? error.message : String(error);\n this.showError(`${prefix}: ${message}`);\n stopThemeWatcher();\n this.stop();\n process.exit(1);\n };\n\nInteractiveModeBase.prototype.renderCurrentSessionState = function(this: InteractiveModeBase): void {\n this.chatContainer.clear();\n this.pendingMessagesContainer.clear();\n this.compactionQueuedMessages = [];\n this.streamingComponent = undefined;\n this.streamingMessage = undefined;\n this.pendingTools.clear();\n this.renderInitialMessages();\n };\n\nInteractiveModeBase.prototype.getRegisteredToolDefinition = function(this: InteractiveModeBase, toolName: string): ReturnType<AgentSession[\"getToolDefinition\"]> {\n return this.session.getToolDefinition(toolName);\n };\n"]}
|
|
1
|
+
{"version":3,"file":"interactive-session-runtime.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-session-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAqB,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAEtG,mBAAmB,CAAC,SAAS,CAAC,4BAA4B,GAAG,KAAK;IAC9D,MAAM,SAAS,GAAG,IAAI,CAAC,wBAAwB,EAAE,CAAC;IAClD,MAAM,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC;QAChC,SAAS;QACT,IAAI,EAAE,KAAK;QACX,qBAAqB,EAAE;YACrB,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,WAAW,EAAE;YACnD,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;gBAC5B,IAAI,IAAI,CAAC,gBAAgB,EAAE,CAAC;oBAC1B,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE,CAAC;oBAC7B,IAAI,CAAC,gBAAgB,GAAG,SAAS,CAAC;gBACpC,CAAC;gBACD,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC;gBAC7B,IAAI,CAAC;oBACH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,UAAU,CAA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AAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC;AAEJ,mBAAmB,CAAC,SAAS,CAAC,yBAAyB,GAAG;IACtD,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;IAC3B,IAAI,CAAC,wBAAwB,CAAC,KAAK,EAAE,CAAC;IACtC,IAAI,CAAC,wBAAwB,GAAG,EAAE,CAAC;IACnC,IAAI,CAAC,kBAAkB,GAAG,SAAS,CAAC;IACpC,IAAI,CAAC,gBAAgB,GAAG,SAAS,CAAC;IAClC,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;IAC1B,IAAI,CAAC,qBAAqB,EAAE,CAAC;AAC/B,CAAC,CAAC;AAEJ,mBAAmB,CAAC,SAAS,CAAC,2BAA2B,GAAG,UAAoC,QAAgB;IAC5G,OAAO,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;AAClD,CAAC,CAAC","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { type AgentSession, setRegisteredThemes, stopThemeWatcher } from \"./interactive-mode-deps.ts\";\n\nInteractiveModeBase.prototype.bindCurrentSessionExtensions = async function(this: InteractiveModeBase): Promise<void> {\n const uiContext = this.createExtensionUIContext();\n await this.session.bindExtensions({\n uiContext,\n mode: \"tui\",\n commandContextActions: {\n waitForIdle: () => this.session.agent.waitForIdle(),\n newSession: async (options) => {\n if (this.loadingAnimation) {\n this.loadingAnimation.stop();\n this.loadingAnimation = undefined;\n }\n this.statusContainer.clear();\n try {\n const result = await this.runtimeHost.newSession(options);\n if (!result.cancelled) {\n this.renderCurrentSessionState();\n this.ui.requestRender();\n }\n return result;\n } catch (error: unknown) {\n return this.handleFatalRuntimeError(\n \"Failed to create session\",\n error,\n );\n }\n },\n fork: async (entryId, options) => {\n try {\n const result = await this.runtimeHost.fork(entryId, options);\n if (!result.cancelled) {\n this.renderCurrentSessionState();\n this.editor.setText(result.selectedText ?? \"\");\n this.showStatus(\"Forked to new session\");\n }\n return { cancelled: result.cancelled };\n } catch (error: unknown) {\n return this.handleFatalRuntimeError(\n \"Failed to fork session\",\n error,\n );\n }\n },\n navigateTree: async (targetId, options) => {\n const result = await this.session.navigateTree(targetId, {\n summarize: options?.summarize,\n customInstructions: options?.customInstructions,\n replaceInstructions: options?.replaceInstructions,\n label: options?.label,\n });\n if (result.cancelled) {\n return { cancelled: true };\n }\n\n this.chatContainer.clear();\n this.renderInitialMessages();\n if (result.editorText && !this.editor.getText().trim()) {\n this.editor.setText(result.editorText);\n }\n this.showStatus(\"Navigated to selected point\");\n void this.flushCompactionQueue({ willRetry: false });\n return { cancelled: false };\n },\n switchSession: async (sessionPath, options) => {\n return this.handleResumeSession(sessionPath, options);\n },\n reload: async () => {\n await this.handleReloadCommand();\n },\n },\n shutdownHandler: () => {\n this.shutdownRequested = true;\n if (!this.session.isStreaming) {\n void this.shutdown();\n }\n },\n onError: (error) => {\n this.showExtensionError(error.extensionPath, error.error, error.stack);\n },\n });\n\n setRegisteredThemes(this.session.resourceLoader.getThemes().themes);\n this.setupAutocompleteProvider();\n\n const extensionRunner = this.session.extensionRunner;\n this.setupExtensionShortcuts(extensionRunner);\n if (!this.deferredStartupPending) {\n this.showLoadedResources({ force: true, showDiagnosticsWhenQuiet: true });\n this.showStartupNoticesIfNeeded();\n }\n };\n\nInteractiveModeBase.prototype.applyRuntimeSettings = function(this: InteractiveModeBase): void {\n this.footer.setSession(this.session);\n this.usageMeter.setSession(this.session);\n this.usageMeter.setAutoCompactEnabled(this.session.autoCompactionEnabled);\n this.footerDataProvider.setCwd(this.sessionManager.getCwd());\n this.hideThinkingBlock = this.settingsManager.getHideThinkingBlock();\n this.outputPad = this.settingsManager.getOutputPad();\n this.ui.setShowHardwareCursor(this.settingsManager.getShowHardwareCursor());\n this.ui.setClearOnShrink(this.settingsManager.getClearOnShrink());\n const editorPaddingX = this.settingsManager.getEditorPaddingX();\n const autocompleteMaxVisible =\n this.settingsManager.getAutocompleteMaxVisible();\n this.defaultEditor.setPaddingX(editorPaddingX);\n this.defaultEditor.setAutocompleteMaxVisible(autocompleteMaxVisible);\n if (this.editor !== this.defaultEditor) {\n this.editor.setPaddingX?.(editorPaddingX);\n this.editor.setAutocompleteMaxVisible?.(autocompleteMaxVisible);\n }\n };\n\nInteractiveModeBase.prototype.rebindCurrentSession = async function(this: InteractiveModeBase): Promise<void> {\n this.unsubscribe?.();\n this.unsubscribe = undefined;\n this.applyRuntimeSettings();\n await this.bindCurrentSessionExtensions();\n this.subscribeToAgent();\n await this.updateAvailableProviderCount();\n this.updateEditorBorderColor();\n this.updateTerminalTitle();\n };\n\nInteractiveModeBase.prototype.handleFatalRuntimeError = async function(this: InteractiveModeBase, prefix: string, error: unknown): Promise<never> {\n const message = error instanceof Error ? error.message : String(error);\n this.showError(`${prefix}: ${message}`);\n stopThemeWatcher();\n this.stop();\n process.exit(1);\n };\n\nInteractiveModeBase.prototype.renderCurrentSessionState = function(this: InteractiveModeBase): void {\n this.chatContainer.clear();\n this.pendingMessagesContainer.clear();\n this.compactionQueuedMessages = [];\n this.streamingComponent = undefined;\n this.streamingMessage = undefined;\n this.pendingTools.clear();\n this.renderInitialMessages();\n };\n\nInteractiveModeBase.prototype.getRegisteredToolDefinition = function(this: InteractiveModeBase, toolName: string): ReturnType<AgentSession[\"getToolDefinition\"]> {\n return this.session.getToolDefinition(toolName);\n };\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactive-startup.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-startup.ts"],"names":[],"mappings":"","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { type MarkdownTheme, os, path, Markdown, Spacer, Text, spawn, APP_NAME, APP_TITLE, ENV_OFFLINE, getEnvValue, getAgentDir, VERSION, formatCodexFastModeModelLabel, shouldApplyCodexFastMode, DefaultPackageManager, isInstallTelemetryEnabled, getChangelogPath, getEntriesForVersion, getNewEntries, normalizeChangelogLinks, parseChangelog, getCwdRelativePath, getPiUserAgent, recordTimeSinceReset, ensureTool, checkForNewPiVersion, renderAtomicAnsiBanner, DynamicBorder, getMarkdownTheme, onThemeChange, theme } from \"./interactive-mode-deps.ts\";\nimport { ExpandableText } from \"./interactive-mode-helpers.ts\";\nimport { ONBOARDING_COPY } from \"./interactive-onboarding.ts\";\n\nInteractiveModeBase.prototype.showStartupNoticesIfNeeded = function(this: InteractiveModeBase): void {\n if (this.startupNoticesShown) {\n return;\n }\n this.startupNoticesShown = true;\n\n const changelogMarkdown = this.changelogMarkdown;\n if (!changelogMarkdown && !this.firstRunNoticeVisible) {\n return;\n }\n\n if (changelogMarkdown) {\n if (this.chatContainer.children.length > 0) {\n this.chatContainer.addChild(new Spacer(1));\n }\n this.chatContainer.addChild(new DynamicBorder());\n if (this.settingsManager.getCollapseChangelog()) {\n const versionMatch = changelogMarkdown.match(\n /##\\s+\\[?((?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)(?:-(?:alpha\\.)?(?:0|[1-9]\\d*))?)\\]?/,\n );\n const latestVersion = versionMatch ? versionMatch[1] : this.version;\n const condensedText = `Updated to v${latestVersion}. Use ${theme.bold(\"/changelog\")} to view full changelog.`;\n this.chatContainer.addChild(new Text(condensedText, 1, 0));\n } else {\n this.chatContainer.addChild(\n new Text(theme.bold(theme.fg(\"accent\", \"What's New\")), 1, 0),\n );\n this.chatContainer.addChild(new Spacer(1));\n this.chatContainer.addChild(\n new Markdown(\n changelogMarkdown.trim(),\n 1,\n 0,\n this.getMarkdownThemeWithSettings(),\n ),\n );\n this.chatContainer.addChild(new Spacer(1));\n }\n this.chatContainer.addChild(new DynamicBorder());\n }\n\n if (this.firstRunNoticeVisible) {\n this.firstRunOnboardingNoticeComponents = [];\n if (this.chatContainer.children.length > 0) {\n this.firstRunOnboardingNoticeComponents.push(new Spacer(1));\n }\n this.firstRunOnboardingNoticeComponents.push(\n new DynamicBorder(),\n new Text(ONBOARDING_COPY, 1, 0),\n new DynamicBorder(),\n new Spacer(1),\n );\n for (const component of this.firstRunOnboardingNoticeComponents) {\n this.chatContainer.addChild(component);\n }\n // Mark completion only after queueing the notice in the chat canvas so\n // launches that skip rendering retry the first-run notice next time.\n this.settingsManager.setOnboardedVersion(this.version);\n }\n\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.init = async function(this: InteractiveModeBase): Promise<void> {\n if (this.isInitialized) return;\n\n this.registerSignalHandlers();\n\n // Load changelog (only show new entries, skip for resumed sessions)\n this.hadLastChangelogVersionAtStartup = Boolean(this.settingsManager.getLastChangelogVersion());\n this.changelogMarkdown = this.getChangelogForDisplay();\n this.initializeFirstRunOnboardingMarkers();\n\n // Add header container as first child. Populate it after theme initialization.\n this.ui.addChild(this.headerContainer);\n\n this.ui.addChild(this.chatContainer);\n this.ui.addChild(this.pendingMessagesContainer);\n this.ui.addChild(this.statusContainer);\n this.renderWidgets(); // Initialize with default spacer\n this.ui.addChild(this.widgetContainerAbove);\n this.ui.addChild(this.usageMeter);\n this.ui.addChild(this.editorContainer);\n // Footer (persistent model + cwd identity) stays pinned directly under the\n // editor; below-editor widgets render after it, at the very bottom. This\n // keeps the session identity line attached to the input and places\n // transient run status (e.g. the workflow companion counter) beneath it.\n // Rendering below-editor widgets last also keeps a live widget at the\n // absolute bottom of the buffer (always within the viewport), so its\n // per-tick updates never sit above the fold — preserving the #1109\n // resize-flicker fix.\n this.ui.addChild(this.footer);\n this.ui.addChild(this.widgetContainerBelow);\n this.ui.setFocus(this.editor);\n\n this.setupKeyHandlers();\n this.setupEditorSubmitHandler();\n\n this.firstRunNoticeVisible = this.isFirstRunOnboardingEligible();\n\n // Start the UI before initializing extensions so session_start handlers can use interactive dialogs.\n // fd/rg readiness is intentionally checked after first paint because ensureTool may spawn\n // or download tools on cold machines.\n this.ui.start();\n recordTimeSinceReset(\"time-to-first-frame\");\n this.isInitialized = true;\n\n await this.themeController.applyFromSettings();\n\n // Add the quiet startup identity (unless silenced). Resource details are\n // disclosed separately in the chat canvas via the tools/resources toggle.\n if (this.options.verbose || !this.settingsManager.getQuietStartup()) {\n this.builtInHeader = new ExpandableText(\n () => this.getStartupIdentityText(),\n () => this.getStartupIdentityText(),\n this.getStartupExpansionState(),\n 1,\n 0,\n );\n\n this.headerContainer.addChild(new Spacer(1));\n this.headerContainer.addChild(this.builtInHeader);\n this.headerContainer.addChild(new Spacer(1));\n } else {\n // Minimal header when silenced\n this.builtInHeader = new Text(\"\", 0, 0);\n this.headerContainer.addChild(this.builtInHeader);\n }\n this.ui.requestRender();\n\n void Promise.all([ensureTool(\"fd\"), ensureTool(\"rg\")])\n .then(([fdPath]) => {\n this.fdPath = fdPath;\n this.setupAutocompleteProvider();\n })\n .catch((error) => {\n const message = error instanceof Error ? error.message : String(error);\n console.error(`Tool readiness check failed: ${message}`);\n });\n\n // Initialize extensions first so resources are shown before messages\n await this.rebindCurrentSession();\n\n // Render initial messages AFTER showing loaded resources\n this.renderInitialMessages();\n\n // Extensions were skipped before first paint; finish loading them in the background.\n if (this.deferredStartupPending) {\n this.deferredStartupPromise = this.completeDeferredStartup();\n }\n\n // Set up theme file watcher\n onThemeChange(() => {\n this.ui.invalidate();\n this.updateEditorBorderColor();\n this.ui.requestRender();\n });\n\n // Set up git branch watcher (uses provider instead of footer)\n this.footerDataProvider.onBranchChange(() => {\n this.ui.requestRender();\n });\n\n // Initialize available provider count for footer display without delaying first-frame startup.\n void this.updateAvailableProviderCount().catch((error) => {\n const message = error instanceof Error ? error.message : String(error);\n console.error(`Failed to update provider count: ${message}`);\n });\n };\n\nInteractiveModeBase.prototype.updateTerminalTitle = function(this: InteractiveModeBase): void {\n const cwdBasename = path.basename(this.sessionManager.getCwd());\n const sessionName = this.sessionManager.getSessionName();\n if (sessionName) {\n this.ui.terminal.setTitle(\n `${APP_TITLE} - ${sessionName} - ${cwdBasename}`,\n );\n } else {\n this.ui.terminal.setTitle(`${APP_TITLE} - ${cwdBasename}`);\n }\n };\n\nInteractiveModeBase.prototype.run = async function(this: InteractiveModeBase): Promise<void> {\n await this.init();\n\n // Load GitHub Copilot context-window tiers from CAPI early (gated on the Copilot provider) so\n // the footer and /model picker reflect GitHub's real windows. Best-effort, never blocks startup.\n void this.refreshCopilotModelCatalog();\n\n // Start version check asynchronously\n checkForNewPiVersion(this.version).then((newVersion) => {\n if (newVersion) {\n this.showNewVersionNotification(newVersion);\n }\n });\n\n // Start package update check asynchronously\n this.checkForPackageUpdates().then((updates) => {\n if (updates.length > 0) {\n this.showPackageUpdateNotification(updates);\n }\n });\n\n // Check tmux keyboard setup asynchronously\n this.checkTmuxKeyboardSetup().then((warning) => {\n if (warning) {\n this.showWarning(warning);\n }\n });\n\n // Show startup warnings\n const {\n migratedProviders,\n modelFallbackMessage,\n initialMessage,\n initialImages,\n initialMessages,\n } = this.options;\n\n if (migratedProviders && migratedProviders.length > 0) {\n this.showWarning(\n `Migrated credentials to auth.json: ${migratedProviders.join(\", \")}`,\n );\n }\n\n const modelsJsonError = this.session.modelRegistry.getError();\n if (modelsJsonError) {\n this.showError(`models.json error: ${modelsJsonError}`);\n }\n\n if (modelFallbackMessage && !this.deferredStartupPromise) {\n // With a deferred extension load, model restore is retried once extension\n // providers register; completeDeferredStartup shows the warning if it still fails.\n this.showWarning(modelFallbackMessage);\n }\n\n void this.maybeWarnAboutAnthropicSubscriptionAuth();\n\n // Prompts need extension tools; wait for the background load before sending any.\n if (this.deferredStartupPromise) {\n await this.deferredStartupPromise;\n }\n\n // Process initial messages\n if (initialMessage) {\n try {\n await this.session.prompt(initialMessage, { images: initialImages });\n } catch (error: unknown) {\n const errorMessage =\n error instanceof Error ? error.message : \"Unknown error occurred\";\n this.showError(errorMessage);\n }\n }\n\n if (initialMessages) {\n for (const message of initialMessages) {\n try {\n await this.session.prompt(message);\n } catch (error: unknown) {\n const errorMessage =\n error instanceof Error ? error.message : \"Unknown error occurred\";\n this.showError(errorMessage);\n }\n }\n }\n\n // Main interactive loop\n while (true) {\n const userInput = await this.getUserInput();\n try {\n await this.session.prompt(userInput);\n } catch (error: unknown) {\n const errorMessage =\n error instanceof Error ? error.message : \"Unknown error occurred\";\n this.showError(errorMessage);\n }\n }\n };\n\nInteractiveModeBase.prototype.checkForPackageUpdates = async function(this: InteractiveModeBase): Promise<string[]> {\n if (getEnvValue(ENV_OFFLINE)) {\n return [];\n }\n\n try {\n const packageManager = new DefaultPackageManager({\n cwd: this.sessionManager.getCwd(),\n agentDir: getAgentDir(),\n settingsManager: this.settingsManager,\n });\n const updates = await packageManager.checkForAvailableUpdates();\n return updates.map((update) => update.displayName);\n } catch {\n return [];\n }\n };\n\nInteractiveModeBase.prototype.checkTmuxKeyboardSetup = async function(this: InteractiveModeBase): Promise<string | undefined> {\n if (!process.env.TMUX) return undefined;\n\n const runTmuxShow = (option: string): Promise<string | undefined> => {\n return new Promise((resolve) => {\n const proc = spawn(\"tmux\", [\"show\", \"-gv\", option], {\n stdio: [\"ignore\", \"pipe\", \"ignore\"],\n });\n let stdout = \"\";\n const timer = setTimeout(() => {\n proc.kill();\n resolve(undefined);\n }, 2000);\n\n proc.stdout?.on(\"data\", (data) => {\n stdout += data.toString();\n });\n proc.on(\"error\", () => {\n clearTimeout(timer);\n resolve(undefined);\n });\n proc.on(\"close\", (code) => {\n clearTimeout(timer);\n resolve(code === 0 ? stdout.trim() : undefined);\n });\n });\n };\n\n const [extendedKeys, extendedKeysFormat] = await Promise.all([\n runTmuxShow(\"extended-keys\"),\n runTmuxShow(\"extended-keys-format\"),\n ]);\n\n // If we couldn't query tmux (timeout, sandbox, etc.), don't warn\n if (extendedKeys === undefined) return undefined;\n\n if (extendedKeys !== \"on\" && extendedKeys !== \"always\") {\n return \"tmux extended-keys is off. Modified enter keys may not work. Add `set -g extended-keys on` to ~/.tmux.conf and restart tmux.\";\n }\n\n if (extendedKeysFormat === \"xterm\") {\n return \"tmux extended-keys-format is xterm. Pi works best with csi-u. Add `set -g extended-keys-format csi-u` to ~/.tmux.conf and restart tmux.\";\n }\n\n return undefined;\n };\n\nInteractiveModeBase.prototype.getChangelogForDisplay = function(this: InteractiveModeBase): string | undefined {\n // Skip changelog for resumed/continued sessions (already have messages)\n if (this.session.state.messages.length > 0) {\n return undefined;\n }\n\n const lastVersion = this.settingsManager.getLastChangelogVersion();\n const changelogPath = getChangelogPath();\n const entries = parseChangelog(changelogPath);\n\n if (!lastVersion) {\n // Fresh install - record the version, send telemetry, don't show changelog\n this.settingsManager.setLastChangelogVersion(VERSION);\n this.reportInstallTelemetry(VERSION);\n return undefined;\n }\n\n const newEntries = getNewEntries(entries, lastVersion, VERSION);\n const currentEntries = getEntriesForVersion(newEntries, VERSION);\n if (currentEntries.length > 0) {\n this.settingsManager.setLastChangelogVersion(VERSION);\n this.reportInstallTelemetry(VERSION);\n return currentEntries.map((e) => normalizeChangelogLinks(e.content, e)).join(\"\\n\\n\");\n }\n\n return undefined;\n };\n\nInteractiveModeBase.prototype.reportInstallTelemetry = function(this: InteractiveModeBase, version: string): void {\n if (getEnvValue(ENV_OFFLINE)) {\n return;\n }\n\n if (!isInstallTelemetryEnabled(this.settingsManager)) {\n return;\n }\n\n void fetch(\n `https://pi.dev/api/report-install?version=${encodeURIComponent(version)}`,\n {\n headers: {\n \"User-Agent\": getPiUserAgent(version),\n },\n signal: AbortSignal.timeout(5000),\n },\n )\n .then(() => undefined)\n .catch(() => undefined);\n };\n\nInteractiveModeBase.prototype.getMarkdownThemeWithSettings = function(this: InteractiveModeBase): MarkdownTheme {\n return {\n ...getMarkdownTheme(),\n codeBlockIndent: this.settingsManager.getCodeBlockIndent(),\n };\n };\n\nInteractiveModeBase.prototype.formatDisplayPath = function(this: InteractiveModeBase, p: string): string {\n const home = os.homedir();\n let result = p;\n\n // Replace home directory with ~\n if (result.startsWith(home)) {\n result = `~${result.slice(home.length)}`;\n }\n\n return result;\n };\n\nInteractiveModeBase.prototype.formatExtensionDisplayPath = function(this: InteractiveModeBase, path: string): string {\n let result = this.formatDisplayPath(path);\n result = result.replace(/\\/index\\.ts$/, \"\").replace(/\\/index\\.js$/, \"\");\n return result;\n };\n\nInteractiveModeBase.prototype.formatContextPath = function(this: InteractiveModeBase, p: string): string {\n const cwd = path.resolve(this.sessionManager.getCwd());\n const absolutePath = path.isAbsolute(p)\n ? path.resolve(p)\n : path.resolve(cwd, p);\n const relativePath = getCwdRelativePath(absolutePath, cwd);\n if (relativePath !== undefined) {\n return relativePath;\n }\n\n return this.formatDisplayPath(absolutePath);\n };\n\nInteractiveModeBase.prototype.getStartupModelLabel = function(this: InteractiveModeBase): string {\n const model = this.session.state.model;\n let modelLabel = model?.id ?? \"no-model\";\n\n if (model?.reasoning) {\n modelLabel = `${modelLabel} ${this.session.thinkingLevel || \"off\"}`;\n }\n\n if (!model) {\n return modelLabel;\n }\n\n const fastModeEnabled = shouldApplyCodexFastMode(\n model,\n this.session.settingsManager.getCodexFastModeSettings(),\n this.session.orchestrationContext,\n );\n return formatCodexFastModeModelLabel(modelLabel, fastModeEnabled);\n };\n\nInteractiveModeBase.prototype.getStartupIdentityText = function(this: InteractiveModeBase): string {\n const appLabel = APP_NAME.length > 0\n ? `${APP_NAME[0]!.toUpperCase()}${APP_NAME.slice(1)}`\n : \"Atomic\";\n const title = `${theme.bold(theme.fg(\"text\", appLabel))} ${theme.fg(\"muted\", `v${this.version}`)}`;\n const model = this.session.state.model;\n const provider = model ? theme.fg(\"dim\", `(${model.provider})`) : theme.fg(\"dim\", \"(no-provider)\");\n const modelLine = `${provider} ${theme.fg(\"muted\", this.getStartupModelLabel())}`;\n const cwd = theme.fg(\"muted\", this.formatDisplayPath(this.sessionManager.getCwd()));\n const metaLines = [title, modelLine, cwd];\n const markLines = this.getAtomicAnsiMarkLines();\n\n return markLines\n .map((line, index) => `${line} ${metaLines[index] ?? \"\"}`.trimEnd())\n .join(\"\\n\");\n };\n\nInteractiveModeBase.prototype.getAtomicAnsiMarkLines = function(this: InteractiveModeBase): string[] {\n return renderAtomicAnsiBanner(theme, this.session.thinkingLevel || \"off\");\n };\n\nInteractiveModeBase.prototype.getStartupExpansionState = function(this: InteractiveModeBase): boolean {\n return this.options.verbose || this.toolOutputExpanded;\n };\n"]}
|
|
1
|
+
{"version":3,"file":"interactive-startup.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-startup.ts"],"names":[],"mappings":"","sourcesContent":["import { InteractiveModeBase, seedStartupInput } from \"./interactive-mode-base.ts\";\nimport { type Container, type MarkdownTheme, os, path, Markdown, Spacer, Text, spawn, APP_NAME, APP_TITLE, ENV_OFFLINE, getEnvValue, getAgentDir, VERSION, formatCodexFastModeModelLabel, shouldApplyCodexFastMode, DefaultPackageManager, isInstallTelemetryEnabled, getChangelogPath, getEntriesForVersion, getNewEntries, normalizeChangelogLinks, parseChangelog, getCwdRelativePath, getPiUserAgent, recordTimeSinceReset, ensureTool, checkForNewPiVersion, renderAtomicAnsiBanner, DynamicBorder, getMarkdownTheme, onThemeChange, theme } from \"./interactive-mode-deps.ts\";\nimport { ExpandableText } from \"./interactive-mode-helpers.ts\";\nimport { ONBOARDING_COPY } from \"./interactive-onboarding.ts\";\n\nInteractiveModeBase.prototype.showStartupNoticesIfNeeded = function(this: InteractiveModeBase, targetContainer: Container = this.chatContainer): void {\n if (this.startupNoticesShown) {\n return;\n }\n this.startupNoticesShown = true;\n\n const changelogMarkdown = this.changelogMarkdown;\n if (!changelogMarkdown && !this.firstRunNoticeVisible) {\n return;\n }\n\n if (changelogMarkdown) {\n if (targetContainer.children.length > 0) {\n targetContainer.addChild(new Spacer(1));\n }\n targetContainer.addChild(new DynamicBorder());\n if (this.settingsManager.getCollapseChangelog()) {\n const versionMatch = changelogMarkdown.match(\n /##\\s+\\[?((?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)(?:-(?:alpha\\.)?(?:0|[1-9]\\d*))?)\\]?/,\n );\n const latestVersion = versionMatch ? versionMatch[1] : this.version;\n const condensedText = `Updated to v${latestVersion}. Use ${theme.bold(\"/changelog\")} to view full changelog.`;\n targetContainer.addChild(new Text(condensedText, 1, 0));\n } else {\n targetContainer.addChild(\n new Text(theme.bold(theme.fg(\"accent\", \"What's New\")), 1, 0),\n );\n targetContainer.addChild(new Spacer(1));\n targetContainer.addChild(\n new Markdown(\n changelogMarkdown.trim(),\n 1,\n 0,\n this.getMarkdownThemeWithSettings(),\n ),\n );\n targetContainer.addChild(new Spacer(1));\n }\n targetContainer.addChild(new DynamicBorder());\n }\n\n if (this.firstRunNoticeVisible) {\n this.firstRunOnboardingNoticeComponents = [];\n if (targetContainer.children.length > 0) {\n this.firstRunOnboardingNoticeComponents.push(new Spacer(1));\n }\n this.firstRunOnboardingNoticeComponents.push(\n new DynamicBorder(),\n new Text(ONBOARDING_COPY, 1, 0),\n new DynamicBorder(),\n new Spacer(1),\n );\n for (const component of this.firstRunOnboardingNoticeComponents) {\n targetContainer.addChild(component);\n }\n // Mark completion only after queueing the notice in the chat canvas so\n // launches that skip rendering retry the first-run notice next time.\n this.settingsManager.setOnboardedVersion(this.version);\n }\n\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.init = async function(this: InteractiveModeBase): Promise<void> {\n if (this.isInitialized) return;\n\n this.registerSignalHandlers();\n\n // Load changelog (only show new entries, skip for resumed sessions)\n this.hadLastChangelogVersionAtStartup = Boolean(this.settingsManager.getLastChangelogVersion());\n this.changelogMarkdown = this.getChangelogForDisplay();\n this.initializeFirstRunOnboardingMarkers();\n\n // Add header container as first child. Populate it after theme initialization.\n this.ui.addChild(this.headerContainer);\n\n this.ui.addChild(this.chatContainer);\n this.ui.addChild(this.pendingMessagesContainer);\n this.ui.addChild(this.statusContainer);\n this.renderWidgets(); // Initialize with default spacer\n this.ui.addChild(this.widgetContainerAbove);\n this.ui.addChild(this.usageMeter);\n this.ui.addChild(this.editorContainer);\n // Footer (persistent model + cwd identity) stays pinned directly under the\n // editor; below-editor widgets render after it, at the very bottom. This\n // keeps the session identity line attached to the input and places\n // transient run status (e.g. the workflow companion counter) beneath it.\n // Rendering below-editor widgets last also keeps a live widget at the\n // absolute bottom of the buffer (always within the viewport), so its\n // per-tick updates never sit above the fold — preserving the #1109\n // resize-flicker fix.\n this.ui.addChild(this.footer);\n this.ui.addChild(this.widgetContainerBelow);\n this.ui.setFocus(this.editor);\n\n this.setupKeyHandlers();\n this.setupEditorSubmitHandler();\n\n this.firstRunNoticeVisible = this.isFirstRunOnboardingEligible();\n\n seedStartupInput(\n this.pendingUserInputs,\n this.defaultEditor,\n this.options.startupInputCapture?.consume(),\n this.startupReplayInputs,\n (text) => {\n this.startupDraftText = text;\n },\n (text) => {\n this.startupReplayActiveInput = text;\n },\n );\n\n // Start the UI before initializing extensions so session_start handlers can use interactive dialogs.\n // fd/rg readiness is intentionally checked after first paint because ensureTool may spawn\n // or download tools on cold machines.\n this.ui.start();\n recordTimeSinceReset(\"time-to-first-frame\");\n this.isInitialized = true;\n\n await this.themeController.applyFromSettings();\n\n // Add the quiet startup identity (unless silenced). Resource details are\n // disclosed separately in the chat canvas via the tools/resources toggle.\n if (this.options.verbose || !this.settingsManager.getQuietStartup()) {\n this.builtInHeader = new ExpandableText(\n () => this.getStartupIdentityText(),\n () => this.getStartupIdentityText(),\n this.getStartupExpansionState(),\n 1,\n 0,\n );\n\n this.headerContainer.addChild(new Spacer(1));\n this.headerContainer.addChild(this.builtInHeader);\n this.headerContainer.addChild(new Spacer(1));\n } else {\n // Minimal header when silenced\n this.builtInHeader = new Text(\"\", 0, 0);\n this.headerContainer.addChild(this.builtInHeader);\n }\n this.ui.requestRender();\n\n void Promise.all([ensureTool(\"fd\"), ensureTool(\"rg\")])\n .then(([fdPath]) => {\n this.fdPath = fdPath;\n this.setupAutocompleteProvider();\n })\n .catch((error) => {\n const message = error instanceof Error ? error.message : String(error);\n console.error(`Tool readiness check failed: ${message}`);\n });\n\n // When startup resources are deferred, keep the already-painted editor responsive.\n // Extension UI bindings are installed at the deferred reload boundary, not here,\n // so no post-paint resource work can block visible typing.\n if (this.deferredStartupPending) {\n this.applyRuntimeSettings();\n this.subscribeToAgent();\n this.updateEditorBorderColor();\n this.updateTerminalTitle();\n } else {\n await this.rebindCurrentSession();\n }\n\n this.attachStartupNoticesContainer();\n // Render initial messages AFTER the initial session binding is in place.\n this.renderInitialMessages();\n\tif (this.deferredStartupPending) {\n\t\tsetTimeout(() => {\n\t\t\tif (!this.deferredStartupPending || this.deferredStartupPromise) return;\n\t\t\tvoid this.ensureDeferredStartupComplete();\n\t\t}, 2000);\n\t}\n // Set up theme file watcher\n onThemeChange(() => {\n this.ui.invalidate();\n this.updateEditorBorderColor();\n this.ui.requestRender();\n });\n\n // Set up git branch watcher (uses provider instead of footer)\n this.footerDataProvider.onBranchChange(() => {\n this.ui.requestRender();\n });\n\n // Initialize available provider count for footer display without delaying first-frame startup.\n void this.updateAvailableProviderCount().catch((error) => {\n const message = error instanceof Error ? error.message : String(error);\n console.error(`Failed to update provider count: ${message}`);\n });\n };\n\nInteractiveModeBase.prototype.updateTerminalTitle = function(this: InteractiveModeBase): void {\n const cwdBasename = path.basename(this.sessionManager.getCwd());\n const sessionName = this.sessionManager.getSessionName();\n if (sessionName) {\n this.ui.terminal.setTitle(\n `${APP_TITLE} - ${sessionName} - ${cwdBasename}`,\n );\n } else {\n this.ui.terminal.setTitle(`${APP_TITLE} - ${cwdBasename}`);\n }\n };\n\nInteractiveModeBase.prototype.run = async function(this: InteractiveModeBase): Promise<void> {\n await this.init();\n\n\tsetTimeout(() => {\n\t\tvoid this.refreshCopilotModelCatalog();\n const startupNoticesContainer = this.startupNoticesContainer;\n\t\tcheckForNewPiVersion(this.version).then((newVersion) => {\n\t\t\tif (newVersion) this.showNewVersionNotification(newVersion, startupNoticesContainer);\n\t\t});\n\t\tthis.checkForPackageUpdates().then((updates) => {\n\t\t\tif (updates.length > 0) this.showPackageUpdateNotification(updates, startupNoticesContainer);\n\t\t});\n\t\tthis.checkTmuxKeyboardSetup().then((warning) => {\n\t\t\tif (warning) this.showWarning(warning, startupNoticesContainer);\n\t\t});\n\t\t// When startup is deferred, the RESOURCES disclosure renders after the\n\t\t// deferred extension load; hold the subscription warning until then so\n\t\t// the disclosure always appears first.\n\t\tif (!this.deferredStartupPending && !this.deferredStartupPromise && !this.pendingLoadedResourcesDisclosure) {\n\t\t\tvoid this.maybeWarnAboutAnthropicSubscriptionAuth(undefined, startupNoticesContainer);\n\t\t}\n\t}, 500);\n\n // Show startup warnings\n const {\n migratedProviders,\n modelFallbackMessage,\n initialMessage,\n initialImages,\n initialMessages,\n } = this.options;\n\n if (migratedProviders && migratedProviders.length > 0) {\n this.showWarning(\n `Migrated credentials to auth.json: ${migratedProviders.join(\", \")}`,\n );\n }\n\n const modelsJsonError = this.session.modelRegistry.getError();\n if (modelsJsonError) {\n this.showError(`models.json error: ${modelsJsonError}`);\n }\n\n if (modelFallbackMessage && !this.deferredStartupPending) {\n this.showWarning(modelFallbackMessage, this.startupNoticesContainer);\n }\n\n // CLI-provided startup prompts need extension tools/resources; wait before sending them,\n // but do not block the normal no-prompt input loop from becoming ready.\n if (this.deferredStartupPending && (initialMessage || (initialMessages && initialMessages.length > 0))) {\n await this.ensureDeferredStartupComplete();\n }\n\n // Process initial messages\n if (initialMessage) {\n try {\n await this.session.prompt(initialMessage, { images: initialImages });\n } catch (error: unknown) {\n const errorMessage =\n error instanceof Error ? error.message : \"Unknown error occurred\";\n this.showError(errorMessage);\n }\n }\n\n if (initialMessages) {\n for (const message of initialMessages) {\n try {\n await this.session.prompt(message);\n } catch (error: unknown) {\n const errorMessage =\n error instanceof Error ? error.message : \"Unknown error occurred\";\n this.showError(errorMessage);\n }\n }\n }\n\n // Main interactive loop\n while (true) {\n const userInput = await this.getUserInput();\n await this.runUserPromptTurn(userInput);\n }\n };\n\nInteractiveModeBase.prototype.checkForPackageUpdates = async function(this: InteractiveModeBase): Promise<string[]> {\n if (getEnvValue(ENV_OFFLINE)) {\n return [];\n }\n\n try {\n const packageManager = new DefaultPackageManager({\n cwd: this.sessionManager.getCwd(),\n agentDir: getAgentDir(),\n settingsManager: this.settingsManager,\n });\n const updates = await packageManager.checkForAvailableUpdates();\n return updates.map((update) => update.displayName);\n } catch {\n return [];\n }\n };\n\nInteractiveModeBase.prototype.checkTmuxKeyboardSetup = async function(this: InteractiveModeBase): Promise<string | undefined> {\n if (!process.env.TMUX) return undefined;\n\n const runTmuxShow = (option: string): Promise<string | undefined> => {\n return new Promise((resolve) => {\n const proc = spawn(\"tmux\", [\"show\", \"-gv\", option], {\n stdio: [\"ignore\", \"pipe\", \"ignore\"],\n });\n let stdout = \"\";\n const timer = setTimeout(() => {\n proc.kill();\n resolve(undefined);\n }, 2000);\n\n proc.stdout?.on(\"data\", (data) => {\n stdout += data.toString();\n });\n proc.on(\"error\", () => {\n clearTimeout(timer);\n resolve(undefined);\n });\n proc.on(\"close\", (code) => {\n clearTimeout(timer);\n resolve(code === 0 ? stdout.trim() : undefined);\n });\n });\n };\n\n const [extendedKeys, extendedKeysFormat] = await Promise.all([\n runTmuxShow(\"extended-keys\"),\n runTmuxShow(\"extended-keys-format\"),\n ]);\n\n // If we couldn't query tmux (timeout, sandbox, etc.), don't warn\n if (extendedKeys === undefined) return undefined;\n\n if (extendedKeys !== \"on\" && extendedKeys !== \"always\") {\n return \"tmux extended-keys is off. Modified enter keys may not work. Add `set -g extended-keys on` to ~/.tmux.conf and restart tmux.\";\n }\n\n if (extendedKeysFormat === \"xterm\") {\n return \"tmux extended-keys-format is xterm. Pi works best with csi-u. Add `set -g extended-keys-format csi-u` to ~/.tmux.conf and restart tmux.\";\n }\n\n return undefined;\n };\n\nInteractiveModeBase.prototype.getChangelogForDisplay = function(this: InteractiveModeBase): string | undefined {\n // Skip changelog for resumed/continued sessions (already have messages)\n if (this.session.state.messages.length > 0) {\n return undefined;\n }\n\n const lastVersion = this.settingsManager.getLastChangelogVersion();\n const changelogPath = getChangelogPath();\n const entries = parseChangelog(changelogPath);\n\n if (!lastVersion) {\n // Fresh install - record the version, send telemetry, don't show changelog\n this.settingsManager.setLastChangelogVersion(VERSION);\n this.reportInstallTelemetry(VERSION);\n return undefined;\n }\n\n const newEntries = getNewEntries(entries, lastVersion, VERSION);\n const currentEntries = getEntriesForVersion(newEntries, VERSION);\n if (currentEntries.length > 0) {\n this.settingsManager.setLastChangelogVersion(VERSION);\n this.reportInstallTelemetry(VERSION);\n return currentEntries.map((e) => normalizeChangelogLinks(e.content, e)).join(\"\\n\\n\");\n }\n\n return undefined;\n };\n\nInteractiveModeBase.prototype.reportInstallTelemetry = function(this: InteractiveModeBase, version: string): void {\n if (getEnvValue(ENV_OFFLINE)) {\n return;\n }\n\n if (!isInstallTelemetryEnabled(this.settingsManager)) {\n return;\n }\n\n void fetch(\n `https://pi.dev/api/report-install?version=${encodeURIComponent(version)}`,\n {\n headers: {\n \"User-Agent\": getPiUserAgent(version),\n },\n signal: AbortSignal.timeout(5000),\n },\n )\n .then(() => undefined)\n .catch(() => undefined);\n };\n\nInteractiveModeBase.prototype.getMarkdownThemeWithSettings = function(this: InteractiveModeBase): MarkdownTheme {\n return {\n ...getMarkdownTheme(),\n codeBlockIndent: this.settingsManager.getCodeBlockIndent(),\n };\n };\n\nInteractiveModeBase.prototype.formatDisplayPath = function(this: InteractiveModeBase, p: string): string {\n const home = os.homedir();\n let result = p;\n\n // Replace home directory with ~\n if (result.startsWith(home)) {\n result = `~${result.slice(home.length)}`;\n }\n\n return result;\n };\n\nInteractiveModeBase.prototype.formatExtensionDisplayPath = function(this: InteractiveModeBase, path: string): string {\n let result = this.formatDisplayPath(path);\n result = result.replace(/\\/index\\.ts$/, \"\").replace(/\\/index\\.js$/, \"\");\n return result;\n };\n\nInteractiveModeBase.prototype.formatContextPath = function(this: InteractiveModeBase, p: string): string {\n const cwd = path.resolve(this.sessionManager.getCwd());\n const absolutePath = path.isAbsolute(p)\n ? path.resolve(p)\n : path.resolve(cwd, p);\n const relativePath = getCwdRelativePath(absolutePath, cwd);\n if (relativePath !== undefined) {\n return relativePath;\n }\n\n return this.formatDisplayPath(absolutePath);\n };\n\nInteractiveModeBase.prototype.getStartupModelLabel = function(this: InteractiveModeBase): string {\n const model = this.session.state.model;\n let modelLabel = model?.id ?? \"no-model\";\n\n if (model?.reasoning) {\n modelLabel = `${modelLabel} ${this.session.thinkingLevel || \"off\"}`;\n }\n\n if (!model) {\n return modelLabel;\n }\n\n const fastModeEnabled = shouldApplyCodexFastMode(\n model,\n this.session.settingsManager.getCodexFastModeSettings(),\n this.session.orchestrationContext,\n );\n return formatCodexFastModeModelLabel(modelLabel, fastModeEnabled);\n };\n\nInteractiveModeBase.prototype.getStartupIdentityText = function(this: InteractiveModeBase): string {\n const appLabel = APP_NAME.length > 0\n ? `${APP_NAME[0]!.toUpperCase()}${APP_NAME.slice(1)}`\n : \"Atomic\";\n const title = `${theme.bold(theme.fg(\"text\", appLabel))} ${theme.fg(\"muted\", `v${this.version}`)}`;\n const model = this.session.state.model;\n const provider = model ? theme.fg(\"dim\", `(${model.provider})`) : theme.fg(\"dim\", \"(no-provider)\");\n const modelLine = `${provider} ${theme.fg(\"muted\", this.getStartupModelLabel())}`;\n const cwd = theme.fg(\"muted\", this.formatDisplayPath(this.sessionManager.getCwd()));\n const metaLines = [title, modelLine, cwd];\n const markLines = this.getAtomicAnsiMarkLines();\n\n return markLines\n .map((line, index) => `${line} ${metaLines[index] ?? \"\"}`.trimEnd())\n .join(\"\\n\");\n };\n\nInteractiveModeBase.prototype.getAtomicAnsiMarkLines = function(this: InteractiveModeBase): string[] {\n return renderAtomicAnsiBanner(theme, this.session.thinkingLevel || \"off\");\n };\n\nInteractiveModeBase.prototype.getStartupExpansionState = function(this: InteractiveModeBase): boolean {\n return this.options.verbose || this.toolOutputExpanded;\n };\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { InteractiveModeBase } from "./interactive-mode-base.js";
|
|
1
|
+
import { InteractiveModeBase, seedStartupInput } from "./interactive-mode-base.js";
|
|
2
2
|
import { os, path, Markdown, Spacer, Text, spawn, APP_NAME, APP_TITLE, ENV_OFFLINE, getEnvValue, getAgentDir, VERSION, formatCodexFastModeModelLabel, shouldApplyCodexFastMode, DefaultPackageManager, isInstallTelemetryEnabled, getChangelogPath, getEntriesForVersion, getNewEntries, normalizeChangelogLinks, parseChangelog, getCwdRelativePath, getPiUserAgent, recordTimeSinceReset, ensureTool, checkForNewPiVersion, renderAtomicAnsiBanner, DynamicBorder, getMarkdownTheme, onThemeChange, theme } from "./interactive-mode-deps.js";
|
|
3
3
|
import { ExpandableText } from "./interactive-mode-helpers.js";
|
|
4
4
|
import { ONBOARDING_COPY } from "./interactive-onboarding.js";
|
|
5
|
-
InteractiveModeBase.prototype.showStartupNoticesIfNeeded = function () {
|
|
5
|
+
InteractiveModeBase.prototype.showStartupNoticesIfNeeded = function (targetContainer = this.chatContainer) {
|
|
6
6
|
if (this.startupNoticesShown) {
|
|
7
7
|
return;
|
|
8
8
|
}
|
|
@@ -12,32 +12,32 @@ InteractiveModeBase.prototype.showStartupNoticesIfNeeded = function () {
|
|
|
12
12
|
return;
|
|
13
13
|
}
|
|
14
14
|
if (changelogMarkdown) {
|
|
15
|
-
if (
|
|
16
|
-
|
|
15
|
+
if (targetContainer.children.length > 0) {
|
|
16
|
+
targetContainer.addChild(new Spacer(1));
|
|
17
17
|
}
|
|
18
|
-
|
|
18
|
+
targetContainer.addChild(new DynamicBorder());
|
|
19
19
|
if (this.settingsManager.getCollapseChangelog()) {
|
|
20
20
|
const versionMatch = changelogMarkdown.match(/##\s+\[?((?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-(?:alpha\.)?(?:0|[1-9]\d*))?)\]?/);
|
|
21
21
|
const latestVersion = versionMatch ? versionMatch[1] : this.version;
|
|
22
22
|
const condensedText = `Updated to v${latestVersion}. Use ${theme.bold("/changelog")} to view full changelog.`;
|
|
23
|
-
|
|
23
|
+
targetContainer.addChild(new Text(condensedText, 1, 0));
|
|
24
24
|
}
|
|
25
25
|
else {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
targetContainer.addChild(new Text(theme.bold(theme.fg("accent", "What's New")), 1, 0));
|
|
27
|
+
targetContainer.addChild(new Spacer(1));
|
|
28
|
+
targetContainer.addChild(new Markdown(changelogMarkdown.trim(), 1, 0, this.getMarkdownThemeWithSettings()));
|
|
29
|
+
targetContainer.addChild(new Spacer(1));
|
|
30
30
|
}
|
|
31
|
-
|
|
31
|
+
targetContainer.addChild(new DynamicBorder());
|
|
32
32
|
}
|
|
33
33
|
if (this.firstRunNoticeVisible) {
|
|
34
34
|
this.firstRunOnboardingNoticeComponents = [];
|
|
35
|
-
if (
|
|
35
|
+
if (targetContainer.children.length > 0) {
|
|
36
36
|
this.firstRunOnboardingNoticeComponents.push(new Spacer(1));
|
|
37
37
|
}
|
|
38
38
|
this.firstRunOnboardingNoticeComponents.push(new DynamicBorder(), new Text(ONBOARDING_COPY, 1, 0), new DynamicBorder(), new Spacer(1));
|
|
39
39
|
for (const component of this.firstRunOnboardingNoticeComponents) {
|
|
40
|
-
|
|
40
|
+
targetContainer.addChild(component);
|
|
41
41
|
}
|
|
42
42
|
// Mark completion only after queueing the notice in the chat canvas so
|
|
43
43
|
// launches that skip rendering retry the first-run notice next time.
|
|
@@ -76,6 +76,11 @@ InteractiveModeBase.prototype.init = async function () {
|
|
|
76
76
|
this.setupKeyHandlers();
|
|
77
77
|
this.setupEditorSubmitHandler();
|
|
78
78
|
this.firstRunNoticeVisible = this.isFirstRunOnboardingEligible();
|
|
79
|
+
seedStartupInput(this.pendingUserInputs, this.defaultEditor, this.options.startupInputCapture?.consume(), this.startupReplayInputs, (text) => {
|
|
80
|
+
this.startupDraftText = text;
|
|
81
|
+
}, (text) => {
|
|
82
|
+
this.startupReplayActiveInput = text;
|
|
83
|
+
});
|
|
79
84
|
// Start the UI before initializing extensions so session_start handlers can use interactive dialogs.
|
|
80
85
|
// fd/rg readiness is intentionally checked after first paint because ensureTool may spawn
|
|
81
86
|
// or download tools on cold machines.
|
|
@@ -106,13 +111,27 @@ InteractiveModeBase.prototype.init = async function () {
|
|
|
106
111
|
const message = error instanceof Error ? error.message : String(error);
|
|
107
112
|
console.error(`Tool readiness check failed: ${message}`);
|
|
108
113
|
});
|
|
109
|
-
//
|
|
110
|
-
|
|
111
|
-
//
|
|
114
|
+
// When startup resources are deferred, keep the already-painted editor responsive.
|
|
115
|
+
// Extension UI bindings are installed at the deferred reload boundary, not here,
|
|
116
|
+
// so no post-paint resource work can block visible typing.
|
|
117
|
+
if (this.deferredStartupPending) {
|
|
118
|
+
this.applyRuntimeSettings();
|
|
119
|
+
this.subscribeToAgent();
|
|
120
|
+
this.updateEditorBorderColor();
|
|
121
|
+
this.updateTerminalTitle();
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
await this.rebindCurrentSession();
|
|
125
|
+
}
|
|
126
|
+
this.attachStartupNoticesContainer();
|
|
127
|
+
// Render initial messages AFTER the initial session binding is in place.
|
|
112
128
|
this.renderInitialMessages();
|
|
113
|
-
// Extensions were skipped before first paint; finish loading them in the background.
|
|
114
129
|
if (this.deferredStartupPending) {
|
|
115
|
-
|
|
130
|
+
setTimeout(() => {
|
|
131
|
+
if (!this.deferredStartupPending || this.deferredStartupPromise)
|
|
132
|
+
return;
|
|
133
|
+
void this.ensureDeferredStartupComplete();
|
|
134
|
+
}, 2000);
|
|
116
135
|
}
|
|
117
136
|
// Set up theme file watcher
|
|
118
137
|
onThemeChange(() => {
|
|
@@ -142,27 +161,28 @@ InteractiveModeBase.prototype.updateTerminalTitle = function () {
|
|
|
142
161
|
};
|
|
143
162
|
InteractiveModeBase.prototype.run = async function () {
|
|
144
163
|
await this.init();
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
+
setTimeout(() => {
|
|
165
|
+
void this.refreshCopilotModelCatalog();
|
|
166
|
+
const startupNoticesContainer = this.startupNoticesContainer;
|
|
167
|
+
checkForNewPiVersion(this.version).then((newVersion) => {
|
|
168
|
+
if (newVersion)
|
|
169
|
+
this.showNewVersionNotification(newVersion, startupNoticesContainer);
|
|
170
|
+
});
|
|
171
|
+
this.checkForPackageUpdates().then((updates) => {
|
|
172
|
+
if (updates.length > 0)
|
|
173
|
+
this.showPackageUpdateNotification(updates, startupNoticesContainer);
|
|
174
|
+
});
|
|
175
|
+
this.checkTmuxKeyboardSetup().then((warning) => {
|
|
176
|
+
if (warning)
|
|
177
|
+
this.showWarning(warning, startupNoticesContainer);
|
|
178
|
+
});
|
|
179
|
+
// When startup is deferred, the RESOURCES disclosure renders after the
|
|
180
|
+
// deferred extension load; hold the subscription warning until then so
|
|
181
|
+
// the disclosure always appears first.
|
|
182
|
+
if (!this.deferredStartupPending && !this.deferredStartupPromise && !this.pendingLoadedResourcesDisclosure) {
|
|
183
|
+
void this.maybeWarnAboutAnthropicSubscriptionAuth(undefined, startupNoticesContainer);
|
|
164
184
|
}
|
|
165
|
-
});
|
|
185
|
+
}, 500);
|
|
166
186
|
// Show startup warnings
|
|
167
187
|
const { migratedProviders, modelFallbackMessage, initialMessage, initialImages, initialMessages, } = this.options;
|
|
168
188
|
if (migratedProviders && migratedProviders.length > 0) {
|
|
@@ -172,15 +192,13 @@ InteractiveModeBase.prototype.run = async function () {
|
|
|
172
192
|
if (modelsJsonError) {
|
|
173
193
|
this.showError(`models.json error: ${modelsJsonError}`);
|
|
174
194
|
}
|
|
175
|
-
if (modelFallbackMessage && !this.
|
|
176
|
-
|
|
177
|
-
// providers register; completeDeferredStartup shows the warning if it still fails.
|
|
178
|
-
this.showWarning(modelFallbackMessage);
|
|
195
|
+
if (modelFallbackMessage && !this.deferredStartupPending) {
|
|
196
|
+
this.showWarning(modelFallbackMessage, this.startupNoticesContainer);
|
|
179
197
|
}
|
|
180
|
-
|
|
181
|
-
//
|
|
182
|
-
if (this.
|
|
183
|
-
await this.
|
|
198
|
+
// CLI-provided startup prompts need extension tools/resources; wait before sending them,
|
|
199
|
+
// but do not block the normal no-prompt input loop from becoming ready.
|
|
200
|
+
if (this.deferredStartupPending && (initialMessage || (initialMessages && initialMessages.length > 0))) {
|
|
201
|
+
await this.ensureDeferredStartupComplete();
|
|
184
202
|
}
|
|
185
203
|
// Process initial messages
|
|
186
204
|
if (initialMessage) {
|
|
@@ -206,13 +224,7 @@ InteractiveModeBase.prototype.run = async function () {
|
|
|
206
224
|
// Main interactive loop
|
|
207
225
|
while (true) {
|
|
208
226
|
const userInput = await this.getUserInput();
|
|
209
|
-
|
|
210
|
-
await this.session.prompt(userInput);
|
|
211
|
-
}
|
|
212
|
-
catch (error) {
|
|
213
|
-
const errorMessage = error instanceof Error ? error.message : "Unknown error occurred";
|
|
214
|
-
this.showError(errorMessage);
|
|
215
|
-
}
|
|
227
|
+
await this.runUserPromptTurn(userInput);
|
|
216
228
|
}
|
|
217
229
|
};
|
|
218
230
|
InteractiveModeBase.prototype.checkForPackageUpdates = async function () {
|