@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
package/dist/index.js
CHANGED
|
@@ -1,30 +1,39 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { mkdirSync } from "node:fs";
|
|
3
|
+
import os from "node:os";
|
|
4
|
+
import path from "node:path";
|
|
2
5
|
import { text } from "node:stream/consumers";
|
|
3
6
|
import { parseArgs } from "node:util";
|
|
4
|
-
import { asyncTry } from "@travisennis/stdlib/try";
|
|
7
|
+
import { asyncTry, isFailure, syncTry } from "@travisennis/stdlib/try";
|
|
5
8
|
import { isDefined } from "@travisennis/stdlib/typeguards";
|
|
6
9
|
import { Agent } from "./agent/index.js";
|
|
7
10
|
import { Cli } from "./cli.js";
|
|
8
11
|
import { CommandManager } from "./commands/manager.js";
|
|
9
|
-
import { config } from "./config.js";
|
|
12
|
+
import { config, } from "./config.js";
|
|
10
13
|
import { logger } from "./logger.js";
|
|
11
|
-
import {
|
|
14
|
+
import { PromptError, processPrompt } from "./mentions.js";
|
|
12
15
|
import { ModelManager } from "./models/manager.js";
|
|
13
16
|
import { isSupportedModel } from "./models/providers.js";
|
|
14
17
|
import { PromptManager } from "./prompts/manager.js";
|
|
15
18
|
import { systemPrompt } from "./prompts.js";
|
|
16
|
-
import { Repl } from "./repl.js";
|
|
17
19
|
import { NewRepl } from "./repl-new.js";
|
|
18
|
-
import {
|
|
20
|
+
import { SessionManager } from "./sessions/manager.js";
|
|
21
|
+
import { setTerminalTitle } from "./terminal/control.js";
|
|
19
22
|
import { select } from "./terminal/select-prompt.js";
|
|
20
23
|
import { TokenCounter } from "./tokens/counter.js";
|
|
21
24
|
import { TokenTracker } from "./tokens/tracker.js";
|
|
22
|
-
import {
|
|
25
|
+
import { initTools } from "./tools/index.js";
|
|
23
26
|
import { getPackageVersion } from "./version.js";
|
|
24
27
|
// Create workspace context from CLI arguments
|
|
25
28
|
export function createWorkspaceContext(addDirArgs = []) {
|
|
26
29
|
const primaryDir = process.cwd();
|
|
27
|
-
|
|
30
|
+
mkdirSync("/tmp/acai", { recursive: true });
|
|
31
|
+
const allowedDirs = [
|
|
32
|
+
primaryDir,
|
|
33
|
+
"/tmp/acai",
|
|
34
|
+
path.join(os.homedir(), ".acai"),
|
|
35
|
+
...addDirArgs,
|
|
36
|
+
];
|
|
28
37
|
// Remove duplicates while preserving order
|
|
29
38
|
const uniqueDirs = allowedDirs.filter((dir, index, array) => array.indexOf(dir) === index);
|
|
30
39
|
return {
|
|
@@ -39,33 +48,43 @@ Usage
|
|
|
39
48
|
Options
|
|
40
49
|
--model, -m Sets the model to use
|
|
41
50
|
--prompt, -p Sets the prompt (runs in CLI mode)
|
|
42
|
-
--continue
|
|
43
|
-
--resume
|
|
51
|
+
--continue Select a conversation to resume from a list
|
|
52
|
+
--resume Resume a specific session by ID, or most recent if no ID given
|
|
44
53
|
--add-dir Add additional working directory (can be used multiple times)
|
|
45
|
-
--
|
|
54
|
+
--no-skills Disable skills discovery and loading
|
|
55
|
+
|
|
56
|
+
|
|
46
57
|
--help, -h Show help
|
|
47
58
|
--version, -v Show version
|
|
48
59
|
|
|
49
60
|
Examples
|
|
50
|
-
$ acai --model
|
|
61
|
+
$ acai --model anthropic:sonnet
|
|
51
62
|
$ acai -p "initial prompt"
|
|
52
63
|
$ acai --add-dir /path/to/project1 --add-dir /path/to/project2
|
|
64
|
+
$ acai --continue
|
|
65
|
+
$ acai --resume
|
|
66
|
+
$ acai --resume a1b2c3d4-e5f6-7890-1234-567890abcdef
|
|
53
67
|
`;
|
|
54
|
-
const parsed = parseArgs({
|
|
68
|
+
const parsed = syncTry(() => parseArgs({
|
|
55
69
|
options: {
|
|
56
70
|
model: { type: "string", short: "m" },
|
|
57
71
|
prompt: { type: "string", short: "p" },
|
|
58
72
|
continue: { type: "boolean", default: false },
|
|
59
73
|
resume: { type: "boolean", default: false },
|
|
60
74
|
"add-dir": { type: "string", multiple: true },
|
|
61
|
-
"
|
|
75
|
+
"no-skills": { type: "boolean", default: false },
|
|
62
76
|
help: { type: "boolean", short: "h" },
|
|
63
77
|
version: { type: "boolean", short: "v" },
|
|
64
78
|
},
|
|
65
79
|
allowPositionals: true,
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
|
|
80
|
+
}));
|
|
81
|
+
if (isFailure(parsed)) {
|
|
82
|
+
console.error(parsed.error.message);
|
|
83
|
+
console.info(helpText);
|
|
84
|
+
process.exit(0);
|
|
85
|
+
}
|
|
86
|
+
const flags = parsed.unwrap().values;
|
|
87
|
+
const input = parsed.unwrap().positionals;
|
|
69
88
|
// Create workspace context from CLI arguments
|
|
70
89
|
const workspace = createWorkspaceContext(flags["add-dir"]);
|
|
71
90
|
/**
|
|
@@ -76,8 +95,75 @@ const workspace = createWorkspaceContext(flags["add-dir"]);
|
|
|
76
95
|
export function handleError(error) {
|
|
77
96
|
logger.error({ error: error }, error.message);
|
|
78
97
|
}
|
|
79
|
-
|
|
80
|
-
|
|
98
|
+
// Configuration constants
|
|
99
|
+
const DEFAULT_HISTORY_LIMIT = 10;
|
|
100
|
+
const CONTINUE_HISTORY_LIMIT = 1;
|
|
101
|
+
// Helper functions for main()
|
|
102
|
+
async function initializeAppState(appConfig, initialPromptInput, stdInPrompt, hasContinueOrResume, resumeSessionId) {
|
|
103
|
+
const appDir = config.app;
|
|
104
|
+
// Parallelize independent async operations
|
|
105
|
+
const [messageHistoryDir, modelManager] = await Promise.all([
|
|
106
|
+
appDir.ensurePath("message-history"),
|
|
107
|
+
initializeModelManager(appDir),
|
|
108
|
+
]);
|
|
109
|
+
// Initialize synchronous components
|
|
110
|
+
const tokenTracker = new TokenTracker();
|
|
111
|
+
const tokenCounter = new TokenCounter();
|
|
112
|
+
// Initialize dependent components
|
|
113
|
+
const sessionManager = await initializeSessionManager(messageHistoryDir, modelManager, tokenTracker);
|
|
114
|
+
// Handle conversation history loading
|
|
115
|
+
await handleConversationHistory(sessionManager, messageHistoryDir, hasContinueOrResume, resumeSessionId);
|
|
116
|
+
// Setup prompt manager
|
|
117
|
+
const promptManager = new PromptManager(tokenCounter);
|
|
118
|
+
if (!hasContinueOrResume && isDefined(initialPromptInput)) {
|
|
119
|
+
try {
|
|
120
|
+
const modelConfig = modelManager.getModelMetadata("repl");
|
|
121
|
+
const processedPrompt = await processPrompt(initialPromptInput, {
|
|
122
|
+
baseDir: process.cwd(),
|
|
123
|
+
model: modelConfig,
|
|
124
|
+
});
|
|
125
|
+
for (const context of processedPrompt.context) {
|
|
126
|
+
promptManager.addContext(context);
|
|
127
|
+
}
|
|
128
|
+
promptManager.set(processedPrompt.message);
|
|
129
|
+
}
|
|
130
|
+
catch (error) {
|
|
131
|
+
if (error instanceof PromptError) {
|
|
132
|
+
logger.error(`Prompt mention error: ${error.message}`);
|
|
133
|
+
promptManager.set(initialPromptInput);
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
throw new Error("Failed to process prompt.", { cause: error });
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
if (stdInPrompt) {
|
|
141
|
+
promptManager.addContext(stdInPrompt);
|
|
142
|
+
}
|
|
143
|
+
const promptHistory = [];
|
|
144
|
+
const commands = new CommandManager({
|
|
145
|
+
promptManager,
|
|
146
|
+
modelManager,
|
|
147
|
+
sessionManager,
|
|
148
|
+
tokenTracker,
|
|
149
|
+
config,
|
|
150
|
+
tokenCounter,
|
|
151
|
+
promptHistory,
|
|
152
|
+
workspace,
|
|
153
|
+
});
|
|
154
|
+
await commands.initializeCommmands();
|
|
155
|
+
return {
|
|
156
|
+
appConfig,
|
|
157
|
+
modelManager,
|
|
158
|
+
tokenTracker,
|
|
159
|
+
tokenCounter,
|
|
160
|
+
sessionManager,
|
|
161
|
+
promptManager,
|
|
162
|
+
promptHistory,
|
|
163
|
+
commands,
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
async function handleEarlyExits() {
|
|
81
167
|
if (flags.version === true) {
|
|
82
168
|
console.info(getPackageVersion());
|
|
83
169
|
process.exit(0);
|
|
@@ -86,83 +172,101 @@ async function main() {
|
|
|
86
172
|
console.info(helpText);
|
|
87
173
|
process.exit(0);
|
|
88
174
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
175
|
+
return false;
|
|
176
|
+
}
|
|
177
|
+
function validateSessionId(id) {
|
|
178
|
+
const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
179
|
+
return id.length === 36 && uuidRegex.test(id);
|
|
180
|
+
}
|
|
181
|
+
function validateCliArguments() {
|
|
92
182
|
if (flags.continue === true && flags.resume === true) {
|
|
93
183
|
console.error("Cannot use --continue and --resume flags together.");
|
|
94
184
|
process.exit(1);
|
|
95
185
|
}
|
|
186
|
+
if (flags.resume === true && input.length > 0) {
|
|
187
|
+
const sessionId = input[0];
|
|
188
|
+
if (!validateSessionId(sessionId)) {
|
|
189
|
+
console.error(`Invalid session ID: ${sessionId}`);
|
|
190
|
+
console.error("Session ID must be a valid UUID (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)");
|
|
191
|
+
process.exit(1);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
async function determineInitialPrompt() {
|
|
96
196
|
const hasContinueOrResume = flags.continue === true || flags.resume === true;
|
|
97
|
-
// --- Determine Initial Prompt (potential conflict) ---
|
|
98
197
|
const positionalPrompt = input.at(0);
|
|
99
198
|
let stdInPrompt;
|
|
100
199
|
// Check if there's data available on stdin
|
|
101
200
|
if (!process.stdin.isTTY) {
|
|
102
201
|
try {
|
|
103
|
-
// Non-TTY stdin means data is being piped in
|
|
104
202
|
stdInPrompt = await text(process.stdin);
|
|
105
203
|
}
|
|
106
204
|
catch (error) {
|
|
107
205
|
console.error(`Error reading stdin: ${error.message}`);
|
|
108
206
|
}
|
|
109
207
|
}
|
|
208
|
+
// Check for session ID with --resume
|
|
209
|
+
const resumeSessionId = flags.resume === true && input.length > 0 ? input[0] : undefined;
|
|
110
210
|
const initialPromptInput = typeof flags.prompt === "string" && flags.prompt.length > 0
|
|
111
211
|
? flags.prompt
|
|
112
|
-
: positionalPrompt && positionalPrompt.length > 0
|
|
212
|
+
: positionalPrompt && positionalPrompt.length > 0 && !resumeSessionId
|
|
113
213
|
? positionalPrompt
|
|
114
214
|
: undefined;
|
|
115
215
|
if (hasContinueOrResume && isDefined(initialPromptInput)) {
|
|
116
216
|
console.error("Cannot use --continue or --resume with an initial prompt.");
|
|
117
217
|
process.exit(1);
|
|
118
218
|
}
|
|
119
|
-
|
|
120
|
-
|
|
219
|
+
return {
|
|
220
|
+
initialPromptInput,
|
|
221
|
+
stdInPrompt,
|
|
222
|
+
hasContinueOrResume,
|
|
223
|
+
resumeSessionId,
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
async function initializeModelManager(appDir) {
|
|
121
227
|
const chosenModel = isSupportedModel(flags.model)
|
|
122
228
|
? flags.model
|
|
123
|
-
: "
|
|
229
|
+
: "opencode:minimax-m2-1";
|
|
124
230
|
const modelManager = new ModelManager({
|
|
125
231
|
stateDir: await appDir.ensurePath("audit"),
|
|
126
232
|
});
|
|
127
233
|
modelManager.setModel("repl", chosenModel);
|
|
128
234
|
modelManager.setModel("cli", chosenModel);
|
|
129
|
-
modelManager.setModel("title-conversation",
|
|
130
|
-
modelManager.setModel("conversation-summarizer",
|
|
131
|
-
modelManager.setModel("tool-repair",
|
|
132
|
-
modelManager.setModel("conversation-analyzer",
|
|
235
|
+
modelManager.setModel("title-conversation", chosenModel);
|
|
236
|
+
modelManager.setModel("conversation-summarizer", chosenModel);
|
|
237
|
+
modelManager.setModel("tool-repair", chosenModel);
|
|
238
|
+
modelManager.setModel("conversation-analyzer", chosenModel);
|
|
133
239
|
modelManager.setModel("init-project", chosenModel);
|
|
134
|
-
modelManager.setModel("task-agent",
|
|
240
|
+
modelManager.setModel("task-agent", chosenModel);
|
|
135
241
|
modelManager.setModel("handoff-agent", chosenModel);
|
|
136
|
-
modelManager.setModel("edit-fix",
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
242
|
+
modelManager.setModel("edit-fix", chosenModel);
|
|
243
|
+
return modelManager;
|
|
244
|
+
}
|
|
245
|
+
async function initializeSessionManager(messageHistoryDir, modelManager, tokenTracker) {
|
|
246
|
+
const messageHistory = new SessionManager({
|
|
140
247
|
stateDir: messageHistoryDir,
|
|
141
248
|
modelManager,
|
|
142
249
|
tokenTracker,
|
|
143
250
|
});
|
|
144
|
-
messageHistory.on("update-title", (title) =>
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
messageHistory.
|
|
150
|
-
console.info(`Resuming conversation: ${latestHistory.title}`);
|
|
151
|
-
// Set terminal title after restoring
|
|
152
|
-
terminal.setTitle(latestHistory.title || `acai: ${process.cwd()}`);
|
|
251
|
+
messageHistory.on("update-title", (title) => setTerminalTitle(title));
|
|
252
|
+
// Listen for model changes and update session manager when repl model changes
|
|
253
|
+
modelManager.on("set-model", (app, _model) => {
|
|
254
|
+
if (app === "repl") {
|
|
255
|
+
const modelId = modelManager.getModel("repl").modelId;
|
|
256
|
+
messageHistory.setModelId(modelId);
|
|
153
257
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
const histories = await
|
|
258
|
+
});
|
|
259
|
+
return messageHistory;
|
|
260
|
+
}
|
|
261
|
+
async function handleConversationHistory(messageHistory, messageHistoryDir, _hasContinueOrResume, resumeSessionId) {
|
|
262
|
+
if (flags.continue === true) {
|
|
263
|
+
const histories = await SessionManager.load(messageHistoryDir, DEFAULT_HISTORY_LIMIT);
|
|
160
264
|
if (histories.length > 0) {
|
|
161
265
|
try {
|
|
162
266
|
const choice = await select({
|
|
163
267
|
message: "Select a conversation to resume:",
|
|
164
268
|
choices: histories.map((h, index) => ({
|
|
165
|
-
name: `${index + 1}: ${h.title} (${h.updatedAt.toLocaleString()})`,
|
|
269
|
+
name: `${index + 1}: ${h.title} [${h.sessionId}] (${h.updatedAt.toLocaleString()})`,
|
|
166
270
|
value: index,
|
|
167
271
|
description: `${h.messages.length} messages`,
|
|
168
272
|
})),
|
|
@@ -171,156 +275,174 @@ async function main() {
|
|
|
171
275
|
if (selectedHistory) {
|
|
172
276
|
messageHistory.restore(selectedHistory);
|
|
173
277
|
logger.info(`Resuming conversation: ${selectedHistory.title}`);
|
|
174
|
-
|
|
175
|
-
terminal.setTitle(selectedHistory.title || `acai: ${process.cwd()}`);
|
|
278
|
+
setTerminalTitle(selectedHistory.title || `acai: ${process.cwd()}`);
|
|
176
279
|
}
|
|
177
280
|
else {
|
|
178
|
-
// This case should theoretically not happen if choice is valid
|
|
179
281
|
logger.error("Selected history index out of bounds.");
|
|
180
282
|
}
|
|
181
283
|
}
|
|
182
284
|
catch (error) {
|
|
183
|
-
// Handle Ctrl-C cancellation
|
|
184
285
|
if (error instanceof Error &&
|
|
185
286
|
"isCanceled" in error &&
|
|
186
287
|
error.isCanceled === true) {
|
|
187
288
|
logger.info("Resume selection cancelled.");
|
|
188
289
|
}
|
|
189
290
|
else {
|
|
190
|
-
// Re-throw other errors
|
|
191
291
|
throw error;
|
|
192
292
|
}
|
|
193
293
|
}
|
|
194
294
|
}
|
|
195
295
|
else {
|
|
196
|
-
logger.info("No previous conversations found to
|
|
296
|
+
logger.info("No previous conversations found to continue.");
|
|
197
297
|
}
|
|
198
298
|
}
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
299
|
+
else if (flags.resume === true) {
|
|
300
|
+
if (resumeSessionId) {
|
|
301
|
+
const histories = await SessionManager.load(messageHistoryDir, DEFAULT_HISTORY_LIMIT);
|
|
302
|
+
const targetHistory = histories.find((h) => h.sessionId === resumeSessionId);
|
|
303
|
+
if (targetHistory) {
|
|
304
|
+
messageHistory.restore(targetHistory);
|
|
305
|
+
logger.info(`Resuming conversation: ${targetHistory.title}`);
|
|
306
|
+
setTerminalTitle(targetHistory.title || `acai: ${process.cwd()}`);
|
|
307
|
+
}
|
|
308
|
+
else {
|
|
309
|
+
console.error(`Session not found: ${resumeSessionId}`);
|
|
310
|
+
process.exit(1);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
else {
|
|
314
|
+
const histories = await SessionManager.load(messageHistoryDir, CONTINUE_HISTORY_LIMIT);
|
|
315
|
+
const latestHistory = histories.at(0);
|
|
316
|
+
if (latestHistory) {
|
|
317
|
+
messageHistory.restore(latestHistory);
|
|
318
|
+
console.info(`Resuming conversation: ${latestHistory.title}`);
|
|
319
|
+
setTerminalTitle(latestHistory.title || `acai: ${process.cwd()}`);
|
|
320
|
+
}
|
|
321
|
+
else {
|
|
322
|
+
logger.info("No previous conversation found to resume.");
|
|
323
|
+
}
|
|
324
|
+
}
|
|
206
325
|
}
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
messageHistory,
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
tokenCounter,
|
|
216
|
-
|
|
326
|
+
}
|
|
327
|
+
async function runCliMode(state) {
|
|
328
|
+
const skillsEnabled = !flags["no-skills"] && (await config.getSkillsEnabled());
|
|
329
|
+
const cliProcess = new Cli({
|
|
330
|
+
promptManager: state.promptManager,
|
|
331
|
+
messageHistory: state.sessionManager,
|
|
332
|
+
modelManager: state.modelManager,
|
|
333
|
+
tokenTracker: state.tokenTracker,
|
|
334
|
+
tokenCounter: state.tokenCounter,
|
|
335
|
+
workspace,
|
|
336
|
+
skillsEnabled,
|
|
337
|
+
});
|
|
338
|
+
(await asyncTry(cliProcess.run())).recover(handleError);
|
|
339
|
+
}
|
|
340
|
+
async function runReplMode(state) {
|
|
341
|
+
// Initialize tools before creating REPL (needed for session reload reconstruction)
|
|
342
|
+
const tools = await initTools({
|
|
217
343
|
workspace,
|
|
218
344
|
});
|
|
219
|
-
await commands.initializeCommmands();
|
|
220
|
-
if (isDefined(initialPromptInput)) {
|
|
221
|
-
const cliProcess = new Cli({
|
|
222
|
-
promptManager,
|
|
223
|
-
config: appConfig,
|
|
224
|
-
messageHistory,
|
|
225
|
-
modelManager,
|
|
226
|
-
tokenTracker,
|
|
227
|
-
tokenCounter,
|
|
228
|
-
workspace,
|
|
229
|
-
});
|
|
230
|
-
return (await asyncTry(cliProcess.run())).recover(handleError);
|
|
231
|
-
}
|
|
232
345
|
const agent = new Agent({
|
|
233
|
-
|
|
234
|
-
modelManager,
|
|
235
|
-
tokenTracker,
|
|
346
|
+
sessionManager: state.sessionManager,
|
|
347
|
+
modelManager: state.modelManager,
|
|
348
|
+
tokenTracker: state.tokenTracker,
|
|
236
349
|
});
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
repl.
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
const
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
for await (const result of results) {
|
|
299
|
-
repl.handle(result, agent.state);
|
|
300
|
-
}
|
|
301
|
-
messageHistory.save();
|
|
302
|
-
}
|
|
303
|
-
catch (_error) {
|
|
304
|
-
// Display error in the TUI by adding an error message to the chat
|
|
305
|
-
// repl.showError((error as Error).message || "Unknown error occurred");
|
|
350
|
+
const repl = new NewRepl({
|
|
351
|
+
agent,
|
|
352
|
+
promptManager: state.promptManager,
|
|
353
|
+
config: state.appConfig,
|
|
354
|
+
messageHistory: state.sessionManager,
|
|
355
|
+
modelManager: state.modelManager,
|
|
356
|
+
tokenTracker: state.tokenTracker,
|
|
357
|
+
commands: state.commands,
|
|
358
|
+
tokenCounter: state.tokenCounter,
|
|
359
|
+
promptHistory: state.promptHistory,
|
|
360
|
+
workspace,
|
|
361
|
+
tools,
|
|
362
|
+
});
|
|
363
|
+
// Initialize TUI
|
|
364
|
+
await repl.init();
|
|
365
|
+
// Reconstruct session display if there are existing messages
|
|
366
|
+
if (!state.sessionManager.isEmpty()) {
|
|
367
|
+
await repl.rerender();
|
|
368
|
+
}
|
|
369
|
+
state.sessionManager.on("clear-history", () => {
|
|
370
|
+
logger.info("Resetting agent state.");
|
|
371
|
+
agent.resetState();
|
|
372
|
+
void repl.rerender();
|
|
373
|
+
});
|
|
374
|
+
// Set interrupt callback
|
|
375
|
+
repl.setInterruptCallback(async () => {
|
|
376
|
+
try {
|
|
377
|
+
await state.sessionManager.save();
|
|
378
|
+
}
|
|
379
|
+
catch (error) {
|
|
380
|
+
// Log but don't throw - we still want to abort the agent
|
|
381
|
+
logger.warn({ error }, "Failed to save message history on interrupt");
|
|
382
|
+
}
|
|
383
|
+
agent.abort();
|
|
384
|
+
});
|
|
385
|
+
// Set exit callback
|
|
386
|
+
repl.setExitCallback((sessionId) => {
|
|
387
|
+
if (!state.sessionManager.isEmpty()) {
|
|
388
|
+
console.info(`\nTo resume this session call acai --resume ${sessionId}`);
|
|
389
|
+
}
|
|
390
|
+
});
|
|
391
|
+
// Interactive loop
|
|
392
|
+
while (true) {
|
|
393
|
+
const userInput = await repl.getUserInput();
|
|
394
|
+
const projectConfig = await config.getConfig();
|
|
395
|
+
const activeTools = projectConfig.tools.activeTools;
|
|
396
|
+
const skillsEnabled = !flags["no-skills"] && (projectConfig.skills?.enabled ?? true);
|
|
397
|
+
try {
|
|
398
|
+
const results = agent.run({
|
|
399
|
+
systemPrompt: await systemPrompt({
|
|
400
|
+
activeTools,
|
|
401
|
+
allowedDirs: workspace.allowedDirs,
|
|
402
|
+
skillsEnabled,
|
|
403
|
+
}),
|
|
404
|
+
input: userInput,
|
|
405
|
+
tools,
|
|
406
|
+
activeTools,
|
|
407
|
+
abortSignal: agent.abortSignal,
|
|
408
|
+
});
|
|
409
|
+
for await (const result of results) {
|
|
410
|
+
await repl.handle(result, agent.state);
|
|
306
411
|
}
|
|
412
|
+
await state.sessionManager.save();
|
|
413
|
+
}
|
|
414
|
+
catch (_error) {
|
|
415
|
+
// Display error in the TUI by adding an error message to the chat
|
|
416
|
+
// repl.showError((error as Error).message || "Unknown error occurred");
|
|
307
417
|
}
|
|
308
418
|
}
|
|
309
|
-
const repl = new Repl({
|
|
310
|
-
promptManager,
|
|
311
|
-
terminal,
|
|
312
|
-
config: appConfig,
|
|
313
|
-
messageHistory,
|
|
314
|
-
modelManager,
|
|
315
|
-
tokenTracker,
|
|
316
|
-
commands,
|
|
317
|
-
tokenCounter,
|
|
318
|
-
promptHistory,
|
|
319
|
-
workspace,
|
|
320
|
-
showLastMessage: hasContinueOrResume
|
|
321
|
-
? !!(messageHistory.get() && messageHistory.get().length > 0)
|
|
322
|
-
: false,
|
|
323
|
-
});
|
|
324
|
-
return (await asyncTry(repl.run())).recover(handleError);
|
|
325
419
|
}
|
|
326
|
-
main()
|
|
420
|
+
async function main() {
|
|
421
|
+
try {
|
|
422
|
+
const appConfig = await config.ensureDefaultConfig("acai");
|
|
423
|
+
// Note: SIGINT/SIGTERM handlers are set up by CLI and REPL components
|
|
424
|
+
// as needed. We don't set a global handler here to avoid conflicts.
|
|
425
|
+
// Handle early exits
|
|
426
|
+
if (await handleEarlyExits())
|
|
427
|
+
return;
|
|
428
|
+
// Validate CLI arguments
|
|
429
|
+
validateCliArguments();
|
|
430
|
+
// Determine initial prompt
|
|
431
|
+
const { initialPromptInput, stdInPrompt, hasContinueOrResume, resumeSessionId, } = await determineInitialPrompt();
|
|
432
|
+
// Initialize application state
|
|
433
|
+
const state = await initializeAppState(appConfig, initialPromptInput, stdInPrompt, hasContinueOrResume, resumeSessionId);
|
|
434
|
+
// Set terminal title after all validation is complete
|
|
435
|
+
setTerminalTitle(`acai: ${workspace.primaryDir}`);
|
|
436
|
+
// Handle CLI mode if initial prompt provided
|
|
437
|
+
if (isDefined(initialPromptInput)) {
|
|
438
|
+
return await runCliMode(state);
|
|
439
|
+
}
|
|
440
|
+
// Setup REPL mode
|
|
441
|
+
return await runReplMode(state);
|
|
442
|
+
}
|
|
443
|
+
catch (error) {
|
|
444
|
+
handleError(error);
|
|
445
|
+
process.exit(1);
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
void main();
|
package/dist/logger.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../source/logger.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../source/logger.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,MAAM,MAAM,CAAC;AAgDxB,eAAO,MAAM,MAAM,6BAIjB,CAAC"}
|
package/dist/logger.js
CHANGED
|
@@ -4,18 +4,11 @@ import { config } from "./config.js";
|
|
|
4
4
|
// Create a lazy logger factory that only initializes when first used
|
|
5
5
|
let loggerInstance = null;
|
|
6
6
|
function createLogger() {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
// 1. Environment variable (primary method)
|
|
10
|
-
// 2. Check if we're running with Node.js permissions (fallback)
|
|
11
|
-
const isCodeInterpreter = process.env["ACAI_CODE_INTERPRETER"] === "true" ||
|
|
12
|
-
(typeof process.permission !== "undefined" &&
|
|
13
|
-
process.permission.has !== undefined);
|
|
14
|
-
if (isCodeInterpreter) {
|
|
15
|
-
// In code interpreter context, use a no-op logger to avoid noise in script output
|
|
7
|
+
const isTest = process.env["NODE_ENV"] === "test";
|
|
8
|
+
if (isTest) {
|
|
16
9
|
return pino({
|
|
17
|
-
level: "silent",
|
|
18
|
-
enabled: false,
|
|
10
|
+
level: "silent",
|
|
11
|
+
enabled: false,
|
|
19
12
|
});
|
|
20
13
|
}
|
|
21
14
|
// Normal file-based logging
|
package/dist/mentions.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mentions.d.ts","sourceRoot":"","sources":["../source/mentions.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"mentions.d.ts","sourceRoot":"","sources":["../source/mentions.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAqBxD,qBAAa,WAAY,SAAQ,KAAK;gBACxB,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK;CAI3C;AAwID,wBAAsB,aAAa,CACjC,OAAO,EAAE,MAAM,EACf,EACE,OAAO,EACP,KAAK,EACL,UAAU,GACX,EAAE;IACD,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,aAAa,CAAC;IACrB,UAAU,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC,GACA,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,WAAW,EAAE,CAAA;CAAE,CAAC,CAkFtD"}
|