@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,7 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import style from "../terminal/style.js";
|
|
3
3
|
import { Text } from "../tui/index.js";
|
|
4
|
-
export const removeDirectoryCommand = ({
|
|
4
|
+
export const removeDirectoryCommand = ({ workspace, }) => {
|
|
5
5
|
return {
|
|
6
6
|
command: "/remove-directory",
|
|
7
7
|
description: "Remove a directory from the list of allowed working directories",
|
|
@@ -9,38 +9,6 @@ export const removeDirectoryCommand = ({ terminal, workspace, }) => {
|
|
|
9
9
|
// Return only non-primary directories for tab completion
|
|
10
10
|
return workspace.allowedDirs.filter((dir) => dir !== workspace.primaryDir);
|
|
11
11
|
},
|
|
12
|
-
execute: async (args) => {
|
|
13
|
-
const directoryPath = args?.[0];
|
|
14
|
-
if (!directoryPath) {
|
|
15
|
-
terminal.error("Usage: /remove-directory <path>");
|
|
16
|
-
return "continue";
|
|
17
|
-
}
|
|
18
|
-
try {
|
|
19
|
-
// Resolve the directory path
|
|
20
|
-
const resolvedPath = path.resolve(directoryPath);
|
|
21
|
-
// Check if it's the primary directory
|
|
22
|
-
if (resolvedPath === workspace.primaryDir) {
|
|
23
|
-
terminal.error("Cannot remove the primary working directory");
|
|
24
|
-
return "continue";
|
|
25
|
-
}
|
|
26
|
-
// Find the directory in the list
|
|
27
|
-
const index = workspace.allowedDirs.indexOf(resolvedPath);
|
|
28
|
-
if (index === -1) {
|
|
29
|
-
terminal.error(`Directory not found in allowed list: ${resolvedPath}`);
|
|
30
|
-
return "continue";
|
|
31
|
-
}
|
|
32
|
-
// Remove the directory
|
|
33
|
-
workspace.allowedDirs.splice(index, 1);
|
|
34
|
-
terminal.writeln(`Removed directory from allowed list: ${style.blue(resolvedPath)}`);
|
|
35
|
-
terminal.writeln(`Current allowed directories: ${style.blue(workspace.allowedDirs.join(", "))}`);
|
|
36
|
-
return "continue";
|
|
37
|
-
}
|
|
38
|
-
catch (error) {
|
|
39
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
40
|
-
terminal.error(`Failed to remove directory: ${errorMessage}`);
|
|
41
|
-
return "continue";
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
12
|
async handle(args, { tui, container, editor, }) {
|
|
45
13
|
const directoryPath = args?.[0];
|
|
46
14
|
if (!directoryPath) {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { CommandOptions, ReplCommand } from "./types.ts";
|
|
2
|
-
export declare const resetCommand: ({ modelManager,
|
|
2
|
+
export declare const resetCommand: ({ modelManager, messageHistory, }: CommandOptions) => ReplCommand;
|
|
3
3
|
//# sourceMappingURL=reset-command.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reset-command.d.ts","sourceRoot":"","sources":["../../source/commands/reset-command.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"reset-command.d.ts","sourceRoot":"","sources":["../../source/commands/reset-command.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9D,eAAO,MAAM,YAAY,GAAI,mCAG1B,cAAc,KAAG,WA4BnB,CAAC"}
|
|
@@ -1,24 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
import { setTerminalTitle } from "../terminal/formatting.js";
|
|
2
|
+
export const resetCommand = ({ modelManager, messageHistory, }) => {
|
|
2
3
|
return {
|
|
3
4
|
command: "/reset",
|
|
4
5
|
aliases: ["/new"],
|
|
5
6
|
description: "Saves the chat history and then resets it.",
|
|
6
7
|
getSubCommands: () => Promise.resolve([]),
|
|
7
|
-
execute: async () => {
|
|
8
|
-
if (!messageHistory.isEmpty()) {
|
|
9
|
-
await messageHistory.save();
|
|
10
|
-
messageHistory.create(modelManager.getModel("repl").modelId);
|
|
11
|
-
}
|
|
12
|
-
terminal.setTitle(`acai: ${process.cwd()}`);
|
|
13
|
-
terminal.clear();
|
|
14
|
-
return "continue";
|
|
15
|
-
},
|
|
16
8
|
async handle(_args, { tui, container, editor, }) {
|
|
17
9
|
if (!messageHistory.isEmpty()) {
|
|
18
10
|
await messageHistory.save();
|
|
19
11
|
messageHistory.create(modelManager.getModel("repl").modelId);
|
|
20
12
|
}
|
|
21
|
-
|
|
13
|
+
setTerminalTitle(`acai: ${process.cwd()}`);
|
|
22
14
|
container.clear();
|
|
23
15
|
editor.setText("");
|
|
24
16
|
tui.requestRender();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rules-command.d.ts","sourceRoot":"","sources":["../../source/commands/rules-command.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rules-command.d.ts","sourceRoot":"","sources":["../../source/commands/rules-command.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9D,eAAO,MAAM,YAAY,GAAI,UAAU,cAAc,KAAG,WA2HvD,CAAC"}
|
|
@@ -1,73 +1,11 @@
|
|
|
1
1
|
import { config } from "../config.js";
|
|
2
|
-
import { editor } from "../terminal/editor-prompt.js";
|
|
3
2
|
import style from "../terminal/style.js";
|
|
4
3
|
import { Text } from "../tui/index.js";
|
|
5
|
-
export const rulesCommand = (
|
|
4
|
+
export const rulesCommand = (_options) => {
|
|
6
5
|
return {
|
|
7
6
|
command: "/rules",
|
|
8
7
|
description: "View, add, or edit rules. Usage: /rules [view|add <text>|edit]",
|
|
9
8
|
getSubCommands: () => Promise.resolve(["view", "add", "edit"]),
|
|
10
|
-
execute: async (args) => {
|
|
11
|
-
const subCommand = args[0] ?? "view"; // Default to 'view'
|
|
12
|
-
const commandArgs = args.slice(1).join(" ");
|
|
13
|
-
try {
|
|
14
|
-
switch (subCommand) {
|
|
15
|
-
case "view": {
|
|
16
|
-
const currentContent = await config.readAgentsFile();
|
|
17
|
-
if (currentContent) {
|
|
18
|
-
terminal.writeln("--- Current Rules ---");
|
|
19
|
-
terminal.writeln(currentContent);
|
|
20
|
-
terminal.writeln("---------------------");
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
terminal.writeln("No rules defined yet. Use '/rules add' or '/rules edit'.");
|
|
24
|
-
}
|
|
25
|
-
break;
|
|
26
|
-
}
|
|
27
|
-
case "add": {
|
|
28
|
-
const newMemory = commandArgs.trim();
|
|
29
|
-
if (!newMemory) {
|
|
30
|
-
terminal.error("Error: Memory text cannot be empty for 'add'.");
|
|
31
|
-
terminal.writeln("Usage: /memory add <new memory text>");
|
|
32
|
-
return "continue";
|
|
33
|
-
}
|
|
34
|
-
const currentContent = await config.readAgentsFile();
|
|
35
|
-
const updatedContent = currentContent
|
|
36
|
-
? `${currentContent.trim()}\n- ${newMemory}` // Ensure space after dash
|
|
37
|
-
: `- ${newMemory}`; // Start with dash if new file
|
|
38
|
-
await config.writeAgentsFile(updatedContent);
|
|
39
|
-
break;
|
|
40
|
-
}
|
|
41
|
-
case "edit": {
|
|
42
|
-
const currentContent = await config.readAgentsFile();
|
|
43
|
-
const updatedContent = await editor({
|
|
44
|
-
message: "Edit rules:",
|
|
45
|
-
postfix: "md",
|
|
46
|
-
default: currentContent,
|
|
47
|
-
skipPrompt: true,
|
|
48
|
-
});
|
|
49
|
-
// Check if the user cancelled the edit (editor returns the original content)
|
|
50
|
-
// Or if the content is actually different
|
|
51
|
-
if (updatedContent !== currentContent) {
|
|
52
|
-
await config.writeAgentsFile(updatedContent);
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
terminal.writeln("Edit cancelled or no changes made.");
|
|
56
|
-
}
|
|
57
|
-
break;
|
|
58
|
-
}
|
|
59
|
-
default:
|
|
60
|
-
terminal.writeln("Invalid subcommand. Usage: /rules [view|add <text>|edit]");
|
|
61
|
-
break;
|
|
62
|
-
}
|
|
63
|
-
return "continue";
|
|
64
|
-
}
|
|
65
|
-
catch (_error) {
|
|
66
|
-
// Errors from read/write helpers are already logged
|
|
67
|
-
terminal.error("Failed to execute memory command.");
|
|
68
|
-
return "continue";
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
9
|
async handle(args, { tui, container, editor, }) {
|
|
72
10
|
const subCommand = args[0] ?? "view"; // Default to 'view'
|
|
73
11
|
const commandArgs = args.slice(1).join(" ");
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { CommandOptions, ReplCommand } from "./types.ts";
|
|
2
|
-
export declare const saveCommand: ({ messageHistory,
|
|
2
|
+
export declare const saveCommand: ({ messageHistory, }: CommandOptions) => ReplCommand;
|
|
3
3
|
//# sourceMappingURL=save-command.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"save-command.d.ts","sourceRoot":"","sources":["../../source/commands/save-command.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9D,eAAO,MAAM,WAAW,GAAI
|
|
1
|
+
{"version":3,"file":"save-command.d.ts","sourceRoot":"","sources":["../../source/commands/save-command.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9D,eAAO,MAAM,WAAW,GAAI,qBAEzB,cAAc,KAAG,WAyBnB,CAAC"}
|
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
import style from "../terminal/style.js";
|
|
2
2
|
import { Spacer, Text } from "../tui/index.js";
|
|
3
|
-
export const saveCommand = ({ messageHistory,
|
|
3
|
+
export const saveCommand = ({ 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();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell-command.d.ts","sourceRoot":"","sources":["../../source/commands/shell-command.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"shell-command.d.ts","sourceRoot":"","sources":["../../source/commands/shell-command.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAK9D,eAAO,MAAM,YAAY,GAAI,SAAS,cAAc,KAAG,WAqHtD,CAAC"}
|
|
@@ -1,62 +1,15 @@
|
|
|
1
1
|
import { initExecutionEnvironment } from "../execution/index.js";
|
|
2
|
-
import { input } from "../terminal/input-prompt.js";
|
|
3
2
|
import style from "../terminal/style.js";
|
|
4
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
|
@@ -3,7 +3,6 @@ import type { WorkspaceContext } from "../index.ts";
|
|
|
3
3
|
import type { MessageHistory } from "../messages.ts";
|
|
4
4
|
import type { ModelManager } from "../models/manager.ts";
|
|
5
5
|
import type { PromptManagerApi } from "../prompts/manager.ts";
|
|
6
|
-
import type { Terminal } from "../terminal/index.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,7 +21,6 @@ export interface ReplCommand {
|
|
|
23
21
|
export interface CommandOptions {
|
|
24
22
|
promptManager: PromptManagerApi;
|
|
25
23
|
modelManager: ModelManager;
|
|
26
|
-
terminal: Terminal;
|
|
27
24
|
messageHistory: MessageHistory;
|
|
28
25
|
tokenTracker: TokenTracker;
|
|
29
26
|
config: ConfigManager;
|
|
@@ -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,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,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,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,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"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { CommandOptions, ReplCommand } from "./types.ts";
|
|
2
|
-
export declare function usageCommand({
|
|
2
|
+
export declare function usageCommand({ tokenTracker }: CommandOptions): ReplCommand;
|
|
3
3
|
//# sourceMappingURL=usage-command.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usage-command.d.ts","sourceRoot":"","sources":["../../source/commands/usage-command.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9D,wBAAgB,YAAY,CAAC,
|
|
1
|
+
{"version":3,"file":"usage-command.d.ts","sourceRoot":"","sources":["../../source/commands/usage-command.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9D,wBAAgB,YAAY,CAAC,EAAE,YAAY,EAAE,EAAE,cAAc,GAAG,WAAW,CAsC1E"}
|
|
@@ -1,22 +1,9 @@
|
|
|
1
|
-
import { Modal, Container as ModalContainer,
|
|
2
|
-
export function usageCommand({
|
|
1
|
+
import { Modal, Container as ModalContainer, ModalText, TableComponent, } from "../tui/index.js";
|
|
2
|
+
export function usageCommand({ tokenTracker }) {
|
|
3
3
|
return {
|
|
4
4
|
command: "/usage",
|
|
5
5
|
description: "Show token usage breakdown",
|
|
6
6
|
getSubCommands: () => Promise.resolve([]),
|
|
7
|
-
async execute() {
|
|
8
|
-
const entries = Object.entries(tokenTracker.getUsageBreakdown());
|
|
9
|
-
if (entries.length === 0) {
|
|
10
|
-
terminal.info("No usage yet.");
|
|
11
|
-
}
|
|
12
|
-
else {
|
|
13
|
-
terminal.table(entries, {
|
|
14
|
-
header: ["App", "Tokens"],
|
|
15
|
-
colWidths: [30, 70],
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
return "continue";
|
|
19
|
-
},
|
|
20
7
|
async handle(_args, { tui, editor }) {
|
|
21
8
|
const entries = Object.entries(tokenTracker.getUsageBreakdown());
|
|
22
9
|
// Build modal content
|
|
@@ -27,7 +14,9 @@ export function usageCommand({ terminal, tokenTracker, }) {
|
|
|
27
14
|
else {
|
|
28
15
|
// Convert entries to table format
|
|
29
16
|
const tableData = entries.map(([app, tokens]) => [app, String(tokens)]);
|
|
30
|
-
modalContent.addChild(new
|
|
17
|
+
modalContent.addChild(new TableComponent(tableData, {
|
|
18
|
+
headers: ["App", "Tokens"],
|
|
19
|
+
}));
|
|
31
20
|
}
|
|
32
21
|
// Create and show modal
|
|
33
22
|
const modal = new Modal("Token Usage", modalContent, true, () => {
|
package/dist/config.d.ts
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
declare const ProjectConfigSchema: z.ZodObject<{
|
|
3
|
+
systemPromptType: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
4
|
+
full: "full";
|
|
5
|
+
minimal: "minimal";
|
|
6
|
+
cli: "cli";
|
|
7
|
+
}>>>;
|
|
3
8
|
logs: z.ZodOptional<z.ZodObject<{
|
|
4
9
|
path: z.ZodString;
|
|
5
10
|
}, z.core.$strip>>;
|
|
6
11
|
loop: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
7
12
|
maxIterations: z.ZodDefault<z.ZodNumber>;
|
|
8
|
-
parallelTools: z.ZodDefault<z.ZodBoolean>;
|
|
9
|
-
maxDurationMs: z.ZodDefault<z.ZodNumber>;
|
|
10
13
|
}, z.core.$strip>>>;
|
|
11
14
|
tools: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
15
|
+
activeTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
12
16
|
maxTokens: z.ZodDefault<z.ZodNumber>;
|
|
13
17
|
maxResults: z.ZodDefault<z.ZodNumber>;
|
|
14
18
|
dynamicTools: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
@@ -17,8 +21,12 @@ declare const ProjectConfigSchema: z.ZodObject<{
|
|
|
17
21
|
}, z.core.$strip>>>;
|
|
18
22
|
}, z.core.$strip>>>;
|
|
19
23
|
notify: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
24
|
+
readOnlyFiles: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
25
|
+
skills: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
26
|
+
enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
27
|
+
}, z.core.$strip>>>;
|
|
20
28
|
}, z.core.$strip>;
|
|
21
|
-
type ProjectConfig = z.infer<typeof ProjectConfigSchema>;
|
|
29
|
+
export type ProjectConfig = z.infer<typeof ProjectConfigSchema>;
|
|
22
30
|
export declare class DirectoryProvider {
|
|
23
31
|
private baseDir;
|
|
24
32
|
constructor(baseDir: string);
|
|
@@ -30,16 +38,19 @@ export declare class ConfigManager {
|
|
|
30
38
|
readonly project: DirectoryProvider;
|
|
31
39
|
readonly app: DirectoryProvider;
|
|
32
40
|
constructor();
|
|
41
|
+
getAccessibleLogDir(): string;
|
|
33
42
|
private _readConfig;
|
|
34
|
-
|
|
43
|
+
getConfig(): Promise<ProjectConfig>;
|
|
44
|
+
getSkillsEnabled(): Promise<boolean>;
|
|
45
|
+
setSkillsEnabled(enabled: boolean): Promise<void>;
|
|
35
46
|
readAgentsFile(): Promise<string>;
|
|
36
47
|
writeAgentsFile(rules: string): Promise<void>;
|
|
37
48
|
readProjectLearnedRulesFile(): Promise<string>;
|
|
38
49
|
writeProjectLearnedRulesFile(rules: string): Promise<void>;
|
|
39
50
|
readCachedLearnedRulesFile(): Promise<string>;
|
|
40
51
|
writeCachedLearnedRulesFile(rules: string): Promise<void>;
|
|
41
|
-
|
|
42
|
-
|
|
52
|
+
private _readAppConfig;
|
|
53
|
+
ensureDefaultConfig(configName: string): Promise<ProjectConfig>;
|
|
43
54
|
writeAppConfig(configName: string, data: Record<PropertyKey, unknown>): Promise<void>;
|
|
44
55
|
}
|
|
45
56
|
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;AAyBxB,QAAA,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;iBA8CvB,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;CAKxC;AAED,qBAAa,aAAa;IACxB,QAAQ,CAAC,OAAO,EAAE,iBAAiB,CAAC;IACpC,QAAQ,CAAC,GAAG,EAAE,iBAAiB,CAAC;;IAQhC,mBAAmB,IAAI,MAAM;YAIf,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,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC;IAYjC,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;IAc1D,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"}
|
package/dist/config.js
CHANGED
|
@@ -4,8 +4,32 @@ import { homedir } from "node:os";
|
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
import { jsonParser } from "./parsing.js";
|
|
7
|
+
const defaultConfig = {
|
|
8
|
+
systemPromptType: "full",
|
|
9
|
+
loop: {
|
|
10
|
+
maxIterations: 200,
|
|
11
|
+
},
|
|
12
|
+
tools: {
|
|
13
|
+
activeTools: undefined,
|
|
14
|
+
maxTokens: 30000,
|
|
15
|
+
maxResults: 30,
|
|
16
|
+
dynamicTools: {
|
|
17
|
+
enabled: true,
|
|
18
|
+
maxTools: 10,
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
notify: true,
|
|
22
|
+
readOnlyFiles: [],
|
|
23
|
+
skills: {
|
|
24
|
+
enabled: true,
|
|
25
|
+
},
|
|
26
|
+
};
|
|
7
27
|
// Type definitions
|
|
8
28
|
const ProjectConfigSchema = z.object({
|
|
29
|
+
systemPromptType: z
|
|
30
|
+
.enum(["full", "minimal", "cli"])
|
|
31
|
+
.optional()
|
|
32
|
+
.default(defaultConfig.systemPromptType),
|
|
9
33
|
logs: z
|
|
10
34
|
.object({
|
|
11
35
|
path: z.string(),
|
|
@@ -13,41 +37,40 @@ const ProjectConfigSchema = z.object({
|
|
|
13
37
|
.optional(),
|
|
14
38
|
loop: z
|
|
15
39
|
.object({
|
|
16
|
-
maxIterations: z.number().default(
|
|
17
|
-
parallelTools: z.boolean().default(true),
|
|
18
|
-
maxDurationMs: z.number().default(0),
|
|
40
|
+
maxIterations: z.number().default(defaultConfig.loop.maxIterations),
|
|
19
41
|
})
|
|
20
42
|
.optional()
|
|
21
|
-
.default(
|
|
22
|
-
maxIterations: 90,
|
|
23
|
-
parallelTools: true,
|
|
24
|
-
maxDurationMs: 0,
|
|
25
|
-
}),
|
|
43
|
+
.default(defaultConfig.loop),
|
|
26
44
|
tools: z
|
|
27
45
|
.object({
|
|
28
|
-
|
|
29
|
-
|
|
46
|
+
activeTools: z.array(z.string()).optional(),
|
|
47
|
+
maxTokens: z.number().default(defaultConfig.tools.maxTokens),
|
|
48
|
+
maxResults: z.number().default(defaultConfig.tools.maxResults),
|
|
30
49
|
dynamicTools: z
|
|
31
50
|
.object({
|
|
32
|
-
enabled: z
|
|
33
|
-
|
|
51
|
+
enabled: z
|
|
52
|
+
.boolean()
|
|
53
|
+
.default(defaultConfig.tools.dynamicTools.enabled),
|
|
54
|
+
maxTools: z
|
|
55
|
+
.number()
|
|
56
|
+
.default(defaultConfig.tools.dynamicTools.maxTools),
|
|
34
57
|
})
|
|
35
58
|
.optional()
|
|
36
|
-
.default(
|
|
37
|
-
enabled: true,
|
|
38
|
-
maxTools: 10,
|
|
39
|
-
}),
|
|
59
|
+
.default(defaultConfig.tools.dynamicTools),
|
|
40
60
|
})
|
|
41
61
|
.optional()
|
|
42
|
-
.default(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
62
|
+
.default(defaultConfig.tools),
|
|
63
|
+
notify: z.boolean().optional().default(defaultConfig.notify),
|
|
64
|
+
readOnlyFiles: z
|
|
65
|
+
.array(z.string())
|
|
66
|
+
.optional()
|
|
67
|
+
.default(defaultConfig.readOnlyFiles),
|
|
68
|
+
skills: z
|
|
69
|
+
.object({
|
|
70
|
+
enabled: z.boolean().optional().default(defaultConfig.skills.enabled),
|
|
71
|
+
})
|
|
72
|
+
.optional()
|
|
73
|
+
.default(defaultConfig.skills),
|
|
51
74
|
});
|
|
52
75
|
export class DirectoryProvider {
|
|
53
76
|
baseDir;
|
|
@@ -77,6 +100,10 @@ export class ConfigManager {
|
|
|
77
100
|
this.project = new DirectoryProvider(path.join(process.cwd(), ".acai"));
|
|
78
101
|
this.app = new DirectoryProvider(path.join(homedir(), ".acai"));
|
|
79
102
|
}
|
|
103
|
+
// Get the log directory that's accessible via bash tool
|
|
104
|
+
getAccessibleLogDir() {
|
|
105
|
+
return this.app.getPath("logs");
|
|
106
|
+
}
|
|
80
107
|
async _readConfig(configPath) {
|
|
81
108
|
try {
|
|
82
109
|
const data = await fs.readFile(configPath, "utf8");
|
|
@@ -89,8 +116,8 @@ export class ConfigManager {
|
|
|
89
116
|
throw error;
|
|
90
117
|
}
|
|
91
118
|
}
|
|
92
|
-
//
|
|
93
|
-
async
|
|
119
|
+
// Get merged configuration (project overrides app)
|
|
120
|
+
async getConfig() {
|
|
94
121
|
const appConfigPath = path.join(this.app.getPath(), "acai.json");
|
|
95
122
|
const projectConfigPath = path.join(this.project.getPath(), "acai.json");
|
|
96
123
|
const appConfig = await this._readConfig(appConfigPath);
|
|
@@ -101,6 +128,30 @@ export class ConfigManager {
|
|
|
101
128
|
};
|
|
102
129
|
return ProjectConfigSchema.parse(mergedConfig);
|
|
103
130
|
}
|
|
131
|
+
// Skills settings helpers
|
|
132
|
+
async getSkillsEnabled() {
|
|
133
|
+
const projectConfig = await this.getConfig();
|
|
134
|
+
return projectConfig.skills?.enabled ?? true;
|
|
135
|
+
}
|
|
136
|
+
async setSkillsEnabled(enabled) {
|
|
137
|
+
const configPath = path.join(this.app.getPath(), "acai.json");
|
|
138
|
+
let configData = {};
|
|
139
|
+
try {
|
|
140
|
+
const data = await fs.readFile(configPath, "utf8");
|
|
141
|
+
configData = jsonParser(ProjectConfigSchema.partial()).parse(data);
|
|
142
|
+
}
|
|
143
|
+
catch (error) {
|
|
144
|
+
if (error.code !== "ENOENT") {
|
|
145
|
+
throw error;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
if (!configData.skills) {
|
|
149
|
+
configData.skills = { enabled: true };
|
|
150
|
+
}
|
|
151
|
+
configData.skills.enabled = enabled;
|
|
152
|
+
await this.app.ensurePath();
|
|
153
|
+
await fs.writeFile(configPath, JSON.stringify(configData, null, 2));
|
|
154
|
+
}
|
|
104
155
|
async readAgentsFile() {
|
|
105
156
|
const agentsPath = path.join(process.cwd(), "AGENTS.md");
|
|
106
157
|
try {
|
|
@@ -177,50 +228,32 @@ export class ConfigManager {
|
|
|
177
228
|
throw error;
|
|
178
229
|
}
|
|
179
230
|
}
|
|
180
|
-
//
|
|
181
|
-
async
|
|
231
|
+
// Private helper for reading app config
|
|
232
|
+
async _readAppConfig(configName) {
|
|
182
233
|
const configPath = path.join(this.app.getPath(), `${configName}.json`);
|
|
183
234
|
try {
|
|
184
235
|
const data = await fs.readFile(configPath, "utf8");
|
|
185
|
-
return JSON.parse(data);
|
|
236
|
+
return ProjectConfigSchema.parse(JSON.parse(data));
|
|
186
237
|
}
|
|
187
238
|
catch (error) {
|
|
188
239
|
if (error.code === "ENOENT") {
|
|
189
|
-
return
|
|
240
|
+
return ProjectConfigSchema.parse(defaultConfig);
|
|
190
241
|
}
|
|
191
242
|
throw error;
|
|
192
243
|
}
|
|
193
244
|
}
|
|
194
|
-
|
|
245
|
+
// Ensure default app configuration exists
|
|
246
|
+
async ensureDefaultConfig(configName) {
|
|
195
247
|
const configPath = path.join(this.app.getPath(), `${configName}.json`);
|
|
196
248
|
try {
|
|
197
249
|
await fs.access(configPath);
|
|
198
|
-
return await this.
|
|
250
|
+
return await this._readAppConfig(configName);
|
|
199
251
|
}
|
|
200
252
|
catch {
|
|
201
253
|
// Create directory and default config if missing
|
|
202
254
|
await this.app.ensurePath();
|
|
203
|
-
const defaultConfig = {
|
|
204
|
-
logs: {
|
|
205
|
-
path: path.join(this.app.getPath(), "logs", "current.log"),
|
|
206
|
-
},
|
|
207
|
-
loop: {
|
|
208
|
-
maxIterations: 90,
|
|
209
|
-
parallelTools: true,
|
|
210
|
-
maxDurationMs: 0,
|
|
211
|
-
},
|
|
212
|
-
tools: {
|
|
213
|
-
maxTokens: 30000,
|
|
214
|
-
maxResults: 30,
|
|
215
|
-
dynamicTools: {
|
|
216
|
-
enabled: true,
|
|
217
|
-
maxTools: 10,
|
|
218
|
-
},
|
|
219
|
-
},
|
|
220
|
-
notify: true,
|
|
221
|
-
};
|
|
222
255
|
await fs.writeFile(configPath, JSON.stringify(defaultConfig, null, 2));
|
|
223
|
-
return defaultConfig;
|
|
256
|
+
return ProjectConfigSchema.parse(defaultConfig);
|
|
224
257
|
}
|
|
225
258
|
}
|
|
226
259
|
async writeAppConfig(configName, data) {
|