@tomsun28/pizza 0.1.0 → 0.1.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/README.md +20 -143
- package/README.zh-CN.md +36 -0
- package/dist/bun/cli.d.ts +2 -0
- package/dist/bun/cli.js +6 -0
- package/dist/bun/register-bedrock.d.ts +1 -0
- package/dist/bun/register-bedrock.js +3 -0
- package/dist/cli/args.d.ts +48 -0
- package/dist/cli/args.js +330 -0
- package/dist/cli/config-selector.d.ts +13 -0
- package/dist/cli/config-selector.js +30 -0
- package/dist/cli/file-processor.d.ts +14 -0
- package/dist/cli/file-processor.js +82 -0
- package/dist/cli/initial-message.d.ts +17 -0
- package/dist/cli/initial-message.js +21 -0
- package/dist/cli/list-models.d.ts +8 -0
- package/dist/cli/list-models.js +96 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +68 -0
- package/dist/config.d.ts +79 -0
- package/dist/config.js +223 -0
- package/dist/core/agent/index.d.ts +6 -0
- package/dist/core/agent/index.js +6 -0
- package/dist/core/agent/types.d.ts +202 -0
- package/dist/core/agent/types.js +51 -0
- package/dist/core/auth-storage.d.ts +135 -0
- package/dist/core/auth-storage.js +417 -0
- package/dist/core/bash-executor.d.ts +31 -0
- package/dist/core/bash-executor.js +107 -0
- package/dist/core/compaction/branch-summarization.d.ts +87 -0
- package/dist/core/compaction/branch-summarization.js +242 -0
- package/dist/core/compaction/compaction-engine.d.ts +40 -0
- package/dist/core/compaction/compaction-engine.js +292 -0
- package/dist/core/compaction/compaction.d.ts +106 -0
- package/dist/core/compaction/compaction.js +295 -0
- package/dist/core/compaction/index.d.ts +7 -0
- package/dist/core/compaction/index.js +7 -0
- package/dist/core/compaction/utils.d.ts +37 -0
- package/dist/core/compaction/utils.js +152 -0
- package/dist/core/defaults.d.ts +2 -0
- package/dist/core/defaults.js +1 -0
- package/dist/core/diagnostics.d.ts +14 -0
- package/dist/core/diagnostics.js +1 -0
- package/dist/core/event-bus.d.ts +8 -0
- package/dist/core/event-bus.js +24 -0
- package/dist/core/event-store/events.d.ts +465 -0
- package/dist/core/event-store/events.js +6 -0
- package/dist/core/event-store/index.d.ts +10 -0
- package/dist/core/event-store/index.js +10 -0
- package/dist/core/event-store/sqlite-store.d.ts +27 -0
- package/dist/core/event-store/sqlite-store.js +275 -0
- package/dist/core/event-store/store.d.ts +91 -0
- package/dist/core/event-store/store.js +7 -0
- package/dist/core/event-store/thread-scoped-store.d.ts +29 -0
- package/dist/core/event-store/thread-scoped-store.js +50 -0
- package/dist/core/event-store/types.d.ts +70 -0
- package/dist/core/event-store/types.js +7 -0
- package/dist/core/event-store/workspace.d.ts +37 -0
- package/dist/core/event-store/workspace.js +71 -0
- package/dist/core/exec.d.ts +28 -0
- package/dist/core/exec.js +74 -0
- package/dist/core/export-html/ansi-to-html.d.ts +21 -0
- package/dist/core/export-html/ansi-to-html.js +248 -0
- package/dist/core/export-html/index.d.ts +29 -0
- package/dist/core/export-html/index.js +186 -0
- package/dist/core/export-html/template.css +1017 -0
- package/dist/core/export-html/template.html +55 -0
- package/dist/core/export-html/template.js +1742 -0
- package/dist/core/export-html/tool-renderer.d.ts +39 -0
- package/dist/core/export-html/tool-renderer.js +94 -0
- package/dist/core/export-html/vendor/highlight.min.js +1213 -0
- package/dist/core/export-html/vendor/marked.min.js +6 -0
- package/dist/core/extensions/index.d.ts +12 -0
- package/dist/core/extensions/index.js +9 -0
- package/dist/core/extensions/loader.d.ts +24 -0
- package/dist/core/extensions/loader.js +492 -0
- package/dist/core/extensions/runner.d.ts +167 -0
- package/dist/core/extensions/runner.js +898 -0
- package/dist/core/extensions/session-context.d.ts +67 -0
- package/dist/core/extensions/session-context.js +272 -0
- package/dist/core/extensions/types.d.ts +1147 -0
- package/dist/core/extensions/types.js +44 -0
- package/dist/core/extensions/wrapper.d.ts +19 -0
- package/dist/core/extensions/wrapper.js +21 -0
- package/dist/core/footer-data-provider.d.ts +47 -0
- package/dist/core/footer-data-provider.js +321 -0
- package/dist/core/goal/index.d.ts +3 -0
- package/dist/core/goal/index.js +1 -0
- package/dist/core/goal/scheduler.d.ts +83 -0
- package/dist/core/goal/scheduler.js +154 -0
- package/dist/core/goal/types.d.ts +182 -0
- package/dist/core/goal/types.js +11 -0
- package/dist/core/index.d.ts +8 -0
- package/dist/core/index.js +8 -0
- package/dist/core/intent/classifier.d.ts +53 -0
- package/dist/core/intent/classifier.js +353 -0
- package/dist/core/intent/index.d.ts +8 -0
- package/dist/core/intent/index.js +8 -0
- package/dist/core/intent/tool-adapter.d.ts +31 -0
- package/dist/core/intent/tool-adapter.js +168 -0
- package/dist/core/intent/types.d.ts +71 -0
- package/dist/core/intent/types.js +6 -0
- package/dist/core/keybindings.d.ts +297 -0
- package/dist/core/keybindings.js +250 -0
- package/dist/core/messages.d.ts +30 -0
- package/dist/core/messages.js +134 -0
- package/dist/core/model-registry.d.ts +131 -0
- package/dist/core/model-registry.js +634 -0
- package/dist/core/model-resolver.d.ts +109 -0
- package/dist/core/model-resolver.js +486 -0
- package/dist/core/output-guard.d.ts +5 -0
- package/dist/core/output-guard.js +58 -0
- package/dist/core/package-manager.d.ts +196 -0
- package/dist/core/package-manager.js +1873 -0
- package/dist/core/projection/boundary-inferrer.d.ts +58 -0
- package/dist/core/projection/boundary-inferrer.js +122 -0
- package/dist/core/projection/event-to-message.d.ts +35 -0
- package/dist/core/projection/event-to-message.js +253 -0
- package/dist/core/projection/goal-projection.d.ts +67 -0
- package/dist/core/projection/goal-projection.js +339 -0
- package/dist/core/projection/index.d.ts +13 -0
- package/dist/core/projection/index.js +13 -0
- package/dist/core/projection/session-manager.d.ts +100 -0
- package/dist/core/projection/session-manager.js +331 -0
- package/dist/core/projection/session-projection.d.ts +58 -0
- package/dist/core/projection/session-projection.js +257 -0
- package/dist/core/projection/task-history.d.ts +13 -0
- package/dist/core/projection/task-history.js +61 -0
- package/dist/core/projection/timeline-projection.d.ts +82 -0
- package/dist/core/projection/timeline-projection.js +276 -0
- package/dist/core/projection/types.d.ts +69 -0
- package/dist/core/projection/types.js +6 -0
- package/dist/core/prompt-templates.d.ts +51 -0
- package/dist/core/prompt-templates.js +249 -0
- package/dist/core/resolve-config-value.d.ts +22 -0
- package/dist/core/resolve-config-value.js +125 -0
- package/dist/core/resource-loader.d.ts +193 -0
- package/dist/core/resource-loader.js +685 -0
- package/dist/core/runtime/ai-client.d.ts +12 -0
- package/dist/core/runtime/ai-client.js +153 -0
- package/dist/core/runtime/checkpoint.d.ts +12 -0
- package/dist/core/runtime/checkpoint.js +78 -0
- package/dist/core/runtime/index.d.ts +12 -0
- package/dist/core/runtime/index.js +12 -0
- package/dist/core/runtime/llm-types.d.ts +99 -0
- package/dist/core/runtime/llm-types.js +6 -0
- package/dist/core/runtime/local-runtime.d.ts +23 -0
- package/dist/core/runtime/local-runtime.js +59 -0
- package/dist/core/runtime/policies.d.ts +72 -0
- package/dist/core/runtime/policies.js +37 -0
- package/dist/core/runtime/reactor.d.ts +213 -0
- package/dist/core/runtime/reactor.js +992 -0
- package/dist/core/runtime/runtime.d.ts +191 -0
- package/dist/core/runtime/runtime.js +449 -0
- package/dist/core/runtime/types.d.ts +42 -0
- package/dist/core/runtime/types.js +1 -0
- package/dist/core/sdk.d.ts +12 -0
- package/dist/core/sdk.js +10 -0
- package/dist/core/session-context-builder.d.ts +9 -0
- package/dist/core/session-context-builder.js +87 -0
- package/dist/core/session-cwd.d.ts +18 -0
- package/dist/core/session-cwd.js +36 -0
- package/dist/core/session-facade-factory.d.ts +79 -0
- package/dist/core/session-facade-factory.js +460 -0
- package/dist/core/session-facade.d.ts +57 -0
- package/dist/core/session-facade.js +91 -0
- package/dist/core/session-listing.d.ts +30 -0
- package/dist/core/session-listing.js +168 -0
- package/dist/core/session-reader.d.ts +19 -0
- package/dist/core/session-reader.js +101 -0
- package/dist/core/session-ref.d.ts +7 -0
- package/dist/core/session-ref.js +25 -0
- package/dist/core/session-services.d.ts +51 -0
- package/dist/core/session-services.js +90 -0
- package/dist/core/session-stats.d.ts +43 -0
- package/dist/core/session-stats.js +41 -0
- package/dist/core/settings-manager.d.ts +236 -0
- package/dist/core/settings-manager.js +706 -0
- package/dist/core/skill-block-parser.d.ts +12 -0
- package/dist/core/skill-block-parser.js +15 -0
- package/dist/core/skills.d.ts +59 -0
- package/dist/core/skills.js +408 -0
- package/dist/core/slash-commands.d.ts +13 -0
- package/dist/core/slash-commands.js +17 -0
- package/dist/core/source-info.d.ts +17 -0
- package/dist/core/source-info.js +18 -0
- package/dist/core/system-prompt.d.ts +27 -0
- package/dist/core/system-prompt.js +179 -0
- package/dist/core/timings.d.ts +7 -0
- package/dist/core/timings.js +30 -0
- package/dist/core/tools/bash.d.ts +95 -0
- package/dist/core/tools/bash.js +513 -0
- package/dist/core/tools/builtin-commands.d.ts +75 -0
- package/dist/core/tools/builtin-commands.js +503 -0
- package/dist/core/tools/compat-commands.d.ts +12 -0
- package/dist/core/tools/compat-commands.js +1280 -0
- package/dist/core/tools/edit-diff.d.ts +59 -0
- package/dist/core/tools/edit-diff.js +263 -0
- package/dist/core/tools/edit.d.ts +49 -0
- package/dist/core/tools/edit.js +340 -0
- package/dist/core/tools/file-mutation-queue.d.ts +5 -0
- package/dist/core/tools/file-mutation-queue.js +36 -0
- package/dist/core/tools/find.d.ts +34 -0
- package/dist/core/tools/find.js +459 -0
- package/dist/core/tools/grep.d.ts +36 -0
- package/dist/core/tools/grep.js +422 -0
- package/dist/core/tools/index.d.ts +70 -0
- package/dist/core/tools/index.js +129 -0
- package/dist/core/tools/line-anchors.d.ts +33 -0
- package/dist/core/tools/line-anchors.js +151 -0
- package/dist/core/tools/ls.d.ts +36 -0
- package/dist/core/tools/ls.js +268 -0
- package/dist/core/tools/path-utils.d.ts +7 -0
- package/dist/core/tools/path-utils.js +80 -0
- package/dist/core/tools/read.d.ts +35 -0
- package/dist/core/tools/read.js +244 -0
- package/dist/core/tools/render-utils.d.ts +20 -0
- package/dist/core/tools/render-utils.js +48 -0
- package/dist/core/tools/session-split.d.ts +9 -0
- package/dist/core/tools/session-split.js +77 -0
- package/dist/core/tools/tool-definition-wrapper.d.ts +13 -0
- package/dist/core/tools/tool-definition-wrapper.js +32 -0
- package/dist/core/tools/truncate.d.ts +69 -0
- package/dist/core/tools/truncate.js +204 -0
- package/dist/core/tools/write.d.ts +25 -0
- package/dist/core/tools/write.js +211 -0
- package/dist/core/types/session-types.d.ts +123 -0
- package/dist/core/types/session-types.js +8 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +38 -0
- package/dist/main.d.ts +11 -2
- package/dist/main.js +577 -149
- package/dist/modes/event-mapper.d.ts +115 -0
- package/dist/modes/event-mapper.js +200 -0
- package/dist/modes/gui/server.d.ts +14 -0
- package/dist/modes/gui/server.js +1032 -0
- package/dist/modes/index.d.ts +10 -0
- package/dist/modes/index.js +9 -0
- package/dist/modes/interactive/assets/clankolas.png +0 -0
- package/dist/modes/interactive/components/armin.d.ts +33 -0
- package/dist/modes/interactive/components/armin.js +328 -0
- package/dist/modes/interactive/components/assistant-message.d.ts +19 -0
- package/dist/modes/interactive/components/assistant-message.js +115 -0
- package/dist/modes/interactive/components/bash-execution.d.ts +33 -0
- package/dist/modes/interactive/components/bash-execution.js +169 -0
- package/dist/modes/interactive/components/bordered-loader.d.ts +15 -0
- package/dist/modes/interactive/components/bordered-loader.js +50 -0
- package/dist/modes/interactive/components/branch-summary-message.d.ts +15 -0
- package/dist/modes/interactive/components/branch-summary-message.js +41 -0
- package/dist/modes/interactive/components/brand-header.d.ts +33 -0
- package/dist/modes/interactive/components/brand-header.js +235 -0
- package/dist/modes/interactive/components/compaction-summary-message.d.ts +15 -0
- package/dist/modes/interactive/components/compaction-summary-message.js +42 -0
- package/dist/modes/interactive/components/config-selector.d.ts +70 -0
- package/dist/modes/interactive/components/config-selector.js +469 -0
- package/dist/modes/interactive/components/countdown-timer.d.ts +13 -0
- package/dist/modes/interactive/components/countdown-timer.js +27 -0
- package/dist/modes/interactive/components/custom-editor.d.ts +27 -0
- package/dist/modes/interactive/components/custom-editor.js +94 -0
- package/dist/modes/interactive/components/custom-message.d.ts +19 -0
- package/dist/modes/interactive/components/custom-message.js +73 -0
- package/dist/modes/interactive/components/daxnuts.d.ts +22 -0
- package/dist/modes/interactive/components/daxnuts.js +137 -0
- package/dist/modes/interactive/components/diff.d.ts +11 -0
- package/dist/modes/interactive/components/diff.js +132 -0
- package/dist/modes/interactive/components/dynamic-border.d.ts +14 -0
- package/dist/modes/interactive/components/dynamic-border.js +19 -0
- package/dist/modes/interactive/components/earendil-announcement.d.ts +4 -0
- package/dist/modes/interactive/components/earendil-announcement.js +39 -0
- package/dist/modes/interactive/components/extension-editor.d.ts +19 -0
- package/dist/modes/interactive/components/extension-editor.js +105 -0
- package/dist/modes/interactive/components/extension-input.d.ts +22 -0
- package/dist/modes/interactive/components/extension-input.js +54 -0
- package/dist/modes/interactive/components/extension-selector.d.ts +23 -0
- package/dist/modes/interactive/components/extension-selector.js +70 -0
- package/dist/modes/interactive/components/footer.d.ts +55 -0
- package/dist/modes/interactive/components/footer.js +207 -0
- package/dist/modes/interactive/components/index.d.ts +31 -0
- package/dist/modes/interactive/components/index.js +32 -0
- package/dist/modes/interactive/components/keybinding-hints.d.ts +7 -0
- package/dist/modes/interactive/components/keybinding-hints.js +21 -0
- package/dist/modes/interactive/components/login-dialog.d.ts +41 -0
- package/dist/modes/interactive/components/login-dialog.js +138 -0
- package/dist/modes/interactive/components/model-selector.d.ts +32 -0
- package/dist/modes/interactive/components/model-selector.js +209 -0
- package/dist/modes/interactive/components/oauth-selector.d.ts +18 -0
- package/dist/modes/interactive/components/oauth-selector.js +91 -0
- package/dist/modes/interactive/components/settings-selector.d.ts +57 -0
- package/dist/modes/interactive/components/settings-selector.js +299 -0
- package/dist/modes/interactive/components/show-images-selector.d.ts +9 -0
- package/dist/modes/interactive/components/show-images-selector.js +37 -0
- package/dist/modes/interactive/components/skill-invocation-message.d.ts +16 -0
- package/dist/modes/interactive/components/skill-invocation-message.js +44 -0
- package/dist/modes/interactive/components/theme-selector.d.ts +10 -0
- package/dist/modes/interactive/components/theme-selector.js +47 -0
- package/dist/modes/interactive/components/thinking-selector.d.ts +10 -0
- package/dist/modes/interactive/components/thinking-selector.js +50 -0
- package/dist/modes/interactive/components/timeline-view.d.ts +31 -0
- package/dist/modes/interactive/components/timeline-view.js +81 -0
- package/dist/modes/interactive/components/tool-execution.d.ts +64 -0
- package/dist/modes/interactive/components/tool-execution.js +305 -0
- package/dist/modes/interactive/components/tree-selector.d.ts +88 -0
- package/dist/modes/interactive/components/tree-selector.js +1072 -0
- package/dist/modes/interactive/components/user-message-selector.d.ts +29 -0
- package/dist/modes/interactive/components/user-message-selector.js +110 -0
- package/dist/modes/interactive/components/user-message.d.ts +9 -0
- package/dist/modes/interactive/components/user-message.js +27 -0
- package/dist/modes/interactive/components/visual-truncate.d.ts +23 -0
- package/dist/modes/interactive/components/visual-truncate.js +32 -0
- package/dist/modes/interactive/interactive-mode.d.ts +394 -0
- package/dist/modes/interactive/interactive-mode.js +4116 -0
- package/dist/modes/interactive/theme/dark.json +85 -0
- package/dist/modes/interactive/theme/light.json +84 -0
- package/dist/modes/interactive/theme/theme-schema.json +335 -0
- package/dist/modes/interactive/theme/theme.d.ts +80 -0
- package/dist/modes/interactive/theme/theme.js +973 -0
- package/dist/modes/print-mode.d.ts +27 -0
- package/dist/modes/print-mode.js +102 -0
- package/dist/modes/rpc/jsonl.d.ts +16 -0
- package/dist/modes/rpc/jsonl.js +48 -0
- package/dist/modes/rpc/rpc-client.d.ts +219 -0
- package/dist/modes/rpc/rpc-client.js +405 -0
- package/dist/modes/rpc/rpc-mode.d.ts +19 -0
- package/dist/modes/rpc/rpc-mode.js +381 -0
- package/dist/modes/rpc/rpc-types.d.ts +406 -0
- package/dist/modes/rpc/rpc-types.js +7 -0
- package/dist/package-manager-cli.d.ts +3 -0
- package/dist/package-manager-cli.js +233 -0
- package/dist/utils/changelog.d.ts +20 -0
- package/dist/utils/changelog.js +86 -0
- package/dist/utils/child-process.d.ts +10 -0
- package/dist/utils/child-process.js +77 -0
- package/dist/utils/clipboard-image.d.ts +10 -0
- package/dist/utils/clipboard-image.js +244 -0
- package/dist/utils/clipboard-native.d.ts +7 -0
- package/dist/utils/clipboard-native.js +13 -0
- package/dist/utils/clipboard.d.ts +1 -0
- package/dist/utils/clipboard.js +77 -0
- package/dist/utils/exif-orientation.d.ts +4 -0
- package/dist/utils/exif-orientation.js +157 -0
- package/dist/utils/frontmatter.d.ts +7 -0
- package/dist/utils/frontmatter.js +25 -0
- package/dist/utils/git.d.ts +25 -0
- package/dist/utils/git.js +162 -0
- package/dist/utils/image-convert.d.ts +8 -0
- package/dist/utils/image-convert.js +38 -0
- package/dist/utils/image-resize.d.ts +35 -0
- package/dist/utils/image-resize.js +136 -0
- package/dist/utils/mime.d.ts +1 -0
- package/dist/utils/mime.js +25 -0
- package/dist/utils/path-shims.d.ts +1 -0
- package/dist/utils/path-shims.js +90 -0
- package/dist/utils/paths.d.ts +6 -0
- package/dist/utils/paths.js +18 -0
- package/dist/utils/photon.d.ts +20 -0
- package/dist/utils/photon.js +120 -0
- package/dist/utils/shell.d.ts +29 -0
- package/dist/utils/shell.js +189 -0
- package/dist/utils/sleep.d.ts +4 -0
- package/dist/utils/sleep.js +16 -0
- package/dist/utils/tools-manager.d.ts +3 -0
- package/dist/utils/tools-manager.js +101 -0
- package/dist/vendor/bin/darwin-arm64/fd +0 -0
- package/dist/vendor/bin/darwin-arm64/rg +0 -0
- package/dist/vendor/bin/darwin-x64/fd +0 -0
- package/dist/vendor/bin/darwin-x64/rg +0 -0
- package/dist/vendor/bin/linux-arm64/fd +0 -0
- package/dist/vendor/bin/linux-arm64/rg +0 -0
- package/dist/vendor/bin/linux-x64/fd +0 -0
- package/dist/vendor/bin/linux-x64/rg +0 -0
- package/dist/vendor/bin/win32-arm64/fd.exe +0 -0
- package/dist/vendor/bin/win32-arm64/rg.exe +0 -0
- package/dist/vendor/bin/win32-x64/fd.exe +0 -0
- package/dist/vendor/bin/win32-x64/rg.exe +0 -0
- package/package.json +90 -26
- package/dist/extension/core.d.ts +0 -69
- package/dist/extension/core.js +0 -270
- package/dist/extension/core.js.map +0 -1
- package/dist/extension/index.d.ts +0 -14
- package/dist/extension/index.js +0 -374
- package/dist/extension/index.js.map +0 -1
- package/dist/main.js.map +0 -1
- package/themes/pizza.json +0 -87
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run modes for the coding agent.
|
|
3
|
+
*/
|
|
4
|
+
export { InteractiveMode, type InteractiveModeOptions } from "./interactive/interactive-mode.js";
|
|
5
|
+
export { mapTypedEventToModeEvents, type ModeEvent } from "./event-mapper.js";
|
|
6
|
+
export { type PrintModeOptions, runPrintModeWithFacade } from "./print-mode.js";
|
|
7
|
+
export { type ModelInfo, RpcClient, type RpcClientOptions, type RpcEventListener } from "./rpc/rpc-client.js";
|
|
8
|
+
export { runRpcModeWithFacade } from "./rpc/rpc-mode.js";
|
|
9
|
+
export { runGuiModeWithFacade, type GuiModeOptions } from "./gui/server.js";
|
|
10
|
+
export type { RpcCommand, RpcResponse, RpcSessionState } from "./rpc/rpc-types.js";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run modes for the coding agent.
|
|
3
|
+
*/
|
|
4
|
+
export { InteractiveMode } from "./interactive/interactive-mode.js";
|
|
5
|
+
export { mapTypedEventToModeEvents } from "./event-mapper.js";
|
|
6
|
+
export { runPrintModeWithFacade } from "./print-mode.js";
|
|
7
|
+
export { RpcClient } from "./rpc/rpc-client.js";
|
|
8
|
+
export { runRpcModeWithFacade } from "./rpc/rpc-mode.js";
|
|
9
|
+
export { runGuiModeWithFacade } from "./gui/server.js";
|
|
Binary file
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Armin says hi! A fun easter egg with animated XBM art.
|
|
3
|
+
*/
|
|
4
|
+
import type { Component, TUI } from "@earendil-works/pi-tui";
|
|
5
|
+
export declare class ArminComponent implements Component {
|
|
6
|
+
private ui;
|
|
7
|
+
private interval;
|
|
8
|
+
private effect;
|
|
9
|
+
private finalGrid;
|
|
10
|
+
private currentGrid;
|
|
11
|
+
private effectState;
|
|
12
|
+
private cachedLines;
|
|
13
|
+
private cachedWidth;
|
|
14
|
+
private gridVersion;
|
|
15
|
+
private cachedVersion;
|
|
16
|
+
constructor(ui: TUI);
|
|
17
|
+
invalidate(): void;
|
|
18
|
+
render(width: number): string[];
|
|
19
|
+
private createEmptyGrid;
|
|
20
|
+
private initEffect;
|
|
21
|
+
private startAnimation;
|
|
22
|
+
private stopAnimation;
|
|
23
|
+
private tickEffect;
|
|
24
|
+
private tickTypewriter;
|
|
25
|
+
private tickScanline;
|
|
26
|
+
private tickRain;
|
|
27
|
+
private tickFade;
|
|
28
|
+
private tickCrt;
|
|
29
|
+
private tickGlitch;
|
|
30
|
+
private tickDissolve;
|
|
31
|
+
private updateDisplay;
|
|
32
|
+
dispose(): void;
|
|
33
|
+
}
|
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Armin says hi! A fun easter egg with animated XBM art.
|
|
3
|
+
*/
|
|
4
|
+
import { theme } from "../theme/theme.js";
|
|
5
|
+
// XBM image: 31x36 pixels, LSB first, 1=background, 0=foreground
|
|
6
|
+
const WIDTH = 31;
|
|
7
|
+
const HEIGHT = 36;
|
|
8
|
+
const BITS = [
|
|
9
|
+
0xff, 0xff, 0xff, 0x7f, 0xff, 0xf0, 0xff, 0x7f, 0xff, 0xed, 0xff, 0x7f, 0xff, 0xdb, 0xff, 0x7f, 0xff, 0xb7, 0xff,
|
|
10
|
+
0x7f, 0xff, 0x77, 0xfe, 0x7f, 0x3f, 0xf8, 0xfe, 0x7f, 0xdf, 0xff, 0xfe, 0x7f, 0xdf, 0x3f, 0xfc, 0x7f, 0x9f, 0xc3,
|
|
11
|
+
0xfb, 0x7f, 0x6f, 0xfc, 0xf4, 0x7f, 0xf7, 0x0f, 0xf7, 0x7f, 0xf7, 0xff, 0xf7, 0x7f, 0xf7, 0xff, 0xe3, 0x7f, 0xf7,
|
|
12
|
+
0x07, 0xe8, 0x7f, 0xef, 0xf8, 0x67, 0x70, 0x0f, 0xff, 0xbb, 0x6f, 0xf1, 0x00, 0xd0, 0x5b, 0xfd, 0x3f, 0xec, 0x53,
|
|
13
|
+
0xc1, 0xff, 0xef, 0x57, 0x9f, 0xfd, 0xee, 0x5f, 0x9f, 0xfc, 0xae, 0x5f, 0x1f, 0x78, 0xac, 0x5f, 0x3f, 0x00, 0x50,
|
|
14
|
+
0x6c, 0x7f, 0x00, 0xdc, 0x77, 0xff, 0xc0, 0x3f, 0x78, 0xff, 0x01, 0xf8, 0x7f, 0xff, 0x03, 0x9c, 0x78, 0xff, 0x07,
|
|
15
|
+
0x8c, 0x7c, 0xff, 0x0f, 0xce, 0x78, 0xff, 0xff, 0xcf, 0x7f, 0xff, 0xff, 0xcf, 0x78, 0xff, 0xff, 0xdf, 0x78, 0xff,
|
|
16
|
+
0xff, 0xdf, 0x7d, 0xff, 0xff, 0x3f, 0x7e, 0xff, 0xff, 0xff, 0x7f,
|
|
17
|
+
];
|
|
18
|
+
const BYTES_PER_ROW = Math.ceil(WIDTH / 8);
|
|
19
|
+
const DISPLAY_HEIGHT = Math.ceil(HEIGHT / 2); // Half-block rendering
|
|
20
|
+
const EFFECTS = ["typewriter", "scanline", "rain", "fade", "crt", "glitch", "dissolve"];
|
|
21
|
+
// Get pixel at (x, y): true = foreground, false = background
|
|
22
|
+
function getPixel(x, y) {
|
|
23
|
+
if (y >= HEIGHT)
|
|
24
|
+
return false;
|
|
25
|
+
const byteIndex = y * BYTES_PER_ROW + Math.floor(x / 8);
|
|
26
|
+
const bitIndex = x % 8;
|
|
27
|
+
return ((BITS[byteIndex] >> bitIndex) & 1) === 0;
|
|
28
|
+
}
|
|
29
|
+
// Get the character for a cell (2 vertical pixels packed)
|
|
30
|
+
function getChar(x, row) {
|
|
31
|
+
const upper = getPixel(x, row * 2);
|
|
32
|
+
const lower = getPixel(x, row * 2 + 1);
|
|
33
|
+
if (upper && lower)
|
|
34
|
+
return "█";
|
|
35
|
+
if (upper)
|
|
36
|
+
return "▀";
|
|
37
|
+
if (lower)
|
|
38
|
+
return "▄";
|
|
39
|
+
return " ";
|
|
40
|
+
}
|
|
41
|
+
// Build the final image grid
|
|
42
|
+
function buildFinalGrid() {
|
|
43
|
+
const grid = [];
|
|
44
|
+
for (let row = 0; row < DISPLAY_HEIGHT; row++) {
|
|
45
|
+
const line = [];
|
|
46
|
+
for (let x = 0; x < WIDTH; x++) {
|
|
47
|
+
line.push(getChar(x, row));
|
|
48
|
+
}
|
|
49
|
+
grid.push(line);
|
|
50
|
+
}
|
|
51
|
+
return grid;
|
|
52
|
+
}
|
|
53
|
+
export class ArminComponent {
|
|
54
|
+
constructor(ui) {
|
|
55
|
+
this.interval = null;
|
|
56
|
+
this.effectState = {};
|
|
57
|
+
this.cachedLines = [];
|
|
58
|
+
this.cachedWidth = 0;
|
|
59
|
+
this.gridVersion = 0;
|
|
60
|
+
this.cachedVersion = -1;
|
|
61
|
+
this.ui = ui;
|
|
62
|
+
this.effect = EFFECTS[Math.floor(Math.random() * EFFECTS.length)];
|
|
63
|
+
this.finalGrid = buildFinalGrid();
|
|
64
|
+
this.currentGrid = this.createEmptyGrid();
|
|
65
|
+
this.initEffect();
|
|
66
|
+
this.startAnimation();
|
|
67
|
+
}
|
|
68
|
+
invalidate() {
|
|
69
|
+
this.cachedWidth = 0;
|
|
70
|
+
}
|
|
71
|
+
render(width) {
|
|
72
|
+
if (width === this.cachedWidth && this.cachedVersion === this.gridVersion) {
|
|
73
|
+
return this.cachedLines;
|
|
74
|
+
}
|
|
75
|
+
const padding = 1;
|
|
76
|
+
const availableWidth = width - padding;
|
|
77
|
+
this.cachedLines = this.currentGrid.map((row) => {
|
|
78
|
+
// Clip row to available width before applying color
|
|
79
|
+
const clipped = row.slice(0, availableWidth).join("");
|
|
80
|
+
const padRight = Math.max(0, width - padding - clipped.length);
|
|
81
|
+
return ` ${theme.fg("accent", clipped)}${" ".repeat(padRight)}`;
|
|
82
|
+
});
|
|
83
|
+
// Add "ARMIN SAYS HI" at the end
|
|
84
|
+
const message = "ARMIN SAYS HI";
|
|
85
|
+
const msgPadRight = Math.max(0, width - padding - message.length);
|
|
86
|
+
this.cachedLines.push(` ${theme.fg("accent", message)}${" ".repeat(msgPadRight)}`);
|
|
87
|
+
this.cachedWidth = width;
|
|
88
|
+
this.cachedVersion = this.gridVersion;
|
|
89
|
+
return this.cachedLines;
|
|
90
|
+
}
|
|
91
|
+
createEmptyGrid() {
|
|
92
|
+
return Array.from({ length: DISPLAY_HEIGHT }, () => Array(WIDTH).fill(" "));
|
|
93
|
+
}
|
|
94
|
+
initEffect() {
|
|
95
|
+
switch (this.effect) {
|
|
96
|
+
case "typewriter":
|
|
97
|
+
this.effectState = { pos: 0 };
|
|
98
|
+
break;
|
|
99
|
+
case "scanline":
|
|
100
|
+
this.effectState = { row: 0 };
|
|
101
|
+
break;
|
|
102
|
+
case "rain":
|
|
103
|
+
// Track falling position for each column
|
|
104
|
+
this.effectState = {
|
|
105
|
+
drops: Array.from({ length: WIDTH }, () => ({
|
|
106
|
+
y: -Math.floor(Math.random() * DISPLAY_HEIGHT * 2),
|
|
107
|
+
settled: 0,
|
|
108
|
+
})),
|
|
109
|
+
};
|
|
110
|
+
break;
|
|
111
|
+
case "fade": {
|
|
112
|
+
// Shuffle all pixel positions
|
|
113
|
+
const positions = [];
|
|
114
|
+
for (let row = 0; row < DISPLAY_HEIGHT; row++) {
|
|
115
|
+
for (let x = 0; x < WIDTH; x++) {
|
|
116
|
+
positions.push([row, x]);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
// Fisher-Yates shuffle
|
|
120
|
+
for (let i = positions.length - 1; i > 0; i--) {
|
|
121
|
+
const j = Math.floor(Math.random() * (i + 1));
|
|
122
|
+
[positions[i], positions[j]] = [positions[j], positions[i]];
|
|
123
|
+
}
|
|
124
|
+
this.effectState = { positions, idx: 0 };
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
case "crt":
|
|
128
|
+
this.effectState = { expansion: 0 };
|
|
129
|
+
break;
|
|
130
|
+
case "glitch":
|
|
131
|
+
this.effectState = { phase: 0, glitchFrames: 8 };
|
|
132
|
+
break;
|
|
133
|
+
case "dissolve": {
|
|
134
|
+
// Start with random noise
|
|
135
|
+
this.currentGrid = Array.from({ length: DISPLAY_HEIGHT }, () => Array.from({ length: WIDTH }, () => {
|
|
136
|
+
const chars = [" ", "░", "▒", "▓", "█", "▀", "▄"];
|
|
137
|
+
return chars[Math.floor(Math.random() * chars.length)];
|
|
138
|
+
}));
|
|
139
|
+
// Shuffle positions for gradual resolve
|
|
140
|
+
const dissolvePositions = [];
|
|
141
|
+
for (let row = 0; row < DISPLAY_HEIGHT; row++) {
|
|
142
|
+
for (let x = 0; x < WIDTH; x++) {
|
|
143
|
+
dissolvePositions.push([row, x]);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
for (let i = dissolvePositions.length - 1; i > 0; i--) {
|
|
147
|
+
const j = Math.floor(Math.random() * (i + 1));
|
|
148
|
+
[dissolvePositions[i], dissolvePositions[j]] = [dissolvePositions[j], dissolvePositions[i]];
|
|
149
|
+
}
|
|
150
|
+
this.effectState = { positions: dissolvePositions, idx: 0 };
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
startAnimation() {
|
|
156
|
+
const fps = this.effect === "glitch" ? 60 : 30;
|
|
157
|
+
this.interval = setInterval(() => {
|
|
158
|
+
const done = this.tickEffect();
|
|
159
|
+
this.updateDisplay();
|
|
160
|
+
this.ui.requestRender();
|
|
161
|
+
if (done) {
|
|
162
|
+
this.stopAnimation();
|
|
163
|
+
}
|
|
164
|
+
}, 1000 / fps);
|
|
165
|
+
}
|
|
166
|
+
stopAnimation() {
|
|
167
|
+
if (this.interval) {
|
|
168
|
+
clearInterval(this.interval);
|
|
169
|
+
this.interval = null;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
tickEffect() {
|
|
173
|
+
switch (this.effect) {
|
|
174
|
+
case "typewriter":
|
|
175
|
+
return this.tickTypewriter();
|
|
176
|
+
case "scanline":
|
|
177
|
+
return this.tickScanline();
|
|
178
|
+
case "rain":
|
|
179
|
+
return this.tickRain();
|
|
180
|
+
case "fade":
|
|
181
|
+
return this.tickFade();
|
|
182
|
+
case "crt":
|
|
183
|
+
return this.tickCrt();
|
|
184
|
+
case "glitch":
|
|
185
|
+
return this.tickGlitch();
|
|
186
|
+
case "dissolve":
|
|
187
|
+
return this.tickDissolve();
|
|
188
|
+
default:
|
|
189
|
+
return true;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
tickTypewriter() {
|
|
193
|
+
const state = this.effectState;
|
|
194
|
+
const pixelsPerFrame = 3;
|
|
195
|
+
for (let i = 0; i < pixelsPerFrame; i++) {
|
|
196
|
+
const row = Math.floor(state.pos / WIDTH);
|
|
197
|
+
const x = state.pos % WIDTH;
|
|
198
|
+
if (row >= DISPLAY_HEIGHT)
|
|
199
|
+
return true;
|
|
200
|
+
this.currentGrid[row][x] = this.finalGrid[row][x];
|
|
201
|
+
state.pos++;
|
|
202
|
+
}
|
|
203
|
+
return false;
|
|
204
|
+
}
|
|
205
|
+
tickScanline() {
|
|
206
|
+
const state = this.effectState;
|
|
207
|
+
if (state.row >= DISPLAY_HEIGHT)
|
|
208
|
+
return true;
|
|
209
|
+
// Copy row
|
|
210
|
+
for (let x = 0; x < WIDTH; x++) {
|
|
211
|
+
this.currentGrid[state.row][x] = this.finalGrid[state.row][x];
|
|
212
|
+
}
|
|
213
|
+
state.row++;
|
|
214
|
+
return false;
|
|
215
|
+
}
|
|
216
|
+
tickRain() {
|
|
217
|
+
const state = this.effectState;
|
|
218
|
+
let allSettled = true;
|
|
219
|
+
this.currentGrid = this.createEmptyGrid();
|
|
220
|
+
for (let x = 0; x < WIDTH; x++) {
|
|
221
|
+
const drop = state.drops[x];
|
|
222
|
+
// Draw settled pixels
|
|
223
|
+
for (let row = DISPLAY_HEIGHT - 1; row >= DISPLAY_HEIGHT - drop.settled; row--) {
|
|
224
|
+
if (row >= 0) {
|
|
225
|
+
this.currentGrid[row][x] = this.finalGrid[row][x];
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
// Check if this column is done
|
|
229
|
+
if (drop.settled >= DISPLAY_HEIGHT)
|
|
230
|
+
continue;
|
|
231
|
+
allSettled = false;
|
|
232
|
+
// Find the target row for this column (lowest non-space pixel)
|
|
233
|
+
let targetRow = -1;
|
|
234
|
+
for (let row = DISPLAY_HEIGHT - 1 - drop.settled; row >= 0; row--) {
|
|
235
|
+
if (this.finalGrid[row][x] !== " ") {
|
|
236
|
+
targetRow = row;
|
|
237
|
+
break;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
// Move drop down
|
|
241
|
+
drop.y++;
|
|
242
|
+
// Draw falling drop
|
|
243
|
+
if (drop.y >= 0 && drop.y < DISPLAY_HEIGHT) {
|
|
244
|
+
if (targetRow >= 0 && drop.y >= targetRow) {
|
|
245
|
+
// Settle
|
|
246
|
+
drop.settled = DISPLAY_HEIGHT - targetRow;
|
|
247
|
+
drop.y = -Math.floor(Math.random() * 5) - 1;
|
|
248
|
+
}
|
|
249
|
+
else {
|
|
250
|
+
// Still falling
|
|
251
|
+
this.currentGrid[drop.y][x] = "▓";
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
return allSettled;
|
|
256
|
+
}
|
|
257
|
+
tickFade() {
|
|
258
|
+
const state = this.effectState;
|
|
259
|
+
const pixelsPerFrame = 15;
|
|
260
|
+
for (let i = 0; i < pixelsPerFrame; i++) {
|
|
261
|
+
if (state.idx >= state.positions.length)
|
|
262
|
+
return true;
|
|
263
|
+
const [row, x] = state.positions[state.idx];
|
|
264
|
+
this.currentGrid[row][x] = this.finalGrid[row][x];
|
|
265
|
+
state.idx++;
|
|
266
|
+
}
|
|
267
|
+
return false;
|
|
268
|
+
}
|
|
269
|
+
tickCrt() {
|
|
270
|
+
const state = this.effectState;
|
|
271
|
+
const midRow = Math.floor(DISPLAY_HEIGHT / 2);
|
|
272
|
+
this.currentGrid = this.createEmptyGrid();
|
|
273
|
+
// Draw from middle expanding outward
|
|
274
|
+
const top = midRow - state.expansion;
|
|
275
|
+
const bottom = midRow + state.expansion;
|
|
276
|
+
for (let row = Math.max(0, top); row <= Math.min(DISPLAY_HEIGHT - 1, bottom); row++) {
|
|
277
|
+
for (let x = 0; x < WIDTH; x++) {
|
|
278
|
+
this.currentGrid[row][x] = this.finalGrid[row][x];
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
state.expansion++;
|
|
282
|
+
return state.expansion > DISPLAY_HEIGHT;
|
|
283
|
+
}
|
|
284
|
+
tickGlitch() {
|
|
285
|
+
const state = this.effectState;
|
|
286
|
+
if (state.phase < state.glitchFrames) {
|
|
287
|
+
// Glitch phase: show corrupted version
|
|
288
|
+
this.currentGrid = this.finalGrid.map((row) => {
|
|
289
|
+
const offset = Math.floor(Math.random() * 7) - 3;
|
|
290
|
+
const glitchRow = [...row];
|
|
291
|
+
// Random horizontal offset
|
|
292
|
+
if (Math.random() < 0.3) {
|
|
293
|
+
const shifted = glitchRow.slice(offset).concat(glitchRow.slice(0, offset));
|
|
294
|
+
return shifted.slice(0, WIDTH);
|
|
295
|
+
}
|
|
296
|
+
// Random vertical swap
|
|
297
|
+
if (Math.random() < 0.2) {
|
|
298
|
+
const swapRow = Math.floor(Math.random() * DISPLAY_HEIGHT);
|
|
299
|
+
return [...this.finalGrid[swapRow]];
|
|
300
|
+
}
|
|
301
|
+
return glitchRow;
|
|
302
|
+
});
|
|
303
|
+
state.phase++;
|
|
304
|
+
return false;
|
|
305
|
+
}
|
|
306
|
+
// Final frame: show clean image
|
|
307
|
+
this.currentGrid = this.finalGrid.map((row) => [...row]);
|
|
308
|
+
return true;
|
|
309
|
+
}
|
|
310
|
+
tickDissolve() {
|
|
311
|
+
const state = this.effectState;
|
|
312
|
+
const pixelsPerFrame = 20;
|
|
313
|
+
for (let i = 0; i < pixelsPerFrame; i++) {
|
|
314
|
+
if (state.idx >= state.positions.length)
|
|
315
|
+
return true;
|
|
316
|
+
const [row, x] = state.positions[state.idx];
|
|
317
|
+
this.currentGrid[row][x] = this.finalGrid[row][x];
|
|
318
|
+
state.idx++;
|
|
319
|
+
}
|
|
320
|
+
return false;
|
|
321
|
+
}
|
|
322
|
+
updateDisplay() {
|
|
323
|
+
this.gridVersion++;
|
|
324
|
+
}
|
|
325
|
+
dispose() {
|
|
326
|
+
this.stopAnimation();
|
|
327
|
+
}
|
|
328
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { AssistantMessage } from "@earendil-works/pi-ai/compat";
|
|
2
|
+
import { Container, type MarkdownTheme } from "@earendil-works/pi-tui";
|
|
3
|
+
/**
|
|
4
|
+
* Component that renders a complete assistant message
|
|
5
|
+
*/
|
|
6
|
+
export declare class AssistantMessageComponent extends Container {
|
|
7
|
+
private contentContainer;
|
|
8
|
+
private hideThinkingBlock;
|
|
9
|
+
private markdownTheme;
|
|
10
|
+
private hiddenThinkingLabel;
|
|
11
|
+
private lastMessage?;
|
|
12
|
+
private hasToolCalls;
|
|
13
|
+
constructor(message?: AssistantMessage, hideThinkingBlock?: boolean, markdownTheme?: MarkdownTheme, hiddenThinkingLabel?: string);
|
|
14
|
+
invalidate(): void;
|
|
15
|
+
setHideThinkingBlock(hide: boolean): void;
|
|
16
|
+
setHiddenThinkingLabel(label: string): void;
|
|
17
|
+
render(width: number): string[];
|
|
18
|
+
updateContent(message: AssistantMessage): void;
|
|
19
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { Container, Markdown, Spacer, Text } from "@earendil-works/pi-tui";
|
|
2
|
+
import { getMarkdownTheme, theme } from "../theme/theme.js";
|
|
3
|
+
const OSC133_ZONE_START = "\x1b]133;A\x07";
|
|
4
|
+
const OSC133_ZONE_END = "\x1b]133;B\x07";
|
|
5
|
+
const OSC133_ZONE_FINAL = "\x1b]133;C\x07";
|
|
6
|
+
/**
|
|
7
|
+
* Component that renders a complete assistant message
|
|
8
|
+
*/
|
|
9
|
+
export class AssistantMessageComponent extends Container {
|
|
10
|
+
constructor(message, hideThinkingBlock = false, markdownTheme = getMarkdownTheme(), hiddenThinkingLabel = "Thinking...") {
|
|
11
|
+
super();
|
|
12
|
+
this.hasToolCalls = false;
|
|
13
|
+
this.hideThinkingBlock = hideThinkingBlock;
|
|
14
|
+
this.markdownTheme = markdownTheme;
|
|
15
|
+
this.hiddenThinkingLabel = hiddenThinkingLabel;
|
|
16
|
+
// Container for text/thinking content
|
|
17
|
+
this.contentContainer = new Container();
|
|
18
|
+
this.addChild(this.contentContainer);
|
|
19
|
+
if (message) {
|
|
20
|
+
this.updateContent(message);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
invalidate() {
|
|
24
|
+
super.invalidate();
|
|
25
|
+
if (this.lastMessage) {
|
|
26
|
+
this.updateContent(this.lastMessage);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
setHideThinkingBlock(hide) {
|
|
30
|
+
this.hideThinkingBlock = hide;
|
|
31
|
+
if (this.lastMessage) {
|
|
32
|
+
this.updateContent(this.lastMessage);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
setHiddenThinkingLabel(label) {
|
|
36
|
+
this.hiddenThinkingLabel = label;
|
|
37
|
+
if (this.lastMessage) {
|
|
38
|
+
this.updateContent(this.lastMessage);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
render(width) {
|
|
42
|
+
const lines = super.render(width);
|
|
43
|
+
if (this.hasToolCalls || lines.length === 0) {
|
|
44
|
+
return lines;
|
|
45
|
+
}
|
|
46
|
+
lines[0] = OSC133_ZONE_START + lines[0];
|
|
47
|
+
lines[lines.length - 1] = OSC133_ZONE_END + OSC133_ZONE_FINAL + lines[lines.length - 1];
|
|
48
|
+
return lines;
|
|
49
|
+
}
|
|
50
|
+
updateContent(message) {
|
|
51
|
+
this.lastMessage = message;
|
|
52
|
+
// Clear content container
|
|
53
|
+
this.contentContainer.clear();
|
|
54
|
+
const hasVisibleContent = message.content.some((c) => (c.type === "text" && c.text.trim()) || (c.type === "thinking" && c.thinking.trim()));
|
|
55
|
+
if (hasVisibleContent) {
|
|
56
|
+
this.contentContainer.addChild(new Spacer(1));
|
|
57
|
+
}
|
|
58
|
+
// Render content in order
|
|
59
|
+
for (let i = 0; i < message.content.length; i++) {
|
|
60
|
+
const content = message.content[i];
|
|
61
|
+
if (content.type === "text" && content.text.trim()) {
|
|
62
|
+
// Assistant text messages with no background - trim the text
|
|
63
|
+
// Set paddingY=0 to avoid extra spacing before tool executions
|
|
64
|
+
this.contentContainer.addChild(new Markdown(content.text.trim(), 1, 0, this.markdownTheme));
|
|
65
|
+
}
|
|
66
|
+
else if (content.type === "thinking" && content.thinking.trim()) {
|
|
67
|
+
// Add spacing only when another visible assistant content block follows.
|
|
68
|
+
// This avoids a superfluous blank line before separately-rendered tool execution blocks.
|
|
69
|
+
const hasVisibleContentAfter = message.content
|
|
70
|
+
.slice(i + 1)
|
|
71
|
+
.some((c) => (c.type === "text" && c.text.trim()) || (c.type === "thinking" && c.thinking.trim()));
|
|
72
|
+
if (this.hideThinkingBlock) {
|
|
73
|
+
// Show static thinking label when hidden
|
|
74
|
+
this.contentContainer.addChild(new Text(theme.italic(theme.fg("thinkingText", this.hiddenThinkingLabel)), 1, 0));
|
|
75
|
+
if (hasVisibleContentAfter) {
|
|
76
|
+
this.contentContainer.addChild(new Spacer(1));
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
// Thinking traces in thinkingText color, italic
|
|
81
|
+
this.contentContainer.addChild(new Markdown(content.thinking.trim(), 1, 0, this.markdownTheme, {
|
|
82
|
+
color: (text) => theme.fg("thinkingText", text),
|
|
83
|
+
italic: true,
|
|
84
|
+
}));
|
|
85
|
+
if (hasVisibleContentAfter) {
|
|
86
|
+
this.contentContainer.addChild(new Spacer(1));
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
// Check if aborted - show after partial content
|
|
92
|
+
// But only if there are no tool calls (tool execution components will show the error)
|
|
93
|
+
const hasToolCalls = message.content.some((c) => c.type === "toolCall");
|
|
94
|
+
this.hasToolCalls = hasToolCalls;
|
|
95
|
+
if (!hasToolCalls) {
|
|
96
|
+
if (message.stopReason === "aborted") {
|
|
97
|
+
const abortMessage = message.errorMessage && message.errorMessage !== "Request was aborted"
|
|
98
|
+
? message.errorMessage
|
|
99
|
+
: "Operation aborted";
|
|
100
|
+
if (hasVisibleContent) {
|
|
101
|
+
this.contentContainer.addChild(new Spacer(1));
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
this.contentContainer.addChild(new Spacer(1));
|
|
105
|
+
}
|
|
106
|
+
this.contentContainer.addChild(new Text(theme.fg("error", abortMessage), 1, 0));
|
|
107
|
+
}
|
|
108
|
+
else if (message.stopReason === "error") {
|
|
109
|
+
const errorMsg = message.errorMessage || "Unknown error";
|
|
110
|
+
this.contentContainer.addChild(new Spacer(1));
|
|
111
|
+
this.contentContainer.addChild(new Text(theme.fg("error", `Error: ${errorMsg}`), 1, 0));
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Component for displaying bash command execution with streaming output.
|
|
3
|
+
*/
|
|
4
|
+
import { Container, type TUI } from "@earendil-works/pi-tui";
|
|
5
|
+
import { type TruncationResult } from "../../../core/tools/truncate.js";
|
|
6
|
+
export declare class BashExecutionComponent extends Container {
|
|
7
|
+
private command;
|
|
8
|
+
private outputLines;
|
|
9
|
+
private status;
|
|
10
|
+
private exitCode;
|
|
11
|
+
private loader;
|
|
12
|
+
private truncationResult?;
|
|
13
|
+
private fullOutputPath?;
|
|
14
|
+
private expanded;
|
|
15
|
+
private contentContainer;
|
|
16
|
+
constructor(command: string, ui: TUI, excludeFromContext?: boolean);
|
|
17
|
+
/**
|
|
18
|
+
* Set whether the output is expanded (shows full output) or collapsed (preview only).
|
|
19
|
+
*/
|
|
20
|
+
setExpanded(expanded: boolean): void;
|
|
21
|
+
invalidate(): void;
|
|
22
|
+
appendOutput(chunk: string): void;
|
|
23
|
+
setComplete(exitCode: number | undefined, cancelled: boolean, truncationResult?: TruncationResult, fullOutputPath?: string): void;
|
|
24
|
+
private updateDisplay;
|
|
25
|
+
/**
|
|
26
|
+
* Get the raw output for creating BashExecutionMessage.
|
|
27
|
+
*/
|
|
28
|
+
getOutput(): string;
|
|
29
|
+
/**
|
|
30
|
+
* Get the command that was executed.
|
|
31
|
+
*/
|
|
32
|
+
getCommand(): string;
|
|
33
|
+
}
|