@travisennis/acai 0.0.5 → 0.0.6
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 +4 -2
- package/dist/agent/index.d.ts +119 -0
- package/dist/agent/index.d.ts.map +1 -0
- package/dist/agent/index.js +406 -0
- package/dist/agent/manual-loop.d.ts +41 -0
- package/dist/agent/manual-loop.d.ts.map +1 -0
- package/dist/agent/manual-loop.js +278 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +27 -33
- package/dist/commands/add-directory-command.d.ts +3 -0
- package/dist/commands/add-directory-command.d.ts.map +1 -0
- package/dist/commands/add-directory-command.js +85 -0
- package/dist/commands/application-log-command.d.ts.map +1 -1
- package/dist/commands/application-log-command.js +34 -0
- package/dist/commands/clear-command.d.ts.map +1 -1
- package/dist/commands/clear-command.js +8 -0
- package/dist/commands/compact-command.d.ts.map +1 -1
- package/dist/commands/compact-command.js +15 -2
- package/dist/commands/context-command.d.ts +3 -0
- package/dist/commands/context-command.d.ts.map +1 -0
- package/dist/commands/context-command.js +183 -0
- package/dist/commands/copy-command.d.ts.map +1 -1
- package/dist/commands/copy-command.js +28 -0
- package/dist/commands/edit-command.d.ts.map +1 -1
- package/dist/commands/edit-command.js +33 -0
- package/dist/commands/edit-prompt-command.d.ts.map +1 -1
- package/dist/commands/edit-prompt-command.js +28 -0
- package/dist/commands/exit-command.d.ts.map +1 -1
- package/dist/commands/exit-command.js +20 -0
- package/dist/commands/files-command.d.ts.map +1 -1
- package/dist/commands/files-command.js +57 -0
- package/dist/commands/generate-rules-command.d.ts.map +1 -1
- package/dist/commands/generate-rules-command.js +311 -1
- package/dist/commands/handoff-command.d.ts +3 -0
- package/dist/commands/handoff-command.d.ts.map +1 -0
- package/dist/commands/handoff-command.js +202 -0
- package/dist/commands/health-command.d.ts.map +1 -1
- package/dist/commands/health-command.js +119 -2
- package/dist/commands/help-command.d.ts.map +1 -1
- package/dist/commands/help-command.js +28 -0
- package/dist/commands/history-command.d.ts +3 -0
- package/dist/commands/history-command.d.ts.map +1 -0
- package/dist/commands/history-command.js +534 -0
- package/dist/commands/init-command.d.ts +1 -1
- package/dist/commands/init-command.d.ts.map +1 -1
- package/dist/commands/init-command.js +55 -18
- package/dist/commands/last-log-command.d.ts.map +1 -1
- package/dist/commands/last-log-command.js +27 -0
- package/dist/commands/list-directories-command.d.ts +3 -0
- package/dist/commands/list-directories-command.d.ts.map +1 -0
- package/dist/commands/list-directories-command.js +48 -0
- package/dist/commands/list-tools-command.d.ts.map +1 -1
- package/dist/commands/list-tools-command.js +66 -3
- package/dist/commands/manager.d.ts +15 -3
- package/dist/commands/manager.d.ts.map +1 -1
- package/dist/commands/manager.js +86 -26
- package/dist/commands/model-command.d.ts +22 -0
- package/dist/commands/model-command.d.ts.map +1 -1
- package/dist/commands/model-command.js +256 -0
- package/dist/commands/paste-command.d.ts.map +1 -1
- package/dist/commands/paste-command.js +92 -0
- package/dist/commands/pickup-command.d.ts +3 -0
- package/dist/commands/pickup-command.d.ts.map +1 -0
- package/dist/commands/pickup-command.js +161 -0
- package/dist/commands/prompt-command.d.ts +1 -1
- package/dist/commands/prompt-command.d.ts.map +1 -1
- package/dist/commands/prompt-command.js +117 -2
- package/dist/commands/remove-directory-command.d.ts +3 -0
- package/dist/commands/remove-directory-command.d.ts.map +1 -0
- package/dist/commands/remove-directory-command.js +87 -0
- package/dist/commands/reset-command.d.ts +1 -1
- package/dist/commands/reset-command.d.ts.map +1 -1
- package/dist/commands/reset-command.js +13 -2
- package/dist/commands/rules-command.d.ts.map +1 -1
- package/dist/commands/rules-command.js +65 -0
- package/dist/commands/save-command.d.ts.map +1 -1
- package/dist/commands/save-command.js +12 -0
- package/dist/commands/shell-command.d.ts.map +1 -1
- package/dist/commands/shell-command.js +68 -0
- package/dist/commands/types.d.ts +9 -4
- package/dist/commands/types.d.ts.map +1 -1
- package/dist/commands/usage-command.d.ts.map +1 -1
- package/dist/commands/usage-command.js +22 -0
- package/dist/config.d.ts +6 -7
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +23 -29
- package/dist/formatting.d.ts +108 -0
- package/dist/formatting.d.ts.map +1 -1
- package/dist/formatting.js +147 -0
- package/dist/index.d.ts +7 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +140 -38
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +47 -18
- package/dist/mentions.d.ts +2 -1
- package/dist/mentions.d.ts.map +1 -1
- package/dist/mentions.js +16 -1
- package/dist/messages.d.ts +8 -0
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js +56 -19
- package/dist/middleware/cache.d.ts +3 -0
- package/dist/middleware/cache.d.ts.map +1 -0
- package/dist/middleware/cache.js +53 -0
- package/dist/middleware/index.d.ts +1 -0
- package/dist/middleware/index.d.ts.map +1 -1
- package/dist/middleware/index.js +1 -0
- package/dist/models/ai-config.d.ts +4 -2
- package/dist/models/ai-config.d.ts.map +1 -1
- package/dist/models/ai-config.js +12 -2
- package/dist/models/anthropic-provider.d.ts.map +1 -1
- package/dist/models/anthropic-provider.js +3 -60
- package/dist/models/manager.d.ts +2 -1
- package/dist/models/manager.d.ts.map +1 -1
- package/dist/models/manager.js +26 -2
- package/dist/models/openrouter-provider.d.ts +7 -14
- package/dist/models/openrouter-provider.d.ts.map +1 -1
- package/dist/models/openrouter-provider.js +114 -169
- package/dist/models/providers.d.ts +1 -1
- package/dist/models/providers.d.ts.map +1 -1
- package/dist/prompts.d.ts +1 -0
- package/dist/prompts.d.ts.map +1 -1
- package/dist/prompts.js +53 -4
- package/dist/repl/display-tool-messages.d.ts +1 -1
- package/dist/repl/display-tool-messages.d.ts.map +1 -1
- package/dist/repl/display-tool-messages.js +47 -44
- package/dist/repl/get-prompt-header.d.ts.map +1 -1
- package/dist/repl/get-prompt-header.js +1 -30
- package/dist/repl/project-status-line.d.ts +2 -0
- package/dist/repl/project-status-line.d.ts.map +1 -0
- package/dist/repl/project-status-line.js +31 -0
- package/dist/repl/prompt.d.ts +21 -0
- package/dist/repl/prompt.d.ts.map +1 -0
- package/dist/{repl-prompt.js → repl/prompt.js} +119 -22
- package/dist/repl/tool-call-repair.d.ts.map +1 -1
- package/dist/repl/tool-call-repair.js +8 -4
- package/dist/repl-new.d.ts +53 -0
- package/dist/repl-new.d.ts.map +1 -0
- package/dist/repl-new.js +374 -0
- package/dist/repl.d.ts +3 -5
- package/dist/repl.d.ts.map +1 -1
- package/dist/repl.js +74 -166
- package/dist/terminal/checkbox-prompt.d.ts.map +1 -1
- package/dist/terminal/checkbox-prompt.js +10 -4
- package/dist/terminal/index.d.ts +7 -0
- package/dist/terminal/index.d.ts.map +1 -1
- package/dist/terminal/index.js +94 -0
- package/dist/terminal/input-prompt.d.ts +2 -1
- package/dist/terminal/input-prompt.d.ts.map +1 -1
- package/dist/terminal/markdown.js +3 -0
- package/dist/terminal/search-prompt.d.ts.map +1 -1
- package/dist/terminal/search-prompt.js +11 -10
- package/dist/terminal/select-prompt.d.ts +2 -2
- package/dist/terminal/select-prompt.d.ts.map +1 -1
- package/dist/terminal/select-prompt.js +47 -39
- package/dist/tokens/threshold.d.ts +35 -0
- package/dist/tokens/threshold.d.ts.map +1 -0
- package/dist/tokens/threshold.js +85 -0
- package/dist/tools/advanced-edit-file.d.ts +69 -0
- package/dist/tools/advanced-edit-file.d.ts.map +1 -0
- package/dist/tools/advanced-edit-file.js +281 -0
- package/dist/tools/agent.d.ts +16 -5
- package/dist/tools/agent.d.ts.map +1 -1
- package/dist/tools/agent.js +71 -58
- package/dist/tools/bash-utils.d.ts +1 -1
- package/dist/tools/bash-utils.d.ts.map +1 -1
- package/dist/tools/bash-utils.js +14 -6
- package/dist/tools/bash.d.ts +21 -12
- package/dist/tools/bash.d.ts.map +1 -1
- package/dist/tools/bash.js +88 -135
- package/dist/tools/code-interpreter.d.ts +21 -9
- package/dist/tools/code-interpreter.d.ts.map +1 -1
- package/dist/tools/code-interpreter.js +138 -137
- package/dist/tools/delete-file.d.ts +17 -10
- package/dist/tools/delete-file.d.ts.map +1 -1
- package/dist/tools/delete-file.js +51 -95
- package/dist/tools/directory-tree.d.ts +17 -6
- package/dist/tools/directory-tree.d.ts.map +1 -1
- package/dist/tools/directory-tree.js +47 -49
- package/dist/tools/dynamic-tool-loader.d.ts +18 -8
- package/dist/tools/dynamic-tool-loader.d.ts.map +1 -1
- package/dist/tools/dynamic-tool-loader.js +121 -129
- package/dist/tools/dynamic-tool-parser.d.ts +1 -0
- package/dist/tools/dynamic-tool-parser.d.ts.map +1 -1
- package/dist/tools/dynamic-tool-parser.js +1 -0
- package/dist/tools/edit-file.d.ts +35 -15
- package/dist/tools/edit-file.d.ts.map +1 -1
- package/dist/tools/edit-file.js +112 -112
- package/dist/tools/filesystem-utils.d.ts +2 -1
- package/dist/tools/filesystem-utils.d.ts.map +1 -1
- package/dist/tools/filesystem-utils.js +31 -17
- package/dist/tools/glob.d.ts +36 -0
- package/dist/tools/glob.d.ts.map +1 -0
- package/dist/tools/glob.js +143 -0
- package/dist/tools/grep.d.ts +73 -12
- package/dist/tools/grep.d.ts.map +1 -1
- package/dist/tools/grep.js +413 -168
- package/dist/tools/index.d.ts +204 -124
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +242 -135
- package/dist/tools/llm-edit-fixer.d.ts +25 -0
- package/dist/tools/llm-edit-fixer.d.ts.map +1 -0
- package/dist/tools/llm-edit-fixer.js +150 -0
- package/dist/tools/move-file.d.ts +19 -7
- package/dist/tools/move-file.d.ts.map +1 -1
- package/dist/tools/move-file.js +40 -33
- package/dist/tools/read-file.d.ts +47 -9
- package/dist/tools/read-file.d.ts.map +1 -1
- package/dist/tools/read-file.js +74 -69
- package/dist/tools/read-multiple-files.d.ts +17 -6
- package/dist/tools/read-multiple-files.d.ts.map +1 -1
- package/dist/tools/read-multiple-files.js +76 -73
- package/dist/tools/save-file.d.ts +45 -12
- package/dist/tools/save-file.d.ts.map +1 -1
- package/dist/tools/save-file.js +58 -101
- package/dist/tools/think.d.ts +15 -7
- package/dist/tools/think.d.ts.map +1 -1
- package/dist/tools/think.js +30 -22
- package/dist/tools/types.d.ts +4 -10
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/tools/types.js +9 -0
- package/dist/tools/utils.d.ts +14 -0
- package/dist/tools/utils.d.ts.map +1 -0
- package/dist/tools/utils.js +16 -0
- package/dist/tools/web-fetch.d.ts +11 -4
- package/dist/tools/web-fetch.d.ts.map +1 -1
- package/dist/tools/web-fetch.js +39 -38
- package/dist/tools/web-search.d.ts +15 -6
- package/dist/tools/web-search.d.ts.map +1 -1
- package/dist/tools/web-search.js +50 -32
- package/dist/tui/autocomplete.d.ts +44 -0
- package/dist/tui/autocomplete.d.ts.map +1 -0
- package/dist/tui/autocomplete.js +466 -0
- package/dist/tui/components/assistant-message.d.ts +18 -0
- package/dist/tui/components/assistant-message.d.ts.map +1 -0
- package/dist/tui/components/assistant-message.js +29 -0
- package/dist/tui/components/editor.d.ts +51 -0
- package/dist/tui/components/editor.d.ts.map +1 -0
- package/dist/tui/components/editor.js +758 -0
- package/dist/tui/components/footer.d.ts +24 -0
- package/dist/tui/components/footer.d.ts.map +1 -0
- package/dist/tui/components/footer.js +197 -0
- package/dist/tui/components/input.d.ts +14 -0
- package/dist/tui/components/input.d.ts.map +1 -0
- package/dist/tui/components/input.js +122 -0
- package/dist/tui/components/loader.d.ts +19 -0
- package/dist/tui/components/loader.d.ts.map +1 -0
- package/dist/tui/components/loader.js +45 -0
- package/dist/tui/components/markdown.d.ts +103 -0
- package/dist/tui/components/markdown.d.ts.map +1 -0
- package/dist/tui/components/markdown.js +533 -0
- package/dist/tui/components/modal.d.ts +40 -0
- package/dist/tui/components/modal.d.ts.map +1 -0
- package/dist/tui/components/modal.js +292 -0
- package/dist/tui/components/prompt-status.d.ts +16 -0
- package/dist/tui/components/prompt-status.d.ts.map +1 -0
- package/dist/tui/components/prompt-status.js +21 -0
- package/dist/tui/components/select-list.d.ts +22 -0
- package/dist/tui/components/select-list.d.ts.map +1 -0
- package/dist/tui/components/select-list.js +143 -0
- package/dist/tui/components/spacer.d.ts +16 -0
- package/dist/tui/components/spacer.d.ts.map +1 -0
- package/dist/tui/components/spacer.js +27 -0
- package/dist/tui/components/text.d.ts +26 -0
- package/dist/tui/components/text.d.ts.map +1 -0
- package/dist/tui/components/text.js +143 -0
- package/dist/tui/components/thinking-block.d.ts +14 -0
- package/dist/tui/components/thinking-block.d.ts.map +1 -0
- package/dist/tui/components/thinking-block.js +30 -0
- package/dist/tui/components/tool-execution.d.ts +17 -0
- package/dist/tui/components/tool-execution.d.ts.map +1 -0
- package/dist/tui/components/tool-execution.js +153 -0
- package/dist/tui/components/user-message.d.ts +9 -0
- package/dist/tui/components/user-message.d.ts.map +1 -0
- package/dist/tui/components/user-message.js +21 -0
- package/dist/tui/components/welcome.d.ts +6 -0
- package/dist/tui/components/welcome.d.ts.map +1 -0
- package/dist/tui/components/welcome.js +30 -0
- package/dist/tui/index.d.ts +14 -0
- package/dist/tui/index.d.ts.map +1 -0
- package/dist/tui/index.js +18 -0
- package/dist/tui/terminal.d.ts +37 -0
- package/dist/tui/terminal.d.ts.map +1 -0
- package/dist/tui/terminal.js +104 -0
- package/dist/tui/tui.d.ts +67 -0
- package/dist/tui/tui.d.ts.map +1 -0
- package/dist/tui/tui.js +184 -0
- package/dist/tui/utils.d.ts +19 -0
- package/dist/tui/utils.d.ts.map +1 -0
- package/dist/tui/utils.js +31 -0
- package/dist/utils/generators.d.ts +3 -0
- package/dist/utils/generators.d.ts.map +1 -0
- package/dist/utils/generators.js +25 -0
- package/dist/utils/iterables.d.ts +2 -0
- package/dist/utils/iterables.d.ts.map +1 -0
- package/dist/utils/iterables.js +6 -0
- package/package.json +16 -16
- package/dist/conversation-analyzer.d.ts +0 -11
- package/dist/conversation-analyzer.d.ts.map +0 -1
- package/dist/conversation-analyzer.js +0 -88
- package/dist/repl-prompt.d.ts +0 -15
- package/dist/repl-prompt.d.ts.map +0 -1
- package/dist/tokens/manage-output.d.ts +0 -34
- package/dist/tokens/manage-output.d.ts.map +0 -1
- package/dist/tokens/manage-output.js +0 -44
- package/dist/tool-executor.d.ts +0 -28
- package/dist/tool-executor.d.ts.map +0 -1
- package/dist/tool-executor.js +0 -74
- package/dist/tools/file-editing-utils.d.ts +0 -2
- package/dist/tools/file-editing-utils.d.ts.map +0 -1
- package/dist/tools/file-editing-utils.js +0 -135
|
@@ -0,0 +1 @@
|
|
|
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,0BAGpC,cAAc,KAAG,WAmEnB,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Modal, Container as ModalContainer, ModalText } from "../tui/index.js";
|
|
2
|
+
export const listDirectoriesCommand = ({ terminal, workspace, }) => {
|
|
3
|
+
return {
|
|
4
|
+
command: "/list-directories",
|
|
5
|
+
description: "List all allowed working directories",
|
|
6
|
+
getSubCommands: async () => {
|
|
7
|
+
return [];
|
|
8
|
+
},
|
|
9
|
+
execute: async () => {
|
|
10
|
+
terminal.header("Current working directories:");
|
|
11
|
+
workspace.allowedDirs.forEach((dir) => {
|
|
12
|
+
const isPrimary = dir === workspace.primaryDir;
|
|
13
|
+
const prefix = isPrimary ? "● " : " ";
|
|
14
|
+
const indicator = isPrimary ? " (primary)" : "";
|
|
15
|
+
terminal.writeln(`${prefix}${dir}${indicator}`);
|
|
16
|
+
});
|
|
17
|
+
if (workspace.allowedDirs.length === 0) {
|
|
18
|
+
terminal.warn("No directories configured. Using current directory only.");
|
|
19
|
+
}
|
|
20
|
+
return "continue";
|
|
21
|
+
},
|
|
22
|
+
async handle(_args, { tui, editor }) {
|
|
23
|
+
// Build modal content
|
|
24
|
+
const modalContent = new ModalContainer();
|
|
25
|
+
modalContent.addChild(new ModalText("Current working directories:", 0, 1));
|
|
26
|
+
if (workspace.allowedDirs.length === 0) {
|
|
27
|
+
modalContent.addChild(new ModalText("No directories configured. Using current directory only.", 0, 1));
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
// Add each directory as a separate line
|
|
31
|
+
workspace.allowedDirs.forEach((dir) => {
|
|
32
|
+
const isPrimary = dir === workspace.primaryDir;
|
|
33
|
+
const prefix = isPrimary ? "● " : " ";
|
|
34
|
+
const indicator = isPrimary ? " (primary)" : "";
|
|
35
|
+
modalContent.addChild(new ModalText(`${prefix}${dir}${indicator}`, 0, 0));
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
// Create and show modal
|
|
39
|
+
const modal = new Modal("Working Directories", modalContent, true, () => {
|
|
40
|
+
// Modal closed callback
|
|
41
|
+
editor.setText("");
|
|
42
|
+
tui.requestRender();
|
|
43
|
+
});
|
|
44
|
+
tui.showModal(modal);
|
|
45
|
+
return "continue";
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-tools-command.d.ts","sourceRoot":"","sources":["../../source/commands/list-tools-command.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"list-tools-command.d.ts","sourceRoot":"","sources":["../../source/commands/list-tools-command.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9D,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,cAAc,GAAG,WAAW,CAyJrE"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import style from "../terminal/style.js";
|
|
1
2
|
import { initAgents, initTools } from "../tools/index.js";
|
|
3
|
+
import { Text } from "../tui/index.js";
|
|
2
4
|
export function listToolsCommand(options) {
|
|
3
5
|
return {
|
|
4
6
|
command: "/list-tools",
|
|
@@ -9,16 +11,17 @@ export function listToolsCommand(options) {
|
|
|
9
11
|
const { terminal } = options;
|
|
10
12
|
try {
|
|
11
13
|
const tools = await initTools({
|
|
12
|
-
terminal: options.terminal,
|
|
13
14
|
tokenCounter: options.tokenCounter,
|
|
14
|
-
|
|
15
|
+
workspace: options.workspace,
|
|
16
|
+
modelManager: options.modelManager,
|
|
17
|
+
tokenTracker: options.tokenTracker,
|
|
15
18
|
});
|
|
16
19
|
const agentTools = await initAgents({
|
|
17
20
|
terminal: options.terminal,
|
|
18
21
|
modelManager: options.modelManager,
|
|
19
22
|
tokenTracker: options.tokenTracker,
|
|
20
23
|
tokenCounter: options.tokenCounter,
|
|
21
|
-
|
|
24
|
+
workspace: options.workspace,
|
|
22
25
|
});
|
|
23
26
|
const toolNames = Object.keys({ ...tools, ...agentTools }).sort();
|
|
24
27
|
terminal.writeln("Available tools:");
|
|
@@ -57,5 +60,65 @@ export function listToolsCommand(options) {
|
|
|
57
60
|
return "continue";
|
|
58
61
|
}
|
|
59
62
|
},
|
|
63
|
+
async handle(_args, { tui, container, editor, }) {
|
|
64
|
+
try {
|
|
65
|
+
const tools = await initTools({
|
|
66
|
+
tokenCounter: options.tokenCounter,
|
|
67
|
+
workspace: options.workspace,
|
|
68
|
+
modelManager: options.modelManager,
|
|
69
|
+
tokenTracker: options.tokenTracker,
|
|
70
|
+
});
|
|
71
|
+
const agentTools = await initAgents({
|
|
72
|
+
terminal: options.terminal,
|
|
73
|
+
modelManager: options.modelManager,
|
|
74
|
+
tokenTracker: options.tokenTracker,
|
|
75
|
+
tokenCounter: options.tokenCounter,
|
|
76
|
+
workspace: options.workspace,
|
|
77
|
+
});
|
|
78
|
+
const toolNames = Object.keys({ ...tools, ...agentTools }).sort();
|
|
79
|
+
container.addChild(new Text("Available tools:", 0, 1));
|
|
80
|
+
// Separate static and dynamic tools
|
|
81
|
+
const staticTools = [];
|
|
82
|
+
const dynamicTools = [];
|
|
83
|
+
for (const toolName of toolNames) {
|
|
84
|
+
if (toolName.startsWith("dynamic-")) {
|
|
85
|
+
dynamicTools.push(toolName);
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
staticTools.push(toolName);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
let lineIndex = 2;
|
|
92
|
+
// Display static tools
|
|
93
|
+
if (staticTools.length > 0) {
|
|
94
|
+
container.addChild(new Text(" Static tools:", lineIndex, 0));
|
|
95
|
+
lineIndex++;
|
|
96
|
+
for (const toolName of staticTools) {
|
|
97
|
+
container.addChild(new Text(` ${toolName}`, lineIndex, 0));
|
|
98
|
+
lineIndex++;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
// Display dynamic tools
|
|
102
|
+
if (dynamicTools.length > 0) {
|
|
103
|
+
container.addChild(new Text(" Dynamic tools:", lineIndex, 0));
|
|
104
|
+
lineIndex++;
|
|
105
|
+
for (const toolName of dynamicTools) {
|
|
106
|
+
container.addChild(new Text(` ${toolName}`, lineIndex, 0));
|
|
107
|
+
lineIndex++;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
// Display summary
|
|
111
|
+
container.addChild(new Text(`\n Total: ${staticTools.length} static, ${dynamicTools.length} dynamic`, lineIndex, 0));
|
|
112
|
+
tui.requestRender();
|
|
113
|
+
editor.setText("");
|
|
114
|
+
return "continue";
|
|
115
|
+
}
|
|
116
|
+
catch (error) {
|
|
117
|
+
container.addChild(new Text(style.red(`Error listing tools: ${error.message}`), 1, 0));
|
|
118
|
+
tui.requestRender();
|
|
119
|
+
editor.setText("");
|
|
120
|
+
return "continue";
|
|
121
|
+
}
|
|
122
|
+
},
|
|
60
123
|
};
|
|
61
124
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Container, Editor, SlashCommand, TUI } from "../tui/index.ts";
|
|
1
2
|
import type { CommandOptions } from "./types.ts";
|
|
2
3
|
export declare class CommandManager {
|
|
3
4
|
private commands;
|
|
@@ -8,13 +9,13 @@ export declare class CommandManager {
|
|
|
8
9
|
private terminal;
|
|
9
10
|
private config;
|
|
10
11
|
private tokenCounter;
|
|
11
|
-
private toolEvents;
|
|
12
|
-
private toolExecutor?;
|
|
13
12
|
private promptHistory;
|
|
13
|
+
private workspace;
|
|
14
14
|
private initialized;
|
|
15
|
-
constructor({ promptManager, modelManager, terminal, messageHistory, tokenTracker, config, tokenCounter,
|
|
15
|
+
constructor({ promptManager, modelManager, terminal, messageHistory, tokenTracker, config, tokenCounter, promptHistory, workspace, }: CommandOptions);
|
|
16
16
|
initializeCommmands(): Promise<void>;
|
|
17
17
|
private ensureInitialized;
|
|
18
|
+
getCompletions(): Promise<SlashCommand[]>;
|
|
18
19
|
getCommands(): string[];
|
|
19
20
|
getSubCommands(command: string): Promise<string[]>;
|
|
20
21
|
handle({ userInput }: {
|
|
@@ -23,5 +24,16 @@ export declare class CommandManager {
|
|
|
23
24
|
continue: boolean;
|
|
24
25
|
break: boolean;
|
|
25
26
|
}>;
|
|
27
|
+
handle2({ userInput }: {
|
|
28
|
+
userInput: string;
|
|
29
|
+
}, options: {
|
|
30
|
+
tui: TUI;
|
|
31
|
+
container: Container;
|
|
32
|
+
inputContainer: Container;
|
|
33
|
+
editor: Editor;
|
|
34
|
+
}): Promise<{
|
|
35
|
+
continue: boolean;
|
|
36
|
+
break: boolean;
|
|
37
|
+
}>;
|
|
26
38
|
}
|
|
27
39
|
//# sourceMappingURL=manager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../source/commands/manager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../source/commands/manager.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAEV,SAAS,EACT,MAAM,EACN,YAAY,EACZ,GAAG,EACJ,MAAM,iBAAiB,CAAC;AA6BzB,OAAO,KAAK,EAAE,cAAc,EAAe,MAAM,YAAY,CAAC;AAG9D,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAA2B;IAC3C,OAAO,CAAC,aAAa,CAAmB;IACxC,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,cAAc,CAAiB;IACvC,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,QAAQ,CAAW;IAC3B,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,aAAa,CAAW;IAChC,OAAO,CAAC,SAAS,CAAmB;IACpC,OAAO,CAAC,WAAW,CAAU;gBAEjB,EACV,aAAa,EACb,YAAY,EACZ,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,MAAM,EACN,YAAY,EACZ,aAAa,EACb,SAAS,GACV,EAAE,cAAc;IAcX,mBAAmB;IA+FzB,OAAO,CAAC,iBAAiB;IAQnB,cAAc,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;IAuB/C,WAAW;IAKL,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAKlD,MAAM,CAAC,EAAE,SAAS,EAAE,EAAE;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE;;;;IA8B3C,OAAO,CACX,EAAE,SAAS,EAAE,EAAE;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,EACpC,OAAO,EAAE;QACP,GAAG,EAAE,GAAG,CAAC;QACT,SAAS,EAAE,SAAS,CAAC;QACrB,cAAc,EAAE,SAAS,CAAC;QAC1B,MAAM,EAAE,MAAM,CAAC;KAChB;;;;CA8BJ"}
|
package/dist/commands/manager.js
CHANGED
|
@@ -1,22 +1,29 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { addDirectoryCommand } from "./add-directory-command.js";
|
|
2
|
+
// import { applicationLogCommand } from "./application-log-command.ts";
|
|
2
3
|
import { clearCommand } from "./clear-command.js";
|
|
3
|
-
import { compactCommand } from "./compact-command.
|
|
4
|
+
// import { compactCommand } from "./compact-command.ts";
|
|
5
|
+
import { contextCommand } from "./context-command.js";
|
|
4
6
|
import { copyCommand } from "./copy-command.js";
|
|
5
|
-
import { editCommand } from "./edit-command.
|
|
6
|
-
import { editPromptCommand } from "./edit-prompt-command.
|
|
7
|
+
// import { editCommand } from "./edit-command.ts";
|
|
8
|
+
// import { editPromptCommand } from "./edit-prompt-command.ts";
|
|
7
9
|
import { exitCommand } from "./exit-command.js";
|
|
8
|
-
import { filesCommand } from "./files-command.
|
|
10
|
+
// import { filesCommand } from "./files-command.ts";
|
|
9
11
|
import { generateRulesCommand } from "./generate-rules-command.js";
|
|
12
|
+
import { handoffCommand } from "./handoff-command.js";
|
|
10
13
|
import { healthCommand } from "./health-command.js";
|
|
11
14
|
import { helpCommand } from "./help-command.js";
|
|
15
|
+
import { historyCommand } from "./history-command.js";
|
|
12
16
|
import { initCommand } from "./init-command.js";
|
|
13
|
-
import { lastLogCommand } from "./last-log-command.
|
|
17
|
+
// import { lastLogCommand } from "./last-log-command.ts";
|
|
18
|
+
import { listDirectoriesCommand } from "./list-directories-command.js";
|
|
14
19
|
import { listToolsCommand } from "./list-tools-command.js";
|
|
15
20
|
import { modelCommand } from "./model-command.js";
|
|
16
21
|
import { pasteCommand } from "./paste-command.js";
|
|
22
|
+
import { pickupCommand } from "./pickup-command.js";
|
|
17
23
|
import { promptCommand } from "./prompt-command.js";
|
|
24
|
+
import { removeDirectoryCommand } from "./remove-directory-command.js";
|
|
18
25
|
import { resetCommand } from "./reset-command.js";
|
|
19
|
-
import { rulesCommand } from "./rules-command.
|
|
26
|
+
// import { rulesCommand } from "./rules-command.ts";
|
|
20
27
|
import { saveCommand } from "./save-command.js";
|
|
21
28
|
import { shellCommand } from "./shell-command.js";
|
|
22
29
|
import { usageCommand } from "./usage-command.js";
|
|
@@ -29,11 +36,10 @@ export class CommandManager {
|
|
|
29
36
|
terminal;
|
|
30
37
|
config;
|
|
31
38
|
tokenCounter;
|
|
32
|
-
toolEvents;
|
|
33
|
-
toolExecutor;
|
|
34
39
|
promptHistory;
|
|
40
|
+
workspace;
|
|
35
41
|
initialized;
|
|
36
|
-
constructor({ promptManager, modelManager, terminal, messageHistory, tokenTracker, config, tokenCounter,
|
|
42
|
+
constructor({ promptManager, modelManager, terminal, messageHistory, tokenTracker, config, tokenCounter, promptHistory, workspace, }) {
|
|
37
43
|
this.commands = new Map();
|
|
38
44
|
this.promptManager = promptManager;
|
|
39
45
|
this.modelManager = modelManager;
|
|
@@ -42,9 +48,8 @@ export class CommandManager {
|
|
|
42
48
|
this.tokenTracker = tokenTracker;
|
|
43
49
|
this.config = config;
|
|
44
50
|
this.tokenCounter = tokenCounter;
|
|
45
|
-
this.toolEvents = toolEvents;
|
|
46
|
-
this.toolExecutor = toolExecutor;
|
|
47
51
|
this.promptHistory = promptHistory;
|
|
52
|
+
this.workspace = workspace;
|
|
48
53
|
this.initialized = false;
|
|
49
54
|
}
|
|
50
55
|
async initializeCommmands() {
|
|
@@ -60,30 +65,36 @@ export class CommandManager {
|
|
|
60
65
|
tokenTracker: this.tokenTracker,
|
|
61
66
|
config: this.config,
|
|
62
67
|
tokenCounter: this.tokenCounter,
|
|
63
|
-
toolEvents: this.toolEvents,
|
|
64
|
-
toolExecutor: this.toolExecutor,
|
|
65
68
|
promptHistory: this.promptHistory,
|
|
69
|
+
workspace: this.workspace,
|
|
66
70
|
};
|
|
67
71
|
// Register all commands
|
|
68
72
|
const cmds = [
|
|
73
|
+
addDirectoryCommand(options),
|
|
69
74
|
clearCommand(options),
|
|
70
|
-
compactCommand(options),
|
|
71
|
-
|
|
72
|
-
|
|
75
|
+
// compactCommand(options),
|
|
76
|
+
contextCommand(options),
|
|
77
|
+
// editCommand(options),
|
|
78
|
+
// editPromptCommand(options),
|
|
73
79
|
exitCommand(options),
|
|
74
|
-
filesCommand(options),
|
|
80
|
+
// filesCommand(options),
|
|
75
81
|
healthCommand(options),
|
|
82
|
+
historyCommand(options),
|
|
76
83
|
initCommand(options),
|
|
84
|
+
listDirectoriesCommand(options),
|
|
77
85
|
pasteCommand(options),
|
|
86
|
+
pickupCommand(options),
|
|
78
87
|
promptCommand(options),
|
|
88
|
+
removeDirectoryCommand(options),
|
|
79
89
|
resetCommand(options),
|
|
80
90
|
saveCommand(options),
|
|
81
|
-
rulesCommand(options),
|
|
91
|
+
// rulesCommand(options),
|
|
82
92
|
modelCommand(options),
|
|
83
93
|
usageCommand(options),
|
|
84
|
-
lastLogCommand(options),
|
|
94
|
+
// lastLogCommand(options),
|
|
85
95
|
generateRulesCommand(options),
|
|
86
|
-
|
|
96
|
+
handoffCommand(options),
|
|
97
|
+
// applicationLogCommand(options),
|
|
87
98
|
copyCommand(options),
|
|
88
99
|
listToolsCommand(options),
|
|
89
100
|
shellCommand(options),
|
|
@@ -97,10 +108,10 @@ export class CommandManager {
|
|
|
97
108
|
// Register all commands
|
|
98
109
|
for (const cmd of cmds) {
|
|
99
110
|
this.commands.set(cmd.command, cmd);
|
|
100
|
-
const aliases = cmd.aliases ?? [];
|
|
101
|
-
for (const alias of aliases) {
|
|
102
|
-
|
|
103
|
-
}
|
|
111
|
+
// const aliases: string[] = cmd.aliases ?? [];
|
|
112
|
+
// for (const alias of aliases) {
|
|
113
|
+
// this.commands.set(alias, cmd);
|
|
114
|
+
// }
|
|
104
115
|
}
|
|
105
116
|
const promptCmd = this.commands.get("/prompt");
|
|
106
117
|
if (promptCmd) {
|
|
@@ -109,10 +120,13 @@ export class CommandManager {
|
|
|
109
120
|
this.commands.set(`/${cmd}`, {
|
|
110
121
|
command: `/${cmd}`,
|
|
111
122
|
description: "",
|
|
123
|
+
getSubCommands: () => Promise.resolve([]),
|
|
112
124
|
execute: (args) => {
|
|
113
125
|
return promptCmd.execute([cmd, ...args]);
|
|
114
126
|
},
|
|
115
|
-
|
|
127
|
+
async handle(args, options) {
|
|
128
|
+
return promptCmd.handle([cmd, ...args], options);
|
|
129
|
+
},
|
|
116
130
|
});
|
|
117
131
|
}
|
|
118
132
|
}
|
|
@@ -123,6 +137,24 @@ export class CommandManager {
|
|
|
123
137
|
throw new Error("Commands have not been initialized. Call initializeCommmands() first.");
|
|
124
138
|
}
|
|
125
139
|
}
|
|
140
|
+
async getCompletions() {
|
|
141
|
+
this.ensureInitialized();
|
|
142
|
+
return Promise.all(Array.from(this.commands.entries()).map(async (entry) => {
|
|
143
|
+
const subs = await entry[1].getSubCommands();
|
|
144
|
+
return {
|
|
145
|
+
name: entry[0].slice(1),
|
|
146
|
+
// value: entry[0].slice(1),
|
|
147
|
+
// label: entry[0].slice(1),
|
|
148
|
+
description: entry[1].description,
|
|
149
|
+
getArgumentCompletions(_argumentPrefix) {
|
|
150
|
+
return subs.map((sub) => ({
|
|
151
|
+
value: sub,
|
|
152
|
+
label: sub,
|
|
153
|
+
}));
|
|
154
|
+
},
|
|
155
|
+
};
|
|
156
|
+
}));
|
|
157
|
+
}
|
|
126
158
|
getCommands() {
|
|
127
159
|
this.ensureInitialized();
|
|
128
160
|
return Array.from(this.commands.keys()).sort();
|
|
@@ -159,4 +191,32 @@ export class CommandManager {
|
|
|
159
191
|
break: false,
|
|
160
192
|
};
|
|
161
193
|
}
|
|
194
|
+
async handle2({ userInput }, options) {
|
|
195
|
+
this.ensureInitialized();
|
|
196
|
+
const commandArgs = userInput.split(" ");
|
|
197
|
+
const command = commandArgs.at(0);
|
|
198
|
+
const args = commandArgs.slice(1);
|
|
199
|
+
if (command) {
|
|
200
|
+
const replCommand = this.commands.get(command);
|
|
201
|
+
if (replCommand) {
|
|
202
|
+
const result = await replCommand.handle(args, options);
|
|
203
|
+
if (result === "continue") {
|
|
204
|
+
return {
|
|
205
|
+
continue: true,
|
|
206
|
+
break: false,
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
if (result === "break") {
|
|
210
|
+
return {
|
|
211
|
+
continue: false,
|
|
212
|
+
break: true,
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
return {
|
|
218
|
+
continue: false,
|
|
219
|
+
break: false,
|
|
220
|
+
};
|
|
221
|
+
}
|
|
162
222
|
}
|
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
import { type ModelName } from "../models/providers.ts";
|
|
2
|
+
import { Container, Input } from "../tui/index.ts";
|
|
1
3
|
import type { CommandOptions, ReplCommand } from "./types.ts";
|
|
2
4
|
export declare function modelCommand(options: CommandOptions): ReplCommand;
|
|
5
|
+
/**
|
|
6
|
+
* Component that renders a model selector with search
|
|
7
|
+
*/
|
|
8
|
+
export declare class ModelSelectorComponent extends Container {
|
|
9
|
+
private searchInput;
|
|
10
|
+
private listContainer;
|
|
11
|
+
private allModels;
|
|
12
|
+
private filteredModels;
|
|
13
|
+
private selectedIndex;
|
|
14
|
+
private currentModel;
|
|
15
|
+
private onSelectCallback;
|
|
16
|
+
private onCancelCallback;
|
|
17
|
+
constructor(currentModel: ModelName, onSelect: (model: ModelName) => void, onCancel: () => void);
|
|
18
|
+
private loadModels;
|
|
19
|
+
private filterModels;
|
|
20
|
+
private updateList;
|
|
21
|
+
handleInput(keyData: string): void;
|
|
22
|
+
private handleSelect;
|
|
23
|
+
getSearchInput(): Input;
|
|
24
|
+
}
|
|
3
25
|
//# sourceMappingURL=model-command.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-command.d.ts","sourceRoot":"","sources":["../../source/commands/model-command.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"model-command.d.ts","sourceRoot":"","sources":["../../source/commands/model-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,SAAS,EAKf,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EACL,SAAS,EAET,KAAK,EAIN,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9D,wBAAgB,YAAY,CAAC,OAAO,EAAE,cAAc,GAAG,WAAW,CAyRjE;AAaD;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,SAAS;IACnD,OAAO,CAAC,WAAW,CAAQ;IAC3B,OAAO,CAAC,aAAa,CAAY;IACjC,OAAO,CAAC,SAAS,CAAmB;IACpC,OAAO,CAAC,cAAc,CAAmB;IACzC,OAAO,CAAC,aAAa,CAAK;IAC1B,OAAO,CAAC,YAAY,CAAY;IAChC,OAAO,CAAC,gBAAgB,CAA6B;IACrD,OAAO,CAAC,gBAAgB,CAAa;gBAGnC,YAAY,EAAE,SAAS,EACvB,QAAQ,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,EACpC,QAAQ,EAAE,MAAM,IAAI;IA0CtB,OAAO,CAAC,UAAU;IAKlB,OAAO,CAAC,YAAY;IAqBpB,OAAO,CAAC,UAAU;IAyDlB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAgClC,OAAO,CAAC,YAAY;IAIpB,cAAc,IAAI,KAAK;CAGxB"}
|