indusagi-coding-agent 0.1.38 → 0.1.40
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 +22 -7
- package/{LICENSE.md → LICENSE} +0 -1
- package/README.md +2 -4
- package/dist/cli/args.d.ts +6 -128
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +277 -472
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/config-selector.d.ts +9 -62
- package/dist/cli/config-selector.d.ts.map +1 -1
- package/dist/cli/config-selector.js +31 -146
- package/dist/cli/config-selector.js.map +1 -1
- package/dist/cli/file-processor.d.ts +1 -69
- package/dist/cli/file-processor.d.ts.map +1 -1
- package/dist/cli/file-processor.js +36 -267
- package/dist/cli/file-processor.js.map +1 -1
- package/dist/cli/list-models.d.ts +0 -60
- package/dist/cli/list-models.d.ts.map +1 -1
- package/dist/cli/list-models.js +53 -246
- package/dist/cli/list-models.js.map +1 -1
- package/dist/cli/session-picker.d.ts +1 -72
- package/dist/cli/session-picker.d.ts.map +1 -1
- package/dist/cli/session-picker.js +57 -231
- package/dist/cli/session-picker.js.map +1 -1
- package/dist/cli.js +25 -31
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +0 -42
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +62 -97
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session.d.ts +26 -2
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +78 -66
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-storage.d.ts +4 -95
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +233 -288
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/bash-executor.d.ts +0 -323
- package/dist/core/bash-executor.d.ts.map +1 -1
- package/dist/core/bash-executor.js +126 -359
- package/dist/core/bash-executor.js.map +1 -1
- package/dist/core/compaction/branch-summarization.d.ts +3 -3
- package/dist/core/compaction/branch-summarization.js +16 -16
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts +3 -3
- package/dist/core/compaction/compaction.js +40 -40
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/compaction/index.d.ts +32 -4
- package/dist/core/compaction/index.d.ts.map +1 -1
- package/dist/core/compaction/index.js +30 -4
- package/dist/core/compaction/index.js.map +1 -1
- package/dist/core/compaction/utils.d.ts +1 -19
- package/dist/core/compaction/utils.d.ts.map +1 -1
- package/dist/core/compaction/utils.js +92 -113
- package/dist/core/compaction/utils.js.map +1 -1
- package/dist/core/discover-packages.d.ts +0 -4
- package/dist/core/discover-packages.d.ts.map +1 -1
- package/dist/core/discover-packages.js +41 -44
- package/dist/core/discover-packages.js.map +1 -1
- package/dist/core/event-bus.d.ts +1 -147
- package/dist/core/event-bus.d.ts.map +1 -1
- package/dist/core/event-bus.js +17 -106
- package/dist/core/event-bus.js.map +1 -1
- package/dist/core/exec.d.ts +0 -16
- package/dist/core/exec.d.ts.map +1 -1
- package/dist/core/exec.js +18 -27
- package/dist/core/exec.js.map +1 -1
- package/dist/core/export-html/ansi-to-html.ts +262 -0
- package/dist/core/export-html/index.ts +433 -0
- package/dist/core/export-html/template.html +48 -26
- package/dist/core/export-html/tool-renderer.d.ts +0 -21
- package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
- package/dist/core/export-html/tool-renderer.js +35 -51
- package/dist/core/export-html/tool-renderer.js.map +1 -1
- package/dist/core/export-html/tool-renderer.ts +80 -0
- package/dist/core/export-html/vendor/highlight.min.js +401 -370
- package/dist/core/export-html/vendor/marked.min.js +71 -3
- package/dist/core/extensions/index.d.ts +7 -4
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js +17 -3
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/loader.d.ts +0 -6
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +60 -56
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +3 -0
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +48 -80
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +50 -23
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/footer-data-provider.d.ts +2 -15
- package/dist/core/footer-data-provider.d.ts.map +1 -1
- package/dist/core/footer-data-provider.js +21 -33
- package/dist/core/footer-data-provider.js.map +1 -1
- package/dist/core/hooks/loader.js +2 -2
- package/dist/core/hooks/loader.js.map +1 -1
- package/dist/core/index.d.ts +29 -10
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +29 -10
- package/dist/core/index.js.map +1 -1
- package/dist/core/keybindings.d.ts +2 -179
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +64 -238
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/model-registry.d.ts +26 -181
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +228 -407
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-resolver.d.ts +0 -139
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +34 -215
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/package-manager.d.ts +25 -57
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +326 -964
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/prompt-templates.d.ts +2 -34
- package/dist/core/prompt-templates.d.ts.map +1 -1
- package/dist/core/prompt-templates.js +122 -170
- package/dist/core/prompt-templates.js.map +1 -1
- package/dist/core/resource-loader.d.ts +19 -12
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +353 -467
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/sdk.d.ts +2 -61
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +184 -252
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-manager.d.ts +447 -1
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +1176 -1
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-manager.d.ts +9 -12
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +170 -398
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/skills.d.ts +2 -27
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +149 -212
- package/dist/core/skills.js.map +1 -1
- package/dist/core/subagents.d.ts +2 -2
- package/dist/core/subagents.d.ts.map +1 -1
- package/dist/core/subagents.js +21 -14
- package/dist/core/subagents.js.map +1 -1
- package/dist/core/system-prompt.d.ts +0 -11
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +168 -139
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/timings.d.ts +1 -4
- package/dist/core/timings.d.ts.map +1 -1
- package/dist/core/timings.js +34 -18
- package/dist/core/timings.js.map +1 -1
- package/dist/core/todo-store.d.ts +20 -0
- package/dist/core/todo-store.d.ts.map +1 -0
- package/dist/core/todo-store.js +60 -0
- package/dist/core/todo-store.js.map +1 -0
- package/dist/core/tools/bash.d.ts +2 -0
- package/dist/core/tools/bash.d.ts.map +1 -0
- package/dist/core/tools/bash.js +2 -0
- package/dist/core/tools/bash.js.map +1 -0
- package/dist/core/tools/bg-process.d.ts +1 -6
- package/dist/core/tools/bg-process.d.ts.map +1 -1
- package/dist/core/tools/bg-process.js +4 -18
- package/dist/core/tools/bg-process.js.map +1 -1
- package/dist/core/tools/edit-diff.d.ts +9 -0
- package/dist/core/tools/edit-diff.d.ts.map +1 -0
- package/dist/core/tools/edit-diff.js +2 -0
- package/dist/core/tools/edit-diff.js.map +1 -0
- package/dist/core/tools/edit.d.ts +2 -0
- package/dist/core/tools/edit.d.ts.map +1 -0
- package/dist/core/tools/edit.js +2 -0
- package/dist/core/tools/edit.js.map +1 -0
- package/dist/core/tools/find.d.ts +2 -0
- package/dist/core/tools/find.d.ts.map +1 -0
- package/dist/core/tools/find.js +2 -0
- package/dist/core/tools/find.js.map +1 -0
- package/dist/core/tools/grep.d.ts +2 -0
- package/dist/core/tools/grep.d.ts.map +1 -0
- package/dist/core/tools/grep.js +2 -0
- package/dist/core/tools/grep.js.map +1 -0
- package/dist/core/tools/index.d.ts +8 -2
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/ls.d.ts +2 -0
- package/dist/core/tools/ls.d.ts.map +1 -0
- package/dist/core/tools/ls.js +2 -0
- package/dist/core/tools/ls.js.map +1 -0
- package/dist/core/tools/memory.d.ts +50 -1
- package/dist/core/tools/memory.d.ts.map +1 -1
- package/dist/core/tools/memory.js +11 -7
- package/dist/core/tools/memory.js.map +1 -1
- package/dist/core/tools/path-utils.d.ts +2 -0
- package/dist/core/tools/path-utils.d.ts.map +1 -0
- package/dist/core/tools/path-utils.js +2 -0
- package/dist/core/tools/path-utils.js.map +1 -0
- package/dist/core/tools/read.d.ts +2 -0
- package/dist/core/tools/read.d.ts.map +1 -0
- package/dist/core/tools/read.js +2 -0
- package/dist/core/tools/read.js.map +1 -0
- package/dist/core/tools/registry.d.ts +0 -15
- package/dist/core/tools/registry.d.ts.map +1 -1
- package/dist/core/tools/registry.js +13 -37
- package/dist/core/tools/registry.js.map +1 -1
- package/dist/core/tools/task.d.ts +17 -23
- package/dist/core/tools/task.d.ts.map +1 -1
- package/dist/core/tools/task.js +43 -82
- package/dist/core/tools/task.js.map +1 -1
- package/dist/core/tools/todo.d.ts +17 -20
- package/dist/core/tools/todo.d.ts.map +1 -1
- package/dist/core/tools/todo.js +79 -58
- package/dist/core/tools/todo.js.map +1 -1
- package/dist/core/tools/truncate.d.ts +2 -0
- package/dist/core/tools/truncate.d.ts.map +1 -0
- package/dist/core/tools/truncate.js +2 -0
- package/dist/core/tools/truncate.js.map +1 -0
- package/dist/core/tools/webfetch.d.ts +2 -0
- package/dist/core/tools/webfetch.d.ts.map +1 -0
- package/dist/core/tools/webfetch.js +2 -0
- package/dist/core/tools/webfetch.js.map +1 -0
- package/dist/core/tools/websearch.d.ts +2 -0
- package/dist/core/tools/websearch.d.ts.map +1 -0
- package/dist/core/tools/websearch.js +2 -0
- package/dist/core/tools/websearch.js.map +1 -0
- package/dist/core/tools/write.d.ts +2 -0
- package/dist/core/tools/write.d.ts.map +1 -0
- package/dist/core/tools/write.js +2 -0
- package/dist/core/tools/write.js.map +1 -0
- package/dist/index.d.ts +35 -29
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +33 -41
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +237 -225
- package/dist/main.js.map +1 -1
- package/dist/migrations.d.ts +0 -25
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +129 -180
- package/dist/migrations.js.map +1 -1
- package/dist/modes/index.d.ts +13 -6
- package/dist/modes/index.d.ts.map +1 -1
- package/dist/modes/index.js +11 -5
- package/dist/modes/index.js.map +1 -1
- package/dist/modes/interactive/components/armin.d.ts +8 -23
- package/dist/modes/interactive/components/armin.d.ts.map +1 -1
- package/dist/modes/interactive/components/armin.js +217 -266
- package/dist/modes/interactive/components/armin.js.map +1 -1
- package/dist/modes/interactive/components/assistant-message.d.ts +2 -168
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +61 -216
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/bash-execution.d.ts +6 -313
- package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/bash-execution.js +86 -403
- package/dist/modes/interactive/components/bash-execution.js.map +1 -1
- package/dist/modes/interactive/components/bordered-loader.d.ts +1 -3
- package/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -1
- package/dist/modes/interactive/components/bordered-loader.js +59 -29
- package/dist/modes/interactive/components/bordered-loader.js.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.d.ts +3 -3
- package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.js +30 -17
- package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.d.ts +3 -3
- package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.js +35 -18
- package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/config-selector.js +60 -68
- package/dist/modes/interactive/components/config-selector.js.map +1 -1
- package/dist/modes/interactive/components/countdown-timer.d.ts +2 -6
- package/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -1
- package/dist/modes/interactive/components/countdown-timer.js +32 -18
- package/dist/modes/interactive/components/countdown-timer.js.map +1 -1
- package/dist/modes/interactive/components/custom-editor.d.ts +1 -5
- package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-editor.js +45 -37
- package/dist/modes/interactive/components/custom-editor.js.map +1 -1
- package/dist/modes/interactive/components/custom-message.d.ts +5 -6
- package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-message.js +43 -53
- package/dist/modes/interactive/components/custom-message.js.map +1 -1
- package/dist/modes/interactive/components/diff.d.ts +0 -3
- package/dist/modes/interactive/components/diff.d.ts.map +1 -1
- package/dist/modes/interactive/components/diff.js +101 -108
- package/dist/modes/interactive/components/diff.js.map +1 -1
- package/dist/modes/interactive/components/dynamic-border.d.ts +7 -2
- package/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -1
- package/dist/modes/interactive/components/dynamic-border.js +24 -4
- package/dist/modes/interactive/components/dynamic-border.js.map +1 -1
- package/dist/modes/interactive/components/extension-editor.d.ts +5 -9
- package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-editor.js +43 -46
- package/dist/modes/interactive/components/extension-editor.js.map +1 -1
- package/dist/modes/interactive/components/extension-input.d.ts +4 -9
- package/dist/modes/interactive/components/extension-input.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-input.js +45 -28
- package/dist/modes/interactive/components/extension-input.js.map +1 -1
- package/dist/modes/interactive/components/extension-selector.d.ts +7 -12
- package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-selector.js +54 -32
- package/dist/modes/interactive/components/extension-selector.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts +2 -11
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +135 -183
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/index.d.ts +79 -30
- package/dist/modes/interactive/components/index.d.ts.map +1 -1
- package/dist/modes/interactive/components/index.js +73 -31
- package/dist/modes/interactive/components/index.js.map +1 -1
- package/dist/modes/interactive/components/keybinding-hints.d.ts +0 -18
- package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -1
- package/dist/modes/interactive/components/keybinding-hints.js +24 -31
- package/dist/modes/interactive/components/keybinding-hints.js.map +1 -1
- package/dist/modes/interactive/components/login-dialog.d.ts +11 -24
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
- package/dist/modes/interactive/components/login-dialog.js +89 -86
- package/dist/modes/interactive/components/login-dialog.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts +15 -19
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +104 -157
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.js +5 -5
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.d.ts +12 -22
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.js +111 -132
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
- package/dist/modes/interactive/components/session-selector-search.d.ts +3 -3
- package/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector-search.js +92 -103
- package/dist/modes/interactive/components/session-selector-search.js.map +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector.js +28 -39
- package/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +111 -203
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/show-images-selector.d.ts +1 -1
- package/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/show-images-selector.js +17 -19
- package/dist/modes/interactive/components/show-images-selector.js.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.d.ts +3 -3
- package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.js +29 -19
- package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
- package/dist/modes/interactive/components/theme-selector.d.ts +2 -2
- package/dist/modes/interactive/components/theme-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/theme-selector.js +20 -25
- package/dist/modes/interactive/components/theme-selector.js.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.d.ts +1 -1
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.js +19 -20
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +12 -10
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +14 -8
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector.js +53 -60
- package/dist/modes/interactive/components/tree-selector.js.map +1 -1
- package/dist/modes/interactive/components/user-message-selector.d.ts +3 -9
- package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message-selector.js +57 -68
- package/dist/modes/interactive/components/user-message-selector.js.map +1 -1
- package/dist/modes/interactive/components/visual-truncate.d.ts +0 -12
- package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -1
- package/dist/modes/interactive/components/visual-truncate.js +14 -22
- package/dist/modes/interactive/components/visual-truncate.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +6 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +118 -113
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +189 -39
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +8 -1
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +88 -59
- 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 +24 -46
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +75 -409
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js +21 -360
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/observability/core/config.d.ts +28 -0
- package/dist/observability/core/config.d.ts.map +1 -0
- package/dist/observability/core/config.js +150 -0
- package/dist/observability/core/config.js.map +1 -0
- package/dist/observability/core/event-bus.d.ts +15 -0
- package/dist/observability/core/event-bus.d.ts.map +1 -0
- package/dist/observability/core/event-bus.js +37 -0
- package/dist/observability/core/event-bus.js.map +1 -0
- package/dist/observability/core/index.d.ts +12 -0
- package/dist/observability/core/index.d.ts.map +1 -0
- package/dist/observability/core/index.js +14 -0
- package/dist/observability/core/index.js.map +1 -0
- package/dist/observability/core/observability.d.ts +63 -0
- package/dist/observability/core/observability.d.ts.map +1 -0
- package/dist/observability/core/observability.js +127 -0
- package/dist/observability/core/observability.js.map +1 -0
- package/dist/observability/core/span.d.ts +37 -0
- package/dist/observability/core/span.d.ts.map +1 -0
- package/dist/observability/core/span.js +90 -0
- package/dist/observability/core/span.js.map +1 -0
- package/dist/observability/core/tracer.d.ts +22 -0
- package/dist/observability/core/tracer.d.ts.map +1 -0
- package/dist/observability/core/tracer.js +79 -0
- package/dist/observability/core/tracer.js.map +1 -0
- package/dist/observability/core/types.d.ts +155 -0
- package/dist/observability/core/types.d.ts.map +1 -0
- package/dist/observability/core/types.js +38 -0
- package/dist/observability/core/types.js.map +1 -0
- package/dist/observability/exporters/base-exporter.d.ts +16 -0
- package/dist/observability/exporters/base-exporter.d.ts.map +1 -0
- package/dist/observability/exporters/base-exporter.js +26 -0
- package/dist/observability/exporters/base-exporter.js.map +1 -0
- package/dist/observability/exporters/console-exporter.d.ts +22 -0
- package/dist/observability/exporters/console-exporter.d.ts.map +1 -0
- package/dist/observability/exporters/console-exporter.js +80 -0
- package/dist/observability/exporters/console-exporter.js.map +1 -0
- package/dist/observability/exporters/file-exporter.d.ts +31 -0
- package/dist/observability/exporters/file-exporter.d.ts.map +1 -0
- package/dist/observability/exporters/file-exporter.js +120 -0
- package/dist/observability/exporters/file-exporter.js.map +1 -0
- package/dist/observability/exporters/index.d.ts +12 -0
- package/dist/observability/exporters/index.d.ts.map +1 -0
- package/dist/observability/exporters/index.js +11 -0
- package/dist/observability/exporters/index.js.map +1 -0
- package/dist/observability/exporters/langfuse-exporter.d.ts +27 -0
- package/dist/observability/exporters/langfuse-exporter.d.ts.map +1 -0
- package/dist/observability/exporters/langfuse-exporter.js +146 -0
- package/dist/observability/exporters/langfuse-exporter.js.map +1 -0
- package/dist/observability/exporters/sentry-exporter.d.ts +22 -0
- package/dist/observability/exporters/sentry-exporter.d.ts.map +1 -0
- package/dist/observability/exporters/sentry-exporter.js +121 -0
- package/dist/observability/exporters/sentry-exporter.js.map +1 -0
- package/dist/observability/index.d.ts +3 -0
- package/dist/observability/index.d.ts.map +1 -0
- package/dist/observability/index.js +3 -0
- package/dist/observability/index.js.map +1 -0
- package/dist/utils/changelog.d.ts +1 -2
- package/dist/utils/changelog.d.ts.map +1 -1
- package/dist/utils/changelog.js +53 -61
- package/dist/utils/changelog.js.map +1 -1
- package/dist/utils/clipboard-image.d.ts.map +1 -1
- package/dist/utils/clipboard-image.js +77 -83
- package/dist/utils/clipboard-image.js.map +1 -1
- package/dist/utils/clipboard.d.ts.map +1 -1
- package/dist/utils/clipboard.js +62 -49
- package/dist/utils/clipboard.js.map +1 -1
- package/dist/utils/image-convert.d.ts +6 -6
- package/dist/utils/image-convert.d.ts.map +1 -1
- package/dist/utils/image-convert.js +29 -23
- package/dist/utils/image-convert.js.map +1 -1
- package/dist/utils/image-resize.d.ts +0 -17
- package/dist/utils/image-resize.d.ts.map +1 -1
- package/dist/utils/image-resize.js +100 -138
- package/dist/utils/image-resize.js.map +1 -1
- package/dist/utils/mime.d.ts +1 -0
- package/dist/utils/mime.d.ts.map +1 -1
- package/dist/utils/mime.js +35 -15
- package/dist/utils/mime.js.map +1 -1
- package/dist/utils/photon.d.ts +4 -15
- package/dist/utils/photon.d.ts.map +1 -1
- package/dist/utils/photon.js +71 -60
- package/dist/utils/photon.js.map +1 -1
- package/dist/utils/shell.d.ts +4 -21
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js +101 -124
- package/dist/utils/shell.js.map +1 -1
- package/dist/utils/sleep.d.ts +1 -1
- package/dist/utils/sleep.d.ts.map +1 -1
- package/dist/utils/sleep.js +32 -8
- package/dist/utils/sleep.js.map +1 -1
- package/dist/utils/tools-manager.d.ts +4 -2
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +96 -122
- package/dist/utils/tools-manager.js.map +1 -1
- package/docs/PI_MONO_MIT_REMOVAL_GUIDE.md +2132 -0
- package/docs/SAME_TO_SAME_PARITY_REPORT.md +312 -0
- package/examples/README.md +12 -0
- package/package.json +62 -88
- package/dist/modes/interactive/theme/dark.json +0 -85
- package/dist/modes/interactive/theme/light.json +0 -84
- package/dist/modes/interactive/theme/theme-schema.json +0 -335
- package/docs/FEATURES.md +0 -306
- package/docs/MCP.md +0 -341
- package/docs/MEMORY.md +0 -443
- package/examples/mcp-servers.example.json +0 -50
|
@@ -1,175 +1,9 @@
|
|
|
1
1
|
import type { AssistantMessage } from "indusagi/ai";
|
|
2
2
|
import { Container, type MarkdownTheme } from "indusagi/tui";
|
|
3
|
-
/**
|
|
4
|
-
* ============================================================================
|
|
5
|
-
* ASSISTANT MESSAGE COMPONENT - RENDERING MODULE
|
|
6
|
-
* ============================================================================
|
|
7
|
-
*
|
|
8
|
-
* PURPOSE:
|
|
9
|
-
* ============================================================================
|
|
10
|
-
* Renders complete assistant messages with support for streaming text content,
|
|
11
|
-
* thinking blocks, and error states. This component is the core renderer for
|
|
12
|
-
* all AI assistant responses in the interactive chat interface.
|
|
13
|
-
*
|
|
14
|
-
* MESSAGE TYPES:
|
|
15
|
-
* - Text: Regular assistant responses with markdown formatting
|
|
16
|
-
* - Thinking: Internal reasoning traces (collapsible, italicized)
|
|
17
|
-
* - Errors: Graceful rendering of aborted/failed operations
|
|
18
|
-
* - Mixed: Multiple content types in sequence (text + thinking)
|
|
19
|
-
*
|
|
20
|
-
* DATA FLOW:
|
|
21
|
-
* ============================================================================
|
|
22
|
-
* Session Event Flow:
|
|
23
|
-
* AgentSession.prompt() emits message_streamed events
|
|
24
|
-
* ↓
|
|
25
|
-
* InteractiveMode.subscribeToAgent() receives event
|
|
26
|
-
* ↓
|
|
27
|
-
* AssistantMessage extracted from event.message
|
|
28
|
-
* ↓
|
|
29
|
-
* AssistantMessageComponent created or updateContent() called
|
|
30
|
-
* ↓
|
|
31
|
-
* contentContainer cleared and rebuilt
|
|
32
|
-
* ↓
|
|
33
|
-
* Markdown/Text components added for each content block
|
|
34
|
-
* ↓
|
|
35
|
-
* TUI invalidate() and requestRender()
|
|
36
|
-
* ↓
|
|
37
|
-
* Terminal renders styled markdown
|
|
38
|
-
*
|
|
39
|
-
* Component State Lifecycle:
|
|
40
|
-
* 1. Constructor: Initialize empty container, apply theme
|
|
41
|
-
* 2. updateContent(): Parse message.content array
|
|
42
|
-
* 3. For each content item:
|
|
43
|
-
* - Check if visible (non-empty text/thinking)
|
|
44
|
-
* - Apply appropriate styling and formatting
|
|
45
|
-
* - Add to contentContainer with spacing
|
|
46
|
-
* 4. Check for error/abort states
|
|
47
|
-
* 5. invalidate() on theme change: re-render preserving message
|
|
48
|
-
*
|
|
49
|
-
* RENDERING PIPELINE:
|
|
50
|
-
* ============================================================================
|
|
51
|
-
* Layout Structure (ASCII):
|
|
52
|
-
* ┌─────────────────────────────────────┐
|
|
53
|
-
* │ [Spacer 1 line] │ ← Top spacing
|
|
54
|
-
* ├─────────────────────────────────────┤
|
|
55
|
-
* │ Markdown: Regular assistant text │ ← Text content (if present)
|
|
56
|
-
* │ with code blocks, lists, etc. │
|
|
57
|
-
* ├─────────────────────────────────────┤
|
|
58
|
-
* │ [Thinking...] (or full thinking) │ ← Thinking block (if present)
|
|
59
|
-
* │ Italic, dimmed color │
|
|
60
|
-
* ├─────────────────────────────────────┤
|
|
61
|
-
* │ Error: Operation aborted │ ← Error message (if error)
|
|
62
|
-
* └─────────────────────────────────────┘
|
|
63
|
-
*
|
|
64
|
-
* Rendering Rules:
|
|
65
|
-
* 1. Only show spacer if content is visible (non-empty text/thinking)
|
|
66
|
-
* 2. Text content: full markdown rendering with syntax highlight
|
|
67
|
-
* 3. Thinking blocks:
|
|
68
|
-
* - If hideThinkingBlock=true: show compact "Thinking..." label
|
|
69
|
-
* - If hideThinkingBlock=false: show full thinking text in italic
|
|
70
|
-
* 4. Spacing: Spacer(1) between thinking and following text
|
|
71
|
-
* 5. Errors: Only shown if no tool calls in message (tools show their own errors)
|
|
72
|
-
*
|
|
73
|
-
* STYLING/FORMATTING:
|
|
74
|
-
* ============================================================================
|
|
75
|
-
* Color Scheme (from theme):
|
|
76
|
-
* - Text: markdownTheme colors (inherit from theme)
|
|
77
|
-
* - Thinking: theme.fg("thinkingText", text) + italic
|
|
78
|
-
* - Error: theme.fg("error", message)
|
|
79
|
-
* - Aborted: theme.fg("error", message) [same as error]
|
|
80
|
-
*
|
|
81
|
-
* Text Processing:
|
|
82
|
-
* - Markdown: Full markdown rendering (lists, code, emphasis, etc.)
|
|
83
|
-
* - Text trim(): Remove leading/trailing whitespace
|
|
84
|
-
* - Thinking italic: Applied via theme formatter
|
|
85
|
-
*
|
|
86
|
-
* Component Nesting:
|
|
87
|
-
* - AssistantMessageComponent (Container)
|
|
88
|
-
* └── contentContainer (Container)
|
|
89
|
-
* ├── Spacer(1) [conditional]
|
|
90
|
-
* ├── Markdown(text content) [0+ times]
|
|
91
|
-
* ├── Markdown(thinking) [italic] [0+ times]
|
|
92
|
-
* ├── Spacer(1) [between thinking and text]
|
|
93
|
-
* └── Text(error message) [conditional]
|
|
94
|
-
*
|
|
95
|
-
* EXAMPLES:
|
|
96
|
-
* ============================================================================
|
|
97
|
-
*
|
|
98
|
-
* Example 1: Regular Text Response
|
|
99
|
-
* ─────────────────────────────────
|
|
100
|
-
* Message content: [{ type: "text", text: "# Hello\n\nThis is a response" }]
|
|
101
|
-
* Rendered output:
|
|
102
|
-
* <blank line>
|
|
103
|
-
* # Hello
|
|
104
|
-
*
|
|
105
|
-
* This is a response
|
|
106
|
-
*
|
|
107
|
-
* Example 2: Response with Thinking
|
|
108
|
-
* ──────────────────────────────────
|
|
109
|
-
* Message content: [
|
|
110
|
-
* { type: "thinking", thinking: "Let me reason about this..." },
|
|
111
|
-
* { type: "text", text: "The answer is..." }
|
|
112
|
-
* ]
|
|
113
|
-
* Rendered output:
|
|
114
|
-
* <blank line>
|
|
115
|
-
* [italic, dim] Thinking...
|
|
116
|
-
* <blank line>
|
|
117
|
-
* The answer is...
|
|
118
|
-
*
|
|
119
|
-
* Example 3: Thinking with Full Trace (hideThinkingBlock=false)
|
|
120
|
-
* ───────────────────────────────────────────────────────────
|
|
121
|
-
* Message content: [
|
|
122
|
-
* { type: "thinking", thinking: "1. Check args\n2. Validate\n3. Execute" }
|
|
123
|
-
* ]
|
|
124
|
-
* Rendered output:
|
|
125
|
-
* <blank line>
|
|
126
|
-
* [italic, muted color]
|
|
127
|
-
* 1. Check args
|
|
128
|
-
* 2. Validate
|
|
129
|
-
* 3. Execute
|
|
130
|
-
*
|
|
131
|
-
* Example 4: Error State
|
|
132
|
-
* ──────────────────────
|
|
133
|
-
* Message: { stopReason: "error", errorMessage: "Rate limit exceeded" }
|
|
134
|
-
* Rendered output:
|
|
135
|
-
* Error: Rate limit exceeded
|
|
136
|
-
*
|
|
137
|
-
* INTEGRATION:
|
|
138
|
-
* ============================================================================
|
|
139
|
-
* TUI Integration:
|
|
140
|
-
* - Extends Container (indusagi/tui base component)
|
|
141
|
-
* - Uses Markdown, Text, Spacer from indusagi/tui
|
|
142
|
-
* - Theme system: getMarkdownTheme(), theme.fg(), theme.italic()
|
|
143
|
-
*
|
|
144
|
-
* Session Integration:
|
|
145
|
-
* - Created in InteractiveMode.handleEvent() for message_streamed
|
|
146
|
-
* - Updated via updateContent() as streaming progresses
|
|
147
|
-
* - Stored in chatContainer for display
|
|
148
|
-
*
|
|
149
|
-
* Theme Integration:
|
|
150
|
-
* - Listens to theme changes via invalidate()
|
|
151
|
-
* - Re-renders with new theme when theme.json changes
|
|
152
|
-
* - Preserves message content across re-renders
|
|
153
|
-
*
|
|
154
|
-
* Settings Integration:
|
|
155
|
-
* - hideThinkingBlock: Toggle thinking visibility
|
|
156
|
-
* - Can be changed after component creation via setHideThinkingBlock()
|
|
157
|
-
* - Changes take effect on next invalidate()
|
|
158
|
-
*
|
|
159
|
-
* Streaming Integration:
|
|
160
|
-
* - updateContent() called repeatedly as text arrives
|
|
161
|
-
* - Maintains lastMessage reference for invalidate() re-render
|
|
162
|
-
* - Efficient: only modifies contentContainer, not entire component tree
|
|
163
|
-
*
|
|
164
|
-
* Performance Notes:
|
|
165
|
-
* - Markdown rendering is cached by indusagi/tui library
|
|
166
|
-
* - invalidate() only re-renders contentContainer
|
|
167
|
-
* - Suitable for incremental streaming (100+ updates acceptable)
|
|
168
|
-
*/
|
|
169
3
|
export declare class AssistantMessageComponent extends Container {
|
|
170
|
-
private contentContainer;
|
|
4
|
+
private readonly contentContainer;
|
|
171
5
|
private hideThinkingBlock;
|
|
172
|
-
private markdownTheme;
|
|
6
|
+
private readonly markdownTheme;
|
|
173
7
|
private lastMessage?;
|
|
174
8
|
constructor(message?: AssistantMessage, hideThinkingBlock?: boolean, markdownTheme?: MarkdownTheme);
|
|
175
9
|
invalidate(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assistant-message.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/assistant-message.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,SAAS,EAAY,KAAK,aAAa,EAAgB,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"assistant-message.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/assistant-message.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,SAAS,EAAY,KAAK,aAAa,EAAgB,MAAM,cAAc,CAAC;AA0ErF,qBAAa,yBAA0B,SAAQ,SAAS;IACvD,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAY;IAC7C,OAAO,CAAC,iBAAiB,CAAU;IACnC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAgB;IAC9C,OAAO,CAAC,WAAW,CAAC,CAAmB;gBAGtC,OAAO,CAAC,EAAE,gBAAgB,EAC1B,iBAAiB,UAAQ,EACzB,aAAa,GAAE,aAAkC;IAYzC,UAAU,IAAI,IAAI;IAO3B,oBAAoB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI;IAIzC,aAAa,CAAC,OAAO,EAAE,gBAAgB,GAAG,IAAI;CAiB9C"}
|
|
@@ -1,177 +1,63 @@
|
|
|
1
1
|
import { Container, Markdown, Spacer, Text } from "indusagi/tui";
|
|
2
2
|
import { getMarkdownTheme, theme } from "../theme/theme.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
* │ with code blocks, lists, etc. │
|
|
57
|
-
* ├─────────────────────────────────────┤
|
|
58
|
-
* │ [Thinking...] (or full thinking) │ ← Thinking block (if present)
|
|
59
|
-
* │ Italic, dimmed color │
|
|
60
|
-
* ├─────────────────────────────────────┤
|
|
61
|
-
* │ Error: Operation aborted │ ← Error message (if error)
|
|
62
|
-
* └─────────────────────────────────────┘
|
|
63
|
-
*
|
|
64
|
-
* Rendering Rules:
|
|
65
|
-
* 1. Only show spacer if content is visible (non-empty text/thinking)
|
|
66
|
-
* 2. Text content: full markdown rendering with syntax highlight
|
|
67
|
-
* 3. Thinking blocks:
|
|
68
|
-
* - If hideThinkingBlock=true: show compact "Thinking..." label
|
|
69
|
-
* - If hideThinkingBlock=false: show full thinking text in italic
|
|
70
|
-
* 4. Spacing: Spacer(1) between thinking and following text
|
|
71
|
-
* 5. Errors: Only shown if no tool calls in message (tools show their own errors)
|
|
72
|
-
*
|
|
73
|
-
* STYLING/FORMATTING:
|
|
74
|
-
* ============================================================================
|
|
75
|
-
* Color Scheme (from theme):
|
|
76
|
-
* - Text: markdownTheme colors (inherit from theme)
|
|
77
|
-
* - Thinking: theme.fg("thinkingText", text) + italic
|
|
78
|
-
* - Error: theme.fg("error", message)
|
|
79
|
-
* - Aborted: theme.fg("error", message) [same as error]
|
|
80
|
-
*
|
|
81
|
-
* Text Processing:
|
|
82
|
-
* - Markdown: Full markdown rendering (lists, code, emphasis, etc.)
|
|
83
|
-
* - Text trim(): Remove leading/trailing whitespace
|
|
84
|
-
* - Thinking italic: Applied via theme formatter
|
|
85
|
-
*
|
|
86
|
-
* Component Nesting:
|
|
87
|
-
* - AssistantMessageComponent (Container)
|
|
88
|
-
* └── contentContainer (Container)
|
|
89
|
-
* ├── Spacer(1) [conditional]
|
|
90
|
-
* ├── Markdown(text content) [0+ times]
|
|
91
|
-
* ├── Markdown(thinking) [italic] [0+ times]
|
|
92
|
-
* ├── Spacer(1) [between thinking and text]
|
|
93
|
-
* └── Text(error message) [conditional]
|
|
94
|
-
*
|
|
95
|
-
* EXAMPLES:
|
|
96
|
-
* ============================================================================
|
|
97
|
-
*
|
|
98
|
-
* Example 1: Regular Text Response
|
|
99
|
-
* ─────────────────────────────────
|
|
100
|
-
* Message content: [{ type: "text", text: "# Hello\n\nThis is a response" }]
|
|
101
|
-
* Rendered output:
|
|
102
|
-
* <blank line>
|
|
103
|
-
* # Hello
|
|
104
|
-
*
|
|
105
|
-
* This is a response
|
|
106
|
-
*
|
|
107
|
-
* Example 2: Response with Thinking
|
|
108
|
-
* ──────────────────────────────────
|
|
109
|
-
* Message content: [
|
|
110
|
-
* { type: "thinking", thinking: "Let me reason about this..." },
|
|
111
|
-
* { type: "text", text: "The answer is..." }
|
|
112
|
-
* ]
|
|
113
|
-
* Rendered output:
|
|
114
|
-
* <blank line>
|
|
115
|
-
* [italic, dim] Thinking...
|
|
116
|
-
* <blank line>
|
|
117
|
-
* The answer is...
|
|
118
|
-
*
|
|
119
|
-
* Example 3: Thinking with Full Trace (hideThinkingBlock=false)
|
|
120
|
-
* ───────────────────────────────────────────────────────────
|
|
121
|
-
* Message content: [
|
|
122
|
-
* { type: "thinking", thinking: "1. Check args\n2. Validate\n3. Execute" }
|
|
123
|
-
* ]
|
|
124
|
-
* Rendered output:
|
|
125
|
-
* <blank line>
|
|
126
|
-
* [italic, muted color]
|
|
127
|
-
* 1. Check args
|
|
128
|
-
* 2. Validate
|
|
129
|
-
* 3. Execute
|
|
130
|
-
*
|
|
131
|
-
* Example 4: Error State
|
|
132
|
-
* ──────────────────────
|
|
133
|
-
* Message: { stopReason: "error", errorMessage: "Rate limit exceeded" }
|
|
134
|
-
* Rendered output:
|
|
135
|
-
* Error: Rate limit exceeded
|
|
136
|
-
*
|
|
137
|
-
* INTEGRATION:
|
|
138
|
-
* ============================================================================
|
|
139
|
-
* TUI Integration:
|
|
140
|
-
* - Extends Container (indusagi/tui base component)
|
|
141
|
-
* - Uses Markdown, Text, Spacer from indusagi/tui
|
|
142
|
-
* - Theme system: getMarkdownTheme(), theme.fg(), theme.italic()
|
|
143
|
-
*
|
|
144
|
-
* Session Integration:
|
|
145
|
-
* - Created in InteractiveMode.handleEvent() for message_streamed
|
|
146
|
-
* - Updated via updateContent() as streaming progresses
|
|
147
|
-
* - Stored in chatContainer for display
|
|
148
|
-
*
|
|
149
|
-
* Theme Integration:
|
|
150
|
-
* - Listens to theme changes via invalidate()
|
|
151
|
-
* - Re-renders with new theme when theme.json changes
|
|
152
|
-
* - Preserves message content across re-renders
|
|
153
|
-
*
|
|
154
|
-
* Settings Integration:
|
|
155
|
-
* - hideThinkingBlock: Toggle thinking visibility
|
|
156
|
-
* - Can be changed after component creation via setHideThinkingBlock()
|
|
157
|
-
* - Changes take effect on next invalidate()
|
|
158
|
-
*
|
|
159
|
-
* Streaming Integration:
|
|
160
|
-
* - updateContent() called repeatedly as text arrives
|
|
161
|
-
* - Maintains lastMessage reference for invalidate() re-render
|
|
162
|
-
* - Efficient: only modifies contentContainer, not entire component tree
|
|
163
|
-
*
|
|
164
|
-
* Performance Notes:
|
|
165
|
-
* - Markdown rendering is cached by indusagi/tui library
|
|
166
|
-
* - invalidate() only re-renders contentContainer
|
|
167
|
-
* - Suitable for incremental streaming (100+ updates acceptable)
|
|
168
|
-
*/
|
|
3
|
+
function extractAssistantRenderableBlocks(message) {
|
|
4
|
+
const blocks = [];
|
|
5
|
+
for (let index = 0; index < message.content.length; index++) {
|
|
6
|
+
const content = message.content[index];
|
|
7
|
+
if (content.type === "text" && content.text.trim()) {
|
|
8
|
+
blocks.push({ kind: "text", value: content.text.trim(), hasTextAfter: false });
|
|
9
|
+
continue;
|
|
10
|
+
}
|
|
11
|
+
if (content.type === "thinking" && content.thinking.trim()) {
|
|
12
|
+
blocks.push({
|
|
13
|
+
kind: "thinking",
|
|
14
|
+
value: content.thinking.trim(),
|
|
15
|
+
hasTextAfter: message.content.slice(index + 1).some((next) => next.type === "text" && next.text.trim()),
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return blocks;
|
|
20
|
+
}
|
|
21
|
+
function renderAssistantThinking(container, block, hideThinkingBlock, markdownTheme) {
|
|
22
|
+
if (hideThinkingBlock) {
|
|
23
|
+
container.addChild(new Text(theme.italic(theme.fg("thinkingText", "Thinking...")), 1, 0));
|
|
24
|
+
if (block.hasTextAfter) {
|
|
25
|
+
container.addChild(new Spacer(1));
|
|
26
|
+
}
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
container.addChild(new Markdown(block.value, 1, 0, markdownTheme, {
|
|
30
|
+
color: (text) => theme.fg("thinkingText", text),
|
|
31
|
+
italic: true,
|
|
32
|
+
}));
|
|
33
|
+
container.addChild(new Spacer(1));
|
|
34
|
+
}
|
|
35
|
+
function renderAssistantText(container, block, markdownTheme) {
|
|
36
|
+
container.addChild(new Markdown(block.value, 1, 0, markdownTheme));
|
|
37
|
+
}
|
|
38
|
+
function renderAssistantErrorState(container, message) {
|
|
39
|
+
const hasToolCalls = message.content.some((content) => content.type === "toolCall");
|
|
40
|
+
if (hasToolCalls) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
if (message.stopReason === "aborted") {
|
|
44
|
+
const abortMessage = message.errorMessage && message.errorMessage !== "Request was aborted"
|
|
45
|
+
? message.errorMessage
|
|
46
|
+
: "Operation aborted";
|
|
47
|
+
container.addChild(new Spacer(1));
|
|
48
|
+
container.addChild(new Text(theme.fg("error", abortMessage), 1, 0));
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
if (message.stopReason === "error") {
|
|
52
|
+
container.addChild(new Spacer(1));
|
|
53
|
+
container.addChild(new Text(theme.fg("error", `Error: ${message.errorMessage || "Unknown error"}`), 1, 0));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
169
56
|
export class AssistantMessageComponent extends Container {
|
|
170
57
|
constructor(message, hideThinkingBlock = false, markdownTheme = getMarkdownTheme()) {
|
|
171
58
|
super();
|
|
172
59
|
this.hideThinkingBlock = hideThinkingBlock;
|
|
173
60
|
this.markdownTheme = markdownTheme;
|
|
174
|
-
// Container for text/thinking content
|
|
175
61
|
this.contentContainer = new Container();
|
|
176
62
|
this.addChild(this.contentContainer);
|
|
177
63
|
if (message) {
|
|
@@ -189,62 +75,21 @@ export class AssistantMessageComponent extends Container {
|
|
|
189
75
|
}
|
|
190
76
|
updateContent(message) {
|
|
191
77
|
this.lastMessage = message;
|
|
192
|
-
// Clear content container
|
|
193
78
|
this.contentContainer.clear();
|
|
194
|
-
const
|
|
79
|
+
const blocks = extractAssistantRenderableBlocks(message);
|
|
80
|
+
const hasVisibleContent = blocks.length > 0;
|
|
195
81
|
if (hasVisibleContent) {
|
|
196
82
|
this.contentContainer.addChild(new Spacer(1));
|
|
197
83
|
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
if (content.type === "text" && content.text.trim()) {
|
|
202
|
-
// Assistant text messages with no background - trim the text
|
|
203
|
-
// Set paddingY=0 to avoid extra spacing before tool executions
|
|
204
|
-
this.contentContainer.addChild(new Markdown(content.text.trim(), 1, 0, this.markdownTheme));
|
|
205
|
-
}
|
|
206
|
-
else if (content.type === "thinking" && content.thinking.trim()) {
|
|
207
|
-
// Check if there's text content after this thinking block
|
|
208
|
-
const hasTextAfter = message.content.slice(i + 1).some((c) => c.type === "text" && c.text.trim());
|
|
209
|
-
if (this.hideThinkingBlock) {
|
|
210
|
-
// Show static "Thinking..." label when hidden
|
|
211
|
-
this.contentContainer.addChild(new Text(theme.italic(theme.fg("thinkingText", "Thinking...")), 1, 0));
|
|
212
|
-
if (hasTextAfter) {
|
|
213
|
-
this.contentContainer.addChild(new Spacer(1));
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
else {
|
|
217
|
-
// Thinking traces in thinkingText color, italic
|
|
218
|
-
this.contentContainer.addChild(new Markdown(content.thinking.trim(), 1, 0, this.markdownTheme, {
|
|
219
|
-
color: (text) => theme.fg("thinkingText", text),
|
|
220
|
-
italic: true,
|
|
221
|
-
}));
|
|
222
|
-
this.contentContainer.addChild(new Spacer(1));
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
// Check if aborted - show after partial content
|
|
227
|
-
// But only if there are no tool calls (tool execution components will show the error)
|
|
228
|
-
const hasToolCalls = message.content.some((c) => c.type === "toolCall");
|
|
229
|
-
if (!hasToolCalls) {
|
|
230
|
-
if (message.stopReason === "aborted") {
|
|
231
|
-
const abortMessage = message.errorMessage && message.errorMessage !== "Request was aborted"
|
|
232
|
-
? message.errorMessage
|
|
233
|
-
: "Operation aborted";
|
|
234
|
-
if (hasVisibleContent) {
|
|
235
|
-
this.contentContainer.addChild(new Spacer(1));
|
|
236
|
-
}
|
|
237
|
-
else {
|
|
238
|
-
this.contentContainer.addChild(new Spacer(1));
|
|
239
|
-
}
|
|
240
|
-
this.contentContainer.addChild(new Text(theme.fg("error", abortMessage), 1, 0));
|
|
84
|
+
for (const block of blocks) {
|
|
85
|
+
if (block.kind === "text") {
|
|
86
|
+
renderAssistantText(this.contentContainer, block, this.markdownTheme);
|
|
241
87
|
}
|
|
242
|
-
else
|
|
243
|
-
|
|
244
|
-
this.contentContainer.addChild(new Spacer(1));
|
|
245
|
-
this.contentContainer.addChild(new Text(theme.fg("error", `Error: ${errorMsg}`), 1, 0));
|
|
88
|
+
else {
|
|
89
|
+
renderAssistantThinking(this.contentContainer, block, this.hideThinkingBlock, this.markdownTheme);
|
|
246
90
|
}
|
|
247
91
|
}
|
|
92
|
+
renderAssistantErrorState(this.contentContainer, message);
|
|
248
93
|
}
|
|
249
94
|
}
|
|
250
95
|
//# sourceMappingURL=assistant-message.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assistant-message.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/assistant-message.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAsB,MAAM,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACrF,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"assistant-message.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/assistant-message.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,QA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