@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
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { basename } from "node:path";
|
|
3
|
+
import style from "../../terminal/style.js";
|
|
4
|
+
import { Spacer, Text } from "../../tui/index.js";
|
|
5
|
+
import { estimateSessionSize, getSessionData, renderSessionHtml, } from "./html-renderer.js";
|
|
6
|
+
async function runCommand(cmd, args, stdin) {
|
|
7
|
+
return new Promise((resolve) => {
|
|
8
|
+
const proc = spawn(cmd, args, {
|
|
9
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
10
|
+
});
|
|
11
|
+
let stdout = "";
|
|
12
|
+
let stderr = "";
|
|
13
|
+
proc.stdout.on("data", (data) => {
|
|
14
|
+
stdout += data.toString();
|
|
15
|
+
});
|
|
16
|
+
proc.stderr.on("data", (data) => {
|
|
17
|
+
stderr += data.toString();
|
|
18
|
+
});
|
|
19
|
+
proc.on("close", (exitCode) => {
|
|
20
|
+
resolve({ stdout, stderr, exitCode: exitCode ?? 1 });
|
|
21
|
+
});
|
|
22
|
+
proc.on("error", (err) => {
|
|
23
|
+
resolve({ stdout: "", stderr: err.message, exitCode: 1 });
|
|
24
|
+
});
|
|
25
|
+
if (stdin) {
|
|
26
|
+
proc.stdin.write(stdin);
|
|
27
|
+
proc.stdin.end();
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
async function checkGhInstalled() {
|
|
32
|
+
const result = await runCommand("which", ["gh"]);
|
|
33
|
+
return result.exitCode === 0;
|
|
34
|
+
}
|
|
35
|
+
async function checkGhAuth() {
|
|
36
|
+
const result = await runCommand("gh", ["auth", "status"]);
|
|
37
|
+
return result.exitCode === 0;
|
|
38
|
+
}
|
|
39
|
+
function extractGistId(output) {
|
|
40
|
+
const match = output.match(/gist\.github\.com\/[\w-]+\/([a-f0-9]+)/i);
|
|
41
|
+
return match ? match[1] : null;
|
|
42
|
+
}
|
|
43
|
+
export const shareCommand = (options) => {
|
|
44
|
+
return {
|
|
45
|
+
command: "/share",
|
|
46
|
+
description: "Share the current session as a GitHub Gist for viewing in a web browser",
|
|
47
|
+
getSubCommands: () => Promise.resolve([]),
|
|
48
|
+
async handle(_args, { tui, container, editor, }) {
|
|
49
|
+
const { sessionManager } = options;
|
|
50
|
+
container.addChild(new Spacer(1));
|
|
51
|
+
if (sessionManager.isEmpty()) {
|
|
52
|
+
container.addChild(new Text(style.yellow("No messages in current session to share."), 1, 0));
|
|
53
|
+
tui.requestRender();
|
|
54
|
+
editor.setText("");
|
|
55
|
+
return "continue";
|
|
56
|
+
}
|
|
57
|
+
container.addChild(new Text(style.gray("Checking GitHub CLI availability..."), 1, 0));
|
|
58
|
+
tui.requestRender();
|
|
59
|
+
const ghInstalled = await checkGhInstalled();
|
|
60
|
+
if (!ghInstalled) {
|
|
61
|
+
container.addChild(new Text(style.red("GitHub CLI (gh) is not installed. Please install it from https://cli.github.com/"), 1, 0));
|
|
62
|
+
tui.requestRender();
|
|
63
|
+
editor.setText("");
|
|
64
|
+
return "continue";
|
|
65
|
+
}
|
|
66
|
+
const ghAuthed = await checkGhAuth();
|
|
67
|
+
if (!ghAuthed) {
|
|
68
|
+
container.addChild(new Text(style.red("Not authenticated with GitHub. Please run `gh auth login` first."), 1, 0));
|
|
69
|
+
tui.requestRender();
|
|
70
|
+
editor.setText("");
|
|
71
|
+
return "continue";
|
|
72
|
+
}
|
|
73
|
+
const project = basename(process.cwd());
|
|
74
|
+
const sessionData = getSessionData(sessionManager, project);
|
|
75
|
+
const { messageCount, contentSizeBytes } = estimateSessionSize(sessionData);
|
|
76
|
+
const isLargeSession = messageCount > 100 || contentSizeBytes > 100 * 1024;
|
|
77
|
+
if (isLargeSession) {
|
|
78
|
+
const sizeKb = Math.round(contentSizeBytes / 1024);
|
|
79
|
+
container.addChild(new Text(style.yellow(`Large session detected: ${messageCount} messages, ~${sizeKb}KB`), 1, 0));
|
|
80
|
+
container.addChild(new Text(style.gray("Proceeding with share... (this may take a moment)"), 1, 0));
|
|
81
|
+
tui.requestRender();
|
|
82
|
+
}
|
|
83
|
+
container.addChild(new Text(style.gray("Creating GitHub Gist..."), 1, 0));
|
|
84
|
+
tui.requestRender();
|
|
85
|
+
const html = renderSessionHtml(sessionData);
|
|
86
|
+
const title = sessionData.title || "Untitled Session";
|
|
87
|
+
const description = `Acai session: ${title}`;
|
|
88
|
+
const result = await runCommand("gh", [
|
|
89
|
+
"gist",
|
|
90
|
+
"create",
|
|
91
|
+
"--public",
|
|
92
|
+
"--desc",
|
|
93
|
+
description,
|
|
94
|
+
"--filename",
|
|
95
|
+
"index.html",
|
|
96
|
+
"-",
|
|
97
|
+
], html);
|
|
98
|
+
if (result.exitCode !== 0) {
|
|
99
|
+
container.addChild(new Text(style.red(`Failed to create Gist: ${result.stderr.trim()}`), 1, 0));
|
|
100
|
+
tui.requestRender();
|
|
101
|
+
editor.setText("");
|
|
102
|
+
return "continue";
|
|
103
|
+
}
|
|
104
|
+
const gistId = extractGistId(result.stdout);
|
|
105
|
+
if (!gistId) {
|
|
106
|
+
container.addChild(new Text(style.red("Failed to extract Gist ID from response."), 1, 0));
|
|
107
|
+
tui.requestRender();
|
|
108
|
+
editor.setText("");
|
|
109
|
+
return "continue";
|
|
110
|
+
}
|
|
111
|
+
const gistUrl = `https://gist.github.com/${gistId}`;
|
|
112
|
+
const shareUrl = `https://gistpreview.github.io/?${gistId}`;
|
|
113
|
+
container.addChild(new Spacer(1));
|
|
114
|
+
container.addChild(new Text(style.green("Session shared successfully!"), 1, 0));
|
|
115
|
+
container.addChild(new Text(`View: ${style.blue(gistUrl)}`, 1, 0));
|
|
116
|
+
container.addChild(new Text(`Share: ${style.blue(shareUrl)}`, 1, 0));
|
|
117
|
+
tui.requestRender();
|
|
118
|
+
editor.setText("");
|
|
119
|
+
return "continue";
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/commands/shell/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAK/D,eAAO,MAAM,YAAY,GAAI,SAAS,cAAc,KAAG,WAqHtD,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { initExecutionEnvironment } from "
|
|
2
|
-
import style from "
|
|
3
|
-
import { SelectList, Text } from "
|
|
1
|
+
import { initExecutionEnvironment } from "../../execution/index.js";
|
|
2
|
+
import style from "../../terminal/style.js";
|
|
3
|
+
import { SelectList, Text } from "../../tui/index.js";
|
|
4
4
|
// Command execution timeout in milliseconds
|
|
5
5
|
const DEFAULT_TIMEOUT = 1.5 * 60 * 1000; // 1.5 minutes
|
|
6
6
|
export const shellCommand = (options) => {
|
package/dist/commands/types.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { ConfigManager } from "../config.ts";
|
|
2
2
|
import type { WorkspaceContext } from "../index.ts";
|
|
3
|
-
import type { MessageHistory } from "../messages.ts";
|
|
4
3
|
import type { ModelManager } from "../models/manager.ts";
|
|
5
4
|
import type { PromptManagerApi } from "../prompts/manager.ts";
|
|
5
|
+
import type { SessionManager } from "../sessions/manager.ts";
|
|
6
6
|
import type { TokenCounter } from "../tokens/counter.ts";
|
|
7
7
|
import type { TokenTracker } from "../tokens/tracker.ts";
|
|
8
8
|
import type { Container, Editor, TUI } from "../tui/index.ts";
|
|
@@ -21,7 +21,7 @@ export interface ReplCommand {
|
|
|
21
21
|
export interface CommandOptions {
|
|
22
22
|
promptManager: PromptManagerApi;
|
|
23
23
|
modelManager: ModelManager;
|
|
24
|
-
|
|
24
|
+
sessionManager: SessionManager;
|
|
25
25
|
tokenTracker: TokenTracker;
|
|
26
26
|
config: ConfigManager;
|
|
27
27
|
tokenCounter: TokenCounter;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../source/commands/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../source/commands/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAE9D,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IACxC,MAAM,EAAE,CACN,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,EAAE;QACP,GAAG,EAAE,GAAG,CAAC;QACT,SAAS,EAAE,SAAS,CAAC;QACrB,cAAc,EAAE,SAAS,CAAC;QAC1B,MAAM,EAAE,MAAM,CAAC;KAChB,KACE,OAAO,CAAC,OAAO,GAAG,UAAU,GAAG,KAAK,CAAC,CAAC;CAC5C;AAED,MAAM,WAAW,cAAc;IAC7B,aAAa,EAAE,gBAAgB,CAAC;IAChC,YAAY,EAAE,YAAY,CAAC;IAC3B,cAAc,EAAE,cAAc,CAAC;IAC/B,YAAY,EAAE,YAAY,CAAC;IAC3B,MAAM,EAAE,aAAa,CAAC;IACtB,YAAY,EAAE,YAAY,CAAC;IAC3B,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,SAAS,EAAE,gBAAgB,CAAC;CAC7B"}
|
package/dist/config.d.ts
CHANGED
|
@@ -1,10 +1,24 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
export declare const defaultConfig: {
|
|
3
|
+
readonly loop: {
|
|
4
|
+
readonly maxIterations: 200;
|
|
5
|
+
};
|
|
6
|
+
readonly tools: {
|
|
7
|
+
readonly activeTools: string[] | undefined;
|
|
8
|
+
readonly maxTokens: 30000;
|
|
9
|
+
readonly maxResults: 30;
|
|
10
|
+
readonly dynamicTools: {
|
|
11
|
+
readonly enabled: true;
|
|
12
|
+
readonly maxTools: 10;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
readonly notify: true;
|
|
16
|
+
readonly readOnlyFiles: string[];
|
|
17
|
+
readonly skills: {
|
|
18
|
+
readonly enabled: true;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
2
21
|
declare const ProjectConfigSchema: z.ZodObject<{
|
|
3
|
-
systemPromptType: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
4
|
-
full: "full";
|
|
5
|
-
minimal: "minimal";
|
|
6
|
-
cli: "cli";
|
|
7
|
-
}>>>;
|
|
8
22
|
logs: z.ZodOptional<z.ZodObject<{
|
|
9
23
|
path: z.ZodString;
|
|
10
24
|
}, z.core.$strip>>;
|
|
@@ -33,17 +47,21 @@ export declare class DirectoryProvider {
|
|
|
33
47
|
getPath(subdir?: string): string;
|
|
34
48
|
ensurePath(subdir?: string): Promise<string>;
|
|
35
49
|
ensurePathSync(subdir?: string): string;
|
|
50
|
+
exists(subdir?: string): Promise<boolean>;
|
|
51
|
+
existsSync(subdir?: string): boolean;
|
|
36
52
|
}
|
|
37
53
|
export declare class ConfigManager {
|
|
38
54
|
readonly project: DirectoryProvider;
|
|
39
55
|
readonly app: DirectoryProvider;
|
|
40
56
|
constructor();
|
|
41
|
-
getAccessibleLogDir(): string;
|
|
42
57
|
private _readConfig;
|
|
43
58
|
getConfig(): Promise<ProjectConfig>;
|
|
44
59
|
getSkillsEnabled(): Promise<boolean>;
|
|
45
60
|
setSkillsEnabled(enabled: boolean): Promise<void>;
|
|
46
|
-
|
|
61
|
+
readAgentsFiles(): Promise<{
|
|
62
|
+
path: string;
|
|
63
|
+
content: string;
|
|
64
|
+
}[]>;
|
|
47
65
|
writeAgentsFile(rules: string): Promise<void>;
|
|
48
66
|
readProjectLearnedRulesFile(): Promise<string>;
|
|
49
67
|
writeProjectLearnedRulesFile(rules: string): Promise<void>;
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../source/config.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../source/config.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,aAAa;;;;;8BAKI,MAAM,EAAE,GAAG,SAAS;;;;;;;;;4BAS3B,MAAM,EAAE;;;;CAIrB,CAAC;AAGX,QAAA,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;iBA0CvB,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,OAAO,CAAS;gBAEZ,OAAO,EAAE,MAAM;IAI3B,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM;IAK1B,UAAU,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAOlD,cAAc,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM;IAOjC,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAW/C,UAAU,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO;CAIrC;AAED,qBAAa,aAAa;IACxB,QAAQ,CAAC,OAAO,EAAE,iBAAiB,CAAC;IACpC,QAAQ,CAAC,GAAG,EAAE,iBAAiB,CAAC;;YAOlB,WAAW;IAenB,SAAS,IAAI,OAAO,CAAC,aAAa,CAAC;IAgBnC,gBAAgB,IAAI,OAAO,CAAC,OAAO,CAAC;IAKpC,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAsBjD,eAAe,IAAI,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IA4B/D,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAY7C,2BAA2B,IAAI,OAAO,CAAC,MAAM,CAAC;IAe9C,4BAA4B,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAkB1D,0BAA0B,IAAI,OAAO,CAAC,MAAM,CAAC;IAY7C,2BAA2B,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;YAcjD,cAAc;IActB,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAe/D,cAAc,CAClB,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,GACjC,OAAO,CAAC,IAAI,CAAC;CAKjB;AAGD,eAAO,MAAM,MAAM,eAAsB,CAAC"}
|
package/dist/config.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { mkdirSync } from "node:fs";
|
|
1
|
+
import { existsSync, mkdirSync } from "node:fs";
|
|
2
2
|
import fs from "node:fs/promises";
|
|
3
3
|
import { homedir } from "node:os";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
import { jsonParser } from "./parsing.js";
|
|
7
|
-
const defaultConfig = {
|
|
8
|
-
systemPromptType: "full",
|
|
7
|
+
export const defaultConfig = {
|
|
9
8
|
loop: {
|
|
10
9
|
maxIterations: 200,
|
|
11
10
|
},
|
|
@@ -26,10 +25,6 @@ const defaultConfig = {
|
|
|
26
25
|
};
|
|
27
26
|
// Type definitions
|
|
28
27
|
const ProjectConfigSchema = z.object({
|
|
29
|
-
systemPromptType: z
|
|
30
|
-
.enum(["full", "minimal", "cli"])
|
|
31
|
-
.optional()
|
|
32
|
-
.default(defaultConfig.systemPromptType),
|
|
33
28
|
logs: z
|
|
34
29
|
.object({
|
|
35
30
|
path: z.string(),
|
|
@@ -92,6 +87,22 @@ export class DirectoryProvider {
|
|
|
92
87
|
mkdirSync(dirPath, { recursive: true });
|
|
93
88
|
return dirPath;
|
|
94
89
|
}
|
|
90
|
+
// Check if directory exists without creating it
|
|
91
|
+
async exists(subdir) {
|
|
92
|
+
const dirPath = this.getPath(subdir);
|
|
93
|
+
try {
|
|
94
|
+
await fs.access(dirPath);
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
97
|
+
catch {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
// Synchronous version of exists check
|
|
102
|
+
existsSync(subdir) {
|
|
103
|
+
const dirPath = this.getPath(subdir);
|
|
104
|
+
return existsSync(dirPath);
|
|
105
|
+
}
|
|
95
106
|
}
|
|
96
107
|
export class ConfigManager {
|
|
97
108
|
project;
|
|
@@ -100,10 +111,6 @@ export class ConfigManager {
|
|
|
100
111
|
this.project = new DirectoryProvider(path.join(process.cwd(), ".acai"));
|
|
101
112
|
this.app = new DirectoryProvider(path.join(homedir(), ".acai"));
|
|
102
113
|
}
|
|
103
|
-
// Get the log directory that's accessible via bash tool
|
|
104
|
-
getAccessibleLogDir() {
|
|
105
|
-
return this.app.getPath("logs");
|
|
106
|
-
}
|
|
107
114
|
async _readConfig(configPath) {
|
|
108
115
|
try {
|
|
109
116
|
const data = await fs.readFile(configPath, "utf8");
|
|
@@ -152,17 +159,31 @@ export class ConfigManager {
|
|
|
152
159
|
await this.app.ensurePath();
|
|
153
160
|
await fs.writeFile(configPath, JSON.stringify(configData, null, 2));
|
|
154
161
|
}
|
|
155
|
-
async
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
162
|
+
async readAgentsFiles() {
|
|
163
|
+
const files = [];
|
|
164
|
+
const agentsPaths = [
|
|
165
|
+
{
|
|
166
|
+
absolute: path.join(this.app.getPath(), "AGENTS.md"),
|
|
167
|
+
relative: "~/.acai/AGENTS.md",
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
absolute: path.join(process.cwd(), "AGENTS.md"),
|
|
171
|
+
relative: "./AGENTS.md",
|
|
172
|
+
},
|
|
173
|
+
];
|
|
174
|
+
for (const { absolute, relative } of agentsPaths) {
|
|
175
|
+
try {
|
|
176
|
+
const content = await fs.readFile(absolute, "utf8");
|
|
177
|
+
files.push({
|
|
178
|
+
path: relative,
|
|
179
|
+
content,
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
catch (_error) {
|
|
183
|
+
// ignore
|
|
163
184
|
}
|
|
164
|
-
throw error;
|
|
165
185
|
}
|
|
186
|
+
return files;
|
|
166
187
|
}
|
|
167
188
|
async writeAgentsFile(rules) {
|
|
168
189
|
const agentsPath = path.join(process.cwd(), "AGENTS.md");
|
|
@@ -190,6 +211,10 @@ export class ConfigManager {
|
|
|
190
211
|
}
|
|
191
212
|
}
|
|
192
213
|
async writeProjectLearnedRulesFile(rules) {
|
|
214
|
+
// Only write project rules if the project directory exists
|
|
215
|
+
if (!(await this.project.exists())) {
|
|
216
|
+
return; // Silently return if project directory doesn't exist
|
|
217
|
+
}
|
|
193
218
|
const rulesDir = await this.project.ensurePath("rules");
|
|
194
219
|
const rulesPath = path.join(rulesDir, "learned-rules.md");
|
|
195
220
|
try {
|
package/dist/dedent.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dedent.d.ts","sourceRoot":"","sources":["../source/dedent.ts"],"names":[],"mappings":"AAAA,KAAK,MAAM,GAAG,CAAC,OAAO,EAAE,oBAAoB,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,KAAK,MAAM,CAAC;AAI9E,eAAO,MAAM,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"dedent.d.ts","sourceRoot":"","sources":["../source/dedent.ts"],"names":[],"mappings":"AAAA,KAAK,MAAM,GAAG,CAAC,OAAO,EAAE,oBAAoB,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,KAAK,MAAM,CAAC;AAI9E,eAAO,MAAM,MAAM,EAAE,MA+CpB,CAAC"}
|
package/dist/dedent.js
CHANGED
|
@@ -3,13 +3,13 @@ export const dedent = (strings, ...values) => {
|
|
|
3
3
|
// Perform interpolation
|
|
4
4
|
let result = "";
|
|
5
5
|
for (let i = 0; i < strings.raw.length; i++) {
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
const raw = strings.raw[i] ?? "";
|
|
7
|
+
// handle escaped newlines, backticks, and interpolation characters
|
|
8
|
+
const next = raw
|
|
9
|
+
.replace(/\\\n[ \t]*/g, "")
|
|
10
|
+
.replace(/\\`/g, "`")
|
|
11
|
+
.replace(/\\\$/g, "$")
|
|
12
|
+
.replace(/\\\{/g, "{");
|
|
13
13
|
result += next;
|
|
14
14
|
if (i < values.length) {
|
|
15
15
|
result += values[i];
|
|
@@ -56,6 +56,7 @@ interface TrackedBackgroundProcess extends BackgroundProcess {
|
|
|
56
56
|
* Execution environment manager
|
|
57
57
|
*/
|
|
58
58
|
interface ExecutionConfig {
|
|
59
|
+
/** Value for NODE_ENV environment variable (defaults to "production") */
|
|
59
60
|
env?: string;
|
|
60
61
|
execution?: {
|
|
61
62
|
cwd?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/execution/index.ts"],"names":[],"mappings":"AASA;;GAEG;AACH,UAAU,eAAe;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAA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gCAAgC,CAC9B,WAAW,EAAE,MAAM,GAClB,wBAAwB,EAAE;IAa7B;;OAEG;IACH,iCAAiC,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IAgB5D;;OAEG;IACH,0BAA0B,IAAI,IAAI;IAgBlC;;OAEG;IACH,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAgCtC;;OAEG;IACH,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAK5C;;OAEG;IACH,mBAAmB,IAAI,MAAM;IAI7B;;OAEG;IACH,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAKzD;;OAEG;IACH,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;CAGzD;AAED;;GAEG;AACH,wBAAsB,wBAAwB,CAC5C,MAAM,GAAE,eAAoB,GAC3B,OAAO,CAAC,oBAAoB,CAAC,CAqB/B"}
|
package/dist/execution/index.js
CHANGED
|
@@ -56,9 +56,10 @@ export class ExecutionEnvironment {
|
|
|
56
56
|
constructor(config = {}) {
|
|
57
57
|
this.config = config;
|
|
58
58
|
this.workingDirectory = config.execution?.cwd || process.cwd();
|
|
59
|
-
// Set up environment variables
|
|
59
|
+
// Set up environment variables - filter out undefined values from process.env
|
|
60
|
+
const filteredEnv = Object.fromEntries(Object.entries(process.env).filter((entry) => entry[1] !== undefined));
|
|
60
61
|
this.environmentVariables = {
|
|
61
|
-
...
|
|
62
|
+
...filteredEnv,
|
|
62
63
|
// biome-ignore lint/style/useNamingConvention: environment variable.
|
|
63
64
|
NODE_ENV: config.env || "production",
|
|
64
65
|
...(config.execution?.env || {}),
|
|
@@ -130,6 +131,23 @@ export class ExecutionEnvironment {
|
|
|
130
131
|
});
|
|
131
132
|
return;
|
|
132
133
|
}
|
|
134
|
+
let settled = false;
|
|
135
|
+
let abortHandler;
|
|
136
|
+
const settle = (result, shouldReject, error) => {
|
|
137
|
+
if (settled)
|
|
138
|
+
return;
|
|
139
|
+
settled = true;
|
|
140
|
+
// Clean up abort listener
|
|
141
|
+
if (abortHandler) {
|
|
142
|
+
options.abortSignal?.removeEventListener("abort", abortHandler);
|
|
143
|
+
}
|
|
144
|
+
if (shouldReject && error) {
|
|
145
|
+
reject(error);
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
resolve(result);
|
|
149
|
+
}
|
|
150
|
+
};
|
|
133
151
|
const childProcess = exec(command, {
|
|
134
152
|
cwd,
|
|
135
153
|
env,
|
|
@@ -145,65 +163,50 @@ export class ExecutionEnvironment {
|
|
|
145
163
|
? `${stdout}${stderr ? stderr : ""}`
|
|
146
164
|
: stdout;
|
|
147
165
|
if (error) {
|
|
166
|
+
const exitCode = error.code ?? 1;
|
|
148
167
|
logger.error({
|
|
149
168
|
error: error.message,
|
|
150
|
-
exitCode
|
|
169
|
+
exitCode,
|
|
151
170
|
duration,
|
|
152
171
|
}, `Command execution failed: ${command}`);
|
|
153
|
-
|
|
172
|
+
settle({
|
|
154
173
|
output: preserveOutputOnError ? output : "",
|
|
155
|
-
exitCode
|
|
174
|
+
exitCode,
|
|
156
175
|
error,
|
|
157
176
|
command,
|
|
158
177
|
duration,
|
|
159
|
-
};
|
|
160
|
-
if (throwOnError) {
|
|
161
|
-
reject(error);
|
|
162
|
-
}
|
|
163
|
-
else {
|
|
164
|
-
resolve(result);
|
|
165
|
-
}
|
|
178
|
+
}, throwOnError, error);
|
|
166
179
|
}
|
|
167
180
|
else {
|
|
168
181
|
logger.debug({
|
|
169
182
|
duration,
|
|
170
183
|
outputLength: output.length,
|
|
171
184
|
}, `Command executed successfully: ${command}`);
|
|
172
|
-
|
|
185
|
+
settle({
|
|
173
186
|
output,
|
|
174
187
|
exitCode: 0,
|
|
175
188
|
command,
|
|
176
189
|
duration,
|
|
177
|
-
});
|
|
190
|
+
}, false);
|
|
178
191
|
}
|
|
179
192
|
});
|
|
180
193
|
// Handle abort signal
|
|
181
194
|
if (options.abortSignal) {
|
|
182
|
-
|
|
195
|
+
abortHandler = () => {
|
|
183
196
|
logger.warn({ command, pid: childProcess.pid }, "Command execution aborted");
|
|
184
197
|
childProcess.kill("SIGTERM");
|
|
185
198
|
const error = new Error("Command execution aborted");
|
|
186
|
-
|
|
187
|
-
output:
|
|
199
|
+
settle({
|
|
200
|
+
output: "",
|
|
188
201
|
exitCode: 1,
|
|
189
202
|
error,
|
|
190
203
|
command,
|
|
191
204
|
duration: Date.now() - startTime,
|
|
192
|
-
};
|
|
193
|
-
if (throwOnError) {
|
|
194
|
-
reject(error);
|
|
195
|
-
}
|
|
196
|
-
else {
|
|
197
|
-
resolve(result);
|
|
198
|
-
}
|
|
205
|
+
}, throwOnError, error);
|
|
199
206
|
};
|
|
200
207
|
options.abortSignal.addEventListener("abort", abortHandler, {
|
|
201
208
|
once: true,
|
|
202
209
|
});
|
|
203
|
-
// Clean up abort listener when process completes
|
|
204
|
-
childProcess.on("exit", () => {
|
|
205
|
-
options.abortSignal?.removeEventListener("abort", abortHandler);
|
|
206
|
-
});
|
|
207
210
|
}
|
|
208
211
|
});
|
|
209
212
|
}
|
|
@@ -228,20 +231,23 @@ export class ExecutionEnvironment {
|
|
|
228
231
|
...ttySizeEnv(),
|
|
229
232
|
...(options.env || {}),
|
|
230
233
|
};
|
|
231
|
-
const shell = options.shell ||
|
|
232
|
-
this.config.execution?.shell ||
|
|
233
|
-
process.env["SHELL"] ||
|
|
234
|
-
"bash";
|
|
234
|
+
const shell = options.shell || this.config.execution?.shell || getShell();
|
|
235
235
|
logger.debug({
|
|
236
236
|
command,
|
|
237
237
|
cwd,
|
|
238
238
|
shell,
|
|
239
239
|
hasAbortSignal: !!options.abortSignal,
|
|
240
240
|
}, "Executing command in background");
|
|
241
|
-
// Check if already aborted
|
|
241
|
+
// Check if already aborted - return a dead process handle for consistency
|
|
242
242
|
if (options.abortSignal?.aborted) {
|
|
243
243
|
logger.warn({ command }, "Background command execution aborted before starting");
|
|
244
|
-
|
|
244
|
+
return {
|
|
245
|
+
pid: -1,
|
|
246
|
+
kill: () => false,
|
|
247
|
+
get isRunning() {
|
|
248
|
+
return false;
|
|
249
|
+
},
|
|
250
|
+
};
|
|
245
251
|
}
|
|
246
252
|
// Spawn the process
|
|
247
253
|
const childProcess = spawn(command, [], {
|
|
@@ -253,8 +259,12 @@ export class ExecutionEnvironment {
|
|
|
253
259
|
});
|
|
254
260
|
const pid = childProcess.pid ?? -1;
|
|
255
261
|
let isRunning = true;
|
|
256
|
-
// Update tracked process with actual PID and kill function
|
|
262
|
+
// Update tracked process with actual PID, isRunning getter, and kill function
|
|
257
263
|
trackedProcess.pid = pid;
|
|
264
|
+
Object.defineProperty(trackedProcess, "isRunning", {
|
|
265
|
+
get: () => isRunning,
|
|
266
|
+
enumerable: true,
|
|
267
|
+
});
|
|
258
268
|
trackedProcess.kill = () => {
|
|
259
269
|
if (isRunning) {
|
|
260
270
|
childProcess.kill();
|
|
@@ -316,11 +326,13 @@ export class ExecutionEnvironment {
|
|
|
316
326
|
once: true,
|
|
317
327
|
});
|
|
318
328
|
}
|
|
319
|
-
// Create the public process handle
|
|
329
|
+
// Create the public process handle with getter for live isRunning state
|
|
320
330
|
const backgroundProcess = {
|
|
321
331
|
pid,
|
|
322
332
|
kill: trackedProcess.kill,
|
|
323
|
-
isRunning
|
|
333
|
+
get isRunning() {
|
|
334
|
+
return isRunning;
|
|
335
|
+
},
|
|
324
336
|
};
|
|
325
337
|
// Track the process
|
|
326
338
|
this.backgroundProcesses.set(pid, trackedProcess);
|
|
@@ -441,34 +453,18 @@ export async function initExecutionEnvironment(config = {}) {
|
|
|
441
453
|
return executionEnv;
|
|
442
454
|
}
|
|
443
455
|
}
|
|
444
|
-
//
|
|
445
|
-
|
|
446
|
-
// let args: string[] = [];
|
|
447
|
-
// const useShellOption = false;
|
|
448
|
-
// if (platformName === "win32") {
|
|
449
|
-
// const { execSync } = await import("node:child_process");
|
|
450
|
-
// try {
|
|
451
|
-
// execSync("where wsl", { stdio: "ignore" });
|
|
452
|
-
// cmd = "wsl.exe";
|
|
453
|
-
// args = ["--", command];
|
|
454
|
-
// } catch {
|
|
455
|
-
// cmd = "powershell.exe";
|
|
456
|
-
// args = ["-NoProfile", "-NonInteractive", "-Command", command];
|
|
457
|
-
// }
|
|
458
|
-
// } else {
|
|
459
|
-
// const shell = process.env["SHELL"] || "/bin/bash";
|
|
460
|
-
// cmd = shell;
|
|
461
|
-
// args = ["-c", command];
|
|
462
|
-
// }
|
|
456
|
+
// Track registered execution environments for cleanup
|
|
457
|
+
const registeredForCleanup = new WeakSet();
|
|
463
458
|
// Set up cleanup on process exit
|
|
464
459
|
function setupProcessCleanup(executionEnv) {
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
});
|
|
471
|
-
process.on("SIGTERM", () => {
|
|
460
|
+
if (registeredForCleanup.has(executionEnv)) {
|
|
461
|
+
return;
|
|
462
|
+
}
|
|
463
|
+
registeredForCleanup.add(executionEnv);
|
|
464
|
+
const cleanup = () => {
|
|
472
465
|
executionEnv.killAllBackgroundProcesses();
|
|
473
|
-
}
|
|
466
|
+
};
|
|
467
|
+
process.on("exit", cleanup);
|
|
468
|
+
process.on("SIGINT", cleanup);
|
|
469
|
+
process.on("SIGTERM", cleanup);
|
|
474
470
|
}
|
package/dist/formatting.d.ts
CHANGED
|
@@ -130,4 +130,31 @@ export declare const formatDuration: (milliseconds: number) => string;
|
|
|
130
130
|
* ```
|
|
131
131
|
*/
|
|
132
132
|
export declare const formatNumber: (num: number) => string;
|
|
133
|
+
/**
|
|
134
|
+
* Formats a date into a human-readable string.
|
|
135
|
+
*
|
|
136
|
+
* @param date - The date to format
|
|
137
|
+
* @returns A formatted date string in the format "MMM DD, YYYY HH:MM:SS AM/PM"
|
|
138
|
+
*
|
|
139
|
+
* @example
|
|
140
|
+
* ```typescript
|
|
141
|
+
* formatDate(new Date("2023-12-25T14:30:00")) // Returns: "Dec 25, 2023, 02:30:00 PM"
|
|
142
|
+
* ```
|
|
143
|
+
*/
|
|
144
|
+
export declare const formatDate: (date: Date) => string;
|
|
145
|
+
/**
|
|
146
|
+
* Formats a number as a percentage with one decimal place.
|
|
147
|
+
*
|
|
148
|
+
* @param n - The numerator
|
|
149
|
+
* @param d - The denominator
|
|
150
|
+
* @returns A formatted percentage string (e.g., "12.5%")
|
|
151
|
+
*
|
|
152
|
+
* @example
|
|
153
|
+
* ```typescript
|
|
154
|
+
* formatPercentage(25, 100) // Returns: "25.0%"
|
|
155
|
+
* formatPercentage(1, 3) // Returns: "33.3%"
|
|
156
|
+
* formatPercentage(0, 0) // Returns: "0.0%"
|
|
157
|
+
* ```
|
|
158
|
+
*/
|
|
159
|
+
export declare const formatPercentage: (n: number, d: number) => string;
|
|
133
160
|
//# sourceMappingURL=formatting.d.ts.map
|
package/dist/formatting.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatting.d.ts","sourceRoot":"","sources":["../source/formatting.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,UAAU,GAAG,SAAS,CAAC;AAExD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,UAAU,GACjB,MAAM,CAaR;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,SAAS,CACvB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,UAAU,GACjB,MAAM,CAWR;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAIrE;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,WAAW,CACzB,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,UA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