@bastani/atomic 0.8.26-alpha.6 → 0.8.26-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/README.md +7 -4
- package/dist/builtin/intercom/CHANGELOG.md +6 -0
- package/dist/builtin/intercom/package.json +2 -2
- package/dist/builtin/mcp/CHANGELOG.md +6 -0
- package/dist/builtin/mcp/package.json +3 -3
- package/dist/builtin/subagents/CHANGELOG.md +6 -0
- package/dist/builtin/subagents/agents/codebase-online-researcher.md +9 -9
- package/dist/builtin/subagents/agents/debugger.md +6 -6
- package/dist/builtin/subagents/package.json +4 -4
- package/dist/builtin/subagents/prompts/parallel-handoff-plan.md +1 -1
- package/dist/builtin/subagents/skills/browser/EXAMPLES.md +151 -0
- package/dist/builtin/subagents/skills/browser/LICENSE.txt +21 -0
- package/dist/builtin/subagents/skills/browser/REFERENCE.md +451 -0
- package/dist/builtin/subagents/skills/browser/SKILL.md +170 -0
- package/dist/builtin/subagents/skills/subagent/SKILL.md +4 -4
- package/dist/builtin/web-access/CHANGELOG.md +6 -0
- package/dist/builtin/web-access/package.json +2 -2
- package/dist/builtin/workflows/CHANGELOG.md +11 -0
- package/dist/builtin/workflows/builtin/deep-research-codebase.ts +4 -1
- package/dist/builtin/workflows/builtin/goal.ts +127 -99
- package/dist/builtin/workflows/builtin/open-claude-design.ts +224 -147
- package/dist/builtin/workflows/builtin/ralph.ts +160 -197
- package/dist/builtin/workflows/package.json +2 -2
- package/dist/builtin/workflows/skills/research-codebase/SKILL.md +1 -1
- package/dist/builtin/workflows/src/tui/stage-chat-view.ts +9 -0
- package/dist/core/agent-session.d.ts +28 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +110 -28
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/compaction/branch-summarization.d.ts +1 -1
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +6 -3
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +23 -10
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/compaction/context-compaction.d.ts +61 -0
- package/dist/core/compaction/context-compaction.d.ts.map +1 -0
- package/dist/core/compaction/context-compaction.js +602 -0
- package/dist/core/compaction/context-compaction.js.map +1 -0
- package/dist/core/compaction/index.d.ts +1 -0
- package/dist/core/compaction/index.d.ts.map +1 -1
- package/dist/core/compaction/index.js +1 -0
- package/dist/core/compaction/index.js.map +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/session-manager.d.ts +41 -1
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +146 -7
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +1 -0
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/modes/index.d.ts +1 -1
- package/dist/modes/index.d.ts.map +1 -1
- package/dist/modes/index.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.js +17 -0
- package/dist/modes/interactive/components/chat-session-host.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +74 -0
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +12 -7
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +8 -1
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +4 -0
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +13 -2
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/docs/compaction.md +42 -23
- package/docs/custom-provider.md +11 -9
- package/docs/extensions.md +35 -35
- package/docs/index.md +1 -8
- package/docs/json.md +14 -11
- package/docs/packages.md +2 -0
- package/docs/providers.md +4 -1
- package/docs/quickstart.md +5 -12
- package/docs/rpc.md +44 -8
- package/docs/sdk.md +1 -8
- package/docs/session-format.md +25 -12
- package/docs/sessions.md +2 -1
- package/docs/skills.md +1 -15
- package/docs/termux.md +9 -10
- package/docs/themes.md +2 -2
- package/docs/tmux.md +3 -3
- package/docs/tui.md +19 -32
- package/docs/usage.md +2 -0
- package/docs/workflows.md +44 -2
- package/package.json +4 -12
- package/dist/builtin/subagents/skills/browser-use/SKILL.md +0 -234
- package/dist/builtin/subagents/skills/browser-use/references/cdp-python.md +0 -76
- package/dist/builtin/subagents/skills/browser-use/references/multi-session.md +0 -92
- package/node_modules/@earendil-works/pi-tui/README.md +0 -779
- package/node_modules/@earendil-works/pi-tui/dist/autocomplete.d.ts +0 -54
- package/node_modules/@earendil-works/pi-tui/dist/autocomplete.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/autocomplete.js +0 -632
- package/node_modules/@earendil-works/pi-tui/dist/autocomplete.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/box.d.ts +0 -22
- package/node_modules/@earendil-works/pi-tui/dist/components/box.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/box.js +0 -104
- package/node_modules/@earendil-works/pi-tui/dist/components/box.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/cancellable-loader.d.ts +0 -22
- package/node_modules/@earendil-works/pi-tui/dist/components/cancellable-loader.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/cancellable-loader.js +0 -35
- package/node_modules/@earendil-works/pi-tui/dist/components/cancellable-loader.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/editor.d.ts +0 -249
- package/node_modules/@earendil-works/pi-tui/dist/components/editor.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/editor.js +0 -1857
- package/node_modules/@earendil-works/pi-tui/dist/components/editor.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/image.d.ts +0 -28
- package/node_modules/@earendil-works/pi-tui/dist/components/image.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/image.js +0 -89
- package/node_modules/@earendil-works/pi-tui/dist/components/image.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/input.d.ts +0 -37
- package/node_modules/@earendil-works/pi-tui/dist/components/input.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/input.js +0 -378
- package/node_modules/@earendil-works/pi-tui/dist/components/input.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/loader.d.ts +0 -31
- package/node_modules/@earendil-works/pi-tui/dist/components/loader.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/loader.js +0 -69
- package/node_modules/@earendil-works/pi-tui/dist/components/loader.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/markdown.d.ts +0 -96
- package/node_modules/@earendil-works/pi-tui/dist/components/markdown.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/markdown.js +0 -644
- package/node_modules/@earendil-works/pi-tui/dist/components/markdown.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/select-list.d.ts +0 -50
- package/node_modules/@earendil-works/pi-tui/dist/components/select-list.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/select-list.js +0 -159
- package/node_modules/@earendil-works/pi-tui/dist/components/select-list.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.d.ts +0 -50
- package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.js +0 -185
- package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/spacer.d.ts +0 -12
- package/node_modules/@earendil-works/pi-tui/dist/components/spacer.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/spacer.js +0 -23
- package/node_modules/@earendil-works/pi-tui/dist/components/spacer.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/text.d.ts +0 -19
- package/node_modules/@earendil-works/pi-tui/dist/components/text.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/text.js +0 -89
- package/node_modules/@earendil-works/pi-tui/dist/components/text.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/truncated-text.d.ts +0 -13
- package/node_modules/@earendil-works/pi-tui/dist/components/truncated-text.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/truncated-text.js +0 -51
- package/node_modules/@earendil-works/pi-tui/dist/components/truncated-text.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/editor-component.d.ts +0 -39
- package/node_modules/@earendil-works/pi-tui/dist/editor-component.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/editor-component.js +0 -2
- package/node_modules/@earendil-works/pi-tui/dist/editor-component.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/fuzzy.d.ts +0 -16
- package/node_modules/@earendil-works/pi-tui/dist/fuzzy.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/fuzzy.js +0 -110
- package/node_modules/@earendil-works/pi-tui/dist/fuzzy.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/index.d.ts +0 -23
- package/node_modules/@earendil-works/pi-tui/dist/index.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/index.js +0 -32
- package/node_modules/@earendil-works/pi-tui/dist/index.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/keybindings.d.ts +0 -193
- package/node_modules/@earendil-works/pi-tui/dist/keybindings.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/keybindings.js +0 -174
- package/node_modules/@earendil-works/pi-tui/dist/keybindings.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/keys.d.ts +0 -184
- package/node_modules/@earendil-works/pi-tui/dist/keys.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/keys.js +0 -1173
- package/node_modules/@earendil-works/pi-tui/dist/keys.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/kill-ring.d.ts +0 -28
- package/node_modules/@earendil-works/pi-tui/dist/kill-ring.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/kill-ring.js +0 -44
- package/node_modules/@earendil-works/pi-tui/dist/kill-ring.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/native-modifiers.d.ts +0 -3
- package/node_modules/@earendil-works/pi-tui/dist/native-modifiers.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/native-modifiers.js +0 -53
- package/node_modules/@earendil-works/pi-tui/dist/native-modifiers.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.d.ts +0 -50
- package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.js +0 -361
- package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts +0 -90
- package/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js +0 -366
- package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts +0 -113
- package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/terminal.js +0 -472
- package/node_modules/@earendil-works/pi-tui/dist/terminal.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/tui.d.ts +0 -227
- package/node_modules/@earendil-works/pi-tui/dist/tui.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/tui.js +0 -1106
- package/node_modules/@earendil-works/pi-tui/dist/tui.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/undo-stack.d.ts +0 -17
- package/node_modules/@earendil-works/pi-tui/dist/undo-stack.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/undo-stack.js +0 -25
- package/node_modules/@earendil-works/pi-tui/dist/undo-stack.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/utils.d.ts +0 -84
- package/node_modules/@earendil-works/pi-tui/dist/utils.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/utils.js +0 -1029
- package/node_modules/@earendil-works/pi-tui/dist/utils.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/word-navigation.d.ts +0 -25
- package/node_modules/@earendil-works/pi-tui/dist/word-navigation.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/word-navigation.js +0 -96
- package/node_modules/@earendil-works/pi-tui/dist/word-navigation.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/native/darwin/prebuilds/darwin-arm64/darwin-modifiers.node +0 -0
- package/node_modules/@earendil-works/pi-tui/native/darwin/prebuilds/darwin-x64/darwin-modifiers.node +0 -0
- package/node_modules/@earendil-works/pi-tui/native/win32/prebuilds/win32-arm64/win32-console-mode.node +0 -0
- package/node_modules/@earendil-works/pi-tui/native/win32/prebuilds/win32-x64/win32-console-mode.node +0 -0
- package/node_modules/@earendil-works/pi-tui/package.json +0 -47
- package/node_modules/get-east-asian-width/index.d.ts +0 -60
- package/node_modules/get-east-asian-width/index.js +0 -30
- package/node_modules/get-east-asian-width/license +0 -9
- package/node_modules/get-east-asian-width/lookup-data.js +0 -21
- package/node_modules/get-east-asian-width/lookup.js +0 -138
- package/node_modules/get-east-asian-width/package.json +0 -71
- package/node_modules/get-east-asian-width/readme.md +0 -65
- package/node_modules/get-east-asian-width/utilities.js +0 -24
- package/node_modules/marked/LICENSE.md +0 -44
- package/node_modules/marked/README.md +0 -106
- package/node_modules/marked/bin/main.js +0 -282
- package/node_modules/marked/bin/marked.js +0 -15
- package/node_modules/marked/lib/marked.cjs +0 -2211
- package/node_modules/marked/lib/marked.cjs.map +0 -7
- package/node_modules/marked/lib/marked.d.cts +0 -728
- package/node_modules/marked/lib/marked.d.ts +0 -728
- package/node_modules/marked/lib/marked.esm.js +0 -2189
- package/node_modules/marked/lib/marked.esm.js.map +0 -7
- package/node_modules/marked/lib/marked.umd.js +0 -2213
- package/node_modules/marked/lib/marked.umd.js.map +0 -7
- package/node_modules/marked/man/marked.1 +0 -111
- package/node_modules/marked/man/marked.1.md +0 -92
- package/node_modules/marked/marked.min.js +0 -69
- package/node_modules/marked/package.json +0 -111
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slash-commands.d.ts","sourceRoot":"","sources":["../../src/core/slash-commands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAO/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,MAAM,MAAM,kBAAkB,GAAG,WAAW,GAAG,QAAQ,GAAG,OAAO,CAAC;AAElE,MAAM,WAAW,gBAAgB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,kBAAkB,CAAC;IAC3B,UAAU,EAAE,UAAU,CAAC;CACvB;AAED,MAAM,WAAW,mBAAmB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,sBAAsB,CAAC,EAAE,CACxB,cAAc,EAAE,MAAM,KAClB,gBAAgB,EAAE,GAAG,IAAI,GAAG,OAAO,CAAC,gBAAgB,EAAE,GAAG,IAAI,CAAC,CAAC;CACpE;AAED,eAAO,MAAM,sBAAsB,EAAE,aAAa,CAAC,mBAAmB,
|
|
1
|
+
{"version":3,"file":"slash-commands.d.ts","sourceRoot":"","sources":["../../src/core/slash-commands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAO/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,MAAM,MAAM,kBAAkB,GAAG,WAAW,GAAG,QAAQ,GAAG,OAAO,CAAC;AAElE,MAAM,WAAW,gBAAgB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,kBAAkB,CAAC;IAC3B,UAAU,EAAE,UAAU,CAAC;CACvB;AAED,MAAM,WAAW,mBAAmB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,sBAAsB,CAAC,EAAE,CACxB,cAAc,EAAE,MAAM,KAClB,gBAAgB,EAAE,GAAG,IAAI,GAAG,OAAO,CAAC,gBAAgB,EAAE,GAAG,IAAI,CAAC,CAAC;CACpE;AAED,eAAO,MAAM,sBAAsB,EAAE,aAAa,CAAC,mBAAmB,CA8BrE,CAAC","sourcesContent":["import type { AutocompleteItem } from \"@earendil-works/pi-tui\";\nimport { APP_NAME } from \"../config.ts\";\nimport {\n\tATOMIC_GUIDE_COMMAND_DESCRIPTION,\n\tATOMIC_GUIDE_COMMAND_NAME,\n\tgetAtomicGuideArgumentCompletions,\n} from \"./atomic-guide-command.ts\";\nimport type { SourceInfo } from \"./source-info.ts\";\n\nexport type SlashCommandSource = \"extension\" | \"prompt\" | \"skill\";\n\nexport interface SlashCommandInfo {\n\tname: string;\n\tdescription?: string;\n\tsource: SlashCommandSource;\n\tsourceInfo: SourceInfo;\n}\n\nexport interface BuiltinSlashCommand {\n\tname: string;\n\tdescription: string;\n\tgetArgumentCompletions?: (\n\t\targumentPrefix: string,\n\t) => AutocompleteItem[] | null | Promise<AutocompleteItem[] | null>;\n}\n\nexport const BUILTIN_SLASH_COMMANDS: ReadonlyArray<BuiltinSlashCommand> = [\n\t{ name: \"settings\", description: \"Open settings menu\" },\n\t{ name: \"model\", description: \"Select model (opens selector UI)\" },\n\t{ name: \"scoped-models\", description: \"Enable/disable models for ctrl+p cycling\" },\n\t{ name: \"fast\", description: \"Configure Codex fast mode for chat and workflows\" },\n\t{ name: \"export\", description: \"Export session (HTML default, or specify path: .html/.jsonl)\" },\n\t{ name: \"import\", description: \"Import and resume a session from a JSONL file\" },\n\t{ name: \"share\", description: \"Share session as a secret GitHub gist\" },\n\t{ name: \"copy\", description: \"Copy last agent message to clipboard\" },\n\t{ name: \"name\", description: \"Set session display name\" },\n\t{ name: \"session\", description: \"Show session info and stats\" },\n\t{ name: \"changelog\", description: \"Show changelog entries\" },\n\t{\n\t\tname: ATOMIC_GUIDE_COMMAND_NAME,\n\t\tdescription: ATOMIC_GUIDE_COMMAND_DESCRIPTION,\n\t\tgetArgumentCompletions: getAtomicGuideArgumentCompletions,\n\t},\n\t{ name: \"hotkeys\", description: \"Show all keyboard shortcuts\" },\n\t{ name: \"fork\", description: \"Create a new fork from a previous user message\" },\n\t{ name: \"clone\", description: \"Duplicate the current session at the current position\" },\n\t{ name: \"tree\", description: \"Navigate session tree (switch branches)\" },\n\t{ name: \"login\", description: \"Configure provider authentication\" },\n\t{ name: \"logout\", description: \"Remove provider authentication\" },\n\t{ name: \"new\", description: \"Start a new session\" },\n\t{ name: \"compact\", description: \"Manually compact the session context\" },\n\t{ name: \"context-compact\", description: \"Delete safe transcript entries verbatim; no arguments\" },\n\t{ name: \"resume\", description: \"Resume a different session\" },\n\t{ name: \"reload\", description: \"Reload keybindings, extensions, skills, prompts, and themes\" },\n\t{ name: \"exit\", description: `Exit ${APP_NAME}` },\n\t{ name: \"quit\", description: `Quit ${APP_NAME}` },\n];\n"]}
|
|
@@ -25,6 +25,7 @@ export const BUILTIN_SLASH_COMMANDS = [
|
|
|
25
25
|
{ name: "logout", description: "Remove provider authentication" },
|
|
26
26
|
{ name: "new", description: "Start a new session" },
|
|
27
27
|
{ name: "compact", description: "Manually compact the session context" },
|
|
28
|
+
{ name: "context-compact", description: "Delete safe transcript entries verbatim; no arguments" },
|
|
28
29
|
{ name: "resume", description: "Resume a different session" },
|
|
29
30
|
{ name: "reload", description: "Reload keybindings, extensions, skills, prompts, and themes" },
|
|
30
31
|
{ name: "exit", description: `Exit ${APP_NAME}` },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slash-commands.js","sourceRoot":"","sources":["../../src/core/slash-commands.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EACN,gCAAgC,EAChC,yBAAyB,EACzB,iCAAiC,GACjC,MAAM,2BAA2B,CAAC;AAoBnC,MAAM,CAAC,MAAM,sBAAsB,GAAuC;IACzE,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,oBAAoB,EAAE;IACvD,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,kCAAkC,EAAE;IAClE,EAAE,IAAI,EAAE,eAAe,EAAE,WAAW,EAAE,0CAA0C,EAAE;IAClF,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,kDAAkD,EAAE;IACjF,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,8DAA8D,EAAE;IAC/F,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,+CAA+C,EAAE;IAChF,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,uCAAuC,EAAE;IACvE,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,sCAAsC,EAAE;IACrE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GuideArgumentCompletions,\n} from \"./atomic-guide-command.ts\";\nimport type { SourceInfo } from \"./source-info.ts\";\n\nexport type SlashCommandSource = \"extension\" | \"prompt\" | \"skill\";\n\nexport interface SlashCommandInfo {\n\tname: string;\n\tdescription?: string;\n\tsource: SlashCommandSource;\n\tsourceInfo: SourceInfo;\n}\n\nexport interface BuiltinSlashCommand {\n\tname: string;\n\tdescription: string;\n\tgetArgumentCompletions?: (\n\t\targumentPrefix: string,\n\t) => AutocompleteItem[] | null | Promise<AutocompleteItem[] | null>;\n}\n\nexport const BUILTIN_SLASH_COMMANDS: ReadonlyArray<BuiltinSlashCommand> = [\n\t{ name: \"settings\", description: \"Open settings menu\" },\n\t{ name: \"model\", description: \"Select model (opens selector UI)\" },\n\t{ name: \"scoped-models\", description: \"Enable/disable models for ctrl+p cycling\" },\n\t{ name: \"fast\", description: \"Configure Codex fast mode for chat and workflows\" },\n\t{ name: \"export\", description: \"Export session (HTML default, or specify path: .html/.jsonl)\" },\n\t{ name: \"import\", description: \"Import and resume a session from a JSONL file\" },\n\t{ name: \"share\", description: \"Share session as a secret GitHub gist\" },\n\t{ name: \"copy\", description: \"Copy last agent message to clipboard\" },\n\t{ name: \"name\", description: \"Set session display name\" },\n\t{ name: \"session\", description: \"Show session info and stats\" },\n\t{ name: \"changelog\", description: \"Show changelog entries\" },\n\t{\n\t\tname: ATOMIC_GUIDE_COMMAND_NAME,\n\t\tdescription: ATOMIC_GUIDE_COMMAND_DESCRIPTION,\n\t\tgetArgumentCompletions: getAtomicGuideArgumentCompletions,\n\t},\n\t{ name: \"hotkeys\", description: \"Show all keyboard shortcuts\" },\n\t{ name: \"fork\", description: \"Create a new fork from a previous user message\" },\n\t{ name: \"clone\", description: \"Duplicate the current session at the current position\" },\n\t{ name: \"tree\", description: \"Navigate session tree (switch branches)\" },\n\t{ name: \"login\", description: \"Configure provider authentication\" },\n\t{ name: \"logout\", description: \"Remove provider authentication\" },\n\t{ name: \"new\", description: \"Start a new session\" },\n\t{ name: \"compact\", description: \"Manually compact the session context\" },\n\t{ name: \"resume\", description: \"Resume a different session\" },\n\t{ name: \"reload\", description: \"Reload keybindings, extensions, skills, prompts, and themes\" },\n\t{ name: \"exit\", description: `Exit ${APP_NAME}` },\n\t{ name: \"quit\", description: `Quit ${APP_NAME}` },\n];\n"]}
|
|
1
|
+
{"version":3,"file":"slash-commands.js","sourceRoot":"","sources":["../../src/core/slash-commands.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EACN,gCAAgC,EAChC,yBAAyB,EACzB,iCAAiC,GACjC,MAAM,2BAA2B,CAAC;AAoBnC,MAAM,CAAC,MAAM,sBAAsB,GAAuC;IACzE,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,oBAAoB,EAAE;IACvD,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,kCAAkC,EAAE;IAClE,EAAE,IAAI,EAAE,eAAe,EAAE,WAAW,EAAE,0CAA0C,EAAE;IAClF,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,kDAAkD,EAAE;IACjF,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,8DAA8D,EAAE;IAC/F,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,+CAA+C,EAAE;IAChF,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,uCAAuC,EAAE;IACvE,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,sCAAsC,EAAE;IACrE,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,0BAA0B,EAAE;IACzD,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,6BAA6B,EAAE;IAC/D,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,wBAAwB,EAAE;IAC5D;QACC,IAAI,EAAE,yBAAyB;QAC/B,WAAW,EAAE,gCAAgC;QAC7C,sBAAsB,EAAE,iCAAiC;KACzD;IACD,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,6BAA6B,EAAE;IAC/D,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,gDAAgD,EAAE;IAC/E,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,uDAAuD,EAAE;IACvF,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,yCAAyC,EAAE;IACxE,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,mCAAmC,EAAE;IACnE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,gCAAgC,EAAE;IACjE,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE;IACnD,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,sCAAsC,EAAE;IACxE,EAAE,IAAI,EAAE,iBAAiB,EAAE,WAAW,EAAE,uDAAuD,EAAE;IACjG,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,4BAA4B,EAAE;IAC7D,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,6DAA6D,EAAE;IAC9F,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,QAAQ,QAAQ,EAAE,EAAE;IACjD,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,QAAQ,QAAQ,EAAE,EAAE;CACjD,CAAC","sourcesContent":["import type { AutocompleteItem } from \"@earendil-works/pi-tui\";\nimport { APP_NAME } from \"../config.ts\";\nimport {\n\tATOMIC_GUIDE_COMMAND_DESCRIPTION,\n\tATOMIC_GUIDE_COMMAND_NAME,\n\tgetAtomicGuideArgumentCompletions,\n} from \"./atomic-guide-command.ts\";\nimport type { SourceInfo } from \"./source-info.ts\";\n\nexport type SlashCommandSource = \"extension\" | \"prompt\" | \"skill\";\n\nexport interface SlashCommandInfo {\n\tname: string;\n\tdescription?: string;\n\tsource: SlashCommandSource;\n\tsourceInfo: SourceInfo;\n}\n\nexport interface BuiltinSlashCommand {\n\tname: string;\n\tdescription: string;\n\tgetArgumentCompletions?: (\n\t\targumentPrefix: string,\n\t) => AutocompleteItem[] | null | Promise<AutocompleteItem[] | null>;\n}\n\nexport const BUILTIN_SLASH_COMMANDS: ReadonlyArray<BuiltinSlashCommand> = [\n\t{ name: \"settings\", description: \"Open settings menu\" },\n\t{ name: \"model\", description: \"Select model (opens selector UI)\" },\n\t{ name: \"scoped-models\", description: \"Enable/disable models for ctrl+p cycling\" },\n\t{ name: \"fast\", description: \"Configure Codex fast mode for chat and workflows\" },\n\t{ name: \"export\", description: \"Export session (HTML default, or specify path: .html/.jsonl)\" },\n\t{ name: \"import\", description: \"Import and resume a session from a JSONL file\" },\n\t{ name: \"share\", description: \"Share session as a secret GitHub gist\" },\n\t{ name: \"copy\", description: \"Copy last agent message to clipboard\" },\n\t{ name: \"name\", description: \"Set session display name\" },\n\t{ name: \"session\", description: \"Show session info and stats\" },\n\t{ name: \"changelog\", description: \"Show changelog entries\" },\n\t{\n\t\tname: ATOMIC_GUIDE_COMMAND_NAME,\n\t\tdescription: ATOMIC_GUIDE_COMMAND_DESCRIPTION,\n\t\tgetArgumentCompletions: getAtomicGuideArgumentCompletions,\n\t},\n\t{ name: \"hotkeys\", description: \"Show all keyboard shortcuts\" },\n\t{ name: \"fork\", description: \"Create a new fork from a previous user message\" },\n\t{ name: \"clone\", description: \"Duplicate the current session at the current position\" },\n\t{ name: \"tree\", description: \"Navigate session tree (switch branches)\" },\n\t{ name: \"login\", description: \"Configure provider authentication\" },\n\t{ name: \"logout\", description: \"Remove provider authentication\" },\n\t{ name: \"new\", description: \"Start a new session\" },\n\t{ name: \"compact\", description: \"Manually compact the session context\" },\n\t{ name: \"context-compact\", description: \"Delete safe transcript entries verbatim; no arguments\" },\n\t{ name: \"resume\", description: \"Resume a different session\" },\n\t{ name: \"reload\", description: \"Reload keybindings, extensions, skills, prompts, and themes\" },\n\t{ name: \"exit\", description: `Exit ${APP_NAME}` },\n\t{ name: \"quit\", description: `Quit ${APP_NAME}` },\n];\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export { APP_NAME, APP_TITLE, CONFIG_DIR_NAME, CONFIG_DIR_NAMES, LEGACY_CONFIG_D
|
|
|
3
3
|
export { type BashResult, executeBashWithOperations } from "./core/bash-executor.ts";
|
|
4
4
|
export { AgentSession, type AgentSessionConfig, type AgentSessionEvent, type AgentSessionEventListener, type ModelCycleResult, type ParsedSkillBlock, type PromptOptions, parseSkillBlock, type SessionStats, } from "./core/agent-session.ts";
|
|
5
5
|
export { type ApiKeyCredential, type AuthCredential, type AuthStatus, AuthStorage, type AuthStorageBackend, FileAuthStorageBackend, InMemoryAuthStorageBackend, type OAuthCredential, } from "./core/auth-storage.ts";
|
|
6
|
-
export { type BranchPreparation, type BranchSummaryResult, type CollectEntriesResult, type CompactionResult, type CutPointResult, calculateContextTokens, collectEntriesForBranchSummary, compact, DEFAULT_COMPACTION_SETTINGS, estimateTokens, type FileOperations, findCutPoint, findTurnStartIndex, type GenerateBranchSummaryOptions, generateBranchSummary, generateSummary, getLastAssistantUsage, prepareBranchEntries, serializeConversation, shouldCompact, } from "./core/compaction/index.ts";
|
|
6
|
+
export { type BranchPreparation, type BranchSummaryResult, type CollectEntriesResult, type CompactableTranscript, type CompactionResult, type ContextCompactionPreparation, type ContextCompactionResult, type CutPointResult, type RawContextDeletionPlan, type ValidatedContextDeletionPlan, buildContextCompactionPrompt, calculateContextTokens, collectEntriesForBranchSummary, compact, contextCompact, DEFAULT_COMPACTION_SETTINGS, estimateTokens, type FileOperations, findCutPoint, findTurnStartIndex, type GenerateBranchSummaryOptions, generateBranchSummary, generateSummary, getLastAssistantUsage, parseContextDeletionPlan, prepareBranchEntries, prepareContextCompaction, serializeConversation, shouldCompact, validateContextDeletionPlan, } from "./core/compaction/index.ts";
|
|
7
7
|
export { CODEX_FAST_MODE_SERVICE_TIER, formatCodexFastModeModelLabel, getCodexFastModeScope, hasSupportedCodexFastModeModel, isCodexFastModeEnabledForScope, isCodexFastModeCandidateModelId, isCodexFastModeSupportedModel, isCodexFastModeSupportedProvider, shouldApplyCodexFastMode, shouldApplyCodexFastModeForScope, type CodexFastModeResolvedSettings, type CodexFastModeScope, } from "./core/codex-fast-mode.ts";
|
|
8
8
|
export { createEventBus, type EventBus, type EventBusController } from "./core/event-bus.ts";
|
|
9
9
|
export type { AgentEndEvent, AgentStartEvent, AgentToolResult, AgentToolUpdateCallback, AppKeybinding, AutocompleteProviderFactory, BashToolCallEvent, BeforeAgentStartEvent, BeforeAgentStartEventResult, BeforeProviderRequestEvent, BeforeProviderRequestEventResult, BuildSystemPromptOptions, CompactOptions, ContextEvent, ContextUsage, CustomToolCallEvent, EditToolCallEvent, ExecOptions, ExecResult, Extension, ExtensionActions, ExtensionAPI, ExtensionCommandContext, ExtensionCommandContextActions, ExtensionContext, ExtensionContextActions, WorkflowStageOrchestrationContext, ExtensionError, ExtensionEvent, ExtensionFactory, ExtensionFlag, ExtensionHandler, ExtensionRuntime, ExtensionShortcut, ExtensionUIContext, ExtensionUIDialogOptions, ExtensionWidgetOptions, FindToolCallEvent, GrepToolCallEvent, InputEvent, InputEventResult, InputSource, KeybindingsManager, LoadExtensionsResult, LsToolCallEvent, MessageRenderer, MessageRenderOptions, OrchestrationContext, ProviderConfig, ProviderModelConfig, ReactiveWidgetAction, ReactiveWidgetComponent, ReactiveWidgetController, ReactiveWidgetFactory, ReactiveWidgetRefreshReason, ReactiveWidgetRenderContext, ReactiveWidgetRenderState, ReactiveWidgetScheduler, ReactiveWidgetTimerApi, ReactiveWidgetTimerHandle, ReactiveWidgetUi, ReadToolCallEvent, RegisteredCommand, RegisteredTool, ResolvedCommand, SessionBeforeCompactEvent, SessionBeforeForkEvent, SessionBeforeSwitchEvent, SessionBeforeTreeEvent, SessionCompactEvent, SessionShutdownEvent, SessionStartEvent, SessionTreeEvent, SlashCommandInfo, SlashCommandSource, SourceInfo, TerminalInputHandler, ToolCallEvent, ToolCallEventResult, ToolDefinition, ToolExecutionMode, InstallReactiveWidgetOptions, ToolInfo, ToolRenderResultOptions, ToolResultEvent, TurnEndEvent, TurnStartEvent, UserBashEvent, UserBashEventResult, WidgetPlacement, WorkingIndicatorOptions, WriteToolCallEvent, } from "./core/extensions/index.ts";
|
|
@@ -18,14 +18,14 @@ export { DefaultPackageManager } from "./core/package-manager.ts";
|
|
|
18
18
|
export type { ResourceCollision, ResourceDiagnostic, ResourceLoader } from "./core/resource-loader.ts";
|
|
19
19
|
export { DefaultResourceLoader, loadProjectContextFiles } from "./core/resource-loader.ts";
|
|
20
20
|
export { AgentSessionRuntime, type AgentSessionRuntimeDiagnostic, type AgentSessionServices, type CreateAgentSessionFromServicesOptions, type CreateAgentSessionOptions, type CreateAgentSessionResult, type CreateAgentSessionRuntimeFactory, type CreateAgentSessionRuntimeResult, type CreateAgentSessionServicesOptions, createAgentSession, createAgentSessionFromServices, createAgentSessionRuntime, createAgentSessionServices, createBashTool, createCodingTools, createEditTool, createFindTool, createGrepTool, createLsTool, createReadOnlyTools, createReadTool, createWriteTool, type PromptTemplate, } from "./core/sdk.ts";
|
|
21
|
-
export { type BranchSummaryEntry, buildSessionContext, type CompactionEntry, CURRENT_SESSION_VERSION, type CustomEntry, type CustomMessageEntry, type FileEntry, getLatestCompactionEntry, type ModelChangeEntry, migrateSessionEntries, type NewSessionOptions, parseSessionEntries, type SessionContext, type SessionEntry, type SessionEntryBase, type SessionHeader, type SessionInfo, type SessionInfoEntry, SessionManager, type SessionMessageEntry, type ThinkingLevelChangeEntry, } from "./core/session-manager.ts";
|
|
21
|
+
export { type BranchSummaryEntry, buildSessionContext, type CompactionEntry, type ContextCompactionEntry, type ContextCompactionStats, type ContextDeletionTarget, CURRENT_SESSION_VERSION, type CustomEntry, type CustomMessageEntry, type FileEntry, getLatestCompactionBoundaryEntry, getLatestCompactionEntry, type ModelChangeEntry, migrateSessionEntries, type NewSessionOptions, parseSessionEntries, type SessionContext, type SessionEntry, type SessionEntryBase, type SessionHeader, type SessionInfo, type SessionInfoEntry, SessionManager, type SessionMessageEntry, type ThinkingLevelChangeEntry, } from "./core/session-manager.ts";
|
|
22
22
|
export { type CompactionSettings, type ImageSettings, type PackageSource, type RetrySettings, SettingsManager, } from "./core/settings-manager.ts";
|
|
23
23
|
export { formatSkillsForPrompt, type LoadSkillsFromDirOptions, type LoadSkillsResult, loadSkills, loadSkillsFromDir, type Skill, type SkillFrontmatter, } from "./core/skills.ts";
|
|
24
24
|
export { createSyntheticSourceInfo } from "./core/source-info.ts";
|
|
25
25
|
export { type BashOperations, type BashSpawnContext, type BashSpawnHook, type BashToolDetails, type BashToolInput, type BashToolOptions, createBashToolDefinition, createEditToolDefinition, createFindToolDefinition, createGrepToolDefinition, createLocalBashOperations, createLsToolDefinition, createReadToolDefinition, createWriteToolDefinition, DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, type EditOperations, type EditToolDetails, type EditToolInput, type EditToolOptions, type FindOperations, type FindToolDetails, type FindToolInput, type FindToolOptions, formatSize, type GrepOperations, type GrepToolDetails, type GrepToolInput, type GrepToolOptions, type LsOperations, type LsToolDetails, type LsToolInput, type LsToolOptions, type ReadOperations, type ReadToolDetails, type ReadToolInput, type ReadToolOptions, type ToolsOptions, type TruncationOptions, type TruncationResult, truncateHead, truncateLine, truncateTail, type WriteOperations, type WriteToolInput, type WriteToolOptions, withFileMutationQueue, } from "./core/tools/index.ts";
|
|
26
26
|
export { type MainOptions, main } from "./main.ts";
|
|
27
27
|
export { pickWhimsicalWorkingMessage } from "./modes/interactive/whimsical-messages.ts";
|
|
28
|
-
export { InteractiveMode, type InteractiveModeOptions, type ModelInfo, type PrintModeOptions, RpcClient, type RpcClientOptions, type RpcCommand, type RpcEventListener, type RpcResponse, type RpcSessionState, runPrintMode, runRpcMode, } from "./modes/index.ts";
|
|
28
|
+
export { InteractiveMode, type InteractiveModeOptions, type ModelInfo, type PrintModeOptions, RpcClient, type RpcClientOptions, type RpcCommand, type RpcEvent, type RpcEventListener, type RpcResponse, type RpcSessionState, runPrintMode, runRpcMode, } from "./modes/index.ts";
|
|
29
29
|
export { ArminComponent, AssistantMessageComponent, BashExecutionComponent, BorderedLoader, chatEntriesFromAgentMessages, ChatSessionHost, type ChatSessionHostBashRequest, type ChatSessionHostCommands, type ChatSessionHostEntry, type ChatSessionHostOpts, type ChatSessionHostStyle, ChatTranscriptComponent, LiveChatEntriesController, renderChatMessageEntry, type ChatMessageEntry, type ChatMessageRenderOptions, ScrollableChatTranscriptComponent, ScrollableComponentViewport, type ChatTranscriptEntryLike, type ChatTranscriptRenderer, type ChatTranscriptRole, BranchSummaryMessageComponent, CompactionSummaryMessageComponent, CustomEditor, CustomMessageComponent, DynamicBorder, ExtensionEditorComponent, ExtensionInputComponent, ExtensionSelectorComponent, FooterComponent, UsageMeterComponent, keyHint, keyText, LoginDialogComponent, ModelSelectorComponent, OAuthSelectorComponent, type RenderDiffOptions, rawKeyHint, renderDiff, SessionSelectorComponent, type SettingsCallbacks, type SettingsConfig, SettingsSelectorComponent, ShowImagesSelectorComponent, SkillInvocationMessageComponent, ThemeSelectorComponent, ThinkingSelectorComponent, ToolExecutionComponent, type ToolExecutionOptions, TreeSelectorComponent, truncateToVisualLines, UserMessageComponent, UserMessageSelectorComponent, WorkingStatusComponent, type WorkingStatusComponentOptions, type VisualTruncateResult, } from "./modes/interactive/components/index.ts";
|
|
30
30
|
export { getLanguageFromPath, getMarkdownTheme, getSelectListTheme, getSettingsListTheme, highlightCode, initTheme, Theme, type ThemeColor, } from "./modes/interactive/theme/theme.ts";
|
|
31
31
|
export { copyToClipboard } from "./utils/clipboard.ts";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EACN,QAAQ,EACR,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,sBAAsB,EACtB,iBAAiB,EACjB,mBAAmB,E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A6B,EAC7B,iCAAiC,EACjC,YAAY,EACZ,sBAAsB,EACtB,aAAa,EACb,wBAAwB,EACxB,uBAAuB,EACvB,0BAA0B,EAC1B,eAAe,EACf,mBAAmB,EACnB,OAAO,EACP,OAAO,EACP,oBAAoB,EACpB,sBAAsB,EACtB,sBAAsB,EACtB,KAAK,iBAAiB,EACtB,UAAU,EACV,UAAU,EACV,wBAAwB,EACxB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,yBAAyB,EACzB,2BAA2B,EAC3B,+BAA+B,EAC/B,sBAAsB,EACtB,yBAAyB,EACzB,sBAAsB,EACtB,KAAK,oBAAoB,EACzB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,4BAA4B,EAC5B,sBAAsB,EACtB,KAAK,6BAA6B,EAClC,KAAK,oBAAoB,GACzB,MAAM,yCAAyC,CAAC;AAEjD,OAAO,EACN,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,aAAa,EACb,SAAS,EACT,KAAK,EACL,KAAK,UAAU,GACf,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,KAAK,YAAY,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE9F,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC","sourcesContent":["// Core session management\n\n// Config paths\nexport {\n\tAPP_NAME,\n\tAPP_TITLE,\n\tCONFIG_DIR_NAME,\n\tCONFIG_DIR_NAMES,\n\tLEGACY_CONFIG_DIR_NAME,\n\tLEGACY_ENV_PREFIX,\n\tgetAgentConfigPaths,\n\tgetAgentDir,\n\tgetAgentDirs,\n\tgetLegacyAgentDir,\n\tgetProjectConfigDirs,\n\tgetProjectConfigPaths,\n\tgetEnvNames,\n\tgetEnvValue,\n\tENV_CODEX_FAST_MODE,\n\tWORKFLOW_STAGE_SUBAGENT_GUARD_ENV,\n\tisBunBinary,\n\tgetUserConfigDirs,\n\tgetUserConfigPaths,\n\thasEnvValue,\n\tPACKAGE_NAME,\n\tsetEnvValue,\n\tVERSION,\n} from \"./config.ts\";\nexport { type BashResult, executeBashWithOperations } from \"./core/bash-executor.ts\";\nexport {\n\tAgentSession,\n\ttype AgentSessionConfig,\n\ttype AgentSessionEvent,\n\ttype AgentSessionEventListener,\n\ttype ModelCycleResult,\n\ttype ParsedSkillBlock,\n\ttype PromptOptions,\n\tparseSkillBlock,\n\ttype SessionStats,\n} from \"./core/agent-session.ts\";\n// Auth and model registry\nexport {\n\ttype ApiKeyCredential,\n\ttype AuthCredential,\n\ttype AuthStatus,\n\tAuthStorage,\n\ttype AuthStorageBackend,\n\tFileAuthStorageBackend,\n\tInMemoryAuthStorageBackend,\n\ttype OAuthCredential,\n} from \"./core/auth-storage.ts\";\n// Compaction\nexport {\n\ttype BranchPreparation,\n\ttype BranchSummaryResult,\n\ttype CollectEntriesResult,\n\ttype CompactionResult,\n\ttype CutPointResult,\n\tcalculateContextTokens,\n\tcollectEntriesForBranchSummary,\n\tcompact,\n\tDEFAULT_COMPACTION_SETTINGS,\n\testimateTokens,\n\ttype FileOperations,\n\tfindCutPoint,\n\tfindTurnStartIndex,\n\ttype GenerateBranchSummaryOptions,\n\tgenerateBranchSummary,\n\tgenerateSummary,\n\tgetLastAssistantUsage,\n\tprepareBranchEntries,\n\tserializeConversation,\n\tshouldCompact,\n} from \"./core/compaction/index.ts\";\nexport {\n\tCODEX_FAST_MODE_SERVICE_TIER,\n\tformatCodexFastModeModelLabel,\n\tgetCodexFastModeScope,\n\thasSupportedCodexFastModeModel,\n\tisCodexFastModeEnabledForScope,\n\tisCodexFastModeCandidateModelId,\n\tisCodexFastModeSupportedModel,\n\tisCodexFastModeSupportedProvider,\n\tshouldApplyCodexFastMode,\n\tshouldApplyCodexFastModeForScope,\n\ttype CodexFastModeResolvedSettings,\n\ttype CodexFastModeScope,\n} from \"./core/codex-fast-mode.ts\";\nexport { createEventBus, type EventBus, type EventBusController } from \"./core/event-bus.ts\";\n// Extension system\nexport type {\n\tAgentEndEvent,\n\tAgentStartEvent,\n\tAgentToolResult,\n\tAgentToolUpdateCallback,\n\tAppKeybinding,\n\tAutocompleteProviderFactory,\n\tBashToolCallEvent,\n\tBeforeAgentStartEvent,\n\tBeforeAgentStartEventResult,\n\tBeforeProviderRequestEvent,\n\tBeforeProviderRequestEventResult,\n\tBuildSystemPromptOptions,\n\tCompactOptions,\n\tContextEvent,\n\tContextUsage,\n\tCustomToolCallEvent,\n\tEditToolCallEvent,\n\tExecOptions,\n\tExecResult,\n\tExtension,\n\tExtensionActions,\n\tExtensionAPI,\n\tExtensionCommandContext,\n\tExtensionCommandContextActions,\n\tExtensionContext,\n\tExtensionContextActions,\n\tWorkflowStageOrchestrationContext,\n\tExtensionError,\n\tExtensionEvent,\n\tExtensionFactory,\n\tExtensionFlag,\n\tExtensionHandler,\n\tExtensionRuntime,\n\tExtensionShortcut,\n\tExtensionUIContext,\n\tExtensionUIDialogOptions,\n\tExtensionWidgetOptions,\n\tFindToolCallEvent,\n\tGrepToolCallEvent,\n\tInputEvent,\n\tInputEventResult,\n\tInputSource,\n\tKeybindingsManager,\n\tLoadExtensionsResult,\n\tLsToolCallEvent,\n\tMessageRenderer,\n\tMessageRenderOptions,\n\tOrchestrationContext,\n\tProviderConfig,\n\tProviderModelConfig,\n\tReactiveWidgetAction,\n\tReactiveWidgetComponent,\n\tReactiveWidgetController,\n\tReactiveWidgetFactory,\n\tReactiveWidgetRefreshReason,\n\tReactiveWidgetRenderContext,\n\tReactiveWidgetRenderState,\n\tReactiveWidgetScheduler,\n\tReactiveWidgetTimerApi,\n\tReactiveWidgetTimerHandle,\n\tReactiveWidgetUi,\n\tReadToolCallEvent,\n\tRegisteredCommand,\n\tRegisteredTool,\n\tResolvedCommand,\n\tSessionBeforeCompactEvent,\n\tSessionBeforeForkEvent,\n\tSessionBeforeSwitchEvent,\n\tSessionBeforeTreeEvent,\n\tSessionCompactEvent,\n\tSessionShutdownEvent,\n\tSessionStartEvent,\n\tSessionTreeEvent,\n\tSlashCommandInfo,\n\tSlashCommandSource,\n\tSourceInfo,\n\tTerminalInputHandler,\n\tToolCallEvent,\n\tToolCallEventResult,\n\tToolDefinition,\n\tToolExecutionMode,\n\tInstallReactiveWidgetOptions,\n\tToolInfo,\n\tToolRenderResultOptions,\n\tToolResultEvent,\n\tTurnEndEvent,\n\tTurnStartEvent,\n\tUserBashEvent,\n\tUserBashEventResult,\n\tWidgetPlacement,\n\tWorkingIndicatorOptions,\n\tWriteToolCallEvent,\n} from \"./core/extensions/index.ts\";\nexport {\n\tcreateExtensionRuntime,\n\tdecideReactiveWidgetAction,\n\tdefineTool,\n\tdiscoverAndLoadExtensions,\n\tExtensionRunner,\n\tisBashToolResult,\n\tisEditToolResult,\n\tisFindToolResult,\n\tisGrepToolResult,\n\tisLsToolResult,\n\tisReadToolResult,\n\tisToolCallEventType,\n\tisWriteToolResult,\n\tinstallReactiveWidget,\n\twrapRegisteredTool,\n\twrapRegisteredTools,\n} from \"./core/extensions/index.ts\";\n// Builtin tool definitions reusable by first-party extensions (e.g. workflows\n// invoking the structured ask_user_question UI deterministically).\nexport { createAskUserQuestionToolDefinition } from \"./core/tools/index.ts\";\n// Footer data provider (git branch + extension statuses - data not otherwise available to extensions)\nexport type { ReadonlyFooterDataProvider } from \"./core/footer-data-provider.ts\";\nexport { convertToLlm } from \"./core/messages.ts\";\nexport { ModelRegistry } from \"./core/model-registry.ts\";\nexport type {\n\tPackageManager,\n\tPathMetadata,\n\tProgressCallback,\n\tProgressEvent,\n\tResolvedPaths,\n\tResolvedResource,\n} from \"./core/package-manager.ts\";\nexport { getBuiltinPackagePaths } from \"./core/builtin-packages.ts\";\nexport { DefaultPackageManager } from \"./core/package-manager.ts\";\nexport type { ResourceCollision, ResourceDiagnostic, ResourceLoader } from \"./core/resource-loader.ts\";\nexport { DefaultResourceLoader, loadProjectContextFiles } from \"./core/resource-loader.ts\";\n// SDK for programmatic usage\nexport {\n\tAgentSessionRuntime,\n\ttype AgentSessionRuntimeDiagnostic,\n\ttype AgentSessionServices,\n\ttype CreateAgentSessionFromServicesOptions,\n\ttype CreateAgentSessionOptions,\n\ttype CreateAgentSessionResult,\n\ttype CreateAgentSessionRuntimeFactory,\n\ttype CreateAgentSessionRuntimeResult,\n\ttype CreateAgentSessionServicesOptions,\n\t// Factory\n\tcreateAgentSession,\n\tcreateAgentSessionFromServices,\n\tcreateAgentSessionRuntime,\n\tcreateAgentSessionServices,\n\tcreateBashTool,\n\t// Tool factories (for custom cwd)\n\tcreateCodingTools,\n\tcreateEditTool,\n\tcreateFindTool,\n\tcreateGrepTool,\n\tcreateLsTool,\n\tcreateReadOnlyTools,\n\tcreateReadTool,\n\tcreateWriteTool,\n\ttype PromptTemplate,\n} from \"./core/sdk.ts\";\nexport {\n\ttype BranchSummaryEntry,\n\tbuildSessionContext,\n\ttype CompactionEntry,\n\tCURRENT_SESSION_VERSION,\n\ttype CustomEntry,\n\ttype CustomMessageEntry,\n\ttype FileEntry,\n\tgetLatestCompactionEntry,\n\ttype ModelChangeEntry,\n\tmigrateSessionEntries,\n\ttype NewSessionOptions,\n\tparseSessionEntries,\n\ttype SessionContext,\n\ttype SessionEntry,\n\ttype SessionEntryBase,\n\ttype SessionHeader,\n\ttype SessionInfo,\n\ttype SessionInfoEntry,\n\tSessionManager,\n\ttype SessionMessageEntry,\n\ttype ThinkingLevelChangeEntry,\n} from \"./core/session-manager.ts\";\nexport {\n\ttype CompactionSettings,\n\ttype ImageSettings,\n\ttype PackageSource,\n\ttype RetrySettings,\n\tSettingsManager,\n} from \"./core/settings-manager.ts\";\n// Skills\nexport {\n\tformatSkillsForPrompt,\n\ttype LoadSkillsFromDirOptions,\n\ttype LoadSkillsResult,\n\tloadSkills,\n\tloadSkillsFromDir,\n\ttype Skill,\n\ttype SkillFrontmatter,\n} from \"./core/skills.ts\";\nexport { createSyntheticSourceInfo } from \"./core/source-info.ts\";\n// Tools\nexport {\n\ttype BashOperations,\n\ttype BashSpawnContext,\n\ttype BashSpawnHook,\n\ttype BashToolDetails,\n\ttype BashToolInput,\n\ttype BashToolOptions,\n\tcreateBashToolDefinition,\n\tcreateEditToolDefinition,\n\tcreateFindToolDefinition,\n\tcreateGrepToolDefinition,\n\tcreateLocalBashOperations,\n\tcreateLsToolDefinition,\n\tcreateReadToolDefinition,\n\tcreateWriteToolDefinition,\n\tDEFAULT_MAX_BYTES,\n\tDEFAULT_MAX_LINES,\n\ttype EditOperations,\n\ttype EditToolDetails,\n\ttype EditToolInput,\n\ttype EditToolOptions,\n\ttype FindOperations,\n\ttype FindToolDetails,\n\ttype FindToolInput,\n\ttype FindToolOptions,\n\tformatSize,\n\ttype GrepOperations,\n\ttype GrepToolDetails,\n\ttype GrepToolInput,\n\ttype GrepToolOptions,\n\ttype LsOperations,\n\ttype LsToolDetails,\n\ttype LsToolInput,\n\ttype LsToolOptions,\n\ttype ReadOperations,\n\ttype ReadToolDetails,\n\ttype ReadToolInput,\n\ttype ReadToolOptions,\n\ttype ToolsOptions,\n\ttype TruncationOptions,\n\ttype TruncationResult,\n\ttruncateHead,\n\ttruncateLine,\n\ttruncateTail,\n\ttype WriteOperations,\n\ttype WriteToolInput,\n\ttype WriteToolOptions,\n\twithFileMutationQueue,\n} from \"./core/tools/index.ts\";\n// Main entry point\nexport { type MainOptions, main } from \"./main.ts\";\n// Run modes for programmatic SDK usage\nexport { pickWhimsicalWorkingMessage } from \"./modes/interactive/whimsical-messages.ts\";\nexport {\n\tInteractiveMode,\n\ttype InteractiveModeOptions,\n\ttype ModelInfo,\n\ttype PrintModeOptions,\n\tRpcClient,\n\ttype RpcClientOptions,\n\ttype RpcCommand,\n\ttype RpcEventListener,\n\ttype RpcResponse,\n\ttype RpcSessionState,\n\trunPrintMode,\n\trunRpcMode,\n} from \"./modes/index.ts\";\n// UI components for extensions\nexport {\n\tArminComponent,\n\tAssistantMessageComponent,\n\tBashExecutionComponent,\n\tBorderedLoader,\n\tchatEntriesFromAgentMessages,\n\t// Internal host seam for bundled workflow stage chat; not yet a stable extension API.\n\tChatSessionHost,\n\ttype ChatSessionHostBashRequest,\n\ttype ChatSessionHostCommands,\n\ttype ChatSessionHostEntry,\n\ttype ChatSessionHostOpts,\n\ttype ChatSessionHostStyle,\n\tChatTranscriptComponent,\n\tLiveChatEntriesController,\n\trenderChatMessageEntry,\n\ttype ChatMessageEntry,\n\ttype ChatMessageRenderOptions,\n\tScrollableChatTranscriptComponent,\n\tScrollableComponentViewport,\n\ttype ChatTranscriptEntryLike,\n\ttype ChatTranscriptRenderer,\n\ttype ChatTranscriptRole,\n\tBranchSummaryMessageComponent,\n\tCompactionSummaryMessageComponent,\n\tCustomEditor,\n\tCustomMessageComponent,\n\tDynamicBorder,\n\tExtensionEditorComponent,\n\tExtensionInputComponent,\n\tExtensionSelectorComponent,\n\tFooterComponent,\n\tUsageMeterComponent,\n\tkeyHint,\n\tkeyText,\n\tLoginDialogComponent,\n\tModelSelectorComponent,\n\tOAuthSelectorComponent,\n\ttype RenderDiffOptions,\n\trawKeyHint,\n\trenderDiff,\n\tSessionSelectorComponent,\n\ttype SettingsCallbacks,\n\ttype SettingsConfig,\n\tSettingsSelectorComponent,\n\tShowImagesSelectorComponent,\n\tSkillInvocationMessageComponent,\n\tThemeSelectorComponent,\n\tThinkingSelectorComponent,\n\tToolExecutionComponent,\n\ttype ToolExecutionOptions,\n\tTreeSelectorComponent,\n\ttruncateToVisualLines,\n\tUserMessageComponent,\n\tUserMessageSelectorComponent,\n\tWorkingStatusComponent,\n\ttype WorkingStatusComponentOptions,\n\ttype VisualTruncateResult,\n} from \"./modes/interactive/components/index.ts\";\n// Theme utilities for custom tools and extensions\nexport {\n\tgetLanguageFromPath,\n\tgetMarkdownTheme,\n\tgetSelectListTheme,\n\tgetSettingsListTheme,\n\thighlightCode,\n\tinitTheme,\n\tTheme,\n\ttype ThemeColor,\n} from \"./modes/interactive/theme/theme.ts\";\n// Clipboard utilities\nexport { copyToClipboard } from \"./utils/clipboard.ts\";\nexport { parseFrontmatter, stripFrontmatter } from \"./utils/frontmatter.ts\";\nexport { createGitEnvironment, GIT_LOCAL_ENV_VARS } from \"./utils/git-env.ts\";\nexport { formatDimensionNote, type ResizedImage, resizeImage } from \"./utils/image-resize.ts\";\n// Shell utilities\nexport { getShellConfig } from \"./utils/shell.ts\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EACN,QAAQ,EACR,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,sBAAsB,EACtB,iBAAiB,EACjB,mBAAmB,EACnB,WAAW,EACX,YAAY,EACZ,iBAAiB,EACjB,oBAAoB,EACpB,qBAAqB,EACrB,WAAW,EACX,WAAW,EACX,mBAAmB,EACnB,iCAAiC,EACjC,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EAClB,WAAW,EACX,YAAY,EACZ,WAAW,EACX,OAAO,GACP,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,KAAK,UAAU,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACrF,OAAO,EACN,YAAY,EACZ,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,EAC9B,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,eAAe,EACf,KAAK,YAAY,GACjB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACN,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,WAAW,EACX,KAAK,kBAAkB,EACvB,sBAAsB,EACtB,0BAA0B,EAC1B,KAAK,eAAe,GACpB,MAAM,wBAAwB,CAAC;AAEhC,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B,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,4BAA4B,EAC5B,sBAAsB,EACtB,KAAK,6BAA6B,EAClC,KAAK,oBAAoB,GACzB,MAAM,yCAAyC,CAAC;AAEjD,OAAO,EACN,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,aAAa,EACb,SAAS,EACT,KAAK,EACL,KAAK,UAAU,GACf,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,KAAK,YAAY,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE9F,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC","sourcesContent":["// Core session management\n\n// Config paths\nexport {\n\tAPP_NAME,\n\tAPP_TITLE,\n\tCONFIG_DIR_NAME,\n\tCONFIG_DIR_NAMES,\n\tLEGACY_CONFIG_DIR_NAME,\n\tLEGACY_ENV_PREFIX,\n\tgetAgentConfigPaths,\n\tgetAgentDir,\n\tgetAgentDirs,\n\tgetLegacyAgentDir,\n\tgetProjectConfigDirs,\n\tgetProjectConfigPaths,\n\tgetEnvNames,\n\tgetEnvValue,\n\tENV_CODEX_FAST_MODE,\n\tWORKFLOW_STAGE_SUBAGENT_GUARD_ENV,\n\tisBunBinary,\n\tgetUserConfigDirs,\n\tgetUserConfigPaths,\n\thasEnvValue,\n\tPACKAGE_NAME,\n\tsetEnvValue,\n\tVERSION,\n} from \"./config.ts\";\nexport { type BashResult, executeBashWithOperations } from \"./core/bash-executor.ts\";\nexport {\n\tAgentSession,\n\ttype AgentSessionConfig,\n\ttype AgentSessionEvent,\n\ttype AgentSessionEventListener,\n\ttype ModelCycleResult,\n\ttype ParsedSkillBlock,\n\ttype PromptOptions,\n\tparseSkillBlock,\n\ttype SessionStats,\n} from \"./core/agent-session.ts\";\n// Auth and model registry\nexport {\n\ttype ApiKeyCredential,\n\ttype AuthCredential,\n\ttype AuthStatus,\n\tAuthStorage,\n\ttype AuthStorageBackend,\n\tFileAuthStorageBackend,\n\tInMemoryAuthStorageBackend,\n\ttype OAuthCredential,\n} from \"./core/auth-storage.ts\";\n// Compaction\nexport {\n\ttype BranchPreparation,\n\ttype BranchSummaryResult,\n\ttype CollectEntriesResult,\n\ttype CompactableTranscript,\n\ttype CompactionResult,\n\ttype ContextCompactionPreparation,\n\ttype ContextCompactionResult,\n\ttype CutPointResult,\n\ttype RawContextDeletionPlan,\n\ttype ValidatedContextDeletionPlan,\n\tbuildContextCompactionPrompt,\n\tcalculateContextTokens,\n\tcollectEntriesForBranchSummary,\n\tcompact,\n\tcontextCompact,\n\tDEFAULT_COMPACTION_SETTINGS,\n\testimateTokens,\n\ttype FileOperations,\n\tfindCutPoint,\n\tfindTurnStartIndex,\n\ttype GenerateBranchSummaryOptions,\n\tgenerateBranchSummary,\n\tgenerateSummary,\n\tgetLastAssistantUsage,\n\tparseContextDeletionPlan,\n\tprepareBranchEntries,\n\tprepareContextCompaction,\n\tserializeConversation,\n\tshouldCompact,\n\tvalidateContextDeletionPlan,\n} from \"./core/compaction/index.ts\";\nexport {\n\tCODEX_FAST_MODE_SERVICE_TIER,\n\tformatCodexFastModeModelLabel,\n\tgetCodexFastModeScope,\n\thasSupportedCodexFastModeModel,\n\tisCodexFastModeEnabledForScope,\n\tisCodexFastModeCandidateModelId,\n\tisCodexFastModeSupportedModel,\n\tisCodexFastModeSupportedProvider,\n\tshouldApplyCodexFastMode,\n\tshouldApplyCodexFastModeForScope,\n\ttype CodexFastModeResolvedSettings,\n\ttype CodexFastModeScope,\n} from \"./core/codex-fast-mode.ts\";\nexport { createEventBus, type EventBus, type EventBusController } from \"./core/event-bus.ts\";\n// Extension system\nexport type {\n\tAgentEndEvent,\n\tAgentStartEvent,\n\tAgentToolResult,\n\tAgentToolUpdateCallback,\n\tAppKeybinding,\n\tAutocompleteProviderFactory,\n\tBashToolCallEvent,\n\tBeforeAgentStartEvent,\n\tBeforeAgentStartEventResult,\n\tBeforeProviderRequestEvent,\n\tBeforeProviderRequestEventResult,\n\tBuildSystemPromptOptions,\n\tCompactOptions,\n\tContextEvent,\n\tContextUsage,\n\tCustomToolCallEvent,\n\tEditToolCallEvent,\n\tExecOptions,\n\tExecResult,\n\tExtension,\n\tExtensionActions,\n\tExtensionAPI,\n\tExtensionCommandContext,\n\tExtensionCommandContextActions,\n\tExtensionContext,\n\tExtensionContextActions,\n\tWorkflowStageOrchestrationContext,\n\tExtensionError,\n\tExtensionEvent,\n\tExtensionFactory,\n\tExtensionFlag,\n\tExtensionHandler,\n\tExtensionRuntime,\n\tExtensionShortcut,\n\tExtensionUIContext,\n\tExtensionUIDialogOptions,\n\tExtensionWidgetOptions,\n\tFindToolCallEvent,\n\tGrepToolCallEvent,\n\tInputEvent,\n\tInputEventResult,\n\tInputSource,\n\tKeybindingsManager,\n\tLoadExtensionsResult,\n\tLsToolCallEvent,\n\tMessageRenderer,\n\tMessageRenderOptions,\n\tOrchestrationContext,\n\tProviderConfig,\n\tProviderModelConfig,\n\tReactiveWidgetAction,\n\tReactiveWidgetComponent,\n\tReactiveWidgetController,\n\tReactiveWidgetFactory,\n\tReactiveWidgetRefreshReason,\n\tReactiveWidgetRenderContext,\n\tReactiveWidgetRenderState,\n\tReactiveWidgetScheduler,\n\tReactiveWidgetTimerApi,\n\tReactiveWidgetTimerHandle,\n\tReactiveWidgetUi,\n\tReadToolCallEvent,\n\tRegisteredCommand,\n\tRegisteredTool,\n\tResolvedCommand,\n\tSessionBeforeCompactEvent,\n\tSessionBeforeForkEvent,\n\tSessionBeforeSwitchEvent,\n\tSessionBeforeTreeEvent,\n\tSessionCompactEvent,\n\tSessionShutdownEvent,\n\tSessionStartEvent,\n\tSessionTreeEvent,\n\tSlashCommandInfo,\n\tSlashCommandSource,\n\tSourceInfo,\n\tTerminalInputHandler,\n\tToolCallEvent,\n\tToolCallEventResult,\n\tToolDefinition,\n\tToolExecutionMode,\n\tInstallReactiveWidgetOptions,\n\tToolInfo,\n\tToolRenderResultOptions,\n\tToolResultEvent,\n\tTurnEndEvent,\n\tTurnStartEvent,\n\tUserBashEvent,\n\tUserBashEventResult,\n\tWidgetPlacement,\n\tWorkingIndicatorOptions,\n\tWriteToolCallEvent,\n} from \"./core/extensions/index.ts\";\nexport {\n\tcreateExtensionRuntime,\n\tdecideReactiveWidgetAction,\n\tdefineTool,\n\tdiscoverAndLoadExtensions,\n\tExtensionRunner,\n\tisBashToolResult,\n\tisEditToolResult,\n\tisFindToolResult,\n\tisGrepToolResult,\n\tisLsToolResult,\n\tisReadToolResult,\n\tisToolCallEventType,\n\tisWriteToolResult,\n\tinstallReactiveWidget,\n\twrapRegisteredTool,\n\twrapRegisteredTools,\n} from \"./core/extensions/index.ts\";\n// Builtin tool definitions reusable by first-party extensions (e.g. workflows\n// invoking the structured ask_user_question UI deterministically).\nexport { createAskUserQuestionToolDefinition } from \"./core/tools/index.ts\";\n// Footer data provider (git branch + extension statuses - data not otherwise available to extensions)\nexport type { ReadonlyFooterDataProvider } from \"./core/footer-data-provider.ts\";\nexport { convertToLlm } from \"./core/messages.ts\";\nexport { ModelRegistry } from \"./core/model-registry.ts\";\nexport type {\n\tPackageManager,\n\tPathMetadata,\n\tProgressCallback,\n\tProgressEvent,\n\tResolvedPaths,\n\tResolvedResource,\n} from \"./core/package-manager.ts\";\nexport { getBuiltinPackagePaths } from \"./core/builtin-packages.ts\";\nexport { DefaultPackageManager } from \"./core/package-manager.ts\";\nexport type { ResourceCollision, ResourceDiagnostic, ResourceLoader } from \"./core/resource-loader.ts\";\nexport { DefaultResourceLoader, loadProjectContextFiles } from \"./core/resource-loader.ts\";\n// SDK for programmatic usage\nexport {\n\tAgentSessionRuntime,\n\ttype AgentSessionRuntimeDiagnostic,\n\ttype AgentSessionServices,\n\ttype CreateAgentSessionFromServicesOptions,\n\ttype CreateAgentSessionOptions,\n\ttype CreateAgentSessionResult,\n\ttype CreateAgentSessionRuntimeFactory,\n\ttype CreateAgentSessionRuntimeResult,\n\ttype CreateAgentSessionServicesOptions,\n\t// Factory\n\tcreateAgentSession,\n\tcreateAgentSessionFromServices,\n\tcreateAgentSessionRuntime,\n\tcreateAgentSessionServices,\n\tcreateBashTool,\n\t// Tool factories (for custom cwd)\n\tcreateCodingTools,\n\tcreateEditTool,\n\tcreateFindTool,\n\tcreateGrepTool,\n\tcreateLsTool,\n\tcreateReadOnlyTools,\n\tcreateReadTool,\n\tcreateWriteTool,\n\ttype PromptTemplate,\n} from \"./core/sdk.ts\";\nexport {\n\ttype BranchSummaryEntry,\n\tbuildSessionContext,\n\ttype CompactionEntry,\n\ttype ContextCompactionEntry,\n\ttype ContextCompactionStats,\n\ttype ContextDeletionTarget,\n\tCURRENT_SESSION_VERSION,\n\ttype CustomEntry,\n\ttype CustomMessageEntry,\n\ttype FileEntry,\n\tgetLatestCompactionBoundaryEntry,\n\tgetLatestCompactionEntry,\n\ttype ModelChangeEntry,\n\tmigrateSessionEntries,\n\ttype NewSessionOptions,\n\tparseSessionEntries,\n\ttype SessionContext,\n\ttype SessionEntry,\n\ttype SessionEntryBase,\n\ttype SessionHeader,\n\ttype SessionInfo,\n\ttype SessionInfoEntry,\n\tSessionManager,\n\ttype SessionMessageEntry,\n\ttype ThinkingLevelChangeEntry,\n} from \"./core/session-manager.ts\";\nexport {\n\ttype CompactionSettings,\n\ttype ImageSettings,\n\ttype PackageSource,\n\ttype RetrySettings,\n\tSettingsManager,\n} from \"./core/settings-manager.ts\";\n// Skills\nexport {\n\tformatSkillsForPrompt,\n\ttype LoadSkillsFromDirOptions,\n\ttype LoadSkillsResult,\n\tloadSkills,\n\tloadSkillsFromDir,\n\ttype Skill,\n\ttype SkillFrontmatter,\n} from \"./core/skills.ts\";\nexport { createSyntheticSourceInfo } from \"./core/source-info.ts\";\n// Tools\nexport {\n\ttype BashOperations,\n\ttype BashSpawnContext,\n\ttype BashSpawnHook,\n\ttype BashToolDetails,\n\ttype BashToolInput,\n\ttype BashToolOptions,\n\tcreateBashToolDefinition,\n\tcreateEditToolDefinition,\n\tcreateFindToolDefinition,\n\tcreateGrepToolDefinition,\n\tcreateLocalBashOperations,\n\tcreateLsToolDefinition,\n\tcreateReadToolDefinition,\n\tcreateWriteToolDefinition,\n\tDEFAULT_MAX_BYTES,\n\tDEFAULT_MAX_LINES,\n\ttype EditOperations,\n\ttype EditToolDetails,\n\ttype EditToolInput,\n\ttype EditToolOptions,\n\ttype FindOperations,\n\ttype FindToolDetails,\n\ttype FindToolInput,\n\ttype FindToolOptions,\n\tformatSize,\n\ttype GrepOperations,\n\ttype GrepToolDetails,\n\ttype GrepToolInput,\n\ttype GrepToolOptions,\n\ttype LsOperations,\n\ttype LsToolDetails,\n\ttype LsToolInput,\n\ttype LsToolOptions,\n\ttype ReadOperations,\n\ttype ReadToolDetails,\n\ttype ReadToolInput,\n\ttype ReadToolOptions,\n\ttype ToolsOptions,\n\ttype TruncationOptions,\n\ttype TruncationResult,\n\ttruncateHead,\n\ttruncateLine,\n\ttruncateTail,\n\ttype WriteOperations,\n\ttype WriteToolInput,\n\ttype WriteToolOptions,\n\twithFileMutationQueue,\n} from \"./core/tools/index.ts\";\n// Main entry point\nexport { type MainOptions, main } from \"./main.ts\";\n// Run modes for programmatic SDK usage\nexport { pickWhimsicalWorkingMessage } from \"./modes/interactive/whimsical-messages.ts\";\nexport {\n\tInteractiveMode,\n\ttype InteractiveModeOptions,\n\ttype ModelInfo,\n\ttype PrintModeOptions,\n\tRpcClient,\n\ttype RpcClientOptions,\n\ttype RpcCommand,\n\ttype RpcEvent,\n\ttype RpcEventListener,\n\ttype RpcResponse,\n\ttype RpcSessionState,\n\trunPrintMode,\n\trunRpcMode,\n} from \"./modes/index.ts\";\n// UI components for extensions\nexport {\n\tArminComponent,\n\tAssistantMessageComponent,\n\tBashExecutionComponent,\n\tBorderedLoader,\n\tchatEntriesFromAgentMessages,\n\t// Internal host seam for bundled workflow stage chat; not yet a stable extension API.\n\tChatSessionHost,\n\ttype ChatSessionHostBashRequest,\n\ttype ChatSessionHostCommands,\n\ttype ChatSessionHostEntry,\n\ttype ChatSessionHostOpts,\n\ttype ChatSessionHostStyle,\n\tChatTranscriptComponent,\n\tLiveChatEntriesController,\n\trenderChatMessageEntry,\n\ttype ChatMessageEntry,\n\ttype ChatMessageRenderOptions,\n\tScrollableChatTranscriptComponent,\n\tScrollableComponentViewport,\n\ttype ChatTranscriptEntryLike,\n\ttype ChatTranscriptRenderer,\n\ttype ChatTranscriptRole,\n\tBranchSummaryMessageComponent,\n\tCompactionSummaryMessageComponent,\n\tCustomEditor,\n\tCustomMessageComponent,\n\tDynamicBorder,\n\tExtensionEditorComponent,\n\tExtensionInputComponent,\n\tExtensionSelectorComponent,\n\tFooterComponent,\n\tUsageMeterComponent,\n\tkeyHint,\n\tkeyText,\n\tLoginDialogComponent,\n\tModelSelectorComponent,\n\tOAuthSelectorComponent,\n\ttype RenderDiffOptions,\n\trawKeyHint,\n\trenderDiff,\n\tSessionSelectorComponent,\n\ttype SettingsCallbacks,\n\ttype SettingsConfig,\n\tSettingsSelectorComponent,\n\tShowImagesSelectorComponent,\n\tSkillInvocationMessageComponent,\n\tThemeSelectorComponent,\n\tThinkingSelectorComponent,\n\tToolExecutionComponent,\n\ttype ToolExecutionOptions,\n\tTreeSelectorComponent,\n\ttruncateToVisualLines,\n\tUserMessageComponent,\n\tUserMessageSelectorComponent,\n\tWorkingStatusComponent,\n\ttype WorkingStatusComponentOptions,\n\ttype VisualTruncateResult,\n} from \"./modes/interactive/components/index.ts\";\n// Theme utilities for custom tools and extensions\nexport {\n\tgetLanguageFromPath,\n\tgetMarkdownTheme,\n\tgetSelectListTheme,\n\tgetSettingsListTheme,\n\thighlightCode,\n\tinitTheme,\n\tTheme,\n\ttype ThemeColor,\n} from \"./modes/interactive/theme/theme.ts\";\n// Clipboard utilities\nexport { copyToClipboard } from \"./utils/clipboard.ts\";\nexport { parseFrontmatter, stripFrontmatter } from \"./utils/frontmatter.ts\";\nexport { createGitEnvironment, GIT_LOCAL_ENV_VARS } from \"./utils/git-env.ts\";\nexport { formatDimensionNote, type ResizedImage, resizeImage } from \"./utils/image-resize.ts\";\n// Shell utilities\nexport { getShellConfig } from \"./utils/shell.ts\";\n"]}
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ export { AgentSession, parseSkillBlock, } from "./core/agent-session.js";
|
|
|
6
6
|
// Auth and model registry
|
|
7
7
|
export { AuthStorage, FileAuthStorageBackend, InMemoryAuthStorageBackend, } from "./core/auth-storage.js";
|
|
8
8
|
// Compaction
|
|
9
|
-
export { calculateContextTokens, collectEntriesForBranchSummary, compact, DEFAULT_COMPACTION_SETTINGS, estimateTokens, findCutPoint, findTurnStartIndex, generateBranchSummary, generateSummary, getLastAssistantUsage, prepareBranchEntries, serializeConversation, shouldCompact, } from "./core/compaction/index.js";
|
|
9
|
+
export { buildContextCompactionPrompt, calculateContextTokens, collectEntriesForBranchSummary, compact, contextCompact, DEFAULT_COMPACTION_SETTINGS, estimateTokens, findCutPoint, findTurnStartIndex, generateBranchSummary, generateSummary, getLastAssistantUsage, parseContextDeletionPlan, prepareBranchEntries, prepareContextCompaction, serializeConversation, shouldCompact, validateContextDeletionPlan, } from "./core/compaction/index.js";
|
|
10
10
|
export { CODEX_FAST_MODE_SERVICE_TIER, formatCodexFastModeModelLabel, getCodexFastModeScope, hasSupportedCodexFastModeModel, isCodexFastModeEnabledForScope, isCodexFastModeCandidateModelId, isCodexFastModeSupportedModel, isCodexFastModeSupportedProvider, shouldApplyCodexFastMode, shouldApplyCodexFastModeForScope, } from "./core/codex-fast-mode.js";
|
|
11
11
|
export { createEventBus } from "./core/event-bus.js";
|
|
12
12
|
export { createExtensionRuntime, decideReactiveWidgetAction, defineTool, discoverAndLoadExtensions, ExtensionRunner, isBashToolResult, isEditToolResult, isFindToolResult, isGrepToolResult, isLsToolResult, isReadToolResult, isToolCallEventType, isWriteToolResult, installReactiveWidget, wrapRegisteredTool, wrapRegisteredTools, } from "./core/extensions/index.js";
|
|
@@ -24,7 +24,7 @@ export { AgentSessionRuntime,
|
|
|
24
24
|
createAgentSession, createAgentSessionFromServices, createAgentSessionRuntime, createAgentSessionServices, createBashTool,
|
|
25
25
|
// Tool factories (for custom cwd)
|
|
26
26
|
createCodingTools, createEditTool, createFindTool, createGrepTool, createLsTool, createReadOnlyTools, createReadTool, createWriteTool, } from "./core/sdk.js";
|
|
27
|
-
export { buildSessionContext, CURRENT_SESSION_VERSION, getLatestCompactionEntry, migrateSessionEntries, parseSessionEntries, SessionManager, } from "./core/session-manager.js";
|
|
27
|
+
export { buildSessionContext, CURRENT_SESSION_VERSION, getLatestCompactionBoundaryEntry, getLatestCompactionEntry, migrateSessionEntries, parseSessionEntries, SessionManager, } from "./core/session-manager.js";
|
|
28
28
|
export { SettingsManager, } from "./core/settings-manager.js";
|
|
29
29
|
// Skills
|
|
30
30
|
export { formatSkillsForPrompt, loadSkills, loadSkillsFromDir, } from "./core/skills.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAE1B,eAAe;AACf,OAAO,EACN,QAAQ,EACR,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,sBAAsB,EACtB,iBAAiB,EACjB,mBAAmB,EACnB,WAAW,EACX,YAAY,EACZ,iBAAiB,EACjB,oBAAoB,EACpB,qBAAqB,EACrB,WAAW,EACX,WAAW,EACX,mBAAmB,EACnB,iCAAiC,EACjC,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EAClB,WAAW,EACX,YAAY,EACZ,WAAW,EACX,OAAO,GACP,MAAM,aAAa,CAAC;AACrB,OAAO,EAAmB,yBAAyB,EAAE,MA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,EACzB,sBAAsB,EAGtB,iCAAiC,EACjC,2BAA2B,EAI3B,6BAA6B,EAC7B,iCAAiC,EACjC,YAAY,EACZ,sBAAsB,EACtB,aAAa,EACb,wBAAwB,EACxB,uBAAuB,EACvB,0BAA0B,EAC1B,eAAe,EACf,mBAAmB,EACnB,OAAO,EACP,OAAO,EACP,oBAAoB,EACpB,sBAAsB,EACtB,sBAAsB,EAEtB,UAAU,EACV,UAAU,EACV,wBAAwB,EAGxB,yBAAyB,EACzB,2BAA2B,EAC3B,+BAA+B,EAC/B,sBAAsB,EACtB,yBAAyB,EACzB,sBAAsB,EAEtB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,4BAA4B,EAC5B,sBAAsB,GAGtB,MAAM,yCAAyC,CAAC;AACjD,kDAAkD;AAClD,OAAO,EACN,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,aAAa,EACb,SAAS,EACT,KAAK,GAEL,MAAM,oCAAoC,CAAC;AAC5C,sBAAsB;AACtB,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAqB,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC9F,kBAAkB;AAClB,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC","sourcesContent":["// Core session management\n\n// Config paths\nexport {\n\tAPP_NAME,\n\tAPP_TITLE,\n\tCONFIG_DIR_NAME,\n\tCONFIG_DIR_NAMES,\n\tLEGACY_CONFIG_DIR_NAME,\n\tLEGACY_ENV_PREFIX,\n\tgetAgentConfigPaths,\n\tgetAgentDir,\n\tgetAgentDirs,\n\tgetLegacyAgentDir,\n\tgetProjectConfigDirs,\n\tgetProjectConfigPaths,\n\tgetEnvNames,\n\tgetEnvValue,\n\tENV_CODEX_FAST_MODE,\n\tWORKFLOW_STAGE_SUBAGENT_GUARD_ENV,\n\tisBunBinary,\n\tgetUserConfigDirs,\n\tgetUserConfigPaths,\n\thasEnvValue,\n\tPACKAGE_NAME,\n\tsetEnvValue,\n\tVERSION,\n} from \"./config.ts\";\nexport { type BashResult, executeBashWithOperations } from \"./core/bash-executor.ts\";\nexport {\n\tAgentSession,\n\ttype AgentSessionConfig,\n\ttype AgentSessionEvent,\n\ttype AgentSessionEventListener,\n\ttype ModelCycleResult,\n\ttype ParsedSkillBlock,\n\ttype PromptOptions,\n\tparseSkillBlock,\n\ttype SessionStats,\n} from \"./core/agent-session.ts\";\n// Auth and model registry\nexport {\n\ttype ApiKeyCredential,\n\ttype AuthCredential,\n\ttype AuthStatus,\n\tAuthStorage,\n\ttype AuthStorageBackend,\n\tFileAuthStorageBackend,\n\tInMemoryAuthStorageBackend,\n\ttype OAuthCredential,\n} from \"./core/auth-storage.ts\";\n// Compaction\nexport {\n\ttype BranchPreparation,\n\ttype BranchSummaryResult,\n\ttype CollectEntriesResult,\n\ttype CompactionResult,\n\ttype CutPointResult,\n\tcalculateContextTokens,\n\tcollectEntriesForBranchSummary,\n\tcompact,\n\tDEFAULT_COMPACTION_SETTINGS,\n\testimateTokens,\n\ttype FileOperations,\n\tfindCutPoint,\n\tfindTurnStartIndex,\n\ttype GenerateBranchSummaryOptions,\n\tgenerateBranchSummary,\n\tgenerateSummary,\n\tgetLastAssistantUsage,\n\tprepareBranchEntries,\n\tserializeConversation,\n\tshouldCompact,\n} from \"./core/compaction/index.ts\";\nexport {\n\tCODEX_FAST_MODE_SERVICE_TIER,\n\tformatCodexFastModeModelLabel,\n\tgetCodexFastModeScope,\n\thasSupportedCodexFastModeModel,\n\tisCodexFastModeEnabledForScope,\n\tisCodexFastModeCandidateModelId,\n\tisCodexFastModeSupportedModel,\n\tisCodexFastModeSupportedProvider,\n\tshouldApplyCodexFastMode,\n\tshouldApplyCodexFastModeForScope,\n\ttype CodexFastModeResolvedSettings,\n\ttype CodexFastModeScope,\n} from \"./core/codex-fast-mode.ts\";\nexport { createEventBus, type EventBus, type EventBusController } from \"./core/event-bus.ts\";\n// Extension system\nexport type {\n\tAgentEndEvent,\n\tAgentStartEvent,\n\tAgentToolResult,\n\tAgentToolUpdateCallback,\n\tAppKeybinding,\n\tAutocompleteProviderFactory,\n\tBashToolCallEvent,\n\tBeforeAgentStartEvent,\n\tBeforeAgentStartEventResult,\n\tBeforeProviderRequestEvent,\n\tBeforeProviderRequestEventResult,\n\tBuildSystemPromptOptions,\n\tCompactOptions,\n\tContextEvent,\n\tContextUsage,\n\tCustomToolCallEvent,\n\tEditToolCallEvent,\n\tExecOptions,\n\tExecResult,\n\tExtension,\n\tExtensionActions,\n\tExtensionAPI,\n\tExtensionCommandContext,\n\tExtensionCommandContextActions,\n\tExtensionContext,\n\tExtensionContextActions,\n\tWorkflowStageOrchestrationContext,\n\tExtensionError,\n\tExtensionEvent,\n\tExtensionFactory,\n\tExtensionFlag,\n\tExtensionHandler,\n\tExtensionRuntime,\n\tExtensionShortcut,\n\tExtensionUIContext,\n\tExtensionUIDialogOptions,\n\tExtensionWidgetOptions,\n\tFindToolCallEvent,\n\tGrepToolCallEvent,\n\tInputEvent,\n\tInputEventResult,\n\tInputSource,\n\tKeybindingsManager,\n\tLoadExtensionsResult,\n\tLsToolCallEvent,\n\tMessageRenderer,\n\tMessageRenderOptions,\n\tOrchestrationContext,\n\tProviderConfig,\n\tProviderModelConfig,\n\tReactiveWidgetAction,\n\tReactiveWidgetComponent,\n\tReactiveWidgetController,\n\tReactiveWidgetFactory,\n\tReactiveWidgetRefreshReason,\n\tReactiveWidgetRenderContext,\n\tReactiveWidgetRenderState,\n\tReactiveWidgetScheduler,\n\tReactiveWidgetTimerApi,\n\tReactiveWidgetTimerHandle,\n\tReactiveWidgetUi,\n\tReadToolCallEvent,\n\tRegisteredCommand,\n\tRegisteredTool,\n\tResolvedCommand,\n\tSessionBeforeCompactEvent,\n\tSessionBeforeForkEvent,\n\tSessionBeforeSwitchEvent,\n\tSessionBeforeTreeEvent,\n\tSessionCompactEvent,\n\tSessionShutdownEvent,\n\tSessionStartEvent,\n\tSessionTreeEvent,\n\tSlashCommandInfo,\n\tSlashCommandSource,\n\tSourceInfo,\n\tTerminalInputHandler,\n\tToolCallEvent,\n\tToolCallEventResult,\n\tToolDefinition,\n\tToolExecutionMode,\n\tInstallReactiveWidgetOptions,\n\tToolInfo,\n\tToolRenderResultOptions,\n\tToolResultEvent,\n\tTurnEndEvent,\n\tTurnStartEvent,\n\tUserBashEvent,\n\tUserBashEventResult,\n\tWidgetPlacement,\n\tWorkingIndicatorOptions,\n\tWriteToolCallEvent,\n} from \"./core/extensions/index.ts\";\nexport {\n\tcreateExtensionRuntime,\n\tdecideReactiveWidgetAction,\n\tdefineTool,\n\tdiscoverAndLoadExtensions,\n\tExtensionRunner,\n\tisBashToolResult,\n\tisEditToolResult,\n\tisFindToolResult,\n\tisGrepToolResult,\n\tisLsToolResult,\n\tisReadToolResult,\n\tisToolCallEventType,\n\tisWriteToolResult,\n\tinstallReactiveWidget,\n\twrapRegisteredTool,\n\twrapRegisteredTools,\n} from \"./core/extensions/index.ts\";\n// Builtin tool definitions reusable by first-party extensions (e.g. workflows\n// invoking the structured ask_user_question UI deterministically).\nexport { createAskUserQuestionToolDefinition } from \"./core/tools/index.ts\";\n// Footer data provider (git branch + extension statuses - data not otherwise available to extensions)\nexport type { ReadonlyFooterDataProvider } from \"./core/footer-data-provider.ts\";\nexport { convertToLlm } from \"./core/messages.ts\";\nexport { ModelRegistry } from \"./core/model-registry.ts\";\nexport type {\n\tPackageManager,\n\tPathMetadata,\n\tProgressCallback,\n\tProgressEvent,\n\tResolvedPaths,\n\tResolvedResource,\n} from \"./core/package-manager.ts\";\nexport { getBuiltinPackagePaths } from \"./core/builtin-packages.ts\";\nexport { DefaultPackageManager } from \"./core/package-manager.ts\";\nexport type { ResourceCollision, ResourceDiagnostic, ResourceLoader } from \"./core/resource-loader.ts\";\nexport { DefaultResourceLoader, loadProjectContextFiles } from \"./core/resource-loader.ts\";\n// SDK for programmatic usage\nexport {\n\tAgentSessionRuntime,\n\ttype AgentSessionRuntimeDiagnostic,\n\ttype AgentSessionServices,\n\ttype CreateAgentSessionFromServicesOptions,\n\ttype CreateAgentSessionOptions,\n\ttype CreateAgentSessionResult,\n\ttype CreateAgentSessionRuntimeFactory,\n\ttype CreateAgentSessionRuntimeResult,\n\ttype CreateAgentSessionServicesOptions,\n\t// Factory\n\tcreateAgentSession,\n\tcreateAgentSessionFromServices,\n\tcreateAgentSessionRuntime,\n\tcreateAgentSessionServices,\n\tcreateBashTool,\n\t// Tool factories (for custom cwd)\n\tcreateCodingTools,\n\tcreateEditTool,\n\tcreateFindTool,\n\tcreateGrepTool,\n\tcreateLsTool,\n\tcreateReadOnlyTools,\n\tcreateReadTool,\n\tcreateWriteTool,\n\ttype PromptTemplate,\n} from \"./core/sdk.ts\";\nexport {\n\ttype BranchSummaryEntry,\n\tbuildSessionContext,\n\ttype CompactionEntry,\n\tCURRENT_SESSION_VERSION,\n\ttype CustomEntry,\n\ttype CustomMessageEntry,\n\ttype FileEntry,\n\tgetLatestCompactionEntry,\n\ttype ModelChangeEntry,\n\tmigrateSessionEntries,\n\ttype NewSessionOptions,\n\tparseSessionEntries,\n\ttype SessionContext,\n\ttype SessionEntry,\n\ttype SessionEntryBase,\n\ttype SessionHeader,\n\ttype SessionInfo,\n\ttype SessionInfoEntry,\n\tSessionManager,\n\ttype SessionMessageEntry,\n\ttype ThinkingLevelChangeEntry,\n} from \"./core/session-manager.ts\";\nexport {\n\ttype CompactionSettings,\n\ttype ImageSettings,\n\ttype PackageSource,\n\ttype RetrySettings,\n\tSettingsManager,\n} from \"./core/settings-manager.ts\";\n// Skills\nexport {\n\tformatSkillsForPrompt,\n\ttype LoadSkillsFromDirOptions,\n\ttype LoadSkillsResult,\n\tloadSkills,\n\tloadSkillsFromDir,\n\ttype Skill,\n\ttype SkillFrontmatter,\n} from \"./core/skills.ts\";\nexport { createSyntheticSourceInfo } from \"./core/source-info.ts\";\n// Tools\nexport {\n\ttype BashOperations,\n\ttype BashSpawnContext,\n\ttype BashSpawnHook,\n\ttype BashToolDetails,\n\ttype BashToolInput,\n\ttype BashToolOptions,\n\tcreateBashToolDefinition,\n\tcreateEditToolDefinition,\n\tcreateFindToolDefinition,\n\tcreateGrepToolDefinition,\n\tcreateLocalBashOperations,\n\tcreateLsToolDefinition,\n\tcreateReadToolDefinition,\n\tcreateWriteToolDefinition,\n\tDEFAULT_MAX_BYTES,\n\tDEFAULT_MAX_LINES,\n\ttype EditOperations,\n\ttype EditToolDetails,\n\ttype EditToolInput,\n\ttype EditToolOptions,\n\ttype FindOperations,\n\ttype FindToolDetails,\n\ttype FindToolInput,\n\ttype FindToolOptions,\n\tformatSize,\n\ttype GrepOperations,\n\ttype GrepToolDetails,\n\ttype GrepToolInput,\n\ttype GrepToolOptions,\n\ttype LsOperations,\n\ttype LsToolDetails,\n\ttype LsToolInput,\n\ttype LsToolOptions,\n\ttype ReadOperations,\n\ttype ReadToolDetails,\n\ttype ReadToolInput,\n\ttype ReadToolOptions,\n\ttype ToolsOptions,\n\ttype TruncationOptions,\n\ttype TruncationResult,\n\ttruncateHead,\n\ttruncateLine,\n\ttruncateTail,\n\ttype WriteOperations,\n\ttype WriteToolInput,\n\ttype WriteToolOptions,\n\twithFileMutationQueue,\n} from \"./core/tools/index.ts\";\n// Main entry point\nexport { type MainOptions, main } from \"./main.ts\";\n// Run modes for programmatic SDK usage\nexport { pickWhimsicalWorkingMessage } from \"./modes/interactive/whimsical-messages.ts\";\nexport {\n\tInteractiveMode,\n\ttype InteractiveModeOptions,\n\ttype ModelInfo,\n\ttype PrintModeOptions,\n\tRpcClient,\n\ttype RpcClientOptions,\n\ttype RpcCommand,\n\ttype RpcEventListener,\n\ttype RpcResponse,\n\ttype RpcSessionState,\n\trunPrintMode,\n\trunRpcMode,\n} from \"./modes/index.ts\";\n// UI components for extensions\nexport {\n\tArminComponent,\n\tAssistantMessageComponent,\n\tBashExecutionComponent,\n\tBorderedLoader,\n\tchatEntriesFromAgentMessages,\n\t// Internal host seam for bundled workflow stage chat; not yet a stable extension API.\n\tChatSessionHost,\n\ttype ChatSessionHostBashRequest,\n\ttype ChatSessionHostCommands,\n\ttype ChatSessionHostEntry,\n\ttype ChatSessionHostOpts,\n\ttype ChatSessionHostStyle,\n\tChatTranscriptComponent,\n\tLiveChatEntriesController,\n\trenderChatMessageEntry,\n\ttype ChatMessageEntry,\n\ttype ChatMessageRenderOptions,\n\tScrollableChatTranscriptComponent,\n\tScrollableComponentViewport,\n\ttype ChatTranscriptEntryLike,\n\ttype ChatTranscriptRenderer,\n\ttype ChatTranscriptRole,\n\tBranchSummaryMessageComponent,\n\tCompactionSummaryMessageComponent,\n\tCustomEditor,\n\tCustomMessageComponent,\n\tDynamicBorder,\n\tExtensionEditorComponent,\n\tExtensionInputComponent,\n\tExtensionSelectorComponent,\n\tFooterComponent,\n\tUsageMeterComponent,\n\tkeyHint,\n\tkeyText,\n\tLoginDialogComponent,\n\tModelSelectorComponent,\n\tOAuthSelectorComponent,\n\ttype RenderDiffOptions,\n\trawKeyHint,\n\trenderDiff,\n\tSessionSelectorComponent,\n\ttype SettingsCallbacks,\n\ttype SettingsConfig,\n\tSettingsSelectorComponent,\n\tShowImagesSelectorComponent,\n\tSkillInvocationMessageComponent,\n\tThemeSelectorComponent,\n\tThinkingSelectorComponent,\n\tToolExecutionComponent,\n\ttype ToolExecutionOptions,\n\tTreeSelectorComponent,\n\ttruncateToVisualLines,\n\tUserMessageComponent,\n\tUserMessageSelectorComponent,\n\tWorkingStatusComponent,\n\ttype WorkingStatusComponentOptions,\n\ttype VisualTruncateResult,\n} from \"./modes/interactive/components/index.ts\";\n// Theme utilities for custom tools and extensions\nexport {\n\tgetLanguageFromPath,\n\tgetMarkdownTheme,\n\tgetSelectListTheme,\n\tgetSettingsListTheme,\n\thighlightCode,\n\tinitTheme,\n\tTheme,\n\ttype ThemeColor,\n} from \"./modes/interactive/theme/theme.ts\";\n// Clipboard utilities\nexport { copyToClipboard } from \"./utils/clipboard.ts\";\nexport { parseFrontmatter, stripFrontmatter } from \"./utils/frontmatter.ts\";\nexport { createGitEnvironment, GIT_LOCAL_ENV_VARS } from \"./utils/git-env.ts\";\nexport { formatDimensionNote, type ResizedImage, resizeImage } from \"./utils/image-resize.ts\";\n// Shell utilities\nexport { getShellConfig } from \"./utils/shell.ts\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAE1B,eAAe;AACf,OAAO,EACN,QAAQ,EACR,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,sBAAsB,EACtB,iBAAiB,EACjB,mBAAmB,EACnB,WAAW,EACX,YAAY,EACZ,iBAAiB,EACjB,oBAAoB,EACpB,qBAAqB,EACrB,WAAW,EACX,WAAW,EACX,mBAAmB,EACnB,iCAAiC,EACjC,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EAClB,WAAW,EACX,YAAY,EACZ,WAAW,EACX,OAAO,GACP,MAAM,aAAa,CAAC;AACrB,OAAO,EAAmB,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACrF,OAAO,EACN,YAAY,EAOZ,eAAe,GAEf,MAAM,yBAAyB,CAAC;AACjC,0BAA0B;AAC1B,OAAO,EAIN,WAAW,EAEX,sBAAsB,EACtB,0BAA0B,GAE1B,MAAM,wBAAwB,CAAC;AAChC,aAAa;AACb,OAAO,EAWN,4BAA4B,EAC5B,sBAAsB,EACtB,8BAA8B,EAC9B,OAAO,EACP,cAAc,EACd,2BAA2B,EAC3B,cAAc,EAEd,YAAY,EACZ,kBAAkB,EAElB,qBAAqB,EACrB,eAAe,EACf,qBAAqB,EACrB,wBAAwB,EACxB,oBAAoB,EACpB,wBAAwB,EACxB,qBAAqB,EACrB,aAAa,EACb,2BAA2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AAyB,EACzB,sBAAsB,EAEtB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,4BAA4B,EAC5B,sBAAsB,GAGtB,MAAM,yCAAyC,CAAC;AACjD,kDAAkD;AAClD,OAAO,EACN,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,aAAa,EACb,SAAS,EACT,KAAK,GAEL,MAAM,oCAAoC,CAAC;AAC5C,sBAAsB;AACtB,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAqB,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC9F,kBAAkB;AAClB,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC","sourcesContent":["// Core session management\n\n// Config paths\nexport {\n\tAPP_NAME,\n\tAPP_TITLE,\n\tCONFIG_DIR_NAME,\n\tCONFIG_DIR_NAMES,\n\tLEGACY_CONFIG_DIR_NAME,\n\tLEGACY_ENV_PREFIX,\n\tgetAgentConfigPaths,\n\tgetAgentDir,\n\tgetAgentDirs,\n\tgetLegacyAgentDir,\n\tgetProjectConfigDirs,\n\tgetProjectConfigPaths,\n\tgetEnvNames,\n\tgetEnvValue,\n\tENV_CODEX_FAST_MODE,\n\tWORKFLOW_STAGE_SUBAGENT_GUARD_ENV,\n\tisBunBinary,\n\tgetUserConfigDirs,\n\tgetUserConfigPaths,\n\thasEnvValue,\n\tPACKAGE_NAME,\n\tsetEnvValue,\n\tVERSION,\n} from \"./config.ts\";\nexport { type BashResult, executeBashWithOperations } from \"./core/bash-executor.ts\";\nexport {\n\tAgentSession,\n\ttype AgentSessionConfig,\n\ttype AgentSessionEvent,\n\ttype AgentSessionEventListener,\n\ttype ModelCycleResult,\n\ttype ParsedSkillBlock,\n\ttype PromptOptions,\n\tparseSkillBlock,\n\ttype SessionStats,\n} from \"./core/agent-session.ts\";\n// Auth and model registry\nexport {\n\ttype ApiKeyCredential,\n\ttype AuthCredential,\n\ttype AuthStatus,\n\tAuthStorage,\n\ttype AuthStorageBackend,\n\tFileAuthStorageBackend,\n\tInMemoryAuthStorageBackend,\n\ttype OAuthCredential,\n} from \"./core/auth-storage.ts\";\n// Compaction\nexport {\n\ttype BranchPreparation,\n\ttype BranchSummaryResult,\n\ttype CollectEntriesResult,\n\ttype CompactableTranscript,\n\ttype CompactionResult,\n\ttype ContextCompactionPreparation,\n\ttype ContextCompactionResult,\n\ttype CutPointResult,\n\ttype RawContextDeletionPlan,\n\ttype ValidatedContextDeletionPlan,\n\tbuildContextCompactionPrompt,\n\tcalculateContextTokens,\n\tcollectEntriesForBranchSummary,\n\tcompact,\n\tcontextCompact,\n\tDEFAULT_COMPACTION_SETTINGS,\n\testimateTokens,\n\ttype FileOperations,\n\tfindCutPoint,\n\tfindTurnStartIndex,\n\ttype GenerateBranchSummaryOptions,\n\tgenerateBranchSummary,\n\tgenerateSummary,\n\tgetLastAssistantUsage,\n\tparseContextDeletionPlan,\n\tprepareBranchEntries,\n\tprepareContextCompaction,\n\tserializeConversation,\n\tshouldCompact,\n\tvalidateContextDeletionPlan,\n} from \"./core/compaction/index.ts\";\nexport {\n\tCODEX_FAST_MODE_SERVICE_TIER,\n\tformatCodexFastModeModelLabel,\n\tgetCodexFastModeScope,\n\thasSupportedCodexFastModeModel,\n\tisCodexFastModeEnabledForScope,\n\tisCodexFastModeCandidateModelId,\n\tisCodexFastModeSupportedModel,\n\tisCodexFastModeSupportedProvider,\n\tshouldApplyCodexFastMode,\n\tshouldApplyCodexFastModeForScope,\n\ttype CodexFastModeResolvedSettings,\n\ttype CodexFastModeScope,\n} from \"./core/codex-fast-mode.ts\";\nexport { createEventBus, type EventBus, type EventBusController } from \"./core/event-bus.ts\";\n// Extension system\nexport type {\n\tAgentEndEvent,\n\tAgentStartEvent,\n\tAgentToolResult,\n\tAgentToolUpdateCallback,\n\tAppKeybinding,\n\tAutocompleteProviderFactory,\n\tBashToolCallEvent,\n\tBeforeAgentStartEvent,\n\tBeforeAgentStartEventResult,\n\tBeforeProviderRequestEvent,\n\tBeforeProviderRequestEventResult,\n\tBuildSystemPromptOptions,\n\tCompactOptions,\n\tContextEvent,\n\tContextUsage,\n\tCustomToolCallEvent,\n\tEditToolCallEvent,\n\tExecOptions,\n\tExecResult,\n\tExtension,\n\tExtensionActions,\n\tExtensionAPI,\n\tExtensionCommandContext,\n\tExtensionCommandContextActions,\n\tExtensionContext,\n\tExtensionContextActions,\n\tWorkflowStageOrchestrationContext,\n\tExtensionError,\n\tExtensionEvent,\n\tExtensionFactory,\n\tExtensionFlag,\n\tExtensionHandler,\n\tExtensionRuntime,\n\tExtensionShortcut,\n\tExtensionUIContext,\n\tExtensionUIDialogOptions,\n\tExtensionWidgetOptions,\n\tFindToolCallEvent,\n\tGrepToolCallEvent,\n\tInputEvent,\n\tInputEventResult,\n\tInputSource,\n\tKeybindingsManager,\n\tLoadExtensionsResult,\n\tLsToolCallEvent,\n\tMessageRenderer,\n\tMessageRenderOptions,\n\tOrchestrationContext,\n\tProviderConfig,\n\tProviderModelConfig,\n\tReactiveWidgetAction,\n\tReactiveWidgetComponent,\n\tReactiveWidgetController,\n\tReactiveWidgetFactory,\n\tReactiveWidgetRefreshReason,\n\tReactiveWidgetRenderContext,\n\tReactiveWidgetRenderState,\n\tReactiveWidgetScheduler,\n\tReactiveWidgetTimerApi,\n\tReactiveWidgetTimerHandle,\n\tReactiveWidgetUi,\n\tReadToolCallEvent,\n\tRegisteredCommand,\n\tRegisteredTool,\n\tResolvedCommand,\n\tSessionBeforeCompactEvent,\n\tSessionBeforeForkEvent,\n\tSessionBeforeSwitchEvent,\n\tSessionBeforeTreeEvent,\n\tSessionCompactEvent,\n\tSessionShutdownEvent,\n\tSessionStartEvent,\n\tSessionTreeEvent,\n\tSlashCommandInfo,\n\tSlashCommandSource,\n\tSourceInfo,\n\tTerminalInputHandler,\n\tToolCallEvent,\n\tToolCallEventResult,\n\tToolDefinition,\n\tToolExecutionMode,\n\tInstallReactiveWidgetOptions,\n\tToolInfo,\n\tToolRenderResultOptions,\n\tToolResultEvent,\n\tTurnEndEvent,\n\tTurnStartEvent,\n\tUserBashEvent,\n\tUserBashEventResult,\n\tWidgetPlacement,\n\tWorkingIndicatorOptions,\n\tWriteToolCallEvent,\n} from \"./core/extensions/index.ts\";\nexport {\n\tcreateExtensionRuntime,\n\tdecideReactiveWidgetAction,\n\tdefineTool,\n\tdiscoverAndLoadExtensions,\n\tExtensionRunner,\n\tisBashToolResult,\n\tisEditToolResult,\n\tisFindToolResult,\n\tisGrepToolResult,\n\tisLsToolResult,\n\tisReadToolResult,\n\tisToolCallEventType,\n\tisWriteToolResult,\n\tinstallReactiveWidget,\n\twrapRegisteredTool,\n\twrapRegisteredTools,\n} from \"./core/extensions/index.ts\";\n// Builtin tool definitions reusable by first-party extensions (e.g. workflows\n// invoking the structured ask_user_question UI deterministically).\nexport { createAskUserQuestionToolDefinition } from \"./core/tools/index.ts\";\n// Footer data provider (git branch + extension statuses - data not otherwise available to extensions)\nexport type { ReadonlyFooterDataProvider } from \"./core/footer-data-provider.ts\";\nexport { convertToLlm } from \"./core/messages.ts\";\nexport { ModelRegistry } from \"./core/model-registry.ts\";\nexport type {\n\tPackageManager,\n\tPathMetadata,\n\tProgressCallback,\n\tProgressEvent,\n\tResolvedPaths,\n\tResolvedResource,\n} from \"./core/package-manager.ts\";\nexport { getBuiltinPackagePaths } from \"./core/builtin-packages.ts\";\nexport { DefaultPackageManager } from \"./core/package-manager.ts\";\nexport type { ResourceCollision, ResourceDiagnostic, ResourceLoader } from \"./core/resource-loader.ts\";\nexport { DefaultResourceLoader, loadProjectContextFiles } from \"./core/resource-loader.ts\";\n// SDK for programmatic usage\nexport {\n\tAgentSessionRuntime,\n\ttype AgentSessionRuntimeDiagnostic,\n\ttype AgentSessionServices,\n\ttype CreateAgentSessionFromServicesOptions,\n\ttype CreateAgentSessionOptions,\n\ttype CreateAgentSessionResult,\n\ttype CreateAgentSessionRuntimeFactory,\n\ttype CreateAgentSessionRuntimeResult,\n\ttype CreateAgentSessionServicesOptions,\n\t// Factory\n\tcreateAgentSession,\n\tcreateAgentSessionFromServices,\n\tcreateAgentSessionRuntime,\n\tcreateAgentSessionServices,\n\tcreateBashTool,\n\t// Tool factories (for custom cwd)\n\tcreateCodingTools,\n\tcreateEditTool,\n\tcreateFindTool,\n\tcreateGrepTool,\n\tcreateLsTool,\n\tcreateReadOnlyTools,\n\tcreateReadTool,\n\tcreateWriteTool,\n\ttype PromptTemplate,\n} from \"./core/sdk.ts\";\nexport {\n\ttype BranchSummaryEntry,\n\tbuildSessionContext,\n\ttype CompactionEntry,\n\ttype ContextCompactionEntry,\n\ttype ContextCompactionStats,\n\ttype ContextDeletionTarget,\n\tCURRENT_SESSION_VERSION,\n\ttype CustomEntry,\n\ttype CustomMessageEntry,\n\ttype FileEntry,\n\tgetLatestCompactionBoundaryEntry,\n\tgetLatestCompactionEntry,\n\ttype ModelChangeEntry,\n\tmigrateSessionEntries,\n\ttype NewSessionOptions,\n\tparseSessionEntries,\n\ttype SessionContext,\n\ttype SessionEntry,\n\ttype SessionEntryBase,\n\ttype SessionHeader,\n\ttype SessionInfo,\n\ttype SessionInfoEntry,\n\tSessionManager,\n\ttype SessionMessageEntry,\n\ttype ThinkingLevelChangeEntry,\n} from \"./core/session-manager.ts\";\nexport {\n\ttype CompactionSettings,\n\ttype ImageSettings,\n\ttype PackageSource,\n\ttype RetrySettings,\n\tSettingsManager,\n} from \"./core/settings-manager.ts\";\n// Skills\nexport {\n\tformatSkillsForPrompt,\n\ttype LoadSkillsFromDirOptions,\n\ttype LoadSkillsResult,\n\tloadSkills,\n\tloadSkillsFromDir,\n\ttype Skill,\n\ttype SkillFrontmatter,\n} from \"./core/skills.ts\";\nexport { createSyntheticSourceInfo } from \"./core/source-info.ts\";\n// Tools\nexport {\n\ttype BashOperations,\n\ttype BashSpawnContext,\n\ttype BashSpawnHook,\n\ttype BashToolDetails,\n\ttype BashToolInput,\n\ttype BashToolOptions,\n\tcreateBashToolDefinition,\n\tcreateEditToolDefinition,\n\tcreateFindToolDefinition,\n\tcreateGrepToolDefinition,\n\tcreateLocalBashOperations,\n\tcreateLsToolDefinition,\n\tcreateReadToolDefinition,\n\tcreateWriteToolDefinition,\n\tDEFAULT_MAX_BYTES,\n\tDEFAULT_MAX_LINES,\n\ttype EditOperations,\n\ttype EditToolDetails,\n\ttype EditToolInput,\n\ttype EditToolOptions,\n\ttype FindOperations,\n\ttype FindToolDetails,\n\ttype FindToolInput,\n\ttype FindToolOptions,\n\tformatSize,\n\ttype GrepOperations,\n\ttype GrepToolDetails,\n\ttype GrepToolInput,\n\ttype GrepToolOptions,\n\ttype LsOperations,\n\ttype LsToolDetails,\n\ttype LsToolInput,\n\ttype LsToolOptions,\n\ttype ReadOperations,\n\ttype ReadToolDetails,\n\ttype ReadToolInput,\n\ttype ReadToolOptions,\n\ttype ToolsOptions,\n\ttype TruncationOptions,\n\ttype TruncationResult,\n\ttruncateHead,\n\ttruncateLine,\n\ttruncateTail,\n\ttype WriteOperations,\n\ttype WriteToolInput,\n\ttype WriteToolOptions,\n\twithFileMutationQueue,\n} from \"./core/tools/index.ts\";\n// Main entry point\nexport { type MainOptions, main } from \"./main.ts\";\n// Run modes for programmatic SDK usage\nexport { pickWhimsicalWorkingMessage } from \"./modes/interactive/whimsical-messages.ts\";\nexport {\n\tInteractiveMode,\n\ttype InteractiveModeOptions,\n\ttype ModelInfo,\n\ttype PrintModeOptions,\n\tRpcClient,\n\ttype RpcClientOptions,\n\ttype RpcCommand,\n\ttype RpcEvent,\n\ttype RpcEventListener,\n\ttype RpcResponse,\n\ttype RpcSessionState,\n\trunPrintMode,\n\trunRpcMode,\n} from \"./modes/index.ts\";\n// UI components for extensions\nexport {\n\tArminComponent,\n\tAssistantMessageComponent,\n\tBashExecutionComponent,\n\tBorderedLoader,\n\tchatEntriesFromAgentMessages,\n\t// Internal host seam for bundled workflow stage chat; not yet a stable extension API.\n\tChatSessionHost,\n\ttype ChatSessionHostBashRequest,\n\ttype ChatSessionHostCommands,\n\ttype ChatSessionHostEntry,\n\ttype ChatSessionHostOpts,\n\ttype ChatSessionHostStyle,\n\tChatTranscriptComponent,\n\tLiveChatEntriesController,\n\trenderChatMessageEntry,\n\ttype ChatMessageEntry,\n\ttype ChatMessageRenderOptions,\n\tScrollableChatTranscriptComponent,\n\tScrollableComponentViewport,\n\ttype ChatTranscriptEntryLike,\n\ttype ChatTranscriptRenderer,\n\ttype ChatTranscriptRole,\n\tBranchSummaryMessageComponent,\n\tCompactionSummaryMessageComponent,\n\tCustomEditor,\n\tCustomMessageComponent,\n\tDynamicBorder,\n\tExtensionEditorComponent,\n\tExtensionInputComponent,\n\tExtensionSelectorComponent,\n\tFooterComponent,\n\tUsageMeterComponent,\n\tkeyHint,\n\tkeyText,\n\tLoginDialogComponent,\n\tModelSelectorComponent,\n\tOAuthSelectorComponent,\n\ttype RenderDiffOptions,\n\trawKeyHint,\n\trenderDiff,\n\tSessionSelectorComponent,\n\ttype SettingsCallbacks,\n\ttype SettingsConfig,\n\tSettingsSelectorComponent,\n\tShowImagesSelectorComponent,\n\tSkillInvocationMessageComponent,\n\tThemeSelectorComponent,\n\tThinkingSelectorComponent,\n\tToolExecutionComponent,\n\ttype ToolExecutionOptions,\n\tTreeSelectorComponent,\n\ttruncateToVisualLines,\n\tUserMessageComponent,\n\tUserMessageSelectorComponent,\n\tWorkingStatusComponent,\n\ttype WorkingStatusComponentOptions,\n\ttype VisualTruncateResult,\n} from \"./modes/interactive/components/index.ts\";\n// Theme utilities for custom tools and extensions\nexport {\n\tgetLanguageFromPath,\n\tgetMarkdownTheme,\n\tgetSelectListTheme,\n\tgetSettingsListTheme,\n\thighlightCode,\n\tinitTheme,\n\tTheme,\n\ttype ThemeColor,\n} from \"./modes/interactive/theme/theme.ts\";\n// Clipboard utilities\nexport { copyToClipboard } from \"./utils/clipboard.ts\";\nexport { parseFrontmatter, stripFrontmatter } from \"./utils/frontmatter.ts\";\nexport { createGitEnvironment, GIT_LOCAL_ENV_VARS } from \"./utils/git-env.ts\";\nexport { formatDimensionNote, type ResizedImage, resizeImage } from \"./utils/image-resize.ts\";\n// Shell utilities\nexport { getShellConfig } from \"./utils/shell.ts\";\n"]}
|
package/dist/modes/index.d.ts
CHANGED
|
@@ -5,5 +5,5 @@ export { InteractiveMode, type InteractiveModeOptions } from "./interactive/inte
|
|
|
5
5
|
export { type PrintModeOptions, runPrintMode } from "./print-mode.ts";
|
|
6
6
|
export { type ModelInfo, RpcClient, type RpcClientOptions, type RpcEventListener } from "./rpc/rpc-client.ts";
|
|
7
7
|
export { runRpcMode } from "./rpc/rpc-mode.ts";
|
|
8
|
-
export type { RpcCommand, RpcResponse, RpcSessionState } from "./rpc/rpc-types.ts";
|
|
8
|
+
export type { RpcCommand, RpcEvent, RpcResponse, RpcSessionState } from "./rpc/rpc-types.ts";
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/modes/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,KAAK,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AACjG,OAAO,EAAE,KAAK,gBAAgB,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACtE,OAAO,EAAE,KAAK,SAAS,EAAE,SAAS,EAAE,KAAK,gBAAgB,EAAE,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC9G,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC","sourcesContent":["/**\n * Run modes for the coding agent.\n */\n\nexport { InteractiveMode, type InteractiveModeOptions } from \"./interactive/interactive-mode.ts\";\nexport { type PrintModeOptions, runPrintMode } from \"./print-mode.ts\";\nexport { type ModelInfo, RpcClient, type RpcClientOptions, type RpcEventListener } from \"./rpc/rpc-client.ts\";\nexport { runRpcMode } from \"./rpc/rpc-mode.ts\";\nexport type { RpcCommand, RpcResponse, RpcSessionState } from \"./rpc/rpc-types.ts\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/modes/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,KAAK,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AACjG,OAAO,EAAE,KAAK,gBAAgB,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACtE,OAAO,EAAE,KAAK,SAAS,EAAE,SAAS,EAAE,KAAK,gBAAgB,EAAE,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC9G,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC","sourcesContent":["/**\n * Run modes for the coding agent.\n */\n\nexport { InteractiveMode, type InteractiveModeOptions } from \"./interactive/interactive-mode.ts\";\nexport { type PrintModeOptions, runPrintMode } from \"./print-mode.ts\";\nexport { type ModelInfo, RpcClient, type RpcClientOptions, type RpcEventListener } from \"./rpc/rpc-client.ts\";\nexport { runRpcMode } from \"./rpc/rpc-mode.ts\";\nexport type { RpcCommand, RpcEvent, RpcResponse, RpcSessionState } from \"./rpc/rpc-types.ts\";\n"]}
|
package/dist/modes/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/modes/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAA+B,MAAM,mCAAmC,CAAC;AACjG,OAAO,EAAyB,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACtE,OAAO,EAAkB,SAAS,EAAgD,MAAM,qBAAqB,CAAC;AAC9G,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC","sourcesContent":["/**\n * Run modes for the coding agent.\n */\n\nexport { InteractiveMode, type InteractiveModeOptions } from \"./interactive/interactive-mode.ts\";\nexport { type PrintModeOptions, runPrintMode } from \"./print-mode.ts\";\nexport { type ModelInfo, RpcClient, type RpcClientOptions, type RpcEventListener } from \"./rpc/rpc-client.ts\";\nexport { runRpcMode } from \"./rpc/rpc-mode.ts\";\nexport type { RpcCommand, RpcResponse, RpcSessionState } from \"./rpc/rpc-types.ts\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/modes/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAA+B,MAAM,mCAAmC,CAAC;AACjG,OAAO,EAAyB,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACtE,OAAO,EAAkB,SAAS,EAAgD,MAAM,qBAAqB,CAAC;AAC9G,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC","sourcesContent":["/**\n * Run modes for the coding agent.\n */\n\nexport { InteractiveMode, type InteractiveModeOptions } from \"./interactive/interactive-mode.ts\";\nexport { type PrintModeOptions, runPrintMode } from \"./print-mode.ts\";\nexport { type ModelInfo, RpcClient, type RpcClientOptions, type RpcEventListener } from \"./rpc/rpc-client.ts\";\nexport { runRpcMode } from \"./rpc/rpc-mode.ts\";\nexport type { RpcCommand, RpcEvent, RpcResponse, RpcSessionState } from \"./rpc/rpc-types.ts\";\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-session-host.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/chat-session-host.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAA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/B;IAEK,MAAM,CAAC,IAAI,GAAE,MAAM,GAAG,UAAmB,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA4EtF;IAED,WAAW,IAAI,OAAO,CAErB;IAED,aAAa,IAAI,OAAO,CAEvB;IAED,oBAAoB,IAAI,OAAO,CAE9B;IAED,YAAY,IAAI,OAAO,CAEtB;IAED,gBAAgB,IAAI,OAAO,CAE1B;IAED,oBAAoB,IAAI,MAAM,CAE7B;IAED,aAAa,IAAI,MAAM,CAEtB;IAED,SAAS,IAAI,MAAM,CAElB;IAED,UAAU,IAAI,MAAM,CAEnB;IAED,cAAc,IAAI,IAAI,CAErB;IAED,iBAAiB,IAAI,IAAI,CAcxB;IAED,OAAO,IAAI,IAAI,CAUd;IAED,OAAO,CAAC,YAAY;IA2EpB,OAAO,CAAC,qBAAqB;IAc7B,OAAO,CAAC,YAAY;IAkBpB,OAAO,CAAC,kBAAkB;IAW1B,OAAO,CAAC,OAAO;IAIf,OAAO,CAAC,aAAa;IAMrB,OAAO,CAAC,WAAW;IAanB,OAAO,CAAC,sBAAsB;IAa9B,OAAO,CAAC,wBAAwB;IAWhC,OAAO,CAAC,OAAO;IAIf,OAAO,CAAC,0BAA0B;IAelC,OAAO,CAAC,kBAAkB;IAa1B,OAAO,CAAC,oBAAoB;IAqC5B,OAAO,CAAC,iBAAiB;IASzB,OAAO,CAAC,kBAAkB;YAaZ,eAAe;YAcf,SAAS;YAYT,cAAc;YAyDd,oBAAoB;YAwBpB,UAAU;YASV,aAAa;IAS3B,6BAA6B,IAAI,OAAO,CAqBvC;IAED,OAAO,CAAC,aAAa;IAMrB,OAAO,CAAC,YAAY;IAMpB,OAAO,CAAC,eAAe;IA2BvB,OAAO,CAAC,UAAU;IAMlB,OAAO,CAAC,kBAAkB;CAY3B","sourcesContent":["import type { AgentSessionEvent } from \"../../../core/agent-session.ts\";\nimport type { AgentSession } from \"../../../core/agent-session.ts\";\nimport type { BashResult } from \"../../../core/bash-executor.ts\";\nimport type { ReadonlyFooterDataProvider } from \"../../../core/footer-data-provider.ts\";\nimport type { BashExecutionMessage } from \"../../../core/messages.ts\";\nimport {\n type Component,\n type EditorComponent,\n type EditorTheme,\n type Focusable,\n type MarkdownTheme,\n type TUI,\n Spacer,\n Text,\n matchesKey as tuiMatchesKey,\n truncateToWidth,\n visibleWidth,\n} from \"@earendil-works/pi-tui\";\nimport { SessionManager } from \"../../../core/session-manager.ts\";\nimport { CustomEditor } from \"./custom-editor.ts\";\nimport {\n LiveChatEntriesController,\n renderChatMessageEntry,\n type ChatMessageEntry,\n type ChatMessageRenderOptions,\n} from \"./chat-message-renderer.ts\";\nimport {\n ChatTranscriptComponent,\n ScrollableComponentViewport,\n type ChatTranscriptEntryLike,\n} from \"./chat-transcript.ts\";\nimport { UsageMeterComponent, FooterComponent } from \"./footer.ts\";\nimport { WorkingStatusComponent } from \"./working-status.ts\";\nimport {\n combineQueuedMessagesForEditor,\n openExternalEditorForText,\n pasteClipboardImageToEditor,\n} from \"../chat-input-actions.ts\";\nimport { pickWhimsicalWorkingMessage } from \"../whimsical-messages.ts\";\n\nconst SPINNER_FRAMES = [\"⠋\", \"⠙\", \"⠹\", \"⠸\", \"⠼\", \"⠴\", \"⠦\", \"⠧\", \"⠇\", \"⠏\"];\nconst ANIMATION_FRAME_MS = 80;\nconst STREAMING_RENDER_THROTTLE_MS = 80;\nconst STREAMING_TEXT_TAIL_LINES = 240;\nconst STREAMING_TEXT_TAIL_CHARS = 16_000;\n\nexport interface ChatSessionHostStyle {\n dim(text: string): string;\n text(text: string): string;\n textMuted(text: string): string;\n accent(text: string): string;\n accentBold(text: string): string;\n rule(hex: string, text: string): string;\n cursor(): string;\n blank(width: number): string;\n editorRuleColor(\n disabled: boolean,\n agentSession: AgentSession | undefined,\n state?: { isBashMode: boolean },\n ): string;\n}\n\nexport interface ChatSessionHostBashRequest {\n command: string;\n excludeFromContext: boolean;\n onChunk: (chunk: string) => void;\n}\n\nexport interface ChatSessionHostCommands {\n ensureAttached?: () => Promise<void>;\n prompt?: (text: string) => Promise<void>;\n steer?: (text: string) => Promise<void>;\n followUp?: (text: string) => Promise<void>;\n interrupt?: () => Promise<void>;\n resume?: (message?: string) => Promise<void>;\n runBash?: (request: ChatSessionHostBashRequest) => Promise<BashResult>;\n abortBash?: () => void | Promise<void>;\n abortCompaction?: () => void | Promise<void>;\n handleSlashCommand?: (text: string) => Promise<boolean> | boolean;\n}\n\nexport interface ChatSessionHostOpts<TExtraEntry extends ChatTranscriptEntryLike = never> {\n style: ChatSessionHostStyle;\n commands?: ChatSessionHostCommands;\n requestRender?: () => void;\n getAgentSession?: () => AgentSession | undefined;\n isStreaming?: () => boolean;\n isPaused?: () => boolean;\n isDisabled?: () => boolean;\n isBashRunning?: () => boolean;\n showWarning?: (message: string) => void;\n showStatus?: (message: string) => void;\n actions?: Record<string, () => void | Promise<void>>;\n getActionKeyDisplay?: (action: string) => string;\n getMarkdownTheme?: () => MarkdownTheme;\n tui?: TUI;\n keybindings?: unknown;\n editorFactory?: (\n tui: TUI,\n theme: EditorTheme,\n keybindings: unknown,\n ) => EditorComponent;\n editorTheme: EditorTheme;\n getChatRenderSettings?: () =>\n | Partial<Omit<ChatMessageRenderOptions, \"ui\" | \"cwd\">>\n | undefined;\n getCwd?: () => string;\n footerData?: ReadonlyFooterDataProvider;\n renderExtraEntry?: (entry: TExtraEntry) => Component;\n}\n\nexport type ChatSessionHostEntry<TExtraEntry extends ChatTranscriptEntryLike = never> =\n | ChatMessageEntry\n | TExtraEntry;\ntype AgentSnapshotMessage = AgentSession[\"messages\"][number];\ntype CacheKeyPart = string | number | boolean | null;\n\nexport class ChatSessionHost<TExtraEntry extends ChatTranscriptEntryLike = never>\n implements Component, Focusable\n{\n focused = true;\n\n private readonly style: ChatSessionHostStyle;\n private readonly commands: ChatSessionHostCommands;\n private readonly requestRender: (() => void) | undefined;\n private readonly getAgentSession: (() => AgentSession | undefined) | undefined;\n private readonly isStreamingOverride: (() => boolean) | undefined;\n private readonly isPaused: (() => boolean) | undefined;\n private readonly isDisabled: (() => boolean) | undefined;\n private readonly isBashRunningOverride: (() => boolean) | undefined;\n private readonly showWarning: ((message: string) => void) | undefined;\n private readonly showStatus: ((message: string) => void) | undefined;\n private readonly actions: Record<string, () => void | Promise<void>> | undefined;\n private readonly getActionKeyDisplay: ((action: string) => string) | undefined;\n private readonly getMarkdownTheme: (() => MarkdownTheme) | undefined;\n private readonly getChatRenderSettings: ChatSessionHostOpts<TExtraEntry>[\"getChatRenderSettings\"];\n private readonly getCwd: (() => string) | undefined;\n private readonly footerData: ReadonlyFooterDataProvider | undefined;\n private readonly renderExtraEntry: ((entry: TExtraEntry) => Component) | undefined;\n private readonly tui: TUI | undefined;\n\n private inputBuffer = \"\";\n private transcript: ChatSessionHostEntry<TExtraEntry>[] = [];\n private statusMessage = \"\";\n private isBashMode = false;\n private localBashRunning = false;\n private sdkBusy = false;\n private workingMessage: string | undefined;\n private pendingSteeringMessages: readonly string[] = [];\n private pendingFollowUpMessages: readonly string[] = [];\n private compactionQueuedMessages: readonly string[] = [];\n private compacting = false;\n private animationTimer: ReturnType<typeof setInterval> | undefined;\n private renderThrottleTimer: ReturnType<typeof setTimeout> | undefined;\n private bodyViewport = new ScrollableComponentViewport();\n private transcriptComponent: ChatTranscriptComponent<ChatSessionHostEntry<TExtraEntry>>;\n private transcriptRenderSettingsKey = \"\";\n private renderIdentityIds = new WeakMap<object, number>();\n private nextRenderIdentityId = 1;\n private liveChat: LiveChatEntriesController;\n private editor: EditorComponent | undefined;\n private optimisticUserSignatureCounts = new Map<string, number>();\n\n constructor(opts: ChatSessionHostOpts<TExtraEntry>) {\n this.style = opts.style;\n this.commands = opts.commands ?? {};\n this.requestRender = opts.requestRender;\n this.getAgentSession = opts.getAgentSession;\n this.isStreamingOverride = opts.isStreaming;\n this.isPaused = opts.isPaused;\n this.isDisabled = opts.isDisabled;\n this.isBashRunningOverride = opts.isBashRunning;\n this.showWarning = opts.showWarning;\n this.showStatus = opts.showStatus;\n this.actions = opts.actions;\n this.getActionKeyDisplay = opts.getActionKeyDisplay;\n this.getMarkdownTheme = opts.getMarkdownTheme;\n this.getChatRenderSettings = opts.getChatRenderSettings;\n this.getCwd = opts.getCwd;\n this.footerData = opts.footerData;\n this.renderExtraEntry = opts.renderExtraEntry;\n this.tui = opts.tui;\n this.liveChat = new LiveChatEntriesController(this.transcript);\n this.transcriptComponent = new ChatTranscriptComponent(\n this.transcript,\n (entry) => this.renderEntry(entry),\n (entry, index) => this.transcriptCacheKey(entry, index),\n );\n this.editor = this.createEditor(\n opts.tui,\n opts.keybindings,\n opts.editorTheme,\n opts.editorFactory,\n );\n this.syncAnimationTick();\n }\n\n appendMessages(messages: readonly AgentSnapshotMessage[]): void {\n this.liveChat.appendMessages(messages);\n }\n\n loadSessionFile(sessionFile: string | undefined): void {\n if (this.transcript.length > 0 || sessionFile === undefined) return;\n let messages: readonly AgentSnapshotMessage[];\n try {\n messages = SessionManager.open(sessionFile).buildSessionContext()\n .messages as readonly AgentSnapshotMessage[];\n } catch {\n return;\n }\n this.liveChat.appendMessages(messages);\n }\n\n appendExtraEntry(entry: TExtraEntry): void {\n this.transcript.push(entry);\n }\n\n entries(): readonly ChatSessionHostEntry<TExtraEntry>[] {\n return this.transcript;\n }\n\n private incrementOptimisticUserSignature(signature: string): void {\n this.optimisticUserSignatureCounts.set(\n signature,\n (this.optimisticUserSignatureCounts.get(signature) ?? 0) + 1,\n );\n }\n\n private decrementOptimisticUserSignature(signature: string): void {\n const count = this.optimisticUserSignatureCounts.get(signature) ?? 0;\n if (count <= 1) this.optimisticUserSignatureCounts.delete(signature);\n else this.optimisticUserSignatureCounts.set(signature, count - 1);\n }\n\n applyAgentEvent(event: AgentSessionEvent): boolean {\n const type = String((event as { type?: unknown }).type ?? \"\");\n if (type === \"message_start\") {\n const message = (event as { message?: unknown }).message;\n if (isUserMessageLike(message)) {\n const signature = userMessageSignature(\n extractMessageText(message.content),\n );\n const count = this.optimisticUserSignatureCounts.get(signature) ?? 0;\n if (count > 0) {\n this.decrementOptimisticUserSignature(signature);\n return false;\n }\n }\n }\n if (isSharedLiveChatEvent(type)) {\n const changed = this.liveChat.applyEvent(event);\n const toolCallEvent = assistantToolCallEvent(event);\n const changedByToolCall = toolCallEvent !== undefined\n ? this.liveChat.applyEvent(toolCallEvent)\n : false;\n this.afterEvent(changed || changedByToolCall);\n return changed || changedByToolCall;\n }\n let changed = false;\n switch (type) {\n case \"agent_start\":\n this.sdkBusy = true;\n this.liveChat.clearPendingTools();\n this.statusMessage = \"\";\n changed = true;\n break;\n case \"agent_end\":\n this.sdkBusy = false;\n this.workingMessage = undefined;\n this.liveChat.clearPendingTools();\n this.statusMessage = \"\";\n changed = true;\n break;\n case \"turn_start\":\n this.workingMessage = pickWhimsicalWorkingMessage();\n changed = true;\n break;\n case \"turn_end\":\n this.workingMessage = undefined;\n changed = true;\n break;\n case \"queue_update\": {\n const queue = event as { steering?: unknown; followUp?: unknown };\n this.pendingSteeringMessages = Array.isArray(queue.steering)\n ? queue.steering.filter((item): item is string => typeof item === \"string\")\n : [];\n this.pendingFollowUpMessages = Array.isArray(queue.followUp)\n ? queue.followUp.filter((item): item is string => typeof item === \"string\")\n : [];\n changed = true;\n break;\n }\n case \"tool_call\":\n case \"tool_use\":\n changed = this.liveChat.applyEvent(legacyToolStartEvent(event));\n break;\n case \"tool_result\":\n changed = this.liveChat.applyEvent(legacyToolResultEvent(event));\n break;\n case \"thinking_delta\":\n case \"thinking\":\n changed = this.liveChat.applyEvent(legacyThinkingEvent(event));\n break;\n case \"compaction_start\":\n this.compacting = true;\n this.sdkBusy = true;\n this.statusMessage = \"compacting context…\";\n changed = true;\n break;\n case \"compaction_end\": {\n const compaction = event as Extract<AgentSessionEvent, { type: \"compaction_end\" }>;\n this.compacting = false;\n this.sdkBusy = false;\n this.statusMessage = compaction.errorMessage ?? \"\";\n if (!compaction.aborted && !compaction.errorMessage && this.compactionQueuedMessages.length > 0) {\n void this.flushCompactionQueue();\n }\n changed = true;\n break;\n }\n case \"auto_retry_start\":\n this.sdkBusy = true;\n this.statusMessage = \"retrying…\";\n changed = true;\n break;\n case \"auto_retry_end\": {\n const retry = event as Extract<AgentSessionEvent, { type: \"auto_retry_end\" }>;\n this.statusMessage = \"\";\n if (!retry.success) {\n this.sdkBusy = false;\n this.workingMessage = undefined;\n }\n changed = true;\n break;\n }\n default:\n changed = false;\n }\n this.afterEvent(changed);\n return changed;\n }\n\n render(width: number): string[] {\n return this.renderBody(width, 1);\n }\n\n invalidate(): void {\n this.transcriptComponent.invalidate();\n this.bodyViewport.invalidate();\n this.editor?.invalidate();\n }\n\n renderBody(width: number, budget: number): string[] {\n const components: Component[] = [];\n this.transcriptRenderSettingsKey = this.chatRenderSettingsCacheKey();\n if (this.transcript.length > 0) {\n components.push(this.transcriptComponent);\n }\n if (this.statusMessage) {\n components.push(new Spacer(1));\n components.push(new Text(this.style.dim(this.statusMessage), 2, 0));\n }\n this.bodyViewport.setVisibleRows(budget);\n this.bodyViewport.setComponents(components);\n return this.bodyViewport.render(width);\n }\n\n renderPendingMessages(width: number): string[] {\n if (\n this.pendingSteeringMessages.length === 0 &&\n this.pendingFollowUpMessages.length === 0 &&\n this.compactionQueuedMessages.length === 0\n ) {\n return [];\n }\n const lines = [this.style.blank(width)];\n for (const message of this.pendingSteeringMessages) {\n lines.push(...this.pendingMessageLine(width, \"Steering\", message));\n }\n for (const message of this.pendingFollowUpMessages) {\n lines.push(...this.pendingMessageLine(width, \"Follow-up\", message));\n }\n for (const message of this.compactionQueuedMessages) {\n lines.push(...this.pendingMessageLine(width, \"Queued\", message));\n }\n const hint = this.getActionKeyDisplay?.(\"app.message.dequeue\") ?? \"alt+up\";\n lines.push(...new Text(this.style.dim(`↳ ${hint} to edit all queued messages`), 1, 0).render(width));\n return lines;\n }\n\n renderWorkingStatus(width: number): string[] {\n if (!this.isStreaming()) return [];\n const message = this.workingMessage ?? \"Working...\";\n return new WorkingStatusComponent({\n spinner: spinnerFrame(),\n message,\n spinnerColor: (text) => this.style.accentBold(text),\n messageColor: (text) => this.style.textMuted(text),\n }).render(width);\n }\n\n renderUsage(width: number): string[] {\n const agentSession = this.getAgentSession?.();\n if (!agentSession) return [];\n return new UsageMeterComponent(agentSession).render(width);\n }\n\n renderEditor(width: number): string[] {\n const disabled = this.isDisabled?.() === true;\n const agentSession = this.getAgentSession?.();\n const ruleHex = this.style.editorRuleColor(disabled, agentSession, {\n isBashMode: this.isBashMode,\n });\n if (!disabled && this.editor) {\n setEditorFocused(this.editor, this.focused);\n setEditorPlaceholder(this.editor, undefined);\n setEditorBorderColor(this.editor, (text) => this.style.rule(ruleHex, text));\n return this.editor.render(width);\n }\n if (this.editor) setEditorFocused(this.editor, false);\n const rule = this.style.rule(ruleHex, \"─\".repeat(width));\n const available = Math.max(1, width - 3);\n const value = this.inputBuffer\n ? this.style.text(truncateToWidth(this.inputBuffer, available)) + this.style.cursor()\n : disabled\n ? \"\"\n : this.style.cursor();\n const left = this.style.accentBold(\"❯\") + \" \" + value;\n const gap = Math.max(0, width - visibleWidth(stripAnsi(left)));\n const body = left + \" \".repeat(gap);\n return [rule, body, rule];\n }\n\n renderFooter(width: number): string[] {\n const agentSession = this.getAgentSession?.();\n if (agentSession && this.footerData) {\n return new FooterComponent(agentSession, this.footerData).render(width);\n }\n return [];\n }\n\n handleScrollInput(data: string): boolean {\n return this.bodyViewport.handleInput(data);\n }\n\n handleInput(data: string): boolean {\n if (this.handleScrollInput(data)) return true;\n if (matchesKey(data, \"alt+up\")) {\n this.restoreQueuedMessagesToEditor();\n return true;\n }\n if (matchesKey(data, \"ctrl+f\")) {\n void this.submit(\"followUp\");\n return true;\n }\n if (matchesKey(data, \"escape\")) {\n if (this.compacting) {\n void this.abortCompaction();\n return true;\n }\n if (this.isStreaming()) {\n void this.interrupt();\n return true;\n }\n if (this.isBashRunning()) {\n void this.abortBash();\n return true;\n }\n if (this.isBashMode) {\n this.setEditorText(\"\");\n this.notifyStatus(\"Bash mode cleared\");\n return true;\n }\n }\n if (this.editor) {\n this.editor.handleInput(data);\n return true;\n }\n if (matchesKey(data, \"enter\")) {\n void this.submit(\"auto\");\n return true;\n }\n if (matchesKey(data, \"backspace\")) {\n this.setEditorText(this.inputBuffer.slice(0, -1));\n return true;\n }\n if (data.length === 1 && data >= \" \" && data <= \"~\") {\n this.setEditorText(`${this.inputBuffer}${data}`);\n return true;\n }\n return false;\n }\n\n async interrupt(): Promise<void> {\n try {\n this.restoreQueuedMessagesToEditor();\n this.sdkBusy = false;\n this.workingMessage = undefined;\n await this.commands.interrupt?.();\n } catch (err) {\n this.statusMessage = errorMessage(err);\n } finally {\n this.syncAnimationTick();\n this.requestRender?.();\n }\n }\n\n async submit(mode: \"auto\" | \"followUp\" = \"auto\", submittedText?: string): Promise<void> {\n const text = (submittedText ?? this.inputBuffer).trim();\n if (!text) return;\n if (text.startsWith(\"/\") && this.commands.handleSlashCommand) {\n const handled = await this.commands.handleSlashCommand(text);\n if (handled) {\n this.setEditorText(\"\");\n this.requestRender?.();\n return;\n }\n }\n if (this.compacting) {\n this.setEditorText(\"\");\n this.compactionQueuedMessages = [...this.compactionQueuedMessages, text];\n this.notifyStatus(\"Queued message until compaction completes\");\n return;\n }\n const bash = parseBashInput(text);\n if (bash?.command) {\n if (this.isBashRunning()) {\n this.notifyWarning(\"A bash command is already running. esc cancel first.\");\n this.setEditorText(text);\n return;\n }\n this.setEditorText(\"\");\n await this.runBashCommand(bash.command, bash.excludeFromContext);\n return;\n }\n this.setEditorText(\"\");\n const isPaused = this.isPaused?.() === true;\n const isStreaming = this.isStreaming();\n const shouldAppendOptimisticUser = mode === \"auto\" && !isStreaming;\n const optimisticSignature = shouldAppendOptimisticUser\n ? userMessageSignature(text)\n : undefined;\n if (optimisticSignature !== undefined) {\n this.liveChat.appendUserText(text);\n this.bodyViewport.scrollToBottom();\n this.incrementOptimisticUserSignature(optimisticSignature);\n }\n this.requestRender?.();\n try {\n if (isPaused) {\n this.sdkBusy = true;\n this.statusMessage = \"resuming…\";\n this.syncAnimationTick();\n this.requestRender?.();\n await this.requiredCommand(\"resume\")(text);\n this.sdkBusy = false;\n this.statusMessage = \"\";\n this.syncAnimationTick();\n return;\n }\n if (mode === \"followUp\" && isStreaming) {\n await this.queueFollowUp(text);\n return;\n }\n if (isStreaming) {\n await this.queueSteer(text);\n } else {\n this.sdkBusy = true;\n this.syncAnimationTick();\n await this.commands.ensureAttached?.();\n await this.requiredCommand(\"prompt\")(text);\n this.sdkBusy = false;\n this.syncAnimationTick();\n }\n } catch (err) {\n if (optimisticSignature !== undefined) {\n this.decrementOptimisticUserSignature(optimisticSignature);\n }\n this.sdkBusy = false;\n this.statusMessage = errorMessage(err);\n this.syncAnimationTick();\n this.requestRender?.();\n }\n }\n\n isStreaming(): boolean {\n return this.sdkBusy || this.isStreamingOverride?.() === true;\n }\n\n isBashRunning(): boolean {\n return this.localBashRunning || this.isBashRunningOverride?.() === true;\n }\n\n isEditingBashCommand(): boolean {\n return this.isBashMode;\n }\n\n hasInputText(): boolean {\n return this.inputBuffer.length > 0;\n }\n\n hasAnimationTick(): boolean {\n return this.animationTimer !== undefined;\n }\n\n bodyScrollFromBottom(): number {\n return this.bodyViewport.getScrollFromBottom();\n }\n\n bodyMaxScroll(): number {\n return this.bodyViewport.getMaxScroll();\n }\n\n inputText(): string {\n return this.inputBuffer;\n }\n\n statusText(): string {\n return this.statusMessage;\n }\n\n scrollToBottom(): void {\n this.bodyViewport.scrollToBottom();\n }\n\n syncAnimationTick(): void {\n const shouldAnimate =\n this.isStreaming() || (this.sdkBusy && this.liveChat.pendingToolIds().length > 0);\n if (shouldAnimate && !this.animationTimer) {\n this.animationTimer = setInterval(() => {\n this.requestRender?.();\n }, ANIMATION_FRAME_MS);\n this.animationTimer.unref?.();\n return;\n }\n if (!shouldAnimate && this.animationTimer) {\n clearInterval(this.animationTimer);\n this.animationTimer = undefined;\n }\n }\n\n dispose(): void {\n if (this.animationTimer) {\n clearInterval(this.animationTimer);\n this.animationTimer = undefined;\n }\n if (this.renderThrottleTimer) {\n clearTimeout(this.renderThrottleTimer);\n this.renderThrottleTimer = undefined;\n }\n this.editor = undefined;\n }\n\n private createEditor(\n tui: TUI | undefined,\n keybindings: unknown,\n editorTheme: EditorTheme,\n editorFactory: ChatSessionHostOpts<TExtraEntry>[\"editorFactory\"],\n ): EditorComponent | undefined {\n if (!tui || !keybindings) return undefined;\n const editor = this.createInheritedEditor(tui, editorTheme, keybindings, editorFactory) ??\n new CustomEditor(\n tui,\n editorTheme,\n keybindings as ConstructorParameters<typeof CustomEditor>[2],\n { paddingX: 0, autocompleteMaxVisible: 5 },\n );\n editor.onChange = (text) => {\n this.inputBuffer = text;\n this.isBashMode = text.trimStart().startsWith(\"!\");\n };\n editor.onSubmit = (text) => {\n void this.submit(\"auto\", text);\n };\n const actionEditor = editor as EditorComponent & {\n onAction?: (action: string, handler: () => void) => void;\n onEscape?: () => void;\n onPasteImage?: () => void;\n };\n actionEditor.onAction?.(\"app.message.followUp\", () => {\n void this.submit(\"followUp\");\n });\n actionEditor.onAction?.(\"app.message.dequeue\", () => {\n this.restoreQueuedMessagesToEditor();\n });\n actionEditor.onAction?.(\"app.editor.external\", () => {\n this.openExternalEditor();\n });\n if (this.actions) {\n for (const [action, handler] of Object.entries(this.actions)) {\n actionEditor.onAction?.(action, () => {\n void handler();\n });\n }\n }\n const previousPasteImage = actionEditor.onPasteImage;\n actionEditor.onPasteImage = () => {\n previousPasteImage?.();\n void pasteClipboardImageToEditor(\n this.editorAccess(),\n () => this.requestRender?.(),\n { showWarning: (message) => this.notifyWarning(message) },\n );\n };\n const previousEscape = actionEditor.onEscape;\n actionEditor.onEscape = () => {\n if (this.compacting) {\n void this.abortCompaction();\n return;\n }\n if (this.isStreaming()) {\n void this.interrupt();\n return;\n }\n if (this.isBashRunning()) {\n void this.abortBash();\n return;\n }\n if (this.isBashMode) {\n this.setEditorText(\"\");\n this.notifyStatus(\"Bash mode cleared\");\n return;\n }\n previousEscape?.();\n };\n return editor;\n }\n\n private createInheritedEditor(\n tui: TUI,\n editorTheme: EditorTheme,\n keybindings: unknown,\n editorFactory: ChatSessionHostOpts<TExtraEntry>[\"editorFactory\"],\n ): EditorComponent | undefined {\n if (!editorFactory) return undefined;\n try {\n return editorFactory(tui, editorTheme, keybindings);\n } catch {\n return undefined;\n }\n }\n\n private editorAccess(): {\n insertTextAtCursor: (text: string) => void;\n getText: () => string;\n setText: (text: string) => void;\n } {\n return {\n insertTextAtCursor: (text: string) => {\n if (this.editor?.insertTextAtCursor) {\n this.editor.insertTextAtCursor(text);\n return;\n }\n this.setEditorText(`${this.inputBuffer}${text}`);\n },\n getText: () => this.inputBuffer,\n setText: (text: string) => this.setEditorText(text),\n };\n }\n\n private openExternalEditor(): void {\n if (!this.editor) return;\n const host = this.tuiHost();\n if (!host) return;\n const currentText = this.editor.getExpandedText?.() ?? this.editor.getText();\n const updated = openExternalEditorForText(currentText, host, {\n showWarning: (message) => this.notifyWarning(message),\n });\n if (updated !== undefined) this.setEditorText(updated);\n }\n\n private tuiHost(): Pick<TUI, \"stop\" | \"start\" | \"requestRender\"> | undefined {\n return this.tui;\n }\n\n private setEditorText(text: string): void {\n this.inputBuffer = text;\n this.isBashMode = text.trimStart().startsWith(\"!\");\n this.editor?.setText(text);\n }\n\n private renderEntry(entry: ChatSessionHostEntry<TExtraEntry>): Component {\n if (isChatMessageEntry(entry)) {\n return renderChatMessageEntry(\n this.streamingWindowedEntry(entry),\n this.chatMessageRenderOptions(),\n );\n }\n if (!this.renderExtraEntry) {\n return new Text(\"\", 0, 0);\n }\n return this.renderExtraEntry(entry);\n }\n\n private streamingWindowedEntry(entry: ChatMessageEntry): ChatMessageEntry {\n if (!this.isStreaming() || this.bodyViewport.getScrollFromBottom() !== 0) {\n return entry;\n }\n if (entry.kind !== \"assistant\") return entry;\n const content = entry.message.content.map((item) => {\n if (item.type === \"text\") return { ...item, text: tailStreamingText(item.text) };\n if (item.type === \"thinking\") return { ...item, thinking: tailStreamingText(item.thinking) };\n return item;\n });\n return { ...entry, message: { ...entry.message, content } };\n }\n\n private chatMessageRenderOptions(): ChatMessageRenderOptions {\n const inherited = this.getChatRenderSettings?.();\n return {\n ...inherited,\n ui: this.toolTui(),\n cwd: this.getCwd?.() ?? this.getAgentSession?.()?.sessionManager.getCwd() ?? process.cwd(),\n markdownTheme: inherited?.markdownTheme ?? this.getMarkdownTheme?.(),\n showImages: inherited?.showImages ?? true,\n };\n }\n\n private toolTui(): Pick<TUI, \"requestRender\"> {\n return { requestRender: () => this.requestRender?.() };\n }\n\n private chatRenderSettingsCacheKey(): string {\n const inherited = this.getChatRenderSettings?.();\n return cacheKey([\n \"settings\",\n inherited?.hideThinkingBlock === true,\n inherited?.hiddenThinkingLabel ?? \"\",\n inherited?.toolOutputExpanded === true,\n inherited?.showImages !== false,\n inherited?.imageWidthCells ?? null,\n this.getCwd?.() ?? this.getAgentSession?.()?.sessionManager.getCwd() ?? process.cwd(),\n this.bodyViewport.getScrollFromBottom() === 0,\n this.isStreaming(),\n ]);\n }\n\n private transcriptCacheKey(\n entry: ChatSessionHostEntry<TExtraEntry>,\n index: number,\n ): string {\n return cacheKey([\n this.transcriptRenderSettingsKey,\n index,\n entry.role,\n this.renderIdentityKey(entry),\n this.entryContentCacheKey(entry),\n ]);\n }\n\n private entryContentCacheKey(entry: ChatSessionHostEntry<TExtraEntry>): string {\n if (!isChatMessageEntry(entry)) return cacheKey([\"extra\"]);\n switch (entry.kind) {\n case \"assistant\":\n return cacheKey([\"assistant\", this.renderIdentityKey(entry.message)]);\n case \"tool\":\n return cacheKey([\n \"tool\",\n entry.toolCallId,\n entry.toolName,\n entry.isPartial === true,\n entry.result === undefined ? null : this.renderIdentityKey(entry.result),\n ]);\n case \"bashExecution\":\n return cacheKey([\n \"bashExecution\",\n entry.isPartial === true,\n entry.message.command,\n entry.message.output,\n entry.message.exitCode ?? null,\n entry.message.cancelled,\n entry.message.truncated,\n entry.message.fullOutputPath ?? null,\n ]);\n case \"user\":\n return cacheKey([\"user\", entry.text]);\n case \"custom\":\n return cacheKey([\"custom\", this.renderIdentityKey(entry.message)]);\n case \"branchSummary\":\n return cacheKey([\"branchSummary\", this.renderIdentityKey(entry.message)]);\n case \"compactionSummary\":\n return cacheKey([\"compactionSummary\", this.renderIdentityKey(entry.message)]);\n case \"system\":\n return cacheKey([\"system\", entry.text]);\n }\n }\n\n private renderIdentityKey(value: object): string {\n const existing = this.renderIdentityIds.get(value);\n if (existing !== undefined) return String(existing);\n const id = this.nextRenderIdentityId;\n this.nextRenderIdentityId += 1;\n this.renderIdentityIds.set(value, id);\n return String(id);\n }\n\n private pendingMessageLine(\n width: number,\n label: \"Steering\" | \"Follow-up\" | \"Queued\",\n message: string,\n ): string[] {\n const text = `${label}: ${message}`;\n return new Text(\n this.style.dim(truncateToWidth(text, Math.max(1, width - 2))),\n 1,\n 0,\n ).render(width);\n }\n\n private async abortCompaction(): Promise<void> {\n try {\n await this.commands.abortCompaction?.();\n this.compacting = false;\n this.sdkBusy = false;\n this.notifyStatus(\"Compaction cancelled\");\n } catch (err) {\n this.notifyWarning(errorMessage(err));\n } finally {\n this.syncAnimationTick();\n this.requestRender?.();\n }\n }\n\n private async abortBash(): Promise<void> {\n try {\n await this.commands.abortBash?.();\n this.localBashRunning = false;\n this.notifyStatus(\"Bash command cancelled\");\n } catch (err) {\n this.notifyWarning(errorMessage(err));\n } finally {\n this.requestRender?.();\n }\n }\n\n private async runBashCommand(\n command: string,\n excludeFromContext: boolean,\n ): Promise<void> {\n const runBash = this.commands.runBash;\n if (!runBash) {\n this.notifyWarning(\"no bash command configured for this chat session\");\n return;\n }\n const bashMessage: BashExecutionMessage = {\n role: \"bashExecution\",\n command,\n output: \"\",\n exitCode: undefined,\n cancelled: false,\n truncated: false,\n timestamp: Date.now(),\n ...(excludeFromContext ? { excludeFromContext: true } : {}),\n };\n const bashEntry: ChatMessageEntry = {\n role: \"tool\",\n kind: \"bashExecution\",\n message: bashMessage,\n isPartial: true,\n };\n this.transcript.push(bashEntry);\n this.localBashRunning = true;\n this.bodyViewport.scrollToBottom();\n this.requestRender?.();\n try {\n const result = await runBash({\n command,\n excludeFromContext,\n onChunk: (chunk) => {\n bashMessage.output += chunk;\n this.requestRender?.();\n },\n });\n bashMessage.output = result.output;\n bashMessage.exitCode = result.exitCode;\n bashMessage.cancelled = result.cancelled;\n bashMessage.truncated = result.truncated;\n if (result.fullOutputPath !== undefined) {\n bashMessage.fullOutputPath = result.fullOutputPath;\n }\n } catch (err) {\n bashMessage.output = errorMessage(err);\n bashMessage.exitCode = undefined;\n bashMessage.cancelled = false;\n bashMessage.truncated = false;\n } finally {\n bashEntry.isPartial = false;\n this.localBashRunning = false;\n this.requestRender?.();\n }\n }\n\n private async flushCompactionQueue(): Promise<void> {\n const queued = [...this.compactionQueuedMessages];\n this.compactionQueuedMessages = [];\n if (queued.length === 0) return;\n let nextIndex = 0;\n try {\n const first = queued[0];\n if (first !== undefined) {\n await this.requiredCommand(\"prompt\")(first);\n nextIndex = 1;\n }\n for (; nextIndex < queued.length; nextIndex++) {\n await this.queueFollowUp(queued[nextIndex]!);\n }\n } catch (err) {\n this.compactionQueuedMessages = [\n ...queued.slice(nextIndex),\n ...this.compactionQueuedMessages,\n ];\n this.notifyWarning(errorMessage(err));\n this.requestRender?.();\n }\n }\n\n private async queueSteer(text: string): Promise<void> {\n const agentSession = this.getAgentSession?.();\n if (agentSession?.isStreaming) {\n await agentSession.prompt(text, { streamingBehavior: \"steer\" });\n return;\n }\n await this.requiredCommand(\"steer\")(text);\n }\n\n private async queueFollowUp(text: string): Promise<void> {\n const agentSession = this.getAgentSession?.();\n if (agentSession?.isStreaming) {\n await agentSession.prompt(text, { streamingBehavior: \"followUp\" });\n return;\n }\n await this.requiredCommand(\"followUp\")(text);\n }\n\n restoreQueuedMessagesToEditor(): boolean {\n const queuedMessages = [\n ...this.pendingSteeringMessages,\n ...this.pendingFollowUpMessages,\n ...this.compactionQueuedMessages,\n ];\n if (queuedMessages.length === 0) {\n this.notifyStatus(\"No queued messages to restore\");\n return false;\n }\n const restoredText = combineQueuedMessagesForEditor(queuedMessages, this.inputBuffer);\n this.pendingSteeringMessages = [];\n this.pendingFollowUpMessages = [];\n this.compactionQueuedMessages = [];\n this.setEditorText(restoredText);\n this.getAgentSession?.()?.clearQueue();\n this.notifyStatus(\n `Restored ${queuedMessages.length} queued message${queuedMessages.length === 1 ? \"\" : \"s\"} to editor`,\n );\n this.requestRender?.();\n return true;\n }\n\n private notifyWarning(message: string): void {\n this.statusMessage = message;\n this.showWarning?.(message);\n this.requestRender?.();\n }\n\n private notifyStatus(message: string): void {\n this.statusMessage = message;\n this.showStatus?.(message);\n this.requestRender?.();\n }\n\n private requiredCommand(\n name: \"prompt\" | \"steer\" | \"followUp\" | \"resume\",\n ): (text?: string) => Promise<void> {\n switch (name) {\n case \"prompt\":\n return async (text) => {\n if (!this.commands.prompt) throw new Error(\"no prompt command configured for this chat session\");\n await this.commands.prompt(text ?? \"\");\n };\n case \"steer\":\n return async (text) => {\n if (!this.commands.steer) throw new Error(\"no steer command configured for this chat session\");\n await this.commands.steer(text ?? \"\");\n };\n case \"followUp\":\n return async (text) => {\n if (!this.commands.followUp) throw new Error(\"no followUp command configured for this chat session\");\n await this.commands.followUp(text ?? \"\");\n };\n case \"resume\":\n return async (text) => {\n if (!this.commands.resume) throw new Error(\"no resume command configured for this chat session\");\n await this.commands.resume(text);\n };\n }\n }\n\n private afterEvent(changed: boolean): void {\n this.syncAnimationTick();\n if (!changed) return;\n this.requestEventRender();\n }\n\n private requestEventRender(): void {\n if (!this.isStreaming()) {\n this.requestRender?.();\n return;\n }\n if (this.renderThrottleTimer) return;\n this.renderThrottleTimer = setTimeout(() => {\n this.renderThrottleTimer = undefined;\n this.requestRender?.();\n }, STREAMING_RENDER_THROTTLE_MS);\n this.renderThrottleTimer.unref?.();\n }\n}\n\nfunction setEditorPlaceholder(\n editor: EditorComponent,\n placeholder: string | undefined,\n): void {\n const candidate = editor as EditorComponent & {\n setPlaceholder?: (value: string | undefined) => void;\n };\n candidate.setPlaceholder?.(placeholder);\n}\n\nfunction setEditorBorderColor(\n editor: EditorComponent,\n borderColor: (text: string) => string,\n): void {\n const candidate = editor as EditorComponent & {\n borderColor?: (text: string) => string;\n };\n if (candidate.borderColor !== undefined) candidate.borderColor = borderColor;\n}\n\nfunction setEditorFocused(editor: EditorComponent, focused: boolean): void {\n const candidate = editor as EditorComponent & Partial<Focusable>;\n if (\"focused\" in candidate) candidate.focused = focused;\n}\n\nfunction matchesKey(\n data: string,\n key: \"enter\" | \"backspace\" | \"escape\" | \"ctrl+f\" | \"alt+up\",\n): boolean {\n if (key === \"enter\" && (data === \"\\r\" || data === \"\\n\")) return true;\n if (key === \"backspace\" && (data === \"\\x7f\" || data === \"\\b\")) return true;\n if (key === \"escape\" && data === \"\\x1b\") return true;\n if (key === \"ctrl+f\" && data === \"\\x06\") return true;\n return tuiMatchesKey(data, key);\n}\n\nfunction parseBashInput(text: string):\n | { command: string; excludeFromContext: boolean }\n | undefined {\n if (!text.startsWith(\"!\")) return undefined;\n const excludeFromContext = text.startsWith(\"!!\");\n const command = text.slice(excludeFromContext ? 2 : 1).trim();\n return { command, excludeFromContext };\n}\n\nfunction isSharedLiveChatEvent(type: string): boolean {\n return (\n type === \"message_start\" ||\n type === \"message_update\" ||\n type === \"message_end\" ||\n type === \"tool_execution_start\" ||\n type === \"tool_execution_update\" ||\n type === \"tool_execution_end\"\n );\n}\n\nfunction cacheKey(parts: readonly CacheKeyPart[]): string {\n return JSON.stringify(parts);\n}\n\nfunction isChatMessageEntry<TExtraEntry extends ChatTranscriptEntryLike>(\n entry: ChatSessionHostEntry<TExtraEntry>,\n): entry is ChatMessageEntry {\n if (!(\"role\" in entry) || !(\"kind\" in entry)) return false;\n const candidate = entry as { role?: unknown; kind?: unknown; message?: unknown; text?: unknown };\n switch (candidate.kind) {\n case \"assistant\":\n return candidate.role === \"assistant\" && candidate.message !== undefined;\n case \"tool\":\n return candidate.role === \"tool\" && \"toolName\" in candidate && \"toolCallId\" in candidate && \"args\" in candidate;\n case \"bashExecution\":\n return candidate.role === \"tool\" && candidate.message !== undefined;\n case \"user\":\n return candidate.role === \"user\" && typeof candidate.text === \"string\";\n case \"custom\":\n return candidate.role === \"custom\" && candidate.message !== undefined;\n case \"branchSummary\":\n case \"compactionSummary\":\n return candidate.role === \"summary\" && candidate.message !== undefined;\n case \"system\":\n return candidate.role === \"system\" && candidate.message !== undefined;\n default:\n return false;\n }\n}\n\nfunction isMessageLike(message: unknown): message is { role?: unknown; content?: unknown } {\n return message !== null && typeof message === \"object\" && \"role\" in message;\n}\n\nfunction isUserMessageLike(\n message: unknown,\n): message is { role: \"user\"; content?: unknown } {\n return isMessageLike(message) && message.role === \"user\";\n}\n\nfunction userMessageSignature(text: string): string {\n return text.trim();\n}\n\nfunction assistantToolCallEvent(event: AgentSessionEvent): {\n type: \"tool_execution_start\";\n toolCallId: string;\n toolName: string;\n args: unknown;\n} | undefined {\n const assistantEvent = (event as {\n assistantMessageEvent?: {\n type?: unknown;\n contentIndex?: unknown;\n partial?: unknown;\n toolCall?: unknown;\n };\n }).assistantMessageEvent;\n const streamType = String(assistantEvent?.type ?? \"\");\n if (!streamType.startsWith(\"toolcall_\")) return undefined;\n const explicit = toolCallPayload(assistantEvent?.toolCall);\n if (explicit) return explicit;\n const contentIndex = typeof assistantEvent?.contentIndex === \"number\" ? assistantEvent.contentIndex : undefined;\n if (contentIndex === undefined) return undefined;\n const partial = assistantEvent?.partial;\n if (!isMessageLike(partial) || partial.role !== \"assistant\") return undefined;\n const content = partial.content;\n if (!Array.isArray(content)) return undefined;\n return toolCallPayload(content[contentIndex]);\n}\n\nfunction toolCallPayload(value: unknown): {\n type: \"tool_execution_start\";\n toolCallId: string;\n toolName: string;\n args: unknown;\n} | undefined {\n if (value === null || typeof value !== \"object\") return undefined;\n const candidate = value as { type?: unknown; id?: unknown; name?: unknown; arguments?: unknown };\n if (candidate.type !== \"toolCall\") return undefined;\n if (typeof candidate.id !== \"string\" || typeof candidate.name !== \"string\") return undefined;\n return {\n type: \"tool_execution_start\",\n toolCallId: candidate.id,\n toolName: candidate.name,\n args: candidate.arguments ?? {},\n };\n}\n\nfunction legacyToolStartEvent(event: AgentSessionEvent): {\n type: \"tool_execution_start\";\n toolCallId: string;\n toolName: string;\n args: unknown;\n} {\n const payload = event as { toolCallId?: unknown; name?: unknown; input?: unknown; args?: unknown };\n const toolName = typeof payload.name === \"string\" ? payload.name : \"tool\";\n const toolCallId =\n typeof payload.toolCallId === \"string\" ? payload.toolCallId : `live-${toolName}`;\n return {\n type: \"tool_execution_start\",\n toolCallId,\n toolName,\n args: payload.input ?? payload.args ?? {},\n };\n}\n\nfunction legacyToolResultEvent(event: AgentSessionEvent): {\n type: \"tool_execution_end\";\n toolCallId: string;\n toolName: string;\n result: unknown;\n isError: boolean;\n} {\n const payload = event as {\n toolCallId?: unknown;\n name?: unknown;\n output?: unknown;\n isError?: unknown;\n };\n const toolName = typeof payload.name === \"string\" ? payload.name : \"tool\";\n const toolCallId =\n typeof payload.toolCallId === \"string\" ? payload.toolCallId : `live-${toolName}`;\n const output = payload.output;\n return {\n type: \"tool_execution_end\",\n toolCallId,\n toolName,\n result:\n output !== null && typeof output === \"object\" && \"content\" in output\n ? output\n : { content: typeof output === \"string\" ? [{ type: \"text\", text: output }] : [] },\n isError: payload.isError === true,\n };\n}\n\nfunction legacyThinkingEvent(event: AgentSessionEvent): {\n type: \"message_update\";\n assistantMessageEvent: { type: \"thinking_delta\"; delta: string };\n message: { role: \"assistant\"; content: [] };\n} {\n const delta = String(\n (event as { delta?: unknown }).delta ??\n (event as { text?: unknown }).text ??\n \"\",\n );\n return {\n type: \"message_update\",\n assistantMessageEvent: { type: \"thinking_delta\", delta },\n message: { role: \"assistant\", content: [] },\n };\n}\n\nfunction extractMessageText(content: unknown): string {\n if (typeof content === \"string\") return content;\n if (!Array.isArray(content)) return \"\";\n const parts: string[] = [];\n for (const item of content) {\n if (item == null) continue;\n if (typeof item === \"string\") {\n parts.push(item);\n continue;\n }\n const obj = item as { type?: unknown; text?: unknown };\n if (typeof obj.text === \"string\") parts.push(obj.text);\n else if (obj.type === \"text\" && typeof obj.text === \"string\") parts.push(obj.text);\n }\n return parts.join(\"\");\n}\n\nfunction tailStreamingText(text: string): string {\n if (\n text.length <= STREAMING_TEXT_TAIL_CHARS &&\n text.split(\"\\n\").length <= STREAMING_TEXT_TAIL_LINES\n ) {\n return text;\n }\n const byChars = text.slice(-STREAMING_TEXT_TAIL_CHARS);\n const lines = byChars.split(\"\\n\");\n const tail =\n lines.length > STREAMING_TEXT_TAIL_LINES\n ? lines.slice(-STREAMING_TEXT_TAIL_LINES).join(\"\\n\")\n : byChars;\n return `[earlier streaming output hidden while attached]\\n\\n${tail.trimStart()}`;\n}\n\nfunction spinnerFrame(): string {\n const idx = Math.floor(Date.now() / 80) % SPINNER_FRAMES.length;\n return SPINNER_FRAMES[idx]!;\n}\n\nfunction stripAnsi(s: string): string {\n return s.replace(/\\x1B\\[[0-?]*[ -/]*[@-~]/g, \"\");\n}\n\nfunction errorMessage(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"chat-session-host.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/chat-session-host.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AAExF,OAAO,EACL,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,GAAG,EAMT,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAG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tB;IAED,SAAS,IAAI,MAAM,CAElB;IAED,UAAU,IAAI,MAAM,CAEnB;IAED,cAAc,IAAI,IAAI,CAErB;IAED,iBAAiB,IAAI,IAAI,CAcxB;IAED,OAAO,IAAI,IAAI,CAUd;IAED,OAAO,CAAC,YAAY;IA2EpB,OAAO,CAAC,qBAAqB;IAc7B,OAAO,CAAC,YAAY;IAkBpB,OAAO,CAAC,kBAAkB;IAW1B,OAAO,CAAC,OAAO;IAIf,OAAO,CAAC,aAAa;IAMrB,OAAO,CAAC,WAAW;IAanB,OAAO,CAAC,sBAAsB;IAa9B,OAAO,CAAC,wBAAwB;IAWhC,OAAO,CAAC,OAAO;IAIf,OAAO,CAAC,0BAA0B;IAelC,OAAO,CAAC,kBAAkB;IAa1B,OAAO,CAAC,oBAAoB;IAqC5B,OAAO,CAAC,iBAAiB;IASzB,OAAO,CAAC,kBAAkB;YAaZ,eAAe;YAcf,SAAS;YAYT,cAAc;YAyDd,oBAAoB;YAwBpB,UAAU;YASV,aAAa;IAS3B,6BAA6B,IAAI,OAAO,CAqBvC;IAED,OAAO,CAAC,aAAa;IAMrB,OAAO,CAAC,YAAY;IAMpB,OAAO,CAAC,eAAe;IA2BvB,OAAO,CAAC,UAAU;IAMlB,OAAO,CAAC,kBAAkB;CAY3B","sourcesContent":["import type { AgentSessionEvent } from \"../../../core/agent-session.ts\";\nimport type { AgentSession } from \"../../../core/agent-session.ts\";\nimport type { BashResult } from \"../../../core/bash-executor.ts\";\nimport type { ReadonlyFooterDataProvider } from \"../../../core/footer-data-provider.ts\";\nimport type { BashExecutionMessage } from \"../../../core/messages.ts\";\nimport {\n type Component,\n type EditorComponent,\n type EditorTheme,\n type Focusable,\n type MarkdownTheme,\n type TUI,\n Spacer,\n Text,\n matchesKey as tuiMatchesKey,\n truncateToWidth,\n visibleWidth,\n} from \"@earendil-works/pi-tui\";\nimport { SessionManager } from \"../../../core/session-manager.ts\";\nimport { CustomEditor } from \"./custom-editor.ts\";\nimport {\n LiveChatEntriesController,\n renderChatMessageEntry,\n type ChatMessageEntry,\n type ChatMessageRenderOptions,\n} from \"./chat-message-renderer.ts\";\nimport {\n ChatTranscriptComponent,\n ScrollableComponentViewport,\n type ChatTranscriptEntryLike,\n} from \"./chat-transcript.ts\";\nimport { UsageMeterComponent, FooterComponent } from \"./footer.ts\";\nimport { WorkingStatusComponent } from \"./working-status.ts\";\nimport {\n combineQueuedMessagesForEditor,\n openExternalEditorForText,\n pasteClipboardImageToEditor,\n} from \"../chat-input-actions.ts\";\nimport { pickWhimsicalWorkingMessage } from \"../whimsical-messages.ts\";\n\nconst SPINNER_FRAMES = [\"⠋\", \"⠙\", \"⠹\", \"⠸\", \"⠼\", \"⠴\", \"⠦\", \"⠧\", \"⠇\", \"⠏\"];\nconst ANIMATION_FRAME_MS = 80;\nconst STREAMING_RENDER_THROTTLE_MS = 80;\nconst STREAMING_TEXT_TAIL_LINES = 240;\nconst STREAMING_TEXT_TAIL_CHARS = 16_000;\n\nexport interface ChatSessionHostStyle {\n dim(text: string): string;\n text(text: string): string;\n textMuted(text: string): string;\n accent(text: string): string;\n accentBold(text: string): string;\n rule(hex: string, text: string): string;\n cursor(): string;\n blank(width: number): string;\n editorRuleColor(\n disabled: boolean,\n agentSession: AgentSession | undefined,\n state?: { isBashMode: boolean },\n ): string;\n}\n\nexport interface ChatSessionHostBashRequest {\n command: string;\n excludeFromContext: boolean;\n onChunk: (chunk: string) => void;\n}\n\nexport interface ChatSessionHostCommands {\n ensureAttached?: () => Promise<void>;\n prompt?: (text: string) => Promise<void>;\n steer?: (text: string) => Promise<void>;\n followUp?: (text: string) => Promise<void>;\n interrupt?: () => Promise<void>;\n resume?: (message?: string) => Promise<void>;\n runBash?: (request: ChatSessionHostBashRequest) => Promise<BashResult>;\n abortBash?: () => void | Promise<void>;\n abortCompaction?: () => void | Promise<void>;\n handleSlashCommand?: (text: string) => Promise<boolean> | boolean;\n}\n\nexport interface ChatSessionHostOpts<TExtraEntry extends ChatTranscriptEntryLike = never> {\n style: ChatSessionHostStyle;\n commands?: ChatSessionHostCommands;\n requestRender?: () => void;\n getAgentSession?: () => AgentSession | undefined;\n isStreaming?: () => boolean;\n isPaused?: () => boolean;\n isDisabled?: () => boolean;\n isBashRunning?: () => boolean;\n showWarning?: (message: string) => void;\n showStatus?: (message: string) => void;\n actions?: Record<string, () => void | Promise<void>>;\n getActionKeyDisplay?: (action: string) => string;\n getMarkdownTheme?: () => MarkdownTheme;\n tui?: TUI;\n keybindings?: unknown;\n editorFactory?: (\n tui: TUI,\n theme: EditorTheme,\n keybindings: unknown,\n ) => EditorComponent;\n editorTheme: EditorTheme;\n getChatRenderSettings?: () =>\n | Partial<Omit<ChatMessageRenderOptions, \"ui\" | \"cwd\">>\n | undefined;\n getCwd?: () => string;\n footerData?: ReadonlyFooterDataProvider;\n renderExtraEntry?: (entry: TExtraEntry) => Component;\n}\n\nexport type ChatSessionHostEntry<TExtraEntry extends ChatTranscriptEntryLike = never> =\n | ChatMessageEntry\n | TExtraEntry;\ntype AgentSnapshotMessage = AgentSession[\"messages\"][number];\ntype CacheKeyPart = string | number | boolean | null;\n\nexport class ChatSessionHost<TExtraEntry extends ChatTranscriptEntryLike = never>\n implements Component, Focusable\n{\n focused = true;\n\n private readonly style: ChatSessionHostStyle;\n private readonly commands: ChatSessionHostCommands;\n private readonly requestRender: (() => void) | undefined;\n private readonly getAgentSession: (() => AgentSession | undefined) | undefined;\n private readonly isStreamingOverride: (() => boolean) | undefined;\n private readonly isPaused: (() => boolean) | undefined;\n private readonly isDisabled: (() => boolean) | undefined;\n private readonly isBashRunningOverride: (() => boolean) | undefined;\n private readonly showWarning: ((message: string) => void) | undefined;\n private readonly showStatus: ((message: string) => void) | undefined;\n private readonly actions: Record<string, () => void | Promise<void>> | undefined;\n private readonly getActionKeyDisplay: ((action: string) => string) | undefined;\n private readonly getMarkdownTheme: (() => MarkdownTheme) | undefined;\n private readonly getChatRenderSettings: ChatSessionHostOpts<TExtraEntry>[\"getChatRenderSettings\"];\n private readonly getCwd: (() => string) | undefined;\n private readonly footerData: ReadonlyFooterDataProvider | undefined;\n private readonly renderExtraEntry: ((entry: TExtraEntry) => Component) | undefined;\n private readonly tui: TUI | undefined;\n\n private inputBuffer = \"\";\n private transcript: ChatSessionHostEntry<TExtraEntry>[] = [];\n private statusMessage = \"\";\n private isBashMode = false;\n private localBashRunning = false;\n private sdkBusy = false;\n private workingMessage: string | undefined;\n private pendingSteeringMessages: readonly string[] = [];\n private pendingFollowUpMessages: readonly string[] = [];\n private compactionQueuedMessages: readonly string[] = [];\n private compacting = false;\n private animationTimer: ReturnType<typeof setInterval> | undefined;\n private renderThrottleTimer: ReturnType<typeof setTimeout> | undefined;\n private bodyViewport = new ScrollableComponentViewport();\n private transcriptComponent: ChatTranscriptComponent<ChatSessionHostEntry<TExtraEntry>>;\n private transcriptRenderSettingsKey = \"\";\n private renderIdentityIds = new WeakMap<object, number>();\n private nextRenderIdentityId = 1;\n private liveChat: LiveChatEntriesController;\n private editor: EditorComponent | undefined;\n private optimisticUserSignatureCounts = new Map<string, number>();\n\n constructor(opts: ChatSessionHostOpts<TExtraEntry>) {\n this.style = opts.style;\n this.commands = opts.commands ?? {};\n this.requestRender = opts.requestRender;\n this.getAgentSession = opts.getAgentSession;\n this.isStreamingOverride = opts.isStreaming;\n this.isPaused = opts.isPaused;\n this.isDisabled = opts.isDisabled;\n this.isBashRunningOverride = opts.isBashRunning;\n this.showWarning = opts.showWarning;\n this.showStatus = opts.showStatus;\n this.actions = opts.actions;\n this.getActionKeyDisplay = opts.getActionKeyDisplay;\n this.getMarkdownTheme = opts.getMarkdownTheme;\n this.getChatRenderSettings = opts.getChatRenderSettings;\n this.getCwd = opts.getCwd;\n this.footerData = opts.footerData;\n this.renderExtraEntry = opts.renderExtraEntry;\n this.tui = opts.tui;\n this.liveChat = new LiveChatEntriesController(this.transcript);\n this.transcriptComponent = new ChatTranscriptComponent(\n this.transcript,\n (entry) => this.renderEntry(entry),\n (entry, index) => this.transcriptCacheKey(entry, index),\n );\n this.editor = this.createEditor(\n opts.tui,\n opts.keybindings,\n opts.editorTheme,\n opts.editorFactory,\n );\n this.syncAnimationTick();\n }\n\n appendMessages(messages: readonly AgentSnapshotMessage[]): void {\n this.liveChat.appendMessages(messages);\n }\n\n loadSessionFile(sessionFile: string | undefined): void {\n if (this.transcript.length > 0 || sessionFile === undefined) return;\n let messages: readonly AgentSnapshotMessage[];\n try {\n messages = SessionManager.open(sessionFile).buildSessionContext()\n .messages as readonly AgentSnapshotMessage[];\n } catch {\n return;\n }\n this.liveChat.appendMessages(messages);\n }\n\n appendExtraEntry(entry: TExtraEntry): void {\n this.transcript.push(entry);\n }\n\n entries(): readonly ChatSessionHostEntry<TExtraEntry>[] {\n return this.transcript;\n }\n\n private incrementOptimisticUserSignature(signature: string): void {\n this.optimisticUserSignatureCounts.set(\n signature,\n (this.optimisticUserSignatureCounts.get(signature) ?? 0) + 1,\n );\n }\n\n private decrementOptimisticUserSignature(signature: string): void {\n const count = this.optimisticUserSignatureCounts.get(signature) ?? 0;\n if (count <= 1) this.optimisticUserSignatureCounts.delete(signature);\n else this.optimisticUserSignatureCounts.set(signature, count - 1);\n }\n\n applyAgentEvent(event: AgentSessionEvent): boolean {\n const type = String((event as { type?: unknown }).type ?? \"\");\n if (type === \"message_start\") {\n const message = (event as { message?: unknown }).message;\n if (isUserMessageLike(message)) {\n const signature = userMessageSignature(\n extractMessageText(message.content),\n );\n const count = this.optimisticUserSignatureCounts.get(signature) ?? 0;\n if (count > 0) {\n this.decrementOptimisticUserSignature(signature);\n return false;\n }\n }\n }\n if (isSharedLiveChatEvent(type)) {\n const changed = this.liveChat.applyEvent(event);\n const toolCallEvent = assistantToolCallEvent(event);\n const changedByToolCall = toolCallEvent !== undefined\n ? this.liveChat.applyEvent(toolCallEvent)\n : false;\n this.afterEvent(changed || changedByToolCall);\n return changed || changedByToolCall;\n }\n let changed = false;\n switch (type) {\n case \"agent_start\":\n this.sdkBusy = true;\n this.liveChat.clearPendingTools();\n this.statusMessage = \"\";\n changed = true;\n break;\n case \"agent_end\":\n this.sdkBusy = false;\n this.workingMessage = undefined;\n this.liveChat.clearPendingTools();\n this.statusMessage = \"\";\n changed = true;\n break;\n case \"turn_start\":\n this.workingMessage = pickWhimsicalWorkingMessage();\n changed = true;\n break;\n case \"turn_end\":\n this.workingMessage = undefined;\n changed = true;\n break;\n case \"queue_update\": {\n const queue = event as { steering?: unknown; followUp?: unknown };\n this.pendingSteeringMessages = Array.isArray(queue.steering)\n ? queue.steering.filter((item): item is string => typeof item === \"string\")\n : [];\n this.pendingFollowUpMessages = Array.isArray(queue.followUp)\n ? queue.followUp.filter((item): item is string => typeof item === \"string\")\n : [];\n changed = true;\n break;\n }\n case \"tool_call\":\n case \"tool_use\":\n changed = this.liveChat.applyEvent(legacyToolStartEvent(event));\n break;\n case \"tool_result\":\n changed = this.liveChat.applyEvent(legacyToolResultEvent(event));\n break;\n case \"thinking_delta\":\n case \"thinking\":\n changed = this.liveChat.applyEvent(legacyThinkingEvent(event));\n break;\n case \"compaction_start\":\n this.compacting = true;\n this.sdkBusy = true;\n this.statusMessage = \"compacting context…\";\n changed = true;\n break;\n case \"context_compaction_start\":\n this.compacting = true;\n this.sdkBusy = true;\n this.statusMessage = \"context-compacting…\";\n changed = true;\n break;\n case \"compaction_end\": {\n const compaction = event as Extract<AgentSessionEvent, { type: \"compaction_end\" }>;\n this.compacting = false;\n this.sdkBusy = false;\n this.statusMessage = compaction.errorMessage ?? \"\";\n if (!compaction.aborted && !compaction.errorMessage && this.compactionQueuedMessages.length > 0) {\n void this.flushCompactionQueue();\n }\n changed = true;\n break;\n }\n case \"context_compaction_end\": {\n const compaction = event as Extract<AgentSessionEvent, { type: \"context_compaction_end\" }>;\n this.compacting = false;\n this.sdkBusy = false;\n this.statusMessage = compaction.errorMessage ?? \"\";\n if (!compaction.aborted && !compaction.errorMessage && this.compactionQueuedMessages.length > 0) {\n void this.flushCompactionQueue();\n }\n changed = true;\n break;\n }\n case \"auto_retry_start\":\n this.sdkBusy = true;\n this.statusMessage = \"retrying…\";\n changed = true;\n break;\n case \"auto_retry_end\": {\n const retry = event as Extract<AgentSessionEvent, { type: \"auto_retry_end\" }>;\n this.statusMessage = \"\";\n if (!retry.success) {\n this.sdkBusy = false;\n this.workingMessage = undefined;\n }\n changed = true;\n break;\n }\n default:\n changed = false;\n }\n this.afterEvent(changed);\n return changed;\n }\n\n render(width: number): string[] {\n return this.renderBody(width, 1);\n }\n\n invalidate(): void {\n this.transcriptComponent.invalidate();\n this.bodyViewport.invalidate();\n this.editor?.invalidate();\n }\n\n renderBody(width: number, budget: number): string[] {\n const components: Component[] = [];\n this.transcriptRenderSettingsKey = this.chatRenderSettingsCacheKey();\n if (this.transcript.length > 0) {\n components.push(this.transcriptComponent);\n }\n if (this.statusMessage) {\n components.push(new Spacer(1));\n components.push(new Text(this.style.dim(this.statusMessage), 2, 0));\n }\n this.bodyViewport.setVisibleRows(budget);\n this.bodyViewport.setComponents(components);\n return this.bodyViewport.render(width);\n }\n\n renderPendingMessages(width: number): string[] {\n if (\n this.pendingSteeringMessages.length === 0 &&\n this.pendingFollowUpMessages.length === 0 &&\n this.compactionQueuedMessages.length === 0\n ) {\n return [];\n }\n const lines = [this.style.blank(width)];\n for (const message of this.pendingSteeringMessages) {\n lines.push(...this.pendingMessageLine(width, \"Steering\", message));\n }\n for (const message of this.pendingFollowUpMessages) {\n lines.push(...this.pendingMessageLine(width, \"Follow-up\", message));\n }\n for (const message of this.compactionQueuedMessages) {\n lines.push(...this.pendingMessageLine(width, \"Queued\", message));\n }\n const hint = this.getActionKeyDisplay?.(\"app.message.dequeue\") ?? \"alt+up\";\n lines.push(...new Text(this.style.dim(`↳ ${hint} to edit all queued messages`), 1, 0).render(width));\n return lines;\n }\n\n renderWorkingStatus(width: number): string[] {\n if (!this.isStreaming()) return [];\n const message = this.workingMessage ?? \"Working...\";\n return new WorkingStatusComponent({\n spinner: spinnerFrame(),\n message,\n spinnerColor: (text) => this.style.accentBold(text),\n messageColor: (text) => this.style.textMuted(text),\n }).render(width);\n }\n\n renderUsage(width: number): string[] {\n const agentSession = this.getAgentSession?.();\n if (!agentSession) return [];\n return new UsageMeterComponent(agentSession).render(width);\n }\n\n renderEditor(width: number): string[] {\n const disabled = this.isDisabled?.() === true;\n const agentSession = this.getAgentSession?.();\n const ruleHex = this.style.editorRuleColor(disabled, agentSession, {\n isBashMode: this.isBashMode,\n });\n if (!disabled && this.editor) {\n setEditorFocused(this.editor, this.focused);\n setEditorPlaceholder(this.editor, undefined);\n setEditorBorderColor(this.editor, (text) => this.style.rule(ruleHex, text));\n return this.editor.render(width);\n }\n if (this.editor) setEditorFocused(this.editor, false);\n const rule = this.style.rule(ruleHex, \"─\".repeat(width));\n const available = Math.max(1, width - 3);\n const value = this.inputBuffer\n ? this.style.text(truncateToWidth(this.inputBuffer, available)) + this.style.cursor()\n : disabled\n ? \"\"\n : this.style.cursor();\n const left = this.style.accentBold(\"❯\") + \" \" + value;\n const gap = Math.max(0, width - visibleWidth(stripAnsi(left)));\n const body = left + \" \".repeat(gap);\n return [rule, body, rule];\n }\n\n renderFooter(width: number): string[] {\n const agentSession = this.getAgentSession?.();\n if (agentSession && this.footerData) {\n return new FooterComponent(agentSession, this.footerData).render(width);\n }\n return [];\n }\n\n handleScrollInput(data: string): boolean {\n return this.bodyViewport.handleInput(data);\n }\n\n handleInput(data: string): boolean {\n if (this.handleScrollInput(data)) return true;\n if (matchesKey(data, \"alt+up\")) {\n this.restoreQueuedMessagesToEditor();\n return true;\n }\n if (matchesKey(data, \"ctrl+f\")) {\n void this.submit(\"followUp\");\n return true;\n }\n if (matchesKey(data, \"escape\")) {\n if (this.compacting) {\n void this.abortCompaction();\n return true;\n }\n if (this.isStreaming()) {\n void this.interrupt();\n return true;\n }\n if (this.isBashRunning()) {\n void this.abortBash();\n return true;\n }\n if (this.isBashMode) {\n this.setEditorText(\"\");\n this.notifyStatus(\"Bash mode cleared\");\n return true;\n }\n }\n if (this.editor) {\n this.editor.handleInput(data);\n return true;\n }\n if (matchesKey(data, \"enter\")) {\n void this.submit(\"auto\");\n return true;\n }\n if (matchesKey(data, \"backspace\")) {\n this.setEditorText(this.inputBuffer.slice(0, -1));\n return true;\n }\n if (data.length === 1 && data >= \" \" && data <= \"~\") {\n this.setEditorText(`${this.inputBuffer}${data}`);\n return true;\n }\n return false;\n }\n\n async interrupt(): Promise<void> {\n try {\n this.restoreQueuedMessagesToEditor();\n this.sdkBusy = false;\n this.workingMessage = undefined;\n await this.commands.interrupt?.();\n } catch (err) {\n this.statusMessage = errorMessage(err);\n } finally {\n this.syncAnimationTick();\n this.requestRender?.();\n }\n }\n\n async submit(mode: \"auto\" | \"followUp\" = \"auto\", submittedText?: string): Promise<void> {\n const text = (submittedText ?? this.inputBuffer).trim();\n if (!text) return;\n if (text.startsWith(\"/\") && this.commands.handleSlashCommand) {\n const handled = await this.commands.handleSlashCommand(text);\n if (handled) {\n this.setEditorText(\"\");\n this.requestRender?.();\n return;\n }\n }\n if (this.compacting) {\n this.setEditorText(\"\");\n this.compactionQueuedMessages = [...this.compactionQueuedMessages, text];\n this.notifyStatus(\"Queued message until compaction completes\");\n return;\n }\n const bash = parseBashInput(text);\n if (bash?.command) {\n if (this.isBashRunning()) {\n this.notifyWarning(\"A bash command is already running. esc cancel first.\");\n this.setEditorText(text);\n return;\n }\n this.setEditorText(\"\");\n await this.runBashCommand(bash.command, bash.excludeFromContext);\n return;\n }\n this.setEditorText(\"\");\n const isPaused = this.isPaused?.() === true;\n const isStreaming = this.isStreaming();\n const shouldAppendOptimisticUser = mode === \"auto\" && !isStreaming;\n const optimisticSignature = shouldAppendOptimisticUser\n ? userMessageSignature(text)\n : undefined;\n if (optimisticSignature !== undefined) {\n this.liveChat.appendUserText(text);\n this.bodyViewport.scrollToBottom();\n this.incrementOptimisticUserSignature(optimisticSignature);\n }\n this.requestRender?.();\n try {\n if (isPaused) {\n this.sdkBusy = true;\n this.statusMessage = \"resuming…\";\n this.syncAnimationTick();\n this.requestRender?.();\n await this.requiredCommand(\"resume\")(text);\n this.sdkBusy = false;\n this.statusMessage = \"\";\n this.syncAnimationTick();\n return;\n }\n if (mode === \"followUp\" && isStreaming) {\n await this.queueFollowUp(text);\n return;\n }\n if (isStreaming) {\n await this.queueSteer(text);\n } else {\n this.sdkBusy = true;\n this.syncAnimationTick();\n await this.commands.ensureAttached?.();\n await this.requiredCommand(\"prompt\")(text);\n this.sdkBusy = false;\n this.syncAnimationTick();\n }\n } catch (err) {\n if (optimisticSignature !== undefined) {\n this.decrementOptimisticUserSignature(optimisticSignature);\n }\n this.sdkBusy = false;\n this.statusMessage = errorMessage(err);\n this.syncAnimationTick();\n this.requestRender?.();\n }\n }\n\n isStreaming(): boolean {\n return this.sdkBusy || this.isStreamingOverride?.() === true;\n }\n\n isBashRunning(): boolean {\n return this.localBashRunning || this.isBashRunningOverride?.() === true;\n }\n\n isEditingBashCommand(): boolean {\n return this.isBashMode;\n }\n\n hasInputText(): boolean {\n return this.inputBuffer.length > 0;\n }\n\n hasAnimationTick(): boolean {\n return this.animationTimer !== undefined;\n }\n\n bodyScrollFromBottom(): number {\n return this.bodyViewport.getScrollFromBottom();\n }\n\n bodyMaxScroll(): number {\n return this.bodyViewport.getMaxScroll();\n }\n\n inputText(): string {\n return this.inputBuffer;\n }\n\n statusText(): string {\n return this.statusMessage;\n }\n\n scrollToBottom(): void {\n this.bodyViewport.scrollToBottom();\n }\n\n syncAnimationTick(): void {\n const shouldAnimate =\n this.isStreaming() || (this.sdkBusy && this.liveChat.pendingToolIds().length > 0);\n if (shouldAnimate && !this.animationTimer) {\n this.animationTimer = setInterval(() => {\n this.requestRender?.();\n }, ANIMATION_FRAME_MS);\n this.animationTimer.unref?.();\n return;\n }\n if (!shouldAnimate && this.animationTimer) {\n clearInterval(this.animationTimer);\n this.animationTimer = undefined;\n }\n }\n\n dispose(): void {\n if (this.animationTimer) {\n clearInterval(this.animationTimer);\n this.animationTimer = undefined;\n }\n if (this.renderThrottleTimer) {\n clearTimeout(this.renderThrottleTimer);\n this.renderThrottleTimer = undefined;\n }\n this.editor = undefined;\n }\n\n private createEditor(\n tui: TUI | undefined,\n keybindings: unknown,\n editorTheme: EditorTheme,\n editorFactory: ChatSessionHostOpts<TExtraEntry>[\"editorFactory\"],\n ): EditorComponent | undefined {\n if (!tui || !keybindings) return undefined;\n const editor = this.createInheritedEditor(tui, editorTheme, keybindings, editorFactory) ??\n new CustomEditor(\n tui,\n editorTheme,\n keybindings as ConstructorParameters<typeof CustomEditor>[2],\n { paddingX: 0, autocompleteMaxVisible: 5 },\n );\n editor.onChange = (text) => {\n this.inputBuffer = text;\n this.isBashMode = text.trimStart().startsWith(\"!\");\n };\n editor.onSubmit = (text) => {\n void this.submit(\"auto\", text);\n };\n const actionEditor = editor as EditorComponent & {\n onAction?: (action: string, handler: () => void) => void;\n onEscape?: () => void;\n onPasteImage?: () => void;\n };\n actionEditor.onAction?.(\"app.message.followUp\", () => {\n void this.submit(\"followUp\");\n });\n actionEditor.onAction?.(\"app.message.dequeue\", () => {\n this.restoreQueuedMessagesToEditor();\n });\n actionEditor.onAction?.(\"app.editor.external\", () => {\n this.openExternalEditor();\n });\n if (this.actions) {\n for (const [action, handler] of Object.entries(this.actions)) {\n actionEditor.onAction?.(action, () => {\n void handler();\n });\n }\n }\n const previousPasteImage = actionEditor.onPasteImage;\n actionEditor.onPasteImage = () => {\n previousPasteImage?.();\n void pasteClipboardImageToEditor(\n this.editorAccess(),\n () => this.requestRender?.(),\n { showWarning: (message) => this.notifyWarning(message) },\n );\n };\n const previousEscape = actionEditor.onEscape;\n actionEditor.onEscape = () => {\n if (this.compacting) {\n void this.abortCompaction();\n return;\n }\n if (this.isStreaming()) {\n void this.interrupt();\n return;\n }\n if (this.isBashRunning()) {\n void this.abortBash();\n return;\n }\n if (this.isBashMode) {\n this.setEditorText(\"\");\n this.notifyStatus(\"Bash mode cleared\");\n return;\n }\n previousEscape?.();\n };\n return editor;\n }\n\n private createInheritedEditor(\n tui: TUI,\n editorTheme: EditorTheme,\n keybindings: unknown,\n editorFactory: ChatSessionHostOpts<TExtraEntry>[\"editorFactory\"],\n ): EditorComponent | undefined {\n if (!editorFactory) return undefined;\n try {\n return editorFactory(tui, editorTheme, keybindings);\n } catch {\n return undefined;\n }\n }\n\n private editorAccess(): {\n insertTextAtCursor: (text: string) => void;\n getText: () => string;\n setText: (text: string) => void;\n } {\n return {\n insertTextAtCursor: (text: string) => {\n if (this.editor?.insertTextAtCursor) {\n this.editor.insertTextAtCursor(text);\n return;\n }\n this.setEditorText(`${this.inputBuffer}${text}`);\n },\n getText: () => this.inputBuffer,\n setText: (text: string) => this.setEditorText(text),\n };\n }\n\n private openExternalEditor(): void {\n if (!this.editor) return;\n const host = this.tuiHost();\n if (!host) return;\n const currentText = this.editor.getExpandedText?.() ?? this.editor.getText();\n const updated = openExternalEditorForText(currentText, host, {\n showWarning: (message) => this.notifyWarning(message),\n });\n if (updated !== undefined) this.setEditorText(updated);\n }\n\n private tuiHost(): Pick<TUI, \"stop\" | \"start\" | \"requestRender\"> | undefined {\n return this.tui;\n }\n\n private setEditorText(text: string): void {\n this.inputBuffer = text;\n this.isBashMode = text.trimStart().startsWith(\"!\");\n this.editor?.setText(text);\n }\n\n private renderEntry(entry: ChatSessionHostEntry<TExtraEntry>): Component {\n if (isChatMessageEntry(entry)) {\n return renderChatMessageEntry(\n this.streamingWindowedEntry(entry),\n this.chatMessageRenderOptions(),\n );\n }\n if (!this.renderExtraEntry) {\n return new Text(\"\", 0, 0);\n }\n return this.renderExtraEntry(entry);\n }\n\n private streamingWindowedEntry(entry: ChatMessageEntry): ChatMessageEntry {\n if (!this.isStreaming() || this.bodyViewport.getScrollFromBottom() !== 0) {\n return entry;\n }\n if (entry.kind !== \"assistant\") return entry;\n const content = entry.message.content.map((item) => {\n if (item.type === \"text\") return { ...item, text: tailStreamingText(item.text) };\n if (item.type === \"thinking\") return { ...item, thinking: tailStreamingText(item.thinking) };\n return item;\n });\n return { ...entry, message: { ...entry.message, content } };\n }\n\n private chatMessageRenderOptions(): ChatMessageRenderOptions {\n const inherited = this.getChatRenderSettings?.();\n return {\n ...inherited,\n ui: this.toolTui(),\n cwd: this.getCwd?.() ?? this.getAgentSession?.()?.sessionManager.getCwd() ?? process.cwd(),\n markdownTheme: inherited?.markdownTheme ?? this.getMarkdownTheme?.(),\n showImages: inherited?.showImages ?? true,\n };\n }\n\n private toolTui(): Pick<TUI, \"requestRender\"> {\n return { requestRender: () => this.requestRender?.() };\n }\n\n private chatRenderSettingsCacheKey(): string {\n const inherited = this.getChatRenderSettings?.();\n return cacheKey([\n \"settings\",\n inherited?.hideThinkingBlock === true,\n inherited?.hiddenThinkingLabel ?? \"\",\n inherited?.toolOutputExpanded === true,\n inherited?.showImages !== false,\n inherited?.imageWidthCells ?? null,\n this.getCwd?.() ?? this.getAgentSession?.()?.sessionManager.getCwd() ?? process.cwd(),\n this.bodyViewport.getScrollFromBottom() === 0,\n this.isStreaming(),\n ]);\n }\n\n private transcriptCacheKey(\n entry: ChatSessionHostEntry<TExtraEntry>,\n index: number,\n ): string {\n return cacheKey([\n this.transcriptRenderSettingsKey,\n index,\n entry.role,\n this.renderIdentityKey(entry),\n this.entryContentCacheKey(entry),\n ]);\n }\n\n private entryContentCacheKey(entry: ChatSessionHostEntry<TExtraEntry>): string {\n if (!isChatMessageEntry(entry)) return cacheKey([\"extra\"]);\n switch (entry.kind) {\n case \"assistant\":\n return cacheKey([\"assistant\", this.renderIdentityKey(entry.message)]);\n case \"tool\":\n return cacheKey([\n \"tool\",\n entry.toolCallId,\n entry.toolName,\n entry.isPartial === true,\n entry.result === undefined ? null : this.renderIdentityKey(entry.result),\n ]);\n case \"bashExecution\":\n return cacheKey([\n \"bashExecution\",\n entry.isPartial === true,\n entry.message.command,\n entry.message.output,\n entry.message.exitCode ?? null,\n entry.message.cancelled,\n entry.message.truncated,\n entry.message.fullOutputPath ?? null,\n ]);\n case \"user\":\n return cacheKey([\"user\", entry.text]);\n case \"custom\":\n return cacheKey([\"custom\", this.renderIdentityKey(entry.message)]);\n case \"branchSummary\":\n return cacheKey([\"branchSummary\", this.renderIdentityKey(entry.message)]);\n case \"compactionSummary\":\n return cacheKey([\"compactionSummary\", this.renderIdentityKey(entry.message)]);\n case \"system\":\n return cacheKey([\"system\", entry.text]);\n }\n }\n\n private renderIdentityKey(value: object): string {\n const existing = this.renderIdentityIds.get(value);\n if (existing !== undefined) return String(existing);\n const id = this.nextRenderIdentityId;\n this.nextRenderIdentityId += 1;\n this.renderIdentityIds.set(value, id);\n return String(id);\n }\n\n private pendingMessageLine(\n width: number,\n label: \"Steering\" | \"Follow-up\" | \"Queued\",\n message: string,\n ): string[] {\n const text = `${label}: ${message}`;\n return new Text(\n this.style.dim(truncateToWidth(text, Math.max(1, width - 2))),\n 1,\n 0,\n ).render(width);\n }\n\n private async abortCompaction(): Promise<void> {\n try {\n await this.commands.abortCompaction?.();\n this.compacting = false;\n this.sdkBusy = false;\n this.notifyStatus(\"Compaction cancelled\");\n } catch (err) {\n this.notifyWarning(errorMessage(err));\n } finally {\n this.syncAnimationTick();\n this.requestRender?.();\n }\n }\n\n private async abortBash(): Promise<void> {\n try {\n await this.commands.abortBash?.();\n this.localBashRunning = false;\n this.notifyStatus(\"Bash command cancelled\");\n } catch (err) {\n this.notifyWarning(errorMessage(err));\n } finally {\n this.requestRender?.();\n }\n }\n\n private async runBashCommand(\n command: string,\n excludeFromContext: boolean,\n ): Promise<void> {\n const runBash = this.commands.runBash;\n if (!runBash) {\n this.notifyWarning(\"no bash command configured for this chat session\");\n return;\n }\n const bashMessage: BashExecutionMessage = {\n role: \"bashExecution\",\n command,\n output: \"\",\n exitCode: undefined,\n cancelled: false,\n truncated: false,\n timestamp: Date.now(),\n ...(excludeFromContext ? { excludeFromContext: true } : {}),\n };\n const bashEntry: ChatMessageEntry = {\n role: \"tool\",\n kind: \"bashExecution\",\n message: bashMessage,\n isPartial: true,\n };\n this.transcript.push(bashEntry);\n this.localBashRunning = true;\n this.bodyViewport.scrollToBottom();\n this.requestRender?.();\n try {\n const result = await runBash({\n command,\n excludeFromContext,\n onChunk: (chunk) => {\n bashMessage.output += chunk;\n this.requestRender?.();\n },\n });\n bashMessage.output = result.output;\n bashMessage.exitCode = result.exitCode;\n bashMessage.cancelled = result.cancelled;\n bashMessage.truncated = result.truncated;\n if (result.fullOutputPath !== undefined) {\n bashMessage.fullOutputPath = result.fullOutputPath;\n }\n } catch (err) {\n bashMessage.output = errorMessage(err);\n bashMessage.exitCode = undefined;\n bashMessage.cancelled = false;\n bashMessage.truncated = false;\n } finally {\n bashEntry.isPartial = false;\n this.localBashRunning = false;\n this.requestRender?.();\n }\n }\n\n private async flushCompactionQueue(): Promise<void> {\n const queued = [...this.compactionQueuedMessages];\n this.compactionQueuedMessages = [];\n if (queued.length === 0) return;\n let nextIndex = 0;\n try {\n const first = queued[0];\n if (first !== undefined) {\n await this.requiredCommand(\"prompt\")(first);\n nextIndex = 1;\n }\n for (; nextIndex < queued.length; nextIndex++) {\n await this.queueFollowUp(queued[nextIndex]!);\n }\n } catch (err) {\n this.compactionQueuedMessages = [\n ...queued.slice(nextIndex),\n ...this.compactionQueuedMessages,\n ];\n this.notifyWarning(errorMessage(err));\n this.requestRender?.();\n }\n }\n\n private async queueSteer(text: string): Promise<void> {\n const agentSession = this.getAgentSession?.();\n if (agentSession?.isStreaming) {\n await agentSession.prompt(text, { streamingBehavior: \"steer\" });\n return;\n }\n await this.requiredCommand(\"steer\")(text);\n }\n\n private async queueFollowUp(text: string): Promise<void> {\n const agentSession = this.getAgentSession?.();\n if (agentSession?.isStreaming) {\n await agentSession.prompt(text, { streamingBehavior: \"followUp\" });\n return;\n }\n await this.requiredCommand(\"followUp\")(text);\n }\n\n restoreQueuedMessagesToEditor(): boolean {\n const queuedMessages = [\n ...this.pendingSteeringMessages,\n ...this.pendingFollowUpMessages,\n ...this.compactionQueuedMessages,\n ];\n if (queuedMessages.length === 0) {\n this.notifyStatus(\"No queued messages to restore\");\n return false;\n }\n const restoredText = combineQueuedMessagesForEditor(queuedMessages, this.inputBuffer);\n this.pendingSteeringMessages = [];\n this.pendingFollowUpMessages = [];\n this.compactionQueuedMessages = [];\n this.setEditorText(restoredText);\n this.getAgentSession?.()?.clearQueue();\n this.notifyStatus(\n `Restored ${queuedMessages.length} queued message${queuedMessages.length === 1 ? \"\" : \"s\"} to editor`,\n );\n this.requestRender?.();\n return true;\n }\n\n private notifyWarning(message: string): void {\n this.statusMessage = message;\n this.showWarning?.(message);\n this.requestRender?.();\n }\n\n private notifyStatus(message: string): void {\n this.statusMessage = message;\n this.showStatus?.(message);\n this.requestRender?.();\n }\n\n private requiredCommand(\n name: \"prompt\" | \"steer\" | \"followUp\" | \"resume\",\n ): (text?: string) => Promise<void> {\n switch (name) {\n case \"prompt\":\n return async (text) => {\n if (!this.commands.prompt) throw new Error(\"no prompt command configured for this chat session\");\n await this.commands.prompt(text ?? \"\");\n };\n case \"steer\":\n return async (text) => {\n if (!this.commands.steer) throw new Error(\"no steer command configured for this chat session\");\n await this.commands.steer(text ?? \"\");\n };\n case \"followUp\":\n return async (text) => {\n if (!this.commands.followUp) throw new Error(\"no followUp command configured for this chat session\");\n await this.commands.followUp(text ?? \"\");\n };\n case \"resume\":\n return async (text) => {\n if (!this.commands.resume) throw new Error(\"no resume command configured for this chat session\");\n await this.commands.resume(text);\n };\n }\n }\n\n private afterEvent(changed: boolean): void {\n this.syncAnimationTick();\n if (!changed) return;\n this.requestEventRender();\n }\n\n private requestEventRender(): void {\n if (!this.isStreaming()) {\n this.requestRender?.();\n return;\n }\n if (this.renderThrottleTimer) return;\n this.renderThrottleTimer = setTimeout(() => {\n this.renderThrottleTimer = undefined;\n this.requestRender?.();\n }, STREAMING_RENDER_THROTTLE_MS);\n this.renderThrottleTimer.unref?.();\n }\n}\n\nfunction setEditorPlaceholder(\n editor: EditorComponent,\n placeholder: string | undefined,\n): void {\n const candidate = editor as EditorComponent & {\n setPlaceholder?: (value: string | undefined) => void;\n };\n candidate.setPlaceholder?.(placeholder);\n}\n\nfunction setEditorBorderColor(\n editor: EditorComponent,\n borderColor: (text: string) => string,\n): void {\n const candidate = editor as EditorComponent & {\n borderColor?: (text: string) => string;\n };\n if (candidate.borderColor !== undefined) candidate.borderColor = borderColor;\n}\n\nfunction setEditorFocused(editor: EditorComponent, focused: boolean): void {\n const candidate = editor as EditorComponent & Partial<Focusable>;\n if (\"focused\" in candidate) candidate.focused = focused;\n}\n\nfunction matchesKey(\n data: string,\n key: \"enter\" | \"backspace\" | \"escape\" | \"ctrl+f\" | \"alt+up\",\n): boolean {\n if (key === \"enter\" && (data === \"\\r\" || data === \"\\n\")) return true;\n if (key === \"backspace\" && (data === \"\\x7f\" || data === \"\\b\")) return true;\n if (key === \"escape\" && data === \"\\x1b\") return true;\n if (key === \"ctrl+f\" && data === \"\\x06\") return true;\n return tuiMatchesKey(data, key);\n}\n\nfunction parseBashInput(text: string):\n | { command: string; excludeFromContext: boolean }\n | undefined {\n if (!text.startsWith(\"!\")) return undefined;\n const excludeFromContext = text.startsWith(\"!!\");\n const command = text.slice(excludeFromContext ? 2 : 1).trim();\n return { command, excludeFromContext };\n}\n\nfunction isSharedLiveChatEvent(type: string): boolean {\n return (\n type === \"message_start\" ||\n type === \"message_update\" ||\n type === \"message_end\" ||\n type === \"tool_execution_start\" ||\n type === \"tool_execution_update\" ||\n type === \"tool_execution_end\"\n );\n}\n\nfunction cacheKey(parts: readonly CacheKeyPart[]): string {\n return JSON.stringify(parts);\n}\n\nfunction isChatMessageEntry<TExtraEntry extends ChatTranscriptEntryLike>(\n entry: ChatSessionHostEntry<TExtraEntry>,\n): entry is ChatMessageEntry {\n if (!(\"role\" in entry) || !(\"kind\" in entry)) return false;\n const candidate = entry as { role?: unknown; kind?: unknown; message?: unknown; text?: unknown };\n switch (candidate.kind) {\n case \"assistant\":\n return candidate.role === \"assistant\" && candidate.message !== undefined;\n case \"tool\":\n return candidate.role === \"tool\" && \"toolName\" in candidate && \"toolCallId\" in candidate && \"args\" in candidate;\n case \"bashExecution\":\n return candidate.role === \"tool\" && candidate.message !== undefined;\n case \"user\":\n return candidate.role === \"user\" && typeof candidate.text === \"string\";\n case \"custom\":\n return candidate.role === \"custom\" && candidate.message !== undefined;\n case \"branchSummary\":\n case \"compactionSummary\":\n return candidate.role === \"summary\" && candidate.message !== undefined;\n case \"system\":\n return candidate.role === \"system\" && candidate.message !== undefined;\n default:\n return false;\n }\n}\n\nfunction isMessageLike(message: unknown): message is { role?: unknown; content?: unknown } {\n return message !== null && typeof message === \"object\" && \"role\" in message;\n}\n\nfunction isUserMessageLike(\n message: unknown,\n): message is { role: \"user\"; content?: unknown } {\n return isMessageLike(message) && message.role === \"user\";\n}\n\nfunction userMessageSignature(text: string): string {\n return text.trim();\n}\n\nfunction assistantToolCallEvent(event: AgentSessionEvent): {\n type: \"tool_execution_start\";\n toolCallId: string;\n toolName: string;\n args: unknown;\n} | undefined {\n const assistantEvent = (event as {\n assistantMessageEvent?: {\n type?: unknown;\n contentIndex?: unknown;\n partial?: unknown;\n toolCall?: unknown;\n };\n }).assistantMessageEvent;\n const streamType = String(assistantEvent?.type ?? \"\");\n if (!streamType.startsWith(\"toolcall_\")) return undefined;\n const explicit = toolCallPayload(assistantEvent?.toolCall);\n if (explicit) return explicit;\n const contentIndex = typeof assistantEvent?.contentIndex === \"number\" ? assistantEvent.contentIndex : undefined;\n if (contentIndex === undefined) return undefined;\n const partial = assistantEvent?.partial;\n if (!isMessageLike(partial) || partial.role !== \"assistant\") return undefined;\n const content = partial.content;\n if (!Array.isArray(content)) return undefined;\n return toolCallPayload(content[contentIndex]);\n}\n\nfunction toolCallPayload(value: unknown): {\n type: \"tool_execution_start\";\n toolCallId: string;\n toolName: string;\n args: unknown;\n} | undefined {\n if (value === null || typeof value !== \"object\") return undefined;\n const candidate = value as { type?: unknown; id?: unknown; name?: unknown; arguments?: unknown };\n if (candidate.type !== \"toolCall\") return undefined;\n if (typeof candidate.id !== \"string\" || typeof candidate.name !== \"string\") return undefined;\n return {\n type: \"tool_execution_start\",\n toolCallId: candidate.id,\n toolName: candidate.name,\n args: candidate.arguments ?? {},\n };\n}\n\nfunction legacyToolStartEvent(event: AgentSessionEvent): {\n type: \"tool_execution_start\";\n toolCallId: string;\n toolName: string;\n args: unknown;\n} {\n const payload = event as { toolCallId?: unknown; name?: unknown; input?: unknown; args?: unknown };\n const toolName = typeof payload.name === \"string\" ? payload.name : \"tool\";\n const toolCallId =\n typeof payload.toolCallId === \"string\" ? payload.toolCallId : `live-${toolName}`;\n return {\n type: \"tool_execution_start\",\n toolCallId,\n toolName,\n args: payload.input ?? payload.args ?? {},\n };\n}\n\nfunction legacyToolResultEvent(event: AgentSessionEvent): {\n type: \"tool_execution_end\";\n toolCallId: string;\n toolName: string;\n result: unknown;\n isError: boolean;\n} {\n const payload = event as {\n toolCallId?: unknown;\n name?: unknown;\n output?: unknown;\n isError?: unknown;\n };\n const toolName = typeof payload.name === \"string\" ? payload.name : \"tool\";\n const toolCallId =\n typeof payload.toolCallId === \"string\" ? payload.toolCallId : `live-${toolName}`;\n const output = payload.output;\n return {\n type: \"tool_execution_end\",\n toolCallId,\n toolName,\n result:\n output !== null && typeof output === \"object\" && \"content\" in output\n ? output\n : { content: typeof output === \"string\" ? [{ type: \"text\", text: output }] : [] },\n isError: payload.isError === true,\n };\n}\n\nfunction legacyThinkingEvent(event: AgentSessionEvent): {\n type: \"message_update\";\n assistantMessageEvent: { type: \"thinking_delta\"; delta: string };\n message: { role: \"assistant\"; content: [] };\n} {\n const delta = String(\n (event as { delta?: unknown }).delta ??\n (event as { text?: unknown }).text ??\n \"\",\n );\n return {\n type: \"message_update\",\n assistantMessageEvent: { type: \"thinking_delta\", delta },\n message: { role: \"assistant\", content: [] },\n };\n}\n\nfunction extractMessageText(content: unknown): string {\n if (typeof content === \"string\") return content;\n if (!Array.isArray(content)) return \"\";\n const parts: string[] = [];\n for (const item of content) {\n if (item == null) continue;\n if (typeof item === \"string\") {\n parts.push(item);\n continue;\n }\n const obj = item as { type?: unknown; text?: unknown };\n if (typeof obj.text === \"string\") parts.push(obj.text);\n else if (obj.type === \"text\" && typeof obj.text === \"string\") parts.push(obj.text);\n }\n return parts.join(\"\");\n}\n\nfunction tailStreamingText(text: string): string {\n if (\n text.length <= STREAMING_TEXT_TAIL_CHARS &&\n text.split(\"\\n\").length <= STREAMING_TEXT_TAIL_LINES\n ) {\n return text;\n }\n const byChars = text.slice(-STREAMING_TEXT_TAIL_CHARS);\n const lines = byChars.split(\"\\n\");\n const tail =\n lines.length > STREAMING_TEXT_TAIL_LINES\n ? lines.slice(-STREAMING_TEXT_TAIL_LINES).join(\"\\n\")\n : byChars;\n return `[earlier streaming output hidden while attached]\\n\\n${tail.trimStart()}`;\n}\n\nfunction spinnerFrame(): string {\n const idx = Math.floor(Date.now() / 80) % SPINNER_FRAMES.length;\n return SPINNER_FRAMES[idx]!;\n}\n\nfunction stripAnsi(s: string): string {\n return s.replace(/\\x1B\\[[0-?]*[ -/]*[@-~]/g, \"\");\n}\n\nfunction errorMessage(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n}\n"]}
|