@travisennis/acai 0.0.6 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +225 -39
- package/dist/agent/index.d.ts +30 -21
- package/dist/agent/index.d.ts.map +1 -1
- package/dist/agent/index.js +237 -198
- package/dist/cli.d.ts +4 -3
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +56 -18
- package/dist/commands/add-directory/index.d.ts +3 -0
- package/dist/commands/add-directory/index.d.ts.map +1 -0
- package/dist/commands/add-directory/index.js +50 -0
- package/dist/commands/add-directory/types.d.ts +6 -0
- package/dist/commands/add-directory/types.d.ts.map +1 -0
- package/dist/commands/add-directory/utils.d.ts +3 -0
- package/dist/commands/add-directory/utils.d.ts.map +1 -0
- package/dist/commands/add-directory/utils.js +15 -0
- package/dist/commands/clear/index.d.ts +3 -0
- package/dist/commands/clear/index.d.ts.map +1 -0
- package/dist/commands/{clear-command.js → clear/index.js} +1 -7
- package/dist/commands/copy/index.d.ts +3 -0
- package/dist/commands/copy/index.d.ts.map +1 -0
- package/dist/commands/copy/index.js +39 -0
- package/dist/commands/copy/types.d.ts +3 -0
- package/dist/commands/copy/types.d.ts.map +1 -0
- package/dist/commands/copy/types.js +1 -0
- package/dist/commands/copy/utils.d.ts +3 -0
- package/dist/commands/copy/utils.d.ts.map +1 -0
- package/dist/commands/copy/utils.js +22 -0
- package/dist/commands/exit/index.d.ts +10 -0
- package/dist/commands/exit/index.d.ts.map +1 -0
- package/dist/commands/exit/index.js +21 -0
- package/dist/commands/exit/types.d.ts +8 -0
- package/dist/commands/exit/types.d.ts.map +1 -0
- package/dist/commands/exit/types.js +1 -0
- package/dist/commands/exit/utils.d.ts +2 -0
- package/dist/commands/exit/utils.d.ts.map +1 -0
- package/dist/commands/exit/utils.js +13 -0
- package/dist/commands/generate-rules/index.d.ts +3 -0
- package/dist/commands/generate-rules/index.d.ts.map +1 -0
- package/dist/commands/{generate-rules-command.js → generate-rules/index.js} +65 -147
- package/dist/commands/generate-rules/utils.d.ts +5 -0
- package/dist/commands/generate-rules/utils.d.ts.map +1 -0
- package/dist/commands/generate-rules/utils.js +25 -0
- package/dist/commands/handoff/index.d.ts +3 -0
- package/dist/commands/handoff/index.d.ts.map +1 -0
- package/dist/commands/handoff/index.js +97 -0
- package/dist/commands/handoff/utils.d.ts +4 -0
- package/dist/commands/handoff/utils.d.ts.map +1 -0
- package/dist/commands/handoff/utils.js +123 -0
- package/dist/commands/health/index.d.ts +3 -0
- package/dist/commands/health/index.d.ts.map +1 -0
- package/dist/commands/health/index.js +56 -0
- package/dist/commands/health/utils.d.ts +15 -0
- package/dist/commands/health/utils.d.ts.map +1 -0
- package/dist/commands/health/utils.js +52 -0
- package/dist/commands/help/index.d.ts +3 -0
- package/dist/commands/help/index.d.ts.map +1 -0
- package/dist/commands/{help-command.js → help/index.js} +6 -14
- package/dist/commands/history/index.d.ts +3 -0
- package/dist/commands/history/index.d.ts.map +1 -0
- package/dist/commands/{history-command.js → history/index.js} +40 -200
- package/dist/commands/history/types.d.ts +11 -0
- package/dist/commands/history/types.d.ts.map +1 -0
- package/dist/commands/history/types.js +1 -0
- package/dist/commands/history/utils.d.ts +4 -0
- package/dist/commands/history/utils.d.ts.map +1 -0
- package/dist/commands/history/utils.js +86 -0
- package/dist/commands/init/index.d.ts +3 -0
- package/dist/commands/init/index.d.ts.map +1 -0
- package/dist/commands/{init-command.js → init/index.js} +17 -27
- package/dist/commands/init-project/index.d.ts +3 -0
- package/dist/commands/init-project/index.d.ts.map +1 -0
- package/dist/commands/init-project/index.js +51 -0
- package/dist/commands/init-project/utils.d.ts +9 -0
- package/dist/commands/init-project/utils.d.ts.map +1 -0
- package/dist/commands/init-project/utils.js +43 -0
- package/dist/commands/list-directories/index.d.ts +3 -0
- package/dist/commands/list-directories/index.d.ts.map +1 -0
- package/dist/commands/{list-directories-command.js → list-directories/index.js} +2 -15
- package/dist/commands/list-tools/index.d.ts +3 -0
- package/dist/commands/list-tools/index.d.ts.map +1 -0
- package/dist/commands/list-tools/index.js +89 -0
- package/dist/commands/manager.d.ts +2 -9
- package/dist/commands/manager.d.ts.map +1 -1
- package/dist/commands/manager.js +38 -83
- package/dist/commands/model/index.d.ts +3 -0
- package/dist/commands/model/index.d.ts.map +1 -0
- package/dist/commands/model/index.js +182 -0
- package/dist/commands/model/utils.d.ts +3 -0
- package/dist/commands/model/utils.d.ts.map +1 -0
- package/dist/commands/model/utils.js +5 -0
- package/dist/commands/paste/index.d.ts +3 -0
- package/dist/commands/paste/index.d.ts.map +1 -0
- package/dist/commands/paste/index.js +94 -0
- package/dist/commands/paste/utils.d.ts +5 -0
- package/dist/commands/paste/utils.d.ts.map +1 -0
- package/dist/commands/paste/utils.js +86 -0
- package/dist/commands/pickup/index.d.ts +3 -0
- package/dist/commands/pickup/index.d.ts.map +1 -0
- package/dist/commands/pickup/index.js +138 -0
- package/dist/commands/pickup/types.d.ts +6 -0
- package/dist/commands/pickup/types.d.ts.map +1 -0
- package/dist/commands/pickup/types.js +1 -0
- package/dist/commands/pickup/utils.d.ts +7 -0
- package/dist/commands/pickup/utils.d.ts.map +1 -0
- package/dist/commands/pickup/utils.js +56 -0
- package/dist/commands/prompt/index.d.ts +5 -0
- package/dist/commands/prompt/index.d.ts.map +1 -0
- package/dist/commands/prompt/index.js +126 -0
- package/dist/commands/prompt/types.d.ts +15 -0
- package/dist/commands/prompt/types.d.ts.map +1 -0
- package/dist/commands/prompt/types.js +1 -0
- package/dist/commands/prompt/utils.d.ts +12 -0
- package/dist/commands/prompt/utils.d.ts.map +1 -0
- package/dist/commands/prompt/utils.js +107 -0
- package/dist/commands/remove-directory/index.d.ts +3 -0
- package/dist/commands/remove-directory/index.d.ts.map +1 -0
- package/dist/commands/{remove-directory-command.js → remove-directory/index.js} +3 -35
- package/dist/commands/reset/index.d.ts +3 -0
- package/dist/commands/reset/index.d.ts.map +1 -0
- package/dist/commands/{reset-command.js → reset/index.js} +8 -11
- package/dist/commands/reset/types.d.ts +1 -0
- package/dist/commands/reset/types.d.ts.map +1 -0
- package/dist/commands/reset/types.js +3 -0
- package/dist/commands/resources/index.d.ts +3 -0
- package/dist/commands/resources/index.d.ts.map +1 -0
- package/dist/commands/resources/index.js +84 -0
- package/dist/commands/review/index.d.ts +3 -0
- package/dist/commands/review/index.d.ts.map +1 -0
- package/dist/commands/review/index.js +126 -0
- package/dist/commands/review/types.d.ts +12 -0
- package/dist/commands/review/types.d.ts.map +1 -0
- package/dist/commands/review/types.js +1 -0
- package/dist/commands/review/utils.d.ts +4 -0
- package/dist/commands/review/utils.d.ts.map +1 -0
- package/dist/commands/review/utils.js +87 -0
- package/dist/commands/save/index.d.ts +3 -0
- package/dist/commands/save/index.d.ts.map +1 -0
- package/dist/commands/{save-command.js → save/index.js} +3 -10
- package/dist/commands/session/index.d.ts +3 -0
- package/dist/commands/session/index.d.ts.map +1 -0
- package/dist/commands/session/index.js +197 -0
- package/dist/commands/session/types.d.ts +13 -0
- package/dist/commands/session/types.d.ts.map +1 -0
- package/dist/commands/session/types.js +7 -0
- package/dist/commands/shell/index.d.ts +3 -0
- package/dist/commands/shell/index.d.ts.map +1 -0
- package/dist/commands/{shell-command.js → shell/index.js} +4 -51
- package/dist/commands/types.d.ts +2 -5
- package/dist/commands/types.d.ts.map +1 -1
- package/dist/config.d.ts +36 -7
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +118 -60
- package/dist/dedent.d.ts.map +1 -1
- package/dist/dedent.js +7 -7
- package/dist/execution/index.d.ts +18 -2
- package/dist/execution/index.d.ts.map +1 -1
- package/dist/execution/index.js +119 -81
- package/dist/formatting.d.ts +46 -0
- package/dist/formatting.d.ts.map +1 -1
- package/dist/formatting.js +94 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +299 -177
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +4 -11
- package/dist/mentions.d.ts.map +1 -1
- package/dist/mentions.js +3 -53
- package/dist/middleware/audit-message.d.ts +2 -2
- package/dist/middleware/audit-message.d.ts.map +1 -1
- package/dist/middleware/audit-message.js +40 -2
- package/dist/middleware/cache.d.ts +2 -2
- package/dist/middleware/cache.d.ts.map +1 -1
- package/dist/middleware/cache.js +111 -27
- package/dist/middleware/rate-limit.d.ts +2 -2
- package/dist/middleware/rate-limit.d.ts.map +1 -1
- package/dist/middleware/rate-limit.js +1 -0
- package/dist/models/ai-config.d.ts.map +1 -1
- package/dist/models/ai-config.js +46 -29
- package/dist/models/anthropic-provider.d.ts +14 -13
- package/dist/models/anthropic-provider.d.ts.map +1 -1
- package/dist/models/anthropic-provider.js +0 -7
- package/dist/models/deepseek-provider.d.ts +9 -8
- package/dist/models/deepseek-provider.d.ts.map +1 -1
- package/dist/models/deepseek-provider.js +0 -2
- package/dist/models/google-provider.d.ts +10 -9
- package/dist/models/google-provider.d.ts.map +1 -1
- package/dist/models/google-provider.js +0 -3
- package/dist/models/groq-provider.d.ts +8 -7
- package/dist/models/groq-provider.d.ts.map +1 -1
- package/dist/models/groq-provider.js +0 -1
- package/dist/models/manager.d.ts +7 -4
- package/dist/models/manager.d.ts.map +1 -1
- package/dist/models/manager.js +5 -25
- package/dist/models/openai-provider.d.ts +11 -10
- package/dist/models/openai-provider.d.ts.map +1 -1
- package/dist/models/openai-provider.js +0 -4
- package/dist/models/opencode-zen-provider.d.ts +23 -0
- package/dist/models/opencode-zen-provider.d.ts.map +1 -0
- package/dist/models/opencode-zen-provider.js +76 -0
- package/dist/models/openrouter-provider.d.ts +34 -28
- package/dist/models/openrouter-provider.d.ts.map +1 -1
- package/dist/models/openrouter-provider.js +148 -139
- package/dist/models/providers.d.ts +6 -16
- package/dist/models/providers.d.ts.map +1 -1
- package/dist/models/providers.js +8 -58
- package/dist/models/xai-provider.d.ts +9 -8
- package/dist/models/xai-provider.d.ts.map +1 -1
- package/dist/models/xai-provider.js +0 -2
- package/dist/prompts/manager.d.ts +1 -1
- package/dist/prompts/manager.d.ts.map +1 -1
- package/dist/prompts/manager.js +1 -1
- package/dist/prompts.d.ts +8 -4
- package/dist/prompts.d.ts.map +1 -1
- package/dist/prompts.js +155 -177
- package/dist/repl/project-status.d.ts +19 -0
- package/dist/repl/project-status.d.ts.map +1 -0
- package/dist/repl/project-status.js +78 -0
- package/dist/repl-new.d.ts +15 -6
- package/dist/repl-new.d.ts.map +1 -1
- package/dist/repl-new.js +266 -83
- package/dist/{messages.d.ts → sessions/manager.d.ts} +13 -4
- package/dist/sessions/manager.d.ts.map +1 -0
- package/dist/{messages.js → sessions/manager.js} +126 -16
- package/dist/skills.d.ts +16 -0
- package/dist/skills.d.ts.map +1 -0
- package/dist/skills.js +233 -0
- package/dist/terminal/control.d.ts +56 -0
- package/dist/terminal/control.d.ts.map +1 -0
- package/dist/terminal/control.js +111 -0
- package/dist/terminal/default-theme.d.ts +1 -1
- package/dist/terminal/default-theme.d.ts.map +1 -1
- package/dist/terminal/default-theme.js +24 -28
- package/dist/terminal/formatting.d.ts +23 -26
- package/dist/terminal/formatting.d.ts.map +1 -1
- package/dist/terminal/formatting.js +35 -53
- package/dist/terminal/highlight/index.d.ts.map +1 -1
- package/dist/terminal/highlight/index.js +3 -6
- package/dist/terminal/highlight/theme.d.ts.map +1 -1
- package/dist/terminal/highlight/theme.js +2 -6
- package/dist/terminal/index.d.ts +2 -101
- package/dist/terminal/index.d.ts.map +1 -1
- package/dist/terminal/index.js +2 -464
- package/dist/terminal/keys.d.ts +211 -0
- package/dist/terminal/keys.d.ts.map +1 -0
- package/dist/terminal/keys.js +546 -0
- package/dist/terminal/segmenter.d.ts +6 -0
- package/dist/terminal/segmenter.d.ts.map +1 -0
- package/dist/terminal/segmenter.js +11 -0
- package/dist/terminal/select-prompt.d.ts.map +1 -1
- package/dist/terminal/select-prompt.js +9 -21
- package/dist/terminal/string-width.d.ts.map +1 -1
- package/dist/terminal/string-width.js +40 -21
- package/dist/terminal/strip-ansi.d.ts.map +1 -1
- package/dist/terminal/strip-ansi.js +9 -15
- package/dist/terminal/table/cell.d.ts +114 -0
- package/dist/terminal/table/cell.d.ts.map +1 -0
- package/dist/terminal/table/cell.js +407 -0
- package/dist/terminal/table/debug.d.ts +15 -0
- package/dist/terminal/table/debug.d.ts.map +1 -0
- package/dist/terminal/table/debug.js +32 -0
- package/dist/terminal/table/index.d.ts +3 -0
- package/dist/terminal/table/index.d.ts.map +1 -0
- package/dist/terminal/table/index.js +2 -0
- package/dist/terminal/table/layout-manager.d.ts +27 -0
- package/dist/terminal/table/layout-manager.d.ts.map +1 -0
- package/dist/terminal/table/layout-manager.js +257 -0
- package/dist/terminal/table/table.d.ts +9 -0
- package/dist/terminal/table/table.d.ts.map +1 -0
- package/dist/terminal/table/table.js +97 -0
- package/dist/terminal/table/utils.d.ts +63 -0
- package/dist/terminal/table/utils.d.ts.map +1 -0
- package/dist/terminal/table/utils.js +326 -0
- package/dist/tokens/tracker.d.ts.map +1 -1
- package/dist/tokens/tracker.js +58 -16
- package/dist/tools/bash.d.ts +11 -11
- package/dist/tools/bash.d.ts.map +1 -1
- package/dist/tools/bash.js +189 -81
- package/dist/tools/directory-tree.d.ts +9 -13
- package/dist/tools/directory-tree.d.ts.map +1 -1
- package/dist/tools/directory-tree.js +90 -60
- package/dist/tools/dynamic-tool-loader.d.ts +22 -8
- package/dist/tools/dynamic-tool-loader.d.ts.map +1 -1
- package/dist/tools/dynamic-tool-loader.js +41 -46
- package/dist/tools/edit-file.d.ts +6 -16
- package/dist/tools/edit-file.d.ts.map +1 -1
- package/dist/tools/edit-file.js +22 -66
- package/dist/tools/glob.d.ts +15 -16
- package/dist/tools/glob.d.ts.map +1 -1
- package/dist/tools/glob.js +78 -109
- package/dist/tools/grep.d.ts +19 -22
- package/dist/tools/grep.d.ts.map +1 -1
- package/dist/tools/grep.js +61 -93
- package/dist/tools/index.d.ts +202 -167
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +17 -273
- package/dist/tools/ls.d.ts +26 -0
- package/dist/tools/ls.d.ts.map +1 -0
- package/dist/tools/ls.js +80 -0
- package/dist/tools/read-file.d.ts +15 -15
- package/dist/tools/read-file.d.ts.map +1 -1
- package/dist/tools/read-file.js +52 -76
- package/dist/tools/save-file.d.ts +8 -8
- package/dist/tools/save-file.d.ts.map +1 -1
- package/dist/tools/save-file.js +42 -53
- package/dist/tools/think.d.ts +4 -4
- package/dist/tools/think.d.ts.map +1 -1
- package/dist/tools/think.js +9 -32
- package/dist/tools/types.d.ts +5 -21
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/tools/types.js +0 -9
- package/dist/tui/autocomplete/attachment-provider.d.ts +18 -0
- package/dist/tui/autocomplete/attachment-provider.d.ts.map +1 -0
- package/dist/tui/autocomplete/attachment-provider.js +159 -0
- package/dist/tui/autocomplete/base-provider.d.ts +17 -0
- package/dist/tui/autocomplete/base-provider.d.ts.map +1 -0
- package/dist/tui/autocomplete/base-provider.js +1 -0
- package/dist/tui/autocomplete/combined-provider.d.ts +20 -0
- package/dist/tui/autocomplete/combined-provider.d.ts.map +1 -0
- package/dist/tui/autocomplete/combined-provider.js +61 -0
- package/dist/tui/autocomplete/command-provider.d.ts +20 -0
- package/dist/tui/autocomplete/command-provider.d.ts.map +1 -0
- package/dist/tui/autocomplete/command-provider.js +90 -0
- package/dist/tui/autocomplete/file-search-provider.d.ts +16 -0
- package/dist/tui/autocomplete/file-search-provider.d.ts.map +1 -0
- package/dist/tui/autocomplete/file-search-provider.js +123 -0
- package/dist/tui/autocomplete/path-provider.d.ts +21 -0
- package/dist/tui/autocomplete/path-provider.d.ts.map +1 -0
- package/dist/tui/autocomplete/path-provider.js +164 -0
- package/dist/tui/autocomplete/utils.d.ts +16 -0
- package/dist/tui/autocomplete/utils.d.ts.map +1 -0
- package/dist/tui/autocomplete/utils.js +137 -0
- package/dist/tui/autocomplete.d.ts +12 -43
- package/dist/tui/autocomplete.d.ts.map +1 -1
- package/dist/tui/autocomplete.js +20 -465
- package/dist/tui/components/assistant-message.js +1 -1
- package/dist/tui/components/box.d.ts +20 -0
- package/dist/tui/components/box.d.ts.map +1 -0
- package/dist/tui/components/box.js +87 -0
- package/dist/tui/components/editor.d.ts +61 -7
- package/dist/tui/components/editor.d.ts.map +1 -1
- package/dist/tui/components/editor.js +630 -127
- package/dist/tui/components/footer.d.ts +19 -18
- package/dist/tui/components/footer.d.ts.map +1 -1
- package/dist/tui/components/footer.js +90 -185
- package/dist/tui/components/header.d.ts +21 -0
- package/dist/tui/components/header.d.ts.map +1 -0
- package/dist/tui/components/header.js +63 -0
- package/dist/tui/components/input.d.ts.map +1 -1
- package/dist/tui/components/input.js +8 -7
- package/dist/tui/components/loader.d.ts +6 -1
- package/dist/tui/components/loader.d.ts.map +1 -1
- package/dist/tui/components/loader.js +8 -3
- package/dist/tui/components/markdown.d.ts +31 -27
- package/dist/tui/components/markdown.d.ts.map +1 -1
- package/dist/tui/components/markdown.js +131 -67
- package/dist/tui/components/modal.d.ts +0 -11
- package/dist/tui/components/modal.d.ts.map +1 -1
- package/dist/tui/components/modal.js +9 -37
- package/dist/tui/components/notification.d.ts +28 -0
- package/dist/tui/components/notification.d.ts.map +1 -0
- package/dist/tui/components/notification.js +63 -0
- package/dist/tui/components/progress-bar.d.ts +19 -0
- package/dist/tui/components/progress-bar.d.ts.map +1 -0
- package/dist/tui/components/progress-bar.js +66 -0
- package/dist/tui/components/select-list.d.ts +12 -1
- package/dist/tui/components/select-list.d.ts.map +1 -1
- package/dist/tui/components/select-list.js +73 -32
- package/dist/tui/components/spacer.d.ts +1 -1
- package/dist/tui/components/spacer.d.ts.map +1 -1
- package/dist/tui/components/spacer.js +2 -2
- package/dist/tui/components/table.d.ts +27 -0
- package/dist/tui/components/table.d.ts.map +1 -0
- package/dist/tui/components/table.js +125 -0
- package/dist/tui/components/thinking-block.d.ts.map +1 -1
- package/dist/tui/components/thinking-block.js +4 -1
- package/dist/tui/components/tool-execution.d.ts +7 -6
- package/dist/tui/components/tool-execution.d.ts.map +1 -1
- package/dist/tui/components/tool-execution.js +81 -85
- package/dist/tui/components/user-message.d.ts.map +1 -1
- package/dist/tui/components/user-message.js +6 -4
- package/dist/tui/components/welcome.d.ts +8 -1
- package/dist/tui/components/welcome.d.ts.map +1 -1
- package/dist/tui/components/welcome.js +45 -6
- package/dist/tui/index.d.ts +12 -6
- package/dist/tui/index.d.ts.map +1 -1
- package/dist/tui/index.js +7 -3
- package/dist/tui/terminal.d.ts +4 -3
- package/dist/tui/terminal.d.ts.map +1 -1
- package/dist/tui/terminal.js +43 -49
- package/dist/tui/tui.d.ts +3 -0
- package/dist/tui/tui.d.ts.map +1 -1
- package/dist/tui/tui.js +58 -43
- package/dist/tui/utils.d.ts +5 -0
- package/dist/tui/utils.d.ts.map +1 -1
- package/dist/tui/utils.js +80 -1
- package/dist/{tools/bash-utils.d.ts → utils/bash.d.ts} +3 -3
- package/dist/utils/bash.d.ts.map +1 -0
- package/dist/{tools/bash-utils.js → utils/bash.js} +22 -11
- package/dist/utils/{filesystem.d.ts → filesystem/operations.d.ts} +1 -1
- package/dist/utils/filesystem/operations.d.ts.map +1 -0
- package/dist/{tools/filesystem-utils.d.ts → utils/filesystem/security.d.ts} +3 -2
- package/dist/utils/filesystem/security.d.ts.map +1 -0
- package/dist/{tools/filesystem-utils.js → utils/filesystem/security.js} +62 -4
- package/dist/utils/funcs.d.ts +6 -0
- package/dist/utils/funcs.d.ts.map +1 -0
- package/dist/utils/funcs.js +6 -0
- package/dist/{tools/git-utils.d.ts → utils/git.d.ts} +1 -1
- package/dist/utils/git.d.ts.map +1 -0
- package/dist/{tools/git-utils.js → utils/git.js} +0 -6
- package/dist/utils/glob.js +1 -1
- package/dist/utils/yaml.d.ts +11 -0
- package/dist/utils/yaml.d.ts.map +1 -0
- package/dist/utils/yaml.js +207 -0
- package/dist/utils/{zod-utils.d.ts → zod.d.ts} +2 -1
- package/dist/utils/zod.d.ts.map +1 -0
- package/dist/utils/zod.js +24 -0
- package/package.json +31 -29
- package/dist/agent/manual-loop.d.ts +0 -41
- package/dist/agent/manual-loop.d.ts.map +0 -1
- package/dist/agent/manual-loop.js +0 -278
- package/dist/api/exa/index.d.ts +0 -177
- package/dist/api/exa/index.d.ts.map +0 -1
- package/dist/api/exa/index.js +0 -439
- package/dist/commands/add-directory-command.d.ts +0 -3
- package/dist/commands/add-directory-command.d.ts.map +0 -1
- package/dist/commands/add-directory-command.js +0 -85
- package/dist/commands/application-log-command.d.ts +0 -3
- package/dist/commands/application-log-command.d.ts.map +0 -1
- package/dist/commands/application-log-command.js +0 -79
- package/dist/commands/clear-command.d.ts +0 -3
- package/dist/commands/clear-command.d.ts.map +0 -1
- package/dist/commands/compact-command.d.ts +0 -3
- package/dist/commands/compact-command.d.ts.map +0 -1
- package/dist/commands/compact-command.js +0 -64
- package/dist/commands/context-command.d.ts +0 -3
- package/dist/commands/context-command.d.ts.map +0 -1
- package/dist/commands/context-command.js +0 -183
- package/dist/commands/copy-command.d.ts +0 -3
- package/dist/commands/copy-command.d.ts.map +0 -1
- package/dist/commands/copy-command.js +0 -80
- package/dist/commands/edit-command.d.ts +0 -3
- package/dist/commands/edit-command.d.ts.map +0 -1
- package/dist/commands/edit-command.js +0 -88
- package/dist/commands/edit-prompt-command.d.ts +0 -3
- package/dist/commands/edit-prompt-command.d.ts.map +0 -1
- package/dist/commands/edit-prompt-command.js +0 -61
- package/dist/commands/exit-command.d.ts +0 -13
- package/dist/commands/exit-command.d.ts.map +0 -1
- package/dist/commands/exit-command.js +0 -46
- package/dist/commands/files-command.d.ts +0 -3
- package/dist/commands/files-command.d.ts.map +0 -1
- package/dist/commands/files-command.js +0 -121
- package/dist/commands/generate-rules-command.d.ts +0 -3
- package/dist/commands/generate-rules-command.d.ts.map +0 -1
- package/dist/commands/handoff-command.d.ts +0 -3
- package/dist/commands/handoff-command.d.ts.map +0 -1
- package/dist/commands/handoff-command.js +0 -202
- package/dist/commands/health-command.d.ts +0 -4
- package/dist/commands/health-command.d.ts.map +0 -1
- package/dist/commands/health-command.js +0 -213
- package/dist/commands/help-command.d.ts +0 -3
- package/dist/commands/help-command.d.ts.map +0 -1
- package/dist/commands/history-command.d.ts +0 -3
- package/dist/commands/history-command.d.ts.map +0 -1
- package/dist/commands/init-command.d.ts +0 -3
- package/dist/commands/init-command.d.ts.map +0 -1
- package/dist/commands/last-log-command.d.ts +0 -3
- package/dist/commands/last-log-command.d.ts.map +0 -1
- package/dist/commands/last-log-command.js +0 -98
- package/dist/commands/list-directories-command.d.ts +0 -3
- package/dist/commands/list-directories-command.d.ts.map +0 -1
- package/dist/commands/list-tools-command.d.ts +0 -3
- package/dist/commands/list-tools-command.d.ts.map +0 -1
- package/dist/commands/list-tools-command.js +0 -124
- package/dist/commands/model-command.d.ts +0 -25
- package/dist/commands/model-command.d.ts.map +0 -1
- package/dist/commands/model-command.js +0 -340
- package/dist/commands/paste-command.d.ts +0 -3
- package/dist/commands/paste-command.d.ts.map +0 -1
- package/dist/commands/paste-command.js +0 -277
- package/dist/commands/pickup-command.d.ts +0 -3
- package/dist/commands/pickup-command.d.ts.map +0 -1
- package/dist/commands/pickup-command.js +0 -161
- package/dist/commands/prompt-command.d.ts +0 -3
- package/dist/commands/prompt-command.d.ts.map +0 -1
- package/dist/commands/prompt-command.js +0 -280
- package/dist/commands/remove-directory-command.d.ts +0 -3
- package/dist/commands/remove-directory-command.d.ts.map +0 -1
- package/dist/commands/reset-command.d.ts +0 -3
- package/dist/commands/reset-command.d.ts.map +0 -1
- package/dist/commands/rules-command.d.ts +0 -3
- package/dist/commands/rules-command.d.ts.map +0 -1
- package/dist/commands/rules-command.js +0 -135
- package/dist/commands/save-command.d.ts +0 -3
- package/dist/commands/save-command.d.ts.map +0 -1
- package/dist/commands/shell-command.d.ts +0 -3
- package/dist/commands/shell-command.d.ts.map +0 -1
- package/dist/commands/usage-command.d.ts +0 -3
- package/dist/commands/usage-command.d.ts.map +0 -1
- package/dist/commands/usage-command.js +0 -42
- package/dist/messages.d.ts.map +0 -1
- package/dist/repl/display-tool-messages.d.ts +0 -4
- package/dist/repl/display-tool-messages.d.ts.map +0 -1
- package/dist/repl/display-tool-messages.js +0 -58
- package/dist/repl/display-tool-use.d.ts +0 -14
- package/dist/repl/display-tool-use.d.ts.map +0 -1
- package/dist/repl/display-tool-use.js +0 -63
- package/dist/repl/get-prompt-header.d.ts +0 -8
- package/dist/repl/get-prompt-header.d.ts.map +0 -1
- package/dist/repl/get-prompt-header.js +0 -9
- package/dist/repl/project-status-line.d.ts +0 -2
- package/dist/repl/project-status-line.d.ts.map +0 -1
- package/dist/repl/project-status-line.js +0 -31
- package/dist/repl/prompt.d.ts +0 -21
- package/dist/repl/prompt.d.ts.map +0 -1
- package/dist/repl/prompt.js +0 -244
- package/dist/repl/tool-call-repair.d.ts +0 -4
- package/dist/repl/tool-call-repair.d.ts.map +0 -1
- package/dist/repl/tool-call-repair.js +0 -54
- package/dist/repl.d.ts +0 -29
- package/dist/repl.d.ts.map +0 -1
- package/dist/repl.js +0 -218
- package/dist/terminal/checkbox-prompt.d.ts +0 -36
- package/dist/terminal/checkbox-prompt.d.ts.map +0 -1
- package/dist/terminal/checkbox-prompt.js +0 -368
- package/dist/terminal/editor-prompt.d.ts +0 -10
- package/dist/terminal/editor-prompt.d.ts.map +0 -1
- package/dist/terminal/editor-prompt.js +0 -61
- package/dist/terminal/errors.d.ts +0 -19
- package/dist/terminal/errors.d.ts.map +0 -1
- package/dist/terminal/errors.js +0 -37
- package/dist/terminal/input-prompt.d.ts +0 -17
- package/dist/terminal/input-prompt.d.ts.map +0 -1
- package/dist/terminal/input-prompt.js +0 -181
- package/dist/terminal/markdown.d.ts +0 -2
- package/dist/terminal/markdown.d.ts.map +0 -1
- package/dist/terminal/markdown.js +0 -118
- package/dist/terminal/search-prompt.d.ts +0 -20
- package/dist/terminal/search-prompt.d.ts.map +0 -1
- package/dist/terminal/search-prompt.js +0 -280
- package/dist/terminal/types.d.ts +0 -35
- package/dist/terminal/types.d.ts.map +0 -1
- package/dist/tokens/threshold.d.ts +0 -35
- package/dist/tokens/threshold.d.ts.map +0 -1
- package/dist/tokens/threshold.js +0 -85
- package/dist/tools/advanced-edit-file.d.ts +0 -69
- package/dist/tools/advanced-edit-file.d.ts.map +0 -1
- package/dist/tools/advanced-edit-file.js +0 -281
- package/dist/tools/agent.d.ts +0 -29
- package/dist/tools/agent.d.ts.map +0 -1
- package/dist/tools/agent.js +0 -103
- package/dist/tools/bash-utils.d.ts.map +0 -1
- package/dist/tools/code-interpreter.d.ts +0 -25
- package/dist/tools/code-interpreter.d.ts.map +0 -1
- package/dist/tools/code-interpreter.js +0 -167
- package/dist/tools/delete-file.d.ts +0 -24
- package/dist/tools/delete-file.d.ts.map +0 -1
- package/dist/tools/delete-file.js +0 -70
- package/dist/tools/dynamic-tool-parser.d.ts +0 -21
- package/dist/tools/dynamic-tool-parser.d.ts.map +0 -1
- package/dist/tools/dynamic-tool-parser.js +0 -22
- package/dist/tools/filesystem-utils.d.ts.map +0 -1
- package/dist/tools/git-utils.d.ts.map +0 -1
- package/dist/tools/llm-edit-fixer.d.ts +0 -25
- package/dist/tools/llm-edit-fixer.d.ts.map +0 -1
- package/dist/tools/llm-edit-fixer.js +0 -150
- package/dist/tools/move-file.d.ts +0 -26
- package/dist/tools/move-file.d.ts.map +0 -1
- package/dist/tools/move-file.js +0 -58
- package/dist/tools/read-multiple-files.d.ts +0 -26
- package/dist/tools/read-multiple-files.d.ts.map +0 -1
- package/dist/tools/read-multiple-files.js +0 -139
- package/dist/tools/web-fetch.d.ts +0 -56
- package/dist/tools/web-fetch.d.ts.map +0 -1
- package/dist/tools/web-fetch.js +0 -247
- package/dist/tools/web-search.d.ts +0 -23
- package/dist/tools/web-search.d.ts.map +0 -1
- package/dist/tools/web-search.js +0 -133
- package/dist/tui/components/prompt-status.d.ts +0 -16
- package/dist/tui/components/prompt-status.d.ts.map +0 -1
- package/dist/tui/components/prompt-status.js +0 -21
- package/dist/utils/filesystem.d.ts.map +0 -1
- package/dist/utils/zod-utils.d.ts.map +0 -1
- package/dist/utils/zod-utils.js +0 -7
- /package/dist/{terminal → commands/add-directory}/types.js +0 -0
- /package/dist/utils/{filesystem.js → filesystem/operations.js} +0 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface EnvVarInfo {
|
|
2
|
+
name: string;
|
|
3
|
+
description: string;
|
|
4
|
+
}
|
|
5
|
+
export interface ToolInfo {
|
|
6
|
+
name: string;
|
|
7
|
+
command: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const ENVIRONMENT_VARIABLES: EnvVarInfo[];
|
|
10
|
+
export declare const BASH_TOOLS: ToolInfo[];
|
|
11
|
+
export declare function checkEnvironmentVariables(): (string | number)[][];
|
|
12
|
+
export declare function checkTools(execFn?: (command: string, options: object) => void): string[][];
|
|
13
|
+
export declare function formatEnvStatus(status: (string | number)[][]): (string | number)[][];
|
|
14
|
+
export declare function formatToolStatus(status: string[][]): string[][];
|
|
15
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../source/commands/health/utils.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,qBAAqB,EAAE,UAAU,EAc7C,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,QAAQ,EAQhC,CAAC;AAEF,wBAAgB,yBAAyB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,EAAE,CASjE;AAED,wBAAgB,UAAU,CACxB,MAAM,GAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAe,GAC5D,MAAM,EAAE,EAAE,CAWZ;AAED,wBAAgB,eAAe,CAC7B,MAAM,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,EAAE,GAC5B,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,EAAE,CAEvB;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,GAAG,MAAM,EAAE,EAAE,CAE/D"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { execSync } from "node:child_process";
|
|
2
|
+
export const ENVIRONMENT_VARIABLES = [
|
|
3
|
+
{ name: "OPENAI_API_KEY", description: "OpenAI (GPT models)" },
|
|
4
|
+
{ name: "ANTHROPIC_API_KEY", description: "Anthropic (Claude models)" },
|
|
5
|
+
{
|
|
6
|
+
name: "GOOGLE_GENERATIVE_AI_API_KEY",
|
|
7
|
+
description: "Google (Gemini models)",
|
|
8
|
+
},
|
|
9
|
+
{ name: "DEEPSEEK_API_KEY", description: "DeepSeek" },
|
|
10
|
+
{ name: "GROQ_API_KEY", description: "Groq (multiple models)" },
|
|
11
|
+
{ name: "X_AI_API_KEY", description: "X.AI (Grok models)" },
|
|
12
|
+
{ name: "XAI_API_KEY", description: "X.AI (Grok models - alt)" },
|
|
13
|
+
{ name: "OPENROUTER_API_KEY", description: "OpenRouter (multiple models)" },
|
|
14
|
+
{ name: "OPENCODE_ZEN_API_TOKEN", description: "OpenCode Zen" },
|
|
15
|
+
{ name: "LOG_LEVEL", description: "Logging level" },
|
|
16
|
+
];
|
|
17
|
+
export const BASH_TOOLS = [
|
|
18
|
+
{ name: "git", command: "git --version" },
|
|
19
|
+
{ name: "gh", command: "gh --version" },
|
|
20
|
+
{ name: "rg", command: "rg --version" },
|
|
21
|
+
{ name: "fd", command: "fd --version" },
|
|
22
|
+
{ name: "ast-grep", command: "ast-grep --version" },
|
|
23
|
+
{ name: "jq", command: "jq --version" },
|
|
24
|
+
{ name: "yq", command: "yq --version" },
|
|
25
|
+
];
|
|
26
|
+
export function checkEnvironmentVariables() {
|
|
27
|
+
return ENVIRONMENT_VARIABLES.map((envVar) => {
|
|
28
|
+
const value = process.env[envVar.name];
|
|
29
|
+
const hasValue = value !== undefined && value !== null && value.trim() !== "";
|
|
30
|
+
const status = hasValue ? "✓ Set" : "✗ Not set";
|
|
31
|
+
return [envVar.name, status, envVar.description];
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
export function checkTools(execFn = execSync) {
|
|
35
|
+
return BASH_TOOLS.map((tool) => {
|
|
36
|
+
let status = "✗ Not installed";
|
|
37
|
+
try {
|
|
38
|
+
execFn(tool.command, { stdio: "ignore", timeout: 5000 });
|
|
39
|
+
status = "✓ Installed";
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
// Ignore error, tool is not installed
|
|
43
|
+
}
|
|
44
|
+
return [tool.name, status];
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
export function formatEnvStatus(status) {
|
|
48
|
+
return status;
|
|
49
|
+
}
|
|
50
|
+
export function formatToolStatus(status) {
|
|
51
|
+
return status;
|
|
52
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/commands/help/index.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/D,eAAO,MAAM,WAAW,GACtB,UAAU,cAAc,EACxB,MAAM,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,KAC7B,WA6CF,CAAC"}
|
|
@@ -1,20 +1,9 @@
|
|
|
1
|
-
import { Modal, Container as ModalContainer,
|
|
2
|
-
export const helpCommand = (
|
|
1
|
+
import { Modal, Container as ModalContainer, ModalText, TableComponent, } from "../../tui/index.js";
|
|
2
|
+
export const helpCommand = (_options, cmds) => {
|
|
3
3
|
return {
|
|
4
4
|
command: "/help",
|
|
5
5
|
description: "Shows available commands.",
|
|
6
6
|
getSubCommands: () => Promise.resolve([]),
|
|
7
|
-
execute: async () => {
|
|
8
|
-
const commands = cmds;
|
|
9
|
-
const entries = Array.from(commands.entries())
|
|
10
|
-
.sort(([a], [b]) => a.localeCompare(b))
|
|
11
|
-
.map(([key, cmd]) => [key, cmd.description]);
|
|
12
|
-
terminal.table(entries, {
|
|
13
|
-
header: ["Command", "Description"],
|
|
14
|
-
colWidths: [30, 70],
|
|
15
|
-
});
|
|
16
|
-
return "continue";
|
|
17
|
-
},
|
|
18
7
|
async handle(_args, { tui, editor }) {
|
|
19
8
|
const commands = cmds;
|
|
20
9
|
const entries = Array.from(commands.entries())
|
|
@@ -31,7 +20,10 @@ export const helpCommand = ({ terminal }, cmds) => {
|
|
|
31
20
|
command,
|
|
32
21
|
description,
|
|
33
22
|
]);
|
|
34
|
-
modalContent.addChild(new
|
|
23
|
+
modalContent.addChild(new TableComponent(tableData, {
|
|
24
|
+
headers: ["Command", "Description"],
|
|
25
|
+
colWidths: [30, 70],
|
|
26
|
+
}));
|
|
35
27
|
}
|
|
36
28
|
// Create and show modal
|
|
37
29
|
const modal = new Modal("Available Commands", modalContent, true, () => {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/commands/history/index.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAwD/D,eAAO,MAAM,cAAc,GAAI,yEAK5B,cAAc,KAAG,WAkJnB,CAAC"}
|
|
@@ -1,102 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
/* biome-ignore-all lint/suspicious/noExplicitAny: internal function uses simplified types */
|
|
2
2
|
import { generateText } from "ai";
|
|
3
|
-
import {
|
|
4
|
-
import { getTerminalSize } from "
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
async function
|
|
9
|
-
const sanitizedTitle = history.title
|
|
10
|
-
.replace(/[^a-zA-Z0-9\s-_]/g, "")
|
|
11
|
-
.replace(/\s+/g, "-")
|
|
12
|
-
.toLowerCase();
|
|
13
|
-
const timestamp = new Date().toISOString().replace(/[:.]/g, "-").slice(0, -5);
|
|
14
|
-
const filename = `${sanitizedTitle}_${timestamp}.md`;
|
|
15
|
-
const markdownContent = generateMarkdown(history);
|
|
16
|
-
try {
|
|
17
|
-
await writeFile(filename, markdownContent);
|
|
18
|
-
terminal.info(`Conversation exported to: ${filename}`);
|
|
19
|
-
}
|
|
20
|
-
catch (error) {
|
|
21
|
-
terminal.error(`Failed to export conversation: ${error}`);
|
|
22
|
-
throw error;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
function generateMarkdown(history) {
|
|
26
|
-
const lines = [];
|
|
27
|
-
// Header
|
|
28
|
-
lines.push(`# ${history.title}`);
|
|
29
|
-
lines.push("");
|
|
30
|
-
lines.push("## Conversation Metadata");
|
|
31
|
-
lines.push(`- **Session ID**: ${history.sessionId}`);
|
|
32
|
-
lines.push(`- **Model**: ${history.modelId}`);
|
|
33
|
-
lines.push(`- **Created**: ${history.createdAt.toISOString()}`);
|
|
34
|
-
lines.push(`- **Last Updated**: ${history.updatedAt.toISOString()}`);
|
|
35
|
-
lines.push(`- **Total Messages**: ${history.messages.length}`);
|
|
36
|
-
lines.push("");
|
|
37
|
-
// Messages
|
|
38
|
-
lines.push("## Conversation History");
|
|
39
|
-
lines.push("");
|
|
40
|
-
history.messages.forEach((message, index) => {
|
|
41
|
-
const role = message.role.toUpperCase();
|
|
42
|
-
lines.push(`### ${role} (Message ${index + 1})`);
|
|
43
|
-
lines.push("");
|
|
44
|
-
if (Array.isArray(message.content)) {
|
|
45
|
-
message.content.forEach((part) => {
|
|
46
|
-
if (part.type === "text" && part.text?.trim()) {
|
|
47
|
-
lines.push(part.text);
|
|
48
|
-
lines.push("");
|
|
49
|
-
}
|
|
50
|
-
else if (part.type === "tool-call") {
|
|
51
|
-
lines.push(`**Tool Call**: ${part.toolName}`);
|
|
52
|
-
lines.push(`**Call ID**: ${part.toolCallId}`);
|
|
53
|
-
lines.push("**Input**:");
|
|
54
|
-
lines.push("```json");
|
|
55
|
-
lines.push(JSON.stringify(part.input, null, 2));
|
|
56
|
-
lines.push("```");
|
|
57
|
-
lines.push("");
|
|
58
|
-
}
|
|
59
|
-
else if (part.type === "tool-result") {
|
|
60
|
-
lines.push(`**Tool Result**: ${part.toolName}`);
|
|
61
|
-
lines.push(`**Call ID**: ${part.toolCallId}`);
|
|
62
|
-
lines.push("**Output**:");
|
|
63
|
-
if (typeof part.output === "object" &&
|
|
64
|
-
part.output !== null &&
|
|
65
|
-
"type" in part.output &&
|
|
66
|
-
part.output.type === "text" &&
|
|
67
|
-
"text" in part.output) {
|
|
68
|
-
lines.push("```");
|
|
69
|
-
lines.push(String(part.output.text));
|
|
70
|
-
lines.push("```");
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
lines.push("```json");
|
|
74
|
-
lines.push(JSON.stringify(part.output, null, 2));
|
|
75
|
-
lines.push("```");
|
|
76
|
-
}
|
|
77
|
-
lines.push("");
|
|
78
|
-
}
|
|
79
|
-
else if (part.type === "tool-error") {
|
|
80
|
-
lines.push(`**Tool Error**: ${part.toolName}`);
|
|
81
|
-
lines.push(`**Call ID**: ${part.toolCallId}`);
|
|
82
|
-
lines.push("**Error**:");
|
|
83
|
-
lines.push("```");
|
|
84
|
-
lines.push(String(part.output));
|
|
85
|
-
lines.push("```");
|
|
86
|
-
lines.push("");
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
else if (typeof message.content === "string" && message.content.trim()) {
|
|
91
|
-
lines.push(message.content);
|
|
92
|
-
lines.push("");
|
|
93
|
-
}
|
|
94
|
-
lines.push("---");
|
|
95
|
-
lines.push("");
|
|
96
|
-
});
|
|
97
|
-
return lines.join("\n");
|
|
98
|
-
}
|
|
99
|
-
async function summarizeConversation(history, terminal, modelManager, tokenTracker) {
|
|
3
|
+
import { SessionManager } from "../../sessions/manager.js";
|
|
4
|
+
import { getTerminalSize, isArrowDown, isArrowUp, isEnter, isEscape, setTerminalTitle, } from "../../terminal/control.js";
|
|
5
|
+
import style from "../../terminal/style.js";
|
|
6
|
+
import { Container, Input, Markdown, Spacer, Text } from "../../tui/index.js";
|
|
7
|
+
import { exportConversation } from "./utils.js";
|
|
8
|
+
async function summarizeConversation(history, modelManager, tokenTracker) {
|
|
100
9
|
const systemPrompt = `You are an expert at summarizing conversations between a coding assistant and a user. Your task is to provide a clear, concise summary of the conversation that captures:
|
|
101
10
|
|
|
102
11
|
1. The main topic and objectives
|
|
@@ -122,104 +31,29 @@ Keep the summary focused and informative, around 3-5 paragraphs. Use plain text
|
|
|
122
31
|
})
|
|
123
32
|
.filter((text) => text?.trim())
|
|
124
33
|
.join("\n\n");
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
catch (error) {
|
|
138
|
-
terminal.error(`Failed to generate summary: ${error}`);
|
|
139
|
-
throw error;
|
|
140
|
-
}
|
|
34
|
+
const { text, usage } = await generateText({
|
|
35
|
+
model: modelManager.getModel("conversation-summarizer"),
|
|
36
|
+
system: systemPrompt,
|
|
37
|
+
prompt: `Please summarize this conversation:\n\n${conversationText}`,
|
|
38
|
+
});
|
|
39
|
+
tokenTracker.trackUsage("conversation-summarizer", usage);
|
|
40
|
+
const results = [];
|
|
41
|
+
results.push(`# Summary of "${history.title}":`);
|
|
42
|
+
results.push("");
|
|
43
|
+
results.push(text);
|
|
44
|
+
results.push("");
|
|
45
|
+
return results.join("\n");
|
|
141
46
|
}
|
|
142
|
-
export const historyCommand = ({ messageHistory,
|
|
47
|
+
export const historyCommand = ({ sessionManager: messageHistory, config, modelManager, tokenTracker, }) => {
|
|
143
48
|
return {
|
|
144
49
|
command: "/history",
|
|
145
50
|
description: "Browse and manage previous conversations.",
|
|
146
51
|
getSubCommands: () => Promise.resolve([]),
|
|
147
|
-
execute: async () => {
|
|
148
|
-
const appDir = config.app;
|
|
149
|
-
const messageHistoryDir = await appDir.ensurePath("message-history");
|
|
150
|
-
// Load all histories (use a large number to get all)
|
|
151
|
-
const histories = await MessageHistory.load(messageHistoryDir, 1000);
|
|
152
|
-
if (histories.length === 0) {
|
|
153
|
-
terminal.info("No previous conversations found.");
|
|
154
|
-
return "continue";
|
|
155
|
-
}
|
|
156
|
-
try {
|
|
157
|
-
// Step 1: Select conversation
|
|
158
|
-
const conversationChoice = await select({
|
|
159
|
-
message: "Select a conversation:",
|
|
160
|
-
choices: histories.map((h, index) => ({
|
|
161
|
-
name: `${index + 1}: ${h.title} (${h.updatedAt.toLocaleString()})`,
|
|
162
|
-
value: index,
|
|
163
|
-
description: `${h.messages.length} messages`,
|
|
164
|
-
})),
|
|
165
|
-
pageSize: 15,
|
|
166
|
-
});
|
|
167
|
-
const selectedHistory = histories.at(conversationChoice);
|
|
168
|
-
if (!selectedHistory) {
|
|
169
|
-
terminal.error("Selected history index out of bounds.");
|
|
170
|
-
return "continue";
|
|
171
|
-
}
|
|
172
|
-
// Step 2: Select action
|
|
173
|
-
const actionChoice = await select({
|
|
174
|
-
message: `What would you like to do with "${selectedHistory.title}"?`,
|
|
175
|
-
choices: [
|
|
176
|
-
{
|
|
177
|
-
name: "Resume - Continue this conversation",
|
|
178
|
-
value: "resume",
|
|
179
|
-
},
|
|
180
|
-
{
|
|
181
|
-
name: "Export - Save as markdown file",
|
|
182
|
-
value: "export",
|
|
183
|
-
},
|
|
184
|
-
{
|
|
185
|
-
name: "Summarize - Generate AI summary of conversation",
|
|
186
|
-
value: "summarize",
|
|
187
|
-
},
|
|
188
|
-
],
|
|
189
|
-
pageSize: 5,
|
|
190
|
-
});
|
|
191
|
-
switch (actionChoice) {
|
|
192
|
-
case "resume":
|
|
193
|
-
messageHistory.restore(selectedHistory);
|
|
194
|
-
terminal.info(`Resuming conversation: ${selectedHistory.title}`);
|
|
195
|
-
terminal.setTitle(selectedHistory.title || `acai: ${process.cwd()}`);
|
|
196
|
-
break;
|
|
197
|
-
case "export":
|
|
198
|
-
await exportConversation(selectedHistory, terminal);
|
|
199
|
-
break;
|
|
200
|
-
case "summarize":
|
|
201
|
-
await summarizeConversation(selectedHistory, terminal, modelManager, tokenTracker);
|
|
202
|
-
break;
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
catch (error) {
|
|
206
|
-
// Handle Ctrl-C cancellation
|
|
207
|
-
if (error instanceof Error &&
|
|
208
|
-
"isCanceled" in error &&
|
|
209
|
-
error.isCanceled === true) {
|
|
210
|
-
terminal.info("Operation cancelled.");
|
|
211
|
-
return "continue";
|
|
212
|
-
}
|
|
213
|
-
// Re-throw other errors
|
|
214
|
-
throw error;
|
|
215
|
-
}
|
|
216
|
-
return "continue";
|
|
217
|
-
},
|
|
218
52
|
async handle(_args, { tui, container, inputContainer, editor, }) {
|
|
219
53
|
const appDir = config.app;
|
|
220
54
|
const messageHistoryDir = await appDir.ensurePath("message-history");
|
|
221
55
|
// Load all histories (use a large number to get all)
|
|
222
|
-
const histories = await
|
|
56
|
+
const histories = await SessionManager.load(messageHistoryDir, 1000);
|
|
223
57
|
if (histories.length === 0) {
|
|
224
58
|
container.addChild(new Text(style.yellow("No previous conversations found."), 0, 1));
|
|
225
59
|
tui.requestRender();
|
|
@@ -235,12 +69,12 @@ export const historyCommand = ({ messageHistory, terminal, config, modelManager,
|
|
|
235
69
|
case "resume":
|
|
236
70
|
messageHistory.restore(conversation);
|
|
237
71
|
container.addChild(new Text(style.green(`Resuming conversation: ${conversation.title}`), 0, 1));
|
|
238
|
-
|
|
72
|
+
setTerminalTitle(conversation.title || `acai: ${process.cwd()}`);
|
|
239
73
|
break;
|
|
240
74
|
case "export":
|
|
241
75
|
try {
|
|
242
|
-
await exportConversation(conversation
|
|
243
|
-
container.addChild(new Text(style.green(
|
|
76
|
+
const destFile = await exportConversation(conversation);
|
|
77
|
+
container.addChild(new Text(style.green(`Conversation exported successfully: ${destFile}`), 1, 0));
|
|
244
78
|
}
|
|
245
79
|
catch (error) {
|
|
246
80
|
container.addChild(new Text(style.red(`Failed to export conversation: ${error}`), 1, 0));
|
|
@@ -248,8 +82,14 @@ export const historyCommand = ({ messageHistory, terminal, config, modelManager,
|
|
|
248
82
|
break;
|
|
249
83
|
case "summarize":
|
|
250
84
|
try {
|
|
251
|
-
await summarizeConversation(conversation,
|
|
252
|
-
container.addChild(new
|
|
85
|
+
const result = await summarizeConversation(conversation, modelManager, tokenTracker);
|
|
86
|
+
container.addChild(new Markdown(result, {
|
|
87
|
+
customBgRgb: {
|
|
88
|
+
r: 52,
|
|
89
|
+
g: 53,
|
|
90
|
+
b: 65,
|
|
91
|
+
},
|
|
92
|
+
}));
|
|
253
93
|
}
|
|
254
94
|
catch (error) {
|
|
255
95
|
container.addChild(new Text(style.red(`Failed to summarize conversation: ${error}`), 1, 0));
|
|
@@ -389,24 +229,24 @@ class ConversationSelectorComponent extends Container {
|
|
|
389
229
|
}
|
|
390
230
|
handleInput(keyData) {
|
|
391
231
|
// Up arrow
|
|
392
|
-
if (keyData
|
|
232
|
+
if (isArrowUp(keyData)) {
|
|
393
233
|
this.selectedIndex = Math.max(0, this.selectedIndex - 1);
|
|
394
234
|
this.updateList();
|
|
395
235
|
}
|
|
396
236
|
// Down arrow
|
|
397
|
-
else if (keyData
|
|
237
|
+
else if (isArrowDown(keyData)) {
|
|
398
238
|
this.selectedIndex = Math.min(this.filteredConversations.length - 1, this.selectedIndex + 1);
|
|
399
239
|
this.updateList();
|
|
400
240
|
}
|
|
401
241
|
// Enter
|
|
402
|
-
else if (keyData
|
|
242
|
+
else if (isEnter(keyData)) {
|
|
403
243
|
const selectedConversation = this.filteredConversations[this.selectedIndex];
|
|
404
244
|
if (selectedConversation) {
|
|
405
245
|
this.handleSelect(selectedConversation);
|
|
406
246
|
}
|
|
407
247
|
}
|
|
408
248
|
// Escape
|
|
409
|
-
else if (keyData
|
|
249
|
+
else if (isEscape(keyData)) {
|
|
410
250
|
this.onCancelCallback();
|
|
411
251
|
}
|
|
412
252
|
// Pass everything else to search input
|
|
@@ -470,17 +310,17 @@ class ActionSelectorComponent extends Container {
|
|
|
470
310
|
}
|
|
471
311
|
handleInput(keyData) {
|
|
472
312
|
// Up arrow
|
|
473
|
-
if (keyData
|
|
313
|
+
if (isArrowUp(keyData)) {
|
|
474
314
|
this.selectedIndex = Math.max(0, this.selectedIndex - 1);
|
|
475
315
|
this.updateList();
|
|
476
316
|
}
|
|
477
317
|
// Down arrow
|
|
478
|
-
else if (keyData
|
|
318
|
+
else if (isArrowDown(keyData)) {
|
|
479
319
|
this.selectedIndex = Math.min(2, this.selectedIndex + 1);
|
|
480
320
|
this.updateList();
|
|
481
321
|
}
|
|
482
322
|
// Enter
|
|
483
|
-
else if (keyData
|
|
323
|
+
else if (isEnter(keyData)) {
|
|
484
324
|
const actions = ["resume", "export", "summarize"];
|
|
485
325
|
const selectedAction = actions[this.selectedIndex];
|
|
486
326
|
if (selectedAction) {
|
|
@@ -488,7 +328,7 @@ class ActionSelectorComponent extends Container {
|
|
|
488
328
|
}
|
|
489
329
|
}
|
|
490
330
|
// Escape
|
|
491
|
-
else if (keyData
|
|
331
|
+
else if (isEscape(keyData)) {
|
|
492
332
|
this.onCancelCallback();
|
|
493
333
|
}
|
|
494
334
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ModelMessage } from "ai";
|
|
2
|
+
export interface ConversationHistory {
|
|
3
|
+
title: string;
|
|
4
|
+
createdAt: Date;
|
|
5
|
+
updatedAt: Date;
|
|
6
|
+
messages: ModelMessage[];
|
|
7
|
+
sessionId: string;
|
|
8
|
+
modelId: string;
|
|
9
|
+
project: string;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../source/commands/history/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAEvC,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAChB,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../source/commands/history/utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEtD,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,MAAM,CAAC,CAYjB;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,mBAAmB,GAAG,MAAM,CAyFrE"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { writeFile } from "node:fs/promises";
|
|
2
|
+
export async function exportConversation(history) {
|
|
3
|
+
const sanitizedTitle = history.title
|
|
4
|
+
.replace(/[^a-zA-Z0-9\s-_]/g, "")
|
|
5
|
+
.replace(/\s+/g, "-")
|
|
6
|
+
.toLowerCase();
|
|
7
|
+
const timestamp = new Date().toISOString().replace(/[:.]/g, "-").slice(0, -5);
|
|
8
|
+
const filename = `${sanitizedTitle}_${timestamp}.md`;
|
|
9
|
+
const markdownContent = generateMarkdown(history);
|
|
10
|
+
await writeFile(filename, markdownContent);
|
|
11
|
+
return filename;
|
|
12
|
+
}
|
|
13
|
+
export function generateMarkdown(history) {
|
|
14
|
+
const lines = [];
|
|
15
|
+
// Header
|
|
16
|
+
lines.push(`# ${history.title}`);
|
|
17
|
+
lines.push("");
|
|
18
|
+
lines.push("## Conversation Metadata");
|
|
19
|
+
lines.push(`- **Session ID**: ${history.sessionId}`);
|
|
20
|
+
lines.push(`- **Model**: ${history.modelId}`);
|
|
21
|
+
lines.push(`- **Created**: ${history.createdAt.toISOString()}`);
|
|
22
|
+
lines.push(`- **Last Updated**: ${history.updatedAt.toISOString()}`);
|
|
23
|
+
lines.push(`- **Total Messages**: ${history.messages.length}`);
|
|
24
|
+
lines.push("");
|
|
25
|
+
// Messages
|
|
26
|
+
lines.push("## Conversation History");
|
|
27
|
+
lines.push("");
|
|
28
|
+
history.messages.forEach((message, index) => {
|
|
29
|
+
const role = message.role.toUpperCase();
|
|
30
|
+
lines.push(`### ${role} (Message ${index + 1})`);
|
|
31
|
+
lines.push("");
|
|
32
|
+
if (Array.isArray(message.content)) {
|
|
33
|
+
message.content.forEach((part) => {
|
|
34
|
+
if (part.type === "text" && part.text?.trim()) {
|
|
35
|
+
lines.push(part.text);
|
|
36
|
+
lines.push("");
|
|
37
|
+
}
|
|
38
|
+
else if (part.type === "tool-call") {
|
|
39
|
+
lines.push(`**Tool Call**: ${part.toolName}`);
|
|
40
|
+
lines.push(`**Call ID**: ${part.toolCallId}`);
|
|
41
|
+
lines.push("**Input**:");
|
|
42
|
+
lines.push("```json");
|
|
43
|
+
lines.push(JSON.stringify(part.input, null, 2));
|
|
44
|
+
lines.push("```");
|
|
45
|
+
lines.push("");
|
|
46
|
+
}
|
|
47
|
+
else if (part.type === "tool-result") {
|
|
48
|
+
lines.push(`**Tool Result**: ${part.toolName}`);
|
|
49
|
+
lines.push(`**Call ID**: ${part.toolCallId}`);
|
|
50
|
+
lines.push("**Output**:");
|
|
51
|
+
if (typeof part.output === "object" &&
|
|
52
|
+
part.output !== null &&
|
|
53
|
+
"type" in part.output &&
|
|
54
|
+
part.output.type === "text" &&
|
|
55
|
+
"text" in part.output) {
|
|
56
|
+
lines.push("```");
|
|
57
|
+
lines.push(String(part.output.text));
|
|
58
|
+
lines.push("```");
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
lines.push("```json");
|
|
62
|
+
lines.push(JSON.stringify(part.output, null, 2));
|
|
63
|
+
lines.push("```");
|
|
64
|
+
}
|
|
65
|
+
lines.push("");
|
|
66
|
+
}
|
|
67
|
+
else if (part.type === "tool-error") {
|
|
68
|
+
lines.push(`**Tool Error**: ${part.toolName}`);
|
|
69
|
+
lines.push(`**Call ID**: ${part.toolCallId}`);
|
|
70
|
+
lines.push("**Error**:");
|
|
71
|
+
lines.push("```");
|
|
72
|
+
lines.push(String(part.output));
|
|
73
|
+
lines.push("```");
|
|
74
|
+
lines.push("");
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
else if (typeof message.content === "string" && message.content.trim()) {
|
|
79
|
+
lines.push(message.content);
|
|
80
|
+
lines.push("");
|
|
81
|
+
}
|
|
82
|
+
lines.push("---");
|
|
83
|
+
lines.push("");
|
|
84
|
+
});
|
|
85
|
+
return lines.join("\n");
|
|
86
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/commands/init/index.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAqB/D,eAAO,MAAM,WAAW,GAAI,8BAGzB,cAAc,KAAG,WAiEnB,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { platform } from "node:os";
|
|
2
|
-
import { stepCountIs, streamText } from "ai";
|
|
3
|
-
import style from "
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
2
|
+
import { stepCountIs, streamText, tool } from "ai";
|
|
3
|
+
import style from "../../terminal/style.js";
|
|
4
|
+
import { initTools } from "../../tools/index.js";
|
|
5
|
+
import { Markdown, Spacer, Text } from "../../tui/index.js";
|
|
6
|
+
import { inGitDirectory } from "../../utils/git.js";
|
|
7
7
|
const initPrompt = `Please analyze this codebase and create a AGENTS.md file containing:
|
|
8
8
|
1. An overview of the project including how the project is structured and the tech stack used.
|
|
9
9
|
2. Build/lint/test commands - especially for running a single test
|
|
@@ -22,43 +22,33 @@ If there are Cursor rules (in .cursor/rules/ or .cursorrules), Copilot rules (in
|
|
|
22
22
|
Your current working directory is ${process.cwd()}
|
|
23
23
|
Is directory a git repo: ${(await inGitDirectory()) ? "Yes" : "No"}
|
|
24
24
|
Platform: ${platform()}`;
|
|
25
|
-
export const initCommand = ({
|
|
25
|
+
export const initCommand = ({ modelManager, workspace, }) => {
|
|
26
26
|
return {
|
|
27
27
|
command: "/init",
|
|
28
28
|
description: "Creates the AGENTS.md file.",
|
|
29
29
|
getSubCommands: () => Promise.resolve([]),
|
|
30
|
-
execute: async () => {
|
|
31
|
-
const result = streamText({
|
|
32
|
-
model: modelManager.getModel("init-project"),
|
|
33
|
-
temperature: 0.5,
|
|
34
|
-
prompt: initPrompt,
|
|
35
|
-
stopWhen: stepCountIs(40),
|
|
36
|
-
tools: (await initCliTools({
|
|
37
|
-
tokenCounter,
|
|
38
|
-
workspace,
|
|
39
|
-
})).toolDefs,
|
|
40
|
-
});
|
|
41
|
-
for await (const text of result.textStream) {
|
|
42
|
-
terminal.write(text);
|
|
43
|
-
}
|
|
44
|
-
return "continue";
|
|
45
|
-
},
|
|
46
30
|
async handle(_args, { tui, container, editor, }) {
|
|
47
31
|
container.addChild(new Text("Initializing project and creating AGENTS.md...", 1, 1));
|
|
48
32
|
tui.requestRender();
|
|
33
|
+
const tools = await initTools({
|
|
34
|
+
workspace,
|
|
35
|
+
});
|
|
49
36
|
const result = streamText({
|
|
50
37
|
model: modelManager.getModel("init-project"),
|
|
51
38
|
temperature: 0.5,
|
|
52
39
|
prompt: initPrompt,
|
|
53
40
|
stopWhen: stepCountIs(40),
|
|
54
|
-
tools: (
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
41
|
+
tools: Object.fromEntries(Object.entries(tools).map((t) => [
|
|
42
|
+
t[0],
|
|
43
|
+
tool({
|
|
44
|
+
...t[1]["toolDef"],
|
|
45
|
+
execute: t[1]["execute"],
|
|
46
|
+
}),
|
|
47
|
+
])),
|
|
58
48
|
});
|
|
59
49
|
container.addChild(new Spacer(1));
|
|
60
50
|
let output = "";
|
|
61
|
-
const t = new Markdown(output,
|
|
51
|
+
const t = new Markdown(output, { paddingX: 1, paddingY: 0 });
|
|
62
52
|
container.addChild(t);
|
|
63
53
|
for await (const text of result.textStream) {
|
|
64
54
|
output += text;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/commands/init-project/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAO/D,eAAO,MAAM,kBAAkB,GAAI,UAAU,cAAc,KAAG,WAqF7D,CAAC"}
|