@kolisachint/hoocode-agent 0.5.57 → 0.5.59
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 +181 -0
- package/dist/core/agent-session.d.ts +2 -2
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +4 -3
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +4 -1
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/keybindings.d.ts +162 -98
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +222 -106
- package/dist/core/keybindings.js.map +1 -1
- package/dist/modes/interactive/command-executor.d.ts.map +1 -1
- package/dist/modes/interactive/command-executor.js +95 -62
- package/dist/modes/interactive/command-executor.js.map +1 -1
- package/dist/modes/interactive/components/ask-options.d.ts +20 -6
- package/dist/modes/interactive/components/ask-options.d.ts.map +1 -1
- package/dist/modes/interactive/components/ask-options.js +35 -13
- package/dist/modes/interactive/components/ask-options.js.map +1 -1
- package/dist/modes/interactive/components/keybinding-hints.d.ts +9 -0
- package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -1
- package/dist/modes/interactive/components/keybinding-hints.js +12 -0
- package/dist/modes/interactive/components/keybinding-hints.js.map +1 -1
- package/dist/modes/interactive/components/task-panel.d.ts +2 -2
- package/dist/modes/interactive/components/task-panel.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-panel.js +24 -11
- package/dist/modes/interactive/components/task-panel.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector.js +29 -12
- package/dist/modes/interactive/components/tree-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +63 -8
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +189 -90
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/model-controller.d.ts +3 -0
- package/dist/modes/interactive/model-controller.d.ts.map +1 -1
- package/dist/modes/interactive/model-controller.js +1 -1
- package/dist/modes/interactive/model-controller.js.map +1 -1
- package/docs/keybindings.md +247 -80
- package/docs/terminal-setup.md +8 -3
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package.json +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-executor.js","sourceRoot":"","sources":["../../../src/modes/interactive/command-executor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAGlC,OAAO,EAAkB,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAChG,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAGjE,OAAO,EAAE,oBAAoB,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AAE3G,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EACN,qBAAqB,EACrB,uBAAuB,EACvB,mBAAmB,EACnB,gBAAgB,GAChB,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAEvE,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC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G,CAAC,aAAa,CAAC,QAAQ,CAC9B,IAAI,IAAI,CAAC,GAAG,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,uBAAqB,CAAC,KAAK,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,YAAY,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAClG,CAAC;QACF,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC;IAAA,CAC5B;CACD","sourcesContent":["/**\n * Extracted command handlers from InteractiveMode.\n * All methods receive dependencies via CommandContext rather than\n * reaching back into the parent class.\n */\n\nimport * as fs from \"node:fs\";\nimport * as os from \"node:os\";\nimport * as path from \"node:path\";\nimport type { Model } from \"@kolisachint/hoocode-ai\";\nimport type { EditorComponent, MarkdownTheme, TUI } from \"@kolisachint/hoocode-tui\";\nimport { type Container, Markdown, Spacer, Text, visibleWidth } from \"@kolisachint/hoocode-tui\";\nimport { spawn, spawnSync } from \"child_process\";\nimport { getDebugLogPath, getShareViewerUrl } from \"../../config.js\";\nimport { loadAgentRegistry } from \"../../core/agent-registry.js\";\nimport type { AgentSession } from \"../../core/agent-session.js\";\nimport type { AgentSessionRuntime } from \"../../core/agent-session-runtime.js\";\nimport { ChangeDirectoryError, SessionImportFileNotFoundError } from \"../../core/agent-session-runtime.js\";\nimport type { KeybindingsManager } from \"../../core/keybindings.js\";\nimport { MissingSessionCwdError } from \"../../core/session-cwd.js\";\nimport {\n\tparseSessionColorSlot,\n\tSESSION_COLOR_NAME_LIST,\n\tSESSION_COLOR_SLOTS,\n\tsessionColorName,\n} from \"../../core/session-identity.js\";\nimport type { SessionManager } from \"../../core/session-manager.js\";\nimport { getSubagentPool } from \"../../core/subagent-pool-instance.js\";\nimport type { SubagentResultFile } from \"../../core/subagent-result.js\";\nimport { getChangelogPath, parseChangelog } from \"../../utils/changelog.js\";\nimport { copyToClipboard } from \"../../utils/clipboard.js\";\nimport { BorderedLoader } from \"./components/bordered-loader.js\";\nimport { DynamicBorder } from \"./components/dynamic-border.js\";\nimport type { FooterComponent } from \"./components/footer.js\";\nimport { formatKeyText, keyDisplayText } from \"./components/keybinding-hints.js\";\nimport { renderSessionChip } from \"./components/session-chip.js\";\nimport { theme } from \"./theme/theme.js\";\n\nexport interface CommandContext {\n\t// Core dependencies\n\tsession: AgentSession;\n\tsessionManager: SessionManager;\n\truntimeHost: AgentSessionRuntime;\n\tui: TUI;\n\teditor: EditorComponent;\n\teditorContainer: Container;\n\tchatContainer: Container;\n\tstatusContainer: Container;\n\tfooter: FooterComponent;\n\tkeybindings: KeybindingsManager;\n\n\t// UI callbacks\n\tshowStatus: (message: string) => void;\n\tshowError: (message: string) => void;\n\tshowWarning: (message: string) => void;\n\tupdateEditorBorderColor: () => void;\n\trenderCurrentSessionState: () => void;\n\trebuildChatFromMessages: () => void;\n\tgetMarkdownThemeWithSettings: () => MarkdownTheme;\n\tstopLoadingAnimation: () => void;\n\n\t// Auth/model helpers\n\tfindExactModelMatch: (searchTerm: string) => Promise<Model<any> | undefined>;\n\tmaybeWarnAboutAnthropicSubscriptionAuth: (model?: Model<any>) => Promise<void>;\n\n\t// Dialog callbacks\n\tshowModelSelector: (searchTerm?: string) => void;\n\tshowExtensionConfirm: (title: string, message: string) => Promise<boolean>;\n\tpromptForMissingSessionCwd: (error: MissingSessionCwdError) => Promise<string | undefined>;\n\n\t// Fatal error handler\n\thandleFatalRuntimeError: (prefix: string, error: unknown) => Promise<never>;\n}\n\nexport class CommandExecutor {\n\t/** Where `/cd -` returns to. Set on every successful move, session-local. */\n\tprivate previousCwd?: string;\n\n\tconstructor(private readonly ctx: CommandContext) {}\n\n\t// =========================================================================\n\t// Slash command handlers\n\t// =========================================================================\n\n\tasync handleModel(searchTerm?: string): Promise<void> {\n\t\tif (!searchTerm) {\n\t\t\tthis.ctx.showModelSelector();\n\t\t\treturn;\n\t\t}\n\n\t\tconst model = await this.ctx.findExactModelMatch(searchTerm);\n\t\tif (model) {\n\t\t\ttry {\n\t\t\t\tawait this.ctx.session.setModel(model);\n\t\t\t\tthis.ctx.footer.invalidate();\n\t\t\t\tthis.ctx.updateEditorBorderColor();\n\t\t\t\tthis.ctx.showStatus(`Model: ${model.id}`);\n\t\t\t\tvoid this.ctx.maybeWarnAboutAnthropicSubscriptionAuth(model);\n\t\t\t} catch (error) {\n\t\t\t\tthis.ctx.showError(error instanceof Error ? error.message : String(error));\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tthis.ctx.showModelSelector(searchTerm);\n\t}\n\n\tasync handleClone(): Promise<void> {\n\t\tconst leafId = this.ctx.sessionManager.getLeafId();\n\t\tif (!leafId) {\n\t\t\tthis.ctx.showStatus(\"Nothing to clone yet\");\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tconst result = await this.ctx.runtimeHost.fork(leafId, { position: \"at\" });\n\t\t\tif (result.cancelled) {\n\t\t\t\tthis.ctx.ui.requestRender();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.ctx.renderCurrentSessionState();\n\t\t\tthis.ctx.editor.setText(\"\");\n\t\t\tthis.ctx.showStatus(\"Cloned to new session\");\n\t\t} catch (error: unknown) {\n\t\t\tthis.ctx.showError(error instanceof Error ? error.message : String(error));\n\t\t}\n\t}\n\n\tasync handleSubagent(text: string): Promise<void> {\n\t\tconst prefix = \"/subagent \";\n\t\tconst args = text.startsWith(prefix) ? text.slice(prefix.length).trim() : \"\";\n\t\tif (!args) {\n\t\t\tthis.ctx.showStatus(\"Usage: /subagent <mode> <task>\");\n\t\t\treturn;\n\t\t}\n\n\t\tconst firstSpace = args.indexOf(\" \");\n\t\tif (firstSpace === -1) {\n\t\t\tthis.ctx.showStatus(\"Usage: /subagent <mode> <task>\");\n\t\t\treturn;\n\t\t}\n\n\t\tconst mode = args.slice(0, firstSpace).trim();\n\t\tconst task = args.slice(firstSpace + 1).trim();\n\t\tif (!task) {\n\t\t\tthis.ctx.showStatus(\"Usage: /subagent <mode> <task>\");\n\t\t\treturn;\n\t\t}\n\n\t\tconst validModes = loadAgentRegistry({ cwd: this.ctx.sessionManager.getCwd() })\n\t\t\t.list()\n\t\t\t.map((a) => a.name);\n\t\tif (!validModes.includes(mode)) {\n\t\t\tthis.ctx.showStatus(`Unknown subagent_type: ${mode}. Available: ${validModes.join(\", \")}`);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.ctx.showStatus(`Spawning ${mode} subagent...`);\n\t\ttry {\n\t\t\tconst pool = getSubagentPool(this.ctx.sessionManager.getCwd(), this.ctx.session.modelRegistry.getAvailable());\n\t\t\tconst dispatchResult = await pool.dispatch(task, {\n\t\t\t\tforceAgent: mode,\n\t\t\t\tmodel: this.ctx.session.model?.id,\n\t\t\t\tprovider: this.ctx.session.model?.provider,\n\t\t\t});\n\t\t\tconst result = dispatchResult.result;\n\t\t\tconst resultData = result?.result_data as SubagentResultFile | undefined;\n\t\t\tif (result?.ok) {\n\t\t\t\tthis.ctx.showStatus(`${mode} subagent completed`);\n\t\t\t\t// Inject the subagent answer as a custom message so the user can see it in the chat\n\t\t\t\tthis.ctx.sessionManager.appendMessage({\n\t\t\t\t\trole: \"custom\",\n\t\t\t\t\tcustomType: \"subagent\",\n\t\t\t\t\tcontent: resultData?.summary || \"(no output)\",\n\t\t\t\t\tdisplay: true,\n\t\t\t\t\ttimestamp: Date.now(),\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tthis.ctx.showError(`Subagent (${mode}) failed: ${result?.error ?? \"unknown error\"}`);\n\t\t\t}\n\t\t} catch (error: unknown) {\n\t\t\tthis.ctx.showError(error instanceof Error ? error.message : String(error));\n\t\t}\n\t}\n\n\tasync handleExport(text: string): Promise<void> {\n\t\tconst outputPath = this.getPathArgument(text, \"/export\");\n\n\t\ttry {\n\t\t\tif (outputPath?.endsWith(\".jsonl\")) {\n\t\t\t\tconst filePath = this.ctx.session.exportToJsonl(outputPath);\n\t\t\t\tthis.ctx.showStatus(`Session exported to: ${filePath}`);\n\t\t\t} else {\n\t\t\t\tconst filePath = await this.ctx.session.exportToHtml(outputPath);\n\t\t\t\tthis.ctx.showStatus(`Session exported to: ${filePath}`);\n\t\t\t}\n\t\t} catch (error: unknown) {\n\t\t\tthis.ctx.showError(`Failed to export session: ${error instanceof Error ? error.message : \"Unknown error\"}`);\n\t\t}\n\t}\n\n\tprivate getPathArgument(text: string, command: \"/export\" | \"/import\"): string | undefined {\n\t\tif (text === command) {\n\t\t\treturn undefined;\n\t\t}\n\t\tif (!text.startsWith(`${command} `)) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst argsString = text.slice(command.length + 1).trimStart();\n\t\tif (!argsString) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst firstChar = argsString[0];\n\t\tif (firstChar === '\"' || firstChar === \"'\") {\n\t\t\tconst closingQuoteIndex = argsString.indexOf(firstChar, 1);\n\t\t\tif (closingQuoteIndex < 0) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\treturn argsString.slice(1, closingQuoteIndex);\n\t\t}\n\n\t\tconst firstWhitespaceIndex = argsString.search(/\\s/);\n\t\tif (firstWhitespaceIndex < 0) {\n\t\t\treturn argsString;\n\t\t}\n\t\treturn argsString.slice(0, firstWhitespaceIndex);\n\t}\n\n\tasync handleImport(text: string): Promise<void> {\n\t\tconst inputPath = this.getPathArgument(text, \"/import\");\n\t\tif (!inputPath) {\n\t\t\tthis.ctx.showError(\"Usage: /import <path.jsonl>\");\n\t\t\treturn;\n\t\t}\n\n\t\tconst confirmed = await this.ctx.showExtensionConfirm(\n\t\t\t\"Import session\",\n\t\t\t`Replace current session with ${inputPath}?`,\n\t\t);\n\t\tif (!confirmed) {\n\t\t\tthis.ctx.showStatus(\"Import cancelled\");\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tthis.ctx.stopLoadingAnimation();\n\t\t\tthis.ctx.statusContainer.clear();\n\t\t\tconst result = await this.ctx.runtimeHost.importFromJsonl(inputPath);\n\t\t\tif (result.cancelled) {\n\t\t\t\tthis.ctx.showStatus(\"Import cancelled\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis.ctx.renderCurrentSessionState();\n\t\t\tthis.ctx.showStatus(`Session imported from: ${inputPath}`);\n\t\t} catch (error: unknown) {\n\t\t\tif (error instanceof MissingSessionCwdError) {\n\t\t\t\tconst selectedCwd = await this.ctx.promptForMissingSessionCwd(error);\n\t\t\t\tif (!selectedCwd) {\n\t\t\t\t\tthis.ctx.showStatus(\"Import cancelled\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst result = await this.ctx.runtimeHost.importFromJsonl(inputPath, selectedCwd);\n\t\t\t\tif (result.cancelled) {\n\t\t\t\t\tthis.ctx.showStatus(\"Import cancelled\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tthis.ctx.renderCurrentSessionState();\n\t\t\t\tthis.ctx.showStatus(`Session imported from: ${inputPath}`);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (error instanceof SessionImportFileNotFoundError) {\n\t\t\t\tthis.ctx.showError(`Failed to import session: ${error.message}`);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tawait this.ctx.handleFatalRuntimeError(\"Failed to import session\", error);\n\t\t}\n\t}\n\n\tasync handleShare(): Promise<void> {\n\t\t// Check if gh is available and logged in\n\t\ttry {\n\t\t\tconst authResult = spawnSync(\"gh\", [\"auth\", \"status\"], { encoding: \"utf-8\" });\n\t\t\tif (authResult.status !== 0) {\n\t\t\t\tthis.ctx.showError(\"GitHub CLI is not logged in. Run 'gh auth login' first.\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t} catch {\n\t\t\tthis.ctx.showError(\"GitHub CLI (gh) is not installed. Install it from https://cli.github.com/\");\n\t\t\treturn;\n\t\t}\n\n\t\t// Export to a temp file\n\t\tconst tmpFile = path.join(os.tmpdir(), \"session.html\");\n\t\ttry {\n\t\t\tawait this.ctx.session.exportToHtml(tmpFile);\n\t\t} catch (error: unknown) {\n\t\t\tthis.ctx.showError(`Failed to export session: ${error instanceof Error ? error.message : \"Unknown error\"}`);\n\t\t\treturn;\n\t\t}\n\n\t\t// Show cancellable loader, replacing the editor\n\t\tconst loader = new BorderedLoader(this.ctx.ui, theme, \"Creating gist...\");\n\t\tthis.ctx.editorContainer.clear();\n\t\tthis.ctx.editorContainer.addChild(loader);\n\t\tthis.ctx.ui.setFocus(loader);\n\t\tthis.ctx.ui.requestRender();\n\n\t\tconst restoreEditor = () => {\n\t\t\tloader.dispose();\n\t\t\tthis.ctx.editorContainer.clear();\n\t\t\tthis.ctx.editorContainer.addChild(this.ctx.editor);\n\t\t\tthis.ctx.ui.setFocus(this.ctx.editor);\n\t\t\ttry {\n\t\t\t\tfs.unlinkSync(tmpFile);\n\t\t\t} catch {\n\t\t\t\t// Ignore cleanup errors\n\t\t\t}\n\t\t};\n\n\t\t// Create a secret gist asynchronously\n\t\tlet proc: ReturnType<typeof spawn> | null = null;\n\n\t\tloader.onAbort = () => {\n\t\t\tproc?.kill();\n\t\t\trestoreEditor();\n\t\t\tthis.ctx.showStatus(\"Share cancelled\");\n\t\t};\n\n\t\ttry {\n\t\t\tconst result = await new Promise<{ stdout: string; stderr: string; code: number | null }>((resolve) => {\n\t\t\t\tproc = spawn(\"gh\", [\"gist\", \"create\", \"--public=false\", tmpFile]);\n\t\t\t\tlet stdout = \"\";\n\t\t\t\tlet stderr = \"\";\n\t\t\t\tproc.stdout?.on(\"data\", (data) => {\n\t\t\t\t\tstdout += data.toString();\n\t\t\t\t});\n\t\t\t\tproc.stderr?.on(\"data\", (data) => {\n\t\t\t\t\tstderr += data.toString();\n\t\t\t\t});\n\t\t\t\tproc.on(\"close\", (code) => resolve({ stdout, stderr, code }));\n\t\t\t});\n\n\t\t\tif (loader.signal.aborted) return;\n\n\t\t\trestoreEditor();\n\n\t\t\tif (result.code !== 0) {\n\t\t\t\tconst errorMsg = result.stderr?.trim() || \"Unknown error\";\n\t\t\t\tthis.ctx.showError(`Failed to create gist: ${errorMsg}`);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Extract gist ID from the URL returned by gh\n\t\t\t// gh returns something like: https://gist.github.com/username/GIST_ID\n\t\t\tconst gistUrl = result.stdout?.trim();\n\t\t\tconst gistId = gistUrl?.split(\"/\").pop();\n\t\t\tif (!gistId) {\n\t\t\t\tthis.ctx.showError(\"Failed to parse gist ID from gh output\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Create the preview URL\n\t\t\tconst previewUrl = getShareViewerUrl(gistId);\n\t\t\tthis.ctx.showStatus(`Share URL: ${previewUrl}\\nGist: ${gistUrl}`);\n\t\t} catch (error: unknown) {\n\t\t\tif (!loader.signal.aborted) {\n\t\t\t\trestoreEditor();\n\t\t\t\tthis.ctx.showError(`Failed to create gist: ${error instanceof Error ? error.message : \"Unknown error\"}`);\n\t\t\t}\n\t\t}\n\t}\n\n\tasync handleCopy(): Promise<void> {\n\t\tconst text = this.ctx.session.getLastAssistantText();\n\t\tif (!text) {\n\t\t\tthis.ctx.showError(\"No agent messages to copy yet.\");\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tawait copyToClipboard(text);\n\t\t\tthis.ctx.showStatus(\"Copied last agent message to clipboard\");\n\t\t} catch (error) {\n\t\t\tthis.ctx.showError(error instanceof Error ? error.message : String(error));\n\t\t}\n\t}\n\n\t/** The session's chip as it currently renders, for echoing back after a change. */\n\tprivate currentChip(): string {\n\t\tconst chip = renderSessionChip(\n\t\t\tthis.ctx.sessionManager.getDisplayName(),\n\t\t\tthis.ctx.sessionManager.getSessionColorSlot(),\n\t\t);\n\t\treturn chip?.styled ?? this.ctx.sessionManager.getDisplayName();\n\t}\n\n\thandleName(text: string): void {\n\t\tconst name = text.replace(/^\\/name\\s*/, \"\").trim();\n\t\tif (!name) {\n\t\t\t// Every session has a name now — an auto-assigned slug until someone\n\t\t\t// picks one — so there is always something to report, and the reply\n\t\t\t// shows the chip rather than describing it.\n\t\t\tconst chosen = this.ctx.sessionManager.getSessionName();\n\t\t\tconst label = chosen ? \"Session name:\" : \"Session name (auto):\";\n\t\t\tthis.ctx.chatContainer.addChild(new Spacer(1));\n\t\t\tthis.ctx.chatContainer.addChild(\n\t\t\t\tnew Text(\n\t\t\t\t\t`${theme.fg(\"dim\", label)} ${this.currentChip()} ${theme.fg(\"dim\", \"/name <name> to change\")}`,\n\t\t\t\t\t1,\n\t\t\t\t\t0,\n\t\t\t\t),\n\t\t\t);\n\t\t\tthis.ctx.ui.requestRender();\n\t\t\treturn;\n\t\t}\n\n\t\tthis.ctx.session.setSessionName(name);\n\t\tthis.ctx.chatContainer.addChild(new Spacer(1));\n\t\tthis.ctx.chatContainer.addChild(new Text(`${theme.fg(\"dim\", \"Session name set:\")} ${this.currentChip()}`, 1, 0));\n\t\tthis.ctx.ui.requestRender();\n\t}\n\n\t/**\n\t * `/color <slot>` sets the session's chip colour directly, where a slot is a\n\t * number, a name (`green`), or a name's initial (`g`). Bare `/color` is\n\t * handled by the caller, which opens the swatch picker instead — the names\n\t * describe a hue family rather than the exact colour a theme fills the slot\n\t * with, so which one reads best here is still a thing you look at.\n\t *\n\t * The confirmation names the slot it landed on, because the aliases fold\n\t * neighbouring hues together: `/color red` answering with \"magenta\" is how\n\t * you learn the palette has no red of its own.\n\t */\n\thandleColor(text: string): boolean {\n\t\tconst arg = text.replace(/^\\/color\\s*/, \"\").trim();\n\t\tif (!arg) return false;\n\t\tconst slot = parseSessionColorSlot(arg);\n\t\tif (slot === undefined) {\n\t\t\tthis.ctx.showWarning(\n\t\t\t\t`Usage: /color <1-${SESSION_COLOR_SLOTS}> or /color <${SESSION_COLOR_NAME_LIST.join(\"|\")}> ` +\n\t\t\t\t\t\"(first letter works too), or /color on its own to pick one\",\n\t\t\t);\n\t\t\treturn true;\n\t\t}\n\t\tthis.ctx.session.setSessionColor(slot);\n\t\tconst name = sessionColorName(slot);\n\t\tthis.ctx.chatContainer.addChild(new Spacer(1));\n\t\tthis.ctx.chatContainer.addChild(\n\t\t\tnew Text(\n\t\t\t\t`${theme.fg(\"dim\", \"Session color set:\")} ${this.currentChip()}${name ? ` ${theme.fg(\"dim\", name)}` : \"\"}`,\n\t\t\t\t1,\n\t\t\t\t0,\n\t\t\t),\n\t\t);\n\t\tthis.ctx.ui.requestRender();\n\t\treturn true;\n\t}\n\n\thandleSession(): void {\n\t\tconst stats = this.ctx.session.getSessionStats();\n\t\tconst sessionName = this.ctx.sessionManager.getSessionName();\n\n\t\tlet info = `${theme.bold(\"Session Info\")}\\n\\n`;\n\t\tinfo += `${theme.fg(\"dim\", sessionName ? \"Name:\" : \"Name (auto):\")} ${this.currentChip()}\\n`;\n\t\tconst branch = this.ctx.sessionManager.getSessionBranch();\n\t\tif (branch) {\n\t\t\tinfo += `${theme.fg(\"dim\", \"Branch:\")} ${branch}\\n`;\n\t\t}\n\t\tinfo += `${theme.fg(\"dim\", \"File:\")} ${stats.sessionFile ?? \"In-memory\"}\\n`;\n\t\tinfo += `${theme.fg(\"dim\", \"ID:\")} ${stats.sessionId}\\n\\n`;\n\t\tinfo += `${theme.bold(\"Messages\")}\\n`;\n\t\tinfo += `${theme.fg(\"dim\", \"User:\")} ${stats.userMessages}\\n`;\n\t\tinfo += `${theme.fg(\"dim\", \"Assistant:\")} ${stats.assistantMessages}\\n`;\n\t\tinfo += `${theme.fg(\"dim\", \"Tool Calls:\")} ${stats.toolCalls}\\n`;\n\t\tinfo += `${theme.fg(\"dim\", \"Tool Results:\")} ${stats.toolResults}\\n`;\n\t\tinfo += `${theme.fg(\"dim\", \"Total:\")} ${stats.totalMessages}\\n\\n`;\n\t\tinfo += `${theme.bold(\"Tokens\")}\\n`;\n\t\tinfo += `${theme.fg(\"dim\", \"Input:\")} ${stats.tokens.input.toLocaleString()}\\n`;\n\t\tinfo += `${theme.fg(\"dim\", \"Output:\")} ${stats.tokens.output.toLocaleString()}\\n`;\n\t\tif (stats.tokens.cacheRead > 0) {\n\t\t\tinfo += `${theme.fg(\"dim\", \"Cache Read:\")} ${stats.tokens.cacheRead.toLocaleString()}\\n`;\n\t\t}\n\t\tif (stats.tokens.cacheWrite > 0) {\n\t\t\tinfo += `${theme.fg(\"dim\", \"Cache Write:\")} ${stats.tokens.cacheWrite.toLocaleString()}\\n`;\n\t\t}\n\t\tinfo += `${theme.fg(\"dim\", \"Total:\")} ${stats.tokens.total.toLocaleString()}\\n`;\n\n\t\tif (stats.cost > 0) {\n\t\t\tinfo += `\\n${theme.bold(\"Cost\")}\\n`;\n\t\t\tinfo += `${theme.fg(\"dim\", \"Total:\")} ${stats.cost.toFixed(4)}`;\n\t\t}\n\n\t\tthis.ctx.chatContainer.addChild(new Spacer(1));\n\t\tthis.ctx.chatContainer.addChild(new Text(info, 1, 0));\n\t\tthis.ctx.ui.requestRender();\n\t}\n\n\thandleChangelog(): void {\n\t\tconst changelogPath = getChangelogPath();\n\t\tconst allEntries = parseChangelog(changelogPath);\n\n\t\tif (allEntries.length === 0) {\n\t\t\tthis.ctx.chatContainer.addChild(new Spacer(1));\n\t\t\tthis.ctx.chatContainer.addChild(new Text(theme.fg(\"dim\", \"No changelog entries found.\"), 1, 0));\n\t\t\tthis.ctx.ui.requestRender();\n\t\t\treturn;\n\t\t}\n\n\t\tconst changelogMarkdown = allEntries\n\t\t\t.slice()\n\t\t\t.reverse()\n\t\t\t.map((e) => e.content)\n\t\t\t.join(\"\\n\\n\");\n\n\t\tthis.ctx.chatContainer.addChild(new Spacer(1));\n\t\tthis.ctx.chatContainer.addChild(new DynamicBorder());\n\t\tthis.ctx.chatContainer.addChild(new Text(theme.bold(theme.fg(\"accent\", \"What's New\")), 1, 0));\n\t\tthis.ctx.chatContainer.addChild(new Spacer(1));\n\t\tthis.ctx.chatContainer.addChild(new Markdown(changelogMarkdown, 1, 0, this.ctx.getMarkdownThemeWithSettings()));\n\t\tthis.ctx.chatContainer.addChild(new DynamicBorder());\n\t\tthis.ctx.ui.requestRender();\n\t}\n\n\thandleHotkeys(): void {\n\t\t// Navigation keybindings\n\t\tconst cursorUp = keyDisplayText(\"tui.editor.cursorUp\");\n\t\tconst cursorDown = keyDisplayText(\"tui.editor.cursorDown\");\n\t\tconst cursorLeft = keyDisplayText(\"tui.editor.cursorLeft\");\n\t\tconst cursorRight = keyDisplayText(\"tui.editor.cursorRight\");\n\t\tconst cursorWordLeft = keyDisplayText(\"tui.editor.cursorWordLeft\");\n\t\tconst cursorWordRight = keyDisplayText(\"tui.editor.cursorWordRight\");\n\t\tconst cursorLineStart = keyDisplayText(\"tui.editor.cursorLineStart\");\n\t\tconst cursorLineEnd = keyDisplayText(\"tui.editor.cursorLineEnd\");\n\t\tconst jumpForward = keyDisplayText(\"tui.editor.jumpForward\");\n\t\tconst jumpBackward = keyDisplayText(\"tui.editor.jumpBackward\");\n\t\tconst pageUp = keyDisplayText(\"tui.editor.pageUp\");\n\t\tconst pageDown = keyDisplayText(\"tui.editor.pageDown\");\n\n\t\t// Editing keybindings\n\t\tconst submit = keyDisplayText(\"tui.input.submit\");\n\t\tconst newLine = keyDisplayText(\"tui.input.newLine\");\n\t\tconst deleteWordBackward = keyDisplayText(\"tui.editor.deleteWordBackward\");\n\t\tconst deleteWordForward = keyDisplayText(\"tui.editor.deleteWordForward\");\n\t\tconst deleteToLineStart = keyDisplayText(\"tui.editor.deleteToLineStart\");\n\t\tconst deleteToLineEnd = keyDisplayText(\"tui.editor.deleteToLineEnd\");\n\t\tconst yank = keyDisplayText(\"tui.editor.yank\");\n\t\tconst yankPop = keyDisplayText(\"tui.editor.yankPop\");\n\t\tconst undo = keyDisplayText(\"tui.editor.undo\");\n\t\tconst tab = keyDisplayText(\"tui.input.tab\");\n\n\t\t// App keybindings\n\t\tconst interrupt = keyDisplayText(\"app.interrupt\");\n\t\tconst clear = keyDisplayText(\"app.clear\");\n\t\tconst exit = keyDisplayText(\"app.exit\");\n\t\tconst suspend = keyDisplayText(\"app.suspend\");\n\t\tconst cycleThinkingLevel = keyDisplayText(\"app.thinking.cycle\");\n\t\tconst cycleModelForward = keyDisplayText(\"app.model.cycleForward\");\n\t\tconst selectModel = keyDisplayText(\"app.model.select\");\n\t\tconst expandTools = keyDisplayText(\"app.tools.expand\");\n\t\tconst toggleThinking = keyDisplayText(\"app.thinking.toggle\");\n\t\tconst cycleTaskView = keyDisplayText(\"app.tasks.cycleView\");\n\t\tconst externalEditor = keyDisplayText(\"app.editor.external\");\n\t\tconst cycleModelBackward = keyDisplayText(\"app.model.cycleBackward\");\n\t\tconst followUp = keyDisplayText(\"app.message.followUp\");\n\t\tconst dequeue = keyDisplayText(\"app.message.dequeue\");\n\t\tconst pasteImage = keyDisplayText(\"app.clipboard.pasteImage\");\n\t\tconst viewForward = keyDisplayText(\"app.view.cycleForward\");\n\t\tconst viewBackward = keyDisplayText(\"app.view.cycleBackward\");\n\t\tconst voice = keyDisplayText(\"app.input.voiceTranscribe\");\n\t\tconst changeDirectory = keyDisplayText(\"app.session.changeDirectory\");\n\t\tconst openSettings = keyDisplayText(\"app.settings.open\");\n\t\tconst openHotkeys = keyDisplayText(\"app.hotkeys.open\");\n\t\tconst cycleMode = keyDisplayText(\"app.mode.cycle\");\n\t\tconst sessionTree = keyDisplayText(\"app.session.tree\");\n\t\tconst sessionResume = keyDisplayText(\"app.session.resume\");\n\t\tconst cycleSessionColor = keyDisplayText(\"app.session.color.cycleForward\");\n\t\tconst cycleSessionColorBackward = keyDisplayText(\"app.session.color.cycleBackward\");\n\n\t\tlet hotkeys = `\n**Navigation**\n| Key | Action |\n|-----|--------|\n| \\`${cursorUp}\\` / \\`${cursorDown}\\` / \\`${cursorLeft}\\` / \\`${cursorRight}\\` | Move cursor / browse history (Up when empty) |\n| \\`${cursorWordLeft}\\` / \\`${cursorWordRight}\\` | Move by word |\n| \\`${cursorLineStart}\\` | Start of line |\n| \\`${cursorLineEnd}\\` | End of line |\n| \\`${jumpForward}\\` | Jump forward to character |\n| \\`${jumpBackward}\\` | Jump backward to character |\n| \\`${pageUp}\\` / \\`${pageDown}\\` | Scroll by page |\n\n**Editing**\n| Key | Action |\n|-----|--------|\n| \\`${submit}\\` | Send message |\n| \\`${newLine}\\` | New line${process.platform === \"win32\" ? \" (Ctrl+Enter on Windows Terminal)\" : \"\"} |\n| \\`${deleteWordBackward}\\` | Delete word backwards |\n| \\`${deleteWordForward}\\` | Delete word forwards |\n| \\`${deleteToLineStart}\\` | Delete to start of line |\n| \\`${deleteToLineEnd}\\` | Delete to end of line |\n| \\`${yank}\\` | Paste the most-recently-deleted text |\n| \\`${yankPop}\\` | Cycle through the deleted text after pasting |\n| \\`${undo}\\` | Undo |\n\n**Flow** — the keys you hit without thinking\n| Key | Action |\n|-----|--------|\n| \\`${tab}\\` | Path completion / accept autocomplete |\n| \\`${interrupt}\\` | Cancel autocomplete / abort streaming |\n| \\`${clear}\\` | Clear editor (first) / exit (second) |\n| \\`${exit}\\` | Exit (when editor is empty) |\n| \\`${suspend}\\` | Suspend to background |\n| \\`${followUp}\\` | Queue follow-up message |\n| \\`${dequeue}\\` | Restore queued messages |\n| \\`${pasteImage}\\` | Paste image from clipboard |\n| \\`/\\` | Slash commands |\n| \\`!\\` | Run bash command |\n| \\`!!\\` | Run bash command (excluded from context) |\n\n**View** — what is on screen right now (\\`Ctrl\\`)\n| Key | Action |\n|-----|--------|\n| \\`${expandTools}\\` | Jump to the full view and back |\n| \\`${viewForward}\\` / \\`${viewBackward}\\` | Cycle tool output: radar → peek → full |\n| \\`${toggleThinking}\\` | Toggle thinking block visibility |\n| \\`${cycleTaskView}\\` | Cycle task panel view (tasks → subagents → teams) |\n| \\`${cycleModelForward}\\` / \\`${cycleModelBackward}\\` | Cycle models |\n| \\`${cycleThinkingLevel}\\` | Cycle thinking level |\n\n**Cockpit** — what the agent is, and where it works (\\`Alt\\`)\n| Key | Action |\n|-----|--------|\n| \\`${cycleMode}\\` | Cycle agent mode (ask → plan → build → debug) |\n| \\`${selectModel}\\` | Open model selector |\n| \\`${changeDirectory}\\` | Change working directory (\\`/cd\\`) |\n| \\`${sessionTree}\\` | Open session tree |\n| \\`${sessionResume}\\` | Resume a session from history |\n| \\`${cycleSessionColor}\\` / \\`${cycleSessionColorBackward}\\` | Cycle the session chip's color (\\`/color\\` to pick one) |\n| \\`${openSettings}\\` | Open settings |\n| \\`${openHotkeys}\\` | Show this list |\n| \\`${externalEditor}\\` | Edit message in external editor |\n| \\`${voice}\\` | Record voice and transcribe |\n\nInside a picker, every \\`Ctrl\\` key still edits the query — the picker's own\nverbs are on \\`Alt\\`, and its hint line names them.\n`;\n\n\t\t// Add extension-registered shortcuts\n\t\tconst extensionRunner = this.ctx.session.extensionRunner;\n\t\tconst shortcuts = extensionRunner.getShortcuts(this.ctx.keybindings.getEffectiveConfig());\n\t\tif (shortcuts.size > 0) {\n\t\t\thotkeys += `\n**Extensions**\n| Key | Action |\n|-----|--------|\n`;\n\t\t\tfor (const [key, shortcut] of shortcuts) {\n\t\t\t\tconst description = shortcut.description ?? shortcut.extensionPath;\n\t\t\t\tconst keyDisplay = formatKeyText(key, { capitalize: true });\n\t\t\t\thotkeys += `| \\`${keyDisplay}\\` | ${description} |\\n`;\n\t\t\t}\n\t\t}\n\n\t\tthis.ctx.chatContainer.addChild(new Spacer(1));\n\t\tthis.ctx.chatContainer.addChild(new DynamicBorder());\n\t\tthis.ctx.chatContainer.addChild(new Text(theme.bold(theme.fg(\"accent\", \"Keyboard Shortcuts\")), 1, 0));\n\t\tthis.ctx.chatContainer.addChild(new Spacer(1));\n\t\tthis.ctx.chatContainer.addChild(new Markdown(hotkeys.trim(), 1, 0, this.ctx.getMarkdownThemeWithSettings()));\n\t\tthis.ctx.chatContainer.addChild(new DynamicBorder());\n\t\tthis.ctx.ui.requestRender();\n\t}\n\n\tasync handleClear(): Promise<void> {\n\t\tthis.ctx.stopLoadingAnimation();\n\t\tthis.ctx.statusContainer.clear();\n\t\ttry {\n\t\t\tconst result = await this.ctx.runtimeHost.newSession();\n\t\t\tif (result.cancelled) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis.ctx.renderCurrentSessionState();\n\t\t\tthis.ctx.chatContainer.addChild(new Spacer(1));\n\t\t\tthis.ctx.chatContainer.addChild(new Text(`${theme.fg(\"accent\", \"✓ New session started\")}`, 1, 0));\n\t\t\tthis.ctx.ui.requestRender();\n\t\t} catch (error: unknown) {\n\t\t\tawait this.ctx.handleFatalRuntimeError(\"Failed to create session\", error);\n\t\t}\n\t}\n\n\t/**\n\t * `/cd [path]` — move the whole session to another directory.\n\t *\n\t * Written for the case it exists to serve: you are done in one repo and want\n\t * to work in the next one without losing the process, its provider auth, or\n\t * its warmed model list. Bare `/cd` goes home, `/cd -` goes back to where you\n\t * came from, `~` and relative paths resolve as a shell would.\n\t *\n\t * The move starts a fresh session rooted in the target — see\n\t * `AgentSessionRuntime.changeDirectory` for why the whole runtime is rebuilt\n\t * rather than a cwd string reassigned.\n\t */\n\tasync handleChangeDirectory(text: string): Promise<void> {\n\t\tconst prefix = \"/cd\";\n\t\tconst rawArg = text.startsWith(prefix) ? text.slice(prefix.length).trim() : text.trim();\n\t\tconst previousCwd = this.ctx.sessionManager.getCwd();\n\n\t\tlet target: string;\n\t\tif (!rawArg || rawArg === \"~\") {\n\t\t\ttarget = os.homedir();\n\t\t} else if (rawArg === \"-\") {\n\t\t\tif (!this.previousCwd) {\n\t\t\t\tthis.ctx.showWarning(\"No previous directory to return to\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\ttarget = this.previousCwd;\n\t\t} else {\n\t\t\tconst expanded = rawArg.startsWith(\"~/\") ? path.join(os.homedir(), rawArg.slice(2)) : rawArg;\n\t\t\ttarget = path.resolve(previousCwd, expanded);\n\t\t}\n\n\t\tif (path.resolve(target) === path.resolve(previousCwd)) {\n\t\t\tthis.ctx.showStatus(`Already in ${target}`);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.ctx.stopLoadingAnimation();\n\t\tthis.ctx.statusContainer.clear();\n\t\ttry {\n\t\t\tconst result = await this.ctx.runtimeHost.changeDirectory(target);\n\t\t\tif (result.cancelled) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis.previousCwd = previousCwd;\n\t\t\tthis.ctx.renderCurrentSessionState();\n\t\t\tthis.ctx.chatContainer.addChild(new Spacer(1));\n\t\t\tthis.ctx.chatContainer.addChild(\n\t\t\t\tnew Text(\n\t\t\t\t\t`${theme.fg(\"accent\", \"✓ Working directory\")} ${theme.fg(\"muted\", result.cwd)}\\n` +\n\t\t\t\t\t\ttheme.fg(\n\t\t\t\t\t\t\t\"dim\",\n\t\t\t\t\t\t\t`New session started here. ${keyDisplayText(\"app.session.resume\")} reopens the session you left in ${previousCwd}.`,\n\t\t\t\t\t\t),\n\t\t\t\t\t1,\n\t\t\t\t\t0,\n\t\t\t\t),\n\t\t\t);\n\t\t\tthis.ctx.ui.requestRender();\n\t\t} catch (error: unknown) {\n\t\t\tif (error instanceof ChangeDirectoryError) {\n\t\t\t\tthis.ctx.showError(error.message);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tawait this.ctx.handleFatalRuntimeError(`Failed to change directory to ${target}`, error);\n\t\t}\n\t}\n\n\t/** Directory completions for `/cd <prefix>`, plus the two shell shorthands. */\n\tgetChangeDirectoryCompletions(argumentPrefix: string): Array<{ value: string; label: string }> {\n\t\tconst cwd = this.ctx.sessionManager.getCwd();\n\t\tconst expanded = argumentPrefix.startsWith(\"~/\")\n\t\t\t? path.join(os.homedir(), argumentPrefix.slice(2))\n\t\t\t: argumentPrefix;\n\t\t// A prefix ending in a separator names the directory to list; otherwise the\n\t\t// last segment is a partial name to filter its parent by.\n\t\tconst endsWithSep = expanded.endsWith(\"/\") || expanded.endsWith(path.sep);\n\t\tconst base = endsWithSep ? expanded : path.dirname(expanded);\n\t\tconst partial = endsWithSep ? \"\" : path.basename(expanded);\n\t\tconst searchDir = path.isAbsolute(base) ? base : path.resolve(cwd, base || \".\");\n\n\t\tconst completions: Array<{ value: string; label: string }> = [];\n\t\tif (!argumentPrefix) {\n\t\t\tif (this.previousCwd) completions.push({ value: \"-\", label: `- (${this.previousCwd})` });\n\t\t\tcompletions.push({ value: \"~\", label: `~ (${os.homedir()})` });\n\t\t}\n\n\t\tlet entries: fs.Dirent[];\n\t\ttry {\n\t\t\tentries = fs.readdirSync(searchDir, { withFileTypes: true });\n\t\t} catch {\n\t\t\treturn completions;\n\t\t}\n\n\t\tfor (const entry of entries) {\n\t\t\tif (!entry.isDirectory()) continue;\n\t\t\tif (partial && !entry.name.startsWith(partial)) continue;\n\t\t\tif (!partial && entry.name.startsWith(\".\")) continue;\n\t\t\tconst joined =\n\t\t\t\tbase && !endsWithSep\n\t\t\t\t\t? path.join(path.dirname(argumentPrefix), entry.name)\n\t\t\t\t\t: `${argumentPrefix}${entry.name}`;\n\t\t\tcompletions.push({ value: `${joined}/`, label: `${entry.name}/` });\n\t\t}\n\t\treturn completions.slice(0, 50);\n\t}\n\n\thandleDebug(): void {\n\t\tconst width = this.ctx.ui.terminal.columns;\n\t\tconst height = this.ctx.ui.terminal.rows;\n\t\tconst allLines = this.ctx.ui.render(width);\n\n\t\tconst debugLogPath = getDebugLogPath();\n\t\tconst debugData = [\n\t\t\t`Debug output at ${new Date().toISOString()}`,\n\t\t\t`Terminal: ${width}x${height}`,\n\t\t\t`Total lines: ${allLines.length}`,\n\t\t\t\"\",\n\t\t\t\"=== All rendered lines with visible widths ===\",\n\t\t\t...allLines.map((line, idx) => {\n\t\t\t\tconst vw = visibleWidth(line);\n\t\t\t\tconst escaped = JSON.stringify(line);\n\t\t\t\treturn `[${idx}] (w=${vw}) ${escaped}`;\n\t\t\t}),\n\t\t\t\"\",\n\t\t\t\"=== Agent messages (JSONL) ===\",\n\t\t\t...this.ctx.session.messages.map((msg) => JSON.stringify(msg)),\n\t\t\t\"\",\n\t\t].join(\"\\n\");\n\n\t\tfs.mkdirSync(path.dirname(debugLogPath), { recursive: true });\n\t\tfs.writeFileSync(debugLogPath, debugData);\n\n\t\tthis.ctx.chatContainer.addChild(new Spacer(1));\n\t\tthis.ctx.chatContainer.addChild(\n\t\t\tnew Text(`${theme.fg(\"accent\", \"✓ Debug log written\")}\\n${theme.fg(\"muted\", debugLogPath)}`, 1, 0),\n\t\t);\n\t\tthis.ctx.ui.requestRender();\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"command-executor.js","sourceRoot":"","sources":["../../../src/modes/interactive/command-executor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAGlC,OAAO,EAAkB,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAChG,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAGjE,OAAO,EAAE,oBAAoB,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AAE3G,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EACN,qBAAqB,EACrB,uBAAuB,EACvB,mBAAmB,EACnB,gBAAgB,GAChB,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAEvE,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAE/D,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClG,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,KAAK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D,EAAE,CAAC,aAAa,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;QAE1C,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QAC/C,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,QAAQ,CAC9B,IAAI,IAAI,CAAC,GAAG,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,uBAAqB,CAAC,KAAK,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,YAAY,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAClG,CAAC;QACF,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC;IAAA,CAC5B;CACD","sourcesContent":["/**\n * Extracted command handlers from InteractiveMode.\n * All methods receive dependencies via CommandContext rather than\n * reaching back into the parent class.\n */\n\nimport * as fs from \"node:fs\";\nimport * as os from \"node:os\";\nimport * as path from \"node:path\";\nimport type { Model } from \"@kolisachint/hoocode-ai\";\nimport type { EditorComponent, MarkdownTheme, TUI } from \"@kolisachint/hoocode-tui\";\nimport { type Container, Markdown, Spacer, Text, visibleWidth } from \"@kolisachint/hoocode-tui\";\nimport { spawn, spawnSync } from \"child_process\";\nimport { getDebugLogPath, getShareViewerUrl } from \"../../config.js\";\nimport { loadAgentRegistry } from \"../../core/agent-registry.js\";\nimport type { AgentSession } from \"../../core/agent-session.js\";\nimport type { AgentSessionRuntime } from \"../../core/agent-session-runtime.js\";\nimport { ChangeDirectoryError, SessionImportFileNotFoundError } from \"../../core/agent-session-runtime.js\";\nimport type { KeybindingsManager } from \"../../core/keybindings.js\";\nimport { MissingSessionCwdError } from \"../../core/session-cwd.js\";\nimport {\n\tparseSessionColorSlot,\n\tSESSION_COLOR_NAME_LIST,\n\tSESSION_COLOR_SLOTS,\n\tsessionColorName,\n} from \"../../core/session-identity.js\";\nimport type { SessionManager } from \"../../core/session-manager.js\";\nimport { getSubagentPool } from \"../../core/subagent-pool-instance.js\";\nimport type { SubagentResultFile } from \"../../core/subagent-result.js\";\nimport { getChangelogPath, parseChangelog } from \"../../utils/changelog.js\";\nimport { copyToClipboard } from \"../../utils/clipboard.js\";\nimport { BorderedLoader } from \"./components/bordered-loader.js\";\nimport { DynamicBorder } from \"./components/dynamic-border.js\";\nimport type { FooterComponent } from \"./components/footer.js\";\nimport { formatKeyText, keyDisplayLabel, keyDisplayText } from \"./components/keybinding-hints.js\";\nimport { renderSessionChip } from \"./components/session-chip.js\";\nimport { theme } from \"./theme/theme.js\";\n\nexport interface CommandContext {\n\t// Core dependencies\n\tsession: AgentSession;\n\tsessionManager: SessionManager;\n\truntimeHost: AgentSessionRuntime;\n\tui: TUI;\n\teditor: EditorComponent;\n\teditorContainer: Container;\n\tchatContainer: Container;\n\tstatusContainer: Container;\n\tfooter: FooterComponent;\n\tkeybindings: KeybindingsManager;\n\n\t// UI callbacks\n\tshowStatus: (message: string) => void;\n\tshowError: (message: string) => void;\n\tshowWarning: (message: string) => void;\n\tupdateEditorBorderColor: () => void;\n\trenderCurrentSessionState: () => void;\n\trebuildChatFromMessages: () => void;\n\tgetMarkdownThemeWithSettings: () => MarkdownTheme;\n\tstopLoadingAnimation: () => void;\n\n\t// Auth/model helpers\n\tfindExactModelMatch: (searchTerm: string) => Promise<Model<any> | undefined>;\n\tmaybeWarnAboutAnthropicSubscriptionAuth: (model?: Model<any>) => Promise<void>;\n\n\t// Dialog callbacks\n\tshowModelSelector: (searchTerm?: string) => void;\n\tshowExtensionConfirm: (title: string, message: string) => Promise<boolean>;\n\tpromptForMissingSessionCwd: (error: MissingSessionCwdError) => Promise<string | undefined>;\n\n\t// Fatal error handler\n\thandleFatalRuntimeError: (prefix: string, error: unknown) => Promise<never>;\n}\n\nexport class CommandExecutor {\n\t/** Where `/cd -` returns to. Set on every successful move, session-local. */\n\tprivate previousCwd?: string;\n\n\tconstructor(private readonly ctx: CommandContext) {}\n\n\t// =========================================================================\n\t// Slash command handlers\n\t// =========================================================================\n\n\tasync handleModel(searchTerm?: string): Promise<void> {\n\t\tif (!searchTerm) {\n\t\t\tthis.ctx.showModelSelector();\n\t\t\treturn;\n\t\t}\n\n\t\tconst model = await this.ctx.findExactModelMatch(searchTerm);\n\t\tif (model) {\n\t\t\ttry {\n\t\t\t\tawait this.ctx.session.setModel(model);\n\t\t\t\tthis.ctx.footer.invalidate();\n\t\t\t\tthis.ctx.updateEditorBorderColor();\n\t\t\t\tthis.ctx.showStatus(`Model: ${model.id}`);\n\t\t\t\tvoid this.ctx.maybeWarnAboutAnthropicSubscriptionAuth(model);\n\t\t\t} catch (error) {\n\t\t\t\tthis.ctx.showError(error instanceof Error ? error.message : String(error));\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tthis.ctx.showModelSelector(searchTerm);\n\t}\n\n\tasync handleClone(): Promise<void> {\n\t\tconst leafId = this.ctx.sessionManager.getLeafId();\n\t\tif (!leafId) {\n\t\t\tthis.ctx.showStatus(\"Nothing to clone yet\");\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tconst result = await this.ctx.runtimeHost.fork(leafId, { position: \"at\" });\n\t\t\tif (result.cancelled) {\n\t\t\t\tthis.ctx.ui.requestRender();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.ctx.renderCurrentSessionState();\n\t\t\tthis.ctx.editor.setText(\"\");\n\t\t\tthis.ctx.showStatus(\"Cloned to new session\");\n\t\t} catch (error: unknown) {\n\t\t\tthis.ctx.showError(error instanceof Error ? error.message : String(error));\n\t\t}\n\t}\n\n\tasync handleSubagent(text: string): Promise<void> {\n\t\tconst prefix = \"/subagent \";\n\t\tconst args = text.startsWith(prefix) ? text.slice(prefix.length).trim() : \"\";\n\t\tif (!args) {\n\t\t\tthis.ctx.showStatus(\"Usage: /subagent <mode> <task>\");\n\t\t\treturn;\n\t\t}\n\n\t\tconst firstSpace = args.indexOf(\" \");\n\t\tif (firstSpace === -1) {\n\t\t\tthis.ctx.showStatus(\"Usage: /subagent <mode> <task>\");\n\t\t\treturn;\n\t\t}\n\n\t\tconst mode = args.slice(0, firstSpace).trim();\n\t\tconst task = args.slice(firstSpace + 1).trim();\n\t\tif (!task) {\n\t\t\tthis.ctx.showStatus(\"Usage: /subagent <mode> <task>\");\n\t\t\treturn;\n\t\t}\n\n\t\tconst validModes = loadAgentRegistry({ cwd: this.ctx.sessionManager.getCwd() })\n\t\t\t.list()\n\t\t\t.map((a) => a.name);\n\t\tif (!validModes.includes(mode)) {\n\t\t\tthis.ctx.showStatus(`Unknown subagent_type: ${mode}. Available: ${validModes.join(\", \")}`);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.ctx.showStatus(`Spawning ${mode} subagent...`);\n\t\ttry {\n\t\t\tconst pool = getSubagentPool(this.ctx.sessionManager.getCwd(), this.ctx.session.modelRegistry.getAvailable());\n\t\t\tconst dispatchResult = await pool.dispatch(task, {\n\t\t\t\tforceAgent: mode,\n\t\t\t\tmodel: this.ctx.session.model?.id,\n\t\t\t\tprovider: this.ctx.session.model?.provider,\n\t\t\t});\n\t\t\tconst result = dispatchResult.result;\n\t\t\tconst resultData = result?.result_data as SubagentResultFile | undefined;\n\t\t\tif (result?.ok) {\n\t\t\t\tthis.ctx.showStatus(`${mode} subagent completed`);\n\t\t\t\t// Inject the subagent answer as a custom message so the user can see it in the chat\n\t\t\t\tthis.ctx.sessionManager.appendMessage({\n\t\t\t\t\trole: \"custom\",\n\t\t\t\t\tcustomType: \"subagent\",\n\t\t\t\t\tcontent: resultData?.summary || \"(no output)\",\n\t\t\t\t\tdisplay: true,\n\t\t\t\t\ttimestamp: Date.now(),\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tthis.ctx.showError(`Subagent (${mode}) failed: ${result?.error ?? \"unknown error\"}`);\n\t\t\t}\n\t\t} catch (error: unknown) {\n\t\t\tthis.ctx.showError(error instanceof Error ? error.message : String(error));\n\t\t}\n\t}\n\n\tasync handleExport(text: string): Promise<void> {\n\t\tconst outputPath = this.getPathArgument(text, \"/export\");\n\n\t\ttry {\n\t\t\tif (outputPath?.endsWith(\".jsonl\")) {\n\t\t\t\tconst filePath = this.ctx.session.exportToJsonl(outputPath);\n\t\t\t\tthis.ctx.showStatus(`Session exported to: ${filePath}`);\n\t\t\t} else {\n\t\t\t\tconst filePath = await this.ctx.session.exportToHtml(outputPath);\n\t\t\t\tthis.ctx.showStatus(`Session exported to: ${filePath}`);\n\t\t\t}\n\t\t} catch (error: unknown) {\n\t\t\tthis.ctx.showError(`Failed to export session: ${error instanceof Error ? error.message : \"Unknown error\"}`);\n\t\t}\n\t}\n\n\tprivate getPathArgument(text: string, command: \"/export\" | \"/import\"): string | undefined {\n\t\tif (text === command) {\n\t\t\treturn undefined;\n\t\t}\n\t\tif (!text.startsWith(`${command} `)) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst argsString = text.slice(command.length + 1).trimStart();\n\t\tif (!argsString) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst firstChar = argsString[0];\n\t\tif (firstChar === '\"' || firstChar === \"'\") {\n\t\t\tconst closingQuoteIndex = argsString.indexOf(firstChar, 1);\n\t\t\tif (closingQuoteIndex < 0) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\treturn argsString.slice(1, closingQuoteIndex);\n\t\t}\n\n\t\tconst firstWhitespaceIndex = argsString.search(/\\s/);\n\t\tif (firstWhitespaceIndex < 0) {\n\t\t\treturn argsString;\n\t\t}\n\t\treturn argsString.slice(0, firstWhitespaceIndex);\n\t}\n\n\tasync handleImport(text: string): Promise<void> {\n\t\tconst inputPath = this.getPathArgument(text, \"/import\");\n\t\tif (!inputPath) {\n\t\t\tthis.ctx.showError(\"Usage: /import <path.jsonl>\");\n\t\t\treturn;\n\t\t}\n\n\t\tconst confirmed = await this.ctx.showExtensionConfirm(\n\t\t\t\"Import session\",\n\t\t\t`Replace current session with ${inputPath}?`,\n\t\t);\n\t\tif (!confirmed) {\n\t\t\tthis.ctx.showStatus(\"Import cancelled\");\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tthis.ctx.stopLoadingAnimation();\n\t\t\tthis.ctx.statusContainer.clear();\n\t\t\tconst result = await this.ctx.runtimeHost.importFromJsonl(inputPath);\n\t\t\tif (result.cancelled) {\n\t\t\t\tthis.ctx.showStatus(\"Import cancelled\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis.ctx.renderCurrentSessionState();\n\t\t\tthis.ctx.showStatus(`Session imported from: ${inputPath}`);\n\t\t} catch (error: unknown) {\n\t\t\tif (error instanceof MissingSessionCwdError) {\n\t\t\t\tconst selectedCwd = await this.ctx.promptForMissingSessionCwd(error);\n\t\t\t\tif (!selectedCwd) {\n\t\t\t\t\tthis.ctx.showStatus(\"Import cancelled\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst result = await this.ctx.runtimeHost.importFromJsonl(inputPath, selectedCwd);\n\t\t\t\tif (result.cancelled) {\n\t\t\t\t\tthis.ctx.showStatus(\"Import cancelled\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tthis.ctx.renderCurrentSessionState();\n\t\t\t\tthis.ctx.showStatus(`Session imported from: ${inputPath}`);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (error instanceof SessionImportFileNotFoundError) {\n\t\t\t\tthis.ctx.showError(`Failed to import session: ${error.message}`);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tawait this.ctx.handleFatalRuntimeError(\"Failed to import session\", error);\n\t\t}\n\t}\n\n\tasync handleShare(): Promise<void> {\n\t\t// Check if gh is available and logged in\n\t\ttry {\n\t\t\tconst authResult = spawnSync(\"gh\", [\"auth\", \"status\"], { encoding: \"utf-8\" });\n\t\t\tif (authResult.status !== 0) {\n\t\t\t\tthis.ctx.showError(\"GitHub CLI is not logged in. Run 'gh auth login' first.\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t} catch {\n\t\t\tthis.ctx.showError(\"GitHub CLI (gh) is not installed. Install it from https://cli.github.com/\");\n\t\t\treturn;\n\t\t}\n\n\t\t// Export to a temp file\n\t\tconst tmpFile = path.join(os.tmpdir(), \"session.html\");\n\t\ttry {\n\t\t\tawait this.ctx.session.exportToHtml(tmpFile);\n\t\t} catch (error: unknown) {\n\t\t\tthis.ctx.showError(`Failed to export session: ${error instanceof Error ? error.message : \"Unknown error\"}`);\n\t\t\treturn;\n\t\t}\n\n\t\t// Show cancellable loader, replacing the editor\n\t\tconst loader = new BorderedLoader(this.ctx.ui, theme, \"Creating gist...\");\n\t\tthis.ctx.editorContainer.clear();\n\t\tthis.ctx.editorContainer.addChild(loader);\n\t\tthis.ctx.ui.setFocus(loader);\n\t\tthis.ctx.ui.requestRender();\n\n\t\tconst restoreEditor = () => {\n\t\t\tloader.dispose();\n\t\t\tthis.ctx.editorContainer.clear();\n\t\t\tthis.ctx.editorContainer.addChild(this.ctx.editor);\n\t\t\tthis.ctx.ui.setFocus(this.ctx.editor);\n\t\t\ttry {\n\t\t\t\tfs.unlinkSync(tmpFile);\n\t\t\t} catch {\n\t\t\t\t// Ignore cleanup errors\n\t\t\t}\n\t\t};\n\n\t\t// Create a secret gist asynchronously\n\t\tlet proc: ReturnType<typeof spawn> | null = null;\n\n\t\tloader.onAbort = () => {\n\t\t\tproc?.kill();\n\t\t\trestoreEditor();\n\t\t\tthis.ctx.showStatus(\"Share cancelled\");\n\t\t};\n\n\t\ttry {\n\t\t\tconst result = await new Promise<{ stdout: string; stderr: string; code: number | null }>((resolve) => {\n\t\t\t\tproc = spawn(\"gh\", [\"gist\", \"create\", \"--public=false\", tmpFile]);\n\t\t\t\tlet stdout = \"\";\n\t\t\t\tlet stderr = \"\";\n\t\t\t\tproc.stdout?.on(\"data\", (data) => {\n\t\t\t\t\tstdout += data.toString();\n\t\t\t\t});\n\t\t\t\tproc.stderr?.on(\"data\", (data) => {\n\t\t\t\t\tstderr += data.toString();\n\t\t\t\t});\n\t\t\t\tproc.on(\"close\", (code) => resolve({ stdout, stderr, code }));\n\t\t\t});\n\n\t\t\tif (loader.signal.aborted) return;\n\n\t\t\trestoreEditor();\n\n\t\t\tif (result.code !== 0) {\n\t\t\t\tconst errorMsg = result.stderr?.trim() || \"Unknown error\";\n\t\t\t\tthis.ctx.showError(`Failed to create gist: ${errorMsg}`);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Extract gist ID from the URL returned by gh\n\t\t\t// gh returns something like: https://gist.github.com/username/GIST_ID\n\t\t\tconst gistUrl = result.stdout?.trim();\n\t\t\tconst gistId = gistUrl?.split(\"/\").pop();\n\t\t\tif (!gistId) {\n\t\t\t\tthis.ctx.showError(\"Failed to parse gist ID from gh output\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Create the preview URL\n\t\t\tconst previewUrl = getShareViewerUrl(gistId);\n\t\t\tthis.ctx.showStatus(`Share URL: ${previewUrl}\\nGist: ${gistUrl}`);\n\t\t} catch (error: unknown) {\n\t\t\tif (!loader.signal.aborted) {\n\t\t\t\trestoreEditor();\n\t\t\t\tthis.ctx.showError(`Failed to create gist: ${error instanceof Error ? error.message : \"Unknown error\"}`);\n\t\t\t}\n\t\t}\n\t}\n\n\tasync handleCopy(): Promise<void> {\n\t\tconst text = this.ctx.session.getLastAssistantText();\n\t\tif (!text) {\n\t\t\tthis.ctx.showError(\"No agent messages to copy yet.\");\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tawait copyToClipboard(text);\n\t\t\tthis.ctx.showStatus(\"Copied last agent message to clipboard\");\n\t\t} catch (error) {\n\t\t\tthis.ctx.showError(error instanceof Error ? error.message : String(error));\n\t\t}\n\t}\n\n\t/** The session's chip as it currently renders, for echoing back after a change. */\n\tprivate currentChip(): string {\n\t\tconst chip = renderSessionChip(\n\t\t\tthis.ctx.sessionManager.getDisplayName(),\n\t\t\tthis.ctx.sessionManager.getSessionColorSlot(),\n\t\t);\n\t\treturn chip?.styled ?? this.ctx.sessionManager.getDisplayName();\n\t}\n\n\thandleName(text: string): void {\n\t\tconst name = text.replace(/^\\/name\\s*/, \"\").trim();\n\t\tif (!name) {\n\t\t\t// Every session has a name now — an auto-assigned slug until someone\n\t\t\t// picks one — so there is always something to report, and the reply\n\t\t\t// shows the chip rather than describing it.\n\t\t\tconst chosen = this.ctx.sessionManager.getSessionName();\n\t\t\tconst label = chosen ? \"Session name:\" : \"Session name (auto):\";\n\t\t\tthis.ctx.chatContainer.addChild(new Spacer(1));\n\t\t\tthis.ctx.chatContainer.addChild(\n\t\t\t\tnew Text(\n\t\t\t\t\t`${theme.fg(\"dim\", label)} ${this.currentChip()} ${theme.fg(\"dim\", \"/name <name> to change\")}`,\n\t\t\t\t\t1,\n\t\t\t\t\t0,\n\t\t\t\t),\n\t\t\t);\n\t\t\tthis.ctx.ui.requestRender();\n\t\t\treturn;\n\t\t}\n\n\t\tthis.ctx.session.setSessionName(name);\n\t\tthis.ctx.chatContainer.addChild(new Spacer(1));\n\t\tthis.ctx.chatContainer.addChild(new Text(`${theme.fg(\"dim\", \"Session name set:\")} ${this.currentChip()}`, 1, 0));\n\t\tthis.ctx.ui.requestRender();\n\t}\n\n\t/**\n\t * `/color <slot>` sets the session's chip colour directly, where a slot is a\n\t * number, a name (`green`), or a name's initial (`g`). Bare `/color` is\n\t * handled by the caller, which opens the swatch picker instead — the names\n\t * describe a hue family rather than the exact colour a theme fills the slot\n\t * with, so which one reads best here is still a thing you look at.\n\t *\n\t * The confirmation names the slot it landed on, because the aliases fold\n\t * neighbouring hues together: `/color red` answering with \"magenta\" is how\n\t * you learn the palette has no red of its own.\n\t */\n\thandleColor(text: string): boolean {\n\t\tconst arg = text.replace(/^\\/color\\s*/, \"\").trim();\n\t\tif (!arg) return false;\n\t\tconst slot = parseSessionColorSlot(arg);\n\t\tif (slot === undefined) {\n\t\t\tthis.ctx.showWarning(\n\t\t\t\t`Usage: /color <1-${SESSION_COLOR_SLOTS}> or /color <${SESSION_COLOR_NAME_LIST.join(\"|\")}> ` +\n\t\t\t\t\t\"(first letter works too), or /color on its own to pick one\",\n\t\t\t);\n\t\t\treturn true;\n\t\t}\n\t\tthis.ctx.session.setSessionColor(slot);\n\t\tconst name = sessionColorName(slot);\n\t\tthis.ctx.chatContainer.addChild(new Spacer(1));\n\t\tthis.ctx.chatContainer.addChild(\n\t\t\tnew Text(\n\t\t\t\t`${theme.fg(\"dim\", \"Session color set:\")} ${this.currentChip()}${name ? ` ${theme.fg(\"dim\", name)}` : \"\"}`,\n\t\t\t\t1,\n\t\t\t\t0,\n\t\t\t),\n\t\t);\n\t\tthis.ctx.ui.requestRender();\n\t\treturn true;\n\t}\n\n\thandleSession(): void {\n\t\tconst stats = this.ctx.session.getSessionStats();\n\t\tconst sessionName = this.ctx.sessionManager.getSessionName();\n\n\t\tlet info = `${theme.bold(\"Session Info\")}\\n\\n`;\n\t\tinfo += `${theme.fg(\"dim\", sessionName ? \"Name:\" : \"Name (auto):\")} ${this.currentChip()}\\n`;\n\t\tconst branch = this.ctx.sessionManager.getSessionBranch();\n\t\tif (branch) {\n\t\t\tinfo += `${theme.fg(\"dim\", \"Branch:\")} ${branch}\\n`;\n\t\t}\n\t\tinfo += `${theme.fg(\"dim\", \"File:\")} ${stats.sessionFile ?? \"In-memory\"}\\n`;\n\t\tinfo += `${theme.fg(\"dim\", \"ID:\")} ${stats.sessionId}\\n\\n`;\n\t\tinfo += `${theme.bold(\"Messages\")}\\n`;\n\t\tinfo += `${theme.fg(\"dim\", \"User:\")} ${stats.userMessages}\\n`;\n\t\tinfo += `${theme.fg(\"dim\", \"Assistant:\")} ${stats.assistantMessages}\\n`;\n\t\tinfo += `${theme.fg(\"dim\", \"Tool Calls:\")} ${stats.toolCalls}\\n`;\n\t\tinfo += `${theme.fg(\"dim\", \"Tool Results:\")} ${stats.toolResults}\\n`;\n\t\tinfo += `${theme.fg(\"dim\", \"Total:\")} ${stats.totalMessages}\\n\\n`;\n\t\tinfo += `${theme.bold(\"Tokens\")}\\n`;\n\t\tinfo += `${theme.fg(\"dim\", \"Input:\")} ${stats.tokens.input.toLocaleString()}\\n`;\n\t\tinfo += `${theme.fg(\"dim\", \"Output:\")} ${stats.tokens.output.toLocaleString()}\\n`;\n\t\tif (stats.tokens.cacheRead > 0) {\n\t\t\tinfo += `${theme.fg(\"dim\", \"Cache Read:\")} ${stats.tokens.cacheRead.toLocaleString()}\\n`;\n\t\t}\n\t\tif (stats.tokens.cacheWrite > 0) {\n\t\t\tinfo += `${theme.fg(\"dim\", \"Cache Write:\")} ${stats.tokens.cacheWrite.toLocaleString()}\\n`;\n\t\t}\n\t\tinfo += `${theme.fg(\"dim\", \"Total:\")} ${stats.tokens.total.toLocaleString()}\\n`;\n\n\t\tif (stats.cost > 0) {\n\t\t\tinfo += `\\n${theme.bold(\"Cost\")}\\n`;\n\t\t\tinfo += `${theme.fg(\"dim\", \"Total:\")} ${stats.cost.toFixed(4)}`;\n\t\t}\n\n\t\tthis.ctx.chatContainer.addChild(new Spacer(1));\n\t\tthis.ctx.chatContainer.addChild(new Text(info, 1, 0));\n\t\tthis.ctx.ui.requestRender();\n\t}\n\n\thandleChangelog(): void {\n\t\tconst changelogPath = getChangelogPath();\n\t\tconst allEntries = parseChangelog(changelogPath);\n\n\t\tif (allEntries.length === 0) {\n\t\t\tthis.ctx.chatContainer.addChild(new Spacer(1));\n\t\t\tthis.ctx.chatContainer.addChild(new Text(theme.fg(\"dim\", \"No changelog entries found.\"), 1, 0));\n\t\t\tthis.ctx.ui.requestRender();\n\t\t\treturn;\n\t\t}\n\n\t\tconst changelogMarkdown = allEntries\n\t\t\t.slice()\n\t\t\t.reverse()\n\t\t\t.map((e) => e.content)\n\t\t\t.join(\"\\n\\n\");\n\n\t\tthis.ctx.chatContainer.addChild(new Spacer(1));\n\t\tthis.ctx.chatContainer.addChild(new DynamicBorder());\n\t\tthis.ctx.chatContainer.addChild(new Text(theme.bold(theme.fg(\"accent\", \"What's New\")), 1, 0));\n\t\tthis.ctx.chatContainer.addChild(new Spacer(1));\n\t\tthis.ctx.chatContainer.addChild(new Markdown(changelogMarkdown, 1, 0, this.ctx.getMarkdownThemeWithSettings()));\n\t\tthis.ctx.chatContainer.addChild(new DynamicBorder());\n\t\tthis.ctx.ui.requestRender();\n\t}\n\n\thandleHotkeys(): void {\n\t\t// Navigation keybindings\n\t\tconst cursorUp = keyDisplayText(\"tui.editor.cursorUp\");\n\t\tconst cursorDown = keyDisplayText(\"tui.editor.cursorDown\");\n\t\tconst cursorLeft = keyDisplayText(\"tui.editor.cursorLeft\");\n\t\tconst cursorRight = keyDisplayText(\"tui.editor.cursorRight\");\n\t\tconst cursorWordLeft = keyDisplayText(\"tui.editor.cursorWordLeft\");\n\t\tconst cursorWordRight = keyDisplayText(\"tui.editor.cursorWordRight\");\n\t\tconst cursorLineStart = keyDisplayText(\"tui.editor.cursorLineStart\");\n\t\tconst cursorLineEnd = keyDisplayText(\"tui.editor.cursorLineEnd\");\n\t\tconst jumpForward = keyDisplayText(\"tui.editor.jumpForward\");\n\t\tconst jumpBackward = keyDisplayText(\"tui.editor.jumpBackward\");\n\t\tconst pageUp = keyDisplayText(\"tui.editor.pageUp\");\n\t\tconst pageDown = keyDisplayText(\"tui.editor.pageDown\");\n\n\t\t// Editing keybindings\n\t\tconst submit = keyDisplayText(\"tui.input.submit\");\n\t\tconst newLine = keyDisplayText(\"tui.input.newLine\");\n\t\tconst deleteWordBackward = keyDisplayText(\"tui.editor.deleteWordBackward\");\n\t\tconst deleteWordForward = keyDisplayText(\"tui.editor.deleteWordForward\");\n\t\tconst deleteToLineStart = keyDisplayText(\"tui.editor.deleteToLineStart\");\n\t\tconst deleteToLineEnd = keyDisplayText(\"tui.editor.deleteToLineEnd\");\n\t\tconst yank = keyDisplayText(\"tui.editor.yank\");\n\t\tconst yankPop = keyDisplayText(\"tui.editor.yankPop\");\n\t\tconst undo = keyDisplayText(\"tui.editor.undo\");\n\t\tconst tab = keyDisplayText(\"tui.input.tab\");\n\n\t\t// App keybindings\n\t\tconst interrupt = keyDisplayText(\"app.interrupt\");\n\t\tconst clear = keyDisplayText(\"app.clear\");\n\t\tconst exit = keyDisplayText(\"app.exit\");\n\t\tconst suspend = keyDisplayText(\"app.suspend\");\n\t\tconst cycleThinkingLevel = keyDisplayLabel(\"app.thinking.cycleForward\");\n\t\tconst cycleThinkingLevelBack = keyDisplayLabel(\"app.thinking.cycleBackward\");\n\t\tconst cycleModelForward = keyDisplayLabel(\"app.model.cycleForward\");\n\t\tconst expandTools = keyDisplayText(\"app.tools.expand\");\n\t\tconst toggleThinking = keyDisplayText(\"app.thinking.toggle\");\n\t\tconst cycleTaskView = keyDisplayLabel(\"app.tasks.cycleForward\");\n\t\tconst cycleTaskViewBack = keyDisplayLabel(\"app.tasks.cycleBackward\");\n\t\tconst teamFocus = keyDisplayText(\"app.team.focus\");\n\t\tconst teamNudge = keyDisplayText(\"app.team.nudge\");\n\t\tconst teamAttach = keyDisplayText(\"app.team.attach\");\n\t\tconst externalEditor = keyDisplayText(\"app.editor.external\");\n\t\tconst cycleModelBackward = keyDisplayLabel(\"app.model.cycleBackward\");\n\t\tconst followUp = keyDisplayText(\"app.message.followUp\");\n\t\tconst dequeue = keyDisplayText(\"app.message.dequeue\");\n\t\tconst pasteImage = keyDisplayText(\"app.clipboard.pasteImage\");\n\t\tconst viewForward = keyDisplayLabel(\"app.view.cycleForward\");\n\t\tconst viewBackward = keyDisplayLabel(\"app.view.cycleBackward\");\n\t\tconst voice = keyDisplayText(\"app.input.voiceTranscribe\");\n\t\tconst changeDirectory = keyDisplayText(\"app.session.changeDirectory\");\n\t\tconst openSettings = keyDisplayText(\"app.settings.open\");\n\t\tconst openHotkeys = keyDisplayText(\"app.hotkeys.open\");\n\t\tconst cycleMode = keyDisplayLabel(\"app.mode.cycleForward\");\n\t\tconst cycleModeBack = keyDisplayLabel(\"app.mode.cycleBackward\");\n\t\tconst sessionResume = keyDisplayText(\"app.session.resume\");\n\t\tconst cycleSessionColor = keyDisplayLabel(\"app.session.color.cycleForward\");\n\t\tconst cycleSessionColorBackward = keyDisplayLabel(\"app.session.color.cycleBackward\");\n\n\t\tlet hotkeys = `\nGrouped by what you are doing, not by what the key is. Five groups, none bigger\nthan five — the size a person can actually hold. Two of them are free: **Flow**\nis what every terminal program already taught you, and every picker prints its\nown keys on its own hint line, so you read those instead of remembering them.\n\n**Compose** — the message in your hands\n| Key | Action |\n|-----|--------|\n| \\`${submit}\\` | Send message |\n| \\`${newLine}\\` | New line${process.platform === \"win32\" ? \" (Ctrl+Enter on Windows Terminal)\" : \"\"} |\n| \\`${tab}\\` | Path completion / accept autocomplete |\n| \\`${externalEditor}\\` | Edit the message in \\`$VISUAL\\` / \\`$EDITOR\\` |\n| \\`${voice}\\` | Speak instead of type |\n| \\`${pasteImage}\\` | Paste image from clipboard |\n| \\`${followUp}\\` | Queue a follow-up while the agent works |\n| \\`${dequeue}\\` | Bring every queued message back to the editor |\n| \\`/\\` \\`!\\` \\`!!\\` | Slash commands · run bash · run bash off the record |\n\n**Steer** — what the agent is before it runs\nThe only three keys that change what happens next, and the only three that cost\nanything. Step forward on the first key, back on the second; the footer shows\nall three.\n\n| Key | Steps | Through |\n|-----|-------|---------|\n| \\`${cycleMode}\\` / \\`${cycleModeBack}\\` | Agent mode | ask → plan → build → debug (\\`/mode\\` picks one) |\n| \\`${cycleModelForward}\\` / \\`${cycleModelBackward}\\` | Model | your enabled models (\\`/model\\` picks one) |\n| \\`${cycleThinkingLevel}\\` / \\`${cycleThinkingLevelBack}\\` | Thinking level | off → … → high |\n\n**Read** — what you see of what it did\nFree and reversible, every one: nothing here touches the work, only the window\nonto it. Press again or add \\`Shift\\` and you are back where you were.\n\n| Key | Action |\n|-----|--------|\n| \\`${viewForward}\\` / \\`${viewBackward}\\` | Step tool output: radar → peek → full |\n| \\`${cycleTaskView}\\` / \\`${cycleTaskViewBack}\\` | Step the task panel: tasks → subagents → teams |\n| \\`${expandTools}\\` | Jump to the full view and back, without moving the dial |\n| \\`${toggleThinking}\\` | Show or hide thinking blocks |\n| \\`${teamFocus}\\` | Focus the team roster — \\`${teamNudge}\\` nudges, \\`${teamAttach}\\` attaches, \\`q\\`/\\`${interrupt}\\` leaves (\\`--team\\`) |\n\n**Go** — sessions and places\nEach takes the screen and hands it back on \\`${interrupt}\\`, and each has a slash\ncommand that does the same thing.\n\n| Key | Action |\n|-----|--------|\n| \\`${sessionResume}\\` | Resume a session from history (\\`/resume\\`) |\n| \\`${changeDirectory}\\` | Change working directory (\\`/cd\\`) |\n| \\`${cycleSessionColor}\\` / \\`${cycleSessionColorBackward}\\` | Step the session chip's color (\\`/color\\` picks one) |\n| \\`${openSettings}\\` | Open settings (\\`/settings\\`) |\n| \\`${openHotkeys}\\` | Show this list (\\`/hotkeys\\`) |\n| \\`/tree\\` | Open the session tree |\n\n**Flow** — getting out, getting back\n| Key | Action |\n|-----|--------|\n| \\`${interrupt}\\` | Cancel autocomplete / abort streaming |\n| \\`${clear}\\` | Clear editor (first) / exit (second) |\n| \\`${exit}\\` | Exit when the editor is empty |\n| \\`${suspend}\\` | Suspend to background |\n\n### What the chord tells you\n\n\\`Alt\\`+letter **sets a value** and nothing takes the screen — you keep typing.\nSix of those are dials, and \\`Shift\\` always steps one back: **a**gent mode,\n**m**odel, **t**hinking, tool **o**utput, task **l**ist, session **c**olor.\n\n\\`Ctrl\\`+letter **acts on what is drawn right now** and shares its letter with the\n\\`Alt\\` key for the same subject. \\`${viewForward}\\` sets how much tool output there\never is, \\`${expandTools}\\` jumps to all of it and back; \\`${cycleThinkingLevel}\\`\nsets how much thinking there ever is, \\`${toggleThinking}\\` shows or hides what you\nhave. Two subjects, two letters, four keys.\n\nThe thinking level also answers to \\`Shift+Tab\\` — it is the one dial with no\nslash command, so that is the way to it on a terminal that does not send \\`Alt\\`.\n\nInside a picker every \\`Ctrl\\` key still edits the query, so the picker's own verbs\nare on \\`Alt\\` and its hint line names them.\n\n### The editor\nStandard readline/emacs bindings — reference, not something to memorise.\n\n| Key | Action |\n|-----|--------|\n| \\`${cursorUp}\\` / \\`${cursorDown}\\` / \\`${cursorLeft}\\` / \\`${cursorRight}\\` | Move cursor / browse history (Up when empty) |\n| \\`${cursorWordLeft}\\` / \\`${cursorWordRight}\\` | Move by word |\n| \\`${cursorLineStart}\\` / \\`${cursorLineEnd}\\` | Start / end of line |\n| \\`${jumpForward}\\` / \\`${jumpBackward}\\` | Jump forward / backward to character |\n| \\`${pageUp}\\` / \\`${pageDown}\\` | Scroll by page |\n| \\`${deleteWordBackward}\\` / \\`${deleteWordForward}\\` | Delete word backwards / forwards |\n| \\`${deleteToLineStart}\\` / \\`${deleteToLineEnd}\\` | Delete to start / end of line |\n| \\`${yank}\\` / \\`${yankPop}\\` | Paste the most-recently-deleted text / cycle older ones |\n| \\`${undo}\\` | Undo |\n`;\n\n\t\t// Add extension-registered shortcuts\n\t\tconst extensionRunner = this.ctx.session.extensionRunner;\n\t\tconst shortcuts = extensionRunner.getShortcuts(this.ctx.keybindings.getEffectiveConfig());\n\t\tif (shortcuts.size > 0) {\n\t\t\thotkeys += `\n**Extensions**\n| Key | Action |\n|-----|--------|\n`;\n\t\t\tfor (const [key, shortcut] of shortcuts) {\n\t\t\t\tconst description = shortcut.description ?? shortcut.extensionPath;\n\t\t\t\tconst keyDisplay = formatKeyText(key, { capitalize: true });\n\t\t\t\thotkeys += `| \\`${keyDisplay}\\` | ${description} |\\n`;\n\t\t\t}\n\t\t}\n\n\t\tthis.ctx.chatContainer.addChild(new Spacer(1));\n\t\tthis.ctx.chatContainer.addChild(new DynamicBorder());\n\t\tthis.ctx.chatContainer.addChild(new Text(theme.bold(theme.fg(\"accent\", \"Keyboard Shortcuts\")), 1, 0));\n\t\tthis.ctx.chatContainer.addChild(new Spacer(1));\n\t\tthis.ctx.chatContainer.addChild(new Markdown(hotkeys.trim(), 1, 0, this.ctx.getMarkdownThemeWithSettings()));\n\t\tthis.ctx.chatContainer.addChild(new DynamicBorder());\n\t\tthis.ctx.ui.requestRender();\n\t}\n\n\tasync handleClear(): Promise<void> {\n\t\tthis.ctx.stopLoadingAnimation();\n\t\tthis.ctx.statusContainer.clear();\n\t\ttry {\n\t\t\tconst result = await this.ctx.runtimeHost.newSession();\n\t\t\tif (result.cancelled) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis.ctx.renderCurrentSessionState();\n\t\t\tthis.ctx.chatContainer.addChild(new Spacer(1));\n\t\t\tthis.ctx.chatContainer.addChild(new Text(`${theme.fg(\"accent\", \"✓ New session started\")}`, 1, 0));\n\t\t\tthis.ctx.ui.requestRender();\n\t\t} catch (error: unknown) {\n\t\t\tawait this.ctx.handleFatalRuntimeError(\"Failed to create session\", error);\n\t\t}\n\t}\n\n\t/**\n\t * `/cd [path]` — move the whole session to another directory.\n\t *\n\t * Written for the case it exists to serve: you are done in one repo and want\n\t * to work in the next one without losing the process, its provider auth, or\n\t * its warmed model list. Bare `/cd` goes home, `/cd -` goes back to where you\n\t * came from, `~` and relative paths resolve as a shell would.\n\t *\n\t * The move starts a fresh session rooted in the target — see\n\t * `AgentSessionRuntime.changeDirectory` for why the whole runtime is rebuilt\n\t * rather than a cwd string reassigned.\n\t */\n\tasync handleChangeDirectory(text: string): Promise<void> {\n\t\tconst prefix = \"/cd\";\n\t\tconst rawArg = text.startsWith(prefix) ? text.slice(prefix.length).trim() : text.trim();\n\t\tconst previousCwd = this.ctx.sessionManager.getCwd();\n\n\t\tlet target: string;\n\t\tif (!rawArg || rawArg === \"~\") {\n\t\t\ttarget = os.homedir();\n\t\t} else if (rawArg === \"-\") {\n\t\t\tif (!this.previousCwd) {\n\t\t\t\tthis.ctx.showWarning(\"No previous directory to return to\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\ttarget = this.previousCwd;\n\t\t} else {\n\t\t\tconst expanded = rawArg.startsWith(\"~/\") ? path.join(os.homedir(), rawArg.slice(2)) : rawArg;\n\t\t\ttarget = path.resolve(previousCwd, expanded);\n\t\t}\n\n\t\tif (path.resolve(target) === path.resolve(previousCwd)) {\n\t\t\tthis.ctx.showStatus(`Already in ${target}`);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.ctx.stopLoadingAnimation();\n\t\tthis.ctx.statusContainer.clear();\n\t\ttry {\n\t\t\tconst result = await this.ctx.runtimeHost.changeDirectory(target);\n\t\t\tif (result.cancelled) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis.previousCwd = previousCwd;\n\t\t\tthis.ctx.renderCurrentSessionState();\n\t\t\tthis.ctx.chatContainer.addChild(new Spacer(1));\n\t\t\tthis.ctx.chatContainer.addChild(\n\t\t\t\tnew Text(\n\t\t\t\t\t`${theme.fg(\"accent\", \"✓ Working directory\")} ${theme.fg(\"muted\", result.cwd)}\\n` +\n\t\t\t\t\t\ttheme.fg(\n\t\t\t\t\t\t\t\"dim\",\n\t\t\t\t\t\t\t`New session started here. ${keyDisplayText(\"app.session.resume\")} reopens the session you left in ${previousCwd}.`,\n\t\t\t\t\t\t),\n\t\t\t\t\t1,\n\t\t\t\t\t0,\n\t\t\t\t),\n\t\t\t);\n\t\t\tthis.ctx.ui.requestRender();\n\t\t} catch (error: unknown) {\n\t\t\tif (error instanceof ChangeDirectoryError) {\n\t\t\t\tthis.ctx.showError(error.message);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tawait this.ctx.handleFatalRuntimeError(`Failed to change directory to ${target}`, error);\n\t\t}\n\t}\n\n\t/** Directory completions for `/cd <prefix>`, plus the two shell shorthands. */\n\tgetChangeDirectoryCompletions(argumentPrefix: string): Array<{ value: string; label: string }> {\n\t\tconst cwd = this.ctx.sessionManager.getCwd();\n\t\tconst expanded = argumentPrefix.startsWith(\"~/\")\n\t\t\t? path.join(os.homedir(), argumentPrefix.slice(2))\n\t\t\t: argumentPrefix;\n\t\t// A prefix ending in a separator names the directory to list; otherwise the\n\t\t// last segment is a partial name to filter its parent by.\n\t\tconst endsWithSep = expanded.endsWith(\"/\") || expanded.endsWith(path.sep);\n\t\tconst base = endsWithSep ? expanded : path.dirname(expanded);\n\t\tconst partial = endsWithSep ? \"\" : path.basename(expanded);\n\t\tconst searchDir = path.isAbsolute(base) ? base : path.resolve(cwd, base || \".\");\n\n\t\tconst completions: Array<{ value: string; label: string }> = [];\n\t\tif (!argumentPrefix) {\n\t\t\tif (this.previousCwd) completions.push({ value: \"-\", label: `- (${this.previousCwd})` });\n\t\t\tcompletions.push({ value: \"~\", label: `~ (${os.homedir()})` });\n\t\t}\n\n\t\tlet entries: fs.Dirent[];\n\t\ttry {\n\t\t\tentries = fs.readdirSync(searchDir, { withFileTypes: true });\n\t\t} catch {\n\t\t\treturn completions;\n\t\t}\n\n\t\tfor (const entry of entries) {\n\t\t\tif (!entry.isDirectory()) continue;\n\t\t\tif (partial && !entry.name.startsWith(partial)) continue;\n\t\t\tif (!partial && entry.name.startsWith(\".\")) continue;\n\t\t\tconst joined =\n\t\t\t\tbase && !endsWithSep\n\t\t\t\t\t? path.join(path.dirname(argumentPrefix), entry.name)\n\t\t\t\t\t: `${argumentPrefix}${entry.name}`;\n\t\t\tcompletions.push({ value: `${joined}/`, label: `${entry.name}/` });\n\t\t}\n\t\treturn completions.slice(0, 50);\n\t}\n\n\thandleDebug(): void {\n\t\tconst width = this.ctx.ui.terminal.columns;\n\t\tconst height = this.ctx.ui.terminal.rows;\n\t\tconst allLines = this.ctx.ui.render(width);\n\n\t\tconst debugLogPath = getDebugLogPath();\n\t\tconst debugData = [\n\t\t\t`Debug output at ${new Date().toISOString()}`,\n\t\t\t`Terminal: ${width}x${height}`,\n\t\t\t`Total lines: ${allLines.length}`,\n\t\t\t\"\",\n\t\t\t\"=== All rendered lines with visible widths ===\",\n\t\t\t...allLines.map((line, idx) => {\n\t\t\t\tconst vw = visibleWidth(line);\n\t\t\t\tconst escaped = JSON.stringify(line);\n\t\t\t\treturn `[${idx}] (w=${vw}) ${escaped}`;\n\t\t\t}),\n\t\t\t\"\",\n\t\t\t\"=== Agent messages (JSONL) ===\",\n\t\t\t...this.ctx.session.messages.map((msg) => JSON.stringify(msg)),\n\t\t\t\"\",\n\t\t].join(\"\\n\");\n\n\t\tfs.mkdirSync(path.dirname(debugLogPath), { recursive: true });\n\t\tfs.writeFileSync(debugLogPath, debugData);\n\n\t\tthis.ctx.chatContainer.addChild(new Spacer(1));\n\t\tthis.ctx.chatContainer.addChild(\n\t\t\tnew Text(`${theme.fg(\"accent\", \"✓ Debug log written\")}\\n${theme.fg(\"muted\", debugLogPath)}`, 1, 0),\n\t\t);\n\t\tthis.ctx.ui.requestRender();\n\t}\n}\n"]}
|
|
@@ -6,12 +6,14 @@
|
|
|
6
6
|
* "INPUT NEEDED" label, and the active row marked with the accent cursor.
|
|
7
7
|
*
|
|
8
8
|
* One decision per step:
|
|
9
|
-
* - tui.select.up / down
|
|
10
|
-
* -
|
|
11
|
-
*
|
|
12
|
-
* -
|
|
13
|
-
* - 1-9
|
|
14
|
-
* - drop onto the custom row and type a free-form answer when none fit
|
|
9
|
+
* - tui.select.up / down move between options (wraps)
|
|
10
|
+
* - app.options.next (→) confirm the highlighted option and advance; on the
|
|
11
|
+
* last step it submits every answer
|
|
12
|
+
* - app.options.back (←) step back to the previous decision
|
|
13
|
+
* - 1-9 quick-pick an option
|
|
14
|
+
* - drop onto the custom row and type a free-form answer when none fit; there
|
|
15
|
+
* the arrows move the text cursor first and only act on the step at its
|
|
16
|
+
* ends, so enter is the key that always commits
|
|
15
17
|
* - tui.select.cancel (esc) skips the whole sequence
|
|
16
18
|
*
|
|
17
19
|
* Answered steps stay on screen as a deterministic breadcrumb so you always
|
|
@@ -34,6 +36,18 @@ export declare class AskOptionsComponent implements Component, Focusable {
|
|
|
34
36
|
invalidate(): void;
|
|
35
37
|
private rowCount;
|
|
36
38
|
private isOnCustomRow;
|
|
39
|
+
/**
|
|
40
|
+
* How the arrow keys divide between the step and the text on the custom row.
|
|
41
|
+
*
|
|
42
|
+
* The step arrows and the text cursor want the same two keys, and they are
|
|
43
|
+
* only ever in conflict on the free-text row with something typed in it.
|
|
44
|
+
* There the text gets first refusal and the step takes what is left over at
|
|
45
|
+
* the ends: `→` at the end of the answer commits it (with nothing typed the
|
|
46
|
+
* end is also the start, which is why the plain custom row still advances),
|
|
47
|
+
* and `←` never leaves the step while there is an answer to lose — stepping
|
|
48
|
+
* back clears the field, which is not what a cursor key should do.
|
|
49
|
+
*/
|
|
50
|
+
private customArrows;
|
|
37
51
|
private spread;
|
|
38
52
|
private renderHints;
|
|
39
53
|
render(width: number): string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ask-options.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/ask-options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EACN,KAAK,SAAS,EACd,KAAK,SAAS,EAMd,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAGrE,qBAAa,mBAAoB,YAAW,SAAS,EAAE,SAAS;IAC/D,OAAO,CAAC,SAAS,CAAgB;IACjC,OAAO,CAAC,IAAI,CAAK;IACjB,OAAO,CAAC,KAAK,CAAK;IAClB,OAAO,CAAC,OAAO,CAAgB;IAC/B,OAAO,CAAC,WAAW,CAAe;IAClC,OAAO,CAAC,gBAAgB,CAA8B;IACtD,OAAO,CAAC,gBAAgB,CAAa;IAErC,OAAO,CAAC,QAAQ,CAAS;IACzB,IAAI,OAAO,IAAI,OAAO,CAErB;IACD,IAAI,OAAO,CAAC,KAAK,EAAE,OAAO,EAGzB;IAED,YAAY,SAAS,EAAE,WAAW,EAAE,EAAE,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,IAAI,EAAE,QAAQ,EAAE,MAAM,IAAI,EAIhG;IAED,UAAU,IAAI,IAAI,CAAG;IAErB,OAAO,CAAC,QAAQ;IAIhB,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,MAAM;IAKd,OAAO,CAAC,WAAW;IAgBnB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAmE9B;IAED,OAAO,CAAC,OAAO;IAmBf,OAAO,CAAC,IAAI;IAOZ,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CA0C9B;CACD","sourcesContent":["/**\n * Options pane — the agent asking the USER for a decision before it acts.\n *\n * Rendered inline in the transcript (never a modal), in the same boxless\n * language as the other selectors: blue rules top & bottom, a cyan\n * \"INPUT NEEDED\" label, and the active row marked with the accent cursor.\n *\n * One decision per step:\n * - tui.select.up / down move between options (wraps)\n * - tui.select.next (→) confirm the highlighted option and advance; on the\n * last step it submits every answer\n * - tui.select.back (←) step back to the previous decision\n * - 1-9 quick-pick an option\n * - drop onto the custom row and type a free-form answer when none fit\n * - tui.select.cancel (esc) skips the whole sequence\n *\n * Answered steps stay on screen as a deterministic breadcrumb so you always\n * see what you've already committed to.\n */\n\nimport {\n\ttype Component,\n\ttype Focusable,\n\tgetKeybindings,\n\tInput,\n\ttype Keybinding,\n\ttruncateToWidth,\n\tvisibleWidth,\n} from \"@kolisachint/hoocode-tui\";\nimport type { AskQuestion } from \"../../../core/extensions/types.js\";\nimport { SELECT_CURSOR, SELECT_GUTTER, theme } from \"../theme/theme.js\";\n\nexport class AskOptionsComponent implements Component, Focusable {\n\tprivate questions: AskQuestion[];\n\tprivate step = 0;\n\tprivate index = 0;\n\tprivate answers: string[] = [];\n\tprivate customInput = new Input();\n\tprivate onSubmitCallback: (answers: string[]) => void;\n\tprivate onCancelCallback: () => void;\n\n\tprivate _focused = false;\n\tget focused(): boolean {\n\t\treturn this._focused;\n\t}\n\tset focused(value: boolean) {\n\t\tthis._focused = value;\n\t\tthis.customInput.focused = value;\n\t}\n\n\tconstructor(questions: AskQuestion[], onSubmit: (answers: string[]) => void, onCancel: () => void) {\n\t\tthis.questions = questions;\n\t\tthis.onSubmitCallback = onSubmit;\n\t\tthis.onCancelCallback = onCancel;\n\t}\n\n\tinvalidate(): void {}\n\n\tprivate rowCount(q: AskQuestion): number {\n\t\treturn q.options.length + (q.allowCustom ? 1 : 0);\n\t}\n\n\tprivate isOnCustomRow(q: AskQuestion): boolean {\n\t\treturn !!q.allowCustom && this.index === q.options.length;\n\t}\n\n\tprivate spread(left: string, right: string, width: number): string {\n\t\tconst gap = Math.max(1, width - visibleWidth(left) - visibleWidth(right));\n\t\treturn truncateToWidth(`${left}${\" \".repeat(gap)}${right}`, width, \"\");\n\t}\n\n\tprivate renderHints(last: boolean): string {\n\t\tconst kb = getKeybindings();\n\t\tconst sep = theme.fg(\"muted\", \" · \");\n\t\tconst hint = (keys: string, desc: string) => theme.fg(\"dim\", keys) + theme.fg(\"muted\", ` ${desc}`);\n\t\tconst upDown = `${kb.getKeys(\"tui.select.up\").join(\"/\")}/${kb.getKeys(\"tui.select.down\").join(\"/\")}`;\n\t\tconst parts = [\n\t\t\thint(upDown, \"move\"),\n\t\t\thint(kb.getKeys(\"app.options.next\" as Keybinding).join(\"/\"), last ? \"submit\" : \"next\"),\n\t\t];\n\t\tif (this.step > 0) {\n\t\t\tparts.push(hint(kb.getKeys(\"app.options.back\" as Keybinding).join(\"/\"), \"back\"));\n\t\t}\n\t\tparts.push(hint(kb.getKeys(\"tui.select.cancel\").join(\"/\"), \"skip\"));\n\t\treturn parts.join(sep);\n\t}\n\n\trender(width: number): string[] {\n\t\tconst lines: string[] = [];\n\t\tconst rule = theme.fg(\"borderAccent\", \"─\".repeat(Math.max(1, width)));\n\t\tconst cur = this.questions[this.step];\n\t\tconst last = this.step === this.questions.length - 1;\n\n\t\tlines.push(rule);\n\n\t\t// Header: \"INPUT NEEDED\" on the left, key hints on the right.\n\t\tconst title = theme.bold(theme.fg(\"borderAccent\", \"INPUT NEEDED\"));\n\t\tlines.push(this.spread(title, this.renderHints(last), width));\n\n\t\t// Answered-step breadcrumb.\n\t\tfor (let i = 0; i < this.step; i++) {\n\t\t\tconst q = this.questions[i];\n\t\t\tconst check = theme.fg(\"success\", \"✓\");\n\t\t\tconst label = theme.fg(\"dim\", q.short ?? q.question);\n\t\t\tconst arrow = theme.fg(\"dim\", \"→ \");\n\t\t\tconst answer = theme.fg(\"accent\", this.answers[i] ?? \"\");\n\t\t\tlines.push(truncateToWidth(`${check} ${label} ${arrow}${answer}`, width, \"...\"));\n\t\t}\n\t\tif (this.step > 0) lines.push(\"\");\n\n\t\t// Current question.\n\t\tconst stepLabel = theme.fg(\"dim\", `${this.step + 1}/${this.questions.length}`);\n\t\tlines.push(truncateToWidth(`${stepLabel} ${theme.bold(cur.question)}`, width, \"...\"));\n\t\tif (cur.detail) lines.push(truncateToWidth(theme.fg(\"muted\", ` ${cur.detail}`), width, \"...\"));\n\t\tlines.push(\"\");\n\n\t\t// Options.\n\t\tfor (let i = 0; i < cur.options.length; i++) {\n\t\t\tconst o = cur.options[i];\n\t\t\tconst active = i === this.index;\n\t\t\tconst cursor = theme.fg(\"accent\", active ? SELECT_CURSOR : SELECT_GUTTER);\n\t\t\tconst num = theme.fg(active ? \"accent\" : \"dim\", String(i + 1));\n\t\t\tconst label = active ? theme.bold(o.label) : o.label;\n\t\t\tlet line = `${cursor}${num} ${label}`;\n\t\t\tif (o.recommended) line += theme.fg(\"success\", \" (recommended)\");\n\t\t\tif (o.description) line += theme.fg(\"muted\", ` ${o.description}`);\n\t\t\tlines.push(truncateToWidth(line, width, \"...\"));\n\t\t}\n\n\t\t// Custom row.\n\t\tif (cur.allowCustom) {\n\t\t\tconst customIndex = cur.options.length;\n\t\t\tconst active = this.index === customIndex;\n\t\t\tconst cursor = theme.fg(\"accent\", active ? SELECT_CURSOR : SELECT_GUTTER);\n\t\t\tconst plus = theme.fg(active ? \"accent\" : \"dim\", \"+\");\n\t\t\tif (active) {\n\t\t\t\tconst value = this.customInput.getValue();\n\t\t\t\tconst prompt = theme.fg(\"accent\", \">\");\n\t\t\t\tconst caret = this._focused ? theme.fg(\"accent\", \"▏\") : \"\";\n\t\t\t\tconst body = value\n\t\t\t\t\t? `${theme.fg(\"text\", value)}${caret}`\n\t\t\t\t\t: `${caret}${theme.fg(\"dim\", \"type your own answer\")}`;\n\t\t\t\tlines.push(truncateToWidth(`${cursor}${plus} ${prompt} ${body}`, width, \"...\"));\n\t\t\t} else {\n\t\t\t\tconst label = theme.fg(\"muted\", \"custom answer\");\n\t\t\t\tconst desc = theme.fg(\"dim\", \"type your own\");\n\t\t\t\tlines.push(truncateToWidth(`${cursor}${plus} ${label} ${desc}`, width, \"...\"));\n\t\t\t}\n\t\t}\n\n\t\t// Count.\n\t\tlines.push(theme.fg(\"dim\", `(${this.index + 1}/${this.rowCount(cur)})`));\n\t\tlines.push(rule);\n\t\treturn lines;\n\t}\n\n\tprivate confirm(): void {\n\t\tconst cur = this.questions[this.step];\n\t\tlet value: string;\n\t\tif (this.isOnCustomRow(cur)) {\n\t\t\tvalue = this.customInput.getValue().trim();\n\t\t\tif (!value) return; // can't submit an empty custom answer\n\t\t} else {\n\t\t\tvalue = cur.options[this.index].label;\n\t\t}\n\t\tthis.answers[this.step] = value;\n\t\tif (this.step < this.questions.length - 1) {\n\t\t\tthis.step += 1;\n\t\t\tthis.index = 0;\n\t\t\tthis.customInput.setValue(\"\");\n\t\t} else {\n\t\t\tthis.onSubmitCallback(this.answers.slice());\n\t\t}\n\t}\n\n\tprivate back(): void {\n\t\tif (this.step === 0) return;\n\t\tthis.step -= 1;\n\t\tthis.index = 0;\n\t\tthis.customInput.setValue(\"\");\n\t}\n\n\thandleInput(data: string): void {\n\t\tconst kb = getKeybindings();\n\t\tconst cur = this.questions[this.step];\n\t\tconst rows = this.rowCount(cur);\n\t\tconst onCustom = this.isOnCustomRow(cur);\n\n\t\tif (kb.matches(data, \"tui.select.up\")) {\n\t\t\tthis.index = this.index === 0 ? rows - 1 : this.index - 1;\n\t\t\treturn;\n\t\t}\n\t\tif (kb.matches(data, \"tui.select.down\")) {\n\t\t\tthis.index = this.index === rows - 1 ? 0 : this.index + 1;\n\t\t\treturn;\n\t\t}\n\t\tif (kb.matches(data, \"app.options.back\" as Keybinding)) {\n\t\t\tthis.back();\n\t\t\treturn;\n\t\t}\n\t\tif (kb.matches(data, \"app.options.next\" as Keybinding) || kb.matches(data, \"tui.select.confirm\")) {\n\t\t\tthis.confirm();\n\t\t\treturn;\n\t\t}\n\t\tif (kb.matches(data, \"tui.select.cancel\")) {\n\t\t\tthis.onCancelCallback();\n\t\t\treturn;\n\t\t}\n\n\t\tif (onCustom) {\n\t\t\t// Delegate free-form typing (insert, backspace, paste, word-delete)\n\t\t\t// to a hidden Input buffer; the value is rendered inline above.\n\t\t\tthis.customInput.handleInput(data);\n\t\t\treturn;\n\t\t}\n\n\t\t// Number quick-pick for the listed options (not the custom row).\n\t\tif (/^[1-9]$/.test(data)) {\n\t\t\tconst n = Number(data) - 1;\n\t\t\tif (n < cur.options.length) {\n\t\t\t\tthis.index = n;\n\t\t\t\tthis.confirm();\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ask-options.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/ask-options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EACN,KAAK,SAAS,EACd,KAAK,SAAS,EAKd,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAGrE,qBAAa,mBAAoB,YAAW,SAAS,EAAE,SAAS;IAC/D,OAAO,CAAC,SAAS,CAAgB;IACjC,OAAO,CAAC,IAAI,CAAK;IACjB,OAAO,CAAC,KAAK,CAAK;IAClB,OAAO,CAAC,OAAO,CAAgB;IAC/B,OAAO,CAAC,WAAW,CAAe;IAClC,OAAO,CAAC,gBAAgB,CAA8B;IACtD,OAAO,CAAC,gBAAgB,CAAa;IAErC,OAAO,CAAC,QAAQ,CAAS;IACzB,IAAI,OAAO,IAAI,OAAO,CAErB;IACD,IAAI,OAAO,CAAC,KAAK,EAAE,OAAO,EAGzB;IAED,YAAY,SAAS,EAAE,WAAW,EAAE,EAAE,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,IAAI,EAAE,QAAQ,EAAE,MAAM,IAAI,EAIhG;IAED,UAAU,IAAI,IAAI,CAAG;IAErB,OAAO,CAAC,QAAQ;IAIhB,OAAO,CAAC,aAAa;IAIrB;;;;;;;;;;OAUG;IACH,OAAO,CAAC,YAAY;IAMpB,OAAO,CAAC,MAAM;IAKd,OAAO,CAAC,WAAW;IAkBnB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAmE9B;IAED,OAAO,CAAC,OAAO;IAmBf,OAAO,CAAC,IAAI;IAOZ,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CA2C9B;CACD","sourcesContent":["/**\n * Options pane — the agent asking the USER for a decision before it acts.\n *\n * Rendered inline in the transcript (never a modal), in the same boxless\n * language as the other selectors: blue rules top & bottom, a cyan\n * \"INPUT NEEDED\" label, and the active row marked with the accent cursor.\n *\n * One decision per step:\n * - tui.select.up / down move between options (wraps)\n * - app.options.next (→) confirm the highlighted option and advance; on the\n * last step it submits every answer\n * - app.options.back (←) step back to the previous decision\n * - 1-9 quick-pick an option\n * - drop onto the custom row and type a free-form answer when none fit; there\n * the arrows move the text cursor first and only act on the step at its\n * ends, so enter is the key that always commits\n * - tui.select.cancel (esc) skips the whole sequence\n *\n * Answered steps stay on screen as a deterministic breadcrumb so you always\n * see what you've already committed to.\n */\n\nimport {\n\ttype Component,\n\ttype Focusable,\n\tgetKeybindings,\n\tInput,\n\ttruncateToWidth,\n\tvisibleWidth,\n} from \"@kolisachint/hoocode-tui\";\nimport type { AskQuestion } from \"../../../core/extensions/types.js\";\nimport { SELECT_CURSOR, SELECT_GUTTER, theme } from \"../theme/theme.js\";\n\nexport class AskOptionsComponent implements Component, Focusable {\n\tprivate questions: AskQuestion[];\n\tprivate step = 0;\n\tprivate index = 0;\n\tprivate answers: string[] = [];\n\tprivate customInput = new Input();\n\tprivate onSubmitCallback: (answers: string[]) => void;\n\tprivate onCancelCallback: () => void;\n\n\tprivate _focused = false;\n\tget focused(): boolean {\n\t\treturn this._focused;\n\t}\n\tset focused(value: boolean) {\n\t\tthis._focused = value;\n\t\tthis.customInput.focused = value;\n\t}\n\n\tconstructor(questions: AskQuestion[], onSubmit: (answers: string[]) => void, onCancel: () => void) {\n\t\tthis.questions = questions;\n\t\tthis.onSubmitCallback = onSubmit;\n\t\tthis.onCancelCallback = onCancel;\n\t}\n\n\tinvalidate(): void {}\n\n\tprivate rowCount(q: AskQuestion): number {\n\t\treturn q.options.length + (q.allowCustom ? 1 : 0);\n\t}\n\n\tprivate isOnCustomRow(q: AskQuestion): boolean {\n\t\treturn !!q.allowCustom && this.index === q.options.length;\n\t}\n\n\t/**\n\t * How the arrow keys divide between the step and the text on the custom row.\n\t *\n\t * The step arrows and the text cursor want the same two keys, and they are\n\t * only ever in conflict on the free-text row with something typed in it.\n\t * There the text gets first refusal and the step takes what is left over at\n\t * the ends: `→` at the end of the answer commits it (with nothing typed the\n\t * end is also the start, which is why the plain custom row still advances),\n\t * and `←` never leaves the step while there is an answer to lose — stepping\n\t * back clears the field, which is not what a cursor key should do.\n\t */\n\tprivate customArrows(): { next: boolean; back: boolean } {\n\t\tif (!this.isOnCustomRow(this.questions[this.step])) return { next: true, back: true };\n\t\tconst typed = this.customInput.getValue().length;\n\t\treturn { next: this.customInput.getCursor() >= typed, back: typed === 0 };\n\t}\n\n\tprivate spread(left: string, right: string, width: number): string {\n\t\tconst gap = Math.max(1, width - visibleWidth(left) - visibleWidth(right));\n\t\treturn truncateToWidth(`${left}${\" \".repeat(gap)}${right}`, width, \"\");\n\t}\n\n\tprivate renderHints(last: boolean): string {\n\t\tconst kb = getKeybindings();\n\t\tconst sep = theme.fg(\"muted\", \" · \");\n\t\tconst hint = (keys: string, desc: string) => theme.fg(\"dim\", keys) + theme.fg(\"muted\", ` ${desc}`);\n\t\tconst upDown = `${kb.getKeys(\"tui.select.up\").join(\"/\")}/${kb.getKeys(\"tui.select.down\").join(\"/\")}`;\n\t\tconst arrows = this.customArrows();\n\t\tconst parts = [hint(upDown, \"move\")];\n\t\t// Mid-answer on the free-text row the arrows are the text cursor's, so the\n\t\t// hint names the key that does commit it.\n\t\tconst nextKeys = arrows.next ? kb.getKeys(\"app.options.next\") : kb.getKeys(\"tui.select.confirm\");\n\t\tparts.push(hint(nextKeys.join(\"/\"), last ? \"submit\" : \"next\"));\n\t\tif (this.step > 0 && arrows.back) {\n\t\t\tparts.push(hint(kb.getKeys(\"app.options.back\").join(\"/\"), \"back\"));\n\t\t}\n\t\tparts.push(hint(kb.getKeys(\"tui.select.cancel\").join(\"/\"), \"skip\"));\n\t\treturn parts.join(sep);\n\t}\n\n\trender(width: number): string[] {\n\t\tconst lines: string[] = [];\n\t\tconst rule = theme.fg(\"borderAccent\", \"─\".repeat(Math.max(1, width)));\n\t\tconst cur = this.questions[this.step];\n\t\tconst last = this.step === this.questions.length - 1;\n\n\t\tlines.push(rule);\n\n\t\t// Header: \"INPUT NEEDED\" on the left, key hints on the right.\n\t\tconst title = theme.bold(theme.fg(\"borderAccent\", \"INPUT NEEDED\"));\n\t\tlines.push(this.spread(title, this.renderHints(last), width));\n\n\t\t// Answered-step breadcrumb.\n\t\tfor (let i = 0; i < this.step; i++) {\n\t\t\tconst q = this.questions[i];\n\t\t\tconst check = theme.fg(\"success\", \"✓\");\n\t\t\tconst label = theme.fg(\"dim\", q.short ?? q.question);\n\t\t\tconst arrow = theme.fg(\"dim\", \"→ \");\n\t\t\tconst answer = theme.fg(\"accent\", this.answers[i] ?? \"\");\n\t\t\tlines.push(truncateToWidth(`${check} ${label} ${arrow}${answer}`, width, \"...\"));\n\t\t}\n\t\tif (this.step > 0) lines.push(\"\");\n\n\t\t// Current question.\n\t\tconst stepLabel = theme.fg(\"dim\", `${this.step + 1}/${this.questions.length}`);\n\t\tlines.push(truncateToWidth(`${stepLabel} ${theme.bold(cur.question)}`, width, \"...\"));\n\t\tif (cur.detail) lines.push(truncateToWidth(theme.fg(\"muted\", ` ${cur.detail}`), width, \"...\"));\n\t\tlines.push(\"\");\n\n\t\t// Options.\n\t\tfor (let i = 0; i < cur.options.length; i++) {\n\t\t\tconst o = cur.options[i];\n\t\t\tconst active = i === this.index;\n\t\t\tconst cursor = theme.fg(\"accent\", active ? SELECT_CURSOR : SELECT_GUTTER);\n\t\t\tconst num = theme.fg(active ? \"accent\" : \"dim\", String(i + 1));\n\t\t\tconst label = active ? theme.bold(o.label) : o.label;\n\t\t\tlet line = `${cursor}${num} ${label}`;\n\t\t\tif (o.recommended) line += theme.fg(\"success\", \" (recommended)\");\n\t\t\tif (o.description) line += theme.fg(\"muted\", ` ${o.description}`);\n\t\t\tlines.push(truncateToWidth(line, width, \"...\"));\n\t\t}\n\n\t\t// Custom row.\n\t\tif (cur.allowCustom) {\n\t\t\tconst customIndex = cur.options.length;\n\t\t\tconst active = this.index === customIndex;\n\t\t\tconst cursor = theme.fg(\"accent\", active ? SELECT_CURSOR : SELECT_GUTTER);\n\t\t\tconst plus = theme.fg(active ? \"accent\" : \"dim\", \"+\");\n\t\t\tif (active) {\n\t\t\t\tconst value = this.customInput.getValue();\n\t\t\t\tconst prompt = theme.fg(\"accent\", \">\");\n\t\t\t\tconst caret = this._focused ? theme.fg(\"accent\", \"▏\") : \"\";\n\t\t\t\tconst body = value\n\t\t\t\t\t? `${theme.fg(\"text\", value)}${caret}`\n\t\t\t\t\t: `${caret}${theme.fg(\"dim\", \"type your own answer\")}`;\n\t\t\t\tlines.push(truncateToWidth(`${cursor}${plus} ${prompt} ${body}`, width, \"...\"));\n\t\t\t} else {\n\t\t\t\tconst label = theme.fg(\"muted\", \"custom answer\");\n\t\t\t\tconst desc = theme.fg(\"dim\", \"type your own\");\n\t\t\t\tlines.push(truncateToWidth(`${cursor}${plus} ${label} ${desc}`, width, \"...\"));\n\t\t\t}\n\t\t}\n\n\t\t// Count.\n\t\tlines.push(theme.fg(\"dim\", `(${this.index + 1}/${this.rowCount(cur)})`));\n\t\tlines.push(rule);\n\t\treturn lines;\n\t}\n\n\tprivate confirm(): void {\n\t\tconst cur = this.questions[this.step];\n\t\tlet value: string;\n\t\tif (this.isOnCustomRow(cur)) {\n\t\t\tvalue = this.customInput.getValue().trim();\n\t\t\tif (!value) return; // can't submit an empty custom answer\n\t\t} else {\n\t\t\tvalue = cur.options[this.index].label;\n\t\t}\n\t\tthis.answers[this.step] = value;\n\t\tif (this.step < this.questions.length - 1) {\n\t\t\tthis.step += 1;\n\t\t\tthis.index = 0;\n\t\t\tthis.customInput.setValue(\"\");\n\t\t} else {\n\t\t\tthis.onSubmitCallback(this.answers.slice());\n\t\t}\n\t}\n\n\tprivate back(): void {\n\t\tif (this.step === 0) return;\n\t\tthis.step -= 1;\n\t\tthis.index = 0;\n\t\tthis.customInput.setValue(\"\");\n\t}\n\n\thandleInput(data: string): void {\n\t\tconst kb = getKeybindings();\n\t\tconst cur = this.questions[this.step];\n\t\tconst rows = this.rowCount(cur);\n\t\tconst onCustom = this.isOnCustomRow(cur);\n\n\t\tif (kb.matches(data, \"tui.select.up\")) {\n\t\t\tthis.index = this.index === 0 ? rows - 1 : this.index - 1;\n\t\t\treturn;\n\t\t}\n\t\tif (kb.matches(data, \"tui.select.down\")) {\n\t\t\tthis.index = this.index === rows - 1 ? 0 : this.index + 1;\n\t\t\treturn;\n\t\t}\n\t\tconst arrows = this.customArrows();\n\t\tif (arrows.back && kb.matches(data, \"app.options.back\")) {\n\t\t\tthis.back();\n\t\t\treturn;\n\t\t}\n\t\tif ((arrows.next && kb.matches(data, \"app.options.next\")) || kb.matches(data, \"tui.select.confirm\")) {\n\t\t\tthis.confirm();\n\t\t\treturn;\n\t\t}\n\t\tif (kb.matches(data, \"tui.select.cancel\")) {\n\t\t\tthis.onCancelCallback();\n\t\t\treturn;\n\t\t}\n\n\t\tif (onCustom) {\n\t\t\t// Delegate free-form typing (insert, backspace, paste, word-delete)\n\t\t\t// to a hidden Input buffer; the value is rendered inline above.\n\t\t\tthis.customInput.handleInput(data);\n\t\t\treturn;\n\t\t}\n\n\t\t// Number quick-pick for the listed options (not the custom row).\n\t\tif (/^[1-9]$/.test(data)) {\n\t\t\tconst n = Number(data) - 1;\n\t\t\tif (n < cur.options.length) {\n\t\t\t\tthis.index = n;\n\t\t\t\tthis.confirm();\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
|
|
@@ -6,12 +6,14 @@
|
|
|
6
6
|
* "INPUT NEEDED" label, and the active row marked with the accent cursor.
|
|
7
7
|
*
|
|
8
8
|
* One decision per step:
|
|
9
|
-
* - tui.select.up / down
|
|
10
|
-
* -
|
|
11
|
-
*
|
|
12
|
-
* -
|
|
13
|
-
* - 1-9
|
|
14
|
-
* - drop onto the custom row and type a free-form answer when none fit
|
|
9
|
+
* - tui.select.up / down move between options (wraps)
|
|
10
|
+
* - app.options.next (→) confirm the highlighted option and advance; on the
|
|
11
|
+
* last step it submits every answer
|
|
12
|
+
* - app.options.back (←) step back to the previous decision
|
|
13
|
+
* - 1-9 quick-pick an option
|
|
14
|
+
* - drop onto the custom row and type a free-form answer when none fit; there
|
|
15
|
+
* the arrows move the text cursor first and only act on the step at its
|
|
16
|
+
* ends, so enter is the key that always commits
|
|
15
17
|
* - tui.select.cancel (esc) skips the whole sequence
|
|
16
18
|
*
|
|
17
19
|
* Answered steps stay on screen as a deterministic breadcrumb so you always
|
|
@@ -47,6 +49,23 @@ export class AskOptionsComponent {
|
|
|
47
49
|
isOnCustomRow(q) {
|
|
48
50
|
return !!q.allowCustom && this.index === q.options.length;
|
|
49
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* How the arrow keys divide between the step and the text on the custom row.
|
|
54
|
+
*
|
|
55
|
+
* The step arrows and the text cursor want the same two keys, and they are
|
|
56
|
+
* only ever in conflict on the free-text row with something typed in it.
|
|
57
|
+
* There the text gets first refusal and the step takes what is left over at
|
|
58
|
+
* the ends: `→` at the end of the answer commits it (with nothing typed the
|
|
59
|
+
* end is also the start, which is why the plain custom row still advances),
|
|
60
|
+
* and `←` never leaves the step while there is an answer to lose — stepping
|
|
61
|
+
* back clears the field, which is not what a cursor key should do.
|
|
62
|
+
*/
|
|
63
|
+
customArrows() {
|
|
64
|
+
if (!this.isOnCustomRow(this.questions[this.step]))
|
|
65
|
+
return { next: true, back: true };
|
|
66
|
+
const typed = this.customInput.getValue().length;
|
|
67
|
+
return { next: this.customInput.getCursor() >= typed, back: typed === 0 };
|
|
68
|
+
}
|
|
50
69
|
spread(left, right, width) {
|
|
51
70
|
const gap = Math.max(1, width - visibleWidth(left) - visibleWidth(right));
|
|
52
71
|
return truncateToWidth(`${left}${" ".repeat(gap)}${right}`, width, "");
|
|
@@ -56,11 +75,13 @@ export class AskOptionsComponent {
|
|
|
56
75
|
const sep = theme.fg("muted", " · ");
|
|
57
76
|
const hint = (keys, desc) => theme.fg("dim", keys) + theme.fg("muted", ` ${desc}`);
|
|
58
77
|
const upDown = `${kb.getKeys("tui.select.up").join("/")}/${kb.getKeys("tui.select.down").join("/")}`;
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
78
|
+
const arrows = this.customArrows();
|
|
79
|
+
const parts = [hint(upDown, "move")];
|
|
80
|
+
// Mid-answer on the free-text row the arrows are the text cursor's, so the
|
|
81
|
+
// hint names the key that does commit it.
|
|
82
|
+
const nextKeys = arrows.next ? kb.getKeys("app.options.next") : kb.getKeys("tui.select.confirm");
|
|
83
|
+
parts.push(hint(nextKeys.join("/"), last ? "submit" : "next"));
|
|
84
|
+
if (this.step > 0 && arrows.back) {
|
|
64
85
|
parts.push(hint(kb.getKeys("app.options.back").join("/"), "back"));
|
|
65
86
|
}
|
|
66
87
|
parts.push(hint(kb.getKeys("tui.select.cancel").join("/"), "skip"));
|
|
@@ -173,11 +194,12 @@ export class AskOptionsComponent {
|
|
|
173
194
|
this.index = this.index === rows - 1 ? 0 : this.index + 1;
|
|
174
195
|
return;
|
|
175
196
|
}
|
|
176
|
-
|
|
197
|
+
const arrows = this.customArrows();
|
|
198
|
+
if (arrows.back && kb.matches(data, "app.options.back")) {
|
|
177
199
|
this.back();
|
|
178
200
|
return;
|
|
179
201
|
}
|
|
180
|
-
if (kb.matches(data, "app.options.next") || kb.matches(data, "tui.select.confirm")) {
|
|
202
|
+
if ((arrows.next && kb.matches(data, "app.options.next")) || kb.matches(data, "tui.select.confirm")) {
|
|
181
203
|
this.confirm();
|
|
182
204
|
return;
|
|
183
205
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ask-options.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/ask-options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAGN,cAAc,EACd,KAAK,EAEL,eAAe,EACf,YAAY,GACZ,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAExE,MAAM,OAAO,mBAAmB;IACvB,SAAS,CAAgB;IACzB,IAAI,GAAG,CAAC,CAAC;IACT,KAAK,GAAG,CAAC,CAAC;IACV,OAAO,GAAa,EAAE,CAAC;IACvB,WAAW,GAAG,IAAI,KAAK,EAAE,CAAC;IAC1B,gBAAgB,CAA8B;IAC9C,gBAAgB,CAAa;IAE7B,QAAQ,GAAG,KAAK,CAAC;IACzB,IAAI,OAAO,GAAY;QACtB,OAAO,IAAI,CAAC,QAAQ,CAAC;IAAA,CACrB;IACD,IAAI,OAAO,CAAC,KAAc,EAAE;QAC3B,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QACtB,IAAI,CAAC,WAAW,CAAC,OAAO,GAAG,KAAK,CAAC;IAAA,CACjC;IAED,YAAY,SAAwB,EAAE,QAAqC,EAAE,QAAoB,EAAE;QAClG,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,gBAAgB,GAAG,QAAQ,CAAC;QACjC,IAAI,CAAC,gBAAgB,GAAG,QAAQ,CAAC;IAAA,CACjC;IAED,UAAU,GAAS,EAAC,CAAC;IAEb,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AC,IAAI,EAAE,kBAAgC,CAAC,EAAE,CAAC;YACxD,IAAI,CAAC,IAAI,EAAE,CAAC;YACZ,OAAO;QACR,CAAC;QACD,IAAI,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,kBAAgC,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,oBAAoB,CAAC,EAAE,CAAC;YAClG,IAAI,CAAC,OAAO,EAAE,CAAC;YACf,OAAO;QACR,CAAC;QACD,IAAI,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,mBAAmB,CAAC,EAAE,CAAC;YAC3C,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACxB,OAAO;QACR,CAAC;QAED,IAAI,QAAQ,EAAE,CAAC;YACd,oEAAoE;YACpE,gEAAgE;YAChE,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;YACnC,OAAO;QACR,CAAC;QAED,iEAAiE;QACjE,IAAI,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YAC1B,MAAM,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAC3B,IAAI,CAAC,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;gBAC5B,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;gBACf,IAAI,CAAC,OAAO,EAAE,CAAC;YAChB,CAAC;QACF,CAAC;IAAA,CACD;CACD","sourcesContent":["/**\n * Options pane — the agent asking the USER for a decision before it acts.\n *\n * Rendered inline in the transcript (never a modal), in the same boxless\n * language as the other selectors: blue rules top & bottom, a cyan\n * \"INPUT NEEDED\" label, and the active row marked with the accent cursor.\n *\n * One decision per step:\n * - tui.select.up / down move between options (wraps)\n * - tui.select.next (→) confirm the highlighted option and advance; on the\n * last step it submits every answer\n * - tui.select.back (←) step back to the previous decision\n * - 1-9 quick-pick an option\n * - drop onto the custom row and type a free-form answer when none fit\n * - tui.select.cancel (esc) skips the whole sequence\n *\n * Answered steps stay on screen as a deterministic breadcrumb so you always\n * see what you've already committed to.\n */\n\nimport {\n\ttype Component,\n\ttype Focusable,\n\tgetKeybindings,\n\tInput,\n\ttype Keybinding,\n\ttruncateToWidth,\n\tvisibleWidth,\n} from \"@kolisachint/hoocode-tui\";\nimport type { AskQuestion } from \"../../../core/extensions/types.js\";\nimport { SELECT_CURSOR, SELECT_GUTTER, theme } from \"../theme/theme.js\";\n\nexport class AskOptionsComponent implements Component, Focusable {\n\tprivate questions: AskQuestion[];\n\tprivate step = 0;\n\tprivate index = 0;\n\tprivate answers: string[] = [];\n\tprivate customInput = new Input();\n\tprivate onSubmitCallback: (answers: string[]) => void;\n\tprivate onCancelCallback: () => void;\n\n\tprivate _focused = false;\n\tget focused(): boolean {\n\t\treturn this._focused;\n\t}\n\tset focused(value: boolean) {\n\t\tthis._focused = value;\n\t\tthis.customInput.focused = value;\n\t}\n\n\tconstructor(questions: AskQuestion[], onSubmit: (answers: string[]) => void, onCancel: () => void) {\n\t\tthis.questions = questions;\n\t\tthis.onSubmitCallback = onSubmit;\n\t\tthis.onCancelCallback = onCancel;\n\t}\n\n\tinvalidate(): void {}\n\n\tprivate rowCount(q: AskQuestion): number {\n\t\treturn q.options.length + (q.allowCustom ? 1 : 0);\n\t}\n\n\tprivate isOnCustomRow(q: AskQuestion): boolean {\n\t\treturn !!q.allowCustom && this.index === q.options.length;\n\t}\n\n\tprivate spread(left: string, right: string, width: number): string {\n\t\tconst gap = Math.max(1, width - visibleWidth(left) - visibleWidth(right));\n\t\treturn truncateToWidth(`${left}${\" \".repeat(gap)}${right}`, width, \"\");\n\t}\n\n\tprivate renderHints(last: boolean): string {\n\t\tconst kb = getKeybindings();\n\t\tconst sep = theme.fg(\"muted\", \" · \");\n\t\tconst hint = (keys: string, desc: string) => theme.fg(\"dim\", keys) + theme.fg(\"muted\", ` ${desc}`);\n\t\tconst upDown = `${kb.getKeys(\"tui.select.up\").join(\"/\")}/${kb.getKeys(\"tui.select.down\").join(\"/\")}`;\n\t\tconst parts = [\n\t\t\thint(upDown, \"move\"),\n\t\t\thint(kb.getKeys(\"app.options.next\" as Keybinding).join(\"/\"), last ? \"submit\" : \"next\"),\n\t\t];\n\t\tif (this.step > 0) {\n\t\t\tparts.push(hint(kb.getKeys(\"app.options.back\" as Keybinding).join(\"/\"), \"back\"));\n\t\t}\n\t\tparts.push(hint(kb.getKeys(\"tui.select.cancel\").join(\"/\"), \"skip\"));\n\t\treturn parts.join(sep);\n\t}\n\n\trender(width: number): string[] {\n\t\tconst lines: string[] = [];\n\t\tconst rule = theme.fg(\"borderAccent\", \"─\".repeat(Math.max(1, width)));\n\t\tconst cur = this.questions[this.step];\n\t\tconst last = this.step === this.questions.length - 1;\n\n\t\tlines.push(rule);\n\n\t\t// Header: \"INPUT NEEDED\" on the left, key hints on the right.\n\t\tconst title = theme.bold(theme.fg(\"borderAccent\", \"INPUT NEEDED\"));\n\t\tlines.push(this.spread(title, this.renderHints(last), width));\n\n\t\t// Answered-step breadcrumb.\n\t\tfor (let i = 0; i < this.step; i++) {\n\t\t\tconst q = this.questions[i];\n\t\t\tconst check = theme.fg(\"success\", \"✓\");\n\t\t\tconst label = theme.fg(\"dim\", q.short ?? q.question);\n\t\t\tconst arrow = theme.fg(\"dim\", \"→ \");\n\t\t\tconst answer = theme.fg(\"accent\", this.answers[i] ?? \"\");\n\t\t\tlines.push(truncateToWidth(`${check} ${label} ${arrow}${answer}`, width, \"...\"));\n\t\t}\n\t\tif (this.step > 0) lines.push(\"\");\n\n\t\t// Current question.\n\t\tconst stepLabel = theme.fg(\"dim\", `${this.step + 1}/${this.questions.length}`);\n\t\tlines.push(truncateToWidth(`${stepLabel} ${theme.bold(cur.question)}`, width, \"...\"));\n\t\tif (cur.detail) lines.push(truncateToWidth(theme.fg(\"muted\", ` ${cur.detail}`), width, \"...\"));\n\t\tlines.push(\"\");\n\n\t\t// Options.\n\t\tfor (let i = 0; i < cur.options.length; i++) {\n\t\t\tconst o = cur.options[i];\n\t\t\tconst active = i === this.index;\n\t\t\tconst cursor = theme.fg(\"accent\", active ? SELECT_CURSOR : SELECT_GUTTER);\n\t\t\tconst num = theme.fg(active ? \"accent\" : \"dim\", String(i + 1));\n\t\t\tconst label = active ? theme.bold(o.label) : o.label;\n\t\t\tlet line = `${cursor}${num} ${label}`;\n\t\t\tif (o.recommended) line += theme.fg(\"success\", \" (recommended)\");\n\t\t\tif (o.description) line += theme.fg(\"muted\", ` ${o.description}`);\n\t\t\tlines.push(truncateToWidth(line, width, \"...\"));\n\t\t}\n\n\t\t// Custom row.\n\t\tif (cur.allowCustom) {\n\t\t\tconst customIndex = cur.options.length;\n\t\t\tconst active = this.index === customIndex;\n\t\t\tconst cursor = theme.fg(\"accent\", active ? SELECT_CURSOR : SELECT_GUTTER);\n\t\t\tconst plus = theme.fg(active ? \"accent\" : \"dim\", \"+\");\n\t\t\tif (active) {\n\t\t\t\tconst value = this.customInput.getValue();\n\t\t\t\tconst prompt = theme.fg(\"accent\", \">\");\n\t\t\t\tconst caret = this._focused ? theme.fg(\"accent\", \"▏\") : \"\";\n\t\t\t\tconst body = value\n\t\t\t\t\t? `${theme.fg(\"text\", value)}${caret}`\n\t\t\t\t\t: `${caret}${theme.fg(\"dim\", \"type your own answer\")}`;\n\t\t\t\tlines.push(truncateToWidth(`${cursor}${plus} ${prompt} ${body}`, width, \"...\"));\n\t\t\t} else {\n\t\t\t\tconst label = theme.fg(\"muted\", \"custom answer\");\n\t\t\t\tconst desc = theme.fg(\"dim\", \"type your own\");\n\t\t\t\tlines.push(truncateToWidth(`${cursor}${plus} ${label} ${desc}`, width, \"...\"));\n\t\t\t}\n\t\t}\n\n\t\t// Count.\n\t\tlines.push(theme.fg(\"dim\", `(${this.index + 1}/${this.rowCount(cur)})`));\n\t\tlines.push(rule);\n\t\treturn lines;\n\t}\n\n\tprivate confirm(): void {\n\t\tconst cur = this.questions[this.step];\n\t\tlet value: string;\n\t\tif (this.isOnCustomRow(cur)) {\n\t\t\tvalue = this.customInput.getValue().trim();\n\t\t\tif (!value) return; // can't submit an empty custom answer\n\t\t} else {\n\t\t\tvalue = cur.options[this.index].label;\n\t\t}\n\t\tthis.answers[this.step] = value;\n\t\tif (this.step < this.questions.length - 1) {\n\t\t\tthis.step += 1;\n\t\t\tthis.index = 0;\n\t\t\tthis.customInput.setValue(\"\");\n\t\t} else {\n\t\t\tthis.onSubmitCallback(this.answers.slice());\n\t\t}\n\t}\n\n\tprivate back(): void {\n\t\tif (this.step === 0) return;\n\t\tthis.step -= 1;\n\t\tthis.index = 0;\n\t\tthis.customInput.setValue(\"\");\n\t}\n\n\thandleInput(data: string): void {\n\t\tconst kb = getKeybindings();\n\t\tconst cur = this.questions[this.step];\n\t\tconst rows = this.rowCount(cur);\n\t\tconst onCustom = this.isOnCustomRow(cur);\n\n\t\tif (kb.matches(data, \"tui.select.up\")) {\n\t\t\tthis.index = this.index === 0 ? rows - 1 : this.index - 1;\n\t\t\treturn;\n\t\t}\n\t\tif (kb.matches(data, \"tui.select.down\")) {\n\t\t\tthis.index = this.index === rows - 1 ? 0 : this.index + 1;\n\t\t\treturn;\n\t\t}\n\t\tif (kb.matches(data, \"app.options.back\" as Keybinding)) {\n\t\t\tthis.back();\n\t\t\treturn;\n\t\t}\n\t\tif (kb.matches(data, \"app.options.next\" as Keybinding) || kb.matches(data, \"tui.select.confirm\")) {\n\t\t\tthis.confirm();\n\t\t\treturn;\n\t\t}\n\t\tif (kb.matches(data, \"tui.select.cancel\")) {\n\t\t\tthis.onCancelCallback();\n\t\t\treturn;\n\t\t}\n\n\t\tif (onCustom) {\n\t\t\t// Delegate free-form typing (insert, backspace, paste, word-delete)\n\t\t\t// to a hidden Input buffer; the value is rendered inline above.\n\t\t\tthis.customInput.handleInput(data);\n\t\t\treturn;\n\t\t}\n\n\t\t// Number quick-pick for the listed options (not the custom row).\n\t\tif (/^[1-9]$/.test(data)) {\n\t\t\tconst n = Number(data) - 1;\n\t\t\tif (n < cur.options.length) {\n\t\t\t\tthis.index = n;\n\t\t\t\tthis.confirm();\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ask-options.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/ask-options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAGN,cAAc,EACd,KAAK,EACL,eAAe,EACf,YAAY,GACZ,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAExE,MAAM,OAAO,mBAAmB;IACvB,SAAS,CAAgB;IACzB,IAAI,GAAG,CAAC,CAAC;IACT,KAAK,GAAG,CAAC,CAAC;IACV,OAAO,GAAa,EAAE,CAAC;IACvB,WAAW,GAAG,IAAI,KAAK,EAAE,CAAC;IAC1B,gBAAgB,CAA8B;IAC9C,gBAAgB,CAAa;IAE7B,QAAQ,GAAG,KAAK,CAAC;IACzB,IAAI,OAAO,GAAY;QACtB,OAAO,IAAI,CAAC,QAAQ,CAAC;IAAA,CACrB;IACD,IAAI,OAAO,CAAC,KAAc,EAAE;QAC3B,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QACtB,IAAI,CAAC,WAAW,CAAC,OAAO,GAAG,KAAK,CAAC;IAAA,CACjC;IAED,YAAY,SAAwB,EAAE,QAAqC,EAAE,QAAoB,EAAE;QAClG,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,gBAAgB,GAAG,QAAQ,CAAC;QACjC,IAAI,CAAC,gBAAgB,GAAG,QAAQ,CAAC;IAAA,CACjC;IAED,UAAU,GAAS,EAAC,CAAC;IAEb,QAAQ,CAAC,CAAc,EAAU;QACxC,OAAO,CAAC,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAAA,CAClD;IAEO,aAAa,C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AS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YAC1B,MAAM,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAC3B,IAAI,CAAC,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;gBAC5B,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;gBACf,IAAI,CAAC,OAAO,EAAE,CAAC;YAChB,CAAC;QACF,CAAC;IAAA,CACD;CACD","sourcesContent":["/**\n * Options pane — the agent asking the USER for a decision before it acts.\n *\n * Rendered inline in the transcript (never a modal), in the same boxless\n * language as the other selectors: blue rules top & bottom, a cyan\n * \"INPUT NEEDED\" label, and the active row marked with the accent cursor.\n *\n * One decision per step:\n * - tui.select.up / down move between options (wraps)\n * - app.options.next (→) confirm the highlighted option and advance; on the\n * last step it submits every answer\n * - app.options.back (←) step back to the previous decision\n * - 1-9 quick-pick an option\n * - drop onto the custom row and type a free-form answer when none fit; there\n * the arrows move the text cursor first and only act on the step at its\n * ends, so enter is the key that always commits\n * - tui.select.cancel (esc) skips the whole sequence\n *\n * Answered steps stay on screen as a deterministic breadcrumb so you always\n * see what you've already committed to.\n */\n\nimport {\n\ttype Component,\n\ttype Focusable,\n\tgetKeybindings,\n\tInput,\n\ttruncateToWidth,\n\tvisibleWidth,\n} from \"@kolisachint/hoocode-tui\";\nimport type { AskQuestion } from \"../../../core/extensions/types.js\";\nimport { SELECT_CURSOR, SELECT_GUTTER, theme } from \"../theme/theme.js\";\n\nexport class AskOptionsComponent implements Component, Focusable {\n\tprivate questions: AskQuestion[];\n\tprivate step = 0;\n\tprivate index = 0;\n\tprivate answers: string[] = [];\n\tprivate customInput = new Input();\n\tprivate onSubmitCallback: (answers: string[]) => void;\n\tprivate onCancelCallback: () => void;\n\n\tprivate _focused = false;\n\tget focused(): boolean {\n\t\treturn this._focused;\n\t}\n\tset focused(value: boolean) {\n\t\tthis._focused = value;\n\t\tthis.customInput.focused = value;\n\t}\n\n\tconstructor(questions: AskQuestion[], onSubmit: (answers: string[]) => void, onCancel: () => void) {\n\t\tthis.questions = questions;\n\t\tthis.onSubmitCallback = onSubmit;\n\t\tthis.onCancelCallback = onCancel;\n\t}\n\n\tinvalidate(): void {}\n\n\tprivate rowCount(q: AskQuestion): number {\n\t\treturn q.options.length + (q.allowCustom ? 1 : 0);\n\t}\n\n\tprivate isOnCustomRow(q: AskQuestion): boolean {\n\t\treturn !!q.allowCustom && this.index === q.options.length;\n\t}\n\n\t/**\n\t * How the arrow keys divide between the step and the text on the custom row.\n\t *\n\t * The step arrows and the text cursor want the same two keys, and they are\n\t * only ever in conflict on the free-text row with something typed in it.\n\t * There the text gets first refusal and the step takes what is left over at\n\t * the ends: `→` at the end of the answer commits it (with nothing typed the\n\t * end is also the start, which is why the plain custom row still advances),\n\t * and `←` never leaves the step while there is an answer to lose — stepping\n\t * back clears the field, which is not what a cursor key should do.\n\t */\n\tprivate customArrows(): { next: boolean; back: boolean } {\n\t\tif (!this.isOnCustomRow(this.questions[this.step])) return { next: true, back: true };\n\t\tconst typed = this.customInput.getValue().length;\n\t\treturn { next: this.customInput.getCursor() >= typed, back: typed === 0 };\n\t}\n\n\tprivate spread(left: string, right: string, width: number): string {\n\t\tconst gap = Math.max(1, width - visibleWidth(left) - visibleWidth(right));\n\t\treturn truncateToWidth(`${left}${\" \".repeat(gap)}${right}`, width, \"\");\n\t}\n\n\tprivate renderHints(last: boolean): string {\n\t\tconst kb = getKeybindings();\n\t\tconst sep = theme.fg(\"muted\", \" · \");\n\t\tconst hint = (keys: string, desc: string) => theme.fg(\"dim\", keys) + theme.fg(\"muted\", ` ${desc}`);\n\t\tconst upDown = `${kb.getKeys(\"tui.select.up\").join(\"/\")}/${kb.getKeys(\"tui.select.down\").join(\"/\")}`;\n\t\tconst arrows = this.customArrows();\n\t\tconst parts = [hint(upDown, \"move\")];\n\t\t// Mid-answer on the free-text row the arrows are the text cursor's, so the\n\t\t// hint names the key that does commit it.\n\t\tconst nextKeys = arrows.next ? kb.getKeys(\"app.options.next\") : kb.getKeys(\"tui.select.confirm\");\n\t\tparts.push(hint(nextKeys.join(\"/\"), last ? \"submit\" : \"next\"));\n\t\tif (this.step > 0 && arrows.back) {\n\t\t\tparts.push(hint(kb.getKeys(\"app.options.back\").join(\"/\"), \"back\"));\n\t\t}\n\t\tparts.push(hint(kb.getKeys(\"tui.select.cancel\").join(\"/\"), \"skip\"));\n\t\treturn parts.join(sep);\n\t}\n\n\trender(width: number): string[] {\n\t\tconst lines: string[] = [];\n\t\tconst rule = theme.fg(\"borderAccent\", \"─\".repeat(Math.max(1, width)));\n\t\tconst cur = this.questions[this.step];\n\t\tconst last = this.step === this.questions.length - 1;\n\n\t\tlines.push(rule);\n\n\t\t// Header: \"INPUT NEEDED\" on the left, key hints on the right.\n\t\tconst title = theme.bold(theme.fg(\"borderAccent\", \"INPUT NEEDED\"));\n\t\tlines.push(this.spread(title, this.renderHints(last), width));\n\n\t\t// Answered-step breadcrumb.\n\t\tfor (let i = 0; i < this.step; i++) {\n\t\t\tconst q = this.questions[i];\n\t\t\tconst check = theme.fg(\"success\", \"✓\");\n\t\t\tconst label = theme.fg(\"dim\", q.short ?? q.question);\n\t\t\tconst arrow = theme.fg(\"dim\", \"→ \");\n\t\t\tconst answer = theme.fg(\"accent\", this.answers[i] ?? \"\");\n\t\t\tlines.push(truncateToWidth(`${check} ${label} ${arrow}${answer}`, width, \"...\"));\n\t\t}\n\t\tif (this.step > 0) lines.push(\"\");\n\n\t\t// Current question.\n\t\tconst stepLabel = theme.fg(\"dim\", `${this.step + 1}/${this.questions.length}`);\n\t\tlines.push(truncateToWidth(`${stepLabel} ${theme.bold(cur.question)}`, width, \"...\"));\n\t\tif (cur.detail) lines.push(truncateToWidth(theme.fg(\"muted\", ` ${cur.detail}`), width, \"...\"));\n\t\tlines.push(\"\");\n\n\t\t// Options.\n\t\tfor (let i = 0; i < cur.options.length; i++) {\n\t\t\tconst o = cur.options[i];\n\t\t\tconst active = i === this.index;\n\t\t\tconst cursor = theme.fg(\"accent\", active ? SELECT_CURSOR : SELECT_GUTTER);\n\t\t\tconst num = theme.fg(active ? \"accent\" : \"dim\", String(i + 1));\n\t\t\tconst label = active ? theme.bold(o.label) : o.label;\n\t\t\tlet line = `${cursor}${num} ${label}`;\n\t\t\tif (o.recommended) line += theme.fg(\"success\", \" (recommended)\");\n\t\t\tif (o.description) line += theme.fg(\"muted\", ` ${o.description}`);\n\t\t\tlines.push(truncateToWidth(line, width, \"...\"));\n\t\t}\n\n\t\t// Custom row.\n\t\tif (cur.allowCustom) {\n\t\t\tconst customIndex = cur.options.length;\n\t\t\tconst active = this.index === customIndex;\n\t\t\tconst cursor = theme.fg(\"accent\", active ? SELECT_CURSOR : SELECT_GUTTER);\n\t\t\tconst plus = theme.fg(active ? \"accent\" : \"dim\", \"+\");\n\t\t\tif (active) {\n\t\t\t\tconst value = this.customInput.getValue();\n\t\t\t\tconst prompt = theme.fg(\"accent\", \">\");\n\t\t\t\tconst caret = this._focused ? theme.fg(\"accent\", \"▏\") : \"\";\n\t\t\t\tconst body = value\n\t\t\t\t\t? `${theme.fg(\"text\", value)}${caret}`\n\t\t\t\t\t: `${caret}${theme.fg(\"dim\", \"type your own answer\")}`;\n\t\t\t\tlines.push(truncateToWidth(`${cursor}${plus} ${prompt} ${body}`, width, \"...\"));\n\t\t\t} else {\n\t\t\t\tconst label = theme.fg(\"muted\", \"custom answer\");\n\t\t\t\tconst desc = theme.fg(\"dim\", \"type your own\");\n\t\t\t\tlines.push(truncateToWidth(`${cursor}${plus} ${label} ${desc}`, width, \"...\"));\n\t\t\t}\n\t\t}\n\n\t\t// Count.\n\t\tlines.push(theme.fg(\"dim\", `(${this.index + 1}/${this.rowCount(cur)})`));\n\t\tlines.push(rule);\n\t\treturn lines;\n\t}\n\n\tprivate confirm(): void {\n\t\tconst cur = this.questions[this.step];\n\t\tlet value: string;\n\t\tif (this.isOnCustomRow(cur)) {\n\t\t\tvalue = this.customInput.getValue().trim();\n\t\t\tif (!value) return; // can't submit an empty custom answer\n\t\t} else {\n\t\t\tvalue = cur.options[this.index].label;\n\t\t}\n\t\tthis.answers[this.step] = value;\n\t\tif (this.step < this.questions.length - 1) {\n\t\t\tthis.step += 1;\n\t\t\tthis.index = 0;\n\t\t\tthis.customInput.setValue(\"\");\n\t\t} else {\n\t\t\tthis.onSubmitCallback(this.answers.slice());\n\t\t}\n\t}\n\n\tprivate back(): void {\n\t\tif (this.step === 0) return;\n\t\tthis.step -= 1;\n\t\tthis.index = 0;\n\t\tthis.customInput.setValue(\"\");\n\t}\n\n\thandleInput(data: string): void {\n\t\tconst kb = getKeybindings();\n\t\tconst cur = this.questions[this.step];\n\t\tconst rows = this.rowCount(cur);\n\t\tconst onCustom = this.isOnCustomRow(cur);\n\n\t\tif (kb.matches(data, \"tui.select.up\")) {\n\t\t\tthis.index = this.index === 0 ? rows - 1 : this.index - 1;\n\t\t\treturn;\n\t\t}\n\t\tif (kb.matches(data, \"tui.select.down\")) {\n\t\t\tthis.index = this.index === rows - 1 ? 0 : this.index + 1;\n\t\t\treturn;\n\t\t}\n\t\tconst arrows = this.customArrows();\n\t\tif (arrows.back && kb.matches(data, \"app.options.back\")) {\n\t\t\tthis.back();\n\t\t\treturn;\n\t\t}\n\t\tif ((arrows.next && kb.matches(data, \"app.options.next\")) || kb.matches(data, \"tui.select.confirm\")) {\n\t\t\tthis.confirm();\n\t\t\treturn;\n\t\t}\n\t\tif (kb.matches(data, \"tui.select.cancel\")) {\n\t\t\tthis.onCancelCallback();\n\t\t\treturn;\n\t\t}\n\n\t\tif (onCustom) {\n\t\t\t// Delegate free-form typing (insert, backspace, paste, word-delete)\n\t\t\t// to a hidden Input buffer; the value is rendered inline above.\n\t\t\tthis.customInput.handleInput(data);\n\t\t\treturn;\n\t\t}\n\n\t\t// Number quick-pick for the listed options (not the custom row).\n\t\tif (/^[1-9]$/.test(data)) {\n\t\t\tconst n = Number(data) - 1;\n\t\t\tif (n < cur.options.length) {\n\t\t\t\tthis.index = n;\n\t\t\t\tthis.confirm();\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
|
|
@@ -9,6 +9,15 @@ export interface KeyTextFormatOptions {
|
|
|
9
9
|
export declare function formatKeyText(key: string, options?: KeyTextFormatOptions): string;
|
|
10
10
|
export declare function keyText(keybinding: Keybinding): string;
|
|
11
11
|
export declare function keyDisplayText(keybinding: Keybinding): string;
|
|
12
|
+
/**
|
|
13
|
+
* The taught key for a binding — the first one — and nothing else.
|
|
14
|
+
*
|
|
15
|
+
* `keyDisplayText` names every key an action answers to, which is right for a
|
|
16
|
+
* reference row and wrong wherever the shape of the hint is the thing being
|
|
17
|
+
* taught: the dials read `alt+t/shift+alt+t`, and a second forward key spliced
|
|
18
|
+
* into the middle of that is what the one-shape rule exists to avoid.
|
|
19
|
+
*/
|
|
20
|
+
export declare function keyDisplayLabel(keybinding: Keybinding): string;
|
|
12
21
|
export declare function keyHint(keybinding: Keybinding, description: string): string;
|
|
13
22
|
export declare function rawKeyHint(key: string, description: string): string;
|
|
14
23
|
/**
|