@bastani/atomic 0.9.89-alpha.1 → 0.9.89-alpha.2
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 +45 -0
- package/dist/builtin/intercom/CHANGELOG.md +8 -0
- package/dist/builtin/intercom/broker/broker-instance.ts +15 -1
- package/dist/builtin/intercom/broker/broker.ts +25 -8
- package/dist/builtin/intercom/broker/client.ts +29 -14
- package/dist/builtin/intercom/broker/multinode-router.ts +193 -52
- package/dist/builtin/intercom/broker/multinode-state-store.ts +6 -2
- package/dist/builtin/intercom/broker/restoring-recipients.ts +5 -0
- package/dist/builtin/intercom/broker/sql-outbox-store.ts +3 -2
- package/dist/builtin/intercom/index.bundle.mjs +19 -12
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/intercom/types.ts +6 -2
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/CHANGELOG.md +6 -0
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/subagents/src/extension/index.bundle.mjs +17 -6
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/builtin/workflows/CHANGELOG.md +12 -0
- package/dist/builtin/workflows/package.json +1 -1
- package/dist/builtin/workflows/src/extension/index.bundle.mjs +310 -344
- package/dist/builtin/workflows/src/extension/local-worker-entry.mjs +99 -17
- package/dist/builtin/workflows/src/index.js +99 -17
- package/dist/builtin/workflows/src/local-worker-entry.mjs +99 -17
- package/dist/cli/storage-command.js +8 -0
- package/dist/cli/storage-command.js.map +1 -1
- package/dist/core/auth-storage-backends.d.ts.map +1 -1
- package/dist/core/auth-storage-backends.js +1 -0
- package/dist/core/auth-storage-backends.js.map +1 -1
- package/dist/core/keybindings.d.ts +8 -0
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +4 -0
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/process-start-token.d.ts.map +1 -1
- package/dist/core/process-start-token.js +8 -1
- package/dist/core/process-start-token.js.map +1 -1
- package/dist/core/resume/blueprint/build-lock.d.ts.map +1 -1
- package/dist/core/resume/blueprint/build-lock.js +2 -1
- package/dist/core/resume/blueprint/build-lock.js.map +1 -1
- package/dist/core/storage/errors.d.ts +4 -2
- package/dist/core/storage/errors.d.ts.map +1 -1
- package/dist/core/storage/errors.js +6 -1
- package/dist/core/storage/errors.js.map +1 -1
- package/dist/core/tasks/completion.d.ts +5 -0
- package/dist/core/tasks/completion.d.ts.map +1 -1
- package/dist/core/tasks/completion.js +13 -0
- package/dist/core/tasks/completion.js.map +1 -1
- package/dist/core/tools/shell-task-render.d.ts +1 -2
- package/dist/core/tools/shell-task-render.d.ts.map +1 -1
- package/dist/core/tools/shell-task-render.js +3 -7
- package/dist/core/tools/shell-task-render.js.map +1 -1
- package/dist/core/tools/windows-directory-security.d.ts.map +1 -1
- package/dist/core/tools/windows-directory-security.js +3 -11
- package/dist/core/tools/windows-directory-security.js.map +1 -1
- package/dist/core/worktree-snapshot/capture.d.ts.map +1 -1
- package/dist/core/worktree-snapshot/capture.js +25 -1
- package/dist/core/worktree-snapshot/capture.js.map +1 -1
- package/dist/core/worktree-snapshot/restore.d.ts.map +1 -1
- package/dist/core/worktree-snapshot/restore.js +38 -9
- package/dist/core/worktree-snapshot/restore.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/modes/interactive/components/agent-panel.d.ts +5 -0
- package/dist/modes/interactive/components/agent-panel.d.ts.map +1 -1
- package/dist/modes/interactive/components/agent-panel.js +13 -0
- package/dist/modes/interactive/components/agent-panel.js.map +1 -1
- package/dist/modes/interactive/components/chat-transcript.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-transcript.js +5 -2
- package/dist/modes/interactive/components/chat-transcript.js.map +1 -1
- package/dist/modes/interactive/components/custom-message.js +1 -1
- package/dist/modes/interactive/components/custom-message.js.map +1 -1
- package/dist/modes/interactive/components/heartbeat-block.d.ts +34 -0
- package/dist/modes/interactive/components/heartbeat-block.d.ts.map +1 -0
- package/dist/modes/interactive/components/heartbeat-block.js +50 -0
- package/dist/modes/interactive/components/heartbeat-block.js.map +1 -0
- package/dist/modes/interactive/components/input-label.d.ts.map +1 -1
- package/dist/modes/interactive/components/input-label.js +8 -3
- package/dist/modes/interactive/components/input-label.js.map +1 -1
- package/dist/modes/interactive/components/main-composer-keys.d.ts.map +1 -1
- package/dist/modes/interactive/components/main-composer-keys.js +3 -7
- package/dist/modes/interactive/components/main-composer-keys.js.map +1 -1
- package/dist/modes/interactive/components/mermaid.d.ts.map +1 -1
- package/dist/modes/interactive/components/mermaid.js +13 -7
- package/dist/modes/interactive/components/mermaid.js.map +1 -1
- package/dist/modes/interactive/components/notice-line.d.ts +10 -2
- package/dist/modes/interactive/components/notice-line.d.ts.map +1 -1
- package/dist/modes/interactive/components/notice-line.js +13 -3
- package/dist/modes/interactive/components/notice-line.js.map +1 -1
- package/dist/modes/interactive/components/provider-brand.d.ts.map +1 -1
- package/dist/modes/interactive/components/provider-brand.js +3 -0
- package/dist/modes/interactive/components/provider-brand.js.map +1 -1
- package/dist/modes/interactive/components/task-heartbeat-message.d.ts +9 -4
- package/dist/modes/interactive/components/task-heartbeat-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-heartbeat-message.js +33 -27
- package/dist/modes/interactive/components/task-heartbeat-message.js.map +1 -1
- package/dist/modes/interactive/components/task-inspector.d.ts +16 -0
- package/dist/modes/interactive/components/task-inspector.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-inspector.js +95 -4
- package/dist/modes/interactive/components/task-inspector.js.map +1 -1
- package/dist/modes/interactive/components/task-list.d.ts +5 -1
- package/dist/modes/interactive/components/task-list.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-list.js +20 -3
- package/dist/modes/interactive/components/task-list.js.map +1 -1
- package/dist/modes/interactive/components/task-transcript-page.d.ts +1 -1
- package/dist/modes/interactive/components/task-transcript-page.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-transcript-page.js +10 -7
- package/dist/modes/interactive/components/task-transcript-page.js.map +1 -1
- package/dist/modes/interactive/interactive-startup.js +1 -2
- package/dist/modes/interactive/interactive-startup.js.map +1 -1
- package/dist/modes/interactive/theme/color-utils.d.ts +29 -1
- package/dist/modes/interactive/theme/color-utils.d.ts.map +1 -1
- package/dist/modes/interactive/theme/color-utils.js +81 -7
- package/dist/modes/interactive/theme/color-utils.js.map +1 -1
- package/dist/modes/interactive/theme/global-theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/global-theme.js +3 -0
- package/dist/modes/interactive/theme/global-theme.js.map +1 -1
- package/dist/modes/interactive/theme/theme-class.d.ts +22 -2
- package/dist/modes/interactive/theme/theme-class.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme-class.js +64 -18
- package/dist/modes/interactive/theme/theme-class.js.map +1 -1
- package/dist/modes/interactive/theme/theme.d.ts +1 -0
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +1 -0
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/utils/clipboard-image.d.ts.map +1 -1
- package/dist/utils/clipboard-image.js +2 -0
- package/dist/utils/clipboard-image.js.map +1 -1
- package/dist/utils/clipboard.d.ts.map +1 -1
- package/dist/utils/clipboard.js +2 -1
- package/dist/utils/clipboard.js.map +1 -1
- package/dist/utils/tools-manager.d.ts +6 -0
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +170 -15
- package/dist/utils/tools-manager.js.map +1 -1
- package/dist/utils/windows-powershell.d.ts +9 -0
- package/dist/utils/windows-powershell.d.ts.map +1 -0
- package/dist/utils/windows-powershell.js +16 -0
- package/dist/utils/windows-powershell.js.map +1 -0
- package/docs/background-tasks.md +6 -6
- package/docs/getting-started/installation.md +4 -2
- package/docs/keybindings.md +3 -0
- package/docs/storage.md +24 -5
- package/docs/subagents.md +1 -1
- package/docs/themes/reference.md +7 -0
- package/docs/tui/reference.md +1 -1
- package/docs/windows.md +1 -1
- package/docs/workflows/api-reference.md +9 -1
- package/docs/workflows/operations.md +1 -1
- package/npm-shrinkwrap.json +49 -49
- package/package.json +6 -6
- package/schemas/keybindings.schema.json +4 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactive-startup.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-startup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACnF,OAAO,EAAE,4BAA4B,EAAE,MAAM,kCAAkC,CAAC;AAChF,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,6BAA6B,EAAE,MAAM,8BAA8B,CAAC;AAC7E,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,iDAAiD,CAAC;AACzF,OAAO,EACN,wCAAwC,EACxC,4CAA4C,EAC5C,sCAAsC,EACtC,6BAA6B,GAC7B,MAAM,8CAA8C,CAAC;AACtD,OAAO,EACN,cAAc,EACd,0BAA0B,EAC1B,sBAAsB,EACtB,oBAAoB,GACpB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6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,QAAQ,CAAC,IAAI,UAAU,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACnF,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9C,CAAC,CAAC;AAEF,mBAAmB,CAAC,SAAS,CAAC,uBAAuB,GAAG;IACvD,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,KAAK,IAAI,IAAI,IAAI,CAAC,eAAe,CAAC,eAAe,EAAE,KAAK,IAAI,CAAC;AACzF,CAAC,CAAC;AAEF,mBAAmB,CAAC,SAAS,CAAC,wBAAwB,GAAG;IACxD,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,KAAK,IAAI,IAAI,IAAI,CAAC,eAAe,CAAC,eAAe,EAAE,KAAK,KAAK,CAAC;AAC1F,CAAC,CAAC","sourcesContent":["import { replaceControlCharacters, ScrollView, VStack } from \"@bastani/atomic-tui\";\nimport { markEventLoopStartupComplete } from \"../../core/event-loop-monitor.ts\";\nimport { markLifecycleTiming } from \"../../core/lifecycle-timings.ts\";\nimport { formatModelLabel } from \"../../core/model-label.ts\";\nimport { isOfflineModeEnabled } from \"../../core/package-manager-env.ts\";\nimport { consumeStartupInput } from \"../../main-early-input.ts\";\nimport { createChildProcessEnvironment } from \"../../utils/child-process.ts\";\nimport { setDeprecationWarningSink } from \"../../utils/deprecation.js\";\nimport { ensurePngTranscoder } from \"../../utils/image-convert.ts\";\nimport { setMarkitDiagnosticSink } from \"../../utils/markit.js\";\nimport { shortenHomePath } from \"../../utils/paths.ts\";\nimport type { ToolStatus } from \"../../utils/tools-manager.ts\";\nimport { renderDiagnosticStatus } from \"../interactive-engine/engine-diagnostic-view.js\";\nimport {\n\tonInteractiveEngineRemoteCommandsChanged,\n\tonInteractiveEngineResourceExtensionsChanged,\n\tonInteractiveEngineSessionStatsChanged,\n\twaitForInteractiveEngineBound,\n} from \"../interactive-engine/extension-ui-bridge.ts\";\nimport {\n\tatomicWordmark,\n\trenderAtomicAssemblyBanner,\n\trenderStartupManifesto,\n\tsupportsAtomicBanner,\n} from \"./components/atomic-banner.ts\";\nimport { StartupIdentityComponent } from \"./components/startup-identity.ts\";\nimport { ThemedText } from \"./components/themed-text.js\";\nimport { bindInitialEagerSession } from \"./interactive-initial-session-binding.ts\";\nimport { InteractiveModeBase, seedStartupInput } from \"./interactive-mode-base.ts\";\nimport {\n\tAPP_NAME,\n\tAPP_TITLE,\n\ttype Container,\n\tcheckForNewPiVersion,\n\tcomposeStartupIdentity,\n\tDefaultPackageManager,\n\tDynamicBorder,\n\tENV_OFFLINE,\n\tensureTool,\n\tgetAgentDir,\n\tgetCachedChangelog,\n\tgetChangelogHighlights,\n\tgetChangelogPath,\n\tgetCwdRelativePath,\n\tgetEntriesForVersion,\n\tgetEnvValue,\n\tgetMarkdownTheme,\n\tgetNewEntries,\n\tgetPiUserAgent,\n\tisInstallTelemetryEnabled,\n\ttype MarkdownTheme,\n\tnormalizeChangelogLinks,\n\tonThemeChange,\n\tpath,\n\tpreloadChangelog,\n\trecordTimeSinceReset,\n\tSpacer,\n\tspawn,\n\tText,\n\ttheme,\n\tVERSION,\n\tVERSION_ADOPTION_ENDPOINT,\n\tvisibleWidth,\n} from \"./interactive-mode-deps.ts\";\nimport {\n\trefreshCatalogsAfterTuiStartup,\n\tupdateProviderCountFromSnapshot,\n} from \"./interactive-model-catalog-startup.ts\";\nimport { ONBOARDING_COPY } from \"./interactive-onboarding.ts\";\nimport { holdTuiForStartupTrust } from \"./interactive-startup-trust.ts\";\nimport { restoreTerminalTitleAfterPackageCheck } from \"./interactive-terminal-title.ts\";\nimport { reportUnavailableTools } from \"./interactive-unavailable-tools.ts\";\nimport { showSessionNotices } from \"./session-notices.ts\";\n\nexport const shouldRefreshCatalogsOnStartup = (): boolean => !isOfflineModeEnabled();\n\nfunction prepareStartupNotices(mode: InteractiveModeBase): void {\n\tif (mode.startupNoticesPrepared) return;\n\tmode.startupNoticesPrepared = true;\n\tmode.hadLastChangelogVersionAtStartup = Boolean(mode.settingsManager.getLastChangelogVersion?.());\n\tif (mode.changelogMarkdown === undefined) {\n\t\tmode.changelogMarkdown = mode.getChangelogForDisplay?.();\n\t}\n\tmode.initializeFirstRunOnboardingMarkers?.();\n\tif (!mode.firstRunNoticeVisible) {\n\t\tmode.firstRunNoticeVisible = mode.isFirstRunOnboardingEligible?.() ?? false;\n\t}\n}\n\n/**\n * Show non-fatal model-catalog warnings — today, a derived `-fast` variant suppressed because\n * something already owns that exact model ID.\n *\n * Called unconditionally at startup and again after deferred extension loading, because an extension\n * provider can introduce a collision that did not exist at startup. The last reported text is kept so\n * the second read only speaks when the diagnostic set actually changed.\n */\nInteractiveModeBase.prototype.reportModelCatalogWarning = function (\n\tthis: InteractiveModeBase,\n\ttargetContainer: Container = this.chatContainer,\n): void {\n\tconst warning = this.session.modelRuntime.getWarning?.();\n\tif (!warning || warning === this.reportedModelCatalogWarning) {\n\t\treturn;\n\t}\n\tthis.reportedModelCatalogWarning = warning;\n\tthis.showWarning(warning, targetContainer);\n};\n\nInteractiveModeBase.prototype.showStartupNoticesIfNeeded = function (\n\tthis: InteractiveModeBase,\n\ttargetContainer: Container = this.chatContainer,\n): void {\n\tif (this.startupNoticesShown) {\n\t\t// Deferred startup asks again after extensions load: redraw What's New with their transformers, don't repeat it.\n\t\tthis.startupChangelogComponent?.invalidate();\n\t\treturn;\n\t}\n\tprepareStartupNotices(this);\n\tthis.startupNoticesShown = true;\n\n\tconst changelogMarkdown = this.changelogMarkdown;\n\tif (!changelogMarkdown && !this.firstRunNoticeVisible) {\n\t\treturn;\n\t}\n\n\tif (changelogMarkdown) {\n\t\tif (targetContainer.children.length > 0) {\n\t\t\ttargetContainer.addChild(new Spacer(1));\n\t\t}\n\t\ttargetContainer.addChild(new DynamicBorder());\n\t\tif (this.settingsManager.getCollapseChangelog()) {\n\t\t\tconst versionMatch = changelogMarkdown.match(\n\t\t\t\t/##\\s+\\[?((?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)(?:-(?:alpha\\.)?(?:0|[1-9]\\d*))?)\\]?/,\n\t\t\t);\n\t\t\tconst latestVersion = versionMatch ? versionMatch[1] : this.version;\n\t\t\tconst condensedText = `Updated to v${latestVersion}. Use ${theme.bold(\"/changelog\")} to view full changelog.`;\n\t\t\ttargetContainer.addChild(new Text(condensedText, 1, 0));\n\t\t} else {\n\t\t\ttargetContainer.addChild(new ThemedText(() => theme.bold(theme.fg(\"accent\", \"What's New\")), 1, 0));\n\t\t\ttargetContainer.addChild(new Spacer(1));\n\t\t\tthis.startupChangelogComponent = this.createChangelogMarkdown(changelogMarkdown.trim(), 1, 0);\n\t\t\ttargetContainer.addChild(this.startupChangelogComponent);\n\t\t\ttargetContainer.addChild(new Spacer(1));\n\t\t}\n\t\ttargetContainer.addChild(new DynamicBorder());\n\t}\n\n\tif (this.firstRunNoticeVisible) {\n\t\tthis.firstRunOnboardingNoticeComponents = [];\n\t\tif (targetContainer.children.length > 0) {\n\t\t\tthis.firstRunOnboardingNoticeComponents.push(new Spacer(1));\n\t\t}\n\t\tthis.firstRunOnboardingNoticeComponents.push(\n\t\t\tnew DynamicBorder(),\n\t\t\tnew Text(ONBOARDING_COPY, 1, 0),\n\t\t\tnew DynamicBorder(),\n\t\t\tnew Spacer(1),\n\t\t);\n\t\tfor (const component of this.firstRunOnboardingNoticeComponents) {\n\t\t\ttargetContainer.addChild(component);\n\t\t}\n\t\t// Mark completion only after queueing the notice in the chat canvas so\n\t\t// launches that skip rendering retry the first-run notice next time.\n\t\tthis.settingsManager.setOnboardedVersion(this.version);\n\t}\n\n\tthis.ui.requestRender();\n};\n\n/** Bring fd, rg, and git to readiness, reporting progress into the transcript. */\nInteractiveModeBase.prototype.ensureManagedToolsReady = function (this: InteractiveModeBase): Promise<void> {\n\tconst statusGeneration = ++this.managedToolStatusGeneration;\n\tconst reportStatus = (status: ToolStatus): void => {\n\t\tif (this.managedToolStatusGeneration === statusGeneration) this.showManagedToolStatus(status);\n\t};\n\t// Autocomplete needs only fd, so a slow rg or git download never delays it.\n\tconst fdReady = ensureTool(\"fd\", reportStatus).then((fdPath) => {\n\t\tthis.fdPath = fdPath;\n\t\tthis.setupAutocompleteProvider();\n\t});\n\treturn Promise.all([fdReady, ensureTool(\"rg\", reportStatus), ensureTool(\"git\", reportStatus)])\n\t\t.then(() => undefined)\n\t\t.catch((error) => {\n\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\treportStatus({ type: \"warning\", message: `Tool readiness check failed: ${message}` });\n\t\t});\n};\n\n/** Show a managed-tool status update in the chat, never on the console. */\nInteractiveModeBase.prototype.showManagedToolStatus = function (this: InteractiveModeBase, status: ToolStatus): void {\n\tif (!this.managedToolStatusStarted) {\n\t\tthis.chatContainer.addChild(new Spacer(1));\n\t\tthis.managedToolStatusStarted = true;\n\t}\n\tconst message = status.type === \"warning\" ? `Warning: ${status.message}` : status.message;\n\tconst color = status.type === \"warning\" ? \"warning\" : \"dim\";\n\tthis.chatContainer.addChild(new ThemedText(() => theme.fg(color, message), 1, 0));\n\tthis.lastStatusSpacer = undefined;\n\tthis.lastStatusText = undefined;\n\tthis.ui.requestRender();\n};\n\nexport function attachInteractiveEngineResourceExtensionRefresh(mode: InteractiveModeBase): () => void {\n\treturn onInteractiveEngineResourceExtensionsChanged(mode.runtimeHost, () => {\n\t\tmode.chatContainer.invalidate();\n\t\tmode.ui.requestRender();\n\t\tif (mode.resourceDisclosureContainer.children.length === 0) return;\n\t\tmode.showLoadedResources({\n\t\t\tforce: true,\n\t\t\tshowDiagnosticsWhenQuiet: true,\n\t\t\ttargetContainer: mode.resourceDisclosureContainer,\n\t\t});\n\t});\n}\n\nexport const STARTUP_DRAFT_HELD_NOTICE = \"Your earlier input is in the prompt; press Enter to send it.\";\n\nInteractiveModeBase.prototype.init = async function (this: InteractiveModeBase): Promise<void> {\n\tif (this.isInitialized) return;\n\n\tif (this.options.holdTuiForStartupTrust) await holdTuiForStartupTrust(this);\n\tthis.registerSignalHandlers();\n\n\t// Keep the transcript in its own viewport and reserve the bottom chrome in a\n\t// fixed dock for the fullscreen renderer. The same components also feed the\n\t// internal main-screen fallback used for guarded terminal paths.\n\tthis.renderWidgets(); // Initialize with default spacer\n\tthis.transcriptScrollView = new ScrollView(this.documentContainer, {\n\t\tfollow: \"end\",\n\t\tprimary: true,\n\t\toverscroll: \"chain\",\n\t\tscrollbar: this.settingsManager.getFullscreenScrollbar(),\n\t\tscrollbarThumbStyle: (text) => theme.bg(\"scrollbarThumb\", text),\n\t});\n\tconst pendingMessagesPreview = {\n\t\trender: (width: number): string[] =>\n\t\t\tthis.navigationInlineCustomUiDepth > 0 ? [] : this.pendingMessagesContainer.render(width),\n\t\tinvalidate: (): void => this.pendingMessagesContainer.invalidate(),\n\t};\n\tconst dock = new VStack([\n\t\t{ component: pendingMessagesPreview, shrink: 1, minSize: 0 },\n\t\t{ component: this.statusContainer, shrink: 1, minSize: 0 },\n\t\t{ component: this.widgetContainerAbove, shrink: 1, minSize: 0 },\n\t\t{ component: this.usageMeter, shrink: 1, minSize: 1 },\n\t\t{ component: this.editorContainer, shrink: 1, minSize: 3 },\n\t\t{ component: this.footerContainer, shrink: 1, minSize: 1 },\n\t\t// Keep widgetContainerBelow after the footer for #1109's stable dock order.\n\t\t{ component: this.widgetContainerBelow, shrink: 1, minSize: 0 },\n\t]);\n\tthis.fullscreenLayoutRoot = new VStack([\n\t\t{ component: this.transcriptScrollView, basis: 0, grow: 1, shrink: 1, minSize: 1 },\n\t\t{ component: dock, basis: \"auto\", grow: 0, shrink: 1, minSize: 1 },\n\t]);\n\tthis.mountInteractiveTui(this.ui, [\n\t\tthis.documentContainer,\n\t\tpendingMessagesPreview,\n\t\tthis.statusContainer,\n\t\tthis.widgetContainerAbove,\n\t\tthis.usageMeter,\n\t\tthis.editorContainer,\n\t\tthis.footerContainer,\n\t\tthis.widgetContainerBelow,\n\t]);\n\tthis.ui.setFocus(this.extensionDialogs.at(-1)?.component ?? this.editor);\n\n\tthis.setupKeyHandlers();\n\tthis.setupEditorSubmitHandler();\n\t// Rebuild autocomplete whenever the engine child's command catalog arrives or\n\t// changes (initial bind, engine restart, reload, new/resume/fork). Subscribed\n\t// before bind so the first async catalog fetch can never be missed. No-op when\n\t// the host is not isolated.\n\tonInteractiveEngineRemoteCommandsChanged(this.runtimeHost, () => {\n\t\tthis.setupAutocompleteProvider();\n\t});\n\tattachInteractiveEngineResourceExtensionRefresh(this);\n\t// Engine stats can land after the last event of a run; repaint so the idle footer shows them.\n\tonInteractiveEngineSessionStatsChanged(this.runtimeHost, () => {\n\t\tthis.ui.requestRender();\n\t});\n\n\tconst startupInput = consumeStartupInput(this.options.startupInputCapture, {\n\t\tstartupDecisionPending: this.options.startupTrustPromptPossible,\n\t});\n\tseedStartupInput(\n\t\tthis.pendingUserInputs,\n\t\tthis.defaultEditor,\n\t\tstartupInput,\n\t\tthis.startupReplayInputs,\n\t\t(text) => {\n\t\t\tthis.startupDraftText = text;\n\t\t},\n\t\t(text) => {\n\t\t\tthis.startupReplayActiveInput = text;\n\t\t},\n\t);\n\n\t// Start and paint the host-owned TUI before waiting for the isolated engine.\n\t// The editor remains local and responsive; session binding and provider work\n\t// still stay behind the engine-bound gate below.\n\tmarkLifecycleTiming(\"tui-start\");\n\tthis.ui.start();\n\tmarkEventLoopStartupComplete();\n\tthis.programStatus.report();\n\tensurePngTranscoder(() => {\n\t\tthis.ui.invalidate();\n\t\tthis.ui.requestRender();\n\t});\n\tthis.disposeMarkitDiagnosticSink = setMarkitDiagnosticSink((message) => renderDiagnosticStatus(message, this));\n\t// A deprecation found once the UI owns the terminal (a settings reload after trust, a tool call) is shown as a\n\t// warning in the chat instead of being written over the screen.\n\tthis.disposeDeprecationWarningSink = installDeprecationWarningSink(this);\n\tthis.footerDataProvider.onBranchChange(() => {\n\t\tthis.ui.requestRender();\n\t});\n\n\tawait this.themeController.applyFromSettings();\n\n\t// Add the quiet startup identity unless silenced.\n\tif (this.shouldShowStartupHeader()) {\n\t\tthis.builtInHeader = new StartupIdentityComponent(this.ui, (width, state) =>\n\t\t\tthis.getStartupIdentityText(width, state.gap, state.manifestoPhase),\n\t\t);\n\n\t\tthis.headerContainer.addChild(new Spacer(1));\n\t\tthis.headerContainer.addChild(this.builtInHeader);\n\t\tthis.headerContainer.addChild(new Spacer(1));\n\t} else {\n\t\t// Minimal header when silenced\n\t\tthis.builtInHeader = new Text(\"\", 0, 0);\n\t\tthis.headerContainer.addChild(this.builtInHeader);\n\t}\n\tthis.showFullscreenModelScopeNotice();\n\tif (startupInput.heldForStartupDecision && startupInput.text.length > 0) {\n\t\tthis.startupNoticesContainer.addChild(new Spacer(1));\n\t\tthis.startupNoticesContainer.addChild(new Text(theme.fg(\"dim\", STARTUP_DRAFT_HELD_NOTICE), 1, 0));\n\t}\n\tmarkLifecycleTiming(\"header-mounted\");\n\tthis.ui.requestRender();\n\t// This legacy mark now means the first requested identity frame. The settled\n\t// animation frame remains the external benchmark's startup-complete mark.\n\trecordTimeSinceReset(\"time-to-first-frame\");\n\n\tawait waitForInteractiveEngineBound(this.runtimeHost);\n\tif (this.isShuttingDown) return;\n\tthis.isInitialized = true;\n\t// The isolated engine may have replaced the preliminary model/provider view.\n\tthis.ui.requestRender();\n\n\t// fd/rg readiness runs after first paint so slow downloads never make\n\t// startup appear frozen. Progress reports land in the transcript: a console\n\t// write here lands in the alternate screen and corrupts the frame.\n\tvoid this.ensureManagedToolsReady();\n\n\t// When startup resources are deferred, keep the already-painted editor responsive.\n\t// Extension UI bindings are installed at the deferred reload boundary, not here,\n\t// so no post-paint resource work can block visible typing.\n\tif (this.deferredStartupPending) {\n\t\tthis.applyRuntimeSettings();\n\t\tthis.subscribeToAgent();\n\t\tthis.updateEditorBorderColor();\n\t\tthis.updateTerminalTitle();\n\t} else {\n\t\tawait preloadChangelog(getChangelogPath());\n\t\tawait bindInitialEagerSession(this);\n\t\tvoid reportUnavailableTools(this);\n\t}\n\n\tthis.attachStartupNoticesContainer();\n\t// Render initial messages AFTER the initial session binding is in place.\n\tthis.renderInitialMessages();\n\tif (!this.deferredStartupPending) this.startSessionRecovery(\"startup\");\n\t// Set up theme file watcher\n\tonThemeChange(() => {\n\t\tthis.ui.invalidate();\n\t\tthis.updateEditorBorderColor();\n\t\tthis.ui.requestRender();\n\t});\n\n\tupdateProviderCountFromSnapshot(this);\n};\n\nInteractiveModeBase.prototype.updateTerminalTitle = function (this: InteractiveModeBase): void {\n\tconst cwdBasename = path.basename(this.sessionManager.getCwd());\n\tconst sessionName = this.sessionManager.getSessionName();\n\t// Session names come from session files: a BEL or ESC in the title would end the OSC title sequence early and send\n\t// the rest to the terminal as escape sequences.\n\tconst title = sessionName ? `${APP_TITLE} - ${sessionName} - ${cwdBasename}` : `${APP_TITLE} - ${cwdBasename}`;\n\tthis.ui.terminal.setTitle(replaceControlCharacters(title));\n};\n\n/**\n * Shows how a resumed session's checkout was prepared with the startup notices, which survive the chat rebuild that\n * follows deferred startup.\n */\n/**\n * Show deprecation warnings in the UI once it owns the terminal, instead of writing them over the screen. A warning\n * raised while deferred startup is still pending (accepting startup project trust loads the project's settings) joins the\n * retained startup notices: deferred startup rebuilds the chat before releasing it, and that rebuild would drop it.\n */\nexport function installDeprecationWarningSink(mode: InteractiveModeBase): () => void {\n\treturn setDeprecationWarningSink((message) =>\n\t\tmode.showWarning(message, mode.deferredStartupPending ? mode.startupNoticesContainer : mode.chatContainer),\n\t);\n}\n\nexport function showResumeNotices(\n\tmode: Pick<InteractiveModeBase, \"startupNoticesContainer\" | \"showWarning\">,\n\tnotices: readonly { readonly type: \"info\" | \"warning\"; readonly message: string }[] | undefined,\n): void {\n\tfor (const notice of notices ?? []) {\n\t\tif (notice.type === \"warning\") mode.showWarning(notice.message, mode.startupNoticesContainer);\n\t\telse {\n\t\t\tmode.startupNoticesContainer.addChild(new Spacer(1));\n\t\t\tmode.startupNoticesContainer.addChild(new Text(theme.fg(\"dim\", notice.message), 1, 0));\n\t\t}\n\t}\n}\n\nInteractiveModeBase.prototype.run = async function (this: InteractiveModeBase): Promise<void> {\n\tawait this.init();\n\tif (this.isShuttingDown) return;\n\n\tif (shouldRefreshCatalogsOnStartup()) void refreshCatalogsAfterTuiStartup(this);\n\n\tsetTimeout(() => {\n\t\tconst startupNoticesContainer = this.startupNoticesContainer;\n\t\tcheckForNewPiVersion(this.version).then((newVersion) => {\n\t\t\tif (newVersion) this.showNewVersionNotification(newVersion, startupNoticesContainer);\n\t\t});\n\t\trestoreTerminalTitleAfterPackageCheck(this.checkForPackageUpdates(), {\n\t\t\tinitialized: () => this.isInitialized,\n\t\t\trestore: () => this.updateTerminalTitle(),\n\t\t}).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// Deferred startup releases chat output immediately after rendering the\n\t\t// disclosure, so wait only while that startup work remains in flight.\n\t\tif (!this.deferredStartupPending && !this.deferredStartupPromise) {\n\t\t\tvoid this.maybeWarnAboutAnthropicSubscriptionAuth(undefined, startupNoticesContainer);\n\t\t}\n\t}, 500);\n\n\t// Show startup warnings\n\tconst { migratedProviders, startupDiagnostics, resumeNotices, initialMessage, initialImages, initialMessages } =\n\t\tthis.options;\n\n\tshowSessionNotices(this, startupDiagnostics);\n\tshowResumeNotices(this, resumeNotices);\n\n\tif (migratedProviders && migratedProviders.length > 0) {\n\t\tthis.showWarning(`Migrated credentials to auth.json: ${migratedProviders.join(\", \")}`);\n\t}\n\n\tconst modelsJsonError = this.session.modelRuntime.getError();\n\tif (modelsJsonError) {\n\t\tthis.showError(`models.json error: ${modelsJsonError}`);\n\t}\n\n\tconst modelFallbackMessage = this.runtimeHost.modelFallbackMessage;\n\tif (modelFallbackMessage && !this.deferredStartupPending) {\n\t\tthis.showWarning(modelFallbackMessage, this.startupNoticesContainer);\n\t}\n\n\t// CLI-provided startup prompts need extension tools/resources; wait before sending them,\n\t// but do not block the normal no-prompt input loop from becoming ready.\n\tif (this.deferredStartupPending && (initialMessage || (initialMessages && initialMessages.length > 0))) {\n\t\tawait this.ensureDeferredStartupComplete();\n\t}\n\n\t// Process initial messages\n\tif (initialMessage) {\n\t\ttry {\n\t\t\tawait this.session.prompt(initialMessage, { images: initialImages });\n\t\t} catch (error: unknown) {\n\t\t\tconst errorMessage = error instanceof Error ? error.message : \"Unknown error occurred\";\n\t\t\tthis.showError(errorMessage);\n\t\t}\n\t}\n\n\tif (initialMessages) {\n\t\tfor (const message of initialMessages) {\n\t\t\ttry {\n\t\t\t\tawait this.session.prompt(message);\n\t\t\t} catch (error: unknown) {\n\t\t\t\tconst errorMessage = error instanceof Error ? error.message : \"Unknown error occurred\";\n\t\t\t\tthis.showError(errorMessage);\n\t\t\t}\n\t\t}\n\t}\n\n\t// Main interactive loop\n\twhile (true) {\n\t\tconst userInput = await this.getUserInput();\n\t\tawait this.runUserPromptTurn(userInput);\n\t}\n};\n\nInteractiveModeBase.prototype.checkForPackageUpdates = async function (this: InteractiveModeBase): Promise<string[]> {\n\tif (getEnvValue(ENV_OFFLINE)) {\n\t\treturn [];\n\t}\n\n\ttry {\n\t\tconst packageManager = new DefaultPackageManager({\n\t\t\tcwd: this.sessionManager.getCwd(),\n\t\t\tagentDir: getAgentDir(),\n\t\t\tsettingsManager: this.settingsManager,\n\t\t});\n\t\tconst updates = await packageManager.checkForAvailableUpdates();\n\t\treturn updates.map((update) => update.displayName);\n\t} catch {\n\t\treturn [];\n\t}\n};\n\nInteractiveModeBase.prototype.checkTmuxKeyboardSetup = async function (\n\tthis: InteractiveModeBase,\n): Promise<string | undefined> {\n\tif (!process.env.TMUX) return undefined;\n\n\tconst runTmuxShow = (option: string): Promise<string | undefined> => {\n\t\treturn new Promise((resolve) => {\n\t\t\tconst proc = spawn(\"tmux\", [\"show\", \"-gv\", option], {\n\t\t\t\tstdio: [\"ignore\", \"pipe\", \"ignore\"],\n\t\t\t\tenv: createChildProcessEnvironment(),\n\t\t\t});\n\t\t\tlet stdout = \"\";\n\t\t\tconst timer = setTimeout(() => {\n\t\t\t\tproc.kill();\n\t\t\t\tresolve(undefined);\n\t\t\t}, 2000);\n\n\t\t\tproc.stdout?.on(\"data\", (data) => {\n\t\t\t\tstdout += data.toString();\n\t\t\t});\n\t\t\tproc.on(\"error\", () => {\n\t\t\t\tclearTimeout(timer);\n\t\t\t\tresolve(undefined);\n\t\t\t});\n\t\t\tproc.on(\"close\", (code) => {\n\t\t\t\tclearTimeout(timer);\n\t\t\t\tresolve(code === 0 ? stdout.trim() : undefined);\n\t\t\t});\n\t\t});\n\t};\n\n\tconst [extendedKeys, extendedKeysFormat] = await Promise.all([\n\t\trunTmuxShow(\"extended-keys\"),\n\t\trunTmuxShow(\"extended-keys-format\"),\n\t]);\n\n\t// If we couldn't query tmux (timeout, sandbox, etc.), don't warn\n\tif (extendedKeys === undefined) return undefined;\n\n\tif (extendedKeys !== \"on\" && extendedKeys !== \"always\") {\n\t\treturn \"tmux extended-keys is off. Modified enter keys may not work. Add `set -g extended-keys on` to ~/.tmux.conf and restart tmux.\";\n\t}\n\n\tif (extendedKeysFormat === \"xterm\") {\n\t\treturn `tmux extended-keys-format is xterm. ${APP_TITLE} works best with csi-u. Add \\`set -g extended-keys-format csi-u\\` to ~/.tmux.conf and restart tmux.`;\n\t}\n\n\treturn undefined;\n};\n\nconst FULL_CHANGELOG_HINT = \"Run `/changelog` for the full list of changes.\";\n\nInteractiveModeBase.prototype.getChangelogForDisplay = function (this: InteractiveModeBase): string | undefined {\n\t// Skip changelog for resumed/continued sessions (already have messages)\n\tif (this.session.state.messages.length > 0) {\n\t\treturn undefined;\n\t}\n\n\tconst lastVersion = this.settingsManager.getLastChangelogVersion();\n\tif (!lastVersion) {\n\t\t// Fresh install - record the version, send telemetry, don't show changelog\n\t\tthis.settingsManager.setLastChangelogVersion(VERSION);\n\t\tthis.reportInstallTelemetry(VERSION);\n\t\treturn undefined;\n\t}\n\n\tconst changelogPath = getChangelogPath();\n\tconst entries = getCachedChangelog(changelogPath);\n\n\tconst newEntries = getNewEntries(entries, lastVersion, VERSION);\n\tconst currentEntries = getEntriesForVersion(newEntries, VERSION);\n\tif (currentEntries.length > 0) {\n\t\tthis.settingsManager.setLastChangelogVersion(VERSION);\n\t\tthis.reportInstallTelemetry(VERSION);\n\t\treturn currentEntries\n\t\t\t.map((e) => {\n\t\t\t\tconst highlights = getChangelogHighlights(e);\n\t\t\t\tif (!highlights) return normalizeChangelogLinks(e.content, e);\n\t\t\t\tconst [heading] = e.content.split(\"\\n\");\n\t\t\t\treturn normalizeChangelogLinks(`${heading}\\n\\n${highlights}\\n\\n${FULL_CHANGELOG_HINT}`, e);\n\t\t\t})\n\t\t\t.join(\"\\n\\n\");\n\t}\n\n\treturn undefined;\n};\n\nInteractiveModeBase.prototype.reportInstallTelemetry = function (this: InteractiveModeBase, version: string): void {\n\tif (getEnvValue(ENV_OFFLINE)) {\n\t\treturn;\n\t}\n\n\tif (!isInstallTelemetryEnabled(this.settingsManager)) {\n\t\treturn;\n\t}\n\n\tvoid fetch(`${VERSION_ADOPTION_ENDPOINT}?version=${encodeURIComponent(version)}`, {\n\t\theaders: {\n\t\t\t\"User-Agent\": getPiUserAgent(version),\n\t\t},\n\t\tsignal: AbortSignal.timeout(5000),\n\t})\n\t\t.then(() => undefined)\n\t\t.catch(() => undefined);\n};\n\nInteractiveModeBase.prototype.getMarkdownThemeWithSettings = function (this: InteractiveModeBase): MarkdownTheme {\n\treturn {\n\t\t...getMarkdownTheme(),\n\t\tcodeBlockIndent: this.settingsManager.getCodeBlockIndent(),\n\t};\n};\n\nInteractiveModeBase.prototype.formatDisplayPath = function (this: InteractiveModeBase, p: string): string {\n\treturn shortenHomePath(p);\n};\n\nInteractiveModeBase.prototype.formatExtensionDisplayPath = function (this: InteractiveModeBase, path: string): string {\n\treturn this.formatDisplayPath(path).replace(/[\\\\/]index\\.(?:ts|js)$/, \"\");\n};\n\nInteractiveModeBase.prototype.formatContextPath = function (this: InteractiveModeBase, p: string): string {\n\tconst cwd = path.resolve(this.sessionManager.getCwd());\n\tconst absolutePath = path.isAbsolute(p) ? path.resolve(p) : path.resolve(cwd, p);\n\tconst relativePath = getCwdRelativePath(absolutePath, cwd);\n\tif (relativePath !== undefined) {\n\t\treturn relativePath;\n\t}\n\n\treturn this.formatDisplayPath(absolutePath);\n};\n\nInteractiveModeBase.prototype.getStartupModelLabel = function (this: InteractiveModeBase): string {\n\tconst model = this.session.state.model;\n\treturn model ? formatModelLabel(model, { thinkingLevel: this.session.thinkingLevel || \"off\" }) : \"no-model\";\n};\n\nInteractiveModeBase.prototype.getStartupIdentityText = function (\n\tthis: InteractiveModeBase,\n\tmaxWidth?: number,\n\tgap = 0,\n\tmanifestoPhase = 4,\n): string {\n\tconst appLabel = APP_NAME.length > 0 ? `${APP_NAME[0]!.toUpperCase()}${APP_NAME.slice(1)}` : \"Atomic\";\n\tconst noColor = process.env.NO_COLOR !== undefined;\n\tconst fg = (role: \"text\" | \"muted\" | \"dim\", text: string): string => (noColor ? text : theme.fg(role, text));\n\tconst showMark = supportsAtomicBanner();\n\tconst wordmark = showMark ? \"\" : `${atomicWordmark()} `;\n\tconst title = `${wordmark}${theme.bold(fg(\"text\", appLabel))} ${fg(\"muted\", `v${this.version}`)}`;\n\tconst modelLine = fg(\"muted\", this.getStartupModelLabel());\n\tconst markLines = showMark ? this.getAtomicAnsiMarkLines(gap) : [];\n\tconst markWidth = Math.max(0, ...markLines.map(visibleWidth));\n\tconst showMeta = gap === 0 || (maxWidth !== undefined && maxWidth < markWidth);\n\tconst metaLines = showMeta\n\t\t? [title, modelLine, fg(\"muted\", this.formatDisplayPath(this.sessionManager.getCwd()))]\n\t\t: [];\n\treturn composeStartupIdentity(\n\t\tmarkLines,\n\t\tmetaLines,\n\t\tmaxWidth,\n\t\tgap === 0 ? renderStartupManifesto(manifestoPhase) : [],\n\t);\n};\n\nInteractiveModeBase.prototype.getAtomicAnsiMarkLines = function (this: InteractiveModeBase, gap = 0): string[] {\n\treturn renderAtomicAssemblyBanner(gap, theme, this.session.thinkingLevel || \"off\");\n};\n\nInteractiveModeBase.prototype.getStartupExpansionState = function (this: InteractiveModeBase): boolean {\n\treturn this.options.verbose || this.toolOutputExpanded;\n};\n\n/**\n * Fullscreen paints on the alternate screen, so the \"Model scope\" line cannot be printed to stdout there\n * (it would stay in the shell after exit); it goes below the header instead (upstream #11508).\n */\nInteractiveModeBase.prototype.showFullscreenModelScopeNotice = function (this: InteractiveModeBase): void {\n\tconst notice = this.options.modelScopeNotice;\n\tif (!notice || !this.usesFullscreenRenderer) return;\n\tthis.headerContainer.addChild(new ThemedText(() => theme.fg(\"dim\", notice), 1, 0));\n\tthis.headerContainer.addChild(new Spacer(1));\n};\n\nInteractiveModeBase.prototype.shouldShowStartupHeader = function (this: InteractiveModeBase): boolean {\n\treturn this.options.verbose === true || this.settingsManager.getQuietStartup() !== true;\n};\n\nInteractiveModeBase.prototype.shouldShowStartupDetails = function (this: InteractiveModeBase): boolean {\n\treturn this.options.verbose === true || this.settingsManager.getQuietStartup() === false;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"interactive-startup.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-startup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACnF,OAAO,EAAE,4BAA4B,EAAE,MAAM,kCAAkC,CAAC;AAChF,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,O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AAC,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,aAAa,IAAI,KAAK,CAAC,CAAC;AACpF,CAAC,CAAC;AAEF,mBAAmB,CAAC,SAAS,CAAC,wBAAwB,GAAG;IACxD,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,IAAI,IAAI,CAAC,kBAAkB,CAAC;AACxD,CAAC,CAAC;AAEF;;;GAGG;AACH,mBAAmB,CAAC,SAAS,CAAC,8BAA8B,GAAG;IAC9D,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC;IAC7C,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,sBAAsB;QAAE,OAAO;IACpD,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,IAAI,UAAU,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACnF,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9C,CAAC,CAAC;AAEF,mBAAmB,CAAC,SAAS,CAAC,uBAAuB,GAAG;IACvD,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,KAAK,IAAI,IAAI,IAAI,CAAC,eAAe,CAAC,eAAe,EAAE,KAAK,IAAI,CAAC;AACzF,CAAC,CAAC;AAEF,mBAAmB,CAAC,SAAS,CAAC,wBAAwB,GAAG;IACxD,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,KAAK,IAAI,IAAI,IAAI,CAAC,eAAe,CAAC,eAAe,EAAE,KAAK,KAAK,CAAC;AAC1F,CAAC,CAAC","sourcesContent":["import { replaceControlCharacters, ScrollView, VStack } from \"@bastani/atomic-tui\";\nimport { markEventLoopStartupComplete } from \"../../core/event-loop-monitor.ts\";\nimport { markLifecycleTiming } from \"../../core/lifecycle-timings.ts\";\nimport { formatModelLabel } from \"../../core/model-label.ts\";\nimport { isOfflineModeEnabled } from \"../../core/package-manager-env.ts\";\nimport { consumeStartupInput } from \"../../main-early-input.ts\";\nimport { createChildProcessEnvironment } from \"../../utils/child-process.ts\";\nimport { setDeprecationWarningSink } from \"../../utils/deprecation.js\";\nimport { ensurePngTranscoder } from \"../../utils/image-convert.ts\";\nimport { setMarkitDiagnosticSink } from \"../../utils/markit.js\";\nimport { shortenHomePath } from \"../../utils/paths.ts\";\nimport type { ToolStatus } from \"../../utils/tools-manager.ts\";\nimport { renderDiagnosticStatus } from \"../interactive-engine/engine-diagnostic-view.js\";\nimport {\n\tonInteractiveEngineRemoteCommandsChanged,\n\tonInteractiveEngineResourceExtensionsChanged,\n\tonInteractiveEngineSessionStatsChanged,\n\twaitForInteractiveEngineBound,\n} from \"../interactive-engine/extension-ui-bridge.ts\";\nimport {\n\tatomicWordmark,\n\trenderAtomicAssemblyBanner,\n\trenderStartupManifesto,\n\tsupportsAtomicBanner,\n} from \"./components/atomic-banner.ts\";\nimport { StartupIdentityComponent } from \"./components/startup-identity.ts\";\nimport { ThemedText } from \"./components/themed-text.js\";\nimport { bindInitialEagerSession } from \"./interactive-initial-session-binding.ts\";\nimport { InteractiveModeBase, seedStartupInput } from \"./interactive-mode-base.ts\";\nimport {\n\tAPP_NAME,\n\tAPP_TITLE,\n\ttype Container,\n\tcheckForNewPiVersion,\n\tcomposeStartupIdentity,\n\tDefaultPackageManager,\n\tDynamicBorder,\n\tENV_OFFLINE,\n\tensureTool,\n\tgetAgentDir,\n\tgetCachedChangelog,\n\tgetChangelogHighlights,\n\tgetChangelogPath,\n\tgetCwdRelativePath,\n\tgetEntriesForVersion,\n\tgetEnvValue,\n\tgetMarkdownTheme,\n\tgetNewEntries,\n\tgetPiUserAgent,\n\tisInstallTelemetryEnabled,\n\ttype MarkdownTheme,\n\tnormalizeChangelogLinks,\n\tonThemeChange,\n\tpath,\n\tpreloadChangelog,\n\trecordTimeSinceReset,\n\tSpacer,\n\tspawn,\n\tText,\n\ttheme,\n\tVERSION,\n\tVERSION_ADOPTION_ENDPOINT,\n\tvisibleWidth,\n} from \"./interactive-mode-deps.ts\";\nimport {\n\trefreshCatalogsAfterTuiStartup,\n\tupdateProviderCountFromSnapshot,\n} from \"./interactive-model-catalog-startup.ts\";\nimport { ONBOARDING_COPY } from \"./interactive-onboarding.ts\";\nimport { holdTuiForStartupTrust } from \"./interactive-startup-trust.ts\";\nimport { restoreTerminalTitleAfterPackageCheck } from \"./interactive-terminal-title.ts\";\nimport { reportUnavailableTools } from \"./interactive-unavailable-tools.ts\";\nimport { showSessionNotices } from \"./session-notices.ts\";\n\nexport const shouldRefreshCatalogsOnStartup = (): boolean => !isOfflineModeEnabled();\n\nfunction prepareStartupNotices(mode: InteractiveModeBase): void {\n\tif (mode.startupNoticesPrepared) return;\n\tmode.startupNoticesPrepared = true;\n\tmode.hadLastChangelogVersionAtStartup = Boolean(mode.settingsManager.getLastChangelogVersion?.());\n\tif (mode.changelogMarkdown === undefined) {\n\t\tmode.changelogMarkdown = mode.getChangelogForDisplay?.();\n\t}\n\tmode.initializeFirstRunOnboardingMarkers?.();\n\tif (!mode.firstRunNoticeVisible) {\n\t\tmode.firstRunNoticeVisible = mode.isFirstRunOnboardingEligible?.() ?? false;\n\t}\n}\n\n/**\n * Show non-fatal model-catalog warnings — today, a derived `-fast` variant suppressed because\n * something already owns that exact model ID.\n *\n * Called unconditionally at startup and again after deferred extension loading, because an extension\n * provider can introduce a collision that did not exist at startup. The last reported text is kept so\n * the second read only speaks when the diagnostic set actually changed.\n */\nInteractiveModeBase.prototype.reportModelCatalogWarning = function (\n\tthis: InteractiveModeBase,\n\ttargetContainer: Container = this.chatContainer,\n): void {\n\tconst warning = this.session.modelRuntime.getWarning?.();\n\tif (!warning || warning === this.reportedModelCatalogWarning) {\n\t\treturn;\n\t}\n\tthis.reportedModelCatalogWarning = warning;\n\tthis.showWarning(warning, targetContainer);\n};\n\nInteractiveModeBase.prototype.showStartupNoticesIfNeeded = function (\n\tthis: InteractiveModeBase,\n\ttargetContainer: Container = this.chatContainer,\n): void {\n\tif (this.startupNoticesShown) {\n\t\t// Deferred startup asks again after extensions load: redraw What's New with their transformers, don't repeat it.\n\t\tthis.startupChangelogComponent?.invalidate();\n\t\treturn;\n\t}\n\tprepareStartupNotices(this);\n\tthis.startupNoticesShown = true;\n\n\tconst changelogMarkdown = this.changelogMarkdown;\n\tif (!changelogMarkdown && !this.firstRunNoticeVisible) {\n\t\treturn;\n\t}\n\n\tif (changelogMarkdown) {\n\t\tif (targetContainer.children.length > 0) {\n\t\t\ttargetContainer.addChild(new Spacer(1));\n\t\t}\n\t\ttargetContainer.addChild(new DynamicBorder());\n\t\tif (this.settingsManager.getCollapseChangelog()) {\n\t\t\tconst versionMatch = changelogMarkdown.match(\n\t\t\t\t/##\\s+\\[?((?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)(?:-(?:alpha\\.)?(?:0|[1-9]\\d*))?)\\]?/,\n\t\t\t);\n\t\t\tconst latestVersion = versionMatch ? versionMatch[1] : this.version;\n\t\t\tconst condensedText = `Updated to v${latestVersion}. Use ${theme.bold(\"/changelog\")} to view full changelog.`;\n\t\t\ttargetContainer.addChild(new Text(condensedText, 1, 0));\n\t\t} else {\n\t\t\ttargetContainer.addChild(new ThemedText(() => theme.bold(theme.fg(\"accent\", \"What's New\")), 1, 0));\n\t\t\ttargetContainer.addChild(new Spacer(1));\n\t\t\tthis.startupChangelogComponent = this.createChangelogMarkdown(changelogMarkdown.trim(), 1, 0);\n\t\t\ttargetContainer.addChild(this.startupChangelogComponent);\n\t\t\ttargetContainer.addChild(new Spacer(1));\n\t\t}\n\t\ttargetContainer.addChild(new DynamicBorder());\n\t}\n\n\tif (this.firstRunNoticeVisible) {\n\t\tthis.firstRunOnboardingNoticeComponents = [];\n\t\tif (targetContainer.children.length > 0) {\n\t\t\tthis.firstRunOnboardingNoticeComponents.push(new Spacer(1));\n\t\t}\n\t\tthis.firstRunOnboardingNoticeComponents.push(\n\t\t\tnew DynamicBorder(),\n\t\t\tnew Text(ONBOARDING_COPY, 1, 0),\n\t\t\tnew DynamicBorder(),\n\t\t\tnew Spacer(1),\n\t\t);\n\t\tfor (const component of this.firstRunOnboardingNoticeComponents) {\n\t\t\ttargetContainer.addChild(component);\n\t\t}\n\t\t// Mark completion only after queueing the notice in the chat canvas so\n\t\t// launches that skip rendering retry the first-run notice next time.\n\t\tthis.settingsManager.setOnboardedVersion(this.version);\n\t}\n\n\tthis.ui.requestRender();\n};\n\n/** Bring fd, rg, and git to readiness, reporting progress into the transcript. */\nInteractiveModeBase.prototype.ensureManagedToolsReady = function (this: InteractiveModeBase): Promise<void> {\n\tconst statusGeneration = ++this.managedToolStatusGeneration;\n\tconst reportStatus = (status: ToolStatus): void => {\n\t\tif (this.managedToolStatusGeneration === statusGeneration) this.showManagedToolStatus(status);\n\t};\n\t// Autocomplete needs only fd, so a slow rg or git download never delays it.\n\tconst fdReady = ensureTool(\"fd\", reportStatus).then((fdPath) => {\n\t\tthis.fdPath = fdPath;\n\t\tthis.setupAutocompleteProvider();\n\t});\n\treturn Promise.all([fdReady, ensureTool(\"rg\", reportStatus), ensureTool(\"git\", reportStatus)])\n\t\t.then(() => undefined)\n\t\t.catch((error) => {\n\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\treportStatus({ type: \"warning\", message: `Tool readiness check failed: ${message}` });\n\t\t});\n};\n\n/** Show a managed-tool status update in the chat, never on the console. */\nInteractiveModeBase.prototype.showManagedToolStatus = function (this: InteractiveModeBase, status: ToolStatus): void {\n\tif (!this.managedToolStatusStarted) {\n\t\tthis.chatContainer.addChild(new Spacer(1));\n\t\tthis.managedToolStatusStarted = true;\n\t}\n\tconst message = status.type === \"warning\" ? `Warning: ${status.message}` : status.message;\n\tconst color = status.type === \"warning\" ? \"warning\" : \"dim\";\n\tthis.chatContainer.addChild(new ThemedText(() => theme.fg(color, message), 1, 0));\n\tthis.lastStatusSpacer = undefined;\n\tthis.lastStatusText = undefined;\n\tthis.ui.requestRender();\n};\n\nexport function attachInteractiveEngineResourceExtensionRefresh(mode: InteractiveModeBase): () => void {\n\treturn onInteractiveEngineResourceExtensionsChanged(mode.runtimeHost, () => {\n\t\tmode.chatContainer.invalidate();\n\t\tmode.ui.requestRender();\n\t\tif (mode.resourceDisclosureContainer.children.length === 0) return;\n\t\tmode.showLoadedResources({\n\t\t\tforce: true,\n\t\t\tshowDiagnosticsWhenQuiet: true,\n\t\t\ttargetContainer: mode.resourceDisclosureContainer,\n\t\t});\n\t});\n}\n\nexport const STARTUP_DRAFT_HELD_NOTICE = \"Your earlier input is in the prompt; press Enter to send it.\";\n\nInteractiveModeBase.prototype.init = async function (this: InteractiveModeBase): Promise<void> {\n\tif (this.isInitialized) return;\n\n\tif (this.options.holdTuiForStartupTrust) await holdTuiForStartupTrust(this);\n\tthis.registerSignalHandlers();\n\n\t// Keep the transcript in its own viewport and reserve the bottom chrome in a\n\t// fixed dock for the fullscreen renderer. The same components also feed the\n\t// internal main-screen fallback used for guarded terminal paths.\n\tthis.renderWidgets(); // Initialize with default spacer\n\tthis.transcriptScrollView = new ScrollView(this.documentContainer, {\n\t\tfollow: \"end\",\n\t\tprimary: true,\n\t\toverscroll: \"chain\",\n\t\tscrollbar: this.settingsManager.getFullscreenScrollbar(),\n\t\tscrollbarThumbStyle: (text) => theme.bg(\"scrollbarThumb\", text),\n\t});\n\tconst pendingMessagesPreview = {\n\t\trender: (width: number): string[] =>\n\t\t\tthis.navigationInlineCustomUiDepth > 0 ? [] : this.pendingMessagesContainer.render(width),\n\t\tinvalidate: (): void => this.pendingMessagesContainer.invalidate(),\n\t};\n\tconst dock = new VStack([\n\t\t{ component: pendingMessagesPreview, shrink: 1, minSize: 0 },\n\t\t{ component: this.statusContainer, shrink: 1, minSize: 0 },\n\t\t{ component: this.widgetContainerAbove, shrink: 1, minSize: 0 },\n\t\t{ component: this.usageMeter, shrink: 1, minSize: 1 },\n\t\t{ component: this.editorContainer, shrink: 1, minSize: 3 },\n\t\t{ component: this.footerContainer, shrink: 1, minSize: 1 },\n\t\t// Keep widgetContainerBelow after the footer for #1109's stable dock order.\n\t\t{ component: this.widgetContainerBelow, shrink: 1, minSize: 0 },\n\t]);\n\tthis.fullscreenLayoutRoot = new VStack([\n\t\t{ component: this.transcriptScrollView, basis: 0, grow: 1, shrink: 1, minSize: 1 },\n\t\t{ component: dock, basis: \"auto\", grow: 0, shrink: 1, minSize: 1 },\n\t]);\n\tthis.mountInteractiveTui(this.ui, [\n\t\tthis.documentContainer,\n\t\tpendingMessagesPreview,\n\t\tthis.statusContainer,\n\t\tthis.widgetContainerAbove,\n\t\tthis.usageMeter,\n\t\tthis.editorContainer,\n\t\tthis.footerContainer,\n\t\tthis.widgetContainerBelow,\n\t]);\n\tthis.ui.setFocus(this.extensionDialogs.at(-1)?.component ?? this.editor);\n\n\tthis.setupKeyHandlers();\n\tthis.setupEditorSubmitHandler();\n\t// Rebuild autocomplete whenever the engine child's command catalog arrives or\n\t// changes (initial bind, engine restart, reload, new/resume/fork). Subscribed\n\t// before bind so the first async catalog fetch can never be missed. No-op when\n\t// the host is not isolated.\n\tonInteractiveEngineRemoteCommandsChanged(this.runtimeHost, () => {\n\t\tthis.setupAutocompleteProvider();\n\t});\n\tattachInteractiveEngineResourceExtensionRefresh(this);\n\t// Engine stats can land after the last event of a run; repaint so the idle footer shows them.\n\tonInteractiveEngineSessionStatsChanged(this.runtimeHost, () => {\n\t\tthis.ui.requestRender();\n\t});\n\n\tconst startupInput = consumeStartupInput(this.options.startupInputCapture, {\n\t\tstartupDecisionPending: this.options.startupTrustPromptPossible,\n\t});\n\tseedStartupInput(\n\t\tthis.pendingUserInputs,\n\t\tthis.defaultEditor,\n\t\tstartupInput,\n\t\tthis.startupReplayInputs,\n\t\t(text) => {\n\t\t\tthis.startupDraftText = text;\n\t\t},\n\t\t(text) => {\n\t\t\tthis.startupReplayActiveInput = text;\n\t\t},\n\t);\n\n\t// Start and paint the host-owned TUI before waiting for the isolated engine.\n\t// The editor remains local and responsive; session binding and provider work\n\t// still stay behind the engine-bound gate below.\n\tmarkLifecycleTiming(\"tui-start\");\n\tthis.ui.start();\n\tmarkEventLoopStartupComplete();\n\tthis.programStatus.report();\n\tensurePngTranscoder(() => {\n\t\tthis.ui.invalidate();\n\t\tthis.ui.requestRender();\n\t});\n\tthis.disposeMarkitDiagnosticSink = setMarkitDiagnosticSink((message) => renderDiagnosticStatus(message, this));\n\t// A deprecation found once the UI owns the terminal (a settings reload after trust, a tool call) is shown as a\n\t// warning in the chat instead of being written over the screen.\n\tthis.disposeDeprecationWarningSink = installDeprecationWarningSink(this);\n\tthis.footerDataProvider.onBranchChange(() => {\n\t\tthis.ui.requestRender();\n\t});\n\n\tawait this.themeController.applyFromSettings();\n\n\t// Add the quiet startup identity unless silenced.\n\tif (this.shouldShowStartupHeader()) {\n\t\tthis.builtInHeader = new StartupIdentityComponent(this.ui, (width, state) =>\n\t\t\tthis.getStartupIdentityText(width, state.gap, state.manifestoPhase),\n\t\t);\n\n\t\tthis.headerContainer.addChild(new Spacer(1));\n\t\tthis.headerContainer.addChild(this.builtInHeader);\n\t\tthis.headerContainer.addChild(new Spacer(1));\n\t} else {\n\t\t// Minimal header when silenced\n\t\tthis.builtInHeader = new Text(\"\", 0, 0);\n\t\tthis.headerContainer.addChild(this.builtInHeader);\n\t}\n\tthis.showFullscreenModelScopeNotice();\n\tif (startupInput.heldForStartupDecision && startupInput.text.length > 0) {\n\t\tthis.startupNoticesContainer.addChild(new Spacer(1));\n\t\tthis.startupNoticesContainer.addChild(new Text(theme.fg(\"dim\", STARTUP_DRAFT_HELD_NOTICE), 1, 0));\n\t}\n\tmarkLifecycleTiming(\"header-mounted\");\n\tthis.ui.requestRender();\n\t// This legacy mark now means the first requested identity frame. The settled\n\t// animation frame remains the external benchmark's startup-complete mark.\n\trecordTimeSinceReset(\"time-to-first-frame\");\n\n\tawait waitForInteractiveEngineBound(this.runtimeHost);\n\tif (this.isShuttingDown) return;\n\tthis.isInitialized = true;\n\t// The isolated engine may have replaced the preliminary model/provider view.\n\tthis.ui.requestRender();\n\n\t// fd/rg readiness runs after first paint so slow downloads never make\n\t// startup appear frozen. Progress reports land in the transcript: a console\n\t// write here lands in the alternate screen and corrupts the frame.\n\tvoid this.ensureManagedToolsReady();\n\n\t// When startup resources are deferred, keep the already-painted editor responsive.\n\t// Extension UI bindings are installed at the deferred reload boundary, not here,\n\t// so no post-paint resource work can block visible typing.\n\tif (this.deferredStartupPending) {\n\t\tthis.applyRuntimeSettings();\n\t\tthis.subscribeToAgent();\n\t\tthis.updateEditorBorderColor();\n\t\tthis.updateTerminalTitle();\n\t} else {\n\t\tawait preloadChangelog(getChangelogPath());\n\t\tawait bindInitialEagerSession(this);\n\t\tvoid reportUnavailableTools(this);\n\t}\n\n\tthis.attachStartupNoticesContainer();\n\t// Render initial messages AFTER the initial session binding is in place.\n\tthis.renderInitialMessages();\n\tif (!this.deferredStartupPending) this.startSessionRecovery(\"startup\");\n\t// Set up theme file watcher\n\tonThemeChange(() => {\n\t\tthis.ui.invalidate();\n\t\tthis.updateEditorBorderColor();\n\t\tthis.ui.requestRender();\n\t});\n\n\tupdateProviderCountFromSnapshot(this);\n};\n\nInteractiveModeBase.prototype.updateTerminalTitle = function (this: InteractiveModeBase): void {\n\tconst cwdBasename = path.basename(this.sessionManager.getCwd());\n\tconst sessionName = this.sessionManager.getSessionName();\n\t// Session names come from session files: a BEL or ESC in the title would end the OSC title sequence early and send\n\t// the rest to the terminal as escape sequences.\n\tconst title = sessionName ? `${APP_TITLE} - ${sessionName} - ${cwdBasename}` : `${APP_TITLE} - ${cwdBasename}`;\n\tthis.ui.terminal.setTitle(replaceControlCharacters(title));\n};\n\n/**\n * Shows how a resumed session's checkout was prepared with the startup notices, which survive the chat rebuild that\n * follows deferred startup.\n */\n/**\n * Show deprecation warnings in the UI once it owns the terminal, instead of writing them over the screen. A warning\n * raised while deferred startup is still pending (accepting startup project trust loads the project's settings) joins the\n * retained startup notices: deferred startup rebuilds the chat before releasing it, and that rebuild would drop it.\n */\nexport function installDeprecationWarningSink(mode: InteractiveModeBase): () => void {\n\treturn setDeprecationWarningSink((message) =>\n\t\tmode.showWarning(message, mode.deferredStartupPending ? mode.startupNoticesContainer : mode.chatContainer),\n\t);\n}\n\nexport function showResumeNotices(\n\tmode: Pick<InteractiveModeBase, \"startupNoticesContainer\" | \"showWarning\">,\n\tnotices: readonly { readonly type: \"info\" | \"warning\"; readonly message: string }[] | undefined,\n): void {\n\tfor (const notice of notices ?? []) {\n\t\tif (notice.type === \"warning\") mode.showWarning(notice.message, mode.startupNoticesContainer);\n\t\telse {\n\t\t\tmode.startupNoticesContainer.addChild(new Spacer(1));\n\t\t\tmode.startupNoticesContainer.addChild(new Text(theme.fg(\"dim\", notice.message), 1, 0));\n\t\t}\n\t}\n}\n\nInteractiveModeBase.prototype.run = async function (this: InteractiveModeBase): Promise<void> {\n\tawait this.init();\n\tif (this.isShuttingDown) return;\n\n\tif (shouldRefreshCatalogsOnStartup()) void refreshCatalogsAfterTuiStartup(this);\n\n\tsetTimeout(() => {\n\t\tconst startupNoticesContainer = this.startupNoticesContainer;\n\t\tcheckForNewPiVersion(this.version).then((newVersion) => {\n\t\t\tif (newVersion) this.showNewVersionNotification(newVersion, startupNoticesContainer);\n\t\t});\n\t\trestoreTerminalTitleAfterPackageCheck(this.checkForPackageUpdates(), {\n\t\t\tinitialized: () => this.isInitialized,\n\t\t\trestore: () => this.updateTerminalTitle(),\n\t\t}).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// Deferred startup releases chat output immediately after rendering the\n\t\t// disclosure, so wait only while that startup work remains in flight.\n\t\tif (!this.deferredStartupPending && !this.deferredStartupPromise) {\n\t\t\tvoid this.maybeWarnAboutAnthropicSubscriptionAuth(undefined, startupNoticesContainer);\n\t\t}\n\t}, 500);\n\n\t// Show startup warnings\n\tconst { migratedProviders, startupDiagnostics, resumeNotices, initialMessage, initialImages, initialMessages } =\n\t\tthis.options;\n\n\tshowSessionNotices(this, startupDiagnostics);\n\tshowResumeNotices(this, resumeNotices);\n\n\tif (migratedProviders && migratedProviders.length > 0) {\n\t\tthis.showWarning(`Migrated credentials to auth.json: ${migratedProviders.join(\", \")}`);\n\t}\n\n\tconst modelsJsonError = this.session.modelRuntime.getError();\n\tif (modelsJsonError) {\n\t\tthis.showError(`models.json error: ${modelsJsonError}`);\n\t}\n\n\tconst modelFallbackMessage = this.runtimeHost.modelFallbackMessage;\n\tif (modelFallbackMessage && !this.deferredStartupPending) {\n\t\tthis.showWarning(modelFallbackMessage, this.startupNoticesContainer);\n\t}\n\n\t// CLI-provided startup prompts need extension tools/resources; wait before sending them,\n\t// but do not block the normal no-prompt input loop from becoming ready.\n\tif (this.deferredStartupPending && (initialMessage || (initialMessages && initialMessages.length > 0))) {\n\t\tawait this.ensureDeferredStartupComplete();\n\t}\n\n\t// Process initial messages\n\tif (initialMessage) {\n\t\ttry {\n\t\t\tawait this.session.prompt(initialMessage, { images: initialImages });\n\t\t} catch (error: unknown) {\n\t\t\tconst errorMessage = error instanceof Error ? error.message : \"Unknown error occurred\";\n\t\t\tthis.showError(errorMessage);\n\t\t}\n\t}\n\n\tif (initialMessages) {\n\t\tfor (const message of initialMessages) {\n\t\t\ttry {\n\t\t\t\tawait this.session.prompt(message);\n\t\t\t} catch (error: unknown) {\n\t\t\t\tconst errorMessage = error instanceof Error ? error.message : \"Unknown error occurred\";\n\t\t\t\tthis.showError(errorMessage);\n\t\t\t}\n\t\t}\n\t}\n\n\t// Main interactive loop\n\twhile (true) {\n\t\tconst userInput = await this.getUserInput();\n\t\tawait this.runUserPromptTurn(userInput);\n\t}\n};\n\nInteractiveModeBase.prototype.checkForPackageUpdates = async function (this: InteractiveModeBase): Promise<string[]> {\n\tif (getEnvValue(ENV_OFFLINE)) {\n\t\treturn [];\n\t}\n\n\ttry {\n\t\tconst packageManager = new DefaultPackageManager({\n\t\t\tcwd: this.sessionManager.getCwd(),\n\t\t\tagentDir: getAgentDir(),\n\t\t\tsettingsManager: this.settingsManager,\n\t\t});\n\t\tconst updates = await packageManager.checkForAvailableUpdates();\n\t\treturn updates.map((update) => update.displayName);\n\t} catch {\n\t\treturn [];\n\t}\n};\n\nInteractiveModeBase.prototype.checkTmuxKeyboardSetup = async function (\n\tthis: InteractiveModeBase,\n): Promise<string | undefined> {\n\tif (!process.env.TMUX) return undefined;\n\n\tconst runTmuxShow = (option: string): Promise<string | undefined> => {\n\t\treturn new Promise((resolve) => {\n\t\t\tconst proc = spawn(\"tmux\", [\"show\", \"-gv\", option], {\n\t\t\t\tstdio: [\"ignore\", \"pipe\", \"ignore\"],\n\t\t\t\tenv: createChildProcessEnvironment(),\n\t\t\t});\n\t\t\tlet stdout = \"\";\n\t\t\tconst timer = setTimeout(() => {\n\t\t\t\tproc.kill();\n\t\t\t\tresolve(undefined);\n\t\t\t}, 2000);\n\n\t\t\tproc.stdout?.on(\"data\", (data) => {\n\t\t\t\tstdout += data.toString();\n\t\t\t});\n\t\t\tproc.on(\"error\", () => {\n\t\t\t\tclearTimeout(timer);\n\t\t\t\tresolve(undefined);\n\t\t\t});\n\t\t\tproc.on(\"close\", (code) => {\n\t\t\t\tclearTimeout(timer);\n\t\t\t\tresolve(code === 0 ? stdout.trim() : undefined);\n\t\t\t});\n\t\t});\n\t};\n\n\tconst [extendedKeys, extendedKeysFormat] = await Promise.all([\n\t\trunTmuxShow(\"extended-keys\"),\n\t\trunTmuxShow(\"extended-keys-format\"),\n\t]);\n\n\t// If we couldn't query tmux (timeout, sandbox, etc.), don't warn\n\tif (extendedKeys === undefined) return undefined;\n\n\tif (extendedKeys !== \"on\" && extendedKeys !== \"always\") {\n\t\treturn \"tmux extended-keys is off. Modified enter keys may not work. Add `set -g extended-keys on` to ~/.tmux.conf and restart tmux.\";\n\t}\n\n\tif (extendedKeysFormat === \"xterm\") {\n\t\treturn `tmux extended-keys-format is xterm. ${APP_TITLE} works best with csi-u. Add \\`set -g extended-keys-format csi-u\\` to ~/.tmux.conf and restart tmux.`;\n\t}\n\n\treturn undefined;\n};\n\nconst FULL_CHANGELOG_HINT = \"Run `/changelog` for the full list of changes.\";\n\nInteractiveModeBase.prototype.getChangelogForDisplay = function (this: InteractiveModeBase): string | undefined {\n\t// Skip changelog for resumed/continued sessions (already have messages)\n\tif (this.session.state.messages.length > 0) {\n\t\treturn undefined;\n\t}\n\n\tconst lastVersion = this.settingsManager.getLastChangelogVersion();\n\tif (!lastVersion) {\n\t\t// Fresh install - record the version, send telemetry, don't show changelog\n\t\tthis.settingsManager.setLastChangelogVersion(VERSION);\n\t\tthis.reportInstallTelemetry(VERSION);\n\t\treturn undefined;\n\t}\n\n\tconst changelogPath = getChangelogPath();\n\tconst entries = getCachedChangelog(changelogPath);\n\n\tconst newEntries = getNewEntries(entries, lastVersion, VERSION);\n\tconst currentEntries = getEntriesForVersion(newEntries, VERSION);\n\tif (currentEntries.length > 0) {\n\t\tthis.settingsManager.setLastChangelogVersion(VERSION);\n\t\tthis.reportInstallTelemetry(VERSION);\n\t\treturn currentEntries\n\t\t\t.map((e) => {\n\t\t\t\tconst highlights = getChangelogHighlights(e);\n\t\t\t\tif (!highlights) return normalizeChangelogLinks(e.content, e);\n\t\t\t\tconst [heading] = e.content.split(\"\\n\");\n\t\t\t\treturn normalizeChangelogLinks(`${heading}\\n\\n${highlights}\\n\\n${FULL_CHANGELOG_HINT}`, e);\n\t\t\t})\n\t\t\t.join(\"\\n\\n\");\n\t}\n\n\treturn undefined;\n};\n\nInteractiveModeBase.prototype.reportInstallTelemetry = function (this: InteractiveModeBase, version: string): void {\n\tif (getEnvValue(ENV_OFFLINE)) {\n\t\treturn;\n\t}\n\n\tif (!isInstallTelemetryEnabled(this.settingsManager)) {\n\t\treturn;\n\t}\n\n\tvoid fetch(`${VERSION_ADOPTION_ENDPOINT}?version=${encodeURIComponent(version)}`, {\n\t\theaders: {\n\t\t\t\"User-Agent\": getPiUserAgent(version),\n\t\t},\n\t\tsignal: AbortSignal.timeout(5000),\n\t})\n\t\t.then(() => undefined)\n\t\t.catch(() => undefined);\n};\n\nInteractiveModeBase.prototype.getMarkdownThemeWithSettings = function (this: InteractiveModeBase): MarkdownTheme {\n\treturn {\n\t\t...getMarkdownTheme(),\n\t\tcodeBlockIndent: this.settingsManager.getCodeBlockIndent(),\n\t};\n};\n\nInteractiveModeBase.prototype.formatDisplayPath = function (this: InteractiveModeBase, p: string): string {\n\treturn shortenHomePath(p);\n};\n\nInteractiveModeBase.prototype.formatExtensionDisplayPath = function (this: InteractiveModeBase, path: string): string {\n\treturn this.formatDisplayPath(path).replace(/[\\\\/]index\\.(?:ts|js)$/, \"\");\n};\n\nInteractiveModeBase.prototype.formatContextPath = function (this: InteractiveModeBase, p: string): string {\n\tconst cwd = path.resolve(this.sessionManager.getCwd());\n\tconst absolutePath = path.isAbsolute(p) ? path.resolve(p) : path.resolve(cwd, p);\n\tconst relativePath = getCwdRelativePath(absolutePath, cwd);\n\tif (relativePath !== undefined) {\n\t\treturn relativePath;\n\t}\n\n\treturn this.formatDisplayPath(absolutePath);\n};\n\nInteractiveModeBase.prototype.getStartupModelLabel = function (this: InteractiveModeBase): string {\n\tconst model = this.session.state.model;\n\treturn model ? formatModelLabel(model, { thinkingLevel: this.session.thinkingLevel || \"off\" }) : \"no-model\";\n};\n\nInteractiveModeBase.prototype.getStartupIdentityText = function (\n\tthis: InteractiveModeBase,\n\tmaxWidth?: number,\n\tgap = 0,\n\tmanifestoPhase = 4,\n): string {\n\tconst appLabel = APP_NAME.length > 0 ? `${APP_NAME[0]!.toUpperCase()}${APP_NAME.slice(1)}` : \"Atomic\";\n\tconst fg = (role: \"text\" | \"muted\" | \"dim\", text: string): string => theme.fg(role, text);\n\tconst showMark = supportsAtomicBanner();\n\tconst wordmark = showMark ? \"\" : `${atomicWordmark()} `;\n\tconst title = `${wordmark}${theme.bold(fg(\"text\", appLabel))} ${fg(\"muted\", `v${this.version}`)}`;\n\tconst modelLine = fg(\"muted\", this.getStartupModelLabel());\n\tconst markLines = showMark ? this.getAtomicAnsiMarkLines(gap) : [];\n\tconst markWidth = Math.max(0, ...markLines.map(visibleWidth));\n\tconst showMeta = gap === 0 || (maxWidth !== undefined && maxWidth < markWidth);\n\tconst metaLines = showMeta\n\t\t? [title, modelLine, fg(\"muted\", this.formatDisplayPath(this.sessionManager.getCwd()))]\n\t\t: [];\n\treturn composeStartupIdentity(\n\t\tmarkLines,\n\t\tmetaLines,\n\t\tmaxWidth,\n\t\tgap === 0 ? renderStartupManifesto(manifestoPhase) : [],\n\t);\n};\n\nInteractiveModeBase.prototype.getAtomicAnsiMarkLines = function (this: InteractiveModeBase, gap = 0): string[] {\n\treturn renderAtomicAssemblyBanner(gap, theme, this.session.thinkingLevel || \"off\");\n};\n\nInteractiveModeBase.prototype.getStartupExpansionState = function (this: InteractiveModeBase): boolean {\n\treturn this.options.verbose || this.toolOutputExpanded;\n};\n\n/**\n * Fullscreen paints on the alternate screen, so the \"Model scope\" line cannot be printed to stdout there\n * (it would stay in the shell after exit); it goes below the header instead (upstream #11508).\n */\nInteractiveModeBase.prototype.showFullscreenModelScopeNotice = function (this: InteractiveModeBase): void {\n\tconst notice = this.options.modelScopeNotice;\n\tif (!notice || !this.usesFullscreenRenderer) return;\n\tthis.headerContainer.addChild(new ThemedText(() => theme.fg(\"dim\", notice), 1, 0));\n\tthis.headerContainer.addChild(new Spacer(1));\n};\n\nInteractiveModeBase.prototype.shouldShowStartupHeader = function (this: InteractiveModeBase): boolean {\n\treturn this.options.verbose === true || this.settingsManager.getQuietStartup() !== true;\n};\n\nInteractiveModeBase.prototype.shouldShowStartupDetails = function (this: InteractiveModeBase): boolean {\n\treturn this.options.verbose === true || this.settingsManager.getQuietStartup() === false;\n};\n"]}
|
|
@@ -1,7 +1,28 @@
|
|
|
1
1
|
import type { ColorValue } from "./theme-schema.ts";
|
|
2
2
|
export type ColorMode = "truecolor" | "256color";
|
|
3
3
|
export type ThemeStyleLevel = 0 | 1 | 2 | 3;
|
|
4
|
-
|
|
4
|
+
/** What NO_COLOR and FORCE_COLOR ask for: color off, a forced level, or the terminal's own color mode. */
|
|
5
|
+
export type ColorEnvironment = {
|
|
6
|
+
readonly off: true;
|
|
7
|
+
} | {
|
|
8
|
+
readonly off: false;
|
|
9
|
+
readonly forced?: ThemeStyleLevel;
|
|
10
|
+
};
|
|
11
|
+
/** A theme that repaints its palette when the color environment is read again. */
|
|
12
|
+
export interface ColorEnvironmentListener {
|
|
13
|
+
applyColorEnvironment(environment: ColorEnvironment): void;
|
|
14
|
+
}
|
|
15
|
+
export declare function readColorEnvironment(env?: NodeJS.ProcessEnv): ColorEnvironment;
|
|
16
|
+
/**
|
|
17
|
+
* The color environment themes paint with. It is read when the first theme is created and again by
|
|
18
|
+
* {@link refreshColorEnvironment}, which theme loads and switches call; painting never reads the environment.
|
|
19
|
+
*/
|
|
20
|
+
export declare function colorEnvironment(): ColorEnvironment;
|
|
21
|
+
/** Keep `listener` (held weakly) on the color environment in use from now on. */
|
|
22
|
+
export declare function onColorEnvironmentChange(listener: ColorEnvironmentListener): void;
|
|
23
|
+
/** Read NO_COLOR and FORCE_COLOR again and apply them to every theme; tests that change them call it too. */
|
|
24
|
+
export declare function refreshColorEnvironment(env?: NodeJS.ProcessEnv): ColorEnvironment;
|
|
25
|
+
export declare function themeStyleLevel(mode: ColorMode, environment: ColorEnvironment): ThemeStyleLevel;
|
|
5
26
|
export declare function detectColorMode(): ColorMode;
|
|
6
27
|
/**
|
|
7
28
|
* Resolve the color mode for a theme from an explicit `terminal.trueColor` setting, then
|
|
@@ -19,6 +40,13 @@ export declare function hexToRgb(hex: string): {
|
|
|
19
40
|
*/
|
|
20
41
|
export type Quantization = "nearest" | "preserve-hue";
|
|
21
42
|
export declare function fgAnsi(color: string | number, mode: ColorMode): string;
|
|
43
|
+
/**
|
|
44
|
+
* The escape sequence that sets the `#rrggbb` color `hex` as the foreground or background, in the color environment
|
|
45
|
+
* themes paint with: none when NO_COLOR or FORCE_COLOR=0 turns color off, the nearest 256-color entry under
|
|
46
|
+
* FORCE_COLOR=1 or 2, and true color otherwise. Code that builds its own colors uses it to follow NO_COLOR and
|
|
47
|
+
* FORCE_COLOR like the theme does; it never reads the environment itself.
|
|
48
|
+
*/
|
|
49
|
+
export declare function hexColorAnsi(hex: string, layer: "fg" | "bg"): string;
|
|
22
50
|
export declare function bgAnsi(color: string | number, mode: ColorMode, quantization?: Quantization): string;
|
|
23
51
|
export declare function resolveVarRefs(value: ColorValue, vars: Record<string, ColorValue>, visited?: Set<string>): string | number;
|
|
24
52
|
export declare function resolveThemeColors<T extends Record<string, ColorValue>>(colors: T, vars?: Record<string, ColorValue>): Record<keyof T, string | number>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color-utils.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/theme/color-utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,MAAM,SAAS,GAAG,WAAW,GAAG,UAAU,CAAC;AACjD,MAAM,MAAM,eAAe,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAE5C,
|
|
1
|
+
{"version":3,"file":"color-utils.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/theme/color-utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,MAAM,SAAS,GAAG,WAAW,GAAG,UAAU,CAAC;AACjD,MAAM,MAAM,eAAe,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAE5C,0GAA0G;AAC1G,MAAM,MAAM,gBAAgB,GAAG;IAAE,QAAQ,CAAC,GAAG,EAA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AAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,GAAE,YAAwB,GAAG,MAAM,CAa9G;AAED,wBAAgB,cAAc,CAC7B,KAAK,EAAE,UAAU,EACjB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,EAChC,OAAO,cAAoB,GACzB,MAAM,GAAG,MAAM,CAajB;AAED,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,EACtE,MAAM,EAAE,CAAC,EACT,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAM,GACnC,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,CAMlC;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAsClD"}
|
|
@@ -1,19 +1,60 @@
|
|
|
1
1
|
import { colorToHex, parseColor } from "@bastani/atomic-tui";
|
|
2
|
-
|
|
2
|
+
const COLOR_ENVIRONMENT_KEY = Symbol.for("@bastani/atomic:theme-color-environment");
|
|
3
|
+
/** Shared across module instances, like the global theme, so every loaded copy of the theme module agrees. */
|
|
4
|
+
function colorEnvironmentState() {
|
|
5
|
+
const store = globalThis;
|
|
6
|
+
let state = store[COLOR_ENVIRONMENT_KEY];
|
|
7
|
+
if (!state) {
|
|
8
|
+
state = { environment: readColorEnvironment(), listeners: new Set() };
|
|
9
|
+
store[COLOR_ENVIRONMENT_KEY] = state;
|
|
10
|
+
}
|
|
11
|
+
return state;
|
|
12
|
+
}
|
|
13
|
+
export function readColorEnvironment(env = process.env) {
|
|
3
14
|
if (env.NO_COLOR !== undefined)
|
|
4
|
-
return
|
|
15
|
+
return { off: true };
|
|
5
16
|
if (env.FORCE_COLOR !== undefined) {
|
|
6
17
|
const forced = env.FORCE_COLOR.trim().toLowerCase();
|
|
7
18
|
if (forced === "0" || forced === "false")
|
|
8
|
-
return
|
|
19
|
+
return { off: true };
|
|
9
20
|
if (forced === "1" || forced === "true" || forced === "")
|
|
10
|
-
return 1;
|
|
21
|
+
return { off: false, forced: 1 };
|
|
11
22
|
if (forced === "2")
|
|
12
|
-
return 2;
|
|
23
|
+
return { off: false, forced: 2 };
|
|
13
24
|
if (forced === "3")
|
|
14
|
-
return 3;
|
|
25
|
+
return { off: false, forced: 3 };
|
|
26
|
+
}
|
|
27
|
+
return { off: false };
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The color environment themes paint with. It is read when the first theme is created and again by
|
|
31
|
+
* {@link refreshColorEnvironment}, which theme loads and switches call; painting never reads the environment.
|
|
32
|
+
*/
|
|
33
|
+
export function colorEnvironment() {
|
|
34
|
+
return colorEnvironmentState().environment;
|
|
35
|
+
}
|
|
36
|
+
/** Keep `listener` (held weakly) on the color environment in use from now on. */
|
|
37
|
+
export function onColorEnvironmentChange(listener) {
|
|
38
|
+
colorEnvironmentState().listeners.add(new WeakRef(listener));
|
|
39
|
+
}
|
|
40
|
+
/** Read NO_COLOR and FORCE_COLOR again and apply them to every theme; tests that change them call it too. */
|
|
41
|
+
export function refreshColorEnvironment(env = process.env) {
|
|
42
|
+
const state = colorEnvironmentState();
|
|
43
|
+
const next = readColorEnvironment(env);
|
|
44
|
+
state.environment = next;
|
|
45
|
+
for (const reference of state.listeners) {
|
|
46
|
+
const listener = reference.deref();
|
|
47
|
+
if (listener === undefined)
|
|
48
|
+
state.listeners.delete(reference);
|
|
49
|
+
else
|
|
50
|
+
listener.applyColorEnvironment(next);
|
|
15
51
|
}
|
|
16
|
-
return
|
|
52
|
+
return next;
|
|
53
|
+
}
|
|
54
|
+
export function themeStyleLevel(mode, environment) {
|
|
55
|
+
if (environment.off)
|
|
56
|
+
return 0;
|
|
57
|
+
return environment.forced ?? (mode === "truecolor" ? 3 : 2);
|
|
17
58
|
}
|
|
18
59
|
export function detectColorMode() {
|
|
19
60
|
const colorterm = process.env.COLORTERM;
|
|
@@ -171,6 +212,39 @@ export function fgAnsi(color, mode) {
|
|
|
171
212
|
}
|
|
172
213
|
throw new Error(`Invalid color value: ${color}`);
|
|
173
214
|
}
|
|
215
|
+
/** Distinct `#rrggbb` colors kept per color environment by {@link hexColorAnsi}; past it the cache starts over. */
|
|
216
|
+
const HEX_COLOR_SEQUENCE_CACHE_LIMIT = 1024;
|
|
217
|
+
const hexColorSequences = {
|
|
218
|
+
environment: undefined,
|
|
219
|
+
fg: new Map(),
|
|
220
|
+
bg: new Map(),
|
|
221
|
+
};
|
|
222
|
+
/**
|
|
223
|
+
* The escape sequence that sets the `#rrggbb` color `hex` as the foreground or background, in the color environment
|
|
224
|
+
* themes paint with: none when NO_COLOR or FORCE_COLOR=0 turns color off, the nearest 256-color entry under
|
|
225
|
+
* FORCE_COLOR=1 or 2, and true color otherwise. Code that builds its own colors uses it to follow NO_COLOR and
|
|
226
|
+
* FORCE_COLOR like the theme does; it never reads the environment itself.
|
|
227
|
+
*/
|
|
228
|
+
export function hexColorAnsi(hex, layer) {
|
|
229
|
+
const environment = colorEnvironment();
|
|
230
|
+
if (environment.off)
|
|
231
|
+
return "";
|
|
232
|
+
if (hexColorSequences.environment !== environment) {
|
|
233
|
+
hexColorSequences.environment = environment;
|
|
234
|
+
hexColorSequences.fg.clear();
|
|
235
|
+
hexColorSequences.bg.clear();
|
|
236
|
+
}
|
|
237
|
+
const cache = hexColorSequences[layer];
|
|
238
|
+
let sequence = cache.get(hex);
|
|
239
|
+
if (sequence === undefined) {
|
|
240
|
+
const mode = environment.forced === 1 || environment.forced === 2 ? "256color" : "truecolor";
|
|
241
|
+
sequence = layer === "fg" ? fgAnsi(hex, mode) : bgAnsi(hex, mode);
|
|
242
|
+
if (cache.size >= HEX_COLOR_SEQUENCE_CACHE_LIMIT)
|
|
243
|
+
cache.clear();
|
|
244
|
+
cache.set(hex, sequence);
|
|
245
|
+
}
|
|
246
|
+
return sequence;
|
|
247
|
+
}
|
|
174
248
|
export function bgAnsi(color, mode, quantization = "nearest") {
|
|
175
249
|
if (color === "")
|
|
176
250
|
return "\x1b[49m";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color-utils.js","sourceRoot":"","sources":["../../../../src/modes/interactive/theme/color-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAM7D,MAAM,UAAU,sBAAsB,CAAC,IAAe,EAAE,GAAG,GAAsB,OAAO,CAAC,GAAG;IAC3F,IAAI,GAAG,CAAC,QAAQ,KAAK,SAAS;QAAE,OAAO,CAAC,CAAC;IACzC,IAAI,GAAG,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;QACnC,MAAM,MAAM,GAAG,GAAG,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;QACpD,IAAI,MAAM,KAAK,GAAG,IAAI,MAAM,KAAK,OAAO;YAAE,OAAO,CAAC,CAAC;QACnD,IAAI,MAAM,KAAK,GAAG,IAAI,MAAM,KAAK,MAAM,IAAI,MAAM,KAAK,EAAE;YAAE,OAAO,CAAC,CAAC;QACnE,IAAI,MAAM,KAAK,GAAG;YAAE,OAAO,CAAC,CAAC;QAC7B,IAAI,MAAM,KAAK,GAAG;YAAE,OAAO,CAAC,CAAC;IAC9B,CAAC;IACD,OAAO,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACrC,CAAC;AAED,MAAM,UAAU,eAAe;IAC9B,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC;IACxC,IAAI,SAAS,KAAK,WAAW,IAAI,SAAS,KAAK,OAAO,EAAE,CAAC;QACxD,OAAO,WAAW,CAAC;IACpB,CAAC;IACD,sCAAsC;IACtC,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC;QAC5B,OAAO,WAAW,CAAC;IACpB,CAAC;IACD,MAAM,IAAI,GAAG,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C,SAAS,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;QAC3C,MAAM,CAAC,GAAG,SAAS,GAAG,CAAC,CAAC;QACxB,MAAM,KAAK,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QACvF,OAAO,IAAI,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;IAC7C,CAAC;IAED,iCAAiC;IACjC,MAAM,IAAI,GAAG,CAAC,GAAG,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,EAAE,CAAC;IACpC,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACnD,OAAO,IAAI,OAAO,GAAG,OAAO,GAAG,OAAO,EAAE,CAAC;AAC1C,CAAC","sourcesContent":["import { colorToHex, parseColor } from \"@bastani/atomic-tui\";\nimport type { ColorValue } from \"./theme-schema.ts\";\n\nexport type ColorMode = \"truecolor\" | \"256color\";\nexport type ThemeStyleLevel = 0 | 1 | 2 | 3;\n\nexport function resolveThemeStyleLevel(mode: ColorMode, env: NodeJS.ProcessEnv = process.env): ThemeStyleLevel {\n\tif (env.NO_COLOR !== undefined) return 0;\n\tif (env.FORCE_COLOR !== undefined) {\n\t\tconst forced = env.FORCE_COLOR.trim().toLowerCase();\n\t\tif (forced === \"0\" || forced === \"false\") return 0;\n\t\tif (forced === \"1\" || forced === \"true\" || forced === \"\") return 1;\n\t\tif (forced === \"2\") return 2;\n\t\tif (forced === \"3\") return 3;\n\t}\n\treturn mode === \"truecolor\" ? 3 : 2;\n}\n\nexport function detectColorMode(): ColorMode {\n\tconst colorterm = process.env.COLORTERM;\n\tif (colorterm === \"truecolor\" || colorterm === \"24bit\") {\n\t\treturn \"truecolor\";\n\t}\n\t// Windows Terminal supports truecolor\n\tif (process.env.WT_SESSION) {\n\t\treturn \"truecolor\";\n\t}\n\tconst term = process.env.TERM || \"\";\n\t// Fall back to 256color for truly limited terminals\n\tif (term === \"dumb\" || term === \"\" || term === \"linux\") {\n\t\treturn \"256color\";\n\t}\n\t// Terminal.app also doesn't support truecolor\n\tif (process.env.TERM_PROGRAM === \"Apple_Terminal\") {\n\t\treturn \"256color\";\n\t}\n\t// GNU screen doesn't support truecolor unless explicitly opted in via COLORTERM=truecolor.\n\t// TERM under screen is typically \"screen\", \"screen-256color\", or \"screen.xterm-256color\".\n\tif (term === \"screen\" || term.startsWith(\"screen-\") || term.startsWith(\"screen.\")) {\n\t\treturn \"256color\";\n\t}\n\t// Assume truecolor for everything else - virtually all modern terminals support it\n\treturn \"truecolor\";\n}\n\n/**\n * Resolve the color mode for a theme from an explicit `terminal.trueColor` setting, then\n * `ATOMIC_TRUE_COLOR=1|0` (legacy `PI_TRUE_COLOR`), then terminal detection.\n */\nexport function resolveColorMode(trueColorSetting: boolean | undefined): ColorMode {\n\tconst envOverride = process.env.ATOMIC_TRUE_COLOR ?? process.env.PI_TRUE_COLOR;\n\tconst trueColor = trueColorSetting ?? (envOverride === \"1\" ? true : envOverride === \"0\" ? false : undefined);\n\tif (trueColor === undefined) return detectColorMode();\n\treturn trueColor ? \"truecolor\" : \"256color\";\n}\n\nexport function hexToRgb(hex: string): { r: number; g: number; b: number } {\n\tconst cleaned = hex.replace(\"#\", \"\");\n\tif (cleaned.length !== 6) {\n\t\tthrow new Error(`Invalid hex color: ${hex}`);\n\t}\n\tconst r = parseInt(cleaned.substring(0, 2), 16);\n\tconst g = parseInt(cleaned.substring(2, 4), 16);\n\tconst b = parseInt(cleaned.substring(4, 6), 16);\n\tif (Number.isNaN(r) || Number.isNaN(g) || Number.isNaN(b)) {\n\t\tthrow new Error(`Invalid hex color: ${hex}`);\n\t}\n\treturn { r, g, b };\n}\n\n// The 6x6x6 color cube channel values (indices 0-5)\nconst CUBE_VALUES = [0, 95, 135, 175, 215, 255];\n\n// Grayscale ramp values (indices 232-255, 24 grays from 8 to 238)\nconst GRAY_VALUES = Array.from({ length: 24 }, (_, i) => 8 + i * 10);\n\nfunction findClosestCubeIndex(value: number): number {\n\tlet minDist = Infinity;\n\tlet minIdx = 0;\n\tfor (let i = 0; i < CUBE_VALUES.length; i++) {\n\t\tconst dist = Math.abs(value - CUBE_VALUES[i]);\n\t\tif (dist < minDist) {\n\t\t\tminDist = dist;\n\t\t\tminIdx = i;\n\t\t}\n\t}\n\treturn minIdx;\n}\n\nfunction findClosestGrayIndex(r: number, g: number, b: number): number {\n\tlet minDist = Infinity;\n\tlet minIdx = 0;\n\tfor (let i = 0; i < GRAY_VALUES.length; i++) {\n\t\tconst value = GRAY_VALUES[i];\n\t\tconst dist = colorDistance(r, g, b, value, value, value);\n\t\tif (dist < minDist) {\n\t\t\tminDist = dist;\n\t\t\tminIdx = i;\n\t\t}\n\t}\n\treturn minIdx;\n}\n\nfunction colorDistance(r1: number, g1: number, b1: number, r2: number, g2: number, b2: number): number {\n\t// Weighted Euclidean distance (human eye is more sensitive to green)\n\tconst dr = r1 - r2;\n\tconst dg = g1 - g2;\n\tconst db = b1 - b2;\n\treturn dr * dr * 0.299 + dg * dg * 0.587 + db * db * 0.114;\n}\n\nfunction rgbTo256(r: number, g: number, b: number): number {\n\t// Find closest color in the 6x6x6 cube\n\tconst rIdx = findClosestCubeIndex(r);\n\tconst gIdx = findClosestCubeIndex(g);\n\tconst bIdx = findClosestCubeIndex(b);\n\tconst cubeR = CUBE_VALUES[rIdx];\n\tconst cubeG = CUBE_VALUES[gIdx];\n\tconst cubeB = CUBE_VALUES[bIdx];\n\tconst cubeIndex = 16 + 36 * rIdx + 6 * gIdx + bIdx;\n\tconst cubeDist = colorDistance(r, g, b, cubeR, cubeG, cubeB);\n\n\t// Find closest grayscale\n\tconst grayIdx = findClosestGrayIndex(r, g, b);\n\tconst grayValue = GRAY_VALUES[grayIdx];\n\tconst grayIndex = 232 + grayIdx;\n\tconst grayDist = colorDistance(r, g, b, grayValue, grayValue, grayValue);\n\n\t// Prefer the cube on equal distances.\n\tif (grayDist < cubeDist) {\n\t\treturn grayIndex;\n\t}\n\n\treturn cubeIndex;\n}\n\n/**\n * `nearest` picks the closest cube or grayscale entry. `preserve-hue` picks the closest entry whose strongest\n * channels are the same as the input's, so a tinted color keeps its hue instead of collapsing to a gray.\n */\nexport type Quantization = \"nearest\" | \"preserve-hue\";\n\ninterface PaletteEntry {\n\tindex: number;\n\tr: number;\n\tg: number;\n\tb: number;\n}\n\nconst PALETTE_256: PaletteEntry[] = [\n\t...Array.from({ length: 216 }, (_, offset) => ({\n\t\tindex: 16 + offset,\n\t\tr: CUBE_VALUES[Math.floor(offset / 36)],\n\t\tg: CUBE_VALUES[Math.floor(offset / 6) % 6],\n\t\tb: CUBE_VALUES[offset % 6],\n\t})),\n\t...GRAY_VALUES.map((value, offset) => ({ index: 232 + offset, r: value, g: value, b: value })),\n];\n\nfunction strongestChannels(r: number, g: number, b: number): number {\n\tconst max = Math.max(r, g, b);\n\treturn (r === max ? 4 : 0) | (g === max ? 2 : 0) | (b === max ? 1 : 0);\n}\n\nfunction rgbTo256PreservingHue(r: number, g: number, b: number): number {\n\tconst channels = strongestChannels(r, g, b);\n\tlet minDist = Infinity;\n\tlet minIndex = 16;\n\tfor (const entry of PALETTE_256) {\n\t\tif (strongestChannels(entry.r, entry.g, entry.b) !== channels) continue;\n\t\tconst dist = colorDistance(r, g, b, entry.r, entry.g, entry.b);\n\t\tif (dist < minDist) {\n\t\t\tminDist = dist;\n\t\t\tminIndex = entry.index;\n\t\t}\n\t}\n\treturn minIndex;\n}\n\nfunction hexTo256(hex: string, quantization: Quantization): number {\n\tconst { r, g, b } = hexToRgb(hex);\n\treturn quantization === \"preserve-hue\" ? rgbTo256PreservingHue(r, g, b) : rgbTo256(r, g, b);\n}\n\nexport function fgAnsi(color: string | number, mode: ColorMode): string {\n\tif (color === \"\") return \"\\x1b[39m\";\n\tif (typeof color === \"number\") return `\\x1b[38;5;${color}m`;\n\tif (color.startsWith(\"#\")) {\n\t\tif (mode === \"truecolor\") {\n\t\t\tconst { r, g, b } = hexToRgb(color);\n\t\t\treturn `\\x1b[38;2;${r};${g};${b}m`;\n\t\t} else {\n\t\t\tconst index = hexTo256(color, \"nearest\");\n\t\t\treturn `\\x1b[38;5;${index}m`;\n\t\t}\n\t}\n\tthrow new Error(`Invalid color value: ${color}`);\n}\n\nexport function bgAnsi(color: string | number, mode: ColorMode, quantization: Quantization = \"nearest\"): string {\n\tif (color === \"\") return \"\\x1b[49m\";\n\tif (typeof color === \"number\") return `\\x1b[48;5;${color}m`;\n\tif (color.startsWith(\"#\")) {\n\t\tif (mode === \"truecolor\") {\n\t\t\tconst { r, g, b } = hexToRgb(color);\n\t\t\treturn `\\x1b[48;2;${r};${g};${b}m`;\n\t\t} else {\n\t\t\tconst index = hexTo256(color, quantization);\n\t\t\treturn `\\x1b[48;5;${index}m`;\n\t\t}\n\t}\n\tthrow new Error(`Invalid color value: ${color}`);\n}\n\nexport function resolveVarRefs(\n\tvalue: ColorValue,\n\tvars: Record<string, ColorValue>,\n\tvisited = new Set<string>(),\n): string | number {\n\tif (typeof value === \"string\" && /^okhsl\\(/i.test(value)) return colorToHex(parseColor(value));\n\tif (typeof value === \"number\" || value === \"\" || value.startsWith(\"#\")) {\n\t\treturn value;\n\t}\n\tif (visited.has(value)) {\n\t\tthrow new Error(`Circular variable reference detected: ${value}`);\n\t}\n\tif (!(value in vars)) {\n\t\tthrow new Error(`Variable reference not found: ${value}`);\n\t}\n\tvisited.add(value);\n\treturn resolveVarRefs(vars[value], vars, visited);\n}\n\nexport function resolveThemeColors<T extends Record<string, ColorValue>>(\n\tcolors: T,\n\tvars: Record<string, ColorValue> = {},\n): Record<keyof T, string | number> {\n\tconst resolved: Record<string, string | number> = {};\n\tfor (const [key, value] of Object.entries(colors)) {\n\t\tresolved[key] = resolveVarRefs(value, vars);\n\t}\n\treturn resolved as Record<keyof T, string | number>;\n}\n\n/**\n * Convert a 256-color index to hex string.\n * Indices 0-15: basic colors (approximate)\n * Indices 16-231: 6x6x6 color cube\n * Indices 232-255: grayscale ramp\n */\nexport function ansi256ToHex(index: number): string {\n\t// Basic colors (0-15) - approximate common terminal values\n\tconst basicColors = [\n\t\t\"#000000\",\n\t\t\"#800000\",\n\t\t\"#008000\",\n\t\t\"#808000\",\n\t\t\"#000080\",\n\t\t\"#800080\",\n\t\t\"#008080\",\n\t\t\"#c0c0c0\",\n\t\t\"#808080\",\n\t\t\"#ff0000\",\n\t\t\"#00ff00\",\n\t\t\"#ffff00\",\n\t\t\"#0000ff\",\n\t\t\"#ff00ff\",\n\t\t\"#00ffff\",\n\t\t\"#ffffff\",\n\t];\n\tif (index < 16) {\n\t\treturn basicColors[index];\n\t}\n\n\t// Color cube (16-231): 6x6x6 = 216 colors\n\tif (index < 232) {\n\t\tconst cubeIndex = index - 16;\n\t\tconst r = Math.floor(cubeIndex / 36);\n\t\tconst g = Math.floor((cubeIndex % 36) / 6);\n\t\tconst b = cubeIndex % 6;\n\t\tconst toHex = (n: number) => (n === 0 ? 0 : 55 + n * 40).toString(16).padStart(2, \"0\");\n\t\treturn `#${toHex(r)}${toHex(g)}${toHex(b)}`;\n\t}\n\n\t// Grayscale (232-255): 24 shades\n\tconst gray = 8 + (index - 232) * 10;\n\tconst grayHex = gray.toString(16).padStart(2, \"0\");\n\treturn `#${grayHex}${grayHex}${grayHex}`;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"color-utils.js","sourceRoot":"","sources":["../../../../src/modes/interactive/theme/color-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAS7D,MAAM,qBAAqB,GAAG,M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G,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,EAAE,CAAC,CAAC;QACrC,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,SAAS,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;QAC3C,MAAM,CAAC,GAAG,SAAS,GAAG,CAAC,CAAC;QACxB,MAAM,KAAK,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QACvF,OAAO,IAAI,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;IAC7C,CAAC;IAED,iCAAiC;IACjC,MAAM,IAAI,GAAG,CAAC,GAAG,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,EAAE,CAAC;IACpC,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACnD,OAAO,IAAI,OAAO,GAAG,OAAO,GAAG,OAAO,EAAE,CAAC;AAC1C,CAAC","sourcesContent":["import { colorToHex, parseColor } from \"@bastani/atomic-tui\";\nimport type { ColorValue } from \"./theme-schema.ts\";\n\nexport type ColorMode = \"truecolor\" | \"256color\";\nexport type ThemeStyleLevel = 0 | 1 | 2 | 3;\n\n/** What NO_COLOR and FORCE_COLOR ask for: color off, a forced level, or the terminal's own color mode. */\nexport type ColorEnvironment = { readonly off: true } | { readonly off: false; readonly forced?: ThemeStyleLevel };\n\nconst COLOR_ENVIRONMENT_KEY = Symbol.for(\"@bastani/atomic:theme-color-environment\");\n\n/** A theme that repaints its palette when the color environment is read again. */\nexport interface ColorEnvironmentListener {\n\tapplyColorEnvironment(environment: ColorEnvironment): void;\n}\n\ntype ColorEnvironmentState = {\n\tenvironment: ColorEnvironment;\n\treadonly listeners: Set<WeakRef<ColorEnvironmentListener>>;\n};\n\n/** Shared across module instances, like the global theme, so every loaded copy of the theme module agrees. */\nfunction colorEnvironmentState(): ColorEnvironmentState {\n\tconst store = globalThis as Record<symbol, ColorEnvironmentState | undefined>;\n\tlet state = store[COLOR_ENVIRONMENT_KEY];\n\tif (!state) {\n\t\tstate = { environment: readColorEnvironment(), listeners: new Set() };\n\t\tstore[COLOR_ENVIRONMENT_KEY] = state;\n\t}\n\treturn state;\n}\n\nexport function readColorEnvironment(env: NodeJS.ProcessEnv = process.env): ColorEnvironment {\n\tif (env.NO_COLOR !== undefined) return { off: true };\n\tif (env.FORCE_COLOR !== undefined) {\n\t\tconst forced = env.FORCE_COLOR.trim().toLowerCase();\n\t\tif (forced === \"0\" || forced === \"false\") return { off: true };\n\t\tif (forced === \"1\" || forced === \"true\" || forced === \"\") return { off: false, forced: 1 };\n\t\tif (forced === \"2\") return { off: false, forced: 2 };\n\t\tif (forced === \"3\") return { off: false, forced: 3 };\n\t}\n\treturn { off: false };\n}\n\n/**\n * The color environment themes paint with. It is read when the first theme is created and again by\n * {@link refreshColorEnvironment}, which theme loads and switches call; painting never reads the environment.\n */\nexport function colorEnvironment(): ColorEnvironment {\n\treturn colorEnvironmentState().environment;\n}\n\n/** Keep `listener` (held weakly) on the color environment in use from now on. */\nexport function onColorEnvironmentChange(listener: ColorEnvironmentListener): void {\n\tcolorEnvironmentState().listeners.add(new WeakRef(listener));\n}\n\n/** Read NO_COLOR and FORCE_COLOR again and apply them to every theme; tests that change them call it too. */\nexport function refreshColorEnvironment(env: NodeJS.ProcessEnv = process.env): ColorEnvironment {\n\tconst state = colorEnvironmentState();\n\tconst next = readColorEnvironment(env);\n\tstate.environment = next;\n\tfor (const reference of state.listeners) {\n\t\tconst listener = reference.deref();\n\t\tif (listener === undefined) state.listeners.delete(reference);\n\t\telse listener.applyColorEnvironment(next);\n\t}\n\treturn next;\n}\n\nexport function themeStyleLevel(mode: ColorMode, environment: ColorEnvironment): ThemeStyleLevel {\n\tif (environment.off) return 0;\n\treturn environment.forced ?? (mode === \"truecolor\" ? 3 : 2);\n}\n\nexport function detectColorMode(): ColorMode {\n\tconst colorterm = process.env.COLORTERM;\n\tif (colorterm === \"truecolor\" || colorterm === \"24bit\") {\n\t\treturn \"truecolor\";\n\t}\n\t// Windows Terminal supports truecolor\n\tif (process.env.WT_SESSION) {\n\t\treturn \"truecolor\";\n\t}\n\tconst term = process.env.TERM || \"\";\n\t// Fall back to 256color for truly limited terminals\n\tif (term === \"dumb\" || term === \"\" || term === \"linux\") {\n\t\treturn \"256color\";\n\t}\n\t// Terminal.app also doesn't support truecolor\n\tif (process.env.TERM_PROGRAM === \"Apple_Terminal\") {\n\t\treturn \"256color\";\n\t}\n\t// GNU screen doesn't support truecolor unless explicitly opted in via COLORTERM=truecolor.\n\t// TERM under screen is typically \"screen\", \"screen-256color\", or \"screen.xterm-256color\".\n\tif (term === \"screen\" || term.startsWith(\"screen-\") || term.startsWith(\"screen.\")) {\n\t\treturn \"256color\";\n\t}\n\t// Assume truecolor for everything else - virtually all modern terminals support it\n\treturn \"truecolor\";\n}\n\n/**\n * Resolve the color mode for a theme from an explicit `terminal.trueColor` setting, then\n * `ATOMIC_TRUE_COLOR=1|0` (legacy `PI_TRUE_COLOR`), then terminal detection.\n */\nexport function resolveColorMode(trueColorSetting: boolean | undefined): ColorMode {\n\tconst envOverride = process.env.ATOMIC_TRUE_COLOR ?? process.env.PI_TRUE_COLOR;\n\tconst trueColor = trueColorSetting ?? (envOverride === \"1\" ? true : envOverride === \"0\" ? false : undefined);\n\tif (trueColor === undefined) return detectColorMode();\n\treturn trueColor ? \"truecolor\" : \"256color\";\n}\n\nexport function hexToRgb(hex: string): { r: number; g: number; b: number } {\n\tconst cleaned = hex.replace(\"#\", \"\");\n\tif (cleaned.length !== 6) {\n\t\tthrow new Error(`Invalid hex color: ${hex}`);\n\t}\n\tconst r = parseInt(cleaned.substring(0, 2), 16);\n\tconst g = parseInt(cleaned.substring(2, 4), 16);\n\tconst b = parseInt(cleaned.substring(4, 6), 16);\n\tif (Number.isNaN(r) || Number.isNaN(g) || Number.isNaN(b)) {\n\t\tthrow new Error(`Invalid hex color: ${hex}`);\n\t}\n\treturn { r, g, b };\n}\n\n// The 6x6x6 color cube channel values (indices 0-5)\nconst CUBE_VALUES = [0, 95, 135, 175, 215, 255];\n\n// Grayscale ramp values (indices 232-255, 24 grays from 8 to 238)\nconst GRAY_VALUES = Array.from({ length: 24 }, (_, i) => 8 + i * 10);\n\nfunction findClosestCubeIndex(value: number): number {\n\tlet minDist = Infinity;\n\tlet minIdx = 0;\n\tfor (let i = 0; i < CUBE_VALUES.length; i++) {\n\t\tconst dist = Math.abs(value - CUBE_VALUES[i]);\n\t\tif (dist < minDist) {\n\t\t\tminDist = dist;\n\t\t\tminIdx = i;\n\t\t}\n\t}\n\treturn minIdx;\n}\n\nfunction findClosestGrayIndex(r: number, g: number, b: number): number {\n\tlet minDist = Infinity;\n\tlet minIdx = 0;\n\tfor (let i = 0; i < GRAY_VALUES.length; i++) {\n\t\tconst value = GRAY_VALUES[i];\n\t\tconst dist = colorDistance(r, g, b, value, value, value);\n\t\tif (dist < minDist) {\n\t\t\tminDist = dist;\n\t\t\tminIdx = i;\n\t\t}\n\t}\n\treturn minIdx;\n}\n\nfunction colorDistance(r1: number, g1: number, b1: number, r2: number, g2: number, b2: number): number {\n\t// Weighted Euclidean distance (human eye is more sensitive to green)\n\tconst dr = r1 - r2;\n\tconst dg = g1 - g2;\n\tconst db = b1 - b2;\n\treturn dr * dr * 0.299 + dg * dg * 0.587 + db * db * 0.114;\n}\n\nfunction rgbTo256(r: number, g: number, b: number): number {\n\t// Find closest color in the 6x6x6 cube\n\tconst rIdx = findClosestCubeIndex(r);\n\tconst gIdx = findClosestCubeIndex(g);\n\tconst bIdx = findClosestCubeIndex(b);\n\tconst cubeR = CUBE_VALUES[rIdx];\n\tconst cubeG = CUBE_VALUES[gIdx];\n\tconst cubeB = CUBE_VALUES[bIdx];\n\tconst cubeIndex = 16 + 36 * rIdx + 6 * gIdx + bIdx;\n\tconst cubeDist = colorDistance(r, g, b, cubeR, cubeG, cubeB);\n\n\t// Find closest grayscale\n\tconst grayIdx = findClosestGrayIndex(r, g, b);\n\tconst grayValue = GRAY_VALUES[grayIdx];\n\tconst grayIndex = 232 + grayIdx;\n\tconst grayDist = colorDistance(r, g, b, grayValue, grayValue, grayValue);\n\n\t// Prefer the cube on equal distances.\n\tif (grayDist < cubeDist) {\n\t\treturn grayIndex;\n\t}\n\n\treturn cubeIndex;\n}\n\n/**\n * `nearest` picks the closest cube or grayscale entry. `preserve-hue` picks the closest entry whose strongest\n * channels are the same as the input's, so a tinted color keeps its hue instead of collapsing to a gray.\n */\nexport type Quantization = \"nearest\" | \"preserve-hue\";\n\ninterface PaletteEntry {\n\tindex: number;\n\tr: number;\n\tg: number;\n\tb: number;\n}\n\nconst PALETTE_256: PaletteEntry[] = [\n\t...Array.from({ length: 216 }, (_, offset) => ({\n\t\tindex: 16 + offset,\n\t\tr: CUBE_VALUES[Math.floor(offset / 36)],\n\t\tg: CUBE_VALUES[Math.floor(offset / 6) % 6],\n\t\tb: CUBE_VALUES[offset % 6],\n\t})),\n\t...GRAY_VALUES.map((value, offset) => ({ index: 232 + offset, r: value, g: value, b: value })),\n];\n\nfunction strongestChannels(r: number, g: number, b: number): number {\n\tconst max = Math.max(r, g, b);\n\treturn (r === max ? 4 : 0) | (g === max ? 2 : 0) | (b === max ? 1 : 0);\n}\n\nfunction rgbTo256PreservingHue(r: number, g: number, b: number): number {\n\tconst channels = strongestChannels(r, g, b);\n\tlet minDist = Infinity;\n\tlet minIndex = 16;\n\tfor (const entry of PALETTE_256) {\n\t\tif (strongestChannels(entry.r, entry.g, entry.b) !== channels) continue;\n\t\tconst dist = colorDistance(r, g, b, entry.r, entry.g, entry.b);\n\t\tif (dist < minDist) {\n\t\t\tminDist = dist;\n\t\t\tminIndex = entry.index;\n\t\t}\n\t}\n\treturn minIndex;\n}\n\nfunction hexTo256(hex: string, quantization: Quantization): number {\n\tconst { r, g, b } = hexToRgb(hex);\n\treturn quantization === \"preserve-hue\" ? rgbTo256PreservingHue(r, g, b) : rgbTo256(r, g, b);\n}\n\nexport function fgAnsi(color: string | number, mode: ColorMode): string {\n\tif (color === \"\") return \"\\x1b[39m\";\n\tif (typeof color === \"number\") return `\\x1b[38;5;${color}m`;\n\tif (color.startsWith(\"#\")) {\n\t\tif (mode === \"truecolor\") {\n\t\t\tconst { r, g, b } = hexToRgb(color);\n\t\t\treturn `\\x1b[38;2;${r};${g};${b}m`;\n\t\t} else {\n\t\t\tconst index = hexTo256(color, \"nearest\");\n\t\t\treturn `\\x1b[38;5;${index}m`;\n\t\t}\n\t}\n\tthrow new Error(`Invalid color value: ${color}`);\n}\n\n/** Distinct `#rrggbb` colors kept per color environment by {@link hexColorAnsi}; past it the cache starts over. */\nconst HEX_COLOR_SEQUENCE_CACHE_LIMIT = 1024;\nconst hexColorSequences = {\n\tenvironment: undefined as ColorEnvironment | undefined,\n\tfg: new Map<string, string>(),\n\tbg: new Map<string, string>(),\n};\n\n/**\n * The escape sequence that sets the `#rrggbb` color `hex` as the foreground or background, in the color environment\n * themes paint with: none when NO_COLOR or FORCE_COLOR=0 turns color off, the nearest 256-color entry under\n * FORCE_COLOR=1 or 2, and true color otherwise. Code that builds its own colors uses it to follow NO_COLOR and\n * FORCE_COLOR like the theme does; it never reads the environment itself.\n */\nexport function hexColorAnsi(hex: string, layer: \"fg\" | \"bg\"): string {\n\tconst environment = colorEnvironment();\n\tif (environment.off) return \"\";\n\tif (hexColorSequences.environment !== environment) {\n\t\thexColorSequences.environment = environment;\n\t\thexColorSequences.fg.clear();\n\t\thexColorSequences.bg.clear();\n\t}\n\tconst cache = hexColorSequences[layer];\n\tlet sequence = cache.get(hex);\n\tif (sequence === undefined) {\n\t\tconst mode: ColorMode = environment.forced === 1 || environment.forced === 2 ? \"256color\" : \"truecolor\";\n\t\tsequence = layer === \"fg\" ? fgAnsi(hex, mode) : bgAnsi(hex, mode);\n\t\tif (cache.size >= HEX_COLOR_SEQUENCE_CACHE_LIMIT) cache.clear();\n\t\tcache.set(hex, sequence);\n\t}\n\treturn sequence;\n}\n\nexport function bgAnsi(color: string | number, mode: ColorMode, quantization: Quantization = \"nearest\"): string {\n\tif (color === \"\") return \"\\x1b[49m\";\n\tif (typeof color === \"number\") return `\\x1b[48;5;${color}m`;\n\tif (color.startsWith(\"#\")) {\n\t\tif (mode === \"truecolor\") {\n\t\t\tconst { r, g, b } = hexToRgb(color);\n\t\t\treturn `\\x1b[48;2;${r};${g};${b}m`;\n\t\t} else {\n\t\t\tconst index = hexTo256(color, quantization);\n\t\t\treturn `\\x1b[48;5;${index}m`;\n\t\t}\n\t}\n\tthrow new Error(`Invalid color value: ${color}`);\n}\n\nexport function resolveVarRefs(\n\tvalue: ColorValue,\n\tvars: Record<string, ColorValue>,\n\tvisited = new Set<string>(),\n): string | number {\n\tif (typeof value === \"string\" && /^okhsl\\(/i.test(value)) return colorToHex(parseColor(value));\n\tif (typeof value === \"number\" || value === \"\" || value.startsWith(\"#\")) {\n\t\treturn value;\n\t}\n\tif (visited.has(value)) {\n\t\tthrow new Error(`Circular variable reference detected: ${value}`);\n\t}\n\tif (!(value in vars)) {\n\t\tthrow new Error(`Variable reference not found: ${value}`);\n\t}\n\tvisited.add(value);\n\treturn resolveVarRefs(vars[value], vars, visited);\n}\n\nexport function resolveThemeColors<T extends Record<string, ColorValue>>(\n\tcolors: T,\n\tvars: Record<string, ColorValue> = {},\n): Record<keyof T, string | number> {\n\tconst resolved: Record<string, string | number> = {};\n\tfor (const [key, value] of Object.entries(colors)) {\n\t\tresolved[key] = resolveVarRefs(value, vars);\n\t}\n\treturn resolved as Record<keyof T, string | number>;\n}\n\n/**\n * Convert a 256-color index to hex string.\n * Indices 0-15: basic colors (approximate)\n * Indices 16-231: 6x6x6 color cube\n * Indices 232-255: grayscale ramp\n */\nexport function ansi256ToHex(index: number): string {\n\t// Basic colors (0-15) - approximate common terminal values\n\tconst basicColors = [\n\t\t\"#000000\",\n\t\t\"#800000\",\n\t\t\"#008000\",\n\t\t\"#808000\",\n\t\t\"#000080\",\n\t\t\"#800080\",\n\t\t\"#008080\",\n\t\t\"#c0c0c0\",\n\t\t\"#808080\",\n\t\t\"#ff0000\",\n\t\t\"#00ff00\",\n\t\t\"#ffff00\",\n\t\t\"#0000ff\",\n\t\t\"#ff00ff\",\n\t\t\"#00ffff\",\n\t\t\"#ffffff\",\n\t];\n\tif (index < 16) {\n\t\treturn basicColors[index];\n\t}\n\n\t// Color cube (16-231): 6x6x6 = 216 colors\n\tif (index < 232) {\n\t\tconst cubeIndex = index - 16;\n\t\tconst r = Math.floor(cubeIndex / 36);\n\t\tconst g = Math.floor((cubeIndex % 36) / 6);\n\t\tconst b = cubeIndex % 6;\n\t\tconst toHex = (n: number) => (n === 0 ? 0 : 55 + n * 40).toString(16).padStart(2, \"0\");\n\t\treturn `#${toHex(r)}${toHex(g)}${toHex(b)}`;\n\t}\n\n\t// Grayscale (232-255): 24 shades\n\tconst gray = 8 + (index - 232) * 10;\n\tconst grayHex = gray.toString(16).padStart(2, \"0\");\n\treturn `#${grayHex}${grayHex}${grayHex}`;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global-theme.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/theme/global-theme.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"global-theme.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/theme/global-theme.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAgB9C,eAAO,MAAM,KAAK,EAAE,KAMlB,CAAC;AAEH,wBAAgB,cAAc,IAAI,KAAK,GAAG,SAAS,CAElD;AAiBD,wBAAgB,mBAAmB,IAAI,MAAM,GAAG,SAAS,CAExD;AAED,wBAAgB,SAAS,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,aAAa,GAAE,OAAe,GAAG,IAAI,CAelF;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,GAAE,OAAe,GAAG;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAqB3G;AAED,wBAAgB,gBAAgB,CAAC,aAAa,EAAE,KAAK,GAAG,IAAI,CAO3D;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAExD;AAoHD,wBAAgB,gBAAgB,IAAI,IAAI,CAavC"}
|
|
@@ -2,6 +2,7 @@ import * as fs from "node:fs";
|
|
|
2
2
|
import * as path from "node:path";
|
|
3
3
|
import { getCustomThemesDir } from "../../../config.js";
|
|
4
4
|
import { closeWatcher, isSafeFsWatchPathError, watchWithErrorHandlerAsync } from "../../../utils/fs-watch.js";
|
|
5
|
+
import { refreshColorEnvironment } from "./color-utils.js";
|
|
5
6
|
import { getDefaultTheme } from "./terminal-detection.js";
|
|
6
7
|
import { getBuiltinThemes, hasCustomThemeFile, loadTheme, loadThemeFromContent, readThemeFiles, setRegisteredTheme, } from "./theme-loading.js";
|
|
7
8
|
// Use globalThis to share theme across module loaders (node + jiti in dev mode)
|
|
@@ -21,6 +22,8 @@ export function getGlobalTheme() {
|
|
|
21
22
|
return globalThis[THEME_KEY];
|
|
22
23
|
}
|
|
23
24
|
function setGlobalTheme(t) {
|
|
25
|
+
// Loading or switching a theme is when NO_COLOR and FORCE_COLOR are read; painting never reads them.
|
|
26
|
+
refreshColorEnvironment();
|
|
24
27
|
globalThis[THEME_KEY] = t;
|
|
25
28
|
globalThis[THEME_KEY_OLD] = t;
|
|
26
29
|
}
|