@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
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import fs from "node:fs/promises";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import style from "../terminal/style.js";
|
|
4
|
-
import { Text } from "../tui/index.js";
|
|
5
|
-
export const addDirectoryCommand = ({ terminal, workspace, }) => {
|
|
6
|
-
return {
|
|
7
|
-
command: "/add-directory",
|
|
8
|
-
description: "Add a directory to the list of allowed working directories",
|
|
9
|
-
getSubCommands: async () => {
|
|
10
|
-
return [];
|
|
11
|
-
},
|
|
12
|
-
execute: async (args) => {
|
|
13
|
-
const directoryPath = args?.[0];
|
|
14
|
-
if (!directoryPath) {
|
|
15
|
-
terminal.error("Usage: /add-directory <path>");
|
|
16
|
-
return "continue";
|
|
17
|
-
}
|
|
18
|
-
try {
|
|
19
|
-
// Resolve and validate the directory
|
|
20
|
-
const resolvedPath = path.resolve(directoryPath);
|
|
21
|
-
const stats = await fs.stat(resolvedPath);
|
|
22
|
-
if (!stats.isDirectory()) {
|
|
23
|
-
terminal.error(`Path is not a directory: ${resolvedPath}`);
|
|
24
|
-
return "continue";
|
|
25
|
-
}
|
|
26
|
-
// Check if directory is already in the list
|
|
27
|
-
if (workspace.allowedDirs.includes(resolvedPath)) {
|
|
28
|
-
terminal.warn(`Directory already in allowed list: ${resolvedPath}`);
|
|
29
|
-
return "continue";
|
|
30
|
-
}
|
|
31
|
-
// Add the directory to the workspace
|
|
32
|
-
workspace.allowedDirs.push(resolvedPath);
|
|
33
|
-
terminal.writeln(`Added directory to allowed list: ${style.blue(resolvedPath)}`);
|
|
34
|
-
terminal.writeln(`Current allowed directories: ${style.blue(workspace.allowedDirs.join(", "))}`);
|
|
35
|
-
return "continue";
|
|
36
|
-
}
|
|
37
|
-
catch (error) {
|
|
38
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
39
|
-
terminal.error(`Failed to add directory: ${errorMessage}`);
|
|
40
|
-
return "continue";
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
async handle(args, { tui, container, editor, }) {
|
|
44
|
-
const directoryPath = args?.[0];
|
|
45
|
-
if (!directoryPath) {
|
|
46
|
-
container.addChild(new Text(style.red("Usage: /add-directory <path>"), 0, 1));
|
|
47
|
-
tui.requestRender();
|
|
48
|
-
editor.setText("");
|
|
49
|
-
return "continue";
|
|
50
|
-
}
|
|
51
|
-
try {
|
|
52
|
-
// Resolve and validate the directory
|
|
53
|
-
const resolvedPath = path.resolve(directoryPath);
|
|
54
|
-
const stats = await fs.stat(resolvedPath);
|
|
55
|
-
if (!stats.isDirectory()) {
|
|
56
|
-
container.addChild(new Text(style.red(`Path is not a directory: ${resolvedPath}`), 1, 0));
|
|
57
|
-
tui.requestRender();
|
|
58
|
-
editor.setText("");
|
|
59
|
-
return "continue";
|
|
60
|
-
}
|
|
61
|
-
// Check if directory is already in the list
|
|
62
|
-
if (workspace.allowedDirs.includes(resolvedPath)) {
|
|
63
|
-
container.addChild(new Text(style.yellow(`Directory already in allowed list: ${resolvedPath}`), 1, 0));
|
|
64
|
-
tui.requestRender();
|
|
65
|
-
editor.setText("");
|
|
66
|
-
return "continue";
|
|
67
|
-
}
|
|
68
|
-
// Add the directory to the workspace
|
|
69
|
-
workspace.allowedDirs.push(resolvedPath);
|
|
70
|
-
container.addChild(new Text(`Added directory to allowed list: ${style.blue(resolvedPath)}`, 1, 0));
|
|
71
|
-
container.addChild(new Text(`Current allowed directories: ${style.blue(workspace.allowedDirs.join(", "))}`, 2, 0));
|
|
72
|
-
tui.requestRender();
|
|
73
|
-
editor.setText("");
|
|
74
|
-
return "continue";
|
|
75
|
-
}
|
|
76
|
-
catch (error) {
|
|
77
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
78
|
-
container.addChild(new Text(style.red(`Failed to add directory: ${errorMessage}`), 0, 1));
|
|
79
|
-
tui.requestRender();
|
|
80
|
-
editor.setText("");
|
|
81
|
-
return "continue";
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
};
|
|
85
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"application-log-command.d.ts","sourceRoot":"","sources":["../../source/commands/application-log-command.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9D,eAAO,MAAM,qBAAqB,GAAI,eAEnC,cAAc,KAAG,WAwHnB,CAAC"}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { readFile } from "node:fs/promises";
|
|
2
|
-
import { config } from "../config.js";
|
|
3
|
-
import { editor } from "../terminal/editor-prompt.js";
|
|
4
|
-
import style from "../terminal/style.js";
|
|
5
|
-
import { Text } from "../tui/index.js";
|
|
6
|
-
export const applicationLogCommand = ({ terminal, }) => {
|
|
7
|
-
return {
|
|
8
|
-
command: "/application-logs",
|
|
9
|
-
description: "Opens the application log file defined in acai.json in the editor.",
|
|
10
|
-
getSubCommands: () => Promise.resolve([]),
|
|
11
|
-
execute: async () => {
|
|
12
|
-
let logFilePath;
|
|
13
|
-
try {
|
|
14
|
-
const projectConfig = await config.readProjectConfig();
|
|
15
|
-
logFilePath = projectConfig.logs?.path;
|
|
16
|
-
if (!logFilePath) {
|
|
17
|
-
terminal.error("Application log path is not defined in .acai/acai.json under the 'logs.path' key.");
|
|
18
|
-
return "continue";
|
|
19
|
-
}
|
|
20
|
-
const content = await readFile(logFilePath, { encoding: "utf8" });
|
|
21
|
-
// Use the editor prompt to display the content (read-only)
|
|
22
|
-
await editor({
|
|
23
|
-
message: `Viewing ${logFilePath}`,
|
|
24
|
-
// Attempt to infer postfix from file extension, default otherwise
|
|
25
|
-
postfix: logFilePath.includes(".")
|
|
26
|
-
? `.${logFilePath.split(".").pop()}`
|
|
27
|
-
: ".log",
|
|
28
|
-
default: content,
|
|
29
|
-
// By not providing an onSubmit or similar handler to write the file,
|
|
30
|
-
// and not calling writeFileSync after, this effectively becomes read-only.
|
|
31
|
-
skipPrompt: true,
|
|
32
|
-
});
|
|
33
|
-
terminal.info(`Closed log view for: ${logFilePath}`);
|
|
34
|
-
return "continue";
|
|
35
|
-
}
|
|
36
|
-
catch (error) {
|
|
37
|
-
if (logFilePath && error.code === "ENOENT") {
|
|
38
|
-
terminal.error(`Application log file not found at: ${logFilePath}`);
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
terminal.error(`Error reading or displaying log file ${logFilePath ?? "specified in config"}: ${error}`);
|
|
42
|
-
}
|
|
43
|
-
return "continue";
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
async handle(_args, { tui, container, editor, }) {
|
|
47
|
-
let logFilePath;
|
|
48
|
-
try {
|
|
49
|
-
const projectConfig = await config.readProjectConfig();
|
|
50
|
-
logFilePath = projectConfig.logs?.path;
|
|
51
|
-
if (!logFilePath) {
|
|
52
|
-
container.addChild(new Text(style.red("Application log path is not defined in .acai/acai.json under the 'logs.path' key."), 1, 0));
|
|
53
|
-
tui.requestRender();
|
|
54
|
-
editor.setText("");
|
|
55
|
-
return "continue";
|
|
56
|
-
}
|
|
57
|
-
const content = await readFile(logFilePath, { encoding: "utf8" });
|
|
58
|
-
// For TUI mode, we'll just display a message since we can't use the editor prompt
|
|
59
|
-
container.addChild(new Text(`Viewing application log: ${style.blue(logFilePath)}`, 0, 1));
|
|
60
|
-
container.addChild(new Text(`Content length: ${content.length} characters`, 2, 0));
|
|
61
|
-
container.addChild(new Text(style.dim("Note: Full log viewing not available in TUI mode"), 3, 0));
|
|
62
|
-
tui.requestRender();
|
|
63
|
-
editor.setText("");
|
|
64
|
-
return "continue";
|
|
65
|
-
}
|
|
66
|
-
catch (error) {
|
|
67
|
-
if (logFilePath && error.code === "ENOENT") {
|
|
68
|
-
container.addChild(new Text(style.red(`Application log file not found at: ${logFilePath}`), 1, 0));
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
container.addChild(new Text(style.red(`Error reading log file ${logFilePath ?? "specified in config"}: ${error}`), 1, 0));
|
|
72
|
-
}
|
|
73
|
-
tui.requestRender();
|
|
74
|
-
editor.setText("");
|
|
75
|
-
return "continue";
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
|
-
};
|
|
79
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"clear-command.d.ts","sourceRoot":"","sources":["../../source/commands/clear-command.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9D,eAAO,MAAM,YAAY,GAAI,cAAc,cAAc,KAAG,WAyB3D,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compact-command.d.ts","sourceRoot":"","sources":["../../source/commands/compact-command.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9D,eAAO,MAAM,cAAc,GAAI,SAAS,cAAc,KAAG,WAqCxD,CAAC"}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { generateText } from "ai";
|
|
2
|
-
import { createUserMessage } from "../messages.js";
|
|
3
|
-
import style from "../terminal/style.js";
|
|
4
|
-
import { Text } from "../tui/index.js";
|
|
5
|
-
export const compactCommand = (options) => {
|
|
6
|
-
return {
|
|
7
|
-
command: "/compact",
|
|
8
|
-
description: "Saves, summarizes, and resets the chat history. Optional instructions can be provided for the summary.",
|
|
9
|
-
getSubCommands: () => Promise.resolve([]),
|
|
10
|
-
execute: async (args) => {
|
|
11
|
-
const { messageHistory, terminal } = options;
|
|
12
|
-
if (!messageHistory.isEmpty()) {
|
|
13
|
-
const additionalInstructions = args.join(" ");
|
|
14
|
-
await summarizeAndReset(options, additionalInstructions);
|
|
15
|
-
}
|
|
16
|
-
terminal.info("Message history summarized and reset.");
|
|
17
|
-
return "continue";
|
|
18
|
-
},
|
|
19
|
-
async handle(args, { tui, container, editor, }) {
|
|
20
|
-
const { messageHistory } = options;
|
|
21
|
-
if (!messageHistory.isEmpty()) {
|
|
22
|
-
const additionalInstructions = args.join(" ");
|
|
23
|
-
await summarizeAndReset(options, additionalInstructions);
|
|
24
|
-
}
|
|
25
|
-
container.addChild(new Text(style.green("Message history summarized and reset."), 0, 1));
|
|
26
|
-
tui.requestRender();
|
|
27
|
-
editor.setText("");
|
|
28
|
-
return "continue";
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
async function summarizeAndReset({ messageHistory, modelManager, tokenTracker }, additionalInstructions) {
|
|
33
|
-
const app = "conversation-summarizer";
|
|
34
|
-
// save existing message history
|
|
35
|
-
await messageHistory.save();
|
|
36
|
-
// summarize message history
|
|
37
|
-
let userPrompt = `Your tasks is to provide a detailed summary of our conversation so far. Focus on information that would be helpful for continuing the conversation and the task, including what was the orginal task requested by the user, what we have done so far and why, which files we're working on, and what we're going to do next. Pay special attention to specific user feedback that you received, especially if the user told you to do something differently. You need to provide enough information that another coding agent can you use your summary to pick up where you have left off.
|
|
38
|
-
|
|
39
|
-
Your summary should include the following sections:
|
|
40
|
-
1. Primary Request and Intent: Capture all of the user's explicit requests and intents in detail
|
|
41
|
-
2. Key Technical Concepts: List all important technical concepts, technologies, and frameworks discussed.
|
|
42
|
-
3. Files and Code Sections: Enumerate specific files and code sections examined, modified, or created. Pay special attention to the most recent messages and include full code snippets where applicable and include a summary of why this file read or edit is important.
|
|
43
|
-
4. Errors and fixes: List all errors that you ran into, and how you fixed them. Pay special attention to specific user feedback that you received, especially if the user told you to do something differently.
|
|
44
|
-
5. Problem Solving: Document problems solved and any ongoing troubleshooting efforts.
|
|
45
|
-
6. All user messages: List ALL user messages that are not tool results. These are critical for understanding the users' feedback and changing intent.
|
|
46
|
-
7. Pending Tasks: Outline any pending tasks that you have explicitly been asked to work on.
|
|
47
|
-
8. Current Work: Describe in detail precisely what was being worked on immediately before this summary request, paying special attention to the most recent messages from both user and assistant. Include file names and code snippets where applicable.
|
|
48
|
-
9. Optional Next Step: List the next step that you will take that is related to the most recent work you were doing. IMPORTANT: ensure that this step is DIRECTLY in line with the user's explicit requests, and the task you were working on immediately before this summary request. If your last task was concluded, then only list next steps if they are explicitly in line with the users request. Do not start on tangential requests without confirming with the user first.
|
|
49
|
-
|
|
50
|
-
If there is a next step, include direct quotes from the most recent conversation showing exactly what task you were working on and where you left off. This should be verbatim to ensure there's no drift in task interpretation.`;
|
|
51
|
-
if (additionalInstructions && additionalInstructions.trim().length > 0) {
|
|
52
|
-
userPrompt += `\n\nAdditional instructions provided by the user: ${additionalInstructions}`;
|
|
53
|
-
}
|
|
54
|
-
messageHistory.appendUserMessage(createUserMessage([], userPrompt));
|
|
55
|
-
const { text, usage } = await generateText({
|
|
56
|
-
model: modelManager.getModel(app),
|
|
57
|
-
system: "You are a helpful AI assistant tasked with summarizing conversations so that a coding agent such as yourself can understand what actions have been taken on a code base and what future work still needs to be done.",
|
|
58
|
-
messages: messageHistory.get(),
|
|
59
|
-
});
|
|
60
|
-
tokenTracker.trackUsage(app, usage);
|
|
61
|
-
//create new session
|
|
62
|
-
messageHistory.create(modelManager.getModel("repl").modelId);
|
|
63
|
-
messageHistory.appendUserMessage(createUserMessage([text]));
|
|
64
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"context-command.d.ts","sourceRoot":"","sources":["../../source/commands/context-command.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AA4C9D,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,SAAS,GACV,EAAE,cAAc,GAAG,WAAW,CA4L9B"}
|
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
import { systemPrompt } from "../prompts.js";
|
|
2
|
-
import { initCliTools } from "../tools/index.js";
|
|
3
|
-
import { prepareTools } from "../tools/utils.js";
|
|
4
|
-
import { Container, Modal, ModalTable, ModalText } from "../tui/index.js";
|
|
5
|
-
/**
|
|
6
|
-
* Count tokens from message history
|
|
7
|
-
*/
|
|
8
|
-
function countMessageTokens(messages, counter) {
|
|
9
|
-
if (messages.length === 0) {
|
|
10
|
-
return 0;
|
|
11
|
-
}
|
|
12
|
-
// Serialize messages to JSON for token counting
|
|
13
|
-
const serializedMessages = JSON.stringify(messages);
|
|
14
|
-
return counter.count(serializedMessages);
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Format numbers for display (e.g., 1.2k, 5.1m)
|
|
18
|
-
*/
|
|
19
|
-
function formatNum(n) {
|
|
20
|
-
if (n < 1000)
|
|
21
|
-
return `${n}`;
|
|
22
|
-
if (n < 1_000_000)
|
|
23
|
-
return `${(n / 1000).toFixed(1)}k`;
|
|
24
|
-
return `${(n / 1_000_000).toFixed(1)}m`;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Calculate percentage for display
|
|
28
|
-
*/
|
|
29
|
-
function pct(n, d) {
|
|
30
|
-
if (d <= 0)
|
|
31
|
-
return "0.0%";
|
|
32
|
-
return `${((n / d) * 100).toFixed(1)}%`;
|
|
33
|
-
}
|
|
34
|
-
export function contextCommand({ terminal, tokenCounter, modelManager, messageHistory, workspace, }) {
|
|
35
|
-
return {
|
|
36
|
-
command: "/context",
|
|
37
|
-
description: "Show context window usage breakdown",
|
|
38
|
-
getSubCommands: () => Promise.resolve(["--details", "--json"]),
|
|
39
|
-
async execute(args) {
|
|
40
|
-
const meta = modelManager.getModelMetadata("repl");
|
|
41
|
-
const window = meta.contextWindow;
|
|
42
|
-
// 1) System prompt
|
|
43
|
-
const sys = await systemPrompt({
|
|
44
|
-
supportsToolCalling: meta.supportsToolCalling,
|
|
45
|
-
includeRules: true,
|
|
46
|
-
});
|
|
47
|
-
const systemPromptTokens = tokenCounter.count(sys);
|
|
48
|
-
// 2) Tools (MVP approximation)
|
|
49
|
-
let toolsTokens = 0;
|
|
50
|
-
try {
|
|
51
|
-
const tools = await initCliTools({ tokenCounter, workspace });
|
|
52
|
-
const toolDefs = tools.toolDefs;
|
|
53
|
-
const toolNames = JSON.stringify(prepareTools(toolDefs));
|
|
54
|
-
toolsTokens = tokenCounter.count(toolNames);
|
|
55
|
-
// v2: replace with exact serialized definitions
|
|
56
|
-
}
|
|
57
|
-
catch (error) {
|
|
58
|
-
console.error(error);
|
|
59
|
-
toolsTokens = 0;
|
|
60
|
-
}
|
|
61
|
-
// 3) Messages
|
|
62
|
-
const messagesTokens = countMessageTokens(messageHistory.get(), tokenCounter);
|
|
63
|
-
// 4) Totals
|
|
64
|
-
const used = systemPromptTokens + toolsTokens + messagesTokens;
|
|
65
|
-
const free = Math.max(0, window - used);
|
|
66
|
-
const breakdown = {
|
|
67
|
-
systemPrompt: systemPromptTokens,
|
|
68
|
-
tools: toolsTokens,
|
|
69
|
-
messages: messagesTokens,
|
|
70
|
-
totalUsed: used,
|
|
71
|
-
window,
|
|
72
|
-
free,
|
|
73
|
-
};
|
|
74
|
-
// Output
|
|
75
|
-
terminal.header("Context Usage");
|
|
76
|
-
terminal.table([
|
|
77
|
-
[
|
|
78
|
-
"System prompt",
|
|
79
|
-
formatNum(breakdown.systemPrompt),
|
|
80
|
-
pct(breakdown.systemPrompt, window),
|
|
81
|
-
],
|
|
82
|
-
[
|
|
83
|
-
"System tools",
|
|
84
|
-
formatNum(breakdown.tools),
|
|
85
|
-
pct(breakdown.tools, window),
|
|
86
|
-
],
|
|
87
|
-
[
|
|
88
|
-
"Messages",
|
|
89
|
-
formatNum(breakdown.messages),
|
|
90
|
-
pct(breakdown.messages, window),
|
|
91
|
-
],
|
|
92
|
-
[
|
|
93
|
-
"Free space",
|
|
94
|
-
formatNum(breakdown.free),
|
|
95
|
-
pct(breakdown.free, window),
|
|
96
|
-
],
|
|
97
|
-
], { header: ["Section", "Tokens", "Percent"], colWidths: [40, 30, 30] });
|
|
98
|
-
terminal.lineBreak();
|
|
99
|
-
terminal.displayProgressBar(used, window);
|
|
100
|
-
if (args.includes("--json")) {
|
|
101
|
-
terminal.lineBreak();
|
|
102
|
-
terminal.display(JSON.stringify(breakdown, null, 2));
|
|
103
|
-
}
|
|
104
|
-
return "continue";
|
|
105
|
-
},
|
|
106
|
-
async handle(args, { tui, editor }) {
|
|
107
|
-
const meta = modelManager.getModelMetadata("repl");
|
|
108
|
-
const window = meta.contextWindow;
|
|
109
|
-
// 1) System prompt
|
|
110
|
-
const sys = await systemPrompt({
|
|
111
|
-
supportsToolCalling: meta.supportsToolCalling,
|
|
112
|
-
includeRules: true,
|
|
113
|
-
});
|
|
114
|
-
const systemPromptTokens = tokenCounter.count(sys);
|
|
115
|
-
// 2) Tools (MVP approximation)
|
|
116
|
-
let toolsTokens = 0;
|
|
117
|
-
try {
|
|
118
|
-
const tools = await initCliTools({ tokenCounter, workspace });
|
|
119
|
-
const toolDefs = tools.toolDefs;
|
|
120
|
-
const toolNames = JSON.stringify(prepareTools(toolDefs));
|
|
121
|
-
toolsTokens = tokenCounter.count(toolNames);
|
|
122
|
-
// v2: replace with exact serialized definitions
|
|
123
|
-
}
|
|
124
|
-
catch (error) {
|
|
125
|
-
console.error(error);
|
|
126
|
-
toolsTokens = 0;
|
|
127
|
-
}
|
|
128
|
-
// 3) Messages
|
|
129
|
-
const messagesTokens = countMessageTokens(messageHistory.get(), tokenCounter);
|
|
130
|
-
// 4) Totals
|
|
131
|
-
const used = systemPromptTokens + toolsTokens + messagesTokens;
|
|
132
|
-
const free = Math.max(0, window - used);
|
|
133
|
-
const breakdown = {
|
|
134
|
-
systemPrompt: systemPromptTokens,
|
|
135
|
-
tools: toolsTokens,
|
|
136
|
-
messages: messagesTokens,
|
|
137
|
-
totalUsed: used,
|
|
138
|
-
window,
|
|
139
|
-
free,
|
|
140
|
-
};
|
|
141
|
-
// Build modal content
|
|
142
|
-
const modalContent = new Container();
|
|
143
|
-
// Context usage table
|
|
144
|
-
const tableData = [
|
|
145
|
-
[
|
|
146
|
-
"System prompt",
|
|
147
|
-
formatNum(breakdown.systemPrompt),
|
|
148
|
-
pct(breakdown.systemPrompt, window),
|
|
149
|
-
],
|
|
150
|
-
[
|
|
151
|
-
"System tools",
|
|
152
|
-
formatNum(breakdown.tools),
|
|
153
|
-
pct(breakdown.tools, window),
|
|
154
|
-
],
|
|
155
|
-
[
|
|
156
|
-
"Messages",
|
|
157
|
-
formatNum(breakdown.messages),
|
|
158
|
-
pct(breakdown.messages, window),
|
|
159
|
-
],
|
|
160
|
-
["Free space", formatNum(breakdown.free), pct(breakdown.free, window)],
|
|
161
|
-
];
|
|
162
|
-
modalContent.addChild(new ModalText("Context Usage", 0, 1));
|
|
163
|
-
modalContent.addChild(new ModalTable(tableData, ["Section", "Tokens", "Percent"]));
|
|
164
|
-
// Progress bar
|
|
165
|
-
const progressBar = `[${"#".repeat(Math.floor((used / window) * 20))}${"-".repeat(20 - Math.floor((used / window) * 20))}] ${pct(used, window)}`;
|
|
166
|
-
modalContent.addChild(new ModalText("", 0, 1)); // Spacer
|
|
167
|
-
modalContent.addChild(new ModalText(progressBar, 0, 1));
|
|
168
|
-
if (args.includes("--json")) {
|
|
169
|
-
modalContent.addChild(new ModalText("", 0, 1)); // Spacer
|
|
170
|
-
modalContent.addChild(new ModalText("JSON Output:", 0, 1));
|
|
171
|
-
modalContent.addChild(new ModalText(JSON.stringify(breakdown, null, 2), 0, 1));
|
|
172
|
-
}
|
|
173
|
-
// Create and show modal
|
|
174
|
-
const modal = new Modal("Context Window Usage", modalContent, true, () => {
|
|
175
|
-
// Modal closed callback
|
|
176
|
-
editor.setText("");
|
|
177
|
-
tui.requestRender();
|
|
178
|
-
});
|
|
179
|
-
tui.showModal(modal);
|
|
180
|
-
return "continue";
|
|
181
|
-
},
|
|
182
|
-
};
|
|
183
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"copy-command.d.ts","sourceRoot":"","sources":["../../source/commands/copy-command.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAyB9D,wBAAgB,WAAW,CAAC,OAAO,EAAE,cAAc,GAAG,WAAW,CAsEhE"}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import Clipboard from "@crosscopy/clipboard";
|
|
2
|
-
import style from "../terminal/style.js";
|
|
3
|
-
import { Spacer, Text } from "../tui/index.js";
|
|
4
|
-
function extractLastAssistantText(messages) {
|
|
5
|
-
for (let i = messages.length - 1; i >= 0; i--) {
|
|
6
|
-
const msg = messages[i];
|
|
7
|
-
if (!msg)
|
|
8
|
-
continue;
|
|
9
|
-
if (msg.role !== "assistant")
|
|
10
|
-
continue;
|
|
11
|
-
if (!("content" in msg) || !Array.isArray(msg.content))
|
|
12
|
-
continue;
|
|
13
|
-
// Find last text part
|
|
14
|
-
for (let j = msg.content.length - 1; j >= 0; j--) {
|
|
15
|
-
const part = msg.content[j];
|
|
16
|
-
if (part &&
|
|
17
|
-
part.type === "text" &&
|
|
18
|
-
typeof part.text === "string") {
|
|
19
|
-
const text = part.text;
|
|
20
|
-
if (text.trim().length > 0)
|
|
21
|
-
return text;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
|
-
export function copyCommand(options) {
|
|
28
|
-
return {
|
|
29
|
-
command: "/copy",
|
|
30
|
-
description: "Copy the last assistant response to the clipboard",
|
|
31
|
-
async getSubCommands() {
|
|
32
|
-
return [];
|
|
33
|
-
},
|
|
34
|
-
async execute(_args) {
|
|
35
|
-
const { messageHistory, terminal } = options;
|
|
36
|
-
const history = messageHistory.get();
|
|
37
|
-
const lastText = extractLastAssistantText(history);
|
|
38
|
-
if (!lastText) {
|
|
39
|
-
terminal.info("No assistant response to copy.");
|
|
40
|
-
return "continue";
|
|
41
|
-
}
|
|
42
|
-
try {
|
|
43
|
-
await Clipboard.setText(lastText);
|
|
44
|
-
terminal.success("Copied last response to clipboard.");
|
|
45
|
-
return "continue";
|
|
46
|
-
}
|
|
47
|
-
catch (err) {
|
|
48
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
49
|
-
terminal.error(`Could not copy to clipboard: ${message}`);
|
|
50
|
-
return "continue";
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
async handle(_args, { tui, container, editor, }) {
|
|
54
|
-
const { messageHistory } = options;
|
|
55
|
-
const history = messageHistory.get();
|
|
56
|
-
container.addChild(new Spacer(1));
|
|
57
|
-
const lastText = extractLastAssistantText(history);
|
|
58
|
-
if (!lastText) {
|
|
59
|
-
container.addChild(new Text(style.dim("No assistant response to copy."), 0, 1));
|
|
60
|
-
tui.requestRender();
|
|
61
|
-
editor.setText("");
|
|
62
|
-
return "continue";
|
|
63
|
-
}
|
|
64
|
-
try {
|
|
65
|
-
await Clipboard.setText(lastText);
|
|
66
|
-
container.addChild(new Text(style.dim("Copied last response to clipboard."), 0, 1));
|
|
67
|
-
tui.requestRender();
|
|
68
|
-
editor.setText("");
|
|
69
|
-
return "continue";
|
|
70
|
-
}
|
|
71
|
-
catch (err) {
|
|
72
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
73
|
-
container.addChild(new Text(style.dim(`Could not copy to clipboard: ${message}`), 0, 1));
|
|
74
|
-
tui.requestRender();
|
|
75
|
-
editor.setText("");
|
|
76
|
-
return "continue";
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
};
|
|
80
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"edit-command.d.ts","sourceRoot":"","sources":["../../source/commands/edit-command.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9D,eAAO,MAAM,WAAW,GAAI,cAAc,cAAc,KAAG,WAoH1D,CAAC"}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
2
|
-
import { extname, resolve } from "node:path";
|
|
3
|
-
import { editor } from "../terminal/editor-prompt.js";
|
|
4
|
-
import { search } from "../terminal/search-prompt.js";
|
|
5
|
-
import style from "../terminal/style.js";
|
|
6
|
-
import { Text } from "../tui/index.js";
|
|
7
|
-
import { glob } from "../utils/glob.js";
|
|
8
|
-
export const editCommand = ({ terminal }) => {
|
|
9
|
-
return {
|
|
10
|
-
command: "/edit",
|
|
11
|
-
description: "Opens file in $EDITOR for editing. Usage: /edit [file-path]",
|
|
12
|
-
getSubCommands: () => Promise.resolve([]),
|
|
13
|
-
execute: async (args) => {
|
|
14
|
-
let fileToEdit;
|
|
15
|
-
if (args.length > 0) {
|
|
16
|
-
// File path provided as argument
|
|
17
|
-
const filePath = args.join(" "); // Handle file paths with spaces
|
|
18
|
-
const resolvedPath = resolve(filePath);
|
|
19
|
-
if (!existsSync(resolvedPath)) {
|
|
20
|
-
terminal.error(`File not found: ${filePath}`);
|
|
21
|
-
return "continue";
|
|
22
|
-
}
|
|
23
|
-
fileToEdit = filePath;
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
// No file path provided, use search prompt
|
|
27
|
-
fileToEdit = await search({
|
|
28
|
-
message: "Search for file:",
|
|
29
|
-
source: async (input) => {
|
|
30
|
-
if (!input) {
|
|
31
|
-
return [];
|
|
32
|
-
}
|
|
33
|
-
const foundFiles = await glob(`**/*${input}*`, {
|
|
34
|
-
gitignore: true,
|
|
35
|
-
});
|
|
36
|
-
return foundFiles.map((file) => ({
|
|
37
|
-
name: file,
|
|
38
|
-
value: file,
|
|
39
|
-
}));
|
|
40
|
-
},
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
const content = readFileSync(fileToEdit, { encoding: "utf8" });
|
|
44
|
-
const edit = await editor({
|
|
45
|
-
message: `Edit ${fileToEdit}?`,
|
|
46
|
-
postfix: extname(fileToEdit),
|
|
47
|
-
default: content,
|
|
48
|
-
skipPrompt: true,
|
|
49
|
-
});
|
|
50
|
-
writeFileSync(fileToEdit, edit);
|
|
51
|
-
if (content !== edit) {
|
|
52
|
-
terminal.info(`File updated: ${fileToEdit}`);
|
|
53
|
-
}
|
|
54
|
-
return "continue";
|
|
55
|
-
},
|
|
56
|
-
async handle(args, { tui, container, editor, }) {
|
|
57
|
-
let fileToEdit;
|
|
58
|
-
if (args.length > 0) {
|
|
59
|
-
// File path provided as argument
|
|
60
|
-
const filePath = args.join(" "); // Handle file paths with spaces
|
|
61
|
-
const resolvedPath = resolve(filePath);
|
|
62
|
-
if (!existsSync(resolvedPath)) {
|
|
63
|
-
container.addChild(new Text(style.red(`File not found: ${filePath}`), 0, 1));
|
|
64
|
-
tui.requestRender();
|
|
65
|
-
editor.setText("");
|
|
66
|
-
return "continue";
|
|
67
|
-
}
|
|
68
|
-
fileToEdit = filePath;
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
// No file path provided, show message for TUI
|
|
72
|
-
container.addChild(new Text(style.red("File path required for /edit in TUI mode"), 0, 1));
|
|
73
|
-
container.addChild(new Text(style.dim("Usage: /edit <file-path>"), 2, 0));
|
|
74
|
-
tui.requestRender();
|
|
75
|
-
editor.setText("");
|
|
76
|
-
return "continue";
|
|
77
|
-
}
|
|
78
|
-
const content = readFileSync(fileToEdit, { encoding: "utf8" });
|
|
79
|
-
// For TUI mode, we can't use the editor prompt, so we'll just show file info
|
|
80
|
-
container.addChild(new Text(`Editing file: ${style.blue(fileToEdit)}`, 0, 1));
|
|
81
|
-
container.addChild(new Text(`Content length: ${content.length} characters`, 2, 0));
|
|
82
|
-
container.addChild(new Text(style.dim("Note: Full file editing not available in TUI mode"), 3, 0));
|
|
83
|
-
tui.requestRender();
|
|
84
|
-
editor.setText("");
|
|
85
|
-
return "continue";
|
|
86
|
-
},
|
|
87
|
-
};
|
|
88
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"edit-prompt-command.d.ts","sourceRoot":"","sources":["../../source/commands/edit-prompt-command.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9D,eAAO,MAAM,iBAAiB,GAAI,6CAI/B,cAAc,KAAG,WAkFnB,CAAC"}
|