@travisennis/acai 0.0.6 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +225 -39
- package/dist/agent/index.d.ts +30 -21
- package/dist/agent/index.d.ts.map +1 -1
- package/dist/agent/index.js +237 -198
- package/dist/cli.d.ts +4 -3
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +56 -18
- 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/index.js +50 -0
- 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/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} +1 -7
- package/dist/commands/copy/index.d.ts +3 -0
- package/dist/commands/copy/index.d.ts.map +1 -0
- package/dist/commands/copy/index.js +39 -0
- 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/index.d.ts +10 -0
- 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} +65 -147
- 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/utils.js +123 -0
- 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/index.d.ts +3 -0
- package/dist/commands/help/index.d.ts.map +1 -0
- package/dist/commands/{help-command.js → help/index.js} +6 -14
- 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} +40 -200
- 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} +17 -27
- 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} +2 -15
- 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/index.js +89 -0
- package/dist/commands/manager.d.ts +2 -9
- package/dist/commands/manager.d.ts.map +1 -1
- package/dist/commands/manager.js +38 -83
- package/dist/commands/model/index.d.ts +3 -0
- package/dist/commands/model/index.d.ts.map +1 -0
- package/dist/commands/model/index.js +182 -0
- 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/index.d.ts +3 -0
- package/dist/commands/paste/index.d.ts.map +1 -0
- package/dist/commands/paste/index.js +94 -0
- package/dist/commands/paste/utils.d.ts +5 -0
- package/dist/commands/paste/utils.d.ts.map +1 -0
- package/dist/commands/paste/utils.js +86 -0
- package/dist/commands/pickup/index.d.ts +3 -0
- package/dist/commands/pickup/index.d.ts.map +1 -0
- package/dist/commands/pickup/index.js +138 -0
- package/dist/commands/pickup/types.d.ts +6 -0
- package/dist/commands/pickup/types.d.ts.map +1 -0
- package/dist/commands/pickup/types.js +1 -0
- package/dist/commands/pickup/utils.d.ts +7 -0
- package/dist/commands/pickup/utils.d.ts.map +1 -0
- package/dist/commands/pickup/utils.js +56 -0
- package/dist/commands/prompt/index.d.ts +5 -0
- package/dist/commands/prompt/index.d.ts.map +1 -0
- package/dist/commands/prompt/index.js +126 -0
- package/dist/commands/prompt/types.d.ts +15 -0
- package/dist/commands/prompt/types.d.ts.map +1 -0
- package/dist/commands/prompt/types.js +1 -0
- package/dist/commands/prompt/utils.d.ts +12 -0
- package/dist/commands/prompt/utils.d.ts.map +1 -0
- package/dist/commands/prompt/utils.js +107 -0
- package/dist/commands/remove-directory/index.d.ts +3 -0
- package/dist/commands/remove-directory/index.d.ts.map +1 -0
- package/dist/commands/{remove-directory-command.js → remove-directory/index.js} +3 -35
- 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} +8 -11
- 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 -10
- package/dist/commands/session/index.d.ts +3 -0
- package/dist/commands/session/index.d.ts.map +1 -0
- package/dist/commands/session/index.js +197 -0
- package/dist/commands/session/types.d.ts +13 -0
- package/dist/commands/session/types.d.ts.map +1 -0
- package/dist/commands/session/types.js +7 -0
- package/dist/commands/shell/index.d.ts +3 -0
- package/dist/commands/shell/index.d.ts.map +1 -0
- package/dist/commands/{shell-command.js → shell/index.js} +4 -51
- package/dist/commands/types.d.ts +2 -5
- package/dist/commands/types.d.ts.map +1 -1
- package/dist/config.d.ts +36 -7
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +118 -60
- package/dist/dedent.d.ts.map +1 -1
- package/dist/dedent.js +7 -7
- package/dist/execution/index.d.ts +18 -2
- package/dist/execution/index.d.ts.map +1 -1
- package/dist/execution/index.js +119 -81
- package/dist/formatting.d.ts +46 -0
- package/dist/formatting.d.ts.map +1 -1
- package/dist/formatting.js +94 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +299 -177
- 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/anthropic-provider.js +0 -7
- package/dist/models/deepseek-provider.d.ts +9 -8
- package/dist/models/deepseek-provider.d.ts.map +1 -1
- package/dist/models/deepseek-provider.js +0 -2
- package/dist/models/google-provider.d.ts +10 -9
- package/dist/models/google-provider.d.ts.map +1 -1
- package/dist/models/google-provider.js +0 -3
- package/dist/models/groq-provider.d.ts +8 -7
- package/dist/models/groq-provider.d.ts.map +1 -1
- package/dist/models/groq-provider.js +0 -1
- package/dist/models/manager.d.ts +7 -4
- package/dist/models/manager.d.ts.map +1 -1
- package/dist/models/manager.js +5 -25
- package/dist/models/openai-provider.d.ts +11 -10
- package/dist/models/openai-provider.d.ts.map +1 -1
- package/dist/models/openai-provider.js +0 -4
- package/dist/models/opencode-zen-provider.d.ts +23 -0
- package/dist/models/opencode-zen-provider.d.ts.map +1 -0
- package/dist/models/opencode-zen-provider.js +76 -0
- package/dist/models/openrouter-provider.d.ts +34 -28
- package/dist/models/openrouter-provider.d.ts.map +1 -1
- package/dist/models/openrouter-provider.js +148 -139
- package/dist/models/providers.d.ts +6 -16
- package/dist/models/providers.d.ts.map +1 -1
- package/dist/models/providers.js +8 -58
- package/dist/models/xai-provider.d.ts +9 -8
- package/dist/models/xai-provider.d.ts.map +1 -1
- package/dist/models/xai-provider.js +0 -2
- 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 +8 -4
- package/dist/prompts.d.ts.map +1 -1
- package/dist/prompts.js +155 -177
- package/dist/repl/project-status.d.ts +19 -0
- package/dist/repl/project-status.d.ts.map +1 -0
- package/dist/repl/project-status.js +78 -0
- package/dist/repl-new.d.ts +15 -6
- package/dist/repl-new.d.ts.map +1 -1
- package/dist/repl-new.js +266 -83
- package/dist/{messages.d.ts → sessions/manager.d.ts} +13 -4
- package/dist/sessions/manager.d.ts.map +1 -0
- package/dist/{messages.js → sessions/manager.js} +126 -16
- package/dist/skills.d.ts +16 -0
- package/dist/skills.d.ts.map +1 -0
- package/dist/skills.js +233 -0
- package/dist/terminal/control.d.ts +56 -0
- package/dist/terminal/control.d.ts.map +1 -0
- package/dist/terminal/control.js +111 -0
- package/dist/terminal/default-theme.d.ts +1 -1
- package/dist/terminal/default-theme.d.ts.map +1 -1
- package/dist/terminal/default-theme.js +24 -28
- package/dist/terminal/formatting.d.ts +23 -26
- package/dist/terminal/formatting.d.ts.map +1 -1
- package/dist/terminal/formatting.js +35 -53
- package/dist/terminal/highlight/index.d.ts.map +1 -1
- package/dist/terminal/highlight/index.js +3 -6
- package/dist/terminal/highlight/theme.d.ts.map +1 -1
- package/dist/terminal/highlight/theme.js +2 -6
- package/dist/terminal/index.d.ts +2 -101
- package/dist/terminal/index.d.ts.map +1 -1
- package/dist/terminal/index.js +2 -464
- 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/terminal/table/cell.d.ts +114 -0
- package/dist/terminal/table/cell.d.ts.map +1 -0
- package/dist/terminal/table/cell.js +407 -0
- package/dist/terminal/table/debug.d.ts +15 -0
- package/dist/terminal/table/debug.d.ts.map +1 -0
- package/dist/terminal/table/debug.js +32 -0
- package/dist/terminal/table/index.d.ts +3 -0
- package/dist/terminal/table/index.d.ts.map +1 -0
- package/dist/terminal/table/index.js +2 -0
- package/dist/terminal/table/layout-manager.d.ts +27 -0
- package/dist/terminal/table/layout-manager.d.ts.map +1 -0
- package/dist/terminal/table/layout-manager.js +257 -0
- package/dist/terminal/table/table.d.ts +9 -0
- package/dist/terminal/table/table.d.ts.map +1 -0
- package/dist/terminal/table/table.js +97 -0
- package/dist/terminal/table/utils.d.ts +63 -0
- package/dist/terminal/table/utils.d.ts.map +1 -0
- package/dist/terminal/table/utils.js +326 -0
- package/dist/tokens/tracker.d.ts.map +1 -1
- package/dist/tokens/tracker.js +58 -16
- package/dist/tools/bash.d.ts +11 -11
- package/dist/tools/bash.d.ts.map +1 -1
- package/dist/tools/bash.js +189 -81
- package/dist/tools/directory-tree.d.ts +9 -13
- package/dist/tools/directory-tree.d.ts.map +1 -1
- package/dist/tools/directory-tree.js +90 -60
- package/dist/tools/dynamic-tool-loader.d.ts +22 -8
- package/dist/tools/dynamic-tool-loader.d.ts.map +1 -1
- package/dist/tools/dynamic-tool-loader.js +41 -46
- 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 +22 -66
- package/dist/tools/glob.d.ts +15 -16
- package/dist/tools/glob.d.ts.map +1 -1
- package/dist/tools/glob.js +78 -109
- package/dist/tools/grep.d.ts +19 -22
- package/dist/tools/grep.d.ts.map +1 -1
- package/dist/tools/grep.js +61 -93
- package/dist/tools/index.d.ts +202 -167
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +17 -273
- 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 +52 -76
- package/dist/tools/save-file.d.ts +8 -8
- package/dist/tools/save-file.d.ts.map +1 -1
- package/dist/tools/save-file.js +42 -53
- package/dist/tools/think.d.ts +4 -4
- package/dist/tools/think.d.ts.map +1 -1
- package/dist/tools/think.js +9 -32
- package/dist/tools/types.d.ts +5 -21
- 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/assistant-message.js +1 -1
- package/dist/tui/components/box.d.ts +20 -0
- package/dist/tui/components/box.d.ts.map +1 -0
- package/dist/tui/components/box.js +87 -0
- package/dist/tui/components/editor.d.ts +61 -7
- package/dist/tui/components/editor.d.ts.map +1 -1
- package/dist/tui/components/editor.js +630 -127
- package/dist/tui/components/footer.d.ts +19 -18
- package/dist/tui/components/footer.d.ts.map +1 -1
- package/dist/tui/components/footer.js +90 -185
- package/dist/tui/components/header.d.ts +21 -0
- package/dist/tui/components/header.d.ts.map +1 -0
- package/dist/tui/components/header.js +63 -0
- 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 +6 -1
- package/dist/tui/components/loader.d.ts.map +1 -1
- package/dist/tui/components/loader.js +8 -3
- package/dist/tui/components/markdown.d.ts +31 -27
- package/dist/tui/components/markdown.d.ts.map +1 -1
- package/dist/tui/components/markdown.js +131 -67
- package/dist/tui/components/modal.d.ts +0 -11
- package/dist/tui/components/modal.d.ts.map +1 -1
- package/dist/tui/components/modal.js +9 -37
- package/dist/tui/components/notification.d.ts +28 -0
- package/dist/tui/components/notification.d.ts.map +1 -0
- package/dist/tui/components/notification.js +63 -0
- package/dist/tui/components/progress-bar.d.ts +19 -0
- package/dist/tui/components/progress-bar.d.ts.map +1 -0
- package/dist/tui/components/progress-bar.js +66 -0
- package/dist/tui/components/select-list.d.ts +12 -1
- package/dist/tui/components/select-list.d.ts.map +1 -1
- package/dist/tui/components/select-list.js +73 -32
- package/dist/tui/components/spacer.d.ts +1 -1
- package/dist/tui/components/spacer.d.ts.map +1 -1
- package/dist/tui/components/spacer.js +2 -2
- package/dist/tui/components/table.d.ts +27 -0
- package/dist/tui/components/table.d.ts.map +1 -0
- package/dist/tui/components/table.js +125 -0
- package/dist/tui/components/thinking-block.d.ts.map +1 -1
- package/dist/tui/components/thinking-block.js +4 -1
- package/dist/tui/components/tool-execution.d.ts +7 -6
- package/dist/tui/components/tool-execution.d.ts.map +1 -1
- package/dist/tui/components/tool-execution.js +81 -85
- package/dist/tui/components/user-message.d.ts.map +1 -1
- package/dist/tui/components/user-message.js +6 -4
- package/dist/tui/components/welcome.d.ts +8 -1
- package/dist/tui/components/welcome.d.ts.map +1 -1
- package/dist/tui/components/welcome.js +45 -6
- package/dist/tui/index.d.ts +12 -6
- package/dist/tui/index.d.ts.map +1 -1
- package/dist/tui/index.js +7 -3
- package/dist/tui/terminal.d.ts +4 -3
- package/dist/tui/terminal.d.ts.map +1 -1
- package/dist/tui/terminal.js +43 -49
- package/dist/tui/tui.d.ts +3 -0
- package/dist/tui/tui.d.ts.map +1 -1
- package/dist/tui/tui.js +58 -43
- package/dist/tui/utils.d.ts +5 -0
- package/dist/tui/utils.d.ts.map +1 -1
- package/dist/tui/utils.js +80 -1
- package/dist/{tools/bash-utils.d.ts → utils/bash.d.ts} +3 -3
- package/dist/utils/bash.d.ts.map +1 -0
- package/dist/{tools/bash-utils.js → utils/bash.js} +22 -11
- package/dist/utils/{filesystem.d.ts → filesystem/operations.d.ts} +1 -1
- package/dist/utils/filesystem/operations.d.ts.map +1 -0
- package/dist/{tools/filesystem-utils.d.ts → utils/filesystem/security.d.ts} +3 -2
- package/dist/utils/filesystem/security.d.ts.map +1 -0
- package/dist/{tools/filesystem-utils.js → utils/filesystem/security.js} +62 -4
- package/dist/utils/funcs.d.ts +6 -0
- package/dist/utils/funcs.d.ts.map +1 -0
- package/dist/utils/funcs.js +6 -0
- package/dist/{tools/git-utils.d.ts → utils/git.d.ts} +1 -1
- package/dist/utils/git.d.ts.map +1 -0
- package/dist/{tools/git-utils.js → utils/git.js} +0 -6
- package/dist/utils/glob.js +1 -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-utils.d.ts → zod.d.ts} +2 -1
- package/dist/utils/zod.d.ts.map +1 -0
- package/dist/utils/zod.js +24 -0
- package/package.json +31 -29
- package/dist/agent/manual-loop.d.ts +0 -41
- package/dist/agent/manual-loop.d.ts.map +0 -1
- package/dist/agent/manual-loop.js +0 -278
- 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/add-directory-command.js +0 -85
- 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 -79
- 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 -64
- 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 -183
- package/dist/commands/copy-command.d.ts +0 -3
- package/dist/commands/copy-command.d.ts.map +0 -1
- package/dist/commands/copy-command.js +0 -80
- 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 -88
- 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 -61
- package/dist/commands/exit-command.d.ts +0 -13
- package/dist/commands/exit-command.d.ts.map +0 -1
- package/dist/commands/exit-command.js +0 -46
- 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 -121
- 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/handoff-command.js +0 -202
- 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 -213
- package/dist/commands/help-command.d.ts +0 -3
- 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 -98
- 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/list-tools-command.js +0 -124
- package/dist/commands/model-command.d.ts +0 -25
- package/dist/commands/model-command.d.ts.map +0 -1
- package/dist/commands/model-command.js +0 -340
- package/dist/commands/paste-command.d.ts +0 -3
- package/dist/commands/paste-command.d.ts.map +0 -1
- package/dist/commands/paste-command.js +0 -277
- 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 -161
- package/dist/commands/prompt-command.d.ts +0 -3
- package/dist/commands/prompt-command.d.ts.map +0 -1
- package/dist/commands/prompt-command.js +0 -280
- 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 -135
- 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 -42
- package/dist/messages.d.ts.map +0 -1
- package/dist/repl/display-tool-messages.d.ts +0 -4
- package/dist/repl/display-tool-messages.d.ts.map +0 -1
- package/dist/repl/display-tool-messages.js +0 -58
- package/dist/repl/display-tool-use.d.ts +0 -14
- package/dist/repl/display-tool-use.d.ts.map +0 -1
- package/dist/repl/display-tool-use.js +0 -63
- package/dist/repl/get-prompt-header.d.ts +0 -8
- package/dist/repl/get-prompt-header.d.ts.map +0 -1
- package/dist/repl/get-prompt-header.js +0 -9
- package/dist/repl/project-status-line.d.ts +0 -2
- package/dist/repl/project-status-line.d.ts.map +0 -1
- package/dist/repl/project-status-line.js +0 -31
- package/dist/repl/prompt.d.ts +0 -21
- package/dist/repl/prompt.d.ts.map +0 -1
- package/dist/repl/prompt.js +0 -244
- 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/repl.d.ts +0 -29
- package/dist/repl.d.ts.map +0 -1
- package/dist/repl.js +0 -218
- package/dist/terminal/checkbox-prompt.d.ts +0 -36
- package/dist/terminal/checkbox-prompt.d.ts.map +0 -1
- package/dist/terminal/checkbox-prompt.js +0 -368
- package/dist/terminal/editor-prompt.d.ts +0 -10
- package/dist/terminal/editor-prompt.d.ts.map +0 -1
- package/dist/terminal/editor-prompt.js +0 -61
- package/dist/terminal/errors.d.ts +0 -19
- package/dist/terminal/errors.d.ts.map +0 -1
- package/dist/terminal/errors.js +0 -37
- package/dist/terminal/input-prompt.d.ts +0 -17
- package/dist/terminal/input-prompt.d.ts.map +0 -1
- package/dist/terminal/input-prompt.js +0 -181
- package/dist/terminal/markdown.d.ts +0 -2
- package/dist/terminal/markdown.d.ts.map +0 -1
- package/dist/terminal/markdown.js +0 -118
- package/dist/terminal/search-prompt.d.ts +0 -20
- package/dist/terminal/search-prompt.d.ts.map +0 -1
- package/dist/terminal/search-prompt.js +0 -280
- package/dist/terminal/types.d.ts +0 -35
- package/dist/terminal/types.d.ts.map +0 -1
- package/dist/tokens/threshold.d.ts +0 -35
- package/dist/tokens/threshold.d.ts.map +0 -1
- package/dist/tokens/threshold.js +0 -85
- 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 -281
- package/dist/tools/agent.d.ts +0 -29
- package/dist/tools/agent.d.ts.map +0 -1
- package/dist/tools/agent.js +0 -103
- package/dist/tools/bash-utils.d.ts.map +0 -1
- 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 -167
- 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 -70
- 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/filesystem-utils.d.ts.map +0 -1
- package/dist/tools/git-utils.d.ts.map +0 -1
- package/dist/tools/llm-edit-fixer.d.ts +0 -25
- package/dist/tools/llm-edit-fixer.d.ts.map +0 -1
- package/dist/tools/llm-edit-fixer.js +0 -150
- 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 -58
- 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 -139
- 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 -133
- package/dist/tui/components/prompt-status.d.ts +0 -16
- package/dist/tui/components/prompt-status.d.ts.map +0 -1
- package/dist/tui/components/prompt-status.js +0 -21
- package/dist/utils/filesystem.d.ts.map +0 -1
- package/dist/utils/zod-utils.d.ts.map +0 -1
- package/dist/utils/zod-utils.js +0 -7
- /package/dist/{terminal → commands/add-directory}/types.js +0 -0
- /package/dist/utils/{filesystem.js → filesystem/operations.js} +0 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
export function parseGitDiffFiles(diffOutput) {
|
|
2
|
+
const lines = diffOutput.split("\n");
|
|
3
|
+
const fileChanges = [];
|
|
4
|
+
let currentFile = null;
|
|
5
|
+
let inDiff = false;
|
|
6
|
+
let isNewFile = false;
|
|
7
|
+
for (const line of lines) {
|
|
8
|
+
if (line.startsWith("diff --git")) {
|
|
9
|
+
if (currentFile) {
|
|
10
|
+
fileChanges.push(currentFile);
|
|
11
|
+
}
|
|
12
|
+
const fileMatch = line.match(/diff --git a\/(.*) b\/(.*)/);
|
|
13
|
+
if (fileMatch) {
|
|
14
|
+
currentFile = {
|
|
15
|
+
fileName: fileMatch[1],
|
|
16
|
+
diff: "",
|
|
17
|
+
stats: "",
|
|
18
|
+
};
|
|
19
|
+
inDiff = true;
|
|
20
|
+
isNewFile =
|
|
21
|
+
fileMatch[1] === "/dev/null" || fileMatch[2] === "/dev/null";
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
else if (line.startsWith("@@")) {
|
|
25
|
+
const statsMatch = line.match(/@@ -(\d+),(\d+) \+(\d+),(\d+) @@/);
|
|
26
|
+
if (statsMatch && currentFile) {
|
|
27
|
+
const deletions = Number.parseInt(statsMatch[2], 10);
|
|
28
|
+
const additions = Number.parseInt(statsMatch[4], 10);
|
|
29
|
+
const actualDeletions = isNewFile ? 0 : deletions;
|
|
30
|
+
currentFile.stats = `Additions: ${additions}, Deletions: ${actualDeletions}`;
|
|
31
|
+
}
|
|
32
|
+
else if (currentFile) {
|
|
33
|
+
currentFile.stats = "Additions: 1, Deletions: 0";
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
else if (inDiff && currentFile) {
|
|
37
|
+
if ((line.startsWith("+") && !line.startsWith("+++")) ||
|
|
38
|
+
(line.startsWith("-") && !line.startsWith("---")) ||
|
|
39
|
+
line.startsWith(" ") ||
|
|
40
|
+
line.startsWith("index") ||
|
|
41
|
+
line.startsWith("old mode") ||
|
|
42
|
+
line.startsWith("new mode") ||
|
|
43
|
+
line.startsWith("deleted file") ||
|
|
44
|
+
line.startsWith("new file")) {
|
|
45
|
+
currentFile.diff += `${line}\n`;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (currentFile) {
|
|
50
|
+
fileChanges.push(currentFile);
|
|
51
|
+
}
|
|
52
|
+
return fileChanges;
|
|
53
|
+
}
|
|
54
|
+
export function formatFileDiffForDisplay(fileName, diff) {
|
|
55
|
+
// Note: Cannot use style here as it's a UI concern - this is a display utility
|
|
56
|
+
const lines = diff.split("\n");
|
|
57
|
+
const formattedLines = [];
|
|
58
|
+
formattedLines.push(`### ${fileName}`);
|
|
59
|
+
formattedLines.push("");
|
|
60
|
+
for (const line of lines) {
|
|
61
|
+
if (line.startsWith("+") && !line.startsWith("+++")) {
|
|
62
|
+
formattedLines.push(`+${line.substring(1)}`);
|
|
63
|
+
}
|
|
64
|
+
else if (line.startsWith("-") && !line.startsWith("---")) {
|
|
65
|
+
formattedLines.push(`-${line.substring(1)}`);
|
|
66
|
+
}
|
|
67
|
+
else if (line.startsWith(" ")) {
|
|
68
|
+
formattedLines.push(` ${line.substring(1)}`);
|
|
69
|
+
}
|
|
70
|
+
else if (line.startsWith("@@")) {
|
|
71
|
+
formattedLines.push(line);
|
|
72
|
+
}
|
|
73
|
+
else if (line.startsWith("index") ||
|
|
74
|
+
line.startsWith("old mode") ||
|
|
75
|
+
line.startsWith("new mode") ||
|
|
76
|
+
line.startsWith("deleted file") ||
|
|
77
|
+
line.startsWith("new file")) {
|
|
78
|
+
formattedLines.push(line);
|
|
79
|
+
}
|
|
80
|
+
else if (line.trim() === "") {
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
formattedLines.push(line);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return formattedLines.join("\n");
|
|
87
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/commands/save/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/D,eAAO,MAAM,WAAW,GAAI,qCAEzB,cAAc,KAAG,WAyBnB,CAAC"}
|
|
@@ -1,17 +1,10 @@
|
|
|
1
|
-
import style from "
|
|
2
|
-
import { Spacer, Text } from "
|
|
3
|
-
export const saveCommand = ({ messageHistory,
|
|
1
|
+
import style from "../../terminal/style.js";
|
|
2
|
+
import { Spacer, Text } from "../../tui/index.js";
|
|
3
|
+
export const saveCommand = ({ sessionManager: messageHistory, }) => {
|
|
4
4
|
return {
|
|
5
5
|
command: "/save",
|
|
6
6
|
description: "Saves the chat history.",
|
|
7
7
|
getSubCommands: () => Promise.resolve([]),
|
|
8
|
-
execute: async () => {
|
|
9
|
-
if (!messageHistory.isEmpty()) {
|
|
10
|
-
await messageHistory.save();
|
|
11
|
-
}
|
|
12
|
-
terminal.info("Message history saved.");
|
|
13
|
-
return "continue";
|
|
14
|
-
},
|
|
15
8
|
async handle(_args, { tui, container, editor, }) {
|
|
16
9
|
if (!messageHistory.isEmpty()) {
|
|
17
10
|
await messageHistory.save();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/commands/session/index.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAI/D,wBAAgB,cAAc,CAAC,EAC7B,MAAM,EACN,YAAY,EACZ,YAAY,EACZ,cAAc,EAAE,cAAc,EAC9B,SAAS,EACT,YAAY,GACb,EAAE,cAAc,GAAG,WAAW,CA2O9B"}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { tool } from "ai";
|
|
2
|
+
import { formatDate, formatDuration, formatNumber, formatPercentage, } from "../../formatting.js";
|
|
3
|
+
import { logger } from "../../logger.js";
|
|
4
|
+
import { systemPrompt } from "../../prompts.js";
|
|
5
|
+
import { getTerminalSize } from "../../terminal/control.js";
|
|
6
|
+
import { initTools, } from "../../tools/index.js";
|
|
7
|
+
import { prepareTools } from "../../tools/utils.js";
|
|
8
|
+
import { Container, Modal, ModalText, TableComponent, } from "../../tui/index.js";
|
|
9
|
+
import { countMessageTokens } from "./types.js";
|
|
10
|
+
export function sessionCommand({ config, tokenCounter, modelManager, sessionManager: messageHistory, workspace, tokenTracker, }) {
|
|
11
|
+
return {
|
|
12
|
+
command: "/session",
|
|
13
|
+
description: "Show comprehensive session information including usage, context, and costs",
|
|
14
|
+
getSubCommands: () => Promise.resolve([]),
|
|
15
|
+
async handle(_args, { tui, editor }) {
|
|
16
|
+
const meta = modelManager.getModelMetadata("repl");
|
|
17
|
+
const window = meta.contextWindow;
|
|
18
|
+
const projectConfig = await config.getConfig();
|
|
19
|
+
const sys = await systemPrompt({
|
|
20
|
+
activeTools: projectConfig.tools.activeTools,
|
|
21
|
+
allowedDirs: workspace.allowedDirs,
|
|
22
|
+
includeRules: true,
|
|
23
|
+
});
|
|
24
|
+
const systemPromptTokens = tokenCounter.count(sys);
|
|
25
|
+
let toolsTokens = 0;
|
|
26
|
+
try {
|
|
27
|
+
const tools = await initTools({
|
|
28
|
+
workspace,
|
|
29
|
+
});
|
|
30
|
+
const toolDefs = Object.fromEntries(Object.entries(tools).map((t) => [
|
|
31
|
+
t[0],
|
|
32
|
+
// biome-ignore lint/suspicious/noExplicitAny: temporary
|
|
33
|
+
tool(t[1].toolDef),
|
|
34
|
+
]));
|
|
35
|
+
const toolNames = JSON.stringify(prepareTools(toolDefs));
|
|
36
|
+
toolsTokens = tokenCounter.count(toolNames);
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
logger.info({ error: error instanceof Error ? error.message : String(error) }, "Failed to calculate tools tokens");
|
|
40
|
+
toolsTokens = 0;
|
|
41
|
+
}
|
|
42
|
+
const messages = messageHistory.get();
|
|
43
|
+
const messagesTokens = countMessageTokens(messages, tokenCounter);
|
|
44
|
+
const used = systemPromptTokens + toolsTokens + messagesTokens;
|
|
45
|
+
const free = Math.max(0, window - used);
|
|
46
|
+
const usedPercentage = window > 0 ? (used / window) * 100 : 0;
|
|
47
|
+
const breakdown = {
|
|
48
|
+
systemPrompt: systemPromptTokens,
|
|
49
|
+
tools: toolsTokens,
|
|
50
|
+
messages: messagesTokens,
|
|
51
|
+
totalUsed: used,
|
|
52
|
+
window,
|
|
53
|
+
free,
|
|
54
|
+
};
|
|
55
|
+
const sessionId = messageHistory.getSessionId();
|
|
56
|
+
const sessionFile = `message-history-${sessionId}.json`;
|
|
57
|
+
const modelId = messageHistory.getModelId() || "Not set";
|
|
58
|
+
const title = messageHistory.getTitle() || "No title";
|
|
59
|
+
const createdAt = messageHistory.getCreatedAt();
|
|
60
|
+
const updatedAt = messageHistory.getUpdatedAt();
|
|
61
|
+
const duration = formatDuration(updatedAt.getTime() - createdAt.getTime());
|
|
62
|
+
const messageCount = messages.length;
|
|
63
|
+
const userMessages = messages.filter((m) => m.role === "user").length;
|
|
64
|
+
const assistantMessages = messages.filter((m) => m.role === "assistant").length;
|
|
65
|
+
const toolMessages = messages.filter((m) => m.role === "tool").length;
|
|
66
|
+
const totalUsage = tokenTracker.getTotalUsage();
|
|
67
|
+
const inputTokens = totalUsage.inputTokens ?? 0;
|
|
68
|
+
const outputTokens = totalUsage.outputTokens ?? 0;
|
|
69
|
+
const totalTokens = inputTokens + outputTokens;
|
|
70
|
+
const inputCost = (meta.costPerInputToken ?? 0) * inputTokens;
|
|
71
|
+
const outputCost = (meta.costPerOutputToken ?? 0) * outputTokens;
|
|
72
|
+
const totalCost = inputCost + outputCost;
|
|
73
|
+
const usageBreakdown = tokenTracker.getUsageBreakdown();
|
|
74
|
+
const { columns } = getTerminalSize();
|
|
75
|
+
const modalContent = new Container();
|
|
76
|
+
modalContent.addChild(new ModalText("Session Overview", 0, 1));
|
|
77
|
+
modalContent.addChild(new ModalText("─".repeat(columns - 10), 0, 1));
|
|
78
|
+
const metadataTable = [
|
|
79
|
+
["Session ID", sessionId],
|
|
80
|
+
["Session File", sessionFile],
|
|
81
|
+
["Model", modelId],
|
|
82
|
+
["Title", title],
|
|
83
|
+
["Duration", duration],
|
|
84
|
+
["Started", formatDate(createdAt)],
|
|
85
|
+
["Last Updated", formatDate(updatedAt)],
|
|
86
|
+
];
|
|
87
|
+
modalContent.addChild(new TableComponent(metadataTable, {
|
|
88
|
+
headers: ["Property", "Value"],
|
|
89
|
+
colWidths: [25, 75],
|
|
90
|
+
}));
|
|
91
|
+
modalContent.addChild(new ModalText("", 0, 1));
|
|
92
|
+
modalContent.addChild(new ModalText("Message Statistics", 0, 1));
|
|
93
|
+
const messageStatsTable = [
|
|
94
|
+
["Total Messages", String(messageCount)],
|
|
95
|
+
["User Messages", String(userMessages)],
|
|
96
|
+
["Assistant Messages", String(assistantMessages)],
|
|
97
|
+
["Tool Messages", String(toolMessages)],
|
|
98
|
+
];
|
|
99
|
+
modalContent.addChild(new TableComponent(messageStatsTable, {
|
|
100
|
+
headers: ["Type", "Count"],
|
|
101
|
+
}));
|
|
102
|
+
modalContent.addChild(new ModalText("", 0, 1));
|
|
103
|
+
modalContent.addChild(new ModalText("Context Usage", 0, 1));
|
|
104
|
+
const contextTable = [
|
|
105
|
+
[
|
|
106
|
+
"System Prompt",
|
|
107
|
+
formatNumber(breakdown.systemPrompt),
|
|
108
|
+
formatPercentage(breakdown.systemPrompt, window),
|
|
109
|
+
],
|
|
110
|
+
[
|
|
111
|
+
"System Tools",
|
|
112
|
+
formatNumber(breakdown.tools),
|
|
113
|
+
formatPercentage(breakdown.tools, window),
|
|
114
|
+
],
|
|
115
|
+
[
|
|
116
|
+
"Messages",
|
|
117
|
+
formatNumber(breakdown.messages),
|
|
118
|
+
formatPercentage(breakdown.messages, window),
|
|
119
|
+
],
|
|
120
|
+
[
|
|
121
|
+
"Free Space",
|
|
122
|
+
formatNumber(breakdown.free),
|
|
123
|
+
formatPercentage(breakdown.free, window),
|
|
124
|
+
],
|
|
125
|
+
[
|
|
126
|
+
"Total Used",
|
|
127
|
+
formatNumber(breakdown.totalUsed),
|
|
128
|
+
formatPercentage(breakdown.totalUsed, window),
|
|
129
|
+
],
|
|
130
|
+
["Context Window", formatNumber(window), "100%"],
|
|
131
|
+
];
|
|
132
|
+
modalContent.addChild(new TableComponent(contextTable, {
|
|
133
|
+
headers: ["Section", "Tokens", "Percent"],
|
|
134
|
+
}));
|
|
135
|
+
const barWidth = Math.max(20, Math.min(50, columns - 40));
|
|
136
|
+
const filled = Math.floor((usedPercentage / 100) * barWidth);
|
|
137
|
+
const empty = barWidth - filled;
|
|
138
|
+
const progressBar = `[${"█".repeat(filled)}${"░".repeat(empty)}] ${usedPercentage.toFixed(1)}%`;
|
|
139
|
+
modalContent.addChild(new ModalText("", 0, 1));
|
|
140
|
+
modalContent.addChild(new ModalText(progressBar, 0, 1));
|
|
141
|
+
modalContent.addChild(new ModalText("", 0, 1));
|
|
142
|
+
modalContent.addChild(new ModalText("Token Usage & Costs", 0, 1));
|
|
143
|
+
const formatCost = (cost) => {
|
|
144
|
+
if (cost === 0)
|
|
145
|
+
return "$0.00";
|
|
146
|
+
if (cost < 0.01)
|
|
147
|
+
return `$${cost.toFixed(6)}`;
|
|
148
|
+
if (cost < 1)
|
|
149
|
+
return `$${cost.toFixed(4)}`;
|
|
150
|
+
return `$${cost.toFixed(2)}`;
|
|
151
|
+
};
|
|
152
|
+
const tokenTable = [
|
|
153
|
+
[
|
|
154
|
+
"Input Tokens",
|
|
155
|
+
formatNumber(inputTokens),
|
|
156
|
+
formatCost(inputCost),
|
|
157
|
+
meta.costPerInputToken
|
|
158
|
+
? `$${meta.costPerInputToken.toFixed(6)}/token`
|
|
159
|
+
: "N/A",
|
|
160
|
+
],
|
|
161
|
+
[
|
|
162
|
+
"Output Tokens",
|
|
163
|
+
formatNumber(outputTokens),
|
|
164
|
+
formatCost(outputCost),
|
|
165
|
+
meta.costPerOutputToken
|
|
166
|
+
? `$${meta.costPerOutputToken.toFixed(6)}/token`
|
|
167
|
+
: "N/A",
|
|
168
|
+
],
|
|
169
|
+
["Total Tokens", formatNumber(totalTokens), formatCost(totalCost), ""],
|
|
170
|
+
];
|
|
171
|
+
modalContent.addChild(new TableComponent(tokenTable, {
|
|
172
|
+
headers: ["Type", "Tokens", "Cost", "Rate"],
|
|
173
|
+
}));
|
|
174
|
+
modalContent.addChild(new ModalText("", 0, 1));
|
|
175
|
+
if (Object.keys(usageBreakdown).length > 0) {
|
|
176
|
+
modalContent.addChild(new ModalText("Usage by Application", 0, 1));
|
|
177
|
+
const usageEntries = Object.entries(usageBreakdown);
|
|
178
|
+
const usageTable = usageEntries.map(([app, tokens]) => [
|
|
179
|
+
app,
|
|
180
|
+
formatNumber(tokens),
|
|
181
|
+
]);
|
|
182
|
+
modalContent.addChild(new TableComponent(usageTable, {
|
|
183
|
+
headers: ["Application", "Tokens"],
|
|
184
|
+
}));
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
modalContent.addChild(new ModalText("No usage data available", 0, 1));
|
|
188
|
+
}
|
|
189
|
+
const modal = new Modal("Session Information", modalContent, true, () => {
|
|
190
|
+
editor.setText("");
|
|
191
|
+
tui.requestRender();
|
|
192
|
+
});
|
|
193
|
+
tui.showModal(modal);
|
|
194
|
+
return "continue";
|
|
195
|
+
},
|
|
196
|
+
};
|
|
197
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ModelMessage } from "ai";
|
|
2
|
+
export type Breakdown = {
|
|
3
|
+
systemPrompt: number;
|
|
4
|
+
tools: number;
|
|
5
|
+
messages: number;
|
|
6
|
+
totalUsed: number;
|
|
7
|
+
window: number;
|
|
8
|
+
free: number;
|
|
9
|
+
};
|
|
10
|
+
export declare function countMessageTokens(messages: ModelMessage[], counter: {
|
|
11
|
+
count: (s: string) => number;
|
|
12
|
+
}): number;
|
|
13
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../source/commands/session/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAEvC,MAAM,MAAM,SAAS,GAAG;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,YAAY,EAAE,EACxB,OAAO,EAAE;IAAE,KAAK,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAA;CAAE,GACxC,MAAM,CAOR"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/commands/shell/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAK/D,eAAO,MAAM,YAAY,GAAI,SAAS,cAAc,KAAG,WAqHtD,CAAC"}
|
|
@@ -1,62 +1,15 @@
|
|
|
1
|
-
import { initExecutionEnvironment } from "
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { SelectList, Text } from "../tui/index.js";
|
|
1
|
+
import { initExecutionEnvironment } from "../../execution/index.js";
|
|
2
|
+
import style from "../../terminal/style.js";
|
|
3
|
+
import { SelectList, Text } from "../../tui/index.js";
|
|
5
4
|
// Command execution timeout in milliseconds
|
|
6
5
|
const DEFAULT_TIMEOUT = 1.5 * 60 * 1000; // 1.5 minutes
|
|
7
6
|
export const shellCommand = (options) => {
|
|
8
|
-
const {
|
|
7
|
+
const { promptManager, tokenCounter } = options;
|
|
9
8
|
return {
|
|
10
9
|
command: "/shell",
|
|
11
10
|
aliases: ["/sh"],
|
|
12
11
|
description: "Run a non-interactive shell command on the local machine.",
|
|
13
12
|
getSubCommands: () => Promise.resolve([]),
|
|
14
|
-
execute: async (args) => {
|
|
15
|
-
const commandStr = args.join(" ");
|
|
16
|
-
if (!commandStr.trim()) {
|
|
17
|
-
terminal.error("Provide a non-empty command.");
|
|
18
|
-
return "continue";
|
|
19
|
-
}
|
|
20
|
-
const execEnv = await initExecutionEnvironment();
|
|
21
|
-
const colorEnv = {
|
|
22
|
-
["FORCE_COLOR"]: "1",
|
|
23
|
-
["CLICOLOR"]: "1",
|
|
24
|
-
["CLICOLOR_FORCE"]: "1",
|
|
25
|
-
["TERM"]: process.env["TERM"] ?? "xterm-256color",
|
|
26
|
-
["COLORTERM"]: process.env["COLORTERM"] ?? "truecolor",
|
|
27
|
-
["npm_config_color"]: "true",
|
|
28
|
-
};
|
|
29
|
-
const { output, exitCode, duration } = await execEnv.executeCommand(commandStr, {
|
|
30
|
-
cwd: process.cwd(),
|
|
31
|
-
timeout: DEFAULT_TIMEOUT,
|
|
32
|
-
preserveOutputOnError: true,
|
|
33
|
-
captureStderr: true,
|
|
34
|
-
throwOnError: false,
|
|
35
|
-
env: colorEnv,
|
|
36
|
-
});
|
|
37
|
-
terminal.lineBreak();
|
|
38
|
-
terminal.writeln(style.gray(`Exit code: ${exitCode}, Duration: ${duration}ms`));
|
|
39
|
-
terminal.writeln(output);
|
|
40
|
-
// Prompt for context addition
|
|
41
|
-
const message = "Would you like to add this output to the prompt context for AI reference? [y/N]";
|
|
42
|
-
const userChoice = await input({
|
|
43
|
-
message,
|
|
44
|
-
validate: (input) => {
|
|
45
|
-
const normalized = input.toLowerCase().trim();
|
|
46
|
-
if (normalized === "y" || normalized === "n" || normalized === "") {
|
|
47
|
-
return true;
|
|
48
|
-
}
|
|
49
|
-
return "Please enter 'y' for yes or 'n' for no";
|
|
50
|
-
},
|
|
51
|
-
default: "N",
|
|
52
|
-
});
|
|
53
|
-
if (userChoice.toLowerCase() === "y") {
|
|
54
|
-
const tokenCount = tokenCounter.count(output);
|
|
55
|
-
promptManager.addContext(output);
|
|
56
|
-
terminal.success(`Output added to prompt context. (${tokenCount} tokens)`);
|
|
57
|
-
}
|
|
58
|
-
return "continue";
|
|
59
|
-
},
|
|
60
13
|
async handle(args, { tui, container, editor, }) {
|
|
61
14
|
const commandStr = args.join(" ");
|
|
62
15
|
if (!commandStr.trim()) {
|
package/dist/commands/types.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { ConfigManager } from "../config.ts";
|
|
2
2
|
import type { WorkspaceContext } from "../index.ts";
|
|
3
|
-
import type { MessageHistory } from "../messages.ts";
|
|
4
3
|
import type { ModelManager } from "../models/manager.ts";
|
|
5
4
|
import type { PromptManagerApi } from "../prompts/manager.ts";
|
|
6
|
-
import type {
|
|
5
|
+
import type { SessionManager } from "../sessions/manager.ts";
|
|
7
6
|
import type { TokenCounter } from "../tokens/counter.ts";
|
|
8
7
|
import type { TokenTracker } from "../tokens/tracker.ts";
|
|
9
8
|
import type { Container, Editor, TUI } from "../tui/index.ts";
|
|
@@ -12,7 +11,6 @@ export interface ReplCommand {
|
|
|
12
11
|
aliases?: string[];
|
|
13
12
|
description: string;
|
|
14
13
|
getSubCommands: () => Promise<string[]>;
|
|
15
|
-
execute: (args: string[]) => Promise<"break" | "continue" | "use">;
|
|
16
14
|
handle: (args: string[], options: {
|
|
17
15
|
tui: TUI;
|
|
18
16
|
container: Container;
|
|
@@ -23,8 +21,7 @@ export interface ReplCommand {
|
|
|
23
21
|
export interface CommandOptions {
|
|
24
22
|
promptManager: PromptManagerApi;
|
|
25
23
|
modelManager: ModelManager;
|
|
26
|
-
|
|
27
|
-
messageHistory: MessageHistory;
|
|
24
|
+
sessionManager: SessionManager;
|
|
28
25
|
tokenTracker: TokenTracker;
|
|
29
26
|
config: ConfigManager;
|
|
30
27
|
tokenCounter: TokenCounter;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../source/commands/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../source/commands/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAE9D,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IACxC,MAAM,EAAE,CACN,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,EAAE;QACP,GAAG,EAAE,GAAG,CAAC;QACT,SAAS,EAAE,SAAS,CAAC;QACrB,cAAc,EAAE,SAAS,CAAC;QAC1B,MAAM,EAAE,MAAM,CAAC;KAChB,KACE,OAAO,CAAC,OAAO,GAAG,UAAU,GAAG,KAAK,CAAC,CAAC;CAC5C;AAED,MAAM,WAAW,cAAc;IAC7B,aAAa,EAAE,gBAAgB,CAAC;IAChC,YAAY,EAAE,YAAY,CAAC;IAC3B,cAAc,EAAE,cAAc,CAAC;IAC/B,YAAY,EAAE,YAAY,CAAC;IAC3B,MAAM,EAAE,aAAa,CAAC;IACtB,YAAY,EAAE,YAAY,CAAC;IAC3B,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,SAAS,EAAE,gBAAgB,CAAC;CAC7B"}
|
package/dist/config.d.ts
CHANGED
|
@@ -1,14 +1,32 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
export declare const defaultConfig: {
|
|
3
|
+
readonly loop: {
|
|
4
|
+
readonly maxIterations: 200;
|
|
5
|
+
};
|
|
6
|
+
readonly tools: {
|
|
7
|
+
readonly activeTools: string[] | undefined;
|
|
8
|
+
readonly maxTokens: 30000;
|
|
9
|
+
readonly maxResults: 30;
|
|
10
|
+
readonly dynamicTools: {
|
|
11
|
+
readonly enabled: true;
|
|
12
|
+
readonly maxTools: 10;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
readonly notify: true;
|
|
16
|
+
readonly readOnlyFiles: string[];
|
|
17
|
+
readonly skills: {
|
|
18
|
+
readonly enabled: true;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
2
21
|
declare const ProjectConfigSchema: z.ZodObject<{
|
|
3
22
|
logs: z.ZodOptional<z.ZodObject<{
|
|
4
23
|
path: z.ZodString;
|
|
5
24
|
}, z.core.$strip>>;
|
|
6
25
|
loop: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
7
26
|
maxIterations: z.ZodDefault<z.ZodNumber>;
|
|
8
|
-
parallelTools: z.ZodDefault<z.ZodBoolean>;
|
|
9
|
-
maxDurationMs: z.ZodDefault<z.ZodNumber>;
|
|
10
27
|
}, z.core.$strip>>>;
|
|
11
28
|
tools: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
29
|
+
activeTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
12
30
|
maxTokens: z.ZodDefault<z.ZodNumber>;
|
|
13
31
|
maxResults: z.ZodDefault<z.ZodNumber>;
|
|
14
32
|
dynamicTools: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
@@ -17,29 +35,40 @@ declare const ProjectConfigSchema: z.ZodObject<{
|
|
|
17
35
|
}, z.core.$strip>>>;
|
|
18
36
|
}, z.core.$strip>>>;
|
|
19
37
|
notify: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
38
|
+
readOnlyFiles: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
39
|
+
skills: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
40
|
+
enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
41
|
+
}, z.core.$strip>>>;
|
|
20
42
|
}, z.core.$strip>;
|
|
21
|
-
type ProjectConfig = z.infer<typeof ProjectConfigSchema>;
|
|
43
|
+
export type ProjectConfig = z.infer<typeof ProjectConfigSchema>;
|
|
22
44
|
export declare class DirectoryProvider {
|
|
23
45
|
private baseDir;
|
|
24
46
|
constructor(baseDir: string);
|
|
25
47
|
getPath(subdir?: string): string;
|
|
26
48
|
ensurePath(subdir?: string): Promise<string>;
|
|
27
49
|
ensurePathSync(subdir?: string): string;
|
|
50
|
+
exists(subdir?: string): Promise<boolean>;
|
|
51
|
+
existsSync(subdir?: string): boolean;
|
|
28
52
|
}
|
|
29
53
|
export declare class ConfigManager {
|
|
30
54
|
readonly project: DirectoryProvider;
|
|
31
55
|
readonly app: DirectoryProvider;
|
|
32
56
|
constructor();
|
|
33
57
|
private _readConfig;
|
|
34
|
-
|
|
35
|
-
|
|
58
|
+
getConfig(): Promise<ProjectConfig>;
|
|
59
|
+
getSkillsEnabled(): Promise<boolean>;
|
|
60
|
+
setSkillsEnabled(enabled: boolean): Promise<void>;
|
|
61
|
+
readAgentsFiles(): Promise<{
|
|
62
|
+
path: string;
|
|
63
|
+
content: string;
|
|
64
|
+
}[]>;
|
|
36
65
|
writeAgentsFile(rules: string): Promise<void>;
|
|
37
66
|
readProjectLearnedRulesFile(): Promise<string>;
|
|
38
67
|
writeProjectLearnedRulesFile(rules: string): Promise<void>;
|
|
39
68
|
readCachedLearnedRulesFile(): Promise<string>;
|
|
40
69
|
writeCachedLearnedRulesFile(rules: string): Promise<void>;
|
|
41
|
-
|
|
42
|
-
|
|
70
|
+
private _readAppConfig;
|
|
71
|
+
ensureDefaultConfig(configName: string): Promise<ProjectConfig>;
|
|
43
72
|
writeAppConfig(configName: string, data: Record<PropertyKey, unknown>): Promise<void>;
|
|
44
73
|
}
|
|
45
74
|
export declare const config: ConfigManager;
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../source/config.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../source/config.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,aAAa;;;;;8BAKI,MAAM,EAAE,GAAG,SAAS;;;;;;;;;4BAS3B,MAAM,EAAE;;;;CAIrB,CAAC;AAGX,QAAA,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;iBA0CvB,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,OAAO,CAAS;gBAEZ,OAAO,EAAE,MAAM;IAI3B,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM;IAK1B,UAAU,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAOlD,cAAc,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM;IAOjC,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAW/C,UAAU,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO;CAIrC;AAED,qBAAa,aAAa;IACxB,QAAQ,CAAC,OAAO,EAAE,iBAAiB,CAAC;IACpC,QAAQ,CAAC,GAAG,EAAE,iBAAiB,CAAC;;YAOlB,WAAW;IAenB,SAAS,IAAI,OAAO,CAAC,aAAa,CAAC;IAgBnC,gBAAgB,IAAI,OAAO,CAAC,OAAO,CAAC;IAKpC,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAsBjD,eAAe,IAAI,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IA4B/D,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAY7C,2BAA2B,IAAI,OAAO,CAAC,MAAM,CAAC;IAe9C,4BAA4B,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAkB1D,0BAA0B,IAAI,OAAO,CAAC,MAAM,CAAC;IAY7C,2BAA2B,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;YAcjD,cAAc;IActB,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAe/D,cAAc,CAClB,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,GACjC,OAAO,CAAC,IAAI,CAAC;CAKjB;AAGD,eAAO,MAAM,MAAM,eAAsB,CAAC"}
|