@bastani/atomic 0.9.5-alpha.5 → 0.9.5-alpha.7
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 +30 -0
- package/dist/builtin/cursor/package.json +2 -2
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/builtin/workflows/CHANGELOG.md +6 -0
- package/dist/builtin/workflows/package.json +1 -1
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-control.ts +8 -0
- package/dist/builtin/workflows/src/runs/foreground/stage-control-registry.ts +2 -0
- package/dist/builtin/workflows/src/runs/foreground/stage-tool-execution-buffer.ts +47 -0
- package/dist/builtin/workflows/src/tui/stage-chat-view-pending-tools.ts +9 -0
- package/dist/builtin/workflows/src/tui/stage-chat-view-render-settings.ts +27 -0
- package/dist/builtin/workflows/src/tui/stage-chat-view-state.ts +5 -6
- 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 +37 -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 +5 -4
- package/dist/core/agent-session-auto-compaction.d.ts.map +1 -1
- package/dist/core/agent-session-auto-compaction.js +15 -9
- package/dist/core/agent-session-auto-compaction.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 +1 -1
- package/dist/core/agent-session-methods.d.ts.map +1 -1
- package/dist/core/agent-session-methods.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/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/loader-core.d.ts.map +1 -1
- package/dist/core/extensions/loader-core.js +6 -0
- package/dist/core/extensions/loader-core.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/model-resolver-scope.d.ts +9 -0
- package/dist/core/model-resolver-scope.d.ts.map +1 -1
- package/dist/core/model-resolver-scope.js +12 -4
- package/dist/core/model-resolver-scope.js.map +1 -1
- package/dist/core/model-resolver.d.ts +3 -2
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +1 -1
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/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-extensions.d.ts.map +1 -1
- package/dist/core/resource-loader-extensions.js +4 -0
- package/dist/core/resource-loader-extensions.js.map +1 -1
- package/dist/core/resource-loader-reload.d.ts.map +1 -1
- package/dist/core/resource-loader-reload.js +54 -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.d.ts.map +1 -1
- package/dist/core/sdk.js +6 -4
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/settings-manager-core.d.ts.map +1 -1
- package/dist/core/settings-manager-core.js +3 -2
- package/dist/core/settings-manager-core.js.map +1 -1
- package/dist/core/settings-storage.d.ts.map +1 -1
- package/dist/core/settings-storage.js +2 -1
- package/dist/core/settings-storage.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/core/trust-manager.d.ts +9 -0
- package/dist/core/trust-manager.d.ts.map +1 -1
- package/dist/core/trust-manager.js +44 -2
- package/dist/core/trust-manager.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/main-deferred-startup.d.ts +21 -0
- package/dist/main-deferred-startup.d.ts.map +1 -0
- package/dist/main-deferred-startup.js +23 -0
- package/dist/main-deferred-startup.js.map +1 -0
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +28 -26
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/interactive-agent-events.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-agent-events.js +10 -1
- package/dist/modes/interactive/interactive-agent-events.js.map +1 -1
- package/dist/modes/interactive/interactive-deferred-startup.d.ts +8 -1
- package/dist/modes/interactive/interactive-deferred-startup.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-deferred-startup.js +58 -11
- 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 +48 -0
- package/dist/modes/interactive/interactive-input-handling.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-base.d.ts +5 -0
- package/dist/modes/interactive/interactive-mode-base.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-base.js +5 -0
- package/dist/modes/interactive/interactive-mode-base.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-deps.d.ts +2 -2
- package/dist/modes/interactive/interactive-mode-deps.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-deps.js +2 -2
- package/dist/modes/interactive/interactive-mode-deps.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-surface.d.ts +18 -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 +5 -1
- 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 +57 -0
- 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-routing.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-session-routing.js +2 -2
- package/dist/modes/interactive/interactive-session-routing.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 +59 -52
- 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/child-process.d.ts +8 -1
- package/dist/utils/child-process.d.ts.map +1 -1
- package/dist/utils/child-process.js +39 -6
- package/dist/utils/child-process.js.map +1 -1
- package/dist/utils/event-loop.d.ts +7 -0
- package/dist/utils/event-loop.d.ts.map +1 -0
- package/dist/utils/event-loop.js +14 -0
- package/dist/utils/event-loop.js.map +1 -0
- package/dist/utils/json.d.ts +4 -0
- package/dist/utils/json.d.ts.map +1 -1
- package/dist/utils/json.js +8 -0
- package/dist/utils/json.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 +3 -0
- package/docs/keybindings.md +2 -2
- package/docs/providers.md +1 -1
- package/docs/settings.md +5 -1
- package/docs/usage.md +1 -1
- package/docs/workflows.md +1 -1
- package/npm-shrinkwrap.json +23 -23
- package/package.json +4 -4
|
@@ -2,7 +2,7 @@ import { InteractiveModeBase } 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.
|
|
@@ -106,13 +106,27 @@ InteractiveModeBase.prototype.init = async function () {
|
|
|
106
106
|
const message = error instanceof Error ? error.message : String(error);
|
|
107
107
|
console.error(`Tool readiness check failed: ${message}`);
|
|
108
108
|
});
|
|
109
|
-
//
|
|
110
|
-
|
|
111
|
-
//
|
|
109
|
+
// When startup resources are deferred, keep the already-painted editor responsive.
|
|
110
|
+
// Extension UI bindings are installed at the deferred reload boundary, not here,
|
|
111
|
+
// so no post-paint resource work can block visible typing.
|
|
112
|
+
if (this.deferredStartupPending) {
|
|
113
|
+
this.applyRuntimeSettings();
|
|
114
|
+
this.subscribeToAgent();
|
|
115
|
+
this.updateEditorBorderColor();
|
|
116
|
+
this.updateTerminalTitle();
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
await this.rebindCurrentSession();
|
|
120
|
+
}
|
|
121
|
+
this.attachStartupNoticesContainer();
|
|
122
|
+
// Render initial messages AFTER the initial session binding is in place.
|
|
112
123
|
this.renderInitialMessages();
|
|
113
|
-
// Extensions were skipped before first paint; finish loading them in the background.
|
|
114
124
|
if (this.deferredStartupPending) {
|
|
115
|
-
|
|
125
|
+
setTimeout(() => {
|
|
126
|
+
if (!this.deferredStartupPending || this.deferredStartupPromise)
|
|
127
|
+
return;
|
|
128
|
+
void this.ensureDeferredStartupComplete();
|
|
129
|
+
}, 2000);
|
|
116
130
|
}
|
|
117
131
|
// Set up theme file watcher
|
|
118
132
|
onThemeChange(() => {
|
|
@@ -142,27 +156,28 @@ InteractiveModeBase.prototype.updateTerminalTitle = function () {
|
|
|
142
156
|
};
|
|
143
157
|
InteractiveModeBase.prototype.run = async function () {
|
|
144
158
|
await this.init();
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
159
|
+
setTimeout(() => {
|
|
160
|
+
void this.refreshCopilotModelCatalog();
|
|
161
|
+
const startupNoticesContainer = this.startupNoticesContainer;
|
|
162
|
+
checkForNewPiVersion(this.version).then((newVersion) => {
|
|
163
|
+
if (newVersion)
|
|
164
|
+
this.showNewVersionNotification(newVersion, startupNoticesContainer);
|
|
165
|
+
});
|
|
166
|
+
this.checkForPackageUpdates().then((updates) => {
|
|
167
|
+
if (updates.length > 0)
|
|
168
|
+
this.showPackageUpdateNotification(updates, startupNoticesContainer);
|
|
169
|
+
});
|
|
170
|
+
this.checkTmuxKeyboardSetup().then((warning) => {
|
|
171
|
+
if (warning)
|
|
172
|
+
this.showWarning(warning, startupNoticesContainer);
|
|
173
|
+
});
|
|
174
|
+
// When startup is deferred, the RESOURCES disclosure renders after the
|
|
175
|
+
// deferred extension load; hold the subscription warning until then so
|
|
176
|
+
// the disclosure always appears first.
|
|
177
|
+
if (!this.deferredStartupPending && !this.deferredStartupPromise && !this.pendingLoadedResourcesDisclosure) {
|
|
178
|
+
void this.maybeWarnAboutAnthropicSubscriptionAuth(undefined, startupNoticesContainer);
|
|
164
179
|
}
|
|
165
|
-
});
|
|
180
|
+
}, 500);
|
|
166
181
|
// Show startup warnings
|
|
167
182
|
const { migratedProviders, modelFallbackMessage, initialMessage, initialImages, initialMessages, } = this.options;
|
|
168
183
|
if (migratedProviders && migratedProviders.length > 0) {
|
|
@@ -172,15 +187,13 @@ InteractiveModeBase.prototype.run = async function () {
|
|
|
172
187
|
if (modelsJsonError) {
|
|
173
188
|
this.showError(`models.json error: ${modelsJsonError}`);
|
|
174
189
|
}
|
|
175
|
-
if (modelFallbackMessage && !this.
|
|
176
|
-
|
|
177
|
-
// providers register; completeDeferredStartup shows the warning if it still fails.
|
|
178
|
-
this.showWarning(modelFallbackMessage);
|
|
190
|
+
if (modelFallbackMessage && !this.deferredStartupPending) {
|
|
191
|
+
this.showWarning(modelFallbackMessage, this.startupNoticesContainer);
|
|
179
192
|
}
|
|
180
|
-
|
|
181
|
-
//
|
|
182
|
-
if (this.
|
|
183
|
-
await this.
|
|
193
|
+
// CLI-provided startup prompts need extension tools/resources; wait before sending them,
|
|
194
|
+
// but do not block the normal no-prompt input loop from becoming ready.
|
|
195
|
+
if (this.deferredStartupPending && (initialMessage || (initialMessages && initialMessages.length > 0))) {
|
|
196
|
+
await this.ensureDeferredStartupComplete();
|
|
184
197
|
}
|
|
185
198
|
// Process initial messages
|
|
186
199
|
if (initialMessage) {
|
|
@@ -206,13 +219,7 @@ InteractiveModeBase.prototype.run = async function () {
|
|
|
206
219
|
// Main interactive loop
|
|
207
220
|
while (true) {
|
|
208
221
|
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
|
-
}
|
|
222
|
+
await this.runUserPromptTurn(userInput);
|
|
216
223
|
}
|
|
217
224
|
};
|
|
218
225
|
InteractiveModeBase.prototype.checkForPackageUpdates = async function () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactive-startup.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-startup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAsB,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,6BAA6B,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,aAAa,EAAE,uBAAuB,EAAE,cAAc,EAAE,kBAAkB,EAAE,cAAc,EAAE,oBAAoB,EAAE,UAAU,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,aAAa,EAAE,gBAAgB,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACpiB,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAE9D,mBAAmB,CAAC,SAAS,CAAC,0BAA0B,GAAG;IACvD,IAAI,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAC7B,OAAO;IACT,CAAC;IACD,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC;IAEhC,MAAM,iBAAiB,GAAG,IAAI,CAAC,iBAAiB,CAAC;IACjD,IAAI,CAAC,iBAAiB,IAAI,CAAC,IAAI,CAAC,qBAAqB,EAAE,CAAC;QACtD,OAAO;IACT,CAAC;IAED,IAAI,iBAAiB,EAAE,CAAC;QAC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G,MAAM,SAAS,GAAG,GAAG,QAAQ,IAAI,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,oBAAoB,EAAE,CAAC,EAAE,CAAC;IAClF,MAAM,GAAG,GAAG,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IACpF,MAAM,SAAS,GAAG,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,CAAC,CAAC;IAC1C,MAAM,SAAS,GAAG,IAAI,CAAC,sBAAsB,EAAE,CAAC;IAEhD,OAAO,SAAS;SACb,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,GAAG,IAAI,KAAK,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,EAAE,CAAC;SACpE,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC,CAAC;AAEJ,mBAAmB,CAAC,SAAS,CAAC,sBAAsB,GAAG;IACnD,OAAO,sBAAsB,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,aAAa,IAAI,KAAK,CAAC,CAAC;AAC5E,CAAC,CAAC;AAEJ,mBAAmB,CAAC,SAAS,CAAC,wBAAwB,GAAG;IACrD,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,IAAI,IAAI,CAAC,kBAAkB,CAAC;AACzD,CAAC,CAAC","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.toolOutput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AK,CAAC;IACvC,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,IAAI,KAAK,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC;IACnG,MAAM,SAAS,GAAG,GAAG,QAAQ,IAAI,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,oBAAoB,EAAE,CAAC,EAAE,CAAC;IAClF,MAAM,GAAG,GAAG,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IACpF,MAAM,SAAS,GAAG,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,CAAC,CAAC;IAC1C,MAAM,SAAS,GAAG,IAAI,CAAC,sBAAsB,EAAE,CAAC;IAEhD,OAAO,SAAS;SACb,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,GAAG,IAAI,KAAK,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,EAAE,CAAC;SACpE,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC,CAAC;AAEJ,mBAAmB,CAAC,SAAS,CAAC,sBAAsB,GAAG;IACnD,OAAO,sBAAsB,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,aAAa,IAAI,KAAK,CAAC,CAAC;AAC5E,CAAC,CAAC;AAEJ,mBAAmB,CAAC,SAAS,CAAC,wBAAwB,GAAG;IACrD,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,IAAI,IAAI,CAAC,kBAAkB,CAAC;AACzD,CAAC,CAAC","sourcesContent":["import { InteractiveModeBase } 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 // 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"]}
|
|
@@ -10,6 +10,7 @@ export declare function getAvailableThemes(): string[];
|
|
|
10
10
|
export declare function getAvailableThemesWithPaths(): ThemeInfo[];
|
|
11
11
|
export declare function loadThemeJson(name: string): ThemeJson;
|
|
12
12
|
export declare function loadThemeFromPath(themePath: string, mode?: ColorMode): Theme;
|
|
13
|
+
export declare function loadThemeFromContent(themePath: string, content: string, mode?: ColorMode): Theme;
|
|
13
14
|
export declare function loadTheme(name: string, mode?: ColorMode): Theme;
|
|
14
15
|
export declare function getThemeByName(name: string): Theme | undefined;
|
|
15
16
|
export declare function setRegisteredThemes(themes: Theme[]): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-loading.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/theme/theme-loading.ts"],"names":[],"mappings":"AAGA,OAAO,EAAmB,KAAK,SAAS,EAAsB,MAAM,kBAAkB,CAAC;AAEvF,OAAO,EAAE,KAAK,EAAiC,MAAM,kBAAkB,CAAC;AACxE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBA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S,GAAG,KAAK,CAGhG;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,KAAK,CAO/D;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,CAM9D;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAQzD;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI,CAEnE","sourcesContent":["import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { getCustomThemesDir, getThemesDir } from \"../../../config.ts\";\nimport { detectColorMode, type ColorMode, resolveThemeColors } from \"./color-utils.ts\";\nimport { assertThemeNameIsValid, parseThemeJsonContent } from \"./theme-parse.ts\";\nimport { Theme, type ThemeBg, type ThemeColor } from \"./theme-class.ts\";\nimport type { ThemeJson } from \"./theme-schema.ts\";\n\nlet BUILTIN_THEMES: Record<string, ThemeJson> | undefined;\nconst registeredThemes = new Map<string, Theme>();\n\nexport interface ThemeInfo {\n\tname: string;\n\tpath: string | undefined;\n}\n\nexport function getBuiltinThemes(): Record<string, ThemeJson> {\n\tif (!BUILTIN_THEMES) {\n\t\tconst themesDir = getThemesDir();\n\t\tconst themes: Record<string, ThemeJson> = {};\n\t\tfor (const file of fs.readdirSync(themesDir).sort()) {\n\t\t\tif (!file.endsWith(\".json\") || file === \"theme-schema.json\") {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst themePath = path.join(themesDir, file);\n\t\t\tconst themeJson = parseThemeJsonContent(themePath, fs.readFileSync(themePath, \"utf-8\"));\n\t\t\tthemes[themeJson.name] = themeJson;\n\t\t}\n\t\tBUILTIN_THEMES = themes;\n\t}\n\treturn BUILTIN_THEMES;\n}\n\nexport function getAvailableThemes(): string[] {\n\treturn getAvailableThemesWithPaths().map(({ name }) => name);\n}\n\nexport function getAvailableThemesWithPaths(): ThemeInfo[] {\n\tconst themesDir = getThemesDir();\n\tconst result: ThemeInfo[] = [];\n\tconst seen = new Set<string>();\n\tconst addTheme = (info: ThemeInfo) => {\n\t\tif (seen.has(info.name)) return;\n\t\tseen.add(info.name);\n\t\tresult.push(info);\n\t};\n\n\t// Built-in themes\n\tfor (const name of Object.keys(getBuiltinThemes())) {\n\t\taddTheme({ name, path: path.join(themesDir, `${name}.json`) });\n\t}\n\n\t// Custom themes\n\tfor (const info of getCustomThemeInfos()) {\n\t\taddTheme(info);\n\t}\n\n\tfor (const [name, theme] of registeredThemes.entries()) {\n\t\taddTheme({ name, path: theme.sourcePath });\n\t}\n\n\treturn result.sort((a, b) => a.name.localeCompare(b.name));\n}\n\nfunction getCustomThemeInfos(): ThemeInfo[] {\n\tconst customThemesDir = getCustomThemesDir();\n\tconst result: ThemeInfo[] = [];\n\tif (!fs.existsSync(customThemesDir)) {\n\t\treturn result;\n\t}\n\n\tfor (const file of fs.readdirSync(customThemesDir)) {\n\t\tif (!file.endsWith(\".json\")) {\n\t\t\tcontinue;\n\t\t}\n\t\tconst themePath = path.join(customThemesDir, file);\n\t\ttry {\n\t\t\tconst customTheme = loadThemeFromPath(themePath);\n\t\t\tif (customTheme.name) {\n\t\t\t\tresult.push({ name: customTheme.name, path: themePath });\n\t\t\t}\n\t\t} catch {\n\t\t\t// Invalid themes are ignored here; the resource loader reports them\n\t\t\t// during normal startup/reload.\n\t\t}\n\t}\n\treturn result;\n}\n\nexport function loadThemeJson(name: string): ThemeJson {\n\tconst builtinThemes = getBuiltinThemes();\n\tif (name in builtinThemes) {\n\t\treturn builtinThemes[name];\n\t}\n\tconst registeredTheme = registeredThemes.get(name);\n\tif (registeredTheme?.sourcePath) {\n\t\tconst content = fs.readFileSync(registeredTheme.sourcePath, \"utf-8\");\n\t\treturn parseThemeJsonContent(registeredTheme.sourcePath, content);\n\t}\n\tif (registeredTheme) {\n\t\tthrow new Error(`Theme \"${name}\" does not have a source path for export`);\n\t}\n\tconst customThemesDir = getCustomThemesDir();\n\tconst themePath = path.join(customThemesDir, `${name}.json`);\n\tif (!fs.existsSync(themePath)) {\n\t\tthrow new Error(`Theme not found: ${name}`);\n\t}\n\tconst content = fs.readFileSync(themePath, \"utf-8\");\n\treturn parseThemeJsonContent(name, content);\n}\n\nfunction createTheme(themeJson: ThemeJson, mode?: ColorMode, sourcePath?: string): Theme {\n\tconst colorMode = mode ?? detectColorMode();\n\tconst resolvedColors = resolveThemeColors(themeJson.colors, themeJson.vars);\n\tconst fgColors: Record<ThemeColor, string | number> = {} as Record<ThemeColor, string | number>;\n\tconst bgColors: Record<ThemeBg, string | number> = {} as Record<ThemeBg, string | number>;\n\tconst bgColorKeys: Set<string> = new Set([\n\t\t\"selectedBg\",\n\t\t\"userMessageBg\",\n\t\t\"customMessageBg\",\n\t\t\"toolPendingBg\",\n\t\t\"toolSuccessBg\",\n\t\t\"toolErrorBg\",\n\t]);\n\tfor (const [key, value] of Object.entries(resolvedColors)) {\n\t\tif (bgColorKeys.has(key)) {\n\t\t\tbgColors[key as ThemeBg] = value;\n\t\t} else {\n\t\t\tfgColors[key as ThemeColor] = value;\n\t\t}\n\t}\n\treturn new Theme(fgColors, bgColors, colorMode, {\n\t\tname: themeJson.name,\n\t\tsourcePath,\n\t});\n}\n\nexport function loadThemeFromPath(themePath: string, mode?: ColorMode): Theme {\n\tconst content = fs.readFileSync(themePath, \"utf-8\");\n\treturn loadThemeFromContent(themePath, content, mode);\n}\n\nexport function loadThemeFromContent(themePath: string, content: string, mode?: ColorMode): Theme {\n\tconst themeJson = parseThemeJsonContent(themePath, content);\n\treturn createTheme(themeJson, mode, themePath);\n}\n\nexport function loadTheme(name: string, mode?: ColorMode): Theme {\n\tconst registeredTheme = registeredThemes.get(name);\n\tif (registeredTheme) {\n\t\treturn registeredTheme;\n\t}\n\tconst themeJson = loadThemeJson(name);\n\treturn createTheme(themeJson, mode);\n}\n\nexport function getThemeByName(name: string): Theme | undefined {\n\ttry {\n\t\treturn loadTheme(name);\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\nexport function setRegisteredThemes(themes: Theme[]): void {\n\tregisteredThemes.clear();\n\tfor (const theme of themes) {\n\t\tif (theme.name) {\n\t\t\tassertThemeNameIsValid(theme.name);\n\t\t\tregisteredThemes.set(theme.name, theme);\n\t\t}\n\t}\n}\n\nexport function setRegisteredTheme(name: string, theme: Theme): void {\n\tregisteredThemes.set(name, theme);\n}\n"]}
|
|
@@ -121,6 +121,9 @@ function createTheme(themeJson, mode, sourcePath) {
|
|
|
121
121
|
}
|
|
122
122
|
export function loadThemeFromPath(themePath, mode) {
|
|
123
123
|
const content = fs.readFileSync(themePath, "utf-8");
|
|
124
|
+
return loadThemeFromContent(themePath, content, mode);
|
|
125
|
+
}
|
|
126
|
+
export function loadThemeFromContent(themePath, content, mode) {
|
|
124
127
|
const themeJson = parseThemeJsonContent(themePath, content);
|
|
125
128
|
return createTheme(themeJson, mode, themePath);
|
|
126
129
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-loading.js","sourceRoot":"","sources":["../../../../src/modes/interactive/theme/theme-loading.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,eAAe,EAAkB,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACvF,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACjF,OAAO,EAAE,KAAK,EAAiC,MAAM,kBAAkB,CAAC;AAGxE,IAAI,cAAqD,CAAC;AAC1D,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAiB,CAAC;AAOlD,MAAM,UAAU,gBAAgB;IAC/B,IAAI,CAAC,cAAc,EAAE,CAAC;QACrB,MAAM,SAAS,GAAG,YAAY,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D,IAAI,eAAe,EAAE,CAAC;QACrB,OAAO,eAAe,CAAC;IACxB,CAAC;IACD,MAAM,SAAS,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;IACtC,OAAO,WAAW,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AACrC,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,IAAY;IAC1C,IAAI,CAAC;QACJ,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,SAAS,CAAC;IAClB,CAAC;AACF,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,MAAe;IAClD,gBAAgB,CAAC,KAAK,EAAE,CAAC;IACzB,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC5B,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC;YAChB,sBAAsB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACnC,gBAAgB,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACzC,CAAC;IACF,CAAC;AACF,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,IAAY,EAAE,KAAY;IAC5D,gBAAgB,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AACnC,CAAC","sourcesContent":["import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { getCustomThemesDir, getThemesDir } from \"../../../config.ts\";\nimport { detectColorMode, type ColorMode, resolveThemeColors } from \"./color-utils.ts\";\nimport { assertThemeNameIsValid, parseThemeJsonContent } from \"./theme-parse.ts\";\nimport { Theme, type ThemeBg, type ThemeColor } from \"./theme-class.ts\";\nimport type { ThemeJson } from \"./theme-schema.ts\";\n\nlet BUILTIN_THEMES: Record<string, ThemeJson> | undefined;\nconst registeredThemes = new Map<string, Theme>();\n\nexport interface ThemeInfo {\n\tname: string;\n\tpath: string | undefined;\n}\n\nexport function getBuiltinThemes(): Record<string, ThemeJson> {\n\tif (!BUILTIN_THEMES) {\n\t\tconst themesDir = getThemesDir();\n\t\tconst themes: Record<string, ThemeJson> = {};\n\t\tfor (const file of fs.readdirSync(themesDir).sort()) {\n\t\t\tif (!file.endsWith(\".json\") || file === \"theme-schema.json\") {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst themePath = path.join(themesDir, file);\n\t\t\tconst themeJson = parseThemeJsonContent(themePath, fs.readFileSync(themePath, \"utf-8\"));\n\t\t\tthemes[themeJson.name] = themeJson;\n\t\t}\n\t\tBUILTIN_THEMES = themes;\n\t}\n\treturn BUILTIN_THEMES;\n}\n\nexport function getAvailableThemes(): string[] {\n\treturn getAvailableThemesWithPaths().map(({ name }) => name);\n}\n\nexport function getAvailableThemesWithPaths(): ThemeInfo[] {\n\tconst themesDir = getThemesDir();\n\tconst result: ThemeInfo[] = [];\n\tconst seen = new Set<string>();\n\tconst addTheme = (info: ThemeInfo) => {\n\t\tif (seen.has(info.name)) return;\n\t\tseen.add(info.name);\n\t\tresult.push(info);\n\t};\n\n\t// Built-in themes\n\tfor (const name of Object.keys(getBuiltinThemes())) {\n\t\taddTheme({ name, path: path.join(themesDir, `${name}.json`) });\n\t}\n\n\t// Custom themes\n\tfor (const info of getCustomThemeInfos()) {\n\t\taddTheme(info);\n\t}\n\n\tfor (const [name, theme] of registeredThemes.entries()) {\n\t\taddTheme({ name, path: theme.sourcePath });\n\t}\n\n\treturn result.sort((a, b) => a.name.localeCompare(b.name));\n}\n\nfunction getCustomThemeInfos(): ThemeInfo[] {\n\tconst customThemesDir = getCustomThemesDir();\n\tconst result: ThemeInfo[] = [];\n\tif (!fs.existsSync(customThemesDir)) {\n\t\treturn result;\n\t}\n\n\tfor (const file of fs.readdirSync(customThemesDir)) {\n\t\tif (!file.endsWith(\".json\")) {\n\t\t\tcontinue;\n\t\t}\n\t\tconst themePath = path.join(customThemesDir, file);\n\t\ttry {\n\t\t\tconst customTheme = loadThemeFromPath(themePath);\n\t\t\tif (customTheme.name) {\n\t\t\t\tresult.push({ name: customTheme.name, path: themePath });\n\t\t\t}\n\t\t} catch {\n\t\t\t// Invalid themes are ignored here; the resource loader reports them\n\t\t\t// during normal startup/reload.\n\t\t}\n\t}\n\treturn result;\n}\n\nexport function loadThemeJson(name: string): ThemeJson {\n\tconst builtinThemes = getBuiltinThemes();\n\tif (name in builtinThemes) {\n\t\treturn builtinThemes[name];\n\t}\n\tconst registeredTheme = registeredThemes.get(name);\n\tif (registeredTheme?.sourcePath) {\n\t\tconst content = fs.readFileSync(registeredTheme.sourcePath, \"utf-8\");\n\t\treturn parseThemeJsonContent(registeredTheme.sourcePath, content);\n\t}\n\tif (registeredTheme) {\n\t\tthrow new Error(`Theme \"${name}\" does not have a source path for export`);\n\t}\n\tconst customThemesDir = getCustomThemesDir();\n\tconst themePath = path.join(customThemesDir, `${name}.json`);\n\tif (!fs.existsSync(themePath)) {\n\t\tthrow new Error(`Theme not found: ${name}`);\n\t}\n\tconst content = fs.readFileSync(themePath, \"utf-8\");\n\treturn parseThemeJsonContent(name, content);\n}\n\nfunction createTheme(themeJson: ThemeJson, mode?: ColorMode, sourcePath?: string): Theme {\n\tconst colorMode = mode ?? detectColorMode();\n\tconst resolvedColors = resolveThemeColors(themeJson.colors, themeJson.vars);\n\tconst fgColors: Record<ThemeColor, string | number> = {} as Record<ThemeColor, string | number>;\n\tconst bgColors: Record<ThemeBg, string | number> = {} as Record<ThemeBg, string | number>;\n\tconst bgColorKeys: Set<string> = new Set([\n\t\t\"selectedBg\",\n\t\t\"userMessageBg\",\n\t\t\"customMessageBg\",\n\t\t\"toolPendingBg\",\n\t\t\"toolSuccessBg\",\n\t\t\"toolErrorBg\",\n\t]);\n\tfor (const [key, value] of Object.entries(resolvedColors)) {\n\t\tif (bgColorKeys.has(key)) {\n\t\t\tbgColors[key as ThemeBg] = value;\n\t\t} else {\n\t\t\tfgColors[key as ThemeColor] = value;\n\t\t}\n\t}\n\treturn new Theme(fgColors, bgColors, colorMode, {\n\t\tname: themeJson.name,\n\t\tsourcePath,\n\t});\n}\n\nexport function loadThemeFromPath(themePath: string, mode?: ColorMode): Theme {\n\tconst content = fs.readFileSync(themePath, \"utf-8\");\n\tconst themeJson = parseThemeJsonContent(themePath, content);\n\treturn createTheme(themeJson, mode, themePath);\n}\n\nexport function loadTheme(name: string, mode?: ColorMode): Theme {\n\tconst registeredTheme = registeredThemes.get(name);\n\tif (registeredTheme) {\n\t\treturn registeredTheme;\n\t}\n\tconst themeJson = loadThemeJson(name);\n\treturn createTheme(themeJson, mode);\n}\n\nexport function getThemeByName(name: string): Theme | undefined {\n\ttry {\n\t\treturn loadTheme(name);\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\nexport function setRegisteredThemes(themes: Theme[]): void {\n\tregisteredThemes.clear();\n\tfor (const theme of themes) {\n\t\tif (theme.name) {\n\t\t\tassertThemeNameIsValid(theme.name);\n\t\t\tregisteredThemes.set(theme.name, theme);\n\t\t}\n\t}\n}\n\nexport function setRegisteredTheme(name: string, theme: Theme): void {\n\tregisteredThemes.set(name, theme);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"theme-loading.js","sourceRoot":"","sources":["../../../../src/modes/interactive/theme/theme-loading.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,eAAe,EAAkB,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACvF,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACjF,OAAO,EAAE,KAAK,EAAiC,MAAM,kBAAkB,CAAC;AAGxE,IAAI,cAAqD,CAAC;AAC1D,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAiB,CAAC;AAOlD,MAAM,UAAU,gBAAgB;IAC/B,IAAI,CAAC,cAAc,EAAE,CAAC;QACrB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,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;AAChD,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,IAAY,EAAE,IAAgB;IACvD,MAAM,eAAe,GAAG,gBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACnD,IAAI,eAAe,EAAE,CAAC;QACrB,OAAO,eAAe,CAAC;IACxB,CAAC;IACD,MAAM,SAAS,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;IACtC,OAAO,WAAW,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AACrC,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,IAAY;IAC1C,IAAI,CAAC;QACJ,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,SAAS,CAAC;IAClB,CAAC;AACF,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,MAAe;IAClD,gBAAgB,CAAC,KAAK,EAAE,CAAC;IACzB,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC5B,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC;YAChB,sBAAsB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACnC,gBAAgB,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACzC,CAAC;IACF,CAAC;AACF,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,IAAY,EAAE,KAAY;IAC5D,gBAAgB,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AACnC,CAAC","sourcesContent":["import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { getCustomThemesDir, getThemesDir } from \"../../../config.ts\";\nimport { detectColorMode, type ColorMode, resolveThemeColors } from \"./color-utils.ts\";\nimport { assertThemeNameIsValid, parseThemeJsonContent } from \"./theme-parse.ts\";\nimport { Theme, type ThemeBg, type ThemeColor } from \"./theme-class.ts\";\nimport type { ThemeJson } from \"./theme-schema.ts\";\n\nlet BUILTIN_THEMES: Record<string, ThemeJson> | undefined;\nconst registeredThemes = new Map<string, Theme>();\n\nexport interface ThemeInfo {\n\tname: string;\n\tpath: string | undefined;\n}\n\nexport function getBuiltinThemes(): Record<string, ThemeJson> {\n\tif (!BUILTIN_THEMES) {\n\t\tconst themesDir = getThemesDir();\n\t\tconst themes: Record<string, ThemeJson> = {};\n\t\tfor (const file of fs.readdirSync(themesDir).sort()) {\n\t\t\tif (!file.endsWith(\".json\") || file === \"theme-schema.json\") {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst themePath = path.join(themesDir, file);\n\t\t\tconst themeJson = parseThemeJsonContent(themePath, fs.readFileSync(themePath, \"utf-8\"));\n\t\t\tthemes[themeJson.name] = themeJson;\n\t\t}\n\t\tBUILTIN_THEMES = themes;\n\t}\n\treturn BUILTIN_THEMES;\n}\n\nexport function getAvailableThemes(): string[] {\n\treturn getAvailableThemesWithPaths().map(({ name }) => name);\n}\n\nexport function getAvailableThemesWithPaths(): ThemeInfo[] {\n\tconst themesDir = getThemesDir();\n\tconst result: ThemeInfo[] = [];\n\tconst seen = new Set<string>();\n\tconst addTheme = (info: ThemeInfo) => {\n\t\tif (seen.has(info.name)) return;\n\t\tseen.add(info.name);\n\t\tresult.push(info);\n\t};\n\n\t// Built-in themes\n\tfor (const name of Object.keys(getBuiltinThemes())) {\n\t\taddTheme({ name, path: path.join(themesDir, `${name}.json`) });\n\t}\n\n\t// Custom themes\n\tfor (const info of getCustomThemeInfos()) {\n\t\taddTheme(info);\n\t}\n\n\tfor (const [name, theme] of registeredThemes.entries()) {\n\t\taddTheme({ name, path: theme.sourcePath });\n\t}\n\n\treturn result.sort((a, b) => a.name.localeCompare(b.name));\n}\n\nfunction getCustomThemeInfos(): ThemeInfo[] {\n\tconst customThemesDir = getCustomThemesDir();\n\tconst result: ThemeInfo[] = [];\n\tif (!fs.existsSync(customThemesDir)) {\n\t\treturn result;\n\t}\n\n\tfor (const file of fs.readdirSync(customThemesDir)) {\n\t\tif (!file.endsWith(\".json\")) {\n\t\t\tcontinue;\n\t\t}\n\t\tconst themePath = path.join(customThemesDir, file);\n\t\ttry {\n\t\t\tconst customTheme = loadThemeFromPath(themePath);\n\t\t\tif (customTheme.name) {\n\t\t\t\tresult.push({ name: customTheme.name, path: themePath });\n\t\t\t}\n\t\t} catch {\n\t\t\t// Invalid themes are ignored here; the resource loader reports them\n\t\t\t// during normal startup/reload.\n\t\t}\n\t}\n\treturn result;\n}\n\nexport function loadThemeJson(name: string): ThemeJson {\n\tconst builtinThemes = getBuiltinThemes();\n\tif (name in builtinThemes) {\n\t\treturn builtinThemes[name];\n\t}\n\tconst registeredTheme = registeredThemes.get(name);\n\tif (registeredTheme?.sourcePath) {\n\t\tconst content = fs.readFileSync(registeredTheme.sourcePath, \"utf-8\");\n\t\treturn parseThemeJsonContent(registeredTheme.sourcePath, content);\n\t}\n\tif (registeredTheme) {\n\t\tthrow new Error(`Theme \"${name}\" does not have a source path for export`);\n\t}\n\tconst customThemesDir = getCustomThemesDir();\n\tconst themePath = path.join(customThemesDir, `${name}.json`);\n\tif (!fs.existsSync(themePath)) {\n\t\tthrow new Error(`Theme not found: ${name}`);\n\t}\n\tconst content = fs.readFileSync(themePath, \"utf-8\");\n\treturn parseThemeJsonContent(name, content);\n}\n\nfunction createTheme(themeJson: ThemeJson, mode?: ColorMode, sourcePath?: string): Theme {\n\tconst colorMode = mode ?? detectColorMode();\n\tconst resolvedColors = resolveThemeColors(themeJson.colors, themeJson.vars);\n\tconst fgColors: Record<ThemeColor, string | number> = {} as Record<ThemeColor, string | number>;\n\tconst bgColors: Record<ThemeBg, string | number> = {} as Record<ThemeBg, string | number>;\n\tconst bgColorKeys: Set<string> = new Set([\n\t\t\"selectedBg\",\n\t\t\"userMessageBg\",\n\t\t\"customMessageBg\",\n\t\t\"toolPendingBg\",\n\t\t\"toolSuccessBg\",\n\t\t\"toolErrorBg\",\n\t]);\n\tfor (const [key, value] of Object.entries(resolvedColors)) {\n\t\tif (bgColorKeys.has(key)) {\n\t\t\tbgColors[key as ThemeBg] = value;\n\t\t} else {\n\t\t\tfgColors[key as ThemeColor] = value;\n\t\t}\n\t}\n\treturn new Theme(fgColors, bgColors, colorMode, {\n\t\tname: themeJson.name,\n\t\tsourcePath,\n\t});\n}\n\nexport function loadThemeFromPath(themePath: string, mode?: ColorMode): Theme {\n\tconst content = fs.readFileSync(themePath, \"utf-8\");\n\treturn loadThemeFromContent(themePath, content, mode);\n}\n\nexport function loadThemeFromContent(themePath: string, content: string, mode?: ColorMode): Theme {\n\tconst themeJson = parseThemeJsonContent(themePath, content);\n\treturn createTheme(themeJson, mode, themePath);\n}\n\nexport function loadTheme(name: string, mode?: ColorMode): Theme {\n\tconst registeredTheme = registeredThemes.get(name);\n\tif (registeredTheme) {\n\t\treturn registeredTheme;\n\t}\n\tconst themeJson = loadThemeJson(name);\n\treturn createTheme(themeJson, mode);\n}\n\nexport function getThemeByName(name: string): Theme | undefined {\n\ttry {\n\t\treturn loadTheme(name);\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\nexport function setRegisteredThemes(themes: Theme[]): void {\n\tregisteredThemes.clear();\n\tfor (const theme of themes) {\n\t\tif (theme.name) {\n\t\t\tassertThemeNameIsValid(theme.name);\n\t\t\tregisteredThemes.set(theme.name, theme);\n\t\t}\n\t}\n}\n\nexport function setRegisteredTheme(name: string, theme: Theme): void {\n\tregisteredThemes.set(name, theme);\n}\n"]}
|
|
@@ -2,6 +2,6 @@ export { getThemeExportColors, getResolvedThemeColors, isLightTheme } from "./ex
|
|
|
2
2
|
export { initTheme, onThemeChange, setTheme, setThemeInstance, stopThemeWatcher, theme, } from "./global-theme.ts";
|
|
3
3
|
export { detectTerminalBackgroundFromEnv, detectTerminalBackgroundTheme, getDefaultTheme, getThemeForRgbColor, parseAutoThemeSetting, resolveThemeSetting, type TerminalBackgroundThemeDetectionOptions, type TerminalBackgroundThemeDetector, type TerminalTheme, type TerminalThemeDetection, type TerminalThemeDetectionOptions, } from "./terminal-detection.ts";
|
|
4
4
|
export { Theme, type ThemeBg, type ThemeColor } from "./theme-class.ts";
|
|
5
|
-
export { getAvailableThemes, getAvailableThemesWithPaths, getThemeByName, loadThemeFromPath, setRegisteredThemes, type ThemeInfo, } from "./theme-loading.ts";
|
|
5
|
+
export { getAvailableThemes, getAvailableThemesWithPaths, getThemeByName, loadThemeFromPath, loadThemeFromContent, setRegisteredThemes, type ThemeInfo, } from "./theme-loading.ts";
|
|
6
6
|
export { getEditorTheme, getLanguageFromPath, getMarkdownTheme, getSelectListTheme, getSettingsListTheme, highlightCode, } from "./tui-theme.ts";
|
|
7
7
|
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/theme/theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAChG,OAAO,EACN,SAAS,EACT,aAAa,EACb,QAAQ,EACR,gBAAgB,EAChB,gBAAgB,EAChB,KAAK,GACL,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACN,+BAA+B,EAC/B,6BAA6B,EAC7B,eAAe,EACf,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,KAAK,uCAAuC,EAC5C,KAAK,+BAA+B,EACpC,KAAK,aAAa,EAClB,KAAK,sBAAsB,EAC3B,KAAK,6BAA6B,GAClC,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,KAAK,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EACN,kBAAkB,EAClB,2BAA2B,EAC3B,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,KAAK,SAAS,GACd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,aAAa,GACb,MAAM,gBAAgB,CAAC","sourcesContent":["export { getThemeExportColors, getResolvedThemeColors, isLightTheme } from \"./export-colors.ts\";\nexport {\n\tinitTheme,\n\tonThemeChange,\n\tsetTheme,\n\tsetThemeInstance,\n\tstopThemeWatcher,\n\ttheme,\n} from \"./global-theme.ts\";\nexport {\n\tdetectTerminalBackgroundFromEnv,\n\tdetectTerminalBackgroundTheme,\n\tgetDefaultTheme,\n\tgetThemeForRgbColor,\n\tparseAutoThemeSetting,\n\tresolveThemeSetting,\n\ttype TerminalBackgroundThemeDetectionOptions,\n\ttype TerminalBackgroundThemeDetector,\n\ttype TerminalTheme,\n\ttype TerminalThemeDetection,\n\ttype TerminalThemeDetectionOptions,\n} from \"./terminal-detection.ts\";\nexport { Theme, type ThemeBg, type ThemeColor } from \"./theme-class.ts\";\nexport {\n\tgetAvailableThemes,\n\tgetAvailableThemesWithPaths,\n\tgetThemeByName,\n\tloadThemeFromPath,\n\tsetRegisteredThemes,\n\ttype ThemeInfo,\n} from \"./theme-loading.ts\";\nexport {\n\tgetEditorTheme,\n\tgetLanguageFromPath,\n\tgetMarkdownTheme,\n\tgetSelectListTheme,\n\tgetSettingsListTheme,\n\thighlightCode,\n} from \"./tui-theme.ts\";\n"]}
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/theme/theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAChG,OAAO,EACN,SAAS,EACT,aAAa,EACb,QAAQ,EACR,gBAAgB,EAChB,gBAAgB,EAChB,KAAK,GACL,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACN,+BAA+B,EAC/B,6BAA6B,EAC7B,eAAe,EACf,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,KAAK,uCAAuC,EAC5C,KAAK,+BAA+B,EACpC,KAAK,aAAa,EAClB,KAAK,sBAAsB,EAC3B,KAAK,6BAA6B,GAClC,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,KAAK,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EACN,kBAAkB,EAClB,2BAA2B,EAC3B,cAAc,EACd,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,EACnB,KAAK,SAAS,GACd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,aAAa,GACb,MAAM,gBAAgB,CAAC","sourcesContent":["export { getThemeExportColors, getResolvedThemeColors, isLightTheme } from \"./export-colors.ts\";\nexport {\n\tinitTheme,\n\tonThemeChange,\n\tsetTheme,\n\tsetThemeInstance,\n\tstopThemeWatcher,\n\ttheme,\n} from \"./global-theme.ts\";\nexport {\n\tdetectTerminalBackgroundFromEnv,\n\tdetectTerminalBackgroundTheme,\n\tgetDefaultTheme,\n\tgetThemeForRgbColor,\n\tparseAutoThemeSetting,\n\tresolveThemeSetting,\n\ttype TerminalBackgroundThemeDetectionOptions,\n\ttype TerminalBackgroundThemeDetector,\n\ttype TerminalTheme,\n\ttype TerminalThemeDetection,\n\ttype TerminalThemeDetectionOptions,\n} from \"./terminal-detection.ts\";\nexport { Theme, type ThemeBg, type ThemeColor } from \"./theme-class.ts\";\nexport {\n\tgetAvailableThemes,\n\tgetAvailableThemesWithPaths,\n\tgetThemeByName,\n\tloadThemeFromPath,\n\tloadThemeFromContent,\n\tsetRegisteredThemes,\n\ttype ThemeInfo,\n} from \"./theme-loading.ts\";\nexport {\n\tgetEditorTheme,\n\tgetLanguageFromPath,\n\tgetMarkdownTheme,\n\tgetSelectListTheme,\n\tgetSettingsListTheme,\n\thighlightCode,\n} from \"./tui-theme.ts\";\n"]}
|
|
@@ -2,6 +2,6 @@ export { getThemeExportColors, getResolvedThemeColors, isLightTheme } from "./ex
|
|
|
2
2
|
export { initTheme, onThemeChange, setTheme, setThemeInstance, stopThemeWatcher, theme, } from "./global-theme.js";
|
|
3
3
|
export { detectTerminalBackgroundFromEnv, detectTerminalBackgroundTheme, getDefaultTheme, getThemeForRgbColor, parseAutoThemeSetting, resolveThemeSetting, } from "./terminal-detection.js";
|
|
4
4
|
export { Theme } from "./theme-class.js";
|
|
5
|
-
export { getAvailableThemes, getAvailableThemesWithPaths, getThemeByName, loadThemeFromPath, setRegisteredThemes, } from "./theme-loading.js";
|
|
5
|
+
export { getAvailableThemes, getAvailableThemesWithPaths, getThemeByName, loadThemeFromPath, loadThemeFromContent, setRegisteredThemes, } from "./theme-loading.js";
|
|
6
6
|
export { getEditorTheme, getLanguageFromPath, getMarkdownTheme, getSelectListTheme, getSettingsListTheme, highlightCode, } from "./tui-theme.js";
|
|
7
7
|
//# sourceMappingURL=theme.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.js","sourceRoot":"","sources":["../../../../src/modes/interactive/theme/theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAChG,OAAO,EACN,SAAS,EACT,aAAa,EACb,QAAQ,EACR,gBAAgB,EAChB,gBAAgB,EAChB,KAAK,GACL,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACN,+BAA+B,EAC/B,6BAA6B,EAC7B,eAAe,EACf,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,GAMnB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,KAAK,EAAiC,MAAM,kBAAkB,CAAC;AACxE,OAAO,EACN,kBAAkB,EAClB,2BAA2B,EAC3B,cAAc,EACd,iBAAiB,EACjB,mBAAmB,GAEnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,aAAa,GACb,MAAM,gBAAgB,CAAC","sourcesContent":["export { getThemeExportColors, getResolvedThemeColors, isLightTheme } from \"./export-colors.ts\";\nexport {\n\tinitTheme,\n\tonThemeChange,\n\tsetTheme,\n\tsetThemeInstance,\n\tstopThemeWatcher,\n\ttheme,\n} from \"./global-theme.ts\";\nexport {\n\tdetectTerminalBackgroundFromEnv,\n\tdetectTerminalBackgroundTheme,\n\tgetDefaultTheme,\n\tgetThemeForRgbColor,\n\tparseAutoThemeSetting,\n\tresolveThemeSetting,\n\ttype TerminalBackgroundThemeDetectionOptions,\n\ttype TerminalBackgroundThemeDetector,\n\ttype TerminalTheme,\n\ttype TerminalThemeDetection,\n\ttype TerminalThemeDetectionOptions,\n} from \"./terminal-detection.ts\";\nexport { Theme, type ThemeBg, type ThemeColor } from \"./theme-class.ts\";\nexport {\n\tgetAvailableThemes,\n\tgetAvailableThemesWithPaths,\n\tgetThemeByName,\n\tloadThemeFromPath,\n\tsetRegisteredThemes,\n\ttype ThemeInfo,\n} from \"./theme-loading.ts\";\nexport {\n\tgetEditorTheme,\n\tgetLanguageFromPath,\n\tgetMarkdownTheme,\n\tgetSelectListTheme,\n\tgetSettingsListTheme,\n\thighlightCode,\n} from \"./tui-theme.ts\";\n"]}
|
|
1
|
+
{"version":3,"file":"theme.js","sourceRoot":"","sources":["../../../../src/modes/interactive/theme/theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAChG,OAAO,EACN,SAAS,EACT,aAAa,EACb,QAAQ,EACR,gBAAgB,EAChB,gBAAgB,EAChB,KAAK,GACL,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACN,+BAA+B,EAC/B,6BAA6B,EAC7B,eAAe,EACf,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,GAMnB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,KAAK,EAAiC,MAAM,kBAAkB,CAAC;AACxE,OAAO,EACN,kBAAkB,EAClB,2BAA2B,EAC3B,cAAc,EACd,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,GAEnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,aAAa,GACb,MAAM,gBAAgB,CAAC","sourcesContent":["export { getThemeExportColors, getResolvedThemeColors, isLightTheme } from \"./export-colors.ts\";\nexport {\n\tinitTheme,\n\tonThemeChange,\n\tsetTheme,\n\tsetThemeInstance,\n\tstopThemeWatcher,\n\ttheme,\n} from \"./global-theme.ts\";\nexport {\n\tdetectTerminalBackgroundFromEnv,\n\tdetectTerminalBackgroundTheme,\n\tgetDefaultTheme,\n\tgetThemeForRgbColor,\n\tparseAutoThemeSetting,\n\tresolveThemeSetting,\n\ttype TerminalBackgroundThemeDetectionOptions,\n\ttype TerminalBackgroundThemeDetector,\n\ttype TerminalTheme,\n\ttype TerminalThemeDetection,\n\ttype TerminalThemeDetectionOptions,\n} from \"./terminal-detection.ts\";\nexport { Theme, type ThemeBg, type ThemeColor } from \"./theme-class.ts\";\nexport {\n\tgetAvailableThemes,\n\tgetAvailableThemesWithPaths,\n\tgetThemeByName,\n\tloadThemeFromPath,\n\tloadThemeFromContent,\n\tsetRegisteredThemes,\n\ttype ThemeInfo,\n} from \"./theme-loading.ts\";\nexport {\n\tgetEditorTheme,\n\tgetLanguageFromPath,\n\tgetMarkdownTheme,\n\tgetSelectListTheme,\n\tgetSettingsListTheme,\n\thighlightCode,\n} from \"./tui-theme.ts\";\n"]}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { type ChildProcess, type ChildProcessByStdio, type SpawnOptions, type SpawnOptionsWithStdioTuple, type SpawnSyncOptionsWithStringEncoding, type SpawnSyncReturns, type StdioNull, type StdioPipe } from "node:child_process";
|
|
2
2
|
import type { Readable } from "node:stream";
|
|
3
|
+
type WaitForChildProcessOptions = {
|
|
4
|
+
platform?: NodeJS.Platform;
|
|
5
|
+
isWindowsProcessAlive?: (pid: number) => boolean;
|
|
6
|
+
windowsExitPollIntervalMs?: number;
|
|
7
|
+
windowsExitCodeGraceMs?: number;
|
|
8
|
+
};
|
|
3
9
|
export declare function shouldUseWindowsShell(command: string): boolean;
|
|
4
10
|
export declare function spawnProcess(command: string, args: string[], options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>): ChildProcessByStdio<null, Readable, Readable>;
|
|
5
11
|
export declare function spawnProcess(command: string, args: string[], options: SpawnOptions): ChildProcess;
|
|
@@ -17,5 +23,6 @@ export declare function spawnProcessSync(command: string, args: string[], option
|
|
|
17
23
|
* after the grace elapses. A longer active-drain hard cap is armed once on `exit`
|
|
18
24
|
* so an endlessly noisy descendant cannot keep the wait pending forever.
|
|
19
25
|
*/
|
|
20
|
-
export declare function waitForChildProcess(child: ChildProcess): Promise<number | null>;
|
|
26
|
+
export declare function waitForChildProcess(child: ChildProcess, options?: WaitForChildProcessOptions): Promise<number | null>;
|
|
27
|
+
export {};
|
|
21
28
|
//# sourceMappingURL=child-process.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"child-process.d.ts","sourceRoot":"","sources":["../../src/utils/child-process.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,YAAY,EACjB,KAAK,mBAAmB,EAGxB,KAAK,YAAY,EACjB,KAAK,0BAA0B,EAC/B,KAAK,kCAAkC,EACvC,KAAK,gBAAgB,EACrB,KAAK,SAAS,EACd,KAAK,SAAS,EACd,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"child-process.d.ts","sourceRoot":"","sources":["../../src/utils/child-process.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,YAAY,EACjB,KAAK,mBAAmB,EAGxB,KAAK,YAAY,EACjB,KAAK,0BAA0B,E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WithStringEncoding,\n\ttype SpawnSyncReturns,\n\ttype StdioNull,\n\ttype StdioPipe,\n} from \"node:child_process\";\nimport { basename } from \"node:path\";\nimport type { Readable } from \"node:stream\";\nimport crossSpawn from \"cross-spawn\";\n\nconst EXIT_STDIO_IDLE_GRACE_MS = 100;\nconst EXIT_STDIO_ACTIVE_DRAIN_HARD_CAP_MS = 5_000;\nconst WINDOWS_EXIT_POLL_INTERVAL_MS = 50;\nconst WINDOWS_EXIT_CODE_GRACE_MS = 1_000;\n\ntype WaitForChildProcessOptions = {\n\tplatform?: NodeJS.Platform;\n\tisWindowsProcessAlive?: (pid: number) => boolean;\n\twindowsExitPollIntervalMs?: number;\n\twindowsExitCodeGraceMs?: number;\n};\n\nconst WINDOWS_SHELL_COMMANDS = new Set([\"bun\", \"npm\", \"npx\", \"pnpm\", \"yarn\", \"yarnpkg\", \"corepack\"]);\n\nexport function shouldUseWindowsShell(command: string): boolean {\n\tif (process.platform !== \"win32\") return false;\n\tconst commandName = basename(command).toLowerCase();\n\treturn commandName.endsWith(\".cmd\") || commandName.endsWith(\".bat\") || WINDOWS_SHELL_COMMANDS.has(commandName);\n}\n\nexport function spawnProcess(\n\tcommand: string,\n\targs: string[],\n\toptions: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>,\n): ChildProcessByStdio<null, Readable, Readable>;\nexport function spawnProcess(command: string, args: string[], options: SpawnOptions): ChildProcess;\nexport function spawnProcess(command: string, args: string[], options: SpawnOptions): ChildProcess {\n\treturn process.platform === \"win32\" ? crossSpawn(command, args, options) : nodeSpawn(command, args, options);\n}\n\nexport function spawnProcessSync(\n\tcommand: string,\n\targs: string[],\n\toptions: SpawnSyncOptionsWithStringEncoding,\n): SpawnSyncReturns<string> {\n\treturn process.platform === \"win32\"\n\t\t? crossSpawn.sync(command, args, options)\n\t\t: nodeSpawnSync(command, args, options);\n}\n\nfunction isWindowsProcessAlive(pid: number): boolean {\n\tconst result = nodeSpawnSync(\"tasklist\", [\"/FI\", `PID eq ${pid}`, \"/NH\"], { encoding: \"utf-8\", windowsHide: true });\n\tif (result.status !== 0) return true;\n\treturn new RegExp(`\\\\b${pid}\\\\b`).test(result.stdout);\n}\n\n/**\n * Wait for a child process to terminate without hanging on inherited stdio handles.\n *\n * A short-lived child can `exit` while a detached descendant keeps its stdout/stderr\n * pipe open. We must not resolve and destroy the streams on a short fixed deadline\n * measured from `exit`, or finite post-exit output still being written past that\n * deadline is silently lost (earendil-works/pi#5303). Instead, after `exit` we wait\n * for the pipes to fall idle: the grace timer is re-armed on every chunk, so finite\n * post-exit writers drain while active, while a quiet inherited handle (e.g. a\n * Windows daemonized descendant that never lets `close` fire) releases promptly\n * after the grace elapses. A longer active-drain hard cap is armed once on `exit`\n * so an endlessly noisy descendant cannot keep the wait pending forever.\n */\nexport function waitForChildProcess(child: ChildProcess, options: WaitForChildProcessOptions = {}): Promise<number | null> {\n\treturn new Promise((resolve, reject) => {\n\t\tlet settled = false;\n\t\tlet exited = false;\n\t\tlet exitCode: number | null = null;\n\t\tlet postExitIdleTimer: NodeJS.Timeout | undefined;\n\t\tlet postExitActiveDrainHardCapTimer: NodeJS.Timeout | undefined;\n\t\tlet stdoutEnded = child.stdout === null;\n\t\tlet stderrEnded = child.stderr === null;\n\t\tlet windowsExitPoll: NodeJS.Timeout | undefined;\n\t\tlet windowsExitCodeGraceTimer: NodeJS.Timeout | undefined;\n\t\tconst platform = options.platform ?? process.platform;\n\t\tconst processAlive = options.isWindowsProcessAlive ?? isWindowsProcessAlive;\n\t\tconst windowsExitPollIntervalMs = options.windowsExitPollIntervalMs ?? WINDOWS_EXIT_POLL_INTERVAL_MS;\n\t\tconst windowsExitCodeGraceMs = options.windowsExitCodeGraceMs ?? WINDOWS_EXIT_CODE_GRACE_MS;\n\n\t\tconst cleanup = () => {\n\t\t\tif (windowsExitPoll) {\n\t\t\t\tclearInterval(windowsExitPoll);\n\t\t\t\twindowsExitPoll = undefined;\n\t\t\t}\n\t\t\tif (postExitIdleTimer) {\n\t\t\t\tclearTimeout(postExitIdleTimer);\n\t\t\t\tpostExitIdleTimer = undefined;\n\t\t\t}\n\t\t\tif (postExitActiveDrainHardCapTimer) {\n\t\t\t\tclearTimeout(postExitActiveDrainHardCapTimer);\n\t\t\t\tpostExitActiveDrainHardCapTimer = undefined;\n\t\t\t}\n\t\t\tif (windowsExitCodeGraceTimer) {\n\t\t\t\tclearTimeout(windowsExitCodeGraceTimer);\n\t\t\t\twindowsExitCodeGraceTimer = undefined;\n\t\t\t}\n\t\t\tchild.removeListener(\"error\", onError);\n\t\t\tchild.removeListener(\"exit\", onExit);\n\t\t\tchild.removeListener(\"close\", onClose);\n\t\t\tchild.stdout?.removeListener(\"end\", onStdoutEnd);\n\t\t\tchild.stderr?.removeListener(\"end\", onStderrEnd);\n\t\t\tchild.stdout?.removeListener(\"data\", onData);\n\t\t\tchild.stderr?.removeListener(\"data\", onData);\n\t\t};\n\n\t\tconst finalize = (code: number | null) => {\n\t\t\tif (settled) return;\n\t\t\tsettled = true;\n\t\t\tcleanup();\n\t\t\tchild.stdout?.destroy();\n\t\t\tchild.stderr?.destroy();\n\t\t\tresolve(code);\n\t\t};\n\n\t\tconst maybeFinalizeAfterExit = () => {\n\t\t\tif (!exited || settled) return;\n\t\t\tif (stdoutEnded && stderrEnded) {\n\t\t\t\tfinalize(exitCode);\n\t\t\t}\n\t\t};\n\n\t\tconst armIdleTimer = () => {\n\t\t\tif (postExitIdleTimer) clearTimeout(postExitIdleTimer);\n\t\t\tpostExitIdleTimer = setTimeout(() => finalize(exitCode), EXIT_STDIO_IDLE_GRACE_MS);\n\t\t};\n\n\t\tconst armActiveDrainHardCapTimer = () => {\n\t\t\tif (postExitActiveDrainHardCapTimer) return;\n\t\t\tpostExitActiveDrainHardCapTimer = setTimeout(\n\t\t\t\t() => finalize(exitCode),\n\t\t\t\tEXIT_STDIO_ACTIVE_DRAIN_HARD_CAP_MS,\n\t\t\t);\n\t\t};\n\n\t\tconst onData = () => {\n\t\t\t// Output is still arriving after exit; keep extending the idle grace\n\t\t\t// so active finite writers can drain without truncating the tail.\n\t\t\tif (exited && !settled) armIdleTimer();\n\t\t};\n\n\t\tconst onStdoutEnd = () => {\n\t\t\tstdoutEnded = true;\n\t\t\tmaybeFinalizeAfterExit();\n\t\t};\n\n\t\tconst onStderrEnd = () => {\n\t\t\tstderrEnded = true;\n\t\t\tmaybeFinalizeAfterExit();\n\t\t};\n\n\t\tconst onError = (err: Error) => {\n\t\t\tif (settled) return;\n\t\t\tsettled = true;\n\t\t\tcleanup();\n\t\t\treject(err);\n\t\t};\n\n\t\tconst onExit = (code: number | null) => {\n\t\t\tif (windowsExitCodeGraceTimer) {\n\t\t\t\tclearTimeout(windowsExitCodeGraceTimer);\n\t\t\t\twindowsExitCodeGraceTimer = undefined;\n\t\t\t}\n\t\t\texited = true;\n\t\t\texitCode = code;\n\t\t\tmaybeFinalizeAfterExit();\n\t\t\tif (!settled) {\n\t\t\t\tarmActiveDrainHardCapTimer();\n\t\t\t\tarmIdleTimer();\n\t\t\t}\n\t\t};\n\n\t\tconst armWindowsExitCodeGraceTimer = () => {\n\t\t\tif (windowsExitCodeGraceTimer) return;\n\t\t\tif (windowsExitPoll) {\n\t\t\t\tclearInterval(windowsExitPoll);\n\t\t\t\twindowsExitPoll = undefined;\n\t\t\t}\n\t\t\twindowsExitCodeGraceTimer = setTimeout(() => {\n\t\t\t\twindowsExitCodeGraceTimer = undefined;\n\t\t\t\tonExit(child.exitCode ?? 0);\n\t\t\t}, windowsExitCodeGraceMs);\n\t\t};\n\n\t\tconst pollWindowsExit = () => {\n\t\t\tif (platform !== \"win32\" || !child.pid || exited || settled) return;\n\t\t\tif (!processAlive(child.pid)) {\n\t\t\t\tif (child.exitCode !== null) {\n\t\t\t\t\tonExit(child.exitCode);\n\t\t\t\t} else {\n\t\t\t\t\tarmWindowsExitCodeGraceTimer();\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tconst onClose = (code: number | null) => {\n\t\t\tfinalize(code);\n\t\t};\n\n\t\tif (platform === \"win32\" && child.pid) {\n\t\t\twindowsExitPoll = setInterval(pollWindowsExit, windowsExitPollIntervalMs);\n\t\t}\n\t\tchild.stdout?.once(\"end\", onStdoutEnd);\n\t\tchild.stderr?.once(\"end\", onStderrEnd);\n\t\tchild.stdout?.on(\"data\", onData);\n\t\tchild.stderr?.on(\"data\", onData);\n\t\tchild.once(\"error\", onError);\n\t\tchild.once(\"exit\", onExit);\n\t\tchild.once(\"close\", onClose);\n\t});\n}\n"]}
|