@travisennis/acai 0.0.7 → 0.0.9
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 +76 -27
- package/dist/agent/index.d.ts +21 -25
- package/dist/agent/index.d.ts.map +1 -1
- package/dist/agent/index.js +145 -103
- package/dist/cli.d.ts +2 -2
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +23 -17
- 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-command.js → add-directory/index.js} +6 -10
- 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/types.js +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} +0 -2
- package/dist/commands/copy/index.d.ts +3 -0
- package/dist/commands/copy/index.d.ts.map +1 -0
- package/dist/commands/{copy-command.js → copy/index.js} +4 -26
- 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-command.d.ts → exit/index.d.ts} +4 -4
- 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} +57 -96
- 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-command.js → handoff/utils.js} +24 -92
- 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-command.d.ts → help/index.d.ts} +2 -2
- package/dist/commands/help/index.d.ts.map +1 -0
- package/dist/commands/{help-command.js → help/index.js} +1 -1
- 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} +16 -100
- 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} +16 -7
- 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} +1 -1
- 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-command.js → list-tools/index.js} +4 -16
- package/dist/commands/manager.d.ts +2 -2
- package/dist/commands/manager.d.ts.map +1 -1
- package/dist/commands/manager.js +35 -43
- package/dist/commands/model/index.d.ts +3 -0
- package/dist/commands/model/index.d.ts.map +1 -0
- package/dist/commands/{model-command.js → model/index.js} +15 -52
- 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-command.d.ts → paste/index.d.ts} +2 -2
- package/dist/commands/paste/index.d.ts.map +1 -0
- package/dist/commands/{paste-command.js → paste/index.js} +6 -111
- 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 +122 -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} +2 -2
- 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} +7 -2
- 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 -3
- 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 +230 -0
- package/dist/commands/session/types.d.ts +20 -0
- package/dist/commands/session/types.d.ts.map +1 -0
- package/dist/commands/session/types.js +7 -0
- package/dist/commands/share/html-renderer.d.ts +25 -0
- package/dist/commands/share/html-renderer.d.ts.map +1 -0
- package/dist/commands/share/html-renderer.js +384 -0
- package/dist/commands/share/index.d.ts +3 -0
- package/dist/commands/share/index.d.ts.map +1 -0
- package/dist/commands/share/index.js +122 -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} +3 -3
- package/dist/commands/types.d.ts +2 -2
- package/dist/commands/types.d.ts.map +1 -1
- package/dist/config.d.ts +25 -7
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +45 -20
- package/dist/dedent.d.ts.map +1 -1
- package/dist/dedent.js +7 -7
- package/dist/execution/index.d.ts +1 -0
- package/dist/execution/index.d.ts.map +1 -1
- package/dist/execution/index.js +60 -64
- package/dist/formatting.d.ts +27 -0
- package/dist/formatting.d.ts.map +1 -1
- package/dist/formatting.js +40 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +194 -95
- 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/deepseek-provider.d.ts +9 -8
- package/dist/models/deepseek-provider.d.ts.map +1 -1
- package/dist/models/google-provider.d.ts +10 -9
- package/dist/models/google-provider.d.ts.map +1 -1
- package/dist/models/groq-provider.d.ts +8 -7
- package/dist/models/groq-provider.d.ts.map +1 -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 +14 -10
- package/dist/models/openai-provider.d.ts.map +1 -1
- package/dist/models/openai-provider.js +39 -0
- package/dist/models/opencode-zen-provider.d.ts +24 -0
- package/dist/models/opencode-zen-provider.d.ts.map +1 -0
- package/dist/models/opencode-zen-provider.js +94 -0
- package/dist/models/openrouter-provider.d.ts +35 -29
- package/dist/models/openrouter-provider.d.ts.map +1 -1
- package/dist/models/openrouter-provider.js +108 -80
- package/dist/models/providers.d.ts +4 -4
- package/dist/models/providers.d.ts.map +1 -1
- package/dist/models/providers.js +7 -1
- package/dist/models/xai-provider.d.ts +9 -8
- package/dist/models/xai-provider.d.ts.map +1 -1
- 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 +12 -2
- package/dist/prompts.d.ts.map +1 -1
- package/dist/prompts.js +74 -411
- 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 +18 -4
- package/dist/repl-new.d.ts.map +1 -1
- package/dist/repl-new.js +256 -43
- package/dist/{messages.d.ts → sessions/manager.d.ts} +10 -4
- package/dist/sessions/manager.d.ts.map +1 -0
- package/dist/{messages.js → sessions/manager.js} +62 -14
- package/dist/skills.d.ts +0 -4
- package/dist/skills.d.ts.map +1 -1
- package/dist/skills.js +100 -59
- package/dist/stdin.d.ts +9 -0
- package/dist/stdin.d.ts.map +1 -0
- package/dist/stdin.js +26 -0
- package/dist/terminal/control.d.ts +1 -0
- package/dist/terminal/control.d.ts.map +1 -1
- package/dist/terminal/control.js +29 -6
- package/dist/terminal/formatting.d.ts +1 -2
- package/dist/terminal/formatting.d.ts.map +1 -1
- package/dist/terminal/formatting.js +1 -2
- 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/tokens/tracker.d.ts.map +1 -1
- package/dist/tokens/tracker.js +58 -16
- package/dist/tools/bash.d.ts +9 -11
- package/dist/tools/bash.d.ts.map +1 -1
- package/dist/tools/bash.js +104 -123
- package/dist/tools/directory-tree.d.ts +9 -7
- package/dist/tools/directory-tree.d.ts.map +1 -1
- package/dist/tools/directory-tree.js +89 -70
- package/dist/tools/dynamic-tool-loader.d.ts +22 -4
- package/dist/tools/dynamic-tool-loader.d.ts.map +1 -1
- package/dist/tools/dynamic-tool-loader.js +39 -44
- 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 +19 -76
- package/dist/tools/glob.d.ts +15 -16
- package/dist/tools/glob.d.ts.map +1 -1
- package/dist/tools/glob.js +77 -119
- package/dist/tools/grep.d.ts +19 -22
- package/dist/tools/grep.d.ts.map +1 -1
- package/dist/tools/grep.js +61 -108
- package/dist/tools/index.d.ts +200 -179
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +17 -315
- 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 +49 -82
- package/dist/tools/save-file.d.ts +4 -4
- package/dist/tools/save-file.d.ts.map +1 -1
- package/dist/tools/save-file.js +37 -66
- package/dist/tools/think.d.ts +4 -4
- package/dist/tools/think.d.ts.map +1 -1
- package/dist/tools/think.js +9 -38
- package/dist/tools/types.d.ts +5 -25
- 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/box.d.ts.map +1 -1
- package/dist/tui/components/box.js +16 -10
- package/dist/tui/components/editor.d.ts +6 -2
- package/dist/tui/components/editor.d.ts.map +1 -1
- package/dist/tui/components/editor.js +166 -107
- package/dist/tui/components/footer.d.ts +20 -7
- package/dist/tui/components/footer.d.ts.map +1 -1
- package/dist/tui/components/footer.js +89 -196
- 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 +2 -1
- package/dist/tui/components/loader.d.ts.map +1 -1
- package/dist/tui/components/loader.js +7 -2
- package/dist/tui/components/markdown.d.ts +5 -4
- package/dist/tui/components/markdown.d.ts.map +1 -1
- package/dist/tui/components/markdown.js +51 -40
- package/dist/tui/components/modal.d.ts.map +1 -1
- package/dist/tui/components/modal.js +9 -8
- 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 +64 -0
- package/dist/tui/components/progress-bar.d.ts.map +1 -1
- package/dist/tui/components/progress-bar.js +3 -15
- package/dist/tui/components/select-list.d.ts +0 -15
- package/dist/tui/components/select-list.d.ts.map +1 -1
- package/dist/tui/components/select-list.js +5 -28
- package/dist/tui/components/tool-execution.d.ts +3 -6
- package/dist/tui/components/tool-execution.d.ts.map +1 -1
- package/dist/tui/components/tool-execution.js +26 -38
- 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/editor-launcher.d.ts +13 -0
- package/dist/tui/editor-launcher.d.ts.map +1 -0
- package/dist/tui/editor-launcher.js +39 -0
- package/dist/tui/index.d.ts +7 -3
- package/dist/tui/index.d.ts.map +1 -1
- package/dist/tui/index.js +3 -2
- package/dist/tui/terminal.d.ts +29 -2
- package/dist/tui/terminal.d.ts.map +1 -1
- package/dist/tui/terminal.js +153 -28
- package/dist/tui/tui.d.ts +2 -0
- package/dist/tui/tui.d.ts.map +1 -1
- package/dist/tui/tui.js +39 -29
- package/dist/tui/utils.d.ts.map +1 -1
- package/dist/tui/utils.js +2 -3
- package/dist/utils/filesystem/security.d.ts.map +1 -1
- package/dist/utils/filesystem/security.js +4 -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.d.ts +1 -0
- package/dist/utils/zod.d.ts.map +1 -1
- package/dist/utils/zod.js +17 -0
- package/package.json +31 -29
- package/bin/acai-wrapper.js +0 -26
- 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/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 -43
- 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 -55
- 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 -124
- package/dist/commands/copy-command.d.ts +0 -3
- package/dist/commands/copy-command.d.ts.map +0 -1
- 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 -42
- 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 -36
- package/dist/commands/exit-command.d.ts.map +0 -1
- package/dist/commands/exit-command.js +0 -30
- 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 -68
- 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/health-command.d.ts +0 -4
- package/dist/commands/health-command.d.ts.map +0 -1
- package/dist/commands/health-command.js +0 -118
- 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 -71
- 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/model-command.d.ts +0 -3
- package/dist/commands/model-command.d.ts.map +0 -1
- package/dist/commands/paste-command.d.ts.map +0 -1
- 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 -109
- package/dist/commands/prompt-command.d.ts +0 -21
- package/dist/commands/prompt-command.d.ts.map +0 -1
- package/dist/commands/prompt-command.js +0 -258
- 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 -73
- 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 -31
- package/dist/messages.d.ts.map +0 -1
- package/dist/repl/project-status-line.d.ts +0 -3
- package/dist/repl/project-status-line.d.ts.map +0 -1
- package/dist/repl/project-status-line.js +0 -61
- 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/terminal/markdown.d.ts +0 -2
- package/dist/terminal/markdown.d.ts.map +0 -1
- package/dist/terminal/markdown.js +0 -120
- package/dist/tokens/threshold.d.ts +0 -20
- package/dist/tokens/threshold.d.ts.map +0 -1
- package/dist/tokens/threshold.js +0 -67
- 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 -285
- package/dist/tools/agent.d.ts +0 -29
- package/dist/tools/agent.d.ts.map +0 -1
- package/dist/tools/agent.js +0 -117
- package/dist/tools/batch.d.ts +0 -34
- package/dist/tools/batch.d.ts.map +0 -1
- package/dist/tools/batch.js +0 -174
- 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 -183
- 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 -77
- 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/llm-edit-fixer.d.ts +0 -24
- package/dist/tools/llm-edit-fixer.d.ts.map +0 -1
- package/dist/tools/llm-edit-fixer.js +0 -136
- 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 -65
- 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 -196
- 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 -148
- package/dist/tui/components/prompt-status.d.ts +0 -17
- package/dist/tui/components/prompt-status.d.ts.map +0 -1
- package/dist/tui/components/prompt-status.js +0 -26
package/dist/formatting.js
CHANGED
|
@@ -243,3 +243,43 @@ export const formatNumber = (num) => {
|
|
|
243
243
|
// For values 100+, round to nearest whole number
|
|
244
244
|
return `${Math.round(scaled)}${unit}`;
|
|
245
245
|
};
|
|
246
|
+
/**
|
|
247
|
+
* Formats a date into a human-readable string.
|
|
248
|
+
*
|
|
249
|
+
* @param date - The date to format
|
|
250
|
+
* @returns A formatted date string in the format "MMM DD, YYYY HH:MM:SS AM/PM"
|
|
251
|
+
*
|
|
252
|
+
* @example
|
|
253
|
+
* ```typescript
|
|
254
|
+
* formatDate(new Date("2023-12-25T14:30:00")) // Returns: "Dec 25, 2023, 02:30:00 PM"
|
|
255
|
+
* ```
|
|
256
|
+
*/
|
|
257
|
+
export const formatDate = (date) => {
|
|
258
|
+
return date.toLocaleString("en-US", {
|
|
259
|
+
month: "short",
|
|
260
|
+
day: "numeric",
|
|
261
|
+
year: "numeric",
|
|
262
|
+
hour: "2-digit",
|
|
263
|
+
minute: "2-digit",
|
|
264
|
+
second: "2-digit",
|
|
265
|
+
});
|
|
266
|
+
};
|
|
267
|
+
/**
|
|
268
|
+
* Formats a number as a percentage with one decimal place.
|
|
269
|
+
*
|
|
270
|
+
* @param n - The numerator
|
|
271
|
+
* @param d - The denominator
|
|
272
|
+
* @returns A formatted percentage string (e.g., "12.5%")
|
|
273
|
+
*
|
|
274
|
+
* @example
|
|
275
|
+
* ```typescript
|
|
276
|
+
* formatPercentage(25, 100) // Returns: "25.0%"
|
|
277
|
+
* formatPercentage(1, 3) // Returns: "33.3%"
|
|
278
|
+
* formatPercentage(0, 0) // Returns: "0.0%"
|
|
279
|
+
* ```
|
|
280
|
+
*/
|
|
281
|
+
export const formatPercentage = (n, d) => {
|
|
282
|
+
if (d <= 0)
|
|
283
|
+
return "0.0%";
|
|
284
|
+
return `${((n / d) * 100).toFixed(1)}%`;
|
|
285
|
+
};
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":";AAgCA,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAGD,wBAAgB,sBAAsB,CACpC,UAAU,GAAE,MAAM,EAAO,GACxB,gBAAgB,CAmBlB;AAmDD,QAAA,MAAM,KAAK;;;;;;;;;CAAyB,CAAC;AAMrC;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAE9C;AAED,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,34 +1,36 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { mkdirSync } from "node:fs";
|
|
2
3
|
import os from "node:os";
|
|
3
4
|
import path from "node:path";
|
|
4
|
-
import { text } from "node:stream/consumers";
|
|
5
5
|
import { parseArgs } from "node:util";
|
|
6
|
-
import { asyncTry } from "@travisennis/stdlib/try";
|
|
6
|
+
import { asyncTry, isFailure, syncTry } from "@travisennis/stdlib/try";
|
|
7
7
|
import { isDefined } from "@travisennis/stdlib/typeguards";
|
|
8
8
|
import { Agent } from "./agent/index.js";
|
|
9
9
|
import { Cli } from "./cli.js";
|
|
10
10
|
import { CommandManager } from "./commands/manager.js";
|
|
11
11
|
import { config, } from "./config.js";
|
|
12
12
|
import { logger } from "./logger.js";
|
|
13
|
-
import {
|
|
13
|
+
import { PromptError, processPrompt } from "./mentions.js";
|
|
14
14
|
import { ModelManager } from "./models/manager.js";
|
|
15
15
|
import { isSupportedModel } from "./models/providers.js";
|
|
16
16
|
import { PromptManager } from "./prompts/manager.js";
|
|
17
17
|
import { systemPrompt } from "./prompts.js";
|
|
18
18
|
import { NewRepl } from "./repl-new.js";
|
|
19
|
-
import {
|
|
19
|
+
import { SessionManager } from "./sessions/manager.js";
|
|
20
|
+
import { readStdinWithLimits } from "./stdin.js";
|
|
21
|
+
import { setTerminalTitle } from "./terminal/control.js";
|
|
20
22
|
import { select } from "./terminal/select-prompt.js";
|
|
21
23
|
import { TokenCounter } from "./tokens/counter.js";
|
|
22
24
|
import { TokenTracker } from "./tokens/tracker.js";
|
|
23
|
-
import {
|
|
25
|
+
import { initTools } from "./tools/index.js";
|
|
24
26
|
import { getPackageVersion } from "./version.js";
|
|
25
27
|
// Create workspace context from CLI arguments
|
|
26
28
|
export function createWorkspaceContext(addDirArgs = []) {
|
|
27
29
|
const primaryDir = process.cwd();
|
|
30
|
+
mkdirSync("/tmp/acai", { recursive: true });
|
|
28
31
|
const allowedDirs = [
|
|
29
32
|
primaryDir,
|
|
30
|
-
"/tmp",
|
|
31
|
-
config.getAccessibleLogDir(),
|
|
33
|
+
"/tmp/acai",
|
|
32
34
|
path.join(os.homedir(), ".acai"),
|
|
33
35
|
...addDirArgs,
|
|
34
36
|
];
|
|
@@ -46,20 +48,24 @@ Usage
|
|
|
46
48
|
Options
|
|
47
49
|
--model, -m Sets the model to use
|
|
48
50
|
--prompt, -p Sets the prompt (runs in CLI mode)
|
|
49
|
-
--continue
|
|
50
|
-
--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
|
|
51
53
|
--add-dir Add additional working directory (can be used multiple times)
|
|
52
54
|
--no-skills Disable skills discovery and loading
|
|
53
55
|
|
|
56
|
+
|
|
54
57
|
--help, -h Show help
|
|
55
58
|
--version, -v Show version
|
|
56
59
|
|
|
57
60
|
Examples
|
|
58
|
-
$ acai --model
|
|
61
|
+
$ acai --model anthropic:sonnet
|
|
59
62
|
$ acai -p "initial prompt"
|
|
60
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
|
|
61
67
|
`;
|
|
62
|
-
const parsed = parseArgs({
|
|
68
|
+
const parsed = syncTry(() => parseArgs({
|
|
63
69
|
options: {
|
|
64
70
|
model: { type: "string", short: "m" },
|
|
65
71
|
prompt: { type: "string", short: "p" },
|
|
@@ -71,9 +77,14 @@ const parsed = parseArgs({
|
|
|
71
77
|
version: { type: "boolean", short: "v" },
|
|
72
78
|
},
|
|
73
79
|
allowPositionals: true,
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
|
|
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;
|
|
77
88
|
// Create workspace context from CLI arguments
|
|
78
89
|
const workspace = createWorkspaceContext(flags["add-dir"]);
|
|
79
90
|
/**
|
|
@@ -88,7 +99,7 @@ export function handleError(error) {
|
|
|
88
99
|
const DEFAULT_HISTORY_LIMIT = 10;
|
|
89
100
|
const CONTINUE_HISTORY_LIMIT = 1;
|
|
90
101
|
// Helper functions for main()
|
|
91
|
-
async function initializeAppState(appConfig, initialPromptInput,
|
|
102
|
+
async function initializeAppState(appConfig, initialPromptInput, stdinContent, hasContinueOrResume, resumeSessionId) {
|
|
92
103
|
const appDir = config.app;
|
|
93
104
|
// Parallelize independent async operations
|
|
94
105
|
const [messageHistoryDir, modelManager] = await Promise.all([
|
|
@@ -99,22 +110,46 @@ async function initializeAppState(appConfig, initialPromptInput, stdInPrompt, ha
|
|
|
99
110
|
const tokenTracker = new TokenTracker();
|
|
100
111
|
const tokenCounter = new TokenCounter();
|
|
101
112
|
// Initialize dependent components
|
|
102
|
-
const
|
|
113
|
+
const sessionManager = await initializeSessionManager(messageHistoryDir, modelManager, tokenTracker);
|
|
103
114
|
// Handle conversation history loading
|
|
104
|
-
await handleConversationHistory(
|
|
115
|
+
await handleConversationHistory(sessionManager, messageHistoryDir, hasContinueOrResume, resumeSessionId);
|
|
105
116
|
// Setup prompt manager
|
|
106
117
|
const promptManager = new PromptManager(tokenCounter);
|
|
107
118
|
if (!hasContinueOrResume && isDefined(initialPromptInput)) {
|
|
108
|
-
|
|
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
|
+
}
|
|
109
139
|
}
|
|
110
|
-
if (
|
|
111
|
-
|
|
140
|
+
if (stdinContent && stdinContent.trim().length > 0) {
|
|
141
|
+
if (isDefined(initialPromptInput)) {
|
|
142
|
+
promptManager.addContext(stdinContent);
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
promptManager.set(stdinContent);
|
|
146
|
+
}
|
|
112
147
|
}
|
|
113
148
|
const promptHistory = [];
|
|
114
149
|
const commands = new CommandManager({
|
|
115
150
|
promptManager,
|
|
116
151
|
modelManager,
|
|
117
|
-
|
|
152
|
+
sessionManager,
|
|
118
153
|
tokenTracker,
|
|
119
154
|
config,
|
|
120
155
|
tokenCounter,
|
|
@@ -127,7 +162,7 @@ async function initializeAppState(appConfig, initialPromptInput, stdInPrompt, ha
|
|
|
127
162
|
modelManager,
|
|
128
163
|
tokenTracker,
|
|
129
164
|
tokenCounter,
|
|
130
|
-
|
|
165
|
+
sessionManager,
|
|
131
166
|
promptManager,
|
|
132
167
|
promptHistory,
|
|
133
168
|
commands,
|
|
@@ -144,40 +179,56 @@ async function handleEarlyExits() {
|
|
|
144
179
|
}
|
|
145
180
|
return false;
|
|
146
181
|
}
|
|
182
|
+
function validateSessionId(id) {
|
|
183
|
+
const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
184
|
+
return id.length === 36 && uuidRegex.test(id);
|
|
185
|
+
}
|
|
147
186
|
function validateCliArguments() {
|
|
148
187
|
if (flags.continue === true && flags.resume === true) {
|
|
149
188
|
console.error("Cannot use --continue and --resume flags together.");
|
|
150
189
|
process.exit(1);
|
|
151
190
|
}
|
|
191
|
+
if (flags.resume === true && input.length > 0) {
|
|
192
|
+
const sessionId = input[0];
|
|
193
|
+
if (!validateSessionId(sessionId)) {
|
|
194
|
+
console.error(`Invalid session ID: ${sessionId}`);
|
|
195
|
+
console.error("Session ID must be a valid UUID (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)");
|
|
196
|
+
process.exit(1);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
152
199
|
}
|
|
153
200
|
async function determineInitialPrompt() {
|
|
154
201
|
const hasContinueOrResume = flags.continue === true || flags.resume === true;
|
|
155
202
|
const positionalPrompt = input.at(0);
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
console.error(`Error reading stdin: ${error.message}`);
|
|
164
|
-
}
|
|
203
|
+
const { content: stdinContent, wasPiped } = await readStdinWithLimits();
|
|
204
|
+
if (wasPiped &&
|
|
205
|
+
(!stdinContent || stdinContent.trim().length === 0) &&
|
|
206
|
+
!flags.prompt &&
|
|
207
|
+
!positionalPrompt) {
|
|
208
|
+
console.error("No input provided via stdin.");
|
|
209
|
+
process.exit(0);
|
|
165
210
|
}
|
|
211
|
+
const resumeSessionId = flags.resume === true && input.length > 0 ? input[0] : undefined;
|
|
166
212
|
const initialPromptInput = typeof flags.prompt === "string" && flags.prompt.length > 0
|
|
167
213
|
? flags.prompt
|
|
168
|
-
: positionalPrompt && positionalPrompt.length > 0
|
|
214
|
+
: positionalPrompt && positionalPrompt.length > 0 && !resumeSessionId
|
|
169
215
|
? positionalPrompt
|
|
170
216
|
: undefined;
|
|
171
217
|
if (hasContinueOrResume && isDefined(initialPromptInput)) {
|
|
172
218
|
console.error("Cannot use --continue or --resume with an initial prompt.");
|
|
173
219
|
process.exit(1);
|
|
174
220
|
}
|
|
175
|
-
return {
|
|
221
|
+
return {
|
|
222
|
+
initialPromptInput,
|
|
223
|
+
stdinContent,
|
|
224
|
+
hasContinueOrResume,
|
|
225
|
+
resumeSessionId,
|
|
226
|
+
};
|
|
176
227
|
}
|
|
177
228
|
async function initializeModelManager(appDir) {
|
|
178
229
|
const chosenModel = isSupportedModel(flags.model)
|
|
179
230
|
? flags.model
|
|
180
|
-
: "
|
|
231
|
+
: "opencode:minimax-m2-1";
|
|
181
232
|
const modelManager = new ModelManager({
|
|
182
233
|
stateDir: await appDir.ensurePath("audit"),
|
|
183
234
|
});
|
|
@@ -193,36 +244,31 @@ async function initializeModelManager(appDir) {
|
|
|
193
244
|
modelManager.setModel("edit-fix", chosenModel);
|
|
194
245
|
return modelManager;
|
|
195
246
|
}
|
|
196
|
-
async function
|
|
197
|
-
const messageHistory = new
|
|
247
|
+
async function initializeSessionManager(messageHistoryDir, modelManager, tokenTracker) {
|
|
248
|
+
const messageHistory = new SessionManager({
|
|
198
249
|
stateDir: messageHistoryDir,
|
|
199
250
|
modelManager,
|
|
200
251
|
tokenTracker,
|
|
201
252
|
});
|
|
202
253
|
messageHistory.on("update-title", (title) => setTerminalTitle(title));
|
|
254
|
+
// Listen for model changes and update session manager when repl model changes
|
|
255
|
+
modelManager.on("set-model", (app, _model) => {
|
|
256
|
+
if (app === "repl") {
|
|
257
|
+
const modelId = modelManager.getModel("repl").modelId;
|
|
258
|
+
messageHistory.setModelId(modelId);
|
|
259
|
+
}
|
|
260
|
+
});
|
|
203
261
|
return messageHistory;
|
|
204
262
|
}
|
|
205
|
-
async function handleConversationHistory(messageHistory, messageHistoryDir, _hasContinueOrResume) {
|
|
263
|
+
async function handleConversationHistory(messageHistory, messageHistoryDir, _hasContinueOrResume, resumeSessionId) {
|
|
206
264
|
if (flags.continue === true) {
|
|
207
|
-
const histories = await
|
|
208
|
-
const latestHistory = histories.at(0);
|
|
209
|
-
if (latestHistory) {
|
|
210
|
-
messageHistory.restore(latestHistory);
|
|
211
|
-
console.info(`Resuming conversation: ${latestHistory.title}`);
|
|
212
|
-
setTerminalTitle(latestHistory.title || `acai: ${process.cwd()}`);
|
|
213
|
-
}
|
|
214
|
-
else {
|
|
215
|
-
logger.info("No previous conversation found to continue.");
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
else if (flags.resume === true) {
|
|
219
|
-
const histories = await MessageHistory.load(messageHistoryDir, DEFAULT_HISTORY_LIMIT);
|
|
265
|
+
const histories = await SessionManager.load(messageHistoryDir, DEFAULT_HISTORY_LIMIT);
|
|
220
266
|
if (histories.length > 0) {
|
|
221
267
|
try {
|
|
222
268
|
const choice = await select({
|
|
223
269
|
message: "Select a conversation to resume:",
|
|
224
270
|
choices: histories.map((h, index) => ({
|
|
225
|
-
name: `${index + 1}: ${h.title} (${h.updatedAt.toLocaleString()})`,
|
|
271
|
+
name: `${index + 1}: ${h.title} [${h.sessionId}] (${h.updatedAt.toLocaleString()})`,
|
|
226
272
|
value: index,
|
|
227
273
|
description: `${h.messages.length} messages`,
|
|
228
274
|
})),
|
|
@@ -249,7 +295,34 @@ async function handleConversationHistory(messageHistory, messageHistoryDir, _has
|
|
|
249
295
|
}
|
|
250
296
|
}
|
|
251
297
|
else {
|
|
252
|
-
logger.info("No previous conversations found to
|
|
298
|
+
logger.info("No previous conversations found to continue.");
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
else if (flags.resume === true) {
|
|
302
|
+
if (resumeSessionId) {
|
|
303
|
+
const histories = await SessionManager.load(messageHistoryDir, DEFAULT_HISTORY_LIMIT);
|
|
304
|
+
const targetHistory = histories.find((h) => h.sessionId === resumeSessionId);
|
|
305
|
+
if (targetHistory) {
|
|
306
|
+
messageHistory.restore(targetHistory);
|
|
307
|
+
logger.info(`Resuming conversation: ${targetHistory.title}`);
|
|
308
|
+
setTerminalTitle(targetHistory.title || `acai: ${process.cwd()}`);
|
|
309
|
+
}
|
|
310
|
+
else {
|
|
311
|
+
console.error(`Session not found: ${resumeSessionId}`);
|
|
312
|
+
process.exit(1);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
else {
|
|
316
|
+
const histories = await SessionManager.load(messageHistoryDir, CONTINUE_HISTORY_LIMIT);
|
|
317
|
+
const latestHistory = histories.at(0);
|
|
318
|
+
if (latestHistory) {
|
|
319
|
+
messageHistory.restore(latestHistory);
|
|
320
|
+
console.info(`Resuming conversation: ${latestHistory.title}`);
|
|
321
|
+
setTerminalTitle(latestHistory.title || `acai: ${process.cwd()}`);
|
|
322
|
+
}
|
|
323
|
+
else {
|
|
324
|
+
logger.info("No previous conversation found to resume.");
|
|
325
|
+
}
|
|
253
326
|
}
|
|
254
327
|
}
|
|
255
328
|
}
|
|
@@ -257,7 +330,7 @@ async function runCliMode(state) {
|
|
|
257
330
|
const skillsEnabled = !flags["no-skills"] && (await config.getSkillsEnabled());
|
|
258
331
|
const cliProcess = new Cli({
|
|
259
332
|
promptManager: state.promptManager,
|
|
260
|
-
messageHistory: state.
|
|
333
|
+
messageHistory: state.sessionManager,
|
|
261
334
|
modelManager: state.modelManager,
|
|
262
335
|
tokenTracker: state.tokenTracker,
|
|
263
336
|
tokenCounter: state.tokenCounter,
|
|
@@ -266,35 +339,45 @@ async function runCliMode(state) {
|
|
|
266
339
|
});
|
|
267
340
|
(await asyncTry(cliProcess.run())).recover(handleError);
|
|
268
341
|
}
|
|
269
|
-
async function runReplMode(state) {
|
|
342
|
+
async function runReplMode(state, stdinWasPiped) {
|
|
343
|
+
// Initialize tools before creating REPL (needed for session reload reconstruction)
|
|
344
|
+
const tools = await initTools({
|
|
345
|
+
workspace,
|
|
346
|
+
});
|
|
270
347
|
const agent = new Agent({
|
|
271
|
-
|
|
348
|
+
sessionManager: state.sessionManager,
|
|
272
349
|
modelManager: state.modelManager,
|
|
273
350
|
tokenTracker: state.tokenTracker,
|
|
274
351
|
});
|
|
352
|
+
// When stdin was piped, use /dev/tty for interactive input instead of process.stdin
|
|
275
353
|
const repl = new NewRepl({
|
|
276
354
|
agent,
|
|
277
355
|
promptManager: state.promptManager,
|
|
278
356
|
config: state.appConfig,
|
|
279
|
-
messageHistory: state.
|
|
357
|
+
messageHistory: state.sessionManager,
|
|
280
358
|
modelManager: state.modelManager,
|
|
281
359
|
tokenTracker: state.tokenTracker,
|
|
282
360
|
commands: state.commands,
|
|
283
361
|
tokenCounter: state.tokenCounter,
|
|
284
362
|
promptHistory: state.promptHistory,
|
|
285
363
|
workspace,
|
|
364
|
+
tools,
|
|
365
|
+
terminalOptions: { useTty: stdinWasPiped },
|
|
286
366
|
});
|
|
287
|
-
// Initialize TUI
|
|
288
367
|
await repl.init();
|
|
289
|
-
|
|
368
|
+
// Reconstruct session display if there are existing messages
|
|
369
|
+
if (!state.sessionManager.isEmpty()) {
|
|
370
|
+
await repl.rerender();
|
|
371
|
+
}
|
|
372
|
+
state.sessionManager.on("clear-history", () => {
|
|
290
373
|
logger.info("Resetting agent state.");
|
|
291
374
|
agent.resetState();
|
|
292
|
-
repl.rerender();
|
|
375
|
+
void repl.rerender();
|
|
293
376
|
});
|
|
294
377
|
// Set interrupt callback
|
|
295
|
-
repl.setInterruptCallback(() => {
|
|
378
|
+
repl.setInterruptCallback(async () => {
|
|
296
379
|
try {
|
|
297
|
-
state.
|
|
380
|
+
await state.sessionManager.save();
|
|
298
381
|
}
|
|
299
382
|
catch (error) {
|
|
300
383
|
// Log but don't throw - we still want to abort the agent
|
|
@@ -302,27 +385,44 @@ async function runReplMode(state) {
|
|
|
302
385
|
}
|
|
303
386
|
agent.abort();
|
|
304
387
|
});
|
|
305
|
-
//
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
tokenTracker: state.tokenTracker,
|
|
311
|
-
});
|
|
312
|
-
const agentTools = await initAgents({
|
|
313
|
-
modelManager: state.modelManager,
|
|
314
|
-
tokenTracker: state.tokenTracker,
|
|
315
|
-
tokenCounter: state.tokenCounter,
|
|
316
|
-
workspace,
|
|
388
|
+
// Set exit callback
|
|
389
|
+
repl.setExitCallback((sessionId) => {
|
|
390
|
+
if (!state.sessionManager.isEmpty()) {
|
|
391
|
+
console.info(`\nTo resume this session call acai --resume ${sessionId}`);
|
|
392
|
+
}
|
|
317
393
|
});
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
394
|
+
// Auto-process pending prompt from stdin
|
|
395
|
+
if (state.promptManager.isPending()) {
|
|
396
|
+
const projectConfig = await config.getConfig();
|
|
397
|
+
const activeTools = projectConfig.tools.activeTools;
|
|
398
|
+
const skillsEnabled = !flags["no-skills"] && (projectConfig.skills?.enabled ?? true);
|
|
399
|
+
try {
|
|
400
|
+
// Get the prompt text before it gets cleared by getUserMessage()
|
|
401
|
+
const promptText = state.promptManager.get();
|
|
402
|
+
// Get the user message (includes context if any) and add to history
|
|
403
|
+
const userMessage = state.promptManager.getUserMessage();
|
|
404
|
+
state.sessionManager.appendUserMessage(userMessage);
|
|
405
|
+
const systemPromptResult = await systemPrompt({
|
|
406
|
+
activeTools,
|
|
407
|
+
allowedDirs: workspace.allowedDirs,
|
|
408
|
+
skillsEnabled,
|
|
409
|
+
});
|
|
410
|
+
const results = agent.run({
|
|
411
|
+
systemPrompt: systemPromptResult.prompt,
|
|
412
|
+
input: promptText,
|
|
413
|
+
tools,
|
|
414
|
+
activeTools,
|
|
415
|
+
abortSignal: agent.abortSignal,
|
|
416
|
+
});
|
|
417
|
+
for await (const result of results) {
|
|
418
|
+
await repl.handle(result, agent.state);
|
|
419
|
+
}
|
|
420
|
+
await state.sessionManager.save();
|
|
421
|
+
}
|
|
422
|
+
catch (_error) {
|
|
423
|
+
// Error displayed in the TUI
|
|
424
|
+
}
|
|
425
|
+
}
|
|
326
426
|
// Interactive loop
|
|
327
427
|
while (true) {
|
|
328
428
|
const userInput = await repl.getUserInput();
|
|
@@ -330,23 +430,22 @@ async function runReplMode(state) {
|
|
|
330
430
|
const activeTools = projectConfig.tools.activeTools;
|
|
331
431
|
const skillsEnabled = !flags["no-skills"] && (projectConfig.skills?.enabled ?? true);
|
|
332
432
|
try {
|
|
433
|
+
const systemPromptResult = await systemPrompt({
|
|
434
|
+
activeTools,
|
|
435
|
+
allowedDirs: workspace.allowedDirs,
|
|
436
|
+
skillsEnabled,
|
|
437
|
+
});
|
|
333
438
|
const results = agent.run({
|
|
334
|
-
systemPrompt:
|
|
335
|
-
type: projectConfig.systemPromptType,
|
|
336
|
-
activeTools,
|
|
337
|
-
allowedDirs: workspace.allowedDirs,
|
|
338
|
-
skillsEnabled,
|
|
339
|
-
}),
|
|
439
|
+
systemPrompt: systemPromptResult.prompt,
|
|
340
440
|
input: userInput,
|
|
341
|
-
|
|
441
|
+
tools,
|
|
342
442
|
activeTools,
|
|
343
|
-
executors: tools.executors,
|
|
344
443
|
abortSignal: agent.abortSignal,
|
|
345
444
|
});
|
|
346
445
|
for await (const result of results) {
|
|
347
|
-
repl.handle(result, agent.state);
|
|
446
|
+
await repl.handle(result, agent.state);
|
|
348
447
|
}
|
|
349
|
-
state.
|
|
448
|
+
await state.sessionManager.save();
|
|
350
449
|
}
|
|
351
450
|
catch (_error) {
|
|
352
451
|
// Display error in the TUI by adding an error message to the chat
|
|
@@ -365,9 +464,9 @@ async function main() {
|
|
|
365
464
|
// Validate CLI arguments
|
|
366
465
|
validateCliArguments();
|
|
367
466
|
// Determine initial prompt
|
|
368
|
-
const { initialPromptInput,
|
|
467
|
+
const { initialPromptInput, stdinContent, hasContinueOrResume, resumeSessionId, } = await determineInitialPrompt();
|
|
369
468
|
// Initialize application state
|
|
370
|
-
const state = await initializeAppState(appConfig, initialPromptInput,
|
|
469
|
+
const state = await initializeAppState(appConfig, initialPromptInput, stdinContent, hasContinueOrResume, resumeSessionId);
|
|
371
470
|
// Set terminal title after all validation is complete
|
|
372
471
|
setTerminalTitle(`acai: ${workspace.primaryDir}`);
|
|
373
472
|
// Handle CLI mode if initial prompt provided
|
|
@@ -375,11 +474,11 @@ async function main() {
|
|
|
375
474
|
return await runCliMode(state);
|
|
376
475
|
}
|
|
377
476
|
// Setup REPL mode
|
|
378
|
-
return await runReplMode(state);
|
|
477
|
+
return await runReplMode(state, stdinContent !== null);
|
|
379
478
|
}
|
|
380
479
|
catch (error) {
|
|
381
480
|
handleError(error);
|
|
382
481
|
process.exit(1);
|
|
383
482
|
}
|
|
384
483
|
}
|
|
385
|
-
main();
|
|
484
|
+
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"}
|
package/dist/mentions.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import fs from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import { isString } from "@travisennis/stdlib/typeguards";
|
|
4
3
|
import { initExecutionEnvironment } from "./execution/index.js";
|
|
5
|
-
import { formatFile
|
|
6
|
-
import { readUrl } from "./tools/web-fetch.js";
|
|
4
|
+
import { formatFile } from "./formatting.js";
|
|
7
5
|
class ShellCommandError extends Error {
|
|
8
6
|
command;
|
|
9
7
|
exitCode;
|
|
@@ -115,35 +113,11 @@ async function processShellCommand(command) {
|
|
|
115
113
|
}
|
|
116
114
|
}
|
|
117
115
|
// Returns the formatted string or an error message string
|
|
118
|
-
async function processUrlCommand(context) {
|
|
119
|
-
const { match } = context;
|
|
120
|
-
const urlPath = match;
|
|
121
|
-
try {
|
|
122
|
-
return Object.assign(await readUrl(urlPath), { source: urlPath });
|
|
123
|
-
}
|
|
124
|
-
catch (error) {
|
|
125
|
-
if (error instanceof Error) {
|
|
126
|
-
return {
|
|
127
|
-
contentType: "text/plain",
|
|
128
|
-
data: `Url: ${urlPath} Status: Error fetching URL: ${error.message}`,
|
|
129
|
-
source: urlPath,
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
// Fallback for unknown error types
|
|
133
|
-
return {
|
|
134
|
-
contentType: "text/plain",
|
|
135
|
-
data: `Url: ${urlPath} Status: Error fetching URL: An unknown error occurred.`,
|
|
136
|
-
source: urlPath,
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
116
|
export async function processPrompt(message, { baseDir, model, pasteStore, }) {
|
|
141
117
|
const fileRegex = /@([^\s@]+(?:\.[\w\d]+))/g;
|
|
142
|
-
const urlRegex = /@(https?:\/\/[^\s]+)/g;
|
|
143
118
|
const shellRegex = /!`([^`]+)`/g;
|
|
144
|
-
// Collect all matches for files
|
|
119
|
+
// Collect all matches for files
|
|
145
120
|
const fileMatches = Array.from(message.matchAll(fileRegex));
|
|
146
|
-
const urlMatches = Array.from(message.matchAll(urlRegex));
|
|
147
121
|
const shellMatches = Array.from(message.matchAll(shellRegex));
|
|
148
122
|
const mentionProcessingPromises = [];
|
|
149
123
|
// Process file references - collect promises
|
|
@@ -158,18 +132,6 @@ export async function processPrompt(message, { baseDir, model, pasteStore, }) {
|
|
|
158
132
|
mentionProcessingPromises.push(processFileCommand(context));
|
|
159
133
|
}
|
|
160
134
|
}
|
|
161
|
-
// Process url references - collect promises
|
|
162
|
-
for (const match of urlMatches) {
|
|
163
|
-
const firstMatch = match[1];
|
|
164
|
-
if (firstMatch) {
|
|
165
|
-
const context = {
|
|
166
|
-
model,
|
|
167
|
-
baseDir, // baseDir is not used by processUrlCommand but kept for consistency
|
|
168
|
-
match: firstMatch,
|
|
169
|
-
};
|
|
170
|
-
mentionProcessingPromises.push(processUrlCommand(context));
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
135
|
let processedMessage = message;
|
|
174
136
|
// Process paste placeholders
|
|
175
137
|
if (pasteStore && pasteStore.size > 0) {
|
|
@@ -208,19 +170,7 @@ export async function processPrompt(message, { baseDir, model, pasteStore, }) {
|
|
|
208
170
|
const mentionResults = await Promise.all(mentionProcessingPromises);
|
|
209
171
|
const context = [];
|
|
210
172
|
for (const mention of mentionResults) {
|
|
211
|
-
|
|
212
|
-
context.push(mention);
|
|
213
|
-
}
|
|
214
|
-
else if (mention.data.startsWith("data")) {
|
|
215
|
-
context.push({
|
|
216
|
-
type: "image",
|
|
217
|
-
mediaType: mention.contentType,
|
|
218
|
-
image: mention.data,
|
|
219
|
-
});
|
|
220
|
-
}
|
|
221
|
-
else {
|
|
222
|
-
context.push(formatUrl(mention.source, mention.data.trim(), model.promptFormat));
|
|
223
|
-
}
|
|
173
|
+
context.push(mention);
|
|
224
174
|
}
|
|
225
175
|
return {
|
|
226
176
|
message: processedMessage,
|