@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
|
@@ -1,29 +1,7 @@
|
|
|
1
1
|
import Clipboard from "@crosscopy/clipboard";
|
|
2
|
-
import style from "
|
|
3
|
-
import { Spacer, Text } from "
|
|
4
|
-
|
|
5
|
-
for (let i = messages.length - 1; i >= 0; i--) {
|
|
6
|
-
const msg = messages[i];
|
|
7
|
-
if (!msg)
|
|
8
|
-
continue;
|
|
9
|
-
if (msg.role !== "assistant")
|
|
10
|
-
continue;
|
|
11
|
-
if (!("content" in msg) || !Array.isArray(msg.content))
|
|
12
|
-
continue;
|
|
13
|
-
// Find last text part
|
|
14
|
-
for (let j = msg.content.length - 1; j >= 0; j--) {
|
|
15
|
-
const part = msg.content[j];
|
|
16
|
-
if (part &&
|
|
17
|
-
part.type === "text" &&
|
|
18
|
-
typeof part.text === "string") {
|
|
19
|
-
const text = part.text;
|
|
20
|
-
if (text.trim().length > 0)
|
|
21
|
-
return text;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
2
|
+
import style from "../../terminal/style.js";
|
|
3
|
+
import { Spacer, Text } from "../../tui/index.js";
|
|
4
|
+
import { extractLastAssistantText } from "./utils.js";
|
|
27
5
|
export function copyCommand(options) {
|
|
28
6
|
return {
|
|
29
7
|
command: "/copy",
|
|
@@ -32,7 +10,7 @@ export function copyCommand(options) {
|
|
|
32
10
|
return [];
|
|
33
11
|
},
|
|
34
12
|
async handle(_args, { tui, container, editor, }) {
|
|
35
|
-
const { messageHistory } = options;
|
|
13
|
+
const { sessionManager: messageHistory } = options;
|
|
36
14
|
const history = messageHistory.get();
|
|
37
15
|
container.addChild(new Spacer(1));
|
|
38
16
|
const lastText = extractLastAssistantText(history);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../source/commands/copy/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAEjD,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../source/commands/copy/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAY,MAAM,IAAI,CAAC;AAEjD,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,YAAY,EAAE,GACvB,MAAM,GAAG,IAAI,CAoBf"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export function extractLastAssistantText(messages) {
|
|
2
|
+
for (let i = messages.length - 1; i >= 0; i--) {
|
|
3
|
+
const msg = messages[i];
|
|
4
|
+
if (!msg)
|
|
5
|
+
continue;
|
|
6
|
+
if (msg.role !== "assistant")
|
|
7
|
+
continue;
|
|
8
|
+
if (!("content" in msg) || !Array.isArray(msg.content))
|
|
9
|
+
continue;
|
|
10
|
+
for (let j = msg.content.length - 1; j >= 0; j--) {
|
|
11
|
+
const part = msg.content[j];
|
|
12
|
+
if (part != null &&
|
|
13
|
+
part.type === "text" &&
|
|
14
|
+
typeof part.text === "string") {
|
|
15
|
+
const text = part.text;
|
|
16
|
+
if (text.trim().length > 0)
|
|
17
|
+
return text;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { ReplCommand } from "
|
|
1
|
+
import type { ReplCommand } from "../types.ts";
|
|
2
2
|
export interface ExitCommandOptions {
|
|
3
|
-
|
|
3
|
+
sessionManager: {
|
|
4
4
|
isEmpty: () => boolean;
|
|
5
5
|
save: () => Promise<void>;
|
|
6
6
|
};
|
|
7
7
|
baseDir?: string | null;
|
|
8
8
|
}
|
|
9
|
-
export declare const exitCommand: ({
|
|
10
|
-
//# sourceMappingURL=
|
|
9
|
+
export declare const exitCommand: ({ sessionManager, baseDir, }: ExitCommandOptions) => ReplCommand;
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/commands/exit/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG/C,MAAM,WAAW,kBAAkB;IACjC,cAAc,EAAE;QACd,OAAO,EAAE,MAAM,OAAO,CAAC;QACvB,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;KAC3B,CAAC;IACF,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAED,eAAO,MAAM,WAAW,GAAI,8BAGzB,kBAAkB,KAAG,WA2BvB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Text } from "../../tui/index.js";
|
|
2
|
+
import { clearTmpDirectory } from "./utils.js";
|
|
3
|
+
export const exitCommand = ({ sessionManager, baseDir, }) => {
|
|
4
|
+
return {
|
|
5
|
+
command: "/exit",
|
|
6
|
+
aliases: ["/bye", "/quit"],
|
|
7
|
+
description: "Exits and saves the chat history.",
|
|
8
|
+
getSubCommands: () => Promise.resolve([]),
|
|
9
|
+
async handle(_args, { tui, container, editor, }) {
|
|
10
|
+
if (!sessionManager.isEmpty()) {
|
|
11
|
+
await sessionManager.save();
|
|
12
|
+
}
|
|
13
|
+
// Clear the .tmp directory on exit
|
|
14
|
+
await clearTmpDirectory(baseDir);
|
|
15
|
+
container.addChild(new Text("Exiting...", 0, 1));
|
|
16
|
+
tui.requestRender();
|
|
17
|
+
editor.setText("");
|
|
18
|
+
return "break";
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../source/commands/exit/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,kBAAkB;IACjC,cAAc,EAAE;QACd,OAAO,EAAE,MAAM,OAAO,CAAC;QACvB,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;KAC3B,CAAC;IACF,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../source/commands/exit/utils.ts"],"names":[],"mappings":"AAIA,wBAAsB,iBAAiB,CACrC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,GACtB,OAAO,CAAC,IAAI,CAAC,CAQf"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { logger } from "../../logger.js";
|
|
3
|
+
import { clearDirectory } from "../../utils/filesystem/operations.js";
|
|
4
|
+
export async function clearTmpDirectory(baseDir) {
|
|
5
|
+
try {
|
|
6
|
+
const tmpDirPath = path.join(baseDir ?? process.cwd(), ".tmp");
|
|
7
|
+
await clearDirectory(tmpDirPath);
|
|
8
|
+
}
|
|
9
|
+
catch (error) {
|
|
10
|
+
// Log error but don't block exit
|
|
11
|
+
logger.error(error, "Failed to clear .tmp directory:");
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/commands/generate-rules/index.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG/D,eAAO,MAAM,oBAAoB,GAAI,oFAMlC,cAAc,KAAG,WA+HnB,CAAC"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { generateText } from "ai";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { createUserMessage } from "
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
export const generateRulesCommand = ({ messageHistory, modelManager, tokenTracker, config,
|
|
10
|
-
workspace, }) => {
|
|
2
|
+
import { logger } from "../../logger.js";
|
|
3
|
+
import { systemPrompt } from "../../prompts.js";
|
|
4
|
+
import { createUserMessage } from "../../sessions/manager.js";
|
|
5
|
+
import { getTerminalSize, isArrowDown, isArrowUp, isEnter, isEscape, } from "../../terminal/control.js";
|
|
6
|
+
import style from "../../terminal/style.js";
|
|
7
|
+
import { Container, Input, Spacer, Text, } from "../../tui/index.js";
|
|
8
|
+
import { hideRuleSelector } from "./utils.js";
|
|
9
|
+
export const generateRulesCommand = ({ sessionManager: messageHistory, modelManager, tokenTracker, config, workspace, }) => {
|
|
11
10
|
return {
|
|
12
11
|
command: "/generate-rules",
|
|
13
12
|
description: "Analyzes the current conversation to generate and save new interaction rules, then displays them.",
|
|
@@ -29,15 +28,13 @@ workspace, }) => {
|
|
|
29
28
|
config,
|
|
30
29
|
workspace,
|
|
31
30
|
});
|
|
32
|
-
if (
|
|
31
|
+
if (newRules == null || newRules.length === 0) {
|
|
33
32
|
container.addChild(new Text(style.yellow("No new generalizable rules were identified."), 2, 0));
|
|
34
33
|
tui.requestRender();
|
|
35
34
|
editor.setText("");
|
|
36
35
|
return "continue";
|
|
37
36
|
}
|
|
38
|
-
// Create rule selector for TUI mode
|
|
39
37
|
const ruleSelector = new RuleSelectorComponent(newRules, async (selectedRules) => {
|
|
40
|
-
// Handle rule selection
|
|
41
38
|
if (selectedRules.length === 0) {
|
|
42
39
|
container.addChild(new Text(style.yellow("No rules selected to save."), 2, 0));
|
|
43
40
|
}
|
|
@@ -59,15 +56,12 @@ workspace, }) => {
|
|
|
59
56
|
container.addChild(new Text(style.red(`Failed to save rules: ${error}`), 2, 0));
|
|
60
57
|
}
|
|
61
58
|
}
|
|
62
|
-
// Hide selector and show editor again
|
|
63
59
|
hideRuleSelector(inputContainer, editor, tui);
|
|
64
60
|
tui.requestRender();
|
|
65
61
|
}, () => {
|
|
66
|
-
// Cancel selection - just hide selector
|
|
67
62
|
hideRuleSelector(inputContainer, editor, tui);
|
|
68
63
|
tui.requestRender();
|
|
69
64
|
});
|
|
70
|
-
// Replace editor with rule selector
|
|
71
65
|
inputContainer.clear();
|
|
72
66
|
inputContainer.addChild(ruleSelector);
|
|
73
67
|
tui.setFocus(ruleSelector);
|
|
@@ -85,15 +79,55 @@ workspace, }) => {
|
|
|
85
79
|
},
|
|
86
80
|
};
|
|
87
81
|
};
|
|
88
|
-
|
|
89
|
-
const
|
|
82
|
+
async function analyzeConversation({ modelManager, messages, tokenTracker, config: configManager, workspace, }) {
|
|
83
|
+
const learnedRules = await configManager.readCachedLearnedRulesFile();
|
|
84
|
+
messages.push(createUserMessage([
|
|
85
|
+
`Analyze this conversation based on the system instructions. Identify points where the user made significant corrections revealing general principles for agent improvement. Infer concise, broadly applicable rules (Always/Never) based *only* on these corrections.
|
|
86
|
+
|
|
87
|
+
**Key Requirements:**
|
|
88
|
+
- Focus on *generalizable* rules applicable to future, different tasks.
|
|
89
|
+
- Avoid rules tied to the specifics of *this* conversation.
|
|
90
|
+
- Ensure rules don't already exist in <existing-rules>.
|
|
91
|
+
- If no *new, general* rules can be inferred, return an empty list or response.
|
|
92
|
+
- Return *only* the Markdown list of rules, with no preamble or explanation.
|
|
93
|
+
|
|
94
|
+
<existing-rules>
|
|
95
|
+
${learnedRules}
|
|
96
|
+
</existing-rules>`,
|
|
97
|
+
]));
|
|
98
|
+
const systemPromptText = await createSystemPrompt(configManager, workspace);
|
|
99
|
+
const { text, usage } = await generateText({
|
|
100
|
+
model: modelManager.getModel("conversation-analyzer"),
|
|
101
|
+
maxOutputTokens: 8192,
|
|
102
|
+
system: systemPromptText,
|
|
103
|
+
messages: messages,
|
|
104
|
+
});
|
|
105
|
+
tokenTracker.trackUsage("conversation-analyzer", usage);
|
|
106
|
+
const potentialRulesText = text.trim();
|
|
107
|
+
if (!potentialRulesText || potentialRulesText.length === 0) {
|
|
108
|
+
return [];
|
|
109
|
+
}
|
|
110
|
+
const potentialRulesList = potentialRulesText
|
|
111
|
+
.split("\n")
|
|
112
|
+
.map((rule) => rule.trim())
|
|
113
|
+
.filter((rule) => rule.length > 0);
|
|
114
|
+
if (potentialRulesList.length === 0) {
|
|
115
|
+
return [];
|
|
116
|
+
}
|
|
117
|
+
const updatedRules = learnedRules.endsWith("\n") || learnedRules.length === 0
|
|
118
|
+
? `${learnedRules}${potentialRulesList.join("\n")}`
|
|
119
|
+
: `${learnedRules}\n${potentialRulesList.join("\n")}`;
|
|
120
|
+
await configManager.writeCachedLearnedRulesFile(updatedRules);
|
|
121
|
+
return potentialRulesList;
|
|
122
|
+
}
|
|
123
|
+
async function createSystemPrompt(configManager, workspace) {
|
|
90
124
|
const projectConfig = await configManager.getConfig();
|
|
91
|
-
const
|
|
92
|
-
type: projectConfig.systemPromptType,
|
|
125
|
+
const sysResult = await systemPrompt({
|
|
93
126
|
activeTools: projectConfig.tools.activeTools,
|
|
94
127
|
includeRules: true,
|
|
95
128
|
allowedDirs: workspace.allowedDirs,
|
|
96
129
|
});
|
|
130
|
+
const sys = sysResult.prompt;
|
|
97
131
|
return `You are an expert analyst reviewing conversations between a coding agent and a software engineer. Your goal is to identify instances where the engineer corrected the agent's approach or understanding in a way that reveals a *generalizable principle* for improving the agent's future behavior across *different* tasks.
|
|
98
132
|
|
|
99
133
|
**Your Task:**
|
|
@@ -130,63 +164,7 @@ This is the original system prompt the agent operated under:
|
|
|
130
164
|
<systemPrompt>
|
|
131
165
|
${sys}
|
|
132
166
|
</systemPrompt>`;
|
|
133
|
-
};
|
|
134
|
-
async function analyzeConversation({ modelManager, messages, tokenTracker, config: configManager, workspace, }) {
|
|
135
|
-
const learnedRules = await configManager.readCachedLearnedRulesFile();
|
|
136
|
-
// Modified User Message within analyzeConversation
|
|
137
|
-
messages.push(createUserMessage([
|
|
138
|
-
`Analyze this conversation based on the system instructions. Identify points where the user made significant corrections revealing general principles for agent improvement. Infer concise, broadly applicable rules (Always/Never) based *only* on these corrections.
|
|
139
|
-
|
|
140
|
-
**Key Requirements:**
|
|
141
|
-
- Focus on *generalizable* rules applicable to future, different tasks.
|
|
142
|
-
- Avoid rules tied to the specifics of *this* conversation.
|
|
143
|
-
- Ensure rules don't already exist in <existing-rules>.
|
|
144
|
-
- If no *new, general* rules can be inferred, return an empty list or response.
|
|
145
|
-
- Return *only* the Markdown list of rules, with no preamble or explanation.
|
|
146
|
-
|
|
147
|
-
<existing-rules>
|
|
148
|
-
${learnedRules}
|
|
149
|
-
</existing-rules>`,
|
|
150
|
-
]));
|
|
151
|
-
const { text, usage } = await generateText({
|
|
152
|
-
model: modelManager.getModel("conversation-analyzer"),
|
|
153
|
-
maxOutputTokens: 8192,
|
|
154
|
-
system: await system(configManager, workspace),
|
|
155
|
-
messages: messages,
|
|
156
|
-
});
|
|
157
|
-
tokenTracker.trackUsage("conversation-analyzer", usage);
|
|
158
|
-
// Trim whitespace and check if the response is effectively empty or just whitespace
|
|
159
|
-
const potentialRulesText = text.trim();
|
|
160
|
-
// Basic check to prevent adding empty lines or just formatting
|
|
161
|
-
if (!potentialRulesText || potentialRulesText.length === 0) {
|
|
162
|
-
return []; // Return empty array if no valid rules generated
|
|
163
|
-
}
|
|
164
|
-
// Split into individual rules, filter out empty lines
|
|
165
|
-
const potentialRulesList = potentialRulesText
|
|
166
|
-
.split("\n")
|
|
167
|
-
.map((rule) => rule.trim())
|
|
168
|
-
.filter((rule) => rule.length > 0);
|
|
169
|
-
if (potentialRulesList.length === 0) {
|
|
170
|
-
return []; // Return empty array if splitting results in no rules
|
|
171
|
-
}
|
|
172
|
-
// Further validation could be added here (e.g., check if it starts with '- ', etc.)
|
|
173
|
-
// before writing to the file.
|
|
174
|
-
// Append only if there are non-empty potential rules
|
|
175
|
-
const updatedRules = learnedRules.endsWith("\n") || learnedRules.length === 0
|
|
176
|
-
? `${learnedRules}${potentialRulesList.join("\n")}`
|
|
177
|
-
: `${learnedRules}\n${potentialRulesList.join("\n")}`;
|
|
178
|
-
await config.writeCachedLearnedRulesFile(updatedRules);
|
|
179
|
-
return potentialRulesList; // Return the list of rules that were added
|
|
180
|
-
}
|
|
181
|
-
function hideRuleSelector(editorContainer, editor, tui) {
|
|
182
|
-
// Replace selector with editor in the container
|
|
183
|
-
editorContainer.clear();
|
|
184
|
-
editorContainer.addChild(editor);
|
|
185
|
-
tui.setFocus(editor);
|
|
186
167
|
}
|
|
187
|
-
/**
|
|
188
|
-
* Component that renders a rule selector with search and multi-selection
|
|
189
|
-
*/
|
|
190
168
|
class RuleSelectorComponent extends Container {
|
|
191
169
|
searchInput;
|
|
192
170
|
listContainer;
|
|
@@ -200,31 +178,23 @@ class RuleSelectorComponent extends Container {
|
|
|
200
178
|
super();
|
|
201
179
|
this.onSelectCallback = onSelect;
|
|
202
180
|
this.onCancelCallback = onCancel;
|
|
203
|
-
// Load all rules
|
|
204
181
|
this.allRules = rules;
|
|
205
182
|
this.filteredRules = rules;
|
|
206
183
|
const { columns } = getTerminalSize();
|
|
207
|
-
// Add top border
|
|
208
184
|
this.addChild(new Text(style.blue("─".repeat(columns)), 0, 0));
|
|
209
185
|
this.addChild(new Spacer(1));
|
|
210
|
-
// Create search input
|
|
211
186
|
this.searchInput = new Input();
|
|
212
187
|
this.searchInput.onSubmit = () => {
|
|
213
|
-
// Enter on search input toggles selection of current item
|
|
214
188
|
this.toggleSelection(this.selectedIndex);
|
|
215
189
|
};
|
|
216
190
|
this.addChild(this.searchInput);
|
|
217
191
|
this.addChild(new Spacer(1));
|
|
218
|
-
// Create list container
|
|
219
192
|
this.listContainer = new Container();
|
|
220
193
|
this.addChild(this.listContainer);
|
|
221
194
|
this.addChild(new Spacer(1));
|
|
222
|
-
// Add instructions
|
|
223
195
|
this.addChild(new Text(style.dim("Space: toggle selection, Enter: confirm, Escape: cancel"), 0, 0));
|
|
224
196
|
this.addChild(new Spacer(1));
|
|
225
|
-
// Add bottom border
|
|
226
197
|
this.addChild(new Text(style.blue("─".repeat(columns)), 0, 0));
|
|
227
|
-
// Initial render
|
|
228
198
|
this.updateList();
|
|
229
199
|
}
|
|
230
200
|
filterRules(query) {
|
|
@@ -249,7 +219,6 @@ class RuleSelectorComponent extends Container {
|
|
|
249
219
|
const maxVisible = 10;
|
|
250
220
|
const startIndex = Math.max(0, Math.min(this.selectedIndex - Math.floor(maxVisible / 2), this.filteredRules.length - maxVisible));
|
|
251
221
|
const endIndex = Math.min(startIndex + maxVisible, this.filteredRules.length);
|
|
252
|
-
// Show visible slice of filtered rules
|
|
253
222
|
for (let i = startIndex; i < endIndex; i++) {
|
|
254
223
|
const rule = this.filteredRules[i];
|
|
255
224
|
if (!rule)
|
|
@@ -270,40 +239,32 @@ class RuleSelectorComponent extends Container {
|
|
|
270
239
|
}
|
|
271
240
|
this.listContainer.addChild(new Text(line, 0, 0));
|
|
272
241
|
}
|
|
273
|
-
// Add scroll indicator if needed
|
|
274
242
|
if (startIndex > 0 || endIndex < this.filteredRules.length) {
|
|
275
243
|
const scrollInfo = style.gray(` (${this.selectedIndex + 1}/${this.filteredRules.length})`);
|
|
276
244
|
this.listContainer.addChild(new Text(scrollInfo, 0, 0));
|
|
277
245
|
}
|
|
278
|
-
// Show "no results" if empty
|
|
279
246
|
if (this.filteredRules.length === 0) {
|
|
280
247
|
this.listContainer.addChild(new Text(style.gray(" No matching rules"), 0, 0));
|
|
281
248
|
}
|
|
282
249
|
}
|
|
283
250
|
handleInput(keyData) {
|
|
284
|
-
|
|
285
|
-
if (keyData === "\x1b[A") {
|
|
251
|
+
if (isArrowUp(keyData)) {
|
|
286
252
|
this.selectedIndex = Math.max(0, this.selectedIndex - 1);
|
|
287
253
|
this.updateList();
|
|
288
254
|
}
|
|
289
|
-
|
|
290
|
-
else if (keyData === "\x1b[B") {
|
|
255
|
+
else if (isArrowDown(keyData)) {
|
|
291
256
|
this.selectedIndex = Math.min(this.filteredRules.length - 1, this.selectedIndex + 1);
|
|
292
257
|
this.updateList();
|
|
293
258
|
}
|
|
294
|
-
// Space - toggle selection
|
|
295
259
|
else if (keyData === " ") {
|
|
296
260
|
this.toggleSelection(this.selectedIndex);
|
|
297
261
|
}
|
|
298
|
-
|
|
299
|
-
else if (keyData === "\r") {
|
|
262
|
+
else if (isEnter(keyData)) {
|
|
300
263
|
this.handleConfirm();
|
|
301
264
|
}
|
|
302
|
-
|
|
303
|
-
else if (keyData === "\x1b") {
|
|
265
|
+
else if (isEscape(keyData)) {
|
|
304
266
|
this.onCancelCallback();
|
|
305
267
|
}
|
|
306
|
-
// Pass everything else to search input
|
|
307
268
|
else {
|
|
308
269
|
this.searchInput.handleInput(keyData);
|
|
309
270
|
this.filterRules(this.searchInput.getValue());
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Container, Editor, TUI } from "../../tui/index.ts";
|
|
2
|
+
export declare function hideRuleSelector(editorContainer: Container, editor: Editor, tui: TUI): void;
|
|
3
|
+
export declare function parseRulesText(text: string): string[];
|
|
4
|
+
export declare function formatRulesForStorage(existingRules: string, newRules: string[]): string;
|
|
5
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../source/commands/generate-rules/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAEjE,wBAAgB,gBAAgB,CAC9B,eAAe,EAAE,SAAS,EAC1B,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,GAAG,GACP,IAAI,CAIN;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAUrD;AAED,wBAAgB,qBAAqB,CACnC,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,MAAM,EAAE,GACjB,MAAM,CAUR"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export function hideRuleSelector(editorContainer, editor, tui) {
|
|
2
|
+
editorContainer.clear();
|
|
3
|
+
editorContainer.addChild(editor);
|
|
4
|
+
tui.setFocus(editor);
|
|
5
|
+
}
|
|
6
|
+
export function parseRulesText(text) {
|
|
7
|
+
const trimmed = text.trim();
|
|
8
|
+
if (!trimmed || trimmed.length === 0) {
|
|
9
|
+
return [];
|
|
10
|
+
}
|
|
11
|
+
return trimmed
|
|
12
|
+
.split("\n")
|
|
13
|
+
.map((rule) => rule.trim())
|
|
14
|
+
.filter((rule) => rule.length > 0);
|
|
15
|
+
}
|
|
16
|
+
export function formatRulesForStorage(existingRules, newRules) {
|
|
17
|
+
if (newRules.length === 0) {
|
|
18
|
+
return existingRules;
|
|
19
|
+
}
|
|
20
|
+
const rulesToAdd = newRules.join("\n");
|
|
21
|
+
if (existingRules.endsWith("\n") || existingRules.length === 0) {
|
|
22
|
+
return `${existingRules}${rulesToAdd}`;
|
|
23
|
+
}
|
|
24
|
+
return `${existingRules}\n${rulesToAdd}`;
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/commands/handoff/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAO/D,eAAO,MAAM,cAAc,GAAI,SAAS,cAAc,KAAG,WA2DxD,CAAC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { mkdir, writeFile } from "node:fs/promises";
|
|
2
|
+
import { generateText } from "ai";
|
|
3
|
+
import { AiConfig } from "../../models/ai-config.js";
|
|
4
|
+
import style from "../../terminal/style.js";
|
|
5
|
+
import { Spacer, Text } from "../../tui/index.js";
|
|
6
|
+
import { generateHandoffFilename, generateHandoffSlug, handoffPrompt, } from "./utils.js";
|
|
7
|
+
export const handoffCommand = (options) => {
|
|
8
|
+
return {
|
|
9
|
+
command: "/handoff",
|
|
10
|
+
description: "Creates a detailed handoff plan of the conversation for continuing the work in a new session. Usage: /handoff <the purpose of the handoff>",
|
|
11
|
+
getSubCommands: () => Promise.resolve([]),
|
|
12
|
+
async handle(args, { tui, container, editor, }) {
|
|
13
|
+
const purpose = args.join(" ").trim();
|
|
14
|
+
if (!purpose) {
|
|
15
|
+
container.addChild(new Text(style.red("Please provide a purpose for the handoff. Usage: /handoff <the purpose of the handoff>"), 1, 0));
|
|
16
|
+
tui.requestRender();
|
|
17
|
+
editor.setText("");
|
|
18
|
+
return "continue";
|
|
19
|
+
}
|
|
20
|
+
container.addChild(new Spacer(1));
|
|
21
|
+
container.addChild(new Text(`Creating handoff document for purpose: ${style.blue(purpose)}`, 1, 0));
|
|
22
|
+
tui.requestRender();
|
|
23
|
+
const filename = await createHandoffDocument(options, purpose);
|
|
24
|
+
container.addChild(new Text(style.green(`Handoff document created: ${filename}`), 2, 0));
|
|
25
|
+
container.addChild(new Text(`Use /pickup ${filename.replace(".md", "")} to continue this work.`, 3, 0));
|
|
26
|
+
tui.requestRender();
|
|
27
|
+
editor.setText("");
|
|
28
|
+
return "continue";
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
async function createHandoffDocument({ modelManager, tokenTracker, sessionManager: messageHistory, }, purpose) {
|
|
33
|
+
const app = "handoff-agent";
|
|
34
|
+
const model = modelManager.getModel(app);
|
|
35
|
+
const modelConfig = modelManager.getModelMetadata(app);
|
|
36
|
+
const messages = messageHistory.get();
|
|
37
|
+
const conversationText = messages
|
|
38
|
+
.map((msg) => {
|
|
39
|
+
let content = "";
|
|
40
|
+
if (Array.isArray(msg.content)) {
|
|
41
|
+
content = msg.content
|
|
42
|
+
.filter((part) => part.type === "text")
|
|
43
|
+
.map((part) => part.text)
|
|
44
|
+
.join("\n");
|
|
45
|
+
}
|
|
46
|
+
else if (typeof msg.content === "string") {
|
|
47
|
+
content = msg.content;
|
|
48
|
+
}
|
|
49
|
+
return `${msg.role}: ${content}`;
|
|
50
|
+
})
|
|
51
|
+
.filter((text) => text?.trim())
|
|
52
|
+
.join("\n\n");
|
|
53
|
+
const fullPrompt = `${handoffPrompt(purpose)}\n\n## Conversation History\n\n${conversationText}`;
|
|
54
|
+
const aiConfig = new AiConfig({
|
|
55
|
+
modelMetadata: modelConfig,
|
|
56
|
+
prompt: fullPrompt,
|
|
57
|
+
});
|
|
58
|
+
let result;
|
|
59
|
+
try {
|
|
60
|
+
result = await generateText({
|
|
61
|
+
model,
|
|
62
|
+
maxOutputTokens: aiConfig.maxOutputTokens(),
|
|
63
|
+
system: "You are a helpful AI assistant tasked with creating detailed handoff summaries for coding agents. Focus on technical accuracy and completeness so that another agent can seamlessly continue the work.",
|
|
64
|
+
prompt: fullPrompt,
|
|
65
|
+
temperature: aiConfig.temperature(),
|
|
66
|
+
topP: aiConfig.topP(),
|
|
67
|
+
providerOptions: aiConfig.providerOptions(),
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
console.error(`Error generating handoff text: ${error}`);
|
|
72
|
+
throw new Error(`Failed to generate handoff summary: ${error.message}`);
|
|
73
|
+
}
|
|
74
|
+
const { text, usage } = result;
|
|
75
|
+
tokenTracker.trackUsage(app, usage);
|
|
76
|
+
if (!text || text.trim().length === 0) {
|
|
77
|
+
throw new Error("AI returned empty response");
|
|
78
|
+
}
|
|
79
|
+
const slug = generateHandoffSlug(purpose);
|
|
80
|
+
const filename = generateHandoffFilename(slug);
|
|
81
|
+
const handoffsDir = ".acai/handoffs";
|
|
82
|
+
const filepath = `${handoffsDir}/${filename}`;
|
|
83
|
+
const handoffDocument = `${text}
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
*Generated on ${new Date().toISOString()} for purpose: ${purpose}*
|
|
87
|
+
*This handoff file can be used to continue the work using the /pickup command*`;
|
|
88
|
+
try {
|
|
89
|
+
await mkdir(handoffsDir, { recursive: true });
|
|
90
|
+
await writeFile(filepath, handoffDocument, "utf-8");
|
|
91
|
+
return filename;
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
console.error(`Failed to save handoff file: ${error}`);
|
|
95
|
+
throw new Error(`Failed to save handoff file: ${error.message}`);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../source/commands/handoff/utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,GAAI,SAAS,MAAM,KAAG,MAqG/C,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAC9B,SAAS,MAAM,EACf,kBAAc,KACb,MAmBF,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,MAAM,MAAM,KAAG,MAItD,CAAC"}
|