@averyyy/pi-coding-agent 0.84.4-piclient.1 → 0.85.1-piclient.1
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 +76 -1
- package/README.md +1 -1
- package/dist/bun/cli.d.ts +3 -1
- package/dist/bun/cli.d.ts.map +1 -1
- package/dist/bun/cli.js +3 -9
- package/dist/bun/cli.js.map +1 -1
- package/dist/bun/runtime-setup.d.ts +2 -0
- package/dist/bun/runtime-setup.d.ts.map +1 -0
- package/dist/bun/runtime-setup.js +9 -0
- package/dist/bun/runtime-setup.js.map +1 -0
- package/dist/bun/sandbox-env-setup.d.ts +2 -0
- package/dist/bun/sandbox-env-setup.d.ts.map +1 -0
- package/dist/bun/sandbox-env-setup.js +4 -0
- package/dist/bun/sandbox-env-setup.js.map +1 -0
- package/dist/bundle/chunks/anthropic-messages-VWZZOSJQ.js +6 -0
- package/dist/bundle/chunks/{azure-openai-responses-B2RCCN5N.js → azure-openai-responses-B467Y57F.js} +1 -1
- package/dist/bundle/chunks/bedrock-converse-stream.js +1 -1
- package/dist/bundle/chunks/{chunk-LRBSW3NQ.js → chunk-6WPJTKUF.js} +2 -2
- package/dist/bundle/chunks/chunk-7ZC4UXSL.js +2 -0
- package/dist/bundle/chunks/chunk-CLNPYIDP.js +42 -0
- package/dist/bundle/chunks/{chunk-MNAIPA3J.js → chunk-IDDQWTHI.js} +1 -1
- package/dist/bundle/chunks/{chunk-2KVJKXS2.js → chunk-U6ZMQKGD.js} +1 -1
- package/dist/bundle/chunks/chunk-USJZMAIR.js +2 -0
- package/dist/bundle/chunks/chunk-ZNXRLOMG.js +1641 -0
- package/dist/bundle/chunks/github-copilot.js +1 -1
- package/dist/bundle/chunks/{google-generative-ai-YMUPJBKR.js → google-generative-ai-Q2K7FBDI.js} +1 -1
- package/dist/bundle/chunks/{google-vertex-MPWMV4OF.js → google-vertex-7UJBF4S7.js} +1 -1
- package/dist/bundle/chunks/image-resize-worker.js +1 -1
- package/dist/bundle/chunks/{mistral-conversations-Q3AWZJAZ.js → mistral-conversations-4M6BZBX6.js} +1 -1
- package/dist/bundle/chunks/node-KG362ECQ.js +16 -0
- package/dist/bundle/chunks/node-TWVVAGPO.js +2 -0
- package/dist/bundle/chunks/openai-codex-responses-MERYAUSE.js +10 -0
- package/dist/bundle/chunks/{openai-completions-ERMU2SS7.js → openai-completions-EKZT2IH2.js} +3 -3
- package/dist/bundle/chunks/openai-responses-YZ6M7S4X.js +2 -0
- package/dist/bundle/chunks/{pi-messages-TPFH44NP.js → pi-messages-PML4SPVJ.js} +1 -1
- package/dist/bundle/cli.js +1 -1
- package/dist/bundle/index.js +1 -1
- package/dist/bundle/rpc-entry.js +1 -1
- package/dist/cli/config-selector.d.ts.map +1 -1
- package/dist/cli/config-selector.js +2 -1
- package/dist/cli/config-selector.js.map +1 -1
- package/dist/cli/setup.d.ts +2 -0
- package/dist/cli/setup.d.ts.map +1 -0
- package/dist/cli/setup.js +12 -0
- package/dist/cli/setup.js.map +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +2 -15
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -0
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +15 -7
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session.d.ts +5 -6
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +36 -8
- 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 +1 -1
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +1 -2
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/types.d.ts +8 -2
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/http-dispatcher.d.ts.map +1 -1
- package/dist/core/http-dispatcher.js +2 -0
- package/dist/core/http-dispatcher.js.map +1 -1
- package/dist/core/keybindings.d.ts +5 -0
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +4 -0
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/messages.d.ts +1 -1
- package/dist/core/messages.d.ts.map +1 -1
- package/dist/core/messages.js.map +1 -1
- package/dist/core/model-config.d.ts +15 -0
- package/dist/core/model-config.d.ts.map +1 -1
- package/dist/core/model-config.js +3 -0
- package/dist/core/model-config.js.map +1 -1
- package/dist/core/model-runtime.d.ts +1 -0
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +5 -2
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/pi-server-client.d.ts.map +1 -1
- package/dist/core/pi-server-client.js +26 -9
- package/dist/core/pi-server-client.js.map +1 -1
- package/dist/core/provider-composer.d.ts.map +1 -1
- package/dist/core/provider-composer.js +8 -2
- package/dist/core/provider-composer.js.map +1 -1
- package/dist/core/session-manager.d.ts +3 -2
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +40 -13
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/skills.d.ts +1 -1
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +4 -2
- package/dist/core/skills.js.map +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +8 -9
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +6 -6
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/edit.d.ts +1 -12
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +5 -163
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js +4 -55
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js +4 -60
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/ls.d.ts.map +1 -1
- package/dist/core/tools/ls.js +4 -49
- package/dist/core/tools/ls.js.map +1 -1
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +4 -120
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/renderers/bash.d.ts +12 -0
- package/dist/core/tools/renderers/bash.d.ts.map +1 -0
- package/dist/core/tools/renderers/bash.js +130 -0
- package/dist/core/tools/renderers/bash.js.map +1 -0
- package/dist/core/tools/renderers/edit.d.ts +23 -0
- package/dist/core/tools/renderers/edit.d.ts.map +1 -0
- package/dist/core/tools/renderers/edit.js +167 -0
- package/dist/core/tools/renderers/edit.js.map +1 -0
- package/dist/core/tools/renderers/find.d.ts +10 -0
- package/dist/core/tools/renderers/find.d.ts.map +1 -0
- package/dist/core/tools/renderers/find.js +64 -0
- package/dist/core/tools/renderers/find.js.map +1 -0
- package/dist/core/tools/renderers/grep.d.ts +10 -0
- package/dist/core/tools/renderers/grep.d.ts.map +1 -0
- package/dist/core/tools/renderers/grep.js +69 -0
- package/dist/core/tools/renderers/grep.js.map +1 -0
- package/dist/core/tools/renderers/index.d.ts +28 -0
- package/dist/core/tools/renderers/index.d.ts.map +1 -0
- package/dist/core/tools/renderers/index.js +47 -0
- package/dist/core/tools/renderers/index.js.map +1 -0
- package/dist/core/tools/renderers/ls.d.ts +10 -0
- package/dist/core/tools/renderers/ls.d.ts.map +1 -0
- package/dist/core/tools/renderers/ls.js +58 -0
- package/dist/core/tools/renderers/ls.js.map +1 -0
- package/dist/core/tools/renderers/read.d.ts +11 -0
- package/dist/core/tools/renderers/read.d.ts.map +1 -0
- package/dist/core/tools/renderers/read.js +129 -0
- package/dist/core/tools/renderers/read.js.map +1 -0
- package/dist/core/tools/renderers/write.d.ts +10 -0
- package/dist/core/tools/renderers/write.d.ts.map +1 -0
- package/dist/core/tools/renderers/write.js +153 -0
- package/dist/core/tools/renderers/write.js.map +1 -0
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js +5 -146
- package/dist/core/tools/write.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +4 -1
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/chat-viewport.d.ts +20 -0
- package/dist/modes/interactive/chat-viewport.d.ts.map +1 -0
- package/dist/modes/interactive/chat-viewport.js +28 -0
- package/dist/modes/interactive/chat-viewport.js.map +1 -0
- package/dist/modes/interactive/components/assistant-message.d.ts +1 -0
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +18 -10
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/custom-editor.d.ts +10 -1
- package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-editor.js +39 -1
- package/dist/modes/interactive/components/custom-editor.js.map +1 -1
- package/dist/modes/interactive/components/index.d.ts +1 -1
- package/dist/modes/interactive/components/index.d.ts.map +1 -1
- package/dist/modes/interactive/components/index.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +10 -19
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.js +21 -23
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +14 -10
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/status-indicator.d.ts +3 -1
- package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -1
- package/dist/modes/interactive/components/status-indicator.js +10 -3
- package/dist/modes/interactive/components/status-indicator.js.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.js +6 -6
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +21 -4
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +35 -33
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/trust-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/trust-selector.js +2 -2
- package/dist/modes/interactive/components/trust-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +9 -15
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +112 -84
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/session-share.d.ts.map +1 -1
- package/dist/modes/interactive/session-share.js +8 -12
- package/dist/modes/interactive/session-share.js.map +1 -1
- package/dist/modes/interactive/theme/dark.json +2 -1
- package/dist/modes/interactive/theme/light.json +2 -1
- package/dist/modes/interactive/theme/theme-controller.d.ts +1 -0
- package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme-controller.js +5 -0
- package/dist/modes/interactive/theme/theme-controller.js.map +1 -1
- package/dist/modes/interactive/theme/theme-json.d.ts +84 -0
- package/dist/modes/interactive/theme/theme-json.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme-json.js +130 -0
- package/dist/modes/interactive/theme/theme-json.js.map +1 -0
- package/dist/modes/interactive/theme/theme-schema.json +6 -2
- package/dist/modes/interactive/theme/theme.d.ts +14 -5
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +18 -119
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/interactive/tui-renderer.d.ts +21 -0
- package/dist/modes/interactive/tui-renderer.d.ts.map +1 -0
- package/dist/modes/interactive/tui-renderer.js +66 -0
- package/dist/modes/interactive/tui-renderer.js.map +1 -0
- package/dist/utils/exif-orientation.d.ts.map +1 -1
- package/dist/utils/exif-orientation.js +2 -3
- package/dist/utils/exif-orientation.js.map +1 -1
- package/dist/utils/tools-manager.d.ts +1 -0
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +41 -19
- package/dist/utils/tools-manager.js.map +1 -1
- package/docs/containerization.md +45 -0
- package/docs/development.md +19 -0
- package/docs/environment-variables.md +2 -0
- package/docs/extensions.md +5 -2
- package/docs/keybindings.md +5 -2
- package/docs/models.md +4 -1
- package/docs/rpc.md +1 -1
- package/docs/sdk.md +5 -0
- package/docs/settings.md +5 -5
- package/docs/skills.md +1 -1
- package/docs/terminal-setup.md +15 -0
- package/docs/themes.md +8 -6
- package/docs/tui.md +20 -1
- package/examples/README.md +3 -0
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/dynamic-resources/dynamic.json +2 -0
- package/examples/extensions/gondolin/package-lock.json +2 -2
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/examples/plugins/pi-example-plugin/README.md +38 -0
- package/examples/plugins/pi-example-plugin/package.json +10 -0
- package/examples/plugins/pi-example-plugin/src/contract.ts +13 -0
- package/examples/plugins/pi-example-plugin/src/session.ts +23 -0
- package/examples/plugins/pi-example-plugin/src/tui.ts +31 -0
- package/package.json +15 -8
- package/dist/bun/register-bedrock.d.ts +0 -2
- package/dist/bun/register-bedrock.d.ts.map +0 -1
- package/dist/bun/register-bedrock.js +0 -4
- package/dist/bun/register-bedrock.js.map +0 -1
- package/dist/bundle/chunks/anthropic-messages-JWX2WP65.js +0 -45
- package/dist/bundle/chunks/chunk-AP7VCR6I.js +0 -1633
- package/dist/bundle/chunks/chunk-JUUC5AZY.js +0 -2
- package/dist/bundle/chunks/openai-codex-responses-MJHX7NXI.js +0 -8
- package/dist/bundle/chunks/openai-responses-CP4VKB27.js +0 -2
- package/dist/bundle/client.js +0 -2
- package/dist/cli/experimental/auth.d.ts +0 -16
- package/dist/cli/experimental/auth.d.ts.map +0 -1
- package/dist/cli/experimental/auth.js +0 -13
- package/dist/cli/experimental/auth.js.map +0 -1
- package/dist/cli/experimental/cli.d.ts +0 -6
- package/dist/cli/experimental/cli.d.ts.map +0 -1
- package/dist/cli/experimental/cli.js +0 -5
- package/dist/cli/experimental/cli.js.map +0 -1
- package/dist/cli/experimental/command-options.d.ts +0 -17
- package/dist/cli/experimental/command-options.d.ts.map +0 -1
- package/dist/cli/experimental/command-options.js +0 -35
- package/dist/cli/experimental/command-options.js.map +0 -1
- package/dist/cli/experimental/command.d.ts +0 -63
- package/dist/cli/experimental/command.d.ts.map +0 -1
- package/dist/cli/experimental/command.js +0 -130
- package/dist/cli/experimental/command.js.map +0 -1
- package/dist/cli/experimental/commands/client.d.ts +0 -13
- package/dist/cli/experimental/commands/client.d.ts.map +0 -1
- package/dist/cli/experimental/commands/client.js +0 -25
- package/dist/cli/experimental/commands/client.js.map +0 -1
- package/dist/cli/experimental/commands/pi.d.ts +0 -15
- package/dist/cli/experimental/commands/pi.d.ts.map +0 -1
- package/dist/cli/experimental/commands/pi.js +0 -28
- package/dist/cli/experimental/commands/pi.js.map +0 -1
- package/dist/cli/experimental/commands/server.d.ts +0 -13
- package/dist/cli/experimental/commands/server.d.ts.map +0 -1
- package/dist/cli/experimental/commands/server.js +0 -25
- package/dist/cli/experimental/commands/server.js.map +0 -1
- package/dist/cli/experimental/transport-address.d.ts +0 -10
- package/dist/cli/experimental/transport-address.d.ts.map +0 -1
- package/dist/cli/experimental/transport-address.js +0 -38
- package/dist/cli/experimental/transport-address.js.map +0 -1
- package/dist/client/index.d.ts +0 -3
- package/dist/client/index.d.ts.map +0 -1
- package/dist/client/index.js +0 -3
- package/dist/client/index.js.map +0 -1
- package/dist/client/remote-session.d.ts +0 -53
- package/dist/client/remote-session.d.ts.map +0 -1
- package/dist/client/remote-session.js +0 -340
- package/dist/client/remote-session.js.map +0 -1
- package/dist/client/transcript.d.ts +0 -12
- package/dist/client/transcript.d.ts.map +0 -1
- package/dist/client/transcript.js +0 -98
- package/dist/client/transcript.js.map +0 -1
- package/dist/server/create-harness.d.ts +0 -26
- package/dist/server/create-harness.d.ts.map +0 -1
- package/dist/server/create-harness.js +0 -106
- package/dist/server/create-harness.js.map +0 -1
|
@@ -7,7 +7,7 @@ import * as fs from "node:fs";
|
|
|
7
7
|
import * as os from "node:os";
|
|
8
8
|
import * as path from "node:path";
|
|
9
9
|
import * as TuiLayouts from "@earendil-works/pi-tui";
|
|
10
|
-
import { CombinedAutocompleteProvider, Container, fuzzyFilter, getCapabilities, hyperlink, Markdown, matchesKey,
|
|
10
|
+
import { CombinedAutocompleteProvider, Container, fuzzyFilter, getCapabilities, hyperlink, Markdown, matchesKey, Spacer, setCapabilityOverrides, setKeybindings, Text, TruncatedText, TuiAltScreen, TuiMainScreen, visibleWidth, } from "@earendil-works/pi-tui";
|
|
11
11
|
import chalk from "chalk";
|
|
12
12
|
import { spawn } from "child_process";
|
|
13
13
|
import { APP_NAME, APP_TITLE, CONFIG_DIR_NAME, getAgentDir, getAuthPath, getDebugLogPath, getDocsPath, VERSION, } from "../../config.js";
|
|
@@ -27,19 +27,20 @@ import { formatMissingSessionCwdPrompt, MissingSessionCwdError } from "../../cor
|
|
|
27
27
|
import { SessionManager, sessionEntryToContextMessages } from "../../core/session-manager.js";
|
|
28
28
|
import { BUILTIN_SLASH_COMMANDS } from "../../core/slash-commands.js";
|
|
29
29
|
import { isInstallTelemetryEnabled } from "../../core/telemetry.js";
|
|
30
|
+
import { withBuiltInRenderers } from "../../core/tools/renderers/index.js";
|
|
30
31
|
import { hasTrustRequiringProjectResources, ProjectTrustStore } from "../../core/trust-manager.js";
|
|
31
32
|
import { getUsageCostBreakdown } from "../../core/usage-totals.js";
|
|
32
33
|
import { getChangelogPath, getNewEntries, normalizeChangelogLinks, parseChangelog } from "../../utils/changelog.js";
|
|
33
34
|
import { copyToClipboard, readClipboardText } from "../../utils/clipboard.js";
|
|
34
35
|
import { extensionForImageMimeType, readClipboardImage } from "../../utils/clipboard-image.js";
|
|
35
36
|
import { parseGitUrl } from "../../utils/git.js";
|
|
36
|
-
import { openBrowser } from "../../utils/open-browser.js";
|
|
37
37
|
import { getCwdRelativePath } from "../../utils/paths.js";
|
|
38
38
|
import { getPiUserAgent } from "../../utils/pi-user-agent.js";
|
|
39
39
|
import { killTrackedDetachedChildren } from "../../utils/shell.js";
|
|
40
40
|
import { loadAllHighlightLanguages } from "../../utils/syntax-highlight.js";
|
|
41
41
|
import { ensureTool } from "../../utils/tools-manager.js";
|
|
42
42
|
import { checkForNewPiVersion } from "../../utils/version-check.js";
|
|
43
|
+
import { createChatViewport } from "./chat-viewport.js";
|
|
43
44
|
import { ArminComponent } from "./components/armin.js";
|
|
44
45
|
import { AssistantMessageComponent } from "./components/assistant-message.js";
|
|
45
46
|
import { BashExecutionComponent } from "./components/bash-execution.js";
|
|
@@ -77,6 +78,14 @@ import { getModelSearchText } from "./model-search.js";
|
|
|
77
78
|
import { shareSession } from "./session-share.js";
|
|
78
79
|
import { getAvailableThemes, getAvailableThemesWithPaths, getEditorTheme, getMarkdownTheme, getThemeByName, onThemeChange, setRegisteredThemes, stopThemeWatcher, Theme, theme, } from "./theme/theme.js";
|
|
79
80
|
import { InteractiveThemeController } from "./theme/theme-controller.js";
|
|
81
|
+
import { createInteractiveTui, createInteractiveTuiReference } from "./tui-renderer.js";
|
|
82
|
+
export { createInteractiveTui, createInteractiveTuiReference } from "./tui-renderer.js";
|
|
83
|
+
function isWorkingStatusEditor(editor) {
|
|
84
|
+
return ("embedWorkingStatus" in editor &&
|
|
85
|
+
editor.embedWorkingStatus === true &&
|
|
86
|
+
"setWorkingStatusIndicator" in editor &&
|
|
87
|
+
typeof editor.setWorkingStatusIndicator === "function");
|
|
88
|
+
}
|
|
80
89
|
function isExpandable(obj) {
|
|
81
90
|
return typeof obj === "object" && obj !== null && "setExpanded" in obj && typeof obj.setExpanded === "function";
|
|
82
91
|
}
|
|
@@ -178,61 +187,6 @@ function formatLoginProviderCompletionDescription(provider) {
|
|
|
178
187
|
const authTypes = provider.authTypes.map(formatAuthSelectorProviderType).join("/");
|
|
179
188
|
return provider.name === provider.id ? authTypes : `${provider.name} · ${authTypes}`;
|
|
180
189
|
}
|
|
181
|
-
/** Composition root for selecting the interactive terminal renderer. */
|
|
182
|
-
export function createInteractiveTui(options) {
|
|
183
|
-
const terminal = options.terminal ?? new ProcessTerminal();
|
|
184
|
-
if (options.tuiMode === "fullscreen") {
|
|
185
|
-
const styleSearchMatch = (text) => theme.bg("searchMatchBg", theme.fg("searchMatchText", text));
|
|
186
|
-
return new TuiAltScreen(terminal, options.showHardwareCursor, options.logDirectory, {
|
|
187
|
-
searchMatchStyle: (text) => theme.underline(styleSearchMatch(text)),
|
|
188
|
-
searchCurrentMatchStyle: (text) => theme.bold(theme.inverse(styleSearchMatch(text))),
|
|
189
|
-
openUrl: openBrowser,
|
|
190
|
-
onRightClickPaste: options.onRightClickPaste,
|
|
191
|
-
copyOnSelect: options.fullscreenCopyOnSelect,
|
|
192
|
-
copySelection: async (text) => {
|
|
193
|
-
try {
|
|
194
|
-
await copyToClipboard(text);
|
|
195
|
-
return true;
|
|
196
|
-
}
|
|
197
|
-
catch {
|
|
198
|
-
return false;
|
|
199
|
-
}
|
|
200
|
-
},
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
return new TuiMainScreen(terminal, options.showHardwareCursor, options.logDirectory);
|
|
204
|
-
}
|
|
205
|
-
/** Stable reference for components while InteractiveMode replaces the active renderer. */
|
|
206
|
-
export function createInteractiveTuiReference(getTui) {
|
|
207
|
-
return new Proxy({}, {
|
|
208
|
-
get: (_target, property) => {
|
|
209
|
-
const tui = getTui();
|
|
210
|
-
const value = Reflect.get(tui, property, tui);
|
|
211
|
-
if (typeof value !== "function")
|
|
212
|
-
return value;
|
|
213
|
-
let methodTui = tui;
|
|
214
|
-
let method = value;
|
|
215
|
-
return (...args) => {
|
|
216
|
-
const currentTui = getTui();
|
|
217
|
-
if (currentTui !== methodTui) {
|
|
218
|
-
const currentMethod = Reflect.get(currentTui, property, currentTui);
|
|
219
|
-
if (typeof currentMethod !== "function") {
|
|
220
|
-
throw new TypeError(`TUI property ${String(property)} is not callable`);
|
|
221
|
-
}
|
|
222
|
-
methodTui = currentTui;
|
|
223
|
-
method = currentMethod;
|
|
224
|
-
}
|
|
225
|
-
return Reflect.apply(method, methodTui, args);
|
|
226
|
-
};
|
|
227
|
-
},
|
|
228
|
-
set: (_target, property, value) => {
|
|
229
|
-
const tui = getTui();
|
|
230
|
-
return Reflect.set(tui, property, value, tui);
|
|
231
|
-
},
|
|
232
|
-
has: (_target, property) => Reflect.has(getTui(), property),
|
|
233
|
-
getPrototypeOf: () => Reflect.getPrototypeOf(getTui()),
|
|
234
|
-
});
|
|
235
|
-
}
|
|
236
190
|
export class InteractiveMode {
|
|
237
191
|
runtimeHost;
|
|
238
192
|
renderer;
|
|
@@ -264,11 +218,12 @@ export class InteractiveMode {
|
|
|
264
218
|
onInputCallback;
|
|
265
219
|
pendingUserInputs = [];
|
|
266
220
|
activeStatusIndicator = undefined;
|
|
221
|
+
activeWorkingIndicatorEmbedded = false;
|
|
267
222
|
idleStatus = new IdleStatus();
|
|
268
223
|
workingMessage = undefined;
|
|
269
224
|
workingVisible = true;
|
|
270
225
|
workingIndicatorOptions = undefined;
|
|
271
|
-
defaultWorkingMessage = "Working
|
|
226
|
+
defaultWorkingMessage = "Working";
|
|
272
227
|
defaultHiddenThinkingLabel = "Thinking...";
|
|
273
228
|
hiddenThinkingLabel = this.defaultHiddenThinkingLabel;
|
|
274
229
|
lastSigintTime = 0;
|
|
@@ -391,6 +346,7 @@ export class InteractiveMode {
|
|
|
391
346
|
this.defaultEditor = new CustomEditor(this.ui, getEditorTheme(), this.keybindings, {
|
|
392
347
|
paddingX: editorPaddingX,
|
|
393
348
|
autocompleteMaxVisible,
|
|
349
|
+
embedWorkingStatus: true,
|
|
394
350
|
});
|
|
395
351
|
this.editor = this.defaultEditor;
|
|
396
352
|
this.editorContainer = new Container();
|
|
@@ -662,25 +618,20 @@ export class InteractiveMode {
|
|
|
662
618
|
}
|
|
663
619
|
// Keep one component tree and remount it when changing renderers.
|
|
664
620
|
this.renderWidgets(); // Initialize with default spacer
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
621
|
+
const viewport = createChatViewport({
|
|
622
|
+
document: this.documentContainer,
|
|
623
|
+
pendingMessages: this.pendingMessagesContainer,
|
|
624
|
+
status: this.statusContainer,
|
|
625
|
+
widgetsAbove: this.widgetContainerAbove,
|
|
626
|
+
editor: this.editorContainer,
|
|
627
|
+
widgetsBelow: this.widgetContainerBelow,
|
|
628
|
+
footer: this.footerContainer,
|
|
669
629
|
scrollbar: this.settingsManager.getFullscreenScrollbar(),
|
|
670
|
-
|
|
630
|
+
scrollbarTrackStyle: (text) => theme.fg("scrollbarTrack", text),
|
|
631
|
+
scrollbarThumbStyle: (text) => theme.fg("scrollbarThumb", text),
|
|
671
632
|
});
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
{ component: this.statusContainer, shrink: 1, minSize: 0 },
|
|
675
|
-
{ component: this.widgetContainerAbove, shrink: 1, minSize: 0 },
|
|
676
|
-
{ component: this.editorContainer, shrink: 1, minSize: 3 },
|
|
677
|
-
{ component: this.widgetContainerBelow, shrink: 1, minSize: 0 },
|
|
678
|
-
{ component: this.footerContainer, shrink: 1, minSize: 1 },
|
|
679
|
-
]);
|
|
680
|
-
this.fullscreenLayoutRoot = new TuiLayouts.VStack([
|
|
681
|
-
{ component: this.transcriptScrollView, basis: 0, grow: 1, shrink: 1, minSize: 1 },
|
|
682
|
-
{ component: dock, basis: "auto", grow: 0, shrink: 1, minSize: 1 },
|
|
683
|
-
]);
|
|
633
|
+
this.transcriptScrollView = viewport.transcript;
|
|
634
|
+
this.fullscreenLayoutRoot = viewport.root;
|
|
684
635
|
this.mountInteractiveTui(this.renderer, [
|
|
685
636
|
this.documentContainer,
|
|
686
637
|
this.pendingMessagesContainer,
|
|
@@ -1592,8 +1543,12 @@ export class InteractiveMode {
|
|
|
1592
1543
|
/**
|
|
1593
1544
|
* Get a registered tool definition by name (for custom rendering).
|
|
1594
1545
|
*/
|
|
1546
|
+
/**
|
|
1547
|
+
* Extension-registered definition, falling back to the built-in one. The renderer components take
|
|
1548
|
+
* whatever this returns, so they never reach into the tool registry themselves.
|
|
1549
|
+
*/
|
|
1595
1550
|
getRegisteredToolDefinition(toolName) {
|
|
1596
|
-
return this.session.getToolDefinition(toolName);
|
|
1551
|
+
return withBuiltInRenderers(toolName, this.session.getToolDefinition(toolName));
|
|
1597
1552
|
}
|
|
1598
1553
|
getMarkdownTransformers() {
|
|
1599
1554
|
return [this.mermaidMarkdownTransformer, ...this.session.extensionRunner.getMarkdownTransformers()];
|
|
@@ -1663,26 +1618,59 @@ export class InteractiveMode {
|
|
|
1663
1618
|
this.footerDataProvider.setExtensionStatus(key, text);
|
|
1664
1619
|
this.ui.requestRender();
|
|
1665
1620
|
}
|
|
1621
|
+
setEditorWorkingStatusIndicator(indicator) {
|
|
1622
|
+
this.defaultEditor.setWorkingStatusIndicator(undefined);
|
|
1623
|
+
if (!isWorkingStatusEditor(this.editor))
|
|
1624
|
+
return false;
|
|
1625
|
+
this.editor.setWorkingStatusIndicator(indicator);
|
|
1626
|
+
return true;
|
|
1627
|
+
}
|
|
1666
1628
|
showStatusIndicator(indicator) {
|
|
1667
1629
|
this.activeStatusIndicator?.dispose();
|
|
1668
1630
|
this.activeStatusIndicator = indicator;
|
|
1631
|
+
this.activeWorkingIndicatorEmbedded = false;
|
|
1669
1632
|
this.statusContainer.clear();
|
|
1633
|
+
this.setEditorWorkingStatusIndicator(undefined);
|
|
1634
|
+
if (indicator instanceof WorkingStatusIndicator && this.setEditorWorkingStatusIndicator(indicator)) {
|
|
1635
|
+
this.activeWorkingIndicatorEmbedded = true;
|
|
1636
|
+
return;
|
|
1637
|
+
}
|
|
1670
1638
|
this.statusContainer.addChild(indicator);
|
|
1671
1639
|
}
|
|
1672
1640
|
clearStatusIndicator(kind) {
|
|
1673
1641
|
if (kind && this.activeStatusIndicator?.kind !== kind) {
|
|
1674
1642
|
return;
|
|
1675
1643
|
}
|
|
1676
|
-
const
|
|
1677
|
-
this.
|
|
1644
|
+
const clearedIndicator = this.activeStatusIndicator;
|
|
1645
|
+
const clearedIndicatorWasEmbedded = clearedIndicator?.kind === "working" && this.activeWorkingIndicatorEmbedded;
|
|
1646
|
+
clearedIndicator?.dispose();
|
|
1678
1647
|
this.activeStatusIndicator = undefined;
|
|
1648
|
+
this.activeWorkingIndicatorEmbedded = false;
|
|
1679
1649
|
this.statusContainer.clear();
|
|
1680
|
-
|
|
1650
|
+
this.setEditorWorkingStatusIndicator(undefined);
|
|
1651
|
+
if (clearedIndicator &&
|
|
1652
|
+
!clearedIndicatorWasEmbedded &&
|
|
1653
|
+
this.options.tuiMode === "regular" &&
|
|
1654
|
+
this.ui.getClearOnShrink()) {
|
|
1681
1655
|
this.statusContainer.addChild(this.idleStatus);
|
|
1682
1656
|
}
|
|
1683
1657
|
}
|
|
1684
1658
|
showWorkingStatusIndicator() {
|
|
1685
|
-
|
|
1659
|
+
const colorFn = isWorkingStatusEditor(this.editor)
|
|
1660
|
+
? (text) => (this.editor.borderColor ?? theme.getThinkingBorderColor(this.session.thinkingLevel || "off"))(text)
|
|
1661
|
+
: undefined;
|
|
1662
|
+
this.showStatusIndicator(new WorkingStatusIndicator(this.ui, this.workingMessage ?? this.defaultWorkingMessage, this.workingIndicatorOptions, colorFn));
|
|
1663
|
+
}
|
|
1664
|
+
restoreWorkingStatusIndicatorIfStreaming() {
|
|
1665
|
+
if (!this.session.isStreaming) {
|
|
1666
|
+
return;
|
|
1667
|
+
}
|
|
1668
|
+
if (this.workingVisible && this.activeStatusIndicator?.kind !== "working") {
|
|
1669
|
+
this.showWorkingStatusIndicator();
|
|
1670
|
+
}
|
|
1671
|
+
if (this.settingsManager.getShowTerminalProgress()) {
|
|
1672
|
+
this.ui.terminal.setProgress(true);
|
|
1673
|
+
}
|
|
1686
1674
|
}
|
|
1687
1675
|
setWorkingVisible(visible) {
|
|
1688
1676
|
this.workingVisible = visible;
|
|
@@ -2154,6 +2142,13 @@ export class InteractiveMode {
|
|
|
2154
2142
|
this.editor = this.defaultEditor;
|
|
2155
2143
|
}
|
|
2156
2144
|
this.editorContainer.addChild(this.editor);
|
|
2145
|
+
if (this.activeStatusIndicator instanceof WorkingStatusIndicator) {
|
|
2146
|
+
this.statusContainer.clear();
|
|
2147
|
+
this.activeWorkingIndicatorEmbedded = this.setEditorWorkingStatusIndicator(this.activeStatusIndicator);
|
|
2148
|
+
if (!this.activeWorkingIndicatorEmbedded) {
|
|
2149
|
+
this.statusContainer.addChild(this.activeStatusIndicator);
|
|
2150
|
+
}
|
|
2151
|
+
}
|
|
2157
2152
|
this.ui.setFocus(this.editor);
|
|
2158
2153
|
this.ui.requestRender();
|
|
2159
2154
|
}
|
|
@@ -2695,6 +2690,7 @@ export class InteractiveMode {
|
|
|
2695
2690
|
for (const [, component] of this.pendingTools.entries()) {
|
|
2696
2691
|
component.setArgsComplete();
|
|
2697
2692
|
}
|
|
2693
|
+
this.maybeShowAssistantDiagnostics(this.streamingMessage);
|
|
2698
2694
|
this.maybeShowCacheMissNotice(this.streamingMessage);
|
|
2699
2695
|
}
|
|
2700
2696
|
this.streamingComponent = undefined;
|
|
@@ -2739,10 +2735,6 @@ export class InteractiveMode {
|
|
|
2739
2735
|
break;
|
|
2740
2736
|
}
|
|
2741
2737
|
case "agent_end":
|
|
2742
|
-
if (this.settingsManager.getShowTerminalProgress()) {
|
|
2743
|
-
this.ui.terminal.setProgress(false);
|
|
2744
|
-
}
|
|
2745
|
-
this.clearStatusIndicator("working");
|
|
2746
2738
|
if (this.streamingComponent) {
|
|
2747
2739
|
this.chatContainer.removeChild(this.streamingComponent);
|
|
2748
2740
|
this.streamingComponent = undefined;
|
|
@@ -2752,6 +2744,10 @@ export class InteractiveMode {
|
|
|
2752
2744
|
this.ui.requestRender();
|
|
2753
2745
|
break;
|
|
2754
2746
|
case "agent_settled":
|
|
2747
|
+
if (this.settingsManager.getShowTerminalProgress()) {
|
|
2748
|
+
this.ui.terminal.setProgress(false);
|
|
2749
|
+
}
|
|
2750
|
+
this.clearStatusIndicator("working");
|
|
2755
2751
|
await this.checkShutdownRequested();
|
|
2756
2752
|
break;
|
|
2757
2753
|
case "compaction_start": {
|
|
@@ -2811,6 +2807,7 @@ export class InteractiveMode {
|
|
|
2811
2807
|
this.chatContainer.addChild(new Text(theme.fg("error", event.errorMessage), 1, 0));
|
|
2812
2808
|
}
|
|
2813
2809
|
}
|
|
2810
|
+
this.restoreWorkingStatusIndicatorIfStreaming();
|
|
2814
2811
|
void this.flushCompactionQueue({ willRetry: event.willRetry });
|
|
2815
2812
|
this.ui.requestRender();
|
|
2816
2813
|
break;
|
|
@@ -2836,6 +2833,7 @@ export class InteractiveMode {
|
|
|
2836
2833
|
if (!event.success) {
|
|
2837
2834
|
this.showError(`Retry failed after ${event.attempt} attempts: ${event.finalError || "Unknown error"}`);
|
|
2838
2835
|
}
|
|
2836
|
+
this.restoreWorkingStatusIndicatorIfStreaming();
|
|
2839
2837
|
this.ui.requestRender();
|
|
2840
2838
|
break;
|
|
2841
2839
|
}
|
|
@@ -3058,6 +3056,7 @@ export class InteractiveMode {
|
|
|
3058
3056
|
}
|
|
3059
3057
|
}
|
|
3060
3058
|
if (message.stopReason !== "aborted" && message.stopReason !== "error") {
|
|
3059
|
+
this.maybeShowAssistantDiagnostics(message);
|
|
3061
3060
|
const miss = cacheMisses.get(message);
|
|
3062
3061
|
if (miss)
|
|
3063
3062
|
this.addCacheMissNotice(miss);
|
|
@@ -3114,6 +3113,32 @@ export class InteractiveMode {
|
|
|
3114
3113
|
this.chatContainer.addChild(new Spacer(1));
|
|
3115
3114
|
this.chatContainer.addChild(new Text(theme.fg("warning", `${label}: ${formatTokens(tokens)} tokens billed${cost}`), 1, 0));
|
|
3116
3115
|
}
|
|
3116
|
+
maybeShowAssistantDiagnostics(message) {
|
|
3117
|
+
if (!this.settingsManager.getShowCacheMissNotices())
|
|
3118
|
+
return;
|
|
3119
|
+
for (const diagnostic of message.diagnostics ?? []) {
|
|
3120
|
+
if (diagnostic.type !== "anthropic_input_transformations")
|
|
3121
|
+
continue;
|
|
3122
|
+
const transformations = diagnostic.details?.transformations;
|
|
3123
|
+
if (!Array.isArray(transformations))
|
|
3124
|
+
continue;
|
|
3125
|
+
const dropped = transformations.flatMap((transformation) => {
|
|
3126
|
+
if (typeof transformation !== "object" || transformation === null)
|
|
3127
|
+
return [];
|
|
3128
|
+
const details = transformation;
|
|
3129
|
+
if (details.type !== "thinking_dropped")
|
|
3130
|
+
return [];
|
|
3131
|
+
const reason = typeof details.reason === "string" ? details.reason : "unknown reason";
|
|
3132
|
+
const location = typeof details.path === "string" ? ` at ${details.path}` : "";
|
|
3133
|
+
return [`${reason}${location}`];
|
|
3134
|
+
});
|
|
3135
|
+
if (dropped.length === 0)
|
|
3136
|
+
continue;
|
|
3137
|
+
const noun = dropped.length === 1 ? "thinking block" : `${dropped.length} thinking blocks`;
|
|
3138
|
+
this.chatContainer.addChild(new Spacer(1));
|
|
3139
|
+
this.chatContainer.addChild(new Text(theme.fg("warning", `Anthropic dropped ${noun}: ${dropped.join("; ")}`), 1, 0));
|
|
3140
|
+
}
|
|
3141
|
+
}
|
|
3117
3142
|
/**
|
|
3118
3143
|
* Show a transcript notice when a completed assistant message paid for a
|
|
3119
3144
|
* significant cache miss. Only states observable facts: the miss itself,
|
|
@@ -3411,6 +3436,9 @@ export class InteractiveMode {
|
|
|
3411
3436
|
const level = this.session.thinkingLevel || "off";
|
|
3412
3437
|
this.editor.borderColor = theme.getThinkingBorderColor(level);
|
|
3413
3438
|
}
|
|
3439
|
+
if (this.activeStatusIndicator?.kind === "working") {
|
|
3440
|
+
this.activeStatusIndicator.invalidate();
|
|
3441
|
+
}
|
|
3414
3442
|
this.ui.requestRender();
|
|
3415
3443
|
}
|
|
3416
3444
|
cycleThinkingLevel() {
|