@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/prompts.js
CHANGED
|
@@ -1,45 +1,69 @@
|
|
|
1
|
-
import { execSync } from "node:child_process";
|
|
2
|
-
import { readFile } from "node:fs/promises";
|
|
3
1
|
import { platform } from "node:os";
|
|
4
|
-
import path from "node:path";
|
|
5
2
|
import { config } from "./config.js";
|
|
6
3
|
import { dedent } from "./dedent.js";
|
|
7
4
|
import { formatSkillsForPrompt, loadSkills } from "./skills.js";
|
|
8
5
|
import { getShell } from "./terminal/index.js";
|
|
9
|
-
import { AgentTool } from "./tools/agent.js";
|
|
10
|
-
import { BashTool } from "./tools/bash.js";
|
|
11
|
-
import { CodeInterpreterTool } from "./tools/code-interpreter.js";
|
|
12
|
-
import { DeleteFileTool } from "./tools/delete-file.js";
|
|
13
|
-
import { DirectoryTreeTool } from "./tools/directory-tree.js";
|
|
14
|
-
import { EditFileTool } from "./tools/edit-file.js";
|
|
15
|
-
import { GrepTool } from "./tools/grep.js";
|
|
16
|
-
import { ReadFileTool } from "./tools/read-file.js";
|
|
17
|
-
import { ReadMultipleFilesTool } from "./tools/read-multiple-files.js";
|
|
18
|
-
import { SaveFileTool } from "./tools/save-file.js";
|
|
19
|
-
import { ThinkTool } from "./tools/think.js";
|
|
20
|
-
import { WebFetchTool } from "./tools/web-fetch.js";
|
|
21
|
-
import { WebSearchTool } from "./tools/web-search.js";
|
|
22
6
|
import { getCurrentBranch, inGitDirectory } from "./utils/git.js";
|
|
23
|
-
async function
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
7
|
+
async function getProjectContext() {
|
|
8
|
+
const agentsFiles = await config.readAgentsFiles();
|
|
9
|
+
const userAgentsFile = agentsFiles.find((f) => f.path === "~/.acai/AGENTS.md");
|
|
10
|
+
const cwdAgentsFile = agentsFiles.find((f) => f.path === "./AGENTS.md");
|
|
11
|
+
const userRules = (userAgentsFile?.content ?? "").trim();
|
|
12
|
+
const cwdRules = (cwdAgentsFile?.content ?? "").trim();
|
|
13
|
+
const learnedRules = (await config.readProjectLearnedRulesFile()).trim();
|
|
14
|
+
let result = "";
|
|
15
|
+
if (userRules || cwdRules) {
|
|
16
|
+
result += "## Project Context:\n\n";
|
|
17
|
+
if (userRules) {
|
|
18
|
+
result += `### ~/.acai/AGENTS.md\n\n<instructions>\n${userRules}\n</instructions>\n\n`;
|
|
19
|
+
}
|
|
20
|
+
if (cwdRules) {
|
|
21
|
+
result += `### ./AGENTS.md\n\n<instructions>\n${cwdRules}\n</instructions>\n\n`;
|
|
22
|
+
}
|
|
28
23
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
if (learnedRules) {
|
|
25
|
+
if (!userRules && !cwdRules) {
|
|
26
|
+
result += "## Project Rules:\n\n";
|
|
27
|
+
}
|
|
28
|
+
result += `### Important rules to follow\n\n${learnedRules}`;
|
|
32
29
|
}
|
|
30
|
+
return result.trim();
|
|
33
31
|
}
|
|
34
|
-
function
|
|
35
|
-
|
|
32
|
+
async function environmentInfo(allowedDirs) {
|
|
33
|
+
const gitDirectory = await inGitDirectory();
|
|
34
|
+
let gitSection = `- **Is directory a git repo**: ${gitDirectory ? "Yes" : "No"}`;
|
|
35
|
+
if (gitDirectory) {
|
|
36
|
+
gitSection += `\n- **Current git branch**: ${await getCurrentBranch()}`;
|
|
37
|
+
}
|
|
38
|
+
return `## Environment
|
|
39
|
+
|
|
40
|
+
### Allowed directories:
|
|
41
|
+
|
|
42
|
+
${allowedDirs.map((dir) => `- ${dir}`).join("\n")}
|
|
43
|
+
|
|
44
|
+
### Information:
|
|
45
|
+
|
|
46
|
+
${gitSection}
|
|
47
|
+
- **Platform**: ${platform()}
|
|
48
|
+
- **Shell**: ${getShell()}
|
|
49
|
+
- **Today's date**: ${new Date().toISOString().split("T")[0]}
|
|
50
|
+
|
|
51
|
+
- Note: The .tmp directory in the current working directory is deleted each time the agent shuts down.`;
|
|
36
52
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
53
|
+
const DEFAULT_ALLOWED_DIRS = [process.cwd()];
|
|
54
|
+
export async function systemPrompt(options) {
|
|
55
|
+
const { allowedDirs = DEFAULT_ALLOWED_DIRS, includeRules = true, skillsEnabled = true, } = options ?? {};
|
|
56
|
+
const projectContextText = includeRules ? await getProjectContext() : "";
|
|
57
|
+
const environmentInfoText = await environmentInfo(allowedDirs);
|
|
58
|
+
let skillsText = "";
|
|
59
|
+
if (skillsEnabled) {
|
|
60
|
+
const skills = await loadSkills();
|
|
61
|
+
skillsText = formatSkillsForPrompt(skills);
|
|
41
62
|
}
|
|
42
|
-
|
|
63
|
+
const prompt = dedent `
|
|
64
|
+
You are acai. You are running as a coding agent in a CLI on the user's computer.
|
|
65
|
+
|
|
66
|
+
## Core Principles
|
|
43
67
|
|
|
44
68
|
- **CLI-Optimized**: Be concise and direct - responses appear in a terminal. Be extremely concise. Sacrifice grammar for the sake of concision.
|
|
45
69
|
- **Progressive Problem Solving**: Work through problems methodically until resolution.
|
|
@@ -159,325 +183,7 @@ DEFAULT TO PARALLEL: Unless you have a specific reason why operations MUST be se
|
|
|
159
183
|
- Never hardcode secrets; prevent injection attacks, XSS, unauthorized access
|
|
160
184
|
- Apply principle of least privilege in API integrations
|
|
161
185
|
- If a tool fails, ask the user how to proceed
|
|
162
|
-
- Report errors with specific locations and suggested fixes
|
|
163
|
-
}
|
|
164
|
-
async function minimalInstructions() {
|
|
165
|
-
const systemMdPath = await getCustomSystemPrompt();
|
|
166
|
-
if (systemMdPath) {
|
|
167
|
-
return systemMdPath;
|
|
168
|
-
}
|
|
169
|
-
return `- Be concise and direct
|
|
170
|
-
- Work through problems methodically until resolution
|
|
171
|
-
- Continue working until the user's query is completely resolved.
|
|
172
|
-
- Assume the user is an experienced software engineer.`;
|
|
173
|
-
}
|
|
174
|
-
const toolSections = [
|
|
175
|
-
{
|
|
176
|
-
id: "information-gathering-file-system",
|
|
177
|
-
title: "#### File System",
|
|
178
|
-
tools: [
|
|
179
|
-
ReadFileTool.name,
|
|
180
|
-
ReadMultipleFilesTool.name,
|
|
181
|
-
GrepTool.name,
|
|
182
|
-
AgentTool.name,
|
|
183
|
-
DirectoryTreeTool.name,
|
|
184
|
-
],
|
|
185
|
-
content: (_activeTools, allActiveTools) => {
|
|
186
|
-
const lines = [];
|
|
187
|
-
// Helper to check if tool is active
|
|
188
|
-
const isActive = (tool) => allActiveTools === undefined ||
|
|
189
|
-
allActiveTools.includes(tool);
|
|
190
|
-
// Read tools
|
|
191
|
-
const readTools = [];
|
|
192
|
-
if (isActive(ReadFileTool.name))
|
|
193
|
-
readTools.push(`\`${ReadFileTool.name}\``);
|
|
194
|
-
if (isActive(ReadMultipleFilesTool.name))
|
|
195
|
-
readTools.push(`\`${ReadMultipleFilesTool.name}\``);
|
|
196
|
-
if (readTools.length > 0) {
|
|
197
|
-
lines.push(`- Use ${readTools.join(" or ")} for file contents if filenames are provided in the prompt. If you do not know the path to a file use one of the following tools to find the files available.`);
|
|
198
|
-
}
|
|
199
|
-
if (isActive(GrepTool.name)) {
|
|
200
|
-
lines.push(`- Use \`${GrepTool.name}\` for code pattern searches`);
|
|
201
|
-
}
|
|
202
|
-
if (isActive(AgentTool.name)) {
|
|
203
|
-
lines.push(`- Use \`${AgentTool.name}\` for iterative keyword/file searches. Use this if you need to explore the project to find what you are looking for.`);
|
|
204
|
-
}
|
|
205
|
-
if (isActive(DirectoryTreeTool.name)) {
|
|
206
|
-
lines.push(`- Use \`${DirectoryTreeTool.name}\` if you need a high-level overview of the project.`);
|
|
207
|
-
}
|
|
208
|
-
// Add general guidelines that reference specific tools only if those tools are active
|
|
209
|
-
if (isActive(GrepTool.name) && isActive(ReadMultipleFilesTool.name)) {
|
|
210
|
-
lines.push(`- Prefer targeted queries: use \`${GrepTool.name}\` for code pattern searches and \`${ReadMultipleFilesTool.name}\` to fetch files. Avoid full directory dumps for large repositories.`);
|
|
211
|
-
}
|
|
212
|
-
// Add general guidelines that don't reference specific tools
|
|
213
|
-
lines.push("- If the contents of files are provided in the prompt, assume the content is up-to-date and use it directly without re-fetching");
|
|
214
|
-
lines.push("- Always verify file contents before suggesting changes unless provided in the prompt");
|
|
215
|
-
return lines.join("\n");
|
|
216
|
-
},
|
|
217
|
-
},
|
|
218
|
-
{
|
|
219
|
-
id: "information-gathering-web",
|
|
220
|
-
title: "#### Web and Internet",
|
|
221
|
-
tools: [WebFetchTool.name, WebSearchTool.name],
|
|
222
|
-
content: (_activeTools, allActiveTools) => {
|
|
223
|
-
const lines = [];
|
|
224
|
-
const isActive = (tool) => allActiveTools === undefined ||
|
|
225
|
-
allActiveTools.includes(tool);
|
|
226
|
-
if (isActive(WebFetchTool.name)) {
|
|
227
|
-
lines.push(`- Use \`${WebFetchTool.name}\` for text-based URLs provided in the prompt`);
|
|
228
|
-
}
|
|
229
|
-
if (isActive(WebSearchTool.name)) {
|
|
230
|
-
lines.push(`- Use \`${WebSearchTool.name}\` for external research (e.g., libraries, errors)`);
|
|
231
|
-
}
|
|
232
|
-
// Add general guideline
|
|
233
|
-
lines.push("- If the contents of URLs are provided in the prompt, assume the content is up-to-date and use it directly without re-fetching");
|
|
234
|
-
return lines.join("\n");
|
|
235
|
-
},
|
|
236
|
-
},
|
|
237
|
-
{
|
|
238
|
-
id: "code-modification",
|
|
239
|
-
title: "### Code Modification",
|
|
240
|
-
tools: [EditFileTool.name, SaveFileTool.name, DeleteFileTool.name],
|
|
241
|
-
content: (_activeTools, allActiveTools) => {
|
|
242
|
-
const lines = [];
|
|
243
|
-
const isActive = (tool) => allActiveTools === undefined ||
|
|
244
|
-
allActiveTools.includes(tool);
|
|
245
|
-
if (isActive(EditFileTool.name)) {
|
|
246
|
-
lines.push(`- Use \`${EditFileTool.name}\` to edit existing files`);
|
|
247
|
-
}
|
|
248
|
-
if (isActive(SaveFileTool.name)) {
|
|
249
|
-
lines.push(`- Use \`${SaveFileTool.name}\` to create new files only`);
|
|
250
|
-
}
|
|
251
|
-
if (isActive(DeleteFileTool.name)) {
|
|
252
|
-
lines.push(`- Use \`${DeleteFileTool.name}\` to delete files`);
|
|
253
|
-
}
|
|
254
|
-
return lines.join("\n");
|
|
255
|
-
},
|
|
256
|
-
},
|
|
257
|
-
{
|
|
258
|
-
id: "planning-complex-tasks",
|
|
259
|
-
title: "### Planning & Complex Tasks",
|
|
260
|
-
tools: [ThinkTool.name],
|
|
261
|
-
content: (_activeTools, allActiveTools) => {
|
|
262
|
-
const isActive = (tool) => allActiveTools === undefined ||
|
|
263
|
-
allActiveTools.includes(tool);
|
|
264
|
-
if (isActive(ThinkTool.name)) {
|
|
265
|
-
return `- Use \`${ThinkTool.name}\` for structured reasoning on complex problems\n- Outline multi-step tasks before execution`;
|
|
266
|
-
}
|
|
267
|
-
return "";
|
|
268
|
-
},
|
|
269
|
-
},
|
|
270
|
-
{
|
|
271
|
-
id: "bash-commands",
|
|
272
|
-
title: `### Bash Commands (\`${BashTool.name}\`)`,
|
|
273
|
-
tools: [BashTool.name],
|
|
274
|
-
content: (_activeTools, allActiveTools) => {
|
|
275
|
-
const isActive = (tool) => allActiveTools === undefined ||
|
|
276
|
-
allActiveTools.includes(tool);
|
|
277
|
-
if (isActive(BashTool.name)) {
|
|
278
|
-
return `- Execute commands with a sandboxed executor that supports pipes (|), conditional chaining (&&, ||, ;), and redirection (> >> < 2> 2>>).\n- Run single commands or compose multi-step flows using shell operators.\n- For extremely large gh/git messages:\n 1. Create temp file with ${SaveFileTool.name} in the project's .tmp directory\n 2. Use git commit --file path/to/temp/file or gh pr create --title "Title of PR" --body-file path/to/temp/file\n- Note: The .tmp directory in the current working directory is deleted each time the agent shuts down.\n- Commands execute only within the project directory; always use absolute paths.\n- Avoid interactive commands; prefer non-interactive flags (e.g., npm init -y).\n\n#### Tools available via \`${BashTool.name}\`\n\n${getInstalledTools()}\n\n#### Using acai as sub-agent\n\nYou can run acai in cli mode and it will receive a prompt and return a result. This version of acai is a separate process, but it has access to the same system prompt and tools as you do.\n\nHow to run: \`acai -p <prompt>\``;
|
|
279
|
-
}
|
|
280
|
-
return "";
|
|
281
|
-
},
|
|
282
|
-
},
|
|
283
|
-
{
|
|
284
|
-
id: "code-interpreter",
|
|
285
|
-
title: `### Code Interpreter (\`${CodeInterpreterTool.name}\`)`,
|
|
286
|
-
tools: [CodeInterpreterTool.name],
|
|
287
|
-
content: (_activeTools, allActiveTools) => {
|
|
288
|
-
const isActive = (tool) => allActiveTools === undefined ||
|
|
289
|
-
allActiveTools.includes(tool);
|
|
290
|
-
if (isActive(CodeInterpreterTool.name)) {
|
|
291
|
-
return `- Executes JavaScript code in a separate Node.js process using Node's Permission Model\n- By default, the child process has no permissions except read/write within the current working directory\n- Returns stdout, stderr, and exitCode\n- Use console.log/console.error to produce output`;
|
|
292
|
-
}
|
|
293
|
-
return "";
|
|
294
|
-
},
|
|
295
|
-
},
|
|
296
|
-
{
|
|
297
|
-
id: "git-workflow",
|
|
298
|
-
title: "### Git Workflow",
|
|
299
|
-
tools: [], // This section doesn't have its own tools
|
|
300
|
-
dependencies: [BashTool.name], // Only show if bash tool is active
|
|
301
|
-
content: () => {
|
|
302
|
-
return "- Always stage changes before attempting to commit them\n- Never amend git commits without approval from the user\n- Never use `git add -A` when preparing for multiple, distinct commits; instead, selectively add files or hunks relevant to each commit\n- Always use `git checkout -b <branch-name>` with a branch name that accurately reflects the *type* of changes being made\n- Never stage changes for files that are specified in `.gitignore`\n- Always stage changes after running a formatter that modifies files, before attempting to commit";
|
|
303
|
-
},
|
|
304
|
-
},
|
|
305
|
-
{
|
|
306
|
-
id: "efficiency-guidelines",
|
|
307
|
-
title: "### Efficiency Guidelines",
|
|
308
|
-
tools: [],
|
|
309
|
-
alwaysInclude: true,
|
|
310
|
-
content: () => {
|
|
311
|
-
return "- Always use the most efficient workflow to complete tasks\n- Never re-read file content that has already been provided in the current turn or is directly accessible via a tool; instead, reuse the provided content or reference the file path directly\n- Always use direct file paths or established methods to pass content to tools that accept file input, rather than re-creating content in command strings\n- Always run a build after making code changes to verify correctness";
|
|
312
|
-
},
|
|
313
|
-
},
|
|
314
|
-
];
|
|
315
|
-
function toolUsage(activeTools) {
|
|
316
|
-
const sections = [];
|
|
317
|
-
// Always include the header
|
|
318
|
-
sections.push("## Tool Usage Guidelines");
|
|
319
|
-
// Helper to check if any of the specified tools are active
|
|
320
|
-
const hasAnyTool = (...tools) => {
|
|
321
|
-
// If activeTools is undefined, all tools are active
|
|
322
|
-
if (activeTools === undefined)
|
|
323
|
-
return true;
|
|
324
|
-
// If activeTools is empty array, no tools are active
|
|
325
|
-
if (activeTools.length === 0)
|
|
326
|
-
return false;
|
|
327
|
-
return tools.some((tool) => activeTools.includes(tool));
|
|
328
|
-
};
|
|
329
|
-
// Track if we've added the Information Gathering header
|
|
330
|
-
let addedInformationGatheringHeader = false;
|
|
331
|
-
for (const section of toolSections) {
|
|
332
|
-
// Check if section should be included
|
|
333
|
-
let shouldInclude = false;
|
|
334
|
-
if (section.alwaysInclude) {
|
|
335
|
-
shouldInclude = true;
|
|
336
|
-
}
|
|
337
|
-
else if (section.tools.length > 0) {
|
|
338
|
-
shouldInclude = hasAnyTool(...section.tools);
|
|
339
|
-
}
|
|
340
|
-
else if (section.dependencies) {
|
|
341
|
-
shouldInclude = hasAnyTool(...section.dependencies);
|
|
342
|
-
}
|
|
343
|
-
else {
|
|
344
|
-
// Section with no tools and no dependencies shouldn't be included
|
|
345
|
-
continue;
|
|
346
|
-
}
|
|
347
|
-
if (!shouldInclude) {
|
|
348
|
-
continue;
|
|
349
|
-
}
|
|
350
|
-
// Generate content for the section
|
|
351
|
-
const content = section.content(activeTools, activeTools);
|
|
352
|
-
if (!content.trim()) {
|
|
353
|
-
continue;
|
|
354
|
-
}
|
|
355
|
-
// Handle Information Gathering sections specially
|
|
356
|
-
if (section.id === "information-gathering-file-system" ||
|
|
357
|
-
section.id === "information-gathering-web") {
|
|
358
|
-
if (!addedInformationGatheringHeader) {
|
|
359
|
-
sections.push("\n\n### Information Gathering");
|
|
360
|
-
addedInformationGatheringHeader = true;
|
|
361
|
-
}
|
|
362
|
-
sections.push(`\n\n${section.title}\n${content}`);
|
|
363
|
-
}
|
|
364
|
-
else {
|
|
365
|
-
sections.push(`\n\n${section.title}\n${content}`);
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
return sections.join("");
|
|
369
|
-
}
|
|
370
|
-
async function getProjectContext() {
|
|
371
|
-
const rules = (await config.readAgentsFile()).trim();
|
|
372
|
-
const learnedRules = (await config.readProjectLearnedRulesFile()).trim();
|
|
373
|
-
let result = "";
|
|
374
|
-
if (rules) {
|
|
375
|
-
result += `## Project Context:\n\n### AGENTS.md for ./\n\n<instructions>\n${rules}\n</instructions>\n\n`;
|
|
376
|
-
}
|
|
377
|
-
if (learnedRules) {
|
|
378
|
-
if (!rules) {
|
|
379
|
-
result += "## Project Rules:\n\n";
|
|
380
|
-
}
|
|
381
|
-
result += `### Important rules to follow\n\n${learnedRules}`;
|
|
382
|
-
}
|
|
383
|
-
return result.trim();
|
|
384
|
-
}
|
|
385
|
-
async function environmentInfo(allowedDirs) {
|
|
386
|
-
const gitDirectory = await inGitDirectory();
|
|
387
|
-
let gitSection = `- **Is directory a git repo**: ${gitDirectory ? "Yes" : "No"}`;
|
|
388
|
-
if (gitDirectory) {
|
|
389
|
-
gitSection += `\n- **Current git branch**: ${await getCurrentBranch()}`;
|
|
390
|
-
}
|
|
391
|
-
return `## Environment
|
|
392
|
-
|
|
393
|
-
### Allowed directories:
|
|
394
|
-
|
|
395
|
-
${allowedDirs.map((dir) => `- ${dir}`).join("\n")}
|
|
396
|
-
|
|
397
|
-
### Information:
|
|
398
|
-
|
|
399
|
-
${gitSection}
|
|
400
|
-
- **Platform**: ${platform()}
|
|
401
|
-
- **Shell**: ${getShell()}
|
|
402
|
-
- **Today's date**: ${new Date().toISOString().split("T")[0]}
|
|
403
|
-
|
|
404
|
-
- Note: The .tmp directory in the current working directory is deleted each time the agent shuts down.`;
|
|
405
|
-
}
|
|
406
|
-
export async function systemPrompt(options) {
|
|
407
|
-
const { type = "full" } = options ?? {};
|
|
408
|
-
switch (type) {
|
|
409
|
-
case "full":
|
|
410
|
-
return fullSystemPrompt(options);
|
|
411
|
-
case "minimal":
|
|
412
|
-
return minSystemPrompt(options);
|
|
413
|
-
case "cli":
|
|
414
|
-
return cliSystemPrompt(options);
|
|
415
|
-
default:
|
|
416
|
-
return fullSystemPrompt(options);
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
const DEFAULT_ALLOWED_DIRS = [process.cwd()];
|
|
420
|
-
async function fullSystemPrompt(options) {
|
|
421
|
-
const { allowedDirs = DEFAULT_ALLOWED_DIRS, includeRules = true, skillsEnabled = true, } = options ?? {};
|
|
422
|
-
const instructionsText = await instructions();
|
|
423
|
-
const projectContextText = includeRules ? await getProjectContext() : "";
|
|
424
|
-
const environmentInfoText = await environmentInfo(allowedDirs);
|
|
425
|
-
let skillsText = "";
|
|
426
|
-
if (skillsEnabled) {
|
|
427
|
-
const skills = await loadSkills();
|
|
428
|
-
skillsText = formatSkillsForPrompt(skills);
|
|
429
|
-
}
|
|
430
|
-
const prompt = dedent `
|
|
431
|
-
${intro()}
|
|
432
|
-
|
|
433
|
-
${instructionsText}
|
|
434
|
-
|
|
435
|
-
${projectContextText}
|
|
436
|
-
|
|
437
|
-
${environmentInfoText}${skillsText}
|
|
438
|
-
`;
|
|
439
|
-
return prompt;
|
|
440
|
-
}
|
|
441
|
-
async function minSystemPrompt(options) {
|
|
442
|
-
const { allowedDirs = DEFAULT_ALLOWED_DIRS, activeTools = undefined, includeRules = true, skillsEnabled = true, } = options ?? {};
|
|
443
|
-
const minimalInstructionsText = await minimalInstructions();
|
|
444
|
-
const projectContextText = includeRules ? await getProjectContext() : "";
|
|
445
|
-
const environmentInfoText = await environmentInfo(allowedDirs);
|
|
446
|
-
let skillsText = "";
|
|
447
|
-
if (skillsEnabled) {
|
|
448
|
-
const skills = await loadSkills();
|
|
449
|
-
skillsText = formatSkillsForPrompt(skills);
|
|
450
|
-
}
|
|
451
|
-
const prompt = dedent `
|
|
452
|
-
${intro()}
|
|
453
|
-
|
|
454
|
-
${minimalInstructionsText}
|
|
455
|
-
|
|
456
|
-
${toolUsage(activeTools)}
|
|
457
|
-
|
|
458
|
-
${projectContextText}
|
|
459
|
-
|
|
460
|
-
${environmentInfoText}${skillsText}
|
|
461
|
-
`;
|
|
462
|
-
return prompt;
|
|
463
|
-
}
|
|
464
|
-
async function cliSystemPrompt(options) {
|
|
465
|
-
const { allowedDirs = DEFAULT_ALLOWED_DIRS, activeTools = undefined, skillsEnabled = true, } = options ?? {};
|
|
466
|
-
const minimalInstructionsText = await minimalInstructions();
|
|
467
|
-
const projectContextText = await getProjectContext();
|
|
468
|
-
const environmentInfoText = await environmentInfo(allowedDirs);
|
|
469
|
-
let skillsText = "";
|
|
470
|
-
if (skillsEnabled) {
|
|
471
|
-
const skills = await loadSkills();
|
|
472
|
-
skillsText = formatSkillsForPrompt(skills);
|
|
473
|
-
}
|
|
474
|
-
const prompt = dedent `
|
|
475
|
-
${intro()}
|
|
476
|
-
|
|
477
|
-
${minimalInstructionsText}
|
|
478
|
-
|
|
479
|
-
${activeTools && activeTools.length > 0 ? "Tools:" : ""}
|
|
480
|
-
${activeTools && activeTools.length > 0 ? activeTools.map((tool) => `- ${tool}`).join("\n") : ""}
|
|
186
|
+
- Report errors with specific locations and suggested fixes
|
|
481
187
|
|
|
482
188
|
${projectContextText}
|
|
483
189
|
|
|
@@ -485,59 +191,3 @@ ${environmentInfoText}${skillsText}
|
|
|
485
191
|
`;
|
|
486
192
|
return prompt;
|
|
487
193
|
}
|
|
488
|
-
function getInstalledTools() {
|
|
489
|
-
// Check for required bash tools
|
|
490
|
-
const tools = [
|
|
491
|
-
{
|
|
492
|
-
name: "git",
|
|
493
|
-
command: "git --version",
|
|
494
|
-
description: "Version control system - used for cloning repositories, checking out branches, committing changes, viewing history, and managing code versions",
|
|
495
|
-
},
|
|
496
|
-
{
|
|
497
|
-
name: "gh",
|
|
498
|
-
command: "gh --version",
|
|
499
|
-
description: "GitHub CLI - used for creating pull requests, managing issues, interacting with GitHub API, and automating GitHub workflows",
|
|
500
|
-
},
|
|
501
|
-
{
|
|
502
|
-
name: "rg",
|
|
503
|
-
command: "rg --version",
|
|
504
|
-
description: "ripgrep - fast text search tool for searching code patterns, file contents, and regular expressions across the codebase (use this instead of grep)",
|
|
505
|
-
},
|
|
506
|
-
{
|
|
507
|
-
name: "fd",
|
|
508
|
-
command: "fd --version",
|
|
509
|
-
description: "Fast file finder - alternative to find command, used for finding files by name, pattern, or type with intuitive syntax (use this instead of find)",
|
|
510
|
-
},
|
|
511
|
-
{
|
|
512
|
-
name: "ast-grep",
|
|
513
|
-
command: "ast-grep --version",
|
|
514
|
-
description: "AST-based code search - used for structural code search, refactoring, finding patterns in abstract syntax trees, and code transformations",
|
|
515
|
-
},
|
|
516
|
-
{
|
|
517
|
-
name: "jq",
|
|
518
|
-
command: "jq --version",
|
|
519
|
-
description: "JSON processor - used for parsing, filtering, and manipulating JSON output from APIs, commands, and configuration files",
|
|
520
|
-
},
|
|
521
|
-
{
|
|
522
|
-
name: "yq",
|
|
523
|
-
command: "yq --version",
|
|
524
|
-
description: "YAML processor - used for parsing and manipulating YAML files (configs, CI/CD pipelines, Kubernetes manifests) with jq-like syntax",
|
|
525
|
-
},
|
|
526
|
-
];
|
|
527
|
-
const toolStatus = tools
|
|
528
|
-
.map((tool) => {
|
|
529
|
-
let status = false;
|
|
530
|
-
try {
|
|
531
|
-
execSync(tool.command, { stdio: "ignore", timeout: 5000 });
|
|
532
|
-
status = true;
|
|
533
|
-
}
|
|
534
|
-
catch (_error) {
|
|
535
|
-
// Ignore error, tool is not installed
|
|
536
|
-
}
|
|
537
|
-
return { name: tool.name, description: tool.description, status };
|
|
538
|
-
})
|
|
539
|
-
.filter((tool) => tool.status)
|
|
540
|
-
.map((tool) => `- **${tool.name}**: ${tool.description}`)
|
|
541
|
-
.join("\n");
|
|
542
|
-
return toolStatus;
|
|
543
|
-
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface ProjectStatusData {
|
|
2
|
+
path: string;
|
|
3
|
+
isGitRepository: boolean;
|
|
4
|
+
branch?: string;
|
|
5
|
+
hasChanges: boolean;
|
|
6
|
+
fileChanges: {
|
|
7
|
+
added: number;
|
|
8
|
+
modified: number;
|
|
9
|
+
deleted: number;
|
|
10
|
+
untracked: number;
|
|
11
|
+
};
|
|
12
|
+
diffStats: {
|
|
13
|
+
insertions: number;
|
|
14
|
+
deletions: number;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export declare function getProjectStatus(): Promise<ProjectStatusData>;
|
|
18
|
+
export declare function clearProjectStatusCache(): void;
|
|
19
|
+
//# sourceMappingURL=project-status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-status.d.ts","sourceRoot":"","sources":["../../source/repl/project-status.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,EAAE,OAAO,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE;QACX,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,SAAS,EAAE;QACT,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;CACH;AAqFD,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,iBAAiB,CAAC,CAEnE;AAID,wBAAgB,uBAAuB,IAAI,IAAI,CAE9C"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { getCurrentBranch, getDiffStat, getGitStatus, inGitDirectory, } from "../utils/git.js";
|
|
2
|
+
// Cache for project status to prevent excessive Git operations
|
|
3
|
+
class ProjectStatus {
|
|
4
|
+
cachedStatus = null;
|
|
5
|
+
cacheTime = 0;
|
|
6
|
+
cacheTtl = 2000; // 2 seconds
|
|
7
|
+
async get() {
|
|
8
|
+
const now = Date.now();
|
|
9
|
+
// Return cached status if it's still valid
|
|
10
|
+
if (this.cachedStatus && now - this.cacheTime < this.cacheTtl) {
|
|
11
|
+
return this.cachedStatus;
|
|
12
|
+
}
|
|
13
|
+
// const currentDir = process.cwd().split("/").pop() || process.cwd();
|
|
14
|
+
let pwd = process.cwd();
|
|
15
|
+
const home = process.env["HOME"] || process.env["USERPROFILE"];
|
|
16
|
+
if (home && pwd.startsWith(home)) {
|
|
17
|
+
pwd = `~${pwd.slice(home.length)}`;
|
|
18
|
+
}
|
|
19
|
+
const currentDir = pwd;
|
|
20
|
+
let status = {
|
|
21
|
+
path: currentDir,
|
|
22
|
+
isGitRepository: false,
|
|
23
|
+
fileChanges: {
|
|
24
|
+
added: 0,
|
|
25
|
+
modified: 0,
|
|
26
|
+
deleted: 0,
|
|
27
|
+
untracked: 0,
|
|
28
|
+
},
|
|
29
|
+
diffStats: {
|
|
30
|
+
insertions: 0,
|
|
31
|
+
deletions: 0,
|
|
32
|
+
},
|
|
33
|
+
hasChanges: false,
|
|
34
|
+
};
|
|
35
|
+
if (await inGitDirectory()) {
|
|
36
|
+
// Generate fresh status
|
|
37
|
+
const branch = await getCurrentBranch();
|
|
38
|
+
const fileChanges = await getGitStatus();
|
|
39
|
+
const hasChanges = fileChanges.added > 0 ||
|
|
40
|
+
fileChanges.deleted > 0 ||
|
|
41
|
+
fileChanges.modified > 0;
|
|
42
|
+
const stats = await getDiffStat();
|
|
43
|
+
status = {
|
|
44
|
+
path: currentDir,
|
|
45
|
+
isGitRepository: true,
|
|
46
|
+
branch: branch ?? undefined,
|
|
47
|
+
hasChanges,
|
|
48
|
+
fileChanges: {
|
|
49
|
+
added: fileChanges.added,
|
|
50
|
+
modified: fileChanges.modified,
|
|
51
|
+
deleted: fileChanges.deleted,
|
|
52
|
+
untracked: fileChanges.untracked,
|
|
53
|
+
},
|
|
54
|
+
diffStats: {
|
|
55
|
+
insertions: stats.insertions,
|
|
56
|
+
deletions: stats.deletions,
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
this.cachedStatus = status;
|
|
61
|
+
this.cacheTime = now;
|
|
62
|
+
return this.cachedStatus;
|
|
63
|
+
}
|
|
64
|
+
// Clear cache (call this when you know the status has changed)
|
|
65
|
+
clear() {
|
|
66
|
+
this.cachedStatus = null;
|
|
67
|
+
this.cacheTime = 0;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
const projectStatus = new ProjectStatus();
|
|
71
|
+
export async function getProjectStatus() {
|
|
72
|
+
return await projectStatus.get();
|
|
73
|
+
}
|
|
74
|
+
// Export clear function for cases where we know the status changed
|
|
75
|
+
// (e.g., after file operations, git operations)
|
|
76
|
+
export function clearProjectStatusCache() {
|
|
77
|
+
projectStatus.clear();
|
|
78
|
+
}
|
package/dist/repl-new.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import type { Agent, AgentEvent, AgentState } from "./agent/index.ts";
|
|
2
2
|
import type { CommandManager } from "./commands/manager.ts";
|
|
3
3
|
import type { WorkspaceContext } from "./index.ts";
|
|
4
|
-
import type { MessageHistory } from "./messages.ts";
|
|
5
4
|
import type { ModelManager } from "./models/manager.ts";
|
|
6
5
|
import type { PromptManager } from "./prompts/manager.ts";
|
|
6
|
+
import type { SessionManager } from "./sessions/manager.ts";
|
|
7
7
|
import type { TokenCounter } from "./tokens/counter.ts";
|
|
8
8
|
import type { TokenTracker } from "./tokens/tracker.ts";
|
|
9
|
+
import type { CompleteToolSet } from "./tools/index.ts";
|
|
9
10
|
interface ReplOptions {
|
|
10
11
|
agent: Agent;
|
|
11
|
-
messageHistory:
|
|
12
|
+
messageHistory: SessionManager;
|
|
12
13
|
promptManager: PromptManager;
|
|
13
14
|
modelManager: ModelManager;
|
|
14
15
|
tokenTracker: TokenTracker;
|
|
@@ -17,6 +18,7 @@ interface ReplOptions {
|
|
|
17
18
|
tokenCounter: TokenCounter;
|
|
18
19
|
promptHistory: string[];
|
|
19
20
|
workspace: WorkspaceContext;
|
|
21
|
+
tools?: CompleteToolSet;
|
|
20
22
|
}
|
|
21
23
|
export declare class NewRepl {
|
|
22
24
|
private options;
|
|
@@ -25,15 +27,18 @@ export declare class NewRepl {
|
|
|
25
27
|
private editor;
|
|
26
28
|
private chatContainer;
|
|
27
29
|
private statusContainer;
|
|
28
|
-
private promptStatus;
|
|
29
30
|
private footer;
|
|
30
31
|
private editorContainer;
|
|
32
|
+
private notification;
|
|
31
33
|
private isInitialized;
|
|
32
34
|
private onInputCallback?;
|
|
33
35
|
private loadingAnimation;
|
|
34
36
|
private onInterruptCallback?;
|
|
37
|
+
private onExitCallback?;
|
|
35
38
|
private lastSigintTime;
|
|
39
|
+
private exitNotificationTimer?;
|
|
36
40
|
private pendingTools;
|
|
41
|
+
private tools?;
|
|
37
42
|
private streamingComponent;
|
|
38
43
|
private thinkingBlockComponent;
|
|
39
44
|
constructor(options: ReplOptions);
|
|
@@ -43,9 +48,15 @@ export declare class NewRepl {
|
|
|
43
48
|
getUserInput(): Promise<string>;
|
|
44
49
|
clearEditor(): void;
|
|
45
50
|
setInterruptCallback(callback: () => void): void;
|
|
51
|
+
setExitCallback(callback: (sessionId: string) => void): void;
|
|
46
52
|
rerender(): Promise<void>;
|
|
53
|
+
private reconstructSession;
|
|
54
|
+
private extractUserMessageText;
|
|
55
|
+
private renderAssistantMessage;
|
|
56
|
+
private extractToolCallsFromAssistant;
|
|
57
|
+
private createToolEvents;
|
|
47
58
|
private handleCtrlC;
|
|
48
|
-
stop(): void;
|
|
59
|
+
stop(showExitMessage?: boolean): void;
|
|
49
60
|
}
|
|
50
61
|
export {};
|
|
51
62
|
//# sourceMappingURL=repl-new.d.ts.map
|
package/dist/repl-new.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repl-new.d.ts","sourceRoot":"","sources":["../source/repl-new.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"repl-new.d.ts","sourceRoot":"","sources":["../source/repl-new.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,KAAK,EACL,UAAU,EACV,UAAU,EAEX,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAGnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAK1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAkBxD,UAAU,WAAW;IACnB,KAAK,EAAE,KAAK,CAAC;IACb,cAAc,EAAE,cAAc,CAAC;IAC/B,aAAa,EAAE,aAAa,CAAC;IAC7B,YAAY,EAAE,YAAY,CAAC;IAC3B,YAAY,EAAE,YAAY,CAAC;IAC3B,QAAQ,EAAE,cAAc,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IACrC,YAAY,EAAE,YAAY,CAAC;IAC3B,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,SAAS,EAAE,gBAAgB,CAAC;IAC5B,KAAK,CAAC,EAAE,eAAe,CAAC;CACzB;AAED,qBAAa,OAAO;IAClB,OAAO,CAAC,OAAO,CAAc;IAC7B,OAAO,CAAC,GAAG,CAAM;IACjB,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,aAAa,CAAY;IACjC,OAAO,CAAC,eAAe,CAAY;IACnC,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,eAAe,CAAY;IACnC,OAAO,CAAC,YAAY,CAAwB;IAC5C,OAAO,CAAC,aAAa,CAAU;IAC/B,OAAO,CAAC,eAAe,CAAC,CAAyB;IACjD,OAAO,CAAC,gBAAgB,CAAuB;IAC/C,OAAO,CAAC,mBAAmB,CAAC,CAAa;IACzC,OAAO,CAAC,cAAc,CAAC,CAA8B;IACrD,OAAO,CAAC,cAAc,CAAK;IAC3B,OAAO,CAAC,qBAAqB,CAAC,CAAiB;IAC/C,OAAO,CAAC,YAAY,CAAsC;IAC1D,OAAO,CAAC,KAAK,CAAC,CAAkB;IAGhC,OAAO,CAAC,kBAAkB,CAA0C;IAGpE,OAAO,CAAC,sBAAsB,CAAuC;gBAEzD,OAAO,EAAE,WAAW;IAoC1B,IAAI;IAoJJ,MAAM,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU;IAqKjD,OAAO,CAAC,gBAAgB;IAWlB,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC;IASrC,WAAW,IAAI,IAAI;IAKnB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI;IAIhD,eAAe,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI;IAItD,QAAQ;IAed,OAAO,CAAC,kBAAkB;IA6E1B,OAAO,CAAC,sBAAsB;IAsB9B,OAAO,CAAC,sBAAsB;IAmC9B,OAAO,CAAC,6BAA6B;IAwDrC,OAAO,CAAC,gBAAgB;IAwCxB,OAAO,CAAC,WAAW;IAwCnB,IAAI,CAAC,eAAe,UAAQ,GAAG,IAAI;CAoBpC"}
|