@travisennis/acai 0.0.7 → 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 +42 -25
- package/dist/agent/index.d.ts +21 -25
- package/dist/agent/index.d.ts.map +1 -1
- package/dist/agent/index.js +115 -104
- package/dist/cli.d.ts +2 -2
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +21 -16
- 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} +55 -95
- 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 +33 -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 +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} +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 +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} +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 +138 -75
- 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 +11 -10
- package/dist/models/openai-provider.d.ts.map +1 -1
- 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 -29
- package/dist/models/openrouter-provider.d.ts.map +1 -1
- package/dist/models/openrouter-provider.js +95 -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 +0 -1
- package/dist/prompts.d.ts.map +1 -1
- package/dist/prompts.js +56 -406
- 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 -4
- package/dist/repl-new.d.ts.map +1 -1
- package/dist/repl-new.js +245 -42
- 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} +60 -14
- package/dist/skills.d.ts +0 -4
- package/dist/skills.d.ts.map +1 -1
- package/dist/skills.js +100 -59
- package/dist/terminal/control.d.ts +1 -0
- package/dist/terminal/control.d.ts.map +1 -1
- package/dist/terminal/control.js +2 -0
- 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 +69 -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 +1 -2
- package/dist/tui/components/editor.d.ts.map +1 -1
- package/dist/tui/components/editor.js +148 -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 +63 -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/index.d.ts +4 -2
- package/dist/tui/index.d.ts.map +1 -1
- package/dist/tui/index.js +2 -2
- package/dist/tui/terminal.d.ts +2 -2
- package/dist/tui/terminal.d.ts.map +1 -1
- package/dist/tui/terminal.js +23 -19
- package/dist/tui/tui.d.ts +1 -0
- package/dist/tui/tui.d.ts.map +1 -1
- package/dist/tui/tui.js +24 -29
- package/dist/tui/utils.d.ts.map +1 -1
- package/dist/tui/utils.js +2 -3
- 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/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
5
|
import { text } from "node:stream/consumers";
|
|
5
6
|
import { parseArgs } from "node:util";
|
|
6
|
-
import { asyncTry } from "@travisennis/stdlib/try";
|
|
7
|
+
import { asyncTry, isFailure, syncTry } from "@travisennis/stdlib/try";
|
|
7
8
|
import { isDefined } from "@travisennis/stdlib/typeguards";
|
|
8
9
|
import { Agent } from "./agent/index.js";
|
|
9
10
|
import { Cli } from "./cli.js";
|
|
10
11
|
import { CommandManager } from "./commands/manager.js";
|
|
11
12
|
import { config, } from "./config.js";
|
|
12
13
|
import { logger } from "./logger.js";
|
|
13
|
-
import {
|
|
14
|
+
import { PromptError, processPrompt } from "./mentions.js";
|
|
14
15
|
import { ModelManager } from "./models/manager.js";
|
|
15
16
|
import { isSupportedModel } from "./models/providers.js";
|
|
16
17
|
import { PromptManager } from "./prompts/manager.js";
|
|
17
18
|
import { systemPrompt } from "./prompts.js";
|
|
18
19
|
import { NewRepl } from "./repl-new.js";
|
|
19
|
-
import {
|
|
20
|
+
import { SessionManager } from "./sessions/manager.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, stdInPrompt, hasContinueOrResume) {
|
|
102
|
+
async function initializeAppState(appConfig, initialPromptInput, stdInPrompt, hasContinueOrResume, resumeSessionId) {
|
|
92
103
|
const appDir = config.app;
|
|
93
104
|
// Parallelize independent async operations
|
|
94
105
|
const [messageHistoryDir, modelManager] = await Promise.all([
|
|
@@ -99,13 +110,32 @@ 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
140
|
if (stdInPrompt) {
|
|
111
141
|
promptManager.addContext(stdInPrompt);
|
|
@@ -114,7 +144,7 @@ async function initializeAppState(appConfig, initialPromptInput, stdInPrompt, ha
|
|
|
114
144
|
const commands = new CommandManager({
|
|
115
145
|
promptManager,
|
|
116
146
|
modelManager,
|
|
117
|
-
|
|
147
|
+
sessionManager,
|
|
118
148
|
tokenTracker,
|
|
119
149
|
config,
|
|
120
150
|
tokenCounter,
|
|
@@ -127,7 +157,7 @@ async function initializeAppState(appConfig, initialPromptInput, stdInPrompt, ha
|
|
|
127
157
|
modelManager,
|
|
128
158
|
tokenTracker,
|
|
129
159
|
tokenCounter,
|
|
130
|
-
|
|
160
|
+
sessionManager,
|
|
131
161
|
promptManager,
|
|
132
162
|
promptHistory,
|
|
133
163
|
commands,
|
|
@@ -144,11 +174,23 @@ async function handleEarlyExits() {
|
|
|
144
174
|
}
|
|
145
175
|
return false;
|
|
146
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
|
+
}
|
|
147
181
|
function validateCliArguments() {
|
|
148
182
|
if (flags.continue === true && flags.resume === true) {
|
|
149
183
|
console.error("Cannot use --continue and --resume flags together.");
|
|
150
184
|
process.exit(1);
|
|
151
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
|
+
}
|
|
152
194
|
}
|
|
153
195
|
async function determineInitialPrompt() {
|
|
154
196
|
const hasContinueOrResume = flags.continue === true || flags.resume === true;
|
|
@@ -163,21 +205,28 @@ async function determineInitialPrompt() {
|
|
|
163
205
|
console.error(`Error reading stdin: ${error.message}`);
|
|
164
206
|
}
|
|
165
207
|
}
|
|
208
|
+
// Check for session ID with --resume
|
|
209
|
+
const resumeSessionId = flags.resume === true && input.length > 0 ? input[0] : undefined;
|
|
166
210
|
const initialPromptInput = typeof flags.prompt === "string" && flags.prompt.length > 0
|
|
167
211
|
? flags.prompt
|
|
168
|
-
: positionalPrompt && positionalPrompt.length > 0
|
|
212
|
+
: positionalPrompt && positionalPrompt.length > 0 && !resumeSessionId
|
|
169
213
|
? positionalPrompt
|
|
170
214
|
: undefined;
|
|
171
215
|
if (hasContinueOrResume && isDefined(initialPromptInput)) {
|
|
172
216
|
console.error("Cannot use --continue or --resume with an initial prompt.");
|
|
173
217
|
process.exit(1);
|
|
174
218
|
}
|
|
175
|
-
return {
|
|
219
|
+
return {
|
|
220
|
+
initialPromptInput,
|
|
221
|
+
stdInPrompt,
|
|
222
|
+
hasContinueOrResume,
|
|
223
|
+
resumeSessionId,
|
|
224
|
+
};
|
|
176
225
|
}
|
|
177
226
|
async function initializeModelManager(appDir) {
|
|
178
227
|
const chosenModel = isSupportedModel(flags.model)
|
|
179
228
|
? flags.model
|
|
180
|
-
: "
|
|
229
|
+
: "opencode:minimax-m2-1";
|
|
181
230
|
const modelManager = new ModelManager({
|
|
182
231
|
stateDir: await appDir.ensurePath("audit"),
|
|
183
232
|
});
|
|
@@ -193,36 +242,31 @@ async function initializeModelManager(appDir) {
|
|
|
193
242
|
modelManager.setModel("edit-fix", chosenModel);
|
|
194
243
|
return modelManager;
|
|
195
244
|
}
|
|
196
|
-
async function
|
|
197
|
-
const messageHistory = new
|
|
245
|
+
async function initializeSessionManager(messageHistoryDir, modelManager, tokenTracker) {
|
|
246
|
+
const messageHistory = new SessionManager({
|
|
198
247
|
stateDir: messageHistoryDir,
|
|
199
248
|
modelManager,
|
|
200
249
|
tokenTracker,
|
|
201
250
|
});
|
|
202
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);
|
|
257
|
+
}
|
|
258
|
+
});
|
|
203
259
|
return messageHistory;
|
|
204
260
|
}
|
|
205
|
-
async function handleConversationHistory(messageHistory, messageHistoryDir, _hasContinueOrResume) {
|
|
261
|
+
async function handleConversationHistory(messageHistory, messageHistoryDir, _hasContinueOrResume, resumeSessionId) {
|
|
206
262
|
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);
|
|
263
|
+
const histories = await SessionManager.load(messageHistoryDir, DEFAULT_HISTORY_LIMIT);
|
|
220
264
|
if (histories.length > 0) {
|
|
221
265
|
try {
|
|
222
266
|
const choice = await select({
|
|
223
267
|
message: "Select a conversation to resume:",
|
|
224
268
|
choices: histories.map((h, index) => ({
|
|
225
|
-
name: `${index + 1}: ${h.title} (${h.updatedAt.toLocaleString()})`,
|
|
269
|
+
name: `${index + 1}: ${h.title} [${h.sessionId}] (${h.updatedAt.toLocaleString()})`,
|
|
226
270
|
value: index,
|
|
227
271
|
description: `${h.messages.length} messages`,
|
|
228
272
|
})),
|
|
@@ -249,7 +293,34 @@ async function handleConversationHistory(messageHistory, messageHistoryDir, _has
|
|
|
249
293
|
}
|
|
250
294
|
}
|
|
251
295
|
else {
|
|
252
|
-
logger.info("No previous conversations found to
|
|
296
|
+
logger.info("No previous conversations found to continue.");
|
|
297
|
+
}
|
|
298
|
+
}
|
|
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
|
+
}
|
|
253
324
|
}
|
|
254
325
|
}
|
|
255
326
|
}
|
|
@@ -257,7 +328,7 @@ async function runCliMode(state) {
|
|
|
257
328
|
const skillsEnabled = !flags["no-skills"] && (await config.getSkillsEnabled());
|
|
258
329
|
const cliProcess = new Cli({
|
|
259
330
|
promptManager: state.promptManager,
|
|
260
|
-
messageHistory: state.
|
|
331
|
+
messageHistory: state.sessionManager,
|
|
261
332
|
modelManager: state.modelManager,
|
|
262
333
|
tokenTracker: state.tokenTracker,
|
|
263
334
|
tokenCounter: state.tokenCounter,
|
|
@@ -267,8 +338,12 @@ async function runCliMode(state) {
|
|
|
267
338
|
(await asyncTry(cliProcess.run())).recover(handleError);
|
|
268
339
|
}
|
|
269
340
|
async function runReplMode(state) {
|
|
341
|
+
// Initialize tools before creating REPL (needed for session reload reconstruction)
|
|
342
|
+
const tools = await initTools({
|
|
343
|
+
workspace,
|
|
344
|
+
});
|
|
270
345
|
const agent = new Agent({
|
|
271
|
-
|
|
346
|
+
sessionManager: state.sessionManager,
|
|
272
347
|
modelManager: state.modelManager,
|
|
273
348
|
tokenTracker: state.tokenTracker,
|
|
274
349
|
});
|
|
@@ -276,25 +351,30 @@ async function runReplMode(state) {
|
|
|
276
351
|
agent,
|
|
277
352
|
promptManager: state.promptManager,
|
|
278
353
|
config: state.appConfig,
|
|
279
|
-
messageHistory: state.
|
|
354
|
+
messageHistory: state.sessionManager,
|
|
280
355
|
modelManager: state.modelManager,
|
|
281
356
|
tokenTracker: state.tokenTracker,
|
|
282
357
|
commands: state.commands,
|
|
283
358
|
tokenCounter: state.tokenCounter,
|
|
284
359
|
promptHistory: state.promptHistory,
|
|
285
360
|
workspace,
|
|
361
|
+
tools,
|
|
286
362
|
});
|
|
287
363
|
// Initialize TUI
|
|
288
364
|
await repl.init();
|
|
289
|
-
|
|
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", () => {
|
|
290
370
|
logger.info("Resetting agent state.");
|
|
291
371
|
agent.resetState();
|
|
292
|
-
repl.rerender();
|
|
372
|
+
void repl.rerender();
|
|
293
373
|
});
|
|
294
374
|
// Set interrupt callback
|
|
295
|
-
repl.setInterruptCallback(() => {
|
|
375
|
+
repl.setInterruptCallback(async () => {
|
|
296
376
|
try {
|
|
297
|
-
state.
|
|
377
|
+
await state.sessionManager.save();
|
|
298
378
|
}
|
|
299
379
|
catch (error) {
|
|
300
380
|
// Log but don't throw - we still want to abort the agent
|
|
@@ -302,27 +382,12 @@ async function runReplMode(state) {
|
|
|
302
382
|
}
|
|
303
383
|
agent.abort();
|
|
304
384
|
});
|
|
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,
|
|
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
|
+
}
|
|
317
390
|
});
|
|
318
|
-
const completeToolDefs = {
|
|
319
|
-
...coreTools.toolDefs,
|
|
320
|
-
...agentTools.toolDefs,
|
|
321
|
-
};
|
|
322
|
-
const tools = {
|
|
323
|
-
toolDefs: completeToolDefs,
|
|
324
|
-
executors: new Map([...coreTools.executors, ...agentTools.executors]),
|
|
325
|
-
};
|
|
326
391
|
// Interactive loop
|
|
327
392
|
while (true) {
|
|
328
393
|
const userInput = await repl.getUserInput();
|
|
@@ -332,21 +397,19 @@ async function runReplMode(state) {
|
|
|
332
397
|
try {
|
|
333
398
|
const results = agent.run({
|
|
334
399
|
systemPrompt: await systemPrompt({
|
|
335
|
-
type: projectConfig.systemPromptType,
|
|
336
400
|
activeTools,
|
|
337
401
|
allowedDirs: workspace.allowedDirs,
|
|
338
402
|
skillsEnabled,
|
|
339
403
|
}),
|
|
340
404
|
input: userInput,
|
|
341
|
-
|
|
405
|
+
tools,
|
|
342
406
|
activeTools,
|
|
343
|
-
executors: tools.executors,
|
|
344
407
|
abortSignal: agent.abortSignal,
|
|
345
408
|
});
|
|
346
409
|
for await (const result of results) {
|
|
347
|
-
repl.handle(result, agent.state);
|
|
410
|
+
await repl.handle(result, agent.state);
|
|
348
411
|
}
|
|
349
|
-
state.
|
|
412
|
+
await state.sessionManager.save();
|
|
350
413
|
}
|
|
351
414
|
catch (_error) {
|
|
352
415
|
// Display error in the TUI by adding an error message to the chat
|
|
@@ -365,9 +428,9 @@ async function main() {
|
|
|
365
428
|
// Validate CLI arguments
|
|
366
429
|
validateCliArguments();
|
|
367
430
|
// Determine initial prompt
|
|
368
|
-
const { initialPromptInput, stdInPrompt, hasContinueOrResume } = await determineInitialPrompt();
|
|
431
|
+
const { initialPromptInput, stdInPrompt, hasContinueOrResume, resumeSessionId, } = await determineInitialPrompt();
|
|
369
432
|
// Initialize application state
|
|
370
|
-
const state = await initializeAppState(appConfig, initialPromptInput, stdInPrompt, hasContinueOrResume);
|
|
433
|
+
const state = await initializeAppState(appConfig, initialPromptInput, stdInPrompt, hasContinueOrResume, resumeSessionId);
|
|
371
434
|
// Set terminal title after all validation is complete
|
|
372
435
|
setTerminalTitle(`acai: ${workspace.primaryDir}`);
|
|
373
436
|
// Handle CLI mode if initial prompt provided
|
|
@@ -382,4 +445,4 @@ async function main() {
|
|
|
382
445
|
process.exit(1);
|
|
383
446
|
}
|
|
384
447
|
}
|
|
385
|
-
main();
|
|
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"}
|
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,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { LanguageModelV3Middleware } from "@ai-sdk/provider";
|
|
2
2
|
export declare const auditMessage: ({ filePath, app, }: {
|
|
3
3
|
filePath: string;
|
|
4
4
|
app: string;
|
|
5
|
-
}) =>
|
|
5
|
+
}) => LanguageModelV3Middleware;
|
|
6
6
|
//# sourceMappingURL=audit-message.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit-message.d.ts","sourceRoot":"","sources":["../../source/middleware/audit-message.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,yBAAyB,EAI1B,MAAM,kBAAkB,CAAC;AAmC1B,eAAO,MAAM,YAAY,GAAI,oBAG1B;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;CACb,
|
|
1
|
+
{"version":3,"file":"audit-message.d.ts","sourceRoot":"","sources":["../../source/middleware/audit-message.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,yBAAyB,EAI1B,MAAM,kBAAkB,CAAC;AAmC1B,eAAO,MAAM,YAAY,GAAI,oBAG1B;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;CACb,8BA4HA,CAAC"}
|
|
@@ -22,6 +22,7 @@ const writeAuditRecord = async (app, filePath, content) => {
|
|
|
22
22
|
};
|
|
23
23
|
export const auditMessage = ({ filePath = "messages", app = "default", }) => {
|
|
24
24
|
const middleware = {
|
|
25
|
+
specificationVersion: "v3",
|
|
25
26
|
wrapGenerate: async ({ doGenerate, params, model }) => {
|
|
26
27
|
const result = await doGenerate();
|
|
27
28
|
const msg = {
|
|
@@ -37,7 +38,21 @@ export const auditMessage = ({ filePath = "messages", app = "default", }) => {
|
|
|
37
38
|
},
|
|
38
39
|
],
|
|
39
40
|
}),
|
|
40
|
-
usage:
|
|
41
|
+
usage: {
|
|
42
|
+
inputTokens: result.usage.inputTokens.total,
|
|
43
|
+
outputTokens: result.usage.outputTokens.total,
|
|
44
|
+
totalTokens: (result.usage.inputTokens.total ?? 0) +
|
|
45
|
+
(result.usage.outputTokens.total ?? 0),
|
|
46
|
+
inputTokenDetails: {
|
|
47
|
+
noCacheTokens: result.usage.inputTokens.noCache,
|
|
48
|
+
cacheReadTokens: result.usage.inputTokens.cacheRead,
|
|
49
|
+
cacheWriteTokens: result.usage.inputTokens.cacheWrite,
|
|
50
|
+
},
|
|
51
|
+
outputTokenDetails: {
|
|
52
|
+
textTokens: result.usage.outputTokens.text,
|
|
53
|
+
reasoningTokens: result.usage.outputTokens.reasoning,
|
|
54
|
+
},
|
|
55
|
+
},
|
|
41
56
|
timestamp: Date.now(),
|
|
42
57
|
};
|
|
43
58
|
await writeAuditRecord(app, filePath, msg);
|
|
@@ -50,6 +65,15 @@ export const auditMessage = ({ filePath = "messages", app = "default", }) => {
|
|
|
50
65
|
inputTokens: 0,
|
|
51
66
|
outputTokens: 0,
|
|
52
67
|
totalTokens: 0,
|
|
68
|
+
inputTokenDetails: {
|
|
69
|
+
noCacheTokens: 0,
|
|
70
|
+
cacheReadTokens: 0,
|
|
71
|
+
cacheWriteTokens: 0,
|
|
72
|
+
},
|
|
73
|
+
outputTokenDetails: {
|
|
74
|
+
textTokens: 0,
|
|
75
|
+
reasoningTokens: 0,
|
|
76
|
+
},
|
|
53
77
|
};
|
|
54
78
|
const transformStream = new TransformStream({
|
|
55
79
|
transform(chunk, controller) {
|
|
@@ -57,7 +81,21 @@ export const auditMessage = ({ filePath = "messages", app = "default", }) => {
|
|
|
57
81
|
generatedText += chunk.delta;
|
|
58
82
|
}
|
|
59
83
|
if (chunk.type === "finish") {
|
|
60
|
-
usage =
|
|
84
|
+
usage = {
|
|
85
|
+
inputTokens: chunk.usage.inputTokens.total,
|
|
86
|
+
outputTokens: chunk.usage.outputTokens.total,
|
|
87
|
+
totalTokens: (chunk.usage.inputTokens.total ?? 0) +
|
|
88
|
+
(chunk.usage.outputTokens.total ?? 0),
|
|
89
|
+
inputTokenDetails: {
|
|
90
|
+
noCacheTokens: chunk.usage.inputTokens.noCache,
|
|
91
|
+
cacheReadTokens: chunk.usage.inputTokens.cacheRead,
|
|
92
|
+
cacheWriteTokens: chunk.usage.inputTokens.cacheWrite,
|
|
93
|
+
},
|
|
94
|
+
outputTokenDetails: {
|
|
95
|
+
textTokens: chunk.usage.outputTokens.text,
|
|
96
|
+
reasoningTokens: chunk.usage.outputTokens.reasoning,
|
|
97
|
+
},
|
|
98
|
+
};
|
|
61
99
|
}
|
|
62
100
|
controller.enqueue(chunk);
|
|
63
101
|
},
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare const cacheMiddleware:
|
|
1
|
+
import type { LanguageModelV3Middleware } from "@ai-sdk/provider";
|
|
2
|
+
export declare const cacheMiddleware: LanguageModelV3Middleware;
|
|
3
3
|
//# sourceMappingURL=cache.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../source/middleware/cache.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../source/middleware/cache.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,yBAAyB,EAE1B,MAAM,kBAAkB,CAAC;AA+F1B,eAAO,MAAM,eAAe,EAAE,yBAqF7B,CAAC"}
|