@travisennis/acai 0.0.6 → 0.0.7
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 +186 -17
- package/bin/acai-wrapper.js +26 -0
- package/dist/agent/index.d.ts +15 -2
- package/dist/agent/index.d.ts.map +1 -1
- package/dist/agent/index.js +202 -174
- package/dist/api/exa/index.js +1 -1
- package/dist/cli.d.ts +2 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +40 -7
- package/dist/commands/add-directory-command.d.ts +1 -1
- package/dist/commands/add-directory-command.d.ts.map +1 -1
- package/dist/commands/add-directory-command.js +1 -32
- package/dist/commands/application-log-command.d.ts +1 -1
- package/dist/commands/application-log-command.d.ts.map +1 -1
- package/dist/commands/application-log-command.js +2 -38
- package/dist/commands/clear-command.d.ts +1 -1
- package/dist/commands/clear-command.d.ts.map +1 -1
- package/dist/commands/clear-command.js +1 -5
- package/dist/commands/compact-command.d.ts.map +1 -1
- package/dist/commands/compact-command.js +0 -9
- package/dist/commands/context-command.d.ts +1 -1
- package/dist/commands/context-command.d.ts.map +1 -1
- package/dist/commands/context-command.js +13 -72
- package/dist/commands/copy-command.d.ts.map +1 -1
- package/dist/commands/copy-command.js +0 -19
- package/dist/commands/edit-command.d.ts +1 -1
- package/dist/commands/edit-command.d.ts.map +1 -1
- package/dist/commands/edit-command.js +3 -49
- package/dist/commands/edit-prompt-command.d.ts +1 -1
- package/dist/commands/edit-prompt-command.d.ts.map +1 -1
- package/dist/commands/edit-prompt-command.js +1 -26
- package/dist/commands/exit-command.d.ts +1 -4
- package/dist/commands/exit-command.d.ts.map +1 -1
- package/dist/commands/exit-command.js +2 -18
- package/dist/commands/files-command.d.ts +1 -1
- package/dist/commands/files-command.d.ts.map +1 -1
- package/dist/commands/files-command.js +1 -54
- package/dist/commands/generate-rules-command.d.ts +1 -1
- package/dist/commands/generate-rules-command.d.ts.map +1 -1
- package/dist/commands/generate-rules-command.js +18 -60
- package/dist/commands/handoff-command.d.ts.map +1 -1
- package/dist/commands/handoff-command.js +0 -11
- package/dist/commands/health-command.d.ts +1 -1
- package/dist/commands/health-command.d.ts.map +1 -1
- package/dist/commands/health-command.js +8 -103
- package/dist/commands/help-command.d.ts +1 -1
- package/dist/commands/help-command.d.ts.map +1 -1
- package/dist/commands/help-command.js +6 -14
- package/dist/commands/history-command.d.ts +1 -1
- package/dist/commands/history-command.d.ts.map +1 -1
- package/dist/commands/history-command.js +30 -106
- 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 +4 -23
- package/dist/commands/last-log-command.d.ts +1 -1
- package/dist/commands/last-log-command.d.ts.map +1 -1
- package/dist/commands/last-log-command.js +1 -28
- package/dist/commands/list-directories-command.d.ts +1 -1
- package/dist/commands/list-directories-command.d.ts.map +1 -1
- package/dist/commands/list-directories-command.js +1 -14
- package/dist/commands/list-tools-command.d.ts.map +1 -1
- package/dist/commands/list-tools-command.js +55 -78
- package/dist/commands/manager.d.ts +1 -8
- package/dist/commands/manager.d.ts.map +1 -1
- package/dist/commands/manager.js +7 -42
- package/dist/commands/model-command.d.ts +0 -22
- package/dist/commands/model-command.d.ts.map +1 -1
- package/dist/commands/model-command.js +5 -126
- package/dist/commands/paste-command.d.ts +1 -1
- package/dist/commands/paste-command.d.ts.map +1 -1
- package/dist/commands/paste-command.js +1 -79
- package/dist/commands/pickup-command.d.ts.map +1 -1
- package/dist/commands/pickup-command.js +3 -55
- package/dist/commands/prompt-command.d.ts +19 -1
- package/dist/commands/prompt-command.d.ts.map +1 -1
- package/dist/commands/prompt-command.js +172 -194
- package/dist/commands/remove-directory-command.d.ts +1 -1
- package/dist/commands/remove-directory-command.d.ts.map +1 -1
- package/dist/commands/remove-directory-command.js +1 -33
- 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 +3 -11
- package/dist/commands/rules-command.d.ts +1 -1
- package/dist/commands/rules-command.d.ts.map +1 -1
- package/dist/commands/rules-command.js +1 -63
- package/dist/commands/save-command.d.ts +1 -1
- package/dist/commands/save-command.d.ts.map +1 -1
- package/dist/commands/save-command.js +1 -8
- package/dist/commands/shell-command.d.ts.map +1 -1
- package/dist/commands/shell-command.js +1 -48
- package/dist/commands/types.d.ts +0 -3
- package/dist/commands/types.d.ts.map +1 -1
- package/dist/commands/usage-command.d.ts +1 -1
- package/dist/commands/usage-command.d.ts.map +1 -1
- package/dist/commands/usage-command.js +5 -16
- package/dist/config.d.ts +17 -6
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +86 -53
- package/dist/execution/index.d.ts +17 -2
- package/dist/execution/index.d.ts.map +1 -1
- package/dist/execution/index.js +62 -20
- package/dist/formatting.d.ts +19 -0
- package/dist/formatting.d.ts.map +1 -1
- package/dist/formatting.js +54 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +212 -153
- package/dist/messages.d.ts +3 -0
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js +67 -3
- 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.map +1 -1
- package/dist/models/deepseek-provider.js +0 -2
- 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.map +1 -1
- package/dist/models/groq-provider.js +0 -1
- package/dist/models/openai-provider.d.ts.map +1 -1
- package/dist/models/openai-provider.js +0 -4
- package/dist/models/openrouter-provider.d.ts +10 -9
- package/dist/models/openrouter-provider.d.ts.map +1 -1
- package/dist/models/openrouter-provider.js +82 -88
- package/dist/models/providers.d.ts +4 -14
- package/dist/models/providers.d.ts.map +1 -1
- package/dist/models/providers.js +1 -57
- package/dist/models/xai-provider.d.ts.map +1 -1
- package/dist/models/xai-provider.js +0 -2
- package/dist/prompts.d.ts +9 -4
- package/dist/prompts.d.ts.map +1 -1
- package/dist/prompts.js +427 -99
- package/dist/repl/project-status-line.d.ts +1 -0
- package/dist/repl/project-status-line.d.ts.map +1 -1
- package/dist/repl/project-status-line.js +57 -27
- package/dist/repl-new.d.ts +0 -2
- package/dist/repl-new.d.ts.map +1 -1
- package/dist/repl-new.js +34 -54
- package/dist/skills.d.ts +20 -0
- package/dist/skills.d.ts.map +1 -0
- package/dist/skills.js +192 -0
- package/dist/terminal/control.d.ts +55 -0
- package/dist/terminal/control.d.ts.map +1 -0
- package/dist/terminal/control.js +109 -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 -25
- package/dist/terminal/formatting.d.ts.map +1 -1
- package/dist/terminal/formatting.js +35 -52
- 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/markdown.js +7 -5
- package/dist/terminal/strip-ansi.js +4 -4
- 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/threshold.d.ts +6 -21
- package/dist/tokens/threshold.d.ts.map +1 -1
- package/dist/tokens/threshold.js +13 -31
- package/dist/tools/advanced-edit-file.d.ts.map +1 -1
- package/dist/tools/advanced-edit-file.js +5 -1
- package/dist/tools/agent.d.ts.map +1 -1
- package/dist/tools/agent.js +19 -5
- package/dist/tools/bash.d.ts +3 -1
- package/dist/tools/bash.d.ts.map +1 -1
- package/dist/tools/bash.js +204 -42
- package/dist/tools/batch.d.ts +34 -0
- package/dist/tools/batch.d.ts.map +1 -0
- package/dist/tools/batch.js +174 -0
- package/dist/tools/code-interpreter.d.ts.map +1 -1
- package/dist/tools/code-interpreter.js +25 -9
- package/dist/tools/delete-file.d.ts.map +1 -1
- package/dist/tools/delete-file.js +9 -2
- package/dist/tools/directory-tree.d.ts +0 -6
- package/dist/tools/directory-tree.d.ts.map +1 -1
- package/dist/tools/directory-tree.js +29 -18
- package/dist/tools/dynamic-tool-loader.d.ts +0 -4
- package/dist/tools/dynamic-tool-loader.d.ts.map +1 -1
- package/dist/tools/dynamic-tool-loader.js +2 -2
- package/dist/tools/edit-file.d.ts.map +1 -1
- package/dist/tools/edit-file.js +16 -3
- package/dist/tools/glob.d.ts.map +1 -1
- package/dist/tools/glob.js +24 -13
- package/dist/tools/grep.d.ts.map +1 -1
- package/dist/tools/grep.js +40 -25
- package/dist/tools/index.d.ts +17 -3
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +43 -1
- package/dist/tools/llm-edit-fixer.d.ts +0 -1
- package/dist/tools/llm-edit-fixer.d.ts.map +1 -1
- package/dist/tools/llm-edit-fixer.js +14 -28
- package/dist/tools/move-file.d.ts.map +1 -1
- package/dist/tools/move-file.js +8 -1
- package/dist/tools/read-file.d.ts.map +1 -1
- package/dist/tools/read-file.js +32 -23
- package/dist/tools/read-multiple-files.d.ts.map +1 -1
- package/dist/tools/read-multiple-files.js +102 -45
- 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 +20 -2
- package/dist/tools/think.d.ts.map +1 -1
- package/dist/tools/think.js +7 -1
- package/dist/tools/types.d.ts +5 -1
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/tools/web-fetch.js +1 -1
- package/dist/tools/web-search.d.ts.map +1 -1
- package/dist/tools/web-search.js +24 -9
- 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 +81 -0
- package/dist/tui/components/editor.d.ts +60 -5
- package/dist/tui/components/editor.d.ts.map +1 -1
- package/dist/tui/components/editor.js +577 -115
- package/dist/tui/components/footer.d.ts +0 -12
- package/dist/tui/components/footer.d.ts.map +1 -1
- package/dist/tui/components/footer.js +19 -7
- 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/loader.d.ts +5 -1
- package/dist/tui/components/loader.d.ts.map +1 -1
- package/dist/tui/components/loader.js +2 -2
- package/dist/tui/components/markdown.d.ts +26 -23
- package/dist/tui/components/markdown.d.ts.map +1 -1
- package/dist/tui/components/markdown.js +107 -54
- 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 +0 -29
- 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 +78 -0
- package/dist/tui/components/prompt-status.d.ts +2 -1
- package/dist/tui/components/prompt-status.d.ts.map +1 -1
- package/dist/tui/components/prompt-status.js +7 -2
- package/dist/tui/components/select-list.d.ts +27 -1
- package/dist/tui/components/select-list.d.ts.map +1 -1
- package/dist/tui/components/select-list.js +93 -29
- 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 +8 -4
- package/dist/tui/components/tool-execution.d.ts.map +1 -1
- package/dist/tui/components/tool-execution.js +88 -80
- package/dist/tui/components/user-message.d.ts.map +1 -1
- package/dist/tui/components/user-message.js +6 -4
- package/dist/tui/index.d.ts +9 -5
- package/dist/tui/index.d.ts.map +1 -1
- package/dist/tui/index.js +5 -1
- package/dist/tui/terminal.d.ts +2 -1
- package/dist/tui/terminal.d.ts.map +1 -1
- package/dist/tui/terminal.js +28 -38
- package/dist/tui/tui.d.ts +2 -0
- package/dist/tui/tui.d.ts.map +1 -1
- package/dist/tui/tui.js +53 -33
- package/dist/tui/utils.d.ts +5 -0
- package/dist/tui/utils.d.ts.map +1 -1
- package/dist/tui/utils.js +81 -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/{zod-utils.d.ts → zod.d.ts} +1 -1
- package/dist/utils/zod.d.ts.map +1 -0
- package/package.json +17 -17
- 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/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/prompt.d.ts +0 -21
- package/dist/repl/prompt.d.ts.map +0 -1
- package/dist/repl/prompt.js +0 -244
- 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/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/terminal/types.js +0 -1
- package/dist/tools/bash-utils.d.ts.map +0 -1
- package/dist/tools/filesystem-utils.d.ts.map +0 -1
- package/dist/tools/git-utils.d.ts.map +0 -1
- package/dist/utils/filesystem.d.ts.map +0 -1
- package/dist/utils/zod-utils.d.ts.map +0 -1
- /package/dist/utils/{filesystem.js → filesystem/operations.js} +0 -0
- /package/dist/utils/{zod-utils.js → zod.js} +0 -0
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { readFile } from "node:fs/promises";
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { config } from "../config.js";
|
|
4
|
-
import { editor } from "../terminal/editor-prompt.js";
|
|
5
4
|
import style from "../terminal/style.js";
|
|
6
5
|
import { Text } from "../tui/index.js";
|
|
7
6
|
import { glob } from "../utils/glob.js";
|
|
@@ -37,37 +36,11 @@ async function findMostRecentLog(logDir) {
|
|
|
37
36
|
datedFiles.sort((a, b) => b.date.getTime() - a.date.getTime());
|
|
38
37
|
return datedFiles[0]?.file ?? null; // The first file is the most recent
|
|
39
38
|
}
|
|
40
|
-
export const lastLogCommand = (
|
|
39
|
+
export const lastLogCommand = (_options) => {
|
|
41
40
|
return {
|
|
42
41
|
command: "/last-log",
|
|
43
42
|
description: "Opens the most recent REPL audit log in the editor.",
|
|
44
43
|
getSubCommands: () => Promise.resolve([]),
|
|
45
|
-
execute: async () => {
|
|
46
|
-
const logDir = config.app.ensurePathSync("audit");
|
|
47
|
-
const mostRecentLog = await findMostRecentLog(logDir);
|
|
48
|
-
if (!mostRecentLog) {
|
|
49
|
-
terminal.error(`No REPL audit logs found in '${logDir}'.`);
|
|
50
|
-
return "continue";
|
|
51
|
-
}
|
|
52
|
-
try {
|
|
53
|
-
const content = await readFile(mostRecentLog, { encoding: "utf8" });
|
|
54
|
-
// Use the editor prompt to display the content (read-only)
|
|
55
|
-
await editor({
|
|
56
|
-
message: `Viewing ${style.green(mostRecentLog)}`,
|
|
57
|
-
postfix: ".json", // Set postfix for syntax highlighting if editor supports it
|
|
58
|
-
default: content,
|
|
59
|
-
// By not providing an onSubmit or similar handler to write the file,
|
|
60
|
-
// and not calling writeFileSync after, this effectively becomes read-only.
|
|
61
|
-
skipPrompt: true,
|
|
62
|
-
});
|
|
63
|
-
terminal.info("Closed log view");
|
|
64
|
-
return "continue";
|
|
65
|
-
}
|
|
66
|
-
catch (error) {
|
|
67
|
-
terminal.error(`Error reading or displaying log file ${mostRecentLog}: ${error}`);
|
|
68
|
-
return "continue";
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
44
|
async handle(_args, { tui, container, editor, }) {
|
|
72
45
|
const logDir = config.app.ensurePathSync("audit");
|
|
73
46
|
const mostRecentLog = await findMostRecentLog(logDir);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { CommandOptions, ReplCommand } from "./types.ts";
|
|
2
|
-
export declare const listDirectoriesCommand: ({
|
|
2
|
+
export declare const listDirectoriesCommand: ({ workspace, }: CommandOptions) => ReplCommand;
|
|
3
3
|
//# sourceMappingURL=list-directories-command.d.ts.map
|
|
@@ -1 +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,
|
|
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,24 +1,11 @@
|
|
|
1
1
|
import { Modal, Container as ModalContainer, ModalText } from "../tui/index.js";
|
|
2
|
-
export const listDirectoriesCommand = ({
|
|
2
|
+
export const listDirectoriesCommand = ({ workspace, }) => {
|
|
3
3
|
return {
|
|
4
4
|
command: "/list-directories",
|
|
5
5
|
description: "List all allowed working directories",
|
|
6
6
|
getSubCommands: async () => {
|
|
7
7
|
return [];
|
|
8
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
9
|
async handle(_args, { tui, editor }) {
|
|
23
10
|
// Build modal content
|
|
24
11
|
const modalContent = new ModalContainer();
|
|
@@ -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":"AASA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9D,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,cAAc,GAAG,WAAW,CAgIrE"}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import style from "../terminal/style.js";
|
|
2
2
|
import { initAgents, initTools } from "../tools/index.js";
|
|
3
|
-
import {
|
|
3
|
+
import { Modal, Container as ModalContainer, ModalText, TableComponent, } from "../tui/index.js";
|
|
4
4
|
export function listToolsCommand(options) {
|
|
5
5
|
return {
|
|
6
6
|
command: "/list-tools",
|
|
7
7
|
description: "List all available static and dynamic tools.",
|
|
8
8
|
aliases: ["/lt"],
|
|
9
9
|
getSubCommands: async () => [],
|
|
10
|
-
async
|
|
11
|
-
const { terminal } = options;
|
|
10
|
+
async handle(_args, { tui, editor }) {
|
|
12
11
|
try {
|
|
12
|
+
// Get active tools from config
|
|
13
|
+
const projectConfig = await options.config.getConfig();
|
|
14
|
+
const activeTools = projectConfig.tools.activeTools;
|
|
13
15
|
const tools = await initTools({
|
|
14
16
|
tokenCounter: options.tokenCounter,
|
|
15
17
|
workspace: options.workspace,
|
|
@@ -17,15 +19,15 @@ export function listToolsCommand(options) {
|
|
|
17
19
|
tokenTracker: options.tokenTracker,
|
|
18
20
|
});
|
|
19
21
|
const agentTools = await initAgents({
|
|
20
|
-
terminal: options.terminal,
|
|
21
22
|
modelManager: options.modelManager,
|
|
22
23
|
tokenTracker: options.tokenTracker,
|
|
23
24
|
tokenCounter: options.tokenCounter,
|
|
24
25
|
workspace: options.workspace,
|
|
25
26
|
});
|
|
26
|
-
const toolNames = Object.keys({
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
const toolNames = Object.keys({
|
|
28
|
+
...tools.toolDefs,
|
|
29
|
+
...agentTools.toolDefs,
|
|
30
|
+
}).sort();
|
|
29
31
|
// Separate static and dynamic tools
|
|
30
32
|
const staticTools = [];
|
|
31
33
|
const dynamicTools = [];
|
|
@@ -37,86 +39,61 @@ export function listToolsCommand(options) {
|
|
|
37
39
|
staticTools.push(toolName);
|
|
38
40
|
}
|
|
39
41
|
}
|
|
40
|
-
//
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
terminal.writeln(` ${toolName}`);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
// Display dynamic tools
|
|
48
|
-
if (dynamicTools.length > 0) {
|
|
49
|
-
terminal.writeln(" Dynamic tools:");
|
|
50
|
-
for (const toolName of dynamicTools) {
|
|
51
|
-
terminal.writeln(` ${toolName}`);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
// Display summary
|
|
55
|
-
terminal.writeln(`\n Total: ${staticTools.length} static, ${dynamicTools.length} dynamic`);
|
|
56
|
-
return "continue";
|
|
57
|
-
}
|
|
58
|
-
catch (error) {
|
|
59
|
-
terminal.error(`Error listing tools: ${error.message}`);
|
|
60
|
-
return "continue";
|
|
61
|
-
}
|
|
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
|
-
}
|
|
42
|
+
// Build modal content
|
|
43
|
+
const modalContent = new ModalContainer();
|
|
44
|
+
if (toolNames.length === 0) {
|
|
45
|
+
modalContent.addChild(new ModalText("No tools available.", 0, 1));
|
|
90
46
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
lineIndex++;
|
|
47
|
+
else {
|
|
48
|
+
// Create table data
|
|
49
|
+
const tableData = [];
|
|
50
|
+
// Add static tools
|
|
96
51
|
for (const toolName of staticTools) {
|
|
97
|
-
|
|
98
|
-
|
|
52
|
+
const isActive = activeTools === undefined || activeTools.includes(toolName);
|
|
53
|
+
tableData.push([
|
|
54
|
+
toolName,
|
|
55
|
+
"Static",
|
|
56
|
+
isActive ? "Active" : "Inactive",
|
|
57
|
+
]);
|
|
99
58
|
}
|
|
100
|
-
|
|
101
|
-
// Display dynamic tools
|
|
102
|
-
if (dynamicTools.length > 0) {
|
|
103
|
-
container.addChild(new Text(" Dynamic tools:", lineIndex, 0));
|
|
104
|
-
lineIndex++;
|
|
59
|
+
// Add dynamic tools
|
|
105
60
|
for (const toolName of dynamicTools) {
|
|
106
|
-
|
|
107
|
-
|
|
61
|
+
const isActive = activeTools === undefined || activeTools.includes(toolName);
|
|
62
|
+
tableData.push([
|
|
63
|
+
toolName,
|
|
64
|
+
"Dynamic",
|
|
65
|
+
isActive ? "Active" : "Inactive",
|
|
66
|
+
]);
|
|
108
67
|
}
|
|
68
|
+
modalContent.addChild(new TableComponent(tableData, {
|
|
69
|
+
headers: ["Tool Name", "Type", "Status"],
|
|
70
|
+
colWidths: [60, 20, 20],
|
|
71
|
+
}));
|
|
72
|
+
// Add summary
|
|
73
|
+
modalContent.addChild(new ModalText("", 0, 1)); // Spacer
|
|
74
|
+
const activeCount = activeTools === undefined
|
|
75
|
+
? toolNames.length
|
|
76
|
+
: toolNames.filter((tool) => activeTools.includes(tool)).length;
|
|
77
|
+
modalContent.addChild(new ModalText(`Total: ${staticTools.length} static, ${dynamicTools.length} dynamic, ${activeCount} active`, 0, 1));
|
|
109
78
|
}
|
|
110
|
-
//
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
79
|
+
// Create and show modal
|
|
80
|
+
const modal = new Modal("Available Tools", modalContent, true, () => {
|
|
81
|
+
// Modal closed callback
|
|
82
|
+
editor.setText("");
|
|
83
|
+
tui.requestRender();
|
|
84
|
+
});
|
|
85
|
+
tui.showModal(modal);
|
|
114
86
|
return "continue";
|
|
115
87
|
}
|
|
116
88
|
catch (error) {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
89
|
+
// Show error in modal
|
|
90
|
+
const errorContent = new ModalContainer();
|
|
91
|
+
errorContent.addChild(new ModalText(style.red(`Error listing tools: ${error.message}`), 0, 1));
|
|
92
|
+
const errorModal = new Modal("Error", errorContent, true, () => {
|
|
93
|
+
editor.setText("");
|
|
94
|
+
tui.requestRender();
|
|
95
|
+
});
|
|
96
|
+
tui.showModal(errorModal);
|
|
120
97
|
return "continue";
|
|
121
98
|
}
|
|
122
99
|
},
|
|
@@ -6,13 +6,12 @@ export declare class CommandManager {
|
|
|
6
6
|
private modelManager;
|
|
7
7
|
private messageHistory;
|
|
8
8
|
private tokenTracker;
|
|
9
|
-
private terminal;
|
|
10
9
|
private config;
|
|
11
10
|
private tokenCounter;
|
|
12
11
|
private promptHistory;
|
|
13
12
|
private workspace;
|
|
14
13
|
private initialized;
|
|
15
|
-
constructor({ promptManager, modelManager,
|
|
14
|
+
constructor({ promptManager, modelManager, messageHistory, tokenTracker, config, tokenCounter, promptHistory, workspace, }: CommandOptions);
|
|
16
15
|
initializeCommmands(): Promise<void>;
|
|
17
16
|
private ensureInitialized;
|
|
18
17
|
getCompletions(): Promise<SlashCommand[]>;
|
|
@@ -20,12 +19,6 @@ export declare class CommandManager {
|
|
|
20
19
|
getSubCommands(command: string): Promise<string[]>;
|
|
21
20
|
handle({ userInput }: {
|
|
22
21
|
userInput: string;
|
|
23
|
-
}): Promise<{
|
|
24
|
-
continue: boolean;
|
|
25
|
-
break: boolean;
|
|
26
|
-
}>;
|
|
27
|
-
handle2({ userInput }: {
|
|
28
|
-
userInput: string;
|
|
29
22
|
}, options: {
|
|
30
23
|
tui: TUI;
|
|
31
24
|
container: Container;
|
|
@@ -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":"AAOA,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,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,cAAc,EACd,YAAY,EACZ,MAAM,EACN,YAAY,EACZ,aAAa,EACb,SAAS,GACV,EAAE,cAAc;IAaX,mBAAmB;IA0FzB,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,CACV,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
|
@@ -20,7 +20,7 @@ import { listToolsCommand } from "./list-tools-command.js";
|
|
|
20
20
|
import { modelCommand } from "./model-command.js";
|
|
21
21
|
import { pasteCommand } from "./paste-command.js";
|
|
22
22
|
import { pickupCommand } from "./pickup-command.js";
|
|
23
|
-
import { promptCommand } from "./prompt-command.js";
|
|
23
|
+
import { loadPrompts, promptCommand } from "./prompt-command.js";
|
|
24
24
|
import { removeDirectoryCommand } from "./remove-directory-command.js";
|
|
25
25
|
import { resetCommand } from "./reset-command.js";
|
|
26
26
|
// import { rulesCommand } from "./rules-command.ts";
|
|
@@ -33,17 +33,15 @@ export class CommandManager {
|
|
|
33
33
|
modelManager;
|
|
34
34
|
messageHistory;
|
|
35
35
|
tokenTracker;
|
|
36
|
-
terminal;
|
|
37
36
|
config;
|
|
38
37
|
tokenCounter;
|
|
39
38
|
promptHistory;
|
|
40
39
|
workspace;
|
|
41
40
|
initialized;
|
|
42
|
-
constructor({ promptManager, modelManager,
|
|
41
|
+
constructor({ promptManager, modelManager, messageHistory, tokenTracker, config, tokenCounter, promptHistory, workspace, }) {
|
|
43
42
|
this.commands = new Map();
|
|
44
43
|
this.promptManager = promptManager;
|
|
45
44
|
this.modelManager = modelManager;
|
|
46
|
-
this.terminal = terminal;
|
|
47
45
|
this.messageHistory = messageHistory;
|
|
48
46
|
this.tokenTracker = tokenTracker;
|
|
49
47
|
this.config = config;
|
|
@@ -60,7 +58,6 @@ export class CommandManager {
|
|
|
60
58
|
const options = {
|
|
61
59
|
promptManager: this.promptManager,
|
|
62
60
|
modelManager: this.modelManager,
|
|
63
|
-
terminal: this.terminal,
|
|
64
61
|
messageHistory: this.messageHistory,
|
|
65
62
|
tokenTracker: this.tokenTracker,
|
|
66
63
|
config: this.config,
|
|
@@ -101,10 +98,7 @@ export class CommandManager {
|
|
|
101
98
|
];
|
|
102
99
|
// Add help command with access to all commands
|
|
103
100
|
const helpCmd = helpCommand(options, this.commands);
|
|
104
|
-
cmds.push(
|
|
105
|
-
...helpCmd,
|
|
106
|
-
execute: () => helpCmd.execute([]),
|
|
107
|
-
});
|
|
101
|
+
cmds.push(helpCmd);
|
|
108
102
|
// Register all commands
|
|
109
103
|
for (const cmd of cmds) {
|
|
110
104
|
this.commands.set(cmd.command, cmd);
|
|
@@ -116,14 +110,13 @@ export class CommandManager {
|
|
|
116
110
|
const promptCmd = this.commands.get("/prompt");
|
|
117
111
|
if (promptCmd) {
|
|
118
112
|
const promptSubmCommands = await promptCmd.getSubCommands();
|
|
113
|
+
const prompts = await loadPrompts(options.config);
|
|
119
114
|
for (const cmd of promptSubmCommands) {
|
|
115
|
+
const prompt = prompts.get(cmd);
|
|
120
116
|
this.commands.set(`/${cmd}`, {
|
|
121
117
|
command: `/${cmd}`,
|
|
122
|
-
description: "",
|
|
118
|
+
description: prompt?.description ?? "",
|
|
123
119
|
getSubCommands: () => Promise.resolve([]),
|
|
124
|
-
execute: (args) => {
|
|
125
|
-
return promptCmd.execute([cmd, ...args]);
|
|
126
|
-
},
|
|
127
120
|
async handle(args, options) {
|
|
128
121
|
return promptCmd.handle([cmd, ...args], options);
|
|
129
122
|
},
|
|
@@ -163,35 +156,7 @@ export class CommandManager {
|
|
|
163
156
|
this.ensureInitialized();
|
|
164
157
|
return (await this.commands.get(command)?.getSubCommands()) ?? [];
|
|
165
158
|
}
|
|
166
|
-
async handle({ userInput }) {
|
|
167
|
-
this.ensureInitialized();
|
|
168
|
-
const commandArgs = userInput.split(" ");
|
|
169
|
-
const command = commandArgs.at(0);
|
|
170
|
-
const args = commandArgs.slice(1);
|
|
171
|
-
if (command) {
|
|
172
|
-
const replCommand = this.commands.get(command);
|
|
173
|
-
if (replCommand) {
|
|
174
|
-
const result = await replCommand.execute(args);
|
|
175
|
-
if (result === "continue") {
|
|
176
|
-
return {
|
|
177
|
-
continue: true,
|
|
178
|
-
break: false,
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
if (result === "break") {
|
|
182
|
-
return {
|
|
183
|
-
continue: false,
|
|
184
|
-
break: true,
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
return {
|
|
190
|
-
continue: false,
|
|
191
|
-
break: false,
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
async handle2({ userInput }, options) {
|
|
159
|
+
async handle({ userInput }, options) {
|
|
195
160
|
this.ensureInitialized();
|
|
196
161
|
const commandArgs = userInput.split(" ");
|
|
197
162
|
const command = commandArgs.at(0);
|
|
@@ -1,25 +1,3 @@
|
|
|
1
|
-
import { type ModelName } from "../models/providers.ts";
|
|
2
|
-
import { Container, Input } from "../tui/index.ts";
|
|
3
1
|
import type { CommandOptions, ReplCommand } from "./types.ts";
|
|
4
2
|
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
|
-
}
|
|
25
3
|
//# 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":"AAgBA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9D,wBAAgB,YAAY,CAAC,OAAO,EAAE,cAAc,GAAG,WAAW,CAoIjE"}
|
|
@@ -1,92 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isValidModel, modelRegistry, models, } from "../models/providers.js";
|
|
2
2
|
import { getTerminalSize } from "../terminal/formatting.js";
|
|
3
3
|
import style from "../terminal/style.js";
|
|
4
4
|
import { Container, Input, Spacer, Text, } from "../tui/index.js";
|
|
5
5
|
export function modelCommand(options) {
|
|
6
|
-
const {
|
|
7
|
-
function switchModel(newModelName) {
|
|
8
|
-
try {
|
|
9
|
-
// Get current and new model configs
|
|
10
|
-
const currentModelConfig = modelManager.getModelMetadata("repl");
|
|
11
|
-
const newModelConfig = modelRegistry[newModelName]; // Ensure modelRegistry is available
|
|
12
|
-
if (!newModelConfig) {
|
|
13
|
-
terminal.error(`Model configuration not found for: ${newModelName}`);
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
// Check for capability differences
|
|
17
|
-
if (currentModelConfig.supportsToolCalling &&
|
|
18
|
-
!newModelConfig.supportsToolCalling) {
|
|
19
|
-
terminal.warn("The new model doesn't support tool calling, which may limit functionality.");
|
|
20
|
-
}
|
|
21
|
-
if (currentModelConfig.supportsReasoning &&
|
|
22
|
-
!newModelConfig.supportsReasoning) {
|
|
23
|
-
terminal.warn("The new model doesn't support reasoning, which may change response quality.");
|
|
24
|
-
}
|
|
25
|
-
// Update model in ModelManager
|
|
26
|
-
modelManager.setModel("repl", newModelName);
|
|
27
|
-
// Assuming ModelManager handles the actual model instance switching internally.
|
|
28
|
-
terminal.info(`Model set to ${newModelName}.`); // Simplified message
|
|
29
|
-
}
|
|
30
|
-
catch (error) {
|
|
31
|
-
terminal.error(`Failed to switch model: ${error.message}`);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
6
|
+
const { modelManager } = options;
|
|
34
7
|
return {
|
|
35
8
|
command: "/model",
|
|
36
|
-
description: "List available models or switch to a different model. Usage: /model [provider:model-name|
|
|
9
|
+
description: "List available models or switch to a different model. Usage: /model [provider:model-name|provider]",
|
|
37
10
|
getSubCommands: () => Promise.resolve(models),
|
|
38
|
-
async execute(args) {
|
|
39
|
-
const arg = args.join(" ").trim();
|
|
40
|
-
const modelConfig = modelManager.getModelMetadata("repl");
|
|
41
|
-
// No args - display current model and list available models by category
|
|
42
|
-
if (!arg) {
|
|
43
|
-
const currentModel = modelConfig.id;
|
|
44
|
-
terminal.header(`Current model: ${currentModel}`);
|
|
45
|
-
terminal.header("Available models by category:");
|
|
46
|
-
// Display models by category
|
|
47
|
-
for (const category of ["fast", "balanced", "powerful"]) {
|
|
48
|
-
// Use 'as const' for stricter typing
|
|
49
|
-
terminal.writeln(`\n${category.charAt(0).toUpperCase() + category.slice(1)} models:`);
|
|
50
|
-
for (const model of getModelsByCategory(category)) {
|
|
51
|
-
terminal.writeln(formatModelInfo(model));
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
return "continue";
|
|
55
|
-
}
|
|
56
|
-
// Switch to a specific model
|
|
57
|
-
if (isValidModel(arg)) {
|
|
58
|
-
// Call the standalone switchModel function
|
|
59
|
-
switchModel(arg);
|
|
60
|
-
return "continue";
|
|
61
|
-
}
|
|
62
|
-
// Display models by category
|
|
63
|
-
const categories = ["fast", "balanced", "powerful"];
|
|
64
|
-
if (categories.includes(arg)) {
|
|
65
|
-
terminal.header(`${arg.charAt(0).toUpperCase() + arg.slice(1)} models:`);
|
|
66
|
-
// Need to assert arg is a valid category if the check passes
|
|
67
|
-
for (const model of getModelsByCategory(arg)) {
|
|
68
|
-
terminal.writeln(formatModelInfo(model));
|
|
69
|
-
}
|
|
70
|
-
return "continue";
|
|
71
|
-
}
|
|
72
|
-
// Display models by provider
|
|
73
|
-
if (providers.includes(arg)) {
|
|
74
|
-
terminal.header(`Models from ${arg}:`);
|
|
75
|
-
// Need to ensure modelRegistry is accessible and correctly typed
|
|
76
|
-
for (const model of Object.values(modelRegistry).filter((m) => m.provider === arg)) {
|
|
77
|
-
terminal.writeln(formatModelInfo(model));
|
|
78
|
-
}
|
|
79
|
-
return "continue";
|
|
80
|
-
}
|
|
81
|
-
// Invalid model name
|
|
82
|
-
terminal.error(`Invalid model name or category: ${arg}`);
|
|
83
|
-
terminal.info("Usage: /model [provider:model-name|category|provider]");
|
|
84
|
-
return "continue";
|
|
85
|
-
},
|
|
86
11
|
async handle(args, { tui, container, inputContainer, editor, }) {
|
|
87
12
|
const arg = args.join(" ").trim();
|
|
88
13
|
const modelConfig = modelManager.getModelMetadata("repl");
|
|
89
|
-
// No args - display
|
|
14
|
+
// No args - display model selector
|
|
90
15
|
if (!arg) {
|
|
91
16
|
// Create model selector with current model
|
|
92
17
|
const modelSelector = new ModelSelectorComponent(modelConfig.id, (model) => {
|
|
@@ -144,52 +69,6 @@ export function modelCommand(options) {
|
|
|
144
69
|
return "continue";
|
|
145
70
|
}
|
|
146
71
|
}
|
|
147
|
-
// // Display models by category
|
|
148
|
-
// const categories = ["fast", "balanced", "powerful"];
|
|
149
|
-
// if (categories.includes(arg)) {
|
|
150
|
-
// container.addChild(
|
|
151
|
-
// new Text(
|
|
152
|
-
// `${arg.charAt(0).toUpperCase() + arg.slice(1)} models:`,
|
|
153
|
-
// 1,
|
|
154
|
-
// 0,
|
|
155
|
-
// ),
|
|
156
|
-
// );
|
|
157
|
-
// let lineIndex = 2;
|
|
158
|
-
// for (const model of getModelsByCategory(
|
|
159
|
-
// arg as "fast" | "balanced" | "powerful",
|
|
160
|
-
// )) {
|
|
161
|
-
// container.addChild(new Text(formatModelInfo(model), lineIndex, 0));
|
|
162
|
-
// lineIndex++;
|
|
163
|
-
// }
|
|
164
|
-
// tui.requestRender();
|
|
165
|
-
// editor.setText("");
|
|
166
|
-
// return "continue";
|
|
167
|
-
// }
|
|
168
|
-
// // Display models by provider
|
|
169
|
-
// if (providers.includes(arg as ModelProvider)) {
|
|
170
|
-
// container.addChild(new Text(`Models from ${arg}:`, 0, 1));
|
|
171
|
-
// let lineIndex = 2;
|
|
172
|
-
// for (const model of Object.values(modelRegistry).filter(
|
|
173
|
-
// (m) => m.provider === arg,
|
|
174
|
-
// )) {
|
|
175
|
-
// container.addChild(new Text(formatModelInfo(model), lineIndex, 0));
|
|
176
|
-
// lineIndex++;
|
|
177
|
-
// }
|
|
178
|
-
// tui.requestRender();
|
|
179
|
-
// editor.setText("");
|
|
180
|
-
// return "continue";
|
|
181
|
-
// }
|
|
182
|
-
// // Invalid model name
|
|
183
|
-
// container.addChild(
|
|
184
|
-
// new Text(style.red(`Invalid model name or category: ${arg}`), 0, 1),
|
|
185
|
-
// );
|
|
186
|
-
// container.addChild(
|
|
187
|
-
// new Text(
|
|
188
|
-
// style.dim("Usage: /model [provider:model-name|category|provider]"),
|
|
189
|
-
// 2,
|
|
190
|
-
// 0,
|
|
191
|
-
// ),
|
|
192
|
-
// );
|
|
193
72
|
tui.requestRender();
|
|
194
73
|
editor.setText("");
|
|
195
74
|
return "continue";
|
|
@@ -205,7 +84,7 @@ function hideModelSelector(editorContainer, editor, tui) {
|
|
|
205
84
|
/**
|
|
206
85
|
* Component that renders a model selector with search
|
|
207
86
|
*/
|
|
208
|
-
|
|
87
|
+
class ModelSelectorComponent extends Container {
|
|
209
88
|
searchInput;
|
|
210
89
|
listContainer;
|
|
211
90
|
allModels = [];
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { CommandOptions, ReplCommand } from "./types.ts";
|
|
2
|
-
export declare const pasteCommand: ({
|
|
2
|
+
export declare const pasteCommand: ({ modelManager, promptManager, tokenCounter, }: CommandOptions) => ReplCommand;
|
|
3
3
|
//# sourceMappingURL=paste-command.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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"}
|