@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,124 +0,0 @@
|
|
|
1
|
-
import { systemPrompt } from "../prompts.js";
|
|
2
|
-
import { initCliTools } from "../tools/index.js";
|
|
3
|
-
import { prepareTools } from "../tools/utils.js";
|
|
4
|
-
import { Container, Modal, ModalText, TableComponent } from "../tui/index.js";
|
|
5
|
-
/**
|
|
6
|
-
* Count tokens from message history
|
|
7
|
-
*/
|
|
8
|
-
function countMessageTokens(messages, counter) {
|
|
9
|
-
if (messages.length === 0) {
|
|
10
|
-
return 0;
|
|
11
|
-
}
|
|
12
|
-
// Serialize messages to JSON for token counting
|
|
13
|
-
const serializedMessages = JSON.stringify(messages);
|
|
14
|
-
return counter.count(serializedMessages);
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Format numbers for display (e.g., 1.2k, 5.1m)
|
|
18
|
-
*/
|
|
19
|
-
function formatNum(n) {
|
|
20
|
-
if (n < 1000)
|
|
21
|
-
return `${n}`;
|
|
22
|
-
if (n < 1_000_000)
|
|
23
|
-
return `${(n / 1000).toFixed(1)}k`;
|
|
24
|
-
return `${(n / 1_000_000).toFixed(1)}m`;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Calculate percentage for display
|
|
28
|
-
*/
|
|
29
|
-
function pct(n, d) {
|
|
30
|
-
if (d <= 0)
|
|
31
|
-
return "0.0%";
|
|
32
|
-
return `${((n / d) * 100).toFixed(1)}%`;
|
|
33
|
-
}
|
|
34
|
-
export function contextCommand({ config, tokenCounter, modelManager, messageHistory, workspace, }) {
|
|
35
|
-
return {
|
|
36
|
-
command: "/context",
|
|
37
|
-
description: "Show context window usage breakdown",
|
|
38
|
-
getSubCommands: () => Promise.resolve(["--details", "--json"]),
|
|
39
|
-
async handle(args, { tui, editor }) {
|
|
40
|
-
const meta = modelManager.getModelMetadata("repl");
|
|
41
|
-
const window = meta.contextWindow;
|
|
42
|
-
const projectConfig = await config.getConfig();
|
|
43
|
-
// 1) System prompt
|
|
44
|
-
const sys = await systemPrompt({
|
|
45
|
-
type: projectConfig.systemPromptType,
|
|
46
|
-
activeTools: projectConfig.tools.activeTools,
|
|
47
|
-
allowedDirs: workspace.allowedDirs,
|
|
48
|
-
includeRules: true,
|
|
49
|
-
});
|
|
50
|
-
const systemPromptTokens = tokenCounter.count(sys);
|
|
51
|
-
// 2) Tools (MVP approximation)
|
|
52
|
-
let toolsTokens = 0;
|
|
53
|
-
try {
|
|
54
|
-
const tools = await initCliTools({
|
|
55
|
-
tokenCounter,
|
|
56
|
-
workspace,
|
|
57
|
-
});
|
|
58
|
-
const toolDefs = tools.toolDefs;
|
|
59
|
-
const toolNames = JSON.stringify(prepareTools(toolDefs));
|
|
60
|
-
toolsTokens = tokenCounter.count(toolNames);
|
|
61
|
-
// v2: replace with exact serialized definitions
|
|
62
|
-
}
|
|
63
|
-
catch (error) {
|
|
64
|
-
console.error(error);
|
|
65
|
-
toolsTokens = 0;
|
|
66
|
-
}
|
|
67
|
-
// 3) Messages
|
|
68
|
-
const messagesTokens = countMessageTokens(messageHistory.get(), tokenCounter);
|
|
69
|
-
// 4) Totals
|
|
70
|
-
const used = systemPromptTokens + toolsTokens + messagesTokens;
|
|
71
|
-
const free = Math.max(0, window - used);
|
|
72
|
-
const breakdown = {
|
|
73
|
-
systemPrompt: systemPromptTokens,
|
|
74
|
-
tools: toolsTokens,
|
|
75
|
-
messages: messagesTokens,
|
|
76
|
-
totalUsed: used,
|
|
77
|
-
window,
|
|
78
|
-
free,
|
|
79
|
-
};
|
|
80
|
-
// Build modal content
|
|
81
|
-
const modalContent = new Container();
|
|
82
|
-
// Context usage table
|
|
83
|
-
const tableData = [
|
|
84
|
-
[
|
|
85
|
-
"System prompt",
|
|
86
|
-
formatNum(breakdown.systemPrompt),
|
|
87
|
-
pct(breakdown.systemPrompt, window),
|
|
88
|
-
],
|
|
89
|
-
[
|
|
90
|
-
"System tools",
|
|
91
|
-
formatNum(breakdown.tools),
|
|
92
|
-
pct(breakdown.tools, window),
|
|
93
|
-
],
|
|
94
|
-
[
|
|
95
|
-
"Messages",
|
|
96
|
-
formatNum(breakdown.messages),
|
|
97
|
-
pct(breakdown.messages, window),
|
|
98
|
-
],
|
|
99
|
-
["Free space", formatNum(breakdown.free), pct(breakdown.free, window)],
|
|
100
|
-
];
|
|
101
|
-
modalContent.addChild(new ModalText("Context Usage", 0, 1));
|
|
102
|
-
modalContent.addChild(new TableComponent(tableData, {
|
|
103
|
-
headers: ["Section", "Tokens", "Percent"],
|
|
104
|
-
}));
|
|
105
|
-
// Progress bar
|
|
106
|
-
const progressBar = `[${"#".repeat(Math.floor((used / window) * 20))}${"-".repeat(20 - Math.floor((used / window) * 20))}] ${pct(used, window)}`;
|
|
107
|
-
modalContent.addChild(new ModalText("", 0, 1)); // Spacer
|
|
108
|
-
modalContent.addChild(new ModalText(progressBar, 0, 1));
|
|
109
|
-
if (args.includes("--json")) {
|
|
110
|
-
modalContent.addChild(new ModalText("", 0, 1)); // Spacer
|
|
111
|
-
modalContent.addChild(new ModalText("JSON Output:", 0, 1));
|
|
112
|
-
modalContent.addChild(new ModalText(JSON.stringify(breakdown, null, 2), 0, 1));
|
|
113
|
-
}
|
|
114
|
-
// Create and show modal
|
|
115
|
-
const modal = new Modal("Context Window Usage", modalContent, true, () => {
|
|
116
|
-
// Modal closed callback
|
|
117
|
-
editor.setText("");
|
|
118
|
-
tui.requestRender();
|
|
119
|
-
});
|
|
120
|
-
tui.showModal(modal);
|
|
121
|
-
return "continue";
|
|
122
|
-
},
|
|
123
|
-
};
|
|
124
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"copy-command.d.ts","sourceRoot":"","sources":["../../source/commands/copy-command.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAyB9D,wBAAgB,WAAW,CAAC,OAAO,EAAE,cAAc,GAAG,WAAW,CAmDhE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"edit-command.d.ts","sourceRoot":"","sources":["../../source/commands/edit-command.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9D,eAAO,MAAM,WAAW,GAAI,UAAU,cAAc,KAAG,WAkEtD,CAAC"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
-
import { resolve } from "node:path";
|
|
3
|
-
import style from "../terminal/style.js";
|
|
4
|
-
import { Text } from "../tui/index.js";
|
|
5
|
-
export const editCommand = (_options) => {
|
|
6
|
-
return {
|
|
7
|
-
command: "/edit",
|
|
8
|
-
description: "Opens file in $EDITOR for editing. Usage: /edit [file-path]",
|
|
9
|
-
getSubCommands: () => Promise.resolve([]),
|
|
10
|
-
async handle(args, { tui, container, editor, }) {
|
|
11
|
-
let fileToEdit;
|
|
12
|
-
if (args.length > 0) {
|
|
13
|
-
// File path provided as argument
|
|
14
|
-
const filePath = args.join(" "); // Handle file paths with spaces
|
|
15
|
-
const resolvedPath = resolve(filePath);
|
|
16
|
-
if (!existsSync(resolvedPath)) {
|
|
17
|
-
container.addChild(new Text(style.red(`File not found: ${filePath}`), 0, 1));
|
|
18
|
-
tui.requestRender();
|
|
19
|
-
editor.setText("");
|
|
20
|
-
return "continue";
|
|
21
|
-
}
|
|
22
|
-
fileToEdit = filePath;
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
// No file path provided, show message for TUI
|
|
26
|
-
container.addChild(new Text(style.red("File path required for /edit in TUI mode"), 0, 1));
|
|
27
|
-
container.addChild(new Text(style.dim("Usage: /edit <file-path>"), 2, 0));
|
|
28
|
-
tui.requestRender();
|
|
29
|
-
editor.setText("");
|
|
30
|
-
return "continue";
|
|
31
|
-
}
|
|
32
|
-
const content = readFileSync(fileToEdit, { encoding: "utf8" });
|
|
33
|
-
// For TUI mode, we can't use the editor prompt, so we'll just show file info
|
|
34
|
-
container.addChild(new Text(`Editing file: ${style.blue(fileToEdit)}`, 0, 1));
|
|
35
|
-
container.addChild(new Text(`Content length: ${content.length} characters`, 2, 0));
|
|
36
|
-
container.addChild(new Text(style.dim("Note: Full file editing not available in TUI mode"), 3, 0));
|
|
37
|
-
tui.requestRender();
|
|
38
|
-
editor.setText("");
|
|
39
|
-
return "continue";
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"edit-prompt-command.d.ts","sourceRoot":"","sources":["../../source/commands/edit-prompt-command.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9D,eAAO,MAAM,iBAAiB,GAAI,mCAG/B,cAAc,KAAG,WAuDnB,CAAC"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { syncTry } from "@travisennis/stdlib/try";
|
|
2
|
-
import style from "../terminal/style.js";
|
|
3
|
-
import { Text } from "../tui/index.js";
|
|
4
|
-
export const editPromptCommand = ({ promptManager, promptHistory, }) => {
|
|
5
|
-
return {
|
|
6
|
-
command: "/edit-prompt",
|
|
7
|
-
description: "Edit the prompt. Accepts optional arguments as initial content.",
|
|
8
|
-
getSubCommands: () => Promise.resolve([]),
|
|
9
|
-
async handle(args, { tui, container, editor, }) {
|
|
10
|
-
try {
|
|
11
|
-
const prompt = syncTry(() => promptManager.get());
|
|
12
|
-
const initialContent = args.length > 0 ? args.join(" ") : prompt.unwrapOr("");
|
|
13
|
-
// For TUI mode, we can't use the editor prompt, so we'll just set the prompt
|
|
14
|
-
if (initialContent.trim().length === 0) {
|
|
15
|
-
container.addChild(new Text(style.red("Prompt cannot be empty"), 0, 1));
|
|
16
|
-
tui.requestRender();
|
|
17
|
-
editor.setText("");
|
|
18
|
-
return "continue";
|
|
19
|
-
}
|
|
20
|
-
promptManager.set(initialContent);
|
|
21
|
-
// Add the edited prompt to history
|
|
22
|
-
promptHistory.push(initialContent);
|
|
23
|
-
container.addChild(new Text(`Prompt set to: ${style.blue(initialContent)}`, 0, 1));
|
|
24
|
-
tui.requestRender();
|
|
25
|
-
editor.setText("");
|
|
26
|
-
}
|
|
27
|
-
catch (error) {
|
|
28
|
-
container.addChild(new Text(style.red(`Error editing prompt: ${error.message}`), 1, 0));
|
|
29
|
-
tui.requestRender();
|
|
30
|
-
editor.setText("");
|
|
31
|
-
return "continue";
|
|
32
|
-
}
|
|
33
|
-
return "use";
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"exit-command.d.ts","sourceRoot":"","sources":["../../source/commands/exit-command.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,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,WAiCvB,CAAC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import path from "node:path";
|
|
2
|
-
import { logger } from "../logger.js";
|
|
3
|
-
import { Text } from "../tui/index.js";
|
|
4
|
-
import { clearDirectory } from "../utils/filesystem/operations.js";
|
|
5
|
-
export const exitCommand = ({ messageHistory, baseDir, }) => {
|
|
6
|
-
return {
|
|
7
|
-
command: "/exit",
|
|
8
|
-
aliases: ["/bye", "/quit"],
|
|
9
|
-
description: "Exits and saves the chat history.",
|
|
10
|
-
getSubCommands: () => Promise.resolve([]),
|
|
11
|
-
async handle(_args, { tui, container, editor, }) {
|
|
12
|
-
if (!messageHistory.isEmpty()) {
|
|
13
|
-
await messageHistory.save();
|
|
14
|
-
}
|
|
15
|
-
// Clear the .tmp directory on exit
|
|
16
|
-
try {
|
|
17
|
-
const tmpDirPath = path.join(baseDir ?? process.cwd(), ".tmp");
|
|
18
|
-
await clearDirectory(tmpDirPath);
|
|
19
|
-
}
|
|
20
|
-
catch (error) {
|
|
21
|
-
// Log error but don't block exit
|
|
22
|
-
logger.error(error, "Failed to clear .tmp directory:");
|
|
23
|
-
}
|
|
24
|
-
container.addChild(new Text("Exiting...", 0, 1));
|
|
25
|
-
tui.requestRender();
|
|
26
|
-
editor.setText("");
|
|
27
|
-
return "break";
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"files-command.d.ts","sourceRoot":"","sources":["../../source/commands/files-command.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9D,eAAO,MAAM,YAAY,GAAI,kCAG1B,cAAc,KAAG,WA4GnB,CAAC"}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { readFile } from "node:fs/promises";
|
|
2
|
-
import { formatFile } from "../formatting.js";
|
|
3
|
-
import style from "../terminal/style.js";
|
|
4
|
-
import { TokenCounter } from "../tokens/counter.js";
|
|
5
|
-
import { Text } from "../tui/index.js";
|
|
6
|
-
import { glob } from "../utils/glob.js";
|
|
7
|
-
export const filesCommand = ({ promptManager, modelManager, }) => {
|
|
8
|
-
return {
|
|
9
|
-
command: "/files",
|
|
10
|
-
description: "Finds files matching the given patterns and adds their content to the next prompt. Usage: /files or /files src/**/*.ts",
|
|
11
|
-
getSubCommands: () => Promise.resolve([]),
|
|
12
|
-
async handle(args, { tui, container, editor, }) {
|
|
13
|
-
try {
|
|
14
|
-
let workingFiles = [];
|
|
15
|
-
if (!args || args.length === 0) {
|
|
16
|
-
// Get all files in the current directory
|
|
17
|
-
const foundFiles = await glob("**/*", { gitignore: true });
|
|
18
|
-
// For TUI mode, we'll just use the first few files
|
|
19
|
-
workingFiles = foundFiles.slice(0, 5);
|
|
20
|
-
if (workingFiles.length === 0) {
|
|
21
|
-
container.addChild(new Text(style.yellow("No files found"), 0, 1));
|
|
22
|
-
tui.requestRender();
|
|
23
|
-
editor.setText("");
|
|
24
|
-
return "continue";
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
const patternList = args.filter(Boolean);
|
|
29
|
-
const foundFiles = await glob(patternList, { gitignore: true });
|
|
30
|
-
if (foundFiles.length === 0) {
|
|
31
|
-
container.addChild(new Text(style.yellow("No files found matching the pattern(s)"), 1, 0));
|
|
32
|
-
tui.requestRender();
|
|
33
|
-
editor.setText("");
|
|
34
|
-
return "continue";
|
|
35
|
-
}
|
|
36
|
-
// Process the selected files
|
|
37
|
-
workingFiles = foundFiles;
|
|
38
|
-
}
|
|
39
|
-
// Read the content of the files and format them for the next prompt
|
|
40
|
-
const format = modelManager.getModelMetadata("repl").promptFormat;
|
|
41
|
-
let tokenCount = 0;
|
|
42
|
-
const tokenCounter = new TokenCounter();
|
|
43
|
-
await Promise.all(workingFiles.map(async (filePath) => {
|
|
44
|
-
try {
|
|
45
|
-
const content = await readFile(filePath, "utf-8");
|
|
46
|
-
const formattedFile = formatFile(filePath, content, format);
|
|
47
|
-
tokenCount += tokenCounter.count(formattedFile);
|
|
48
|
-
promptManager.addContext(formattedFile);
|
|
49
|
-
}
|
|
50
|
-
catch (error) {
|
|
51
|
-
container.addChild(new Text(style.red(`Error reading file ${filePath}: ${error.message}`), 1, 0));
|
|
52
|
-
}
|
|
53
|
-
}));
|
|
54
|
-
tokenCounter.free();
|
|
55
|
-
container.addChild(new Text(style.green(`File contents will be added to your next prompt (${workingFiles.length} files, ${tokenCount} tokens)`), 1, 0));
|
|
56
|
-
tui.requestRender();
|
|
57
|
-
editor.setText("");
|
|
58
|
-
return "continue";
|
|
59
|
-
}
|
|
60
|
-
catch (error) {
|
|
61
|
-
container.addChild(new Text(style.red(`Error processing file patterns: ${error.message}`), 1, 0));
|
|
62
|
-
tui.requestRender();
|
|
63
|
-
editor.setText("");
|
|
64
|
-
return "continue";
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
};
|
|
68
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generate-rules-command.d.ts","sourceRoot":"","sources":["../../source/commands/generate-rules-command.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9D,eAAO,MAAM,oBAAoB,GAAI,oEAMlC,cAAc,KAAG,WAoInB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"handoff-command.d.ts","sourceRoot":"","sources":["../../source/commands/handoff-command.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9D,eAAO,MAAM,cAAc,GAAI,SAAS,cAAc,KAAG,WAoDxD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"health-command.d.ts","sourceRoot":"","sources":["../../source/commands/health-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAI9C,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9D,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,cAAc,EACxB,MAAM,kBAAW,GAChB,WAAW,CAiKb"}
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import { execSync } from "node:child_process";
|
|
2
|
-
import { formatMemoryUsage } from "../formatting.js";
|
|
3
|
-
import { Container, Modal, ModalText, TableComponent } from "../tui/index.js";
|
|
4
|
-
export function healthCommand(_options, execFn = execSync) {
|
|
5
|
-
return {
|
|
6
|
-
command: "/health",
|
|
7
|
-
description: "Show application health status and environment variables",
|
|
8
|
-
getSubCommands: () => Promise.resolve([]),
|
|
9
|
-
async handle(_args, { tui, editor }) {
|
|
10
|
-
// Define the environment variables we care about
|
|
11
|
-
const envVars = [
|
|
12
|
-
// AI Provider API Keys
|
|
13
|
-
{ name: "OPENAI_API_KEY", description: "OpenAI (GPT models)" },
|
|
14
|
-
{ name: "ANTHROPIC_API_KEY", description: "Anthropic (Claude models)" },
|
|
15
|
-
{
|
|
16
|
-
name: "GOOGLE_GENERATIVE_AI_API_KEY",
|
|
17
|
-
description: "Google (Gemini models)",
|
|
18
|
-
},
|
|
19
|
-
{ name: "DEEPSEEK_API_KEY", description: "DeepSeek" },
|
|
20
|
-
{ name: "GROQ_API_KEY", description: "Groq (multiple models)" },
|
|
21
|
-
{ name: "X_AI_API_KEY", description: "X.AI (Grok models)" },
|
|
22
|
-
{ name: "XAI_API_KEY", description: "X.AI (Grok models - alt)" },
|
|
23
|
-
{
|
|
24
|
-
name: "OPENROUTER_API_KEY",
|
|
25
|
-
description: "OpenRouter (multiple models)",
|
|
26
|
-
},
|
|
27
|
-
// Web Service API Keys
|
|
28
|
-
{ name: "EXA_API_KEY", description: "Exa (enhanced web search)" },
|
|
29
|
-
{
|
|
30
|
-
name: "JINA_READER_API_KEY",
|
|
31
|
-
description: "Jina Reader (web content extraction)",
|
|
32
|
-
},
|
|
33
|
-
// Application Configuration
|
|
34
|
-
{ name: "LOG_LEVEL", description: "Logging level" },
|
|
35
|
-
];
|
|
36
|
-
// Check each environment variable
|
|
37
|
-
const envStatus = envVars.map((envVar) => {
|
|
38
|
-
const value = process.env[envVar.name];
|
|
39
|
-
const hasValue = value !== undefined && value !== null && value.trim() !== "";
|
|
40
|
-
const status = hasValue ? "✓ Set" : "✗ Not set";
|
|
41
|
-
return [envVar.name, status, envVar.description];
|
|
42
|
-
});
|
|
43
|
-
// Check for required bash tools
|
|
44
|
-
const tools = [
|
|
45
|
-
{ name: "git", command: "git --version" },
|
|
46
|
-
{ name: "gh", command: "gh --version" },
|
|
47
|
-
{ name: "rg", command: "rg --version" },
|
|
48
|
-
{ name: "fd", command: "fd --version" },
|
|
49
|
-
{ name: "ast-grep", command: "ast-grep --version" },
|
|
50
|
-
{ name: "jq", command: "jq --version" },
|
|
51
|
-
{ name: "yq", command: "yq --version" },
|
|
52
|
-
];
|
|
53
|
-
const toolStatus = tools.map((tool) => {
|
|
54
|
-
let status = "✗ Not installed";
|
|
55
|
-
try {
|
|
56
|
-
execFn(tool.command, { stdio: "ignore", timeout: 5000 });
|
|
57
|
-
status = "✓ Installed";
|
|
58
|
-
}
|
|
59
|
-
catch (_error) {
|
|
60
|
-
// Ignore error, tool is not installed
|
|
61
|
-
}
|
|
62
|
-
return [tool.name, status];
|
|
63
|
-
});
|
|
64
|
-
// Count how many are set
|
|
65
|
-
const setCount = envStatus.filter((row) => row[1] === "✓ Set").length;
|
|
66
|
-
const totalCount = envVars.length;
|
|
67
|
-
const installedCount = toolStatus.filter((row) => row[1] === "✓ Installed").length;
|
|
68
|
-
const totalTools = tools.length;
|
|
69
|
-
// Display memory usage
|
|
70
|
-
const usage = process.memoryUsage().rss;
|
|
71
|
-
const formattedUsage = formatMemoryUsage(usage);
|
|
72
|
-
// Build modal content
|
|
73
|
-
const modalContent = new Container();
|
|
74
|
-
// Environment variables section
|
|
75
|
-
modalContent.addChild(new ModalText("Environment Variables Status:", 0, 1));
|
|
76
|
-
modalContent.addChild(new TableComponent(envStatus, {
|
|
77
|
-
headers: ["Variable", "Status", "Description"],
|
|
78
|
-
}));
|
|
79
|
-
const envSummary = `Summary: ${setCount}/${totalCount} environment variables are set`;
|
|
80
|
-
modalContent.addChild(new ModalText(envSummary, 0, 1));
|
|
81
|
-
if (setCount === 0) {
|
|
82
|
-
modalContent.addChild(new ModalText("⚠️ No AI provider API keys are configured. The app may not function properly.", 0, 1));
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
modalContent.addChild(new ModalText("✓ At least one AI provider is configured.", 0, 1));
|
|
86
|
-
}
|
|
87
|
-
// Tools section
|
|
88
|
-
modalContent.addChild(new ModalText("", 0, 1)); // Spacer
|
|
89
|
-
modalContent.addChild(new ModalText("Bash Tools Status:", 0, 1));
|
|
90
|
-
modalContent.addChild(new TableComponent(toolStatus, {
|
|
91
|
-
headers: ["Tool", "Status"],
|
|
92
|
-
}));
|
|
93
|
-
const toolSummary = `Tool Summary: ${installedCount}/${totalTools} tools are installed.`;
|
|
94
|
-
modalContent.addChild(new ModalText(toolSummary, 0, 1));
|
|
95
|
-
if (installedCount < totalTools) {
|
|
96
|
-
modalContent.addChild(new ModalText("⚠️ Some tools are missing. Install them for full functionality.", 0, 1));
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
modalContent.addChild(new ModalText("✓ All required tools are installed.", 0, 1));
|
|
100
|
-
}
|
|
101
|
-
// Memory usage
|
|
102
|
-
modalContent.addChild(new ModalText("", 0, 1)); // Spacer
|
|
103
|
-
modalContent.addChild(new ModalText("Current Process:", 0, 1));
|
|
104
|
-
const memoryText = usage >= 2 * 1024 * 1024 * 1024
|
|
105
|
-
? `Memory Usage: ${formattedUsage}`
|
|
106
|
-
: `Memory Usage: ${formattedUsage}`;
|
|
107
|
-
modalContent.addChild(new ModalText(memoryText, 0, 1));
|
|
108
|
-
// Create and show modal
|
|
109
|
-
const modal = new Modal("Health Status", modalContent, true, () => {
|
|
110
|
-
// Modal closed callback
|
|
111
|
-
editor.setText("");
|
|
112
|
-
tui.requestRender();
|
|
113
|
-
});
|
|
114
|
-
tui.showModal(modal);
|
|
115
|
-
return "continue";
|
|
116
|
-
},
|
|
117
|
-
};
|
|
118
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"help-command.d.ts","sourceRoot":"","sources":["../../source/commands/help-command.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9D,eAAO,MAAM,WAAW,GACtB,UAAU,cAAc,EACxB,MAAM,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,KAC7B,WA6CF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"history-command.d.ts","sourceRoot":"","sources":["../../source/commands/history-command.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AA2K9D,eAAO,MAAM,cAAc,GAAI,yDAK5B,cAAc,KAAG,WAkJnB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"init-command.d.ts","sourceRoot":"","sources":["../../source/commands/init-command.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAqB9D,eAAO,MAAM,WAAW,GAAI,4CAIzB,cAAc,KAAG,WAkDnB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"last-log-command.d.ts","sourceRoot":"","sources":["../../source/commands/last-log-command.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAyC9D,eAAO,MAAM,cAAc,GAAI,UAAU,cAAc,KAAG,WAiEzD,CAAC"}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { readFile } from "node:fs/promises";
|
|
2
|
-
import { join } from "node:path";
|
|
3
|
-
import { config } from "../config.js";
|
|
4
|
-
import style from "../terminal/style.js";
|
|
5
|
-
import { Text } from "../tui/index.js";
|
|
6
|
-
import { glob } from "../utils/glob.js";
|
|
7
|
-
const isoDateRegex = /^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z)/;
|
|
8
|
-
// Function to find the most recent log file
|
|
9
|
-
async function findMostRecentLog(logDir) {
|
|
10
|
-
const logPattern = join(logDir, "*-repl-message.json");
|
|
11
|
-
const files = await glob(logPattern);
|
|
12
|
-
if (files.length === 0) {
|
|
13
|
-
return null;
|
|
14
|
-
}
|
|
15
|
-
const datedFiles = files
|
|
16
|
-
.map((file) => {
|
|
17
|
-
const filename = file.split("/").pop();
|
|
18
|
-
if (!filename) {
|
|
19
|
-
return null; // Skip if filename is somehow undefined
|
|
20
|
-
}
|
|
21
|
-
// Match the ISO date string at the beginning of the filename
|
|
22
|
-
const match = filename.match(isoDateRegex);
|
|
23
|
-
if (match?.[1]) {
|
|
24
|
-
const date = new Date(match[1]);
|
|
25
|
-
if (!Number.isNaN(date.getTime())) {
|
|
26
|
-
return { file, date };
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return null; // Exclude files that don't match the pattern or have invalid dates
|
|
30
|
-
})
|
|
31
|
-
.filter((item) => item !== null);
|
|
32
|
-
if (datedFiles.length === 0) {
|
|
33
|
-
return null; // No valid log files found
|
|
34
|
-
}
|
|
35
|
-
// Sort files by date (descending)
|
|
36
|
-
datedFiles.sort((a, b) => b.date.getTime() - a.date.getTime());
|
|
37
|
-
return datedFiles[0]?.file ?? null; // The first file is the most recent
|
|
38
|
-
}
|
|
39
|
-
export const lastLogCommand = (_options) => {
|
|
40
|
-
return {
|
|
41
|
-
command: "/last-log",
|
|
42
|
-
description: "Opens the most recent REPL audit log in the editor.",
|
|
43
|
-
getSubCommands: () => Promise.resolve([]),
|
|
44
|
-
async handle(_args, { tui, container, editor, }) {
|
|
45
|
-
const logDir = config.app.ensurePathSync("audit");
|
|
46
|
-
const mostRecentLog = await findMostRecentLog(logDir);
|
|
47
|
-
if (!mostRecentLog) {
|
|
48
|
-
container.addChild(new Text(style.red(`No REPL audit logs found in '${logDir}'.`), 0, 1));
|
|
49
|
-
tui.requestRender();
|
|
50
|
-
editor.setText("");
|
|
51
|
-
return "continue";
|
|
52
|
-
}
|
|
53
|
-
try {
|
|
54
|
-
const content = await readFile(mostRecentLog, { encoding: "utf8" });
|
|
55
|
-
// For TUI mode, we'll just display a message since we can't use the editor prompt
|
|
56
|
-
container.addChild(new Text(`Viewing most recent log: ${style.blue(mostRecentLog)}`, 1, 0));
|
|
57
|
-
container.addChild(new Text(`Content length: ${content.length} characters`, 2, 0));
|
|
58
|
-
container.addChild(new Text(style.dim("Note: Full log viewing not available in TUI mode"), 3, 0));
|
|
59
|
-
tui.requestRender();
|
|
60
|
-
editor.setText("");
|
|
61
|
-
return "continue";
|
|
62
|
-
}
|
|
63
|
-
catch (error) {
|
|
64
|
-
container.addChild(new Text(style.red(`Error reading log file ${mostRecentLog}: ${error}`), 1, 0));
|
|
65
|
-
tui.requestRender();
|
|
66
|
-
editor.setText("");
|
|
67
|
-
return "continue";
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
};
|
|
71
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"list-directories-command.d.ts","sourceRoot":"","sources":["../../source/commands/list-directories-command.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9D,eAAO,MAAM,sBAAsB,GAAI,gBAEpC,cAAc,KAAG,WAkDnB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"list-tools-command.d.ts","sourceRoot":"","sources":["../../source/commands/list-tools-command.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9D,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,cAAc,GAAG,WAAW,CAgIrE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"model-command.d.ts","sourceRoot":"","sources":["../../source/commands/model-command.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9D,wBAAgB,YAAY,CAAC,OAAO,EAAE,cAAc,GAAG,WAAW,CAoIjE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"paste-command.d.ts","sourceRoot":"","sources":["../../source/commands/paste-command.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAsH9D,eAAO,MAAM,YAAY,GAAI,gDAI1B,cAAc,KAAG,WAwKnB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pickup-command.d.ts","sourceRoot":"","sources":["../../source/commands/pickup-command.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9D,eAAO,MAAM,aAAa,GAAI,SAAS,cAAc,KAAG,WAuIvD,CAAC"}
|