indusagi-coding-agent 0.1.38 → 0.1.39
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 +13 -7
- 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 +23 -0
- 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 +7 -1
- 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/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 +60 -88
- package/LICENSE.md +0 -22
- 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
|
@@ -0,0 +1,433 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTML Export System - Export agent sessions to standalone HTML files
|
|
3
|
+
*
|
|
4
|
+
* Purpose:
|
|
5
|
+
* Converts JSONL session files to beautiful, interactive HTML pages that can be
|
|
6
|
+
* shared, archived, or viewed in any browser. Supports custom themes and tool rendering.
|
|
7
|
+
*
|
|
8
|
+
* Architecture:
|
|
9
|
+
* - Index.ts: Main export orchestration and color/theme handling
|
|
10
|
+
* - ansi-to-html.ts: ANSI color code conversion to HTML
|
|
11
|
+
* - tool-renderer.ts: Custom tool output rendering
|
|
12
|
+
* - template.html: Base HTML structure
|
|
13
|
+
* - template.css: Styling and responsive design
|
|
14
|
+
* - template.js: Client-side interactivity
|
|
15
|
+
*
|
|
16
|
+
* Key Features:
|
|
17
|
+
* - Theme support (dark/light mode, custom colors)
|
|
18
|
+
* - ANSI color preservation from terminal output
|
|
19
|
+
* - Custom tool output rendering via extensions
|
|
20
|
+
* - Responsive design (works on mobile)
|
|
21
|
+
* - Interactive features (expand/collapse, copy, etc.)
|
|
22
|
+
* - Self-contained HTML (no external dependencies)
|
|
23
|
+
* - Message formatting with markdown support
|
|
24
|
+
* - Tool output with syntax highlighting
|
|
25
|
+
*
|
|
26
|
+
* Export Process:
|
|
27
|
+
* 1. Load session from JSONL file
|
|
28
|
+
* 2. Extract all messages and metadata
|
|
29
|
+
* 3. Apply theme colors to template
|
|
30
|
+
* 4. Convert ANSI codes to HTML spans
|
|
31
|
+
* 5. Render tool outputs (custom or default)
|
|
32
|
+
* 6. Generate final HTML with inline CSS/JS
|
|
33
|
+
* 7. Write to output file
|
|
34
|
+
*
|
|
35
|
+
* Theme System:
|
|
36
|
+
* - Uses theme colors from config
|
|
37
|
+
* - Maps terminal colors to HTML/CSS colors
|
|
38
|
+
* - Supports both dark and light modes
|
|
39
|
+
* - Color derivation for exports (luminance-aware)
|
|
40
|
+
* - Custom color parsing (hex, rgb formats)
|
|
41
|
+
*
|
|
42
|
+
* ANSI Color Code Handling:
|
|
43
|
+
* - Converts terminal ANSI codes (e.g., \x1b[31m) to HTML
|
|
44
|
+
* - Preserves colors from bash output, tool results, etc.
|
|
45
|
+
* - Supports foreground, background, and attribute codes
|
|
46
|
+
* - Gracefully handles incomplete/malformed codes
|
|
47
|
+
*
|
|
48
|
+
* Tool Rendering:
|
|
49
|
+
* - Default: Shows raw output with syntax highlighting
|
|
50
|
+
* - Custom: Extensions can provide tool-specific renderers
|
|
51
|
+
* - Examples:
|
|
52
|
+
* - Bash tool: Syntax-highlighted code blocks
|
|
53
|
+
* - Read tool: Formatted file contents
|
|
54
|
+
* - Edit tool: Diff-style before/after
|
|
55
|
+
* - Web fetch: Formatted HTML/JSON preview
|
|
56
|
+
*
|
|
57
|
+
* HTML Output Structure:
|
|
58
|
+
* ```html
|
|
59
|
+
* <!DOCTYPE html>
|
|
60
|
+
* <html>
|
|
61
|
+
* <head>
|
|
62
|
+
* <style><!-- theme colors + template.css --></style>
|
|
63
|
+
* </head>
|
|
64
|
+
* <body>
|
|
65
|
+
* <div class="session">
|
|
66
|
+
* <div class="message user"><!-- user message --></div>
|
|
67
|
+
* <div class="message assistant"><!-- assistant message --></div>
|
|
68
|
+
* <div class="tool-call"><!-- tool execution --></div>
|
|
69
|
+
* <div class="tool-result"><!-- tool result --></div>
|
|
70
|
+
* </div>
|
|
71
|
+
* <script><!-- template.js --></script>
|
|
72
|
+
* </body>
|
|
73
|
+
* </html>
|
|
74
|
+
* ```
|
|
75
|
+
*
|
|
76
|
+
* Usage Examples:
|
|
77
|
+
* ```typescript
|
|
78
|
+
* // Export session to HTML
|
|
79
|
+
* await exportSessionToHtml(
|
|
80
|
+
* "session-id",
|
|
81
|
+
* {
|
|
82
|
+
* outputPath: "/path/to/output.html",
|
|
83
|
+
* themeName: "dark",
|
|
84
|
+
* toolRenderer: customRenderer
|
|
85
|
+
* }
|
|
86
|
+
* );
|
|
87
|
+
*
|
|
88
|
+
* // Use default output path
|
|
89
|
+
* await exportSessionToHtml("session-id");
|
|
90
|
+
* // → ~/.indusagi/exports/session-id.html
|
|
91
|
+
* ```
|
|
92
|
+
*
|
|
93
|
+
* Color Handling:
|
|
94
|
+
* - Parse CSS color formats (hex, rgb)
|
|
95
|
+
* - Calculate luminance for light/dark detection
|
|
96
|
+
* - Adjust brightness for export backgrounds
|
|
97
|
+
* - Preserve original theme colors in HTML
|
|
98
|
+
* - Support for both resolved and export-specific colors
|
|
99
|
+
*
|
|
100
|
+
* File Size Considerations:
|
|
101
|
+
* - Self-contained HTML (no external CDNs)
|
|
102
|
+
* - Can handle large sessions (100MB+ JSONL)
|
|
103
|
+
* - Streaming processing where possible
|
|
104
|
+
* - Inline CSS/JS to minimize files
|
|
105
|
+
* - Base64 encoding for any embedded resources
|
|
106
|
+
*
|
|
107
|
+
* Browser Compatibility:
|
|
108
|
+
* - Modern browsers (Chrome, Firefox, Safari, Edge)
|
|
109
|
+
* - ES6 JavaScript support required
|
|
110
|
+
* - CSS Grid and Flexbox used for layout
|
|
111
|
+
* - Mobile responsive via media queries
|
|
112
|
+
*
|
|
113
|
+
* Troubleshooting:
|
|
114
|
+
* - Missing colors: Falls back to defaults
|
|
115
|
+
* - Invalid theme: Uses dark mode defaults
|
|
116
|
+
* - Broken session file: Shows error message
|
|
117
|
+
* - Large files: May take time but should complete
|
|
118
|
+
*
|
|
119
|
+
* Related Files:
|
|
120
|
+
* - Session format: src/core/session-manager.ts
|
|
121
|
+
* - Theme system: src/modes/interactive/theme/
|
|
122
|
+
* - Tool system: src/core/tools/
|
|
123
|
+
* - ANSI conversion: ansi-to-html.ts
|
|
124
|
+
*
|
|
125
|
+
* Based on HTML export patterns from ChatGPT and Claude
|
|
126
|
+
* Original inspiration: https://openai.com, https://claude.ai
|
|
127
|
+
* Adapted for indusagi sessions and themes
|
|
128
|
+
*/
|
|
129
|
+
|
|
130
|
+
import type { AgentState } from "indusagi/agent";
|
|
131
|
+
import { existsSync, readFileSync, writeFileSync } from "fs";
|
|
132
|
+
import { basename, join } from "path";
|
|
133
|
+
import { APP_NAME, getExportTemplateDir } from "../../config.js";
|
|
134
|
+
import { getResolvedThemeColors, getThemeExportColors } from "../../modes/interactive/theme/theme.js";
|
|
135
|
+
import type { SessionEntry } from "../session-manager.js";
|
|
136
|
+
import { SessionManager } from "../session-manager.js";
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Interface for rendering custom tools to HTML.
|
|
140
|
+
* Used by agent-session to pre-render extension tool output.
|
|
141
|
+
*/
|
|
142
|
+
export interface ToolHtmlRenderer {
|
|
143
|
+
/** Render a tool call to HTML. Returns undefined if tool has no custom renderer. */
|
|
144
|
+
renderCall(toolName: string, args: unknown): string | undefined;
|
|
145
|
+
/** Render a tool result to HTML. Returns undefined if tool has no custom renderer. */
|
|
146
|
+
renderResult(
|
|
147
|
+
toolName: string,
|
|
148
|
+
result: Array<{ type: string; text?: string; data?: string; mimeType?: string }>,
|
|
149
|
+
details: unknown,
|
|
150
|
+
isError: boolean,
|
|
151
|
+
): string | undefined;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/** Pre-rendered HTML for a custom tool call and result */
|
|
155
|
+
interface RenderedToolHtml {
|
|
156
|
+
callHtml?: string;
|
|
157
|
+
resultHtml?: string;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export interface ExportOptions {
|
|
161
|
+
outputPath?: string;
|
|
162
|
+
themeName?: string;
|
|
163
|
+
/** Optional tool renderer for custom tools */
|
|
164
|
+
toolRenderer?: ToolHtmlRenderer;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/** Parse a color string to RGB values. Supports hex (#RRGGBB) and rgb(r,g,b) formats. */
|
|
168
|
+
function parseColor(color: string): { r: number; g: number; b: number } | undefined {
|
|
169
|
+
const hexMatch = color.match(/^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/);
|
|
170
|
+
if (hexMatch) {
|
|
171
|
+
return {
|
|
172
|
+
r: Number.parseInt(hexMatch[1], 16),
|
|
173
|
+
g: Number.parseInt(hexMatch[2], 16),
|
|
174
|
+
b: Number.parseInt(hexMatch[3], 16),
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
const rgbMatch = color.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/);
|
|
178
|
+
if (rgbMatch) {
|
|
179
|
+
return {
|
|
180
|
+
r: Number.parseInt(rgbMatch[1], 10),
|
|
181
|
+
g: Number.parseInt(rgbMatch[2], 10),
|
|
182
|
+
b: Number.parseInt(rgbMatch[3], 10),
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
return undefined;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/** Calculate relative luminance of a color (0-1, higher = lighter). */
|
|
189
|
+
function getLuminance(r: number, g: number, b: number): number {
|
|
190
|
+
const toLinear = (c: number) => {
|
|
191
|
+
const s = c / 255;
|
|
192
|
+
return s <= 0.03928 ? s / 12.92 : ((s + 0.055) / 1.055) ** 2.4;
|
|
193
|
+
};
|
|
194
|
+
return 0.2126 * toLinear(r) + 0.7152 * toLinear(g) + 0.0722 * toLinear(b);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/** Adjust color brightness. Factor > 1 lightens, < 1 darkens. */
|
|
198
|
+
function adjustBrightness(color: string, factor: number): string {
|
|
199
|
+
const parsed = parseColor(color);
|
|
200
|
+
if (!parsed) return color;
|
|
201
|
+
const adjust = (c: number) => Math.min(255, Math.max(0, Math.round(c * factor)));
|
|
202
|
+
return `rgb(${adjust(parsed.r)}, ${adjust(parsed.g)}, ${adjust(parsed.b)})`;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/** Derive export background colors from a base color (e.g., userMessageBg). */
|
|
206
|
+
function deriveExportColors(baseColor: string): { pageBg: string; cardBg: string; infoBg: string } {
|
|
207
|
+
const parsed = parseColor(baseColor);
|
|
208
|
+
if (!parsed) {
|
|
209
|
+
return {
|
|
210
|
+
pageBg: "rgb(24, 24, 30)",
|
|
211
|
+
cardBg: "rgb(30, 30, 36)",
|
|
212
|
+
infoBg: "rgb(60, 55, 40)",
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
const luminance = getLuminance(parsed.r, parsed.g, parsed.b);
|
|
217
|
+
const isLight = luminance > 0.5;
|
|
218
|
+
|
|
219
|
+
if (isLight) {
|
|
220
|
+
return {
|
|
221
|
+
pageBg: adjustBrightness(baseColor, 0.96),
|
|
222
|
+
cardBg: baseColor,
|
|
223
|
+
infoBg: `rgb(${Math.min(255, parsed.r + 10)}, ${Math.min(255, parsed.g + 5)}, ${Math.max(0, parsed.b - 20)})`,
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
return {
|
|
227
|
+
pageBg: adjustBrightness(baseColor, 0.7),
|
|
228
|
+
cardBg: adjustBrightness(baseColor, 0.85),
|
|
229
|
+
infoBg: `rgb(${Math.min(255, parsed.r + 20)}, ${Math.min(255, parsed.g + 15)}, ${parsed.b})`,
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Generate CSS custom property declarations from theme colors.
|
|
235
|
+
*/
|
|
236
|
+
function generateThemeVars(themeName?: string): string {
|
|
237
|
+
const colors = getResolvedThemeColors(themeName);
|
|
238
|
+
const lines: string[] = [];
|
|
239
|
+
for (const [key, value] of Object.entries(colors)) {
|
|
240
|
+
lines.push(`--${key}: ${value};`);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// Use explicit theme export colors if available, otherwise derive from userMessageBg
|
|
244
|
+
const themeExport = getThemeExportColors(themeName);
|
|
245
|
+
const userMessageBg = colors.userMessageBg || "#343541";
|
|
246
|
+
const derivedColors = deriveExportColors(userMessageBg);
|
|
247
|
+
|
|
248
|
+
lines.push(`--exportPageBg: ${themeExport.pageBg ?? derivedColors.pageBg};`);
|
|
249
|
+
lines.push(`--exportCardBg: ${themeExport.cardBg ?? derivedColors.cardBg};`);
|
|
250
|
+
lines.push(`--exportInfoBg: ${themeExport.infoBg ?? derivedColors.infoBg};`);
|
|
251
|
+
|
|
252
|
+
return lines.join("\n ");
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
interface SessionData {
|
|
256
|
+
header: ReturnType<SessionManager["getHeader"]>;
|
|
257
|
+
entries: ReturnType<SessionManager["getEntries"]>;
|
|
258
|
+
leafId: string | null;
|
|
259
|
+
systemPrompt?: string;
|
|
260
|
+
tools?: { name: string; description: string }[];
|
|
261
|
+
/** Pre-rendered HTML for custom tool calls/results, keyed by tool call ID */
|
|
262
|
+
renderedTools?: Record<string, RenderedToolHtml>;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Core HTML generation logic shared by both export functions.
|
|
267
|
+
*/
|
|
268
|
+
function generateHtml(sessionData: SessionData, themeName?: string): string {
|
|
269
|
+
const templateDir = getExportTemplateDir();
|
|
270
|
+
const template = readFileSync(join(templateDir, "template.html"), "utf-8");
|
|
271
|
+
const templateCss = readFileSync(join(templateDir, "template.css"), "utf-8");
|
|
272
|
+
const templateJs = readFileSync(join(templateDir, "template.js"), "utf-8");
|
|
273
|
+
const markedJs = readFileSync(join(templateDir, "vendor", "marked.min.js"), "utf-8");
|
|
274
|
+
const hljsJs = readFileSync(join(templateDir, "vendor", "highlight.min.js"), "utf-8");
|
|
275
|
+
|
|
276
|
+
const themeVars = generateThemeVars(themeName);
|
|
277
|
+
const colors = getResolvedThemeColors(themeName);
|
|
278
|
+
const exportColors = deriveExportColors(colors.userMessageBg || "#343541");
|
|
279
|
+
const bodyBg = exportColors.pageBg;
|
|
280
|
+
const containerBg = exportColors.cardBg;
|
|
281
|
+
const infoBg = exportColors.infoBg;
|
|
282
|
+
|
|
283
|
+
// Base64 encode session data to avoid escaping issues
|
|
284
|
+
const sessionDataBase64 = Buffer.from(JSON.stringify(sessionData)).toString("base64");
|
|
285
|
+
|
|
286
|
+
// Build the CSS with theme variables injected
|
|
287
|
+
const css = templateCss
|
|
288
|
+
.replace("{{THEME_VARS}}", themeVars)
|
|
289
|
+
.replace("{{BODY_BG}}", bodyBg)
|
|
290
|
+
.replace("{{CONTAINER_BG}}", containerBg)
|
|
291
|
+
.replace("{{INFO_BG}}", infoBg);
|
|
292
|
+
|
|
293
|
+
return template
|
|
294
|
+
.replace("{{CSS}}", css)
|
|
295
|
+
.replace("{{JS}}", templateJs)
|
|
296
|
+
.replace("{{SESSION_DATA}}", sessionDataBase64)
|
|
297
|
+
.replace("{{MARKED_JS}}", markedJs)
|
|
298
|
+
.replace("{{HIGHLIGHT_JS}}", hljsJs);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/** Built-in tool names that have custom rendering in template.js */
|
|
302
|
+
const BUILTIN_TOOLS = new Set(["bash", "read", "write", "edit", "ls", "find", "grep"]);
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* Pre-render custom tools to HTML using their TUI renderers.
|
|
306
|
+
*/
|
|
307
|
+
function preRenderCustomTools(
|
|
308
|
+
entries: SessionEntry[],
|
|
309
|
+
toolRenderer: ToolHtmlRenderer,
|
|
310
|
+
): Record<string, RenderedToolHtml> {
|
|
311
|
+
const renderedTools: Record<string, RenderedToolHtml> = {};
|
|
312
|
+
|
|
313
|
+
for (const entry of entries) {
|
|
314
|
+
if (entry.type !== "message") continue;
|
|
315
|
+
const msg = entry.message;
|
|
316
|
+
|
|
317
|
+
// Find tool calls in assistant messages
|
|
318
|
+
if (msg.role === "assistant" && Array.isArray(msg.content)) {
|
|
319
|
+
for (const block of msg.content) {
|
|
320
|
+
if (block.type === "toolCall" && !BUILTIN_TOOLS.has(block.name)) {
|
|
321
|
+
const callHtml = toolRenderer.renderCall(block.name, block.arguments);
|
|
322
|
+
if (callHtml) {
|
|
323
|
+
renderedTools[block.id] = { callHtml };
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
// Find tool results
|
|
330
|
+
if (msg.role === "toolResult" && msg.toolCallId) {
|
|
331
|
+
const toolName = msg.toolName || "";
|
|
332
|
+
// Only render if we have a pre-rendered call OR it's not a built-in tool
|
|
333
|
+
const existing = renderedTools[msg.toolCallId];
|
|
334
|
+
if (existing || !BUILTIN_TOOLS.has(toolName)) {
|
|
335
|
+
const resultHtml = toolRenderer.renderResult(toolName, msg.content, msg.details, msg.isError || false);
|
|
336
|
+
if (resultHtml) {
|
|
337
|
+
renderedTools[msg.toolCallId] = {
|
|
338
|
+
...existing,
|
|
339
|
+
resultHtml,
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
return renderedTools;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Export session to HTML using SessionManager and AgentState.
|
|
351
|
+
* Used by TUI's /export command.
|
|
352
|
+
*/
|
|
353
|
+
export async function exportSessionToHtml(
|
|
354
|
+
sm: SessionManager,
|
|
355
|
+
state?: AgentState,
|
|
356
|
+
options?: ExportOptions | string,
|
|
357
|
+
): Promise<string> {
|
|
358
|
+
const opts: ExportOptions = typeof options === "string" ? { outputPath: options } : options || {};
|
|
359
|
+
|
|
360
|
+
const sessionFile = sm.getSessionFile();
|
|
361
|
+
if (!sessionFile) {
|
|
362
|
+
throw new Error("Cannot export in-memory session to HTML");
|
|
363
|
+
}
|
|
364
|
+
if (!existsSync(sessionFile)) {
|
|
365
|
+
throw new Error("Nothing to export yet - start a conversation first");
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
const entries = sm.getEntries();
|
|
369
|
+
|
|
370
|
+
// Pre-render custom tools if a tool renderer is provided
|
|
371
|
+
let renderedTools: Record<string, RenderedToolHtml> | undefined;
|
|
372
|
+
if (opts.toolRenderer) {
|
|
373
|
+
renderedTools = preRenderCustomTools(entries, opts.toolRenderer);
|
|
374
|
+
// Only include if we actually rendered something
|
|
375
|
+
if (Object.keys(renderedTools).length === 0) {
|
|
376
|
+
renderedTools = undefined;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
const sessionData: SessionData = {
|
|
381
|
+
header: sm.getHeader(),
|
|
382
|
+
entries,
|
|
383
|
+
leafId: sm.getLeafId(),
|
|
384
|
+
systemPrompt: state?.systemPrompt,
|
|
385
|
+
tools: state?.tools?.map((t) => ({ name: t.name, description: t.description })),
|
|
386
|
+
renderedTools,
|
|
387
|
+
};
|
|
388
|
+
|
|
389
|
+
const html = generateHtml(sessionData, opts.themeName);
|
|
390
|
+
|
|
391
|
+
let outputPath = opts.outputPath;
|
|
392
|
+
if (!outputPath) {
|
|
393
|
+
const sessionBasename = basename(sessionFile, ".jsonl");
|
|
394
|
+
outputPath = `${APP_NAME}-session-${sessionBasename}.html`;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
writeFileSync(outputPath, html, "utf8");
|
|
398
|
+
return outputPath;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* Export session file to HTML (standalone, without AgentState).
|
|
403
|
+
* Used by CLI for exporting arbitrary session files.
|
|
404
|
+
*/
|
|
405
|
+
export async function exportFromFile(inputPath: string, options?: ExportOptions | string): Promise<string> {
|
|
406
|
+
const opts: ExportOptions = typeof options === "string" ? { outputPath: options } : options || {};
|
|
407
|
+
|
|
408
|
+
if (!existsSync(inputPath)) {
|
|
409
|
+
throw new Error(`File not found: ${inputPath}`);
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
const sm = SessionManager.open(inputPath);
|
|
413
|
+
|
|
414
|
+
const sessionData: SessionData = {
|
|
415
|
+
header: sm.getHeader(),
|
|
416
|
+
entries: sm.getEntries(),
|
|
417
|
+
leafId: sm.getLeafId(),
|
|
418
|
+
systemPrompt: undefined,
|
|
419
|
+
tools: undefined,
|
|
420
|
+
};
|
|
421
|
+
|
|
422
|
+
const html = generateHtml(sessionData, opts.themeName);
|
|
423
|
+
|
|
424
|
+
let outputPath = opts.outputPath;
|
|
425
|
+
if (!outputPath) {
|
|
426
|
+
const inputBasename = basename(inputPath, ".jsonl");
|
|
427
|
+
outputPath = `${APP_NAME}-session-${inputBasename}.html`;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
writeFileSync(outputPath, html, "utf8");
|
|
431
|
+
return outputPath;
|
|
432
|
+
}
|
|
433
|
+
|
|
@@ -9,44 +9,66 @@
|
|
|
9
9
|
</style>
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
|
12
|
-
<
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
<
|
|
18
|
-
|
|
12
|
+
<div id="export-shell">
|
|
13
|
+
<button id="hamburger" title="Toggle conversation tree" aria-label="Toggle conversation tree">
|
|
14
|
+
<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor" stroke="none">
|
|
15
|
+
<circle cx="6" cy="6" r="2.5"></circle>
|
|
16
|
+
<circle cx="6" cy="18" r="2.5"></circle>
|
|
17
|
+
<circle cx="18" cy="12" r="2.5"></circle>
|
|
18
|
+
<rect x="5" y="6" width="2" height="12"></rect>
|
|
19
|
+
<path d="M6 12h10c1 0 2 0 2-2V8"></path>
|
|
20
|
+
</svg>
|
|
21
|
+
</button>
|
|
22
|
+
|
|
23
|
+
<div id="sidebar-overlay"></div>
|
|
24
|
+
|
|
25
|
+
<div id="app" class="export-layout">
|
|
26
|
+
<aside id="sidebar" class="nav-panel">
|
|
27
|
+
<div class="nav-panel-topbar">
|
|
28
|
+
<div class="nav-panel-title-wrap">
|
|
29
|
+
<strong class="nav-panel-title">Conversation tree</strong>
|
|
30
|
+
<span class="nav-panel-subtitle">Navigate branches and filter entries</span>
|
|
31
|
+
</div>
|
|
32
|
+
<button class="sidebar-close" id="sidebar-close" title="Close navigation">✕</button>
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
<div class="nav-panel-search-row">
|
|
36
|
+
<input type="text" class="sidebar-search" id="tree-search" placeholder="Search conversation...">
|
|
19
37
|
</div>
|
|
20
|
-
|
|
38
|
+
|
|
39
|
+
<div class="nav-panel-filter-row">
|
|
21
40
|
<button class="filter-btn active" data-filter="default" title="Hide settings entries">Default</button>
|
|
22
|
-
<button class="filter-btn" data-filter="no-tools" title="
|
|
41
|
+
<button class="filter-btn" data-filter="no-tools" title="Hide tool results">No-tools</button>
|
|
23
42
|
<button class="filter-btn" data-filter="user-only" title="Only user messages">User</button>
|
|
24
43
|
<button class="filter-btn" data-filter="labeled-only" title="Only labeled entries">Labeled</button>
|
|
25
|
-
<button class="filter-btn" data-filter="all" title="Show
|
|
26
|
-
|
|
44
|
+
<button class="filter-btn" data-filter="all" title="Show all entries">All</button>
|
|
45
|
+
</div>
|
|
46
|
+
|
|
47
|
+
<div class="nav-panel-body">
|
|
48
|
+
<div class="tree-container" id="tree-container"></div>
|
|
27
49
|
</div>
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
50
|
+
|
|
51
|
+
<div class="tree-status" id="tree-status"></div>
|
|
52
|
+
</aside>
|
|
53
|
+
|
|
54
|
+
<main id="content" class="export-main">
|
|
55
|
+
<section class="export-header-surface">
|
|
56
|
+
<div id="header-container"></div>
|
|
57
|
+
</section>
|
|
58
|
+
<section class="export-messages-surface">
|
|
59
|
+
<div id="messages"></div>
|
|
60
|
+
</section>
|
|
61
|
+
</main>
|
|
62
|
+
</div>
|
|
63
|
+
|
|
36
64
|
<div id="image-modal" class="image-modal">
|
|
37
|
-
<img id="modal-image" src="" alt="">
|
|
65
|
+
<img id="modal-image" src="" alt="Expanded export image preview">
|
|
38
66
|
</div>
|
|
39
67
|
</div>
|
|
40
68
|
|
|
41
69
|
<script id="session-data" type="application/json">{{SESSION_DATA}}</script>
|
|
42
|
-
|
|
43
|
-
<!-- Vendored libraries -->
|
|
44
70
|
<script>{{MARKED_JS}}</script>
|
|
45
|
-
|
|
46
|
-
<!-- highlight.js -->
|
|
47
71
|
<script>{{HIGHLIGHT_JS}}</script>
|
|
48
|
-
|
|
49
|
-
<!-- Main application code -->
|
|
50
72
|
<script>
|
|
51
73
|
{{JS}}
|
|
52
74
|
</script>
|
|
@@ -1,27 +1,12 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tool HTML renderer for custom tools in HTML export.
|
|
3
|
-
*
|
|
4
|
-
* Based on TUI component rendering architecture from:
|
|
5
|
-
* - Ink (https://github.com/vadimdemedes/ink) for React-like component model
|
|
6
|
-
* - blessed (https://github.com/chjj/blessed) for terminal widget rendering
|
|
7
|
-
*
|
|
8
|
-
* Renders custom tool calls and results to HTML by invoking their TUI renderers
|
|
9
|
-
* and converting the ANSI output to HTML.
|
|
10
|
-
*/
|
|
11
1
|
import type { Theme } from "../../modes/interactive/theme/theme.js";
|
|
12
2
|
import type { ToolDefinition } from "../extensions/types.js";
|
|
13
3
|
export interface ToolHtmlRendererDeps {
|
|
14
|
-
/** Function to look up tool definition by name */
|
|
15
4
|
getToolDefinition: (name: string) => ToolDefinition | undefined;
|
|
16
|
-
/** Theme for styling */
|
|
17
5
|
theme: Theme;
|
|
18
|
-
/** Terminal width for rendering (default: 100) */
|
|
19
6
|
width?: number;
|
|
20
7
|
}
|
|
21
8
|
export interface ToolHtmlRenderer {
|
|
22
|
-
/** Render a tool call to HTML. Returns undefined if tool has no custom renderer. */
|
|
23
9
|
renderCall(toolName: string, args: unknown): string | undefined;
|
|
24
|
-
/** Render a tool result to HTML. Returns undefined if tool has no custom renderer. */
|
|
25
10
|
renderResult(toolName: string, result: Array<{
|
|
26
11
|
type: string;
|
|
27
12
|
text?: string;
|
|
@@ -29,11 +14,5 @@ export interface ToolHtmlRenderer {
|
|
|
29
14
|
mimeType?: string;
|
|
30
15
|
}>, details: unknown, isError: boolean): string | undefined;
|
|
31
16
|
}
|
|
32
|
-
/**
|
|
33
|
-
* Create a tool HTML renderer.
|
|
34
|
-
*
|
|
35
|
-
* The renderer looks up tool definitions and invokes their renderCall/renderResult
|
|
36
|
-
* methods, converting the resulting TUI Component output (ANSI) to HTML.
|
|
37
|
-
*/
|
|
38
17
|
export declare function createToolHtmlRenderer(deps: ToolHtmlRendererDeps): ToolHtmlRenderer;
|
|
39
18
|
//# sourceMappingURL=tool-renderer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-renderer.d.ts","sourceRoot":"","sources":["../../../src/core/export-html/tool-renderer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tool-renderer.d.ts","sourceRoot":"","sources":["../../../src/core/export-html/tool-renderer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wCAAwC,CAAC;AACpE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAG7D,MAAM,WAAW,oBAAoB;IACpC,iBAAiB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,cAAc,GAAG,SAAS,CAAC;IAChE,KAAK,EAAE,KAAK,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,gBAAgB;IAChC,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC;IAChE,YAAY,CACX,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,EAChF,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,GACd,MAAM,GAAG,SAAS,CAAC;CACtB;AAkDD,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,oBAAoB,GAAG,gBAAgB,CAUnF"}
|
|
@@ -1,60 +1,44 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tool HTML renderer for custom tools in HTML export.
|
|
3
|
-
*
|
|
4
|
-
* Based on TUI component rendering architecture from:
|
|
5
|
-
* - Ink (https://github.com/vadimdemedes/ink) for React-like component model
|
|
6
|
-
* - blessed (https://github.com/chjj/blessed) for terminal widget rendering
|
|
7
|
-
*
|
|
8
|
-
* Renders custom tool calls and results to HTML by invoking their TUI renderers
|
|
9
|
-
* and converting the ANSI output to HTML.
|
|
10
|
-
*/
|
|
11
1
|
import { ansiLinesToHtml } from "./ansi-to-html.js";
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
2
|
+
function renderComponentToHtml(component, width) {
|
|
3
|
+
return ansiLinesToHtml(component.render(width));
|
|
4
|
+
}
|
|
5
|
+
function createAgentToolResult(result, details, isError) {
|
|
6
|
+
return {
|
|
7
|
+
content: result,
|
|
8
|
+
details,
|
|
9
|
+
isError,
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
function tryRenderCall(toolDef, args, theme, width) {
|
|
13
|
+
if (!toolDef?.renderCall) {
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
try {
|
|
17
|
+
return renderComponentToHtml(toolDef.renderCall(args, theme), width);
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function tryRenderResult(toolDef, result, details, isError, theme, width) {
|
|
24
|
+
if (!toolDef?.renderResult) {
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
try {
|
|
28
|
+
return renderComponentToHtml(toolDef.renderResult(createAgentToolResult(result, details, isError), { expanded: true, isPartial: false }, theme), width);
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
18
34
|
export function createToolHtmlRenderer(deps) {
|
|
19
|
-
const
|
|
35
|
+
const width = deps.width ?? 100;
|
|
20
36
|
return {
|
|
21
37
|
renderCall(toolName, args) {
|
|
22
|
-
|
|
23
|
-
const toolDef = getToolDefinition(toolName);
|
|
24
|
-
if (!toolDef?.renderCall) {
|
|
25
|
-
return undefined;
|
|
26
|
-
}
|
|
27
|
-
const component = toolDef.renderCall(args, theme);
|
|
28
|
-
const lines = component.render(width);
|
|
29
|
-
return ansiLinesToHtml(lines);
|
|
30
|
-
}
|
|
31
|
-
catch {
|
|
32
|
-
// On error, return undefined to trigger JSON fallback
|
|
33
|
-
return undefined;
|
|
34
|
-
}
|
|
38
|
+
return tryRenderCall(deps.getToolDefinition(toolName), args, deps.theme, width);
|
|
35
39
|
},
|
|
36
40
|
renderResult(toolName, result, details, isError) {
|
|
37
|
-
|
|
38
|
-
const toolDef = getToolDefinition(toolName);
|
|
39
|
-
if (!toolDef?.renderResult) {
|
|
40
|
-
return undefined;
|
|
41
|
-
}
|
|
42
|
-
// Build AgentToolResult from content array
|
|
43
|
-
// Cast content since session storage uses generic object types
|
|
44
|
-
const agentToolResult = {
|
|
45
|
-
content: result,
|
|
46
|
-
details,
|
|
47
|
-
isError,
|
|
48
|
-
};
|
|
49
|
-
// Always render expanded, client-side will apply truncation
|
|
50
|
-
const component = toolDef.renderResult(agentToolResult, { expanded: true, isPartial: false }, theme);
|
|
51
|
-
const lines = component.render(width);
|
|
52
|
-
return ansiLinesToHtml(lines);
|
|
53
|
-
}
|
|
54
|
-
catch {
|
|
55
|
-
// On error, return undefined to trigger JSON fallback
|
|
56
|
-
return undefined;
|
|
57
|
-
}
|
|
41
|
+
return tryRenderResult(deps.getToolDefinition(toolName), result, details, isError, deps.theme, width);
|
|
58
42
|
},
|
|
59
43
|
};
|
|
60
44
|
}
|