@travisennis/acai 0.0.12 → 0.0.13
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 +3 -2
- package/dist/agent/index.d.ts.map +1 -1
- package/dist/agent/index.js +2 -5
- package/dist/commands/history/types.d.ts +3 -2
- package/dist/commands/history/types.d.ts.map +1 -1
- package/dist/commands/init-project/utils.d.ts +0 -1
- package/dist/commands/init-project/utils.d.ts.map +1 -1
- package/dist/commands/init-project/utils.js +1 -1
- package/dist/commands/manager.d.ts.map +1 -1
- package/dist/commands/manager.js +0 -18
- package/dist/commands/share/html-renderer.d.ts.map +1 -1
- package/dist/commands/share/html-renderer.js +54 -48
- package/dist/commands/tools/index.js +39 -38
- package/dist/config/index.d.ts +0 -2
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +2 -6
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +94 -76
- package/dist/models/manager.d.ts +1 -10
- package/dist/models/manager.d.ts.map +1 -1
- package/dist/models/manager.js +2 -2
- package/dist/models/opencode-go-provider.d.ts +4 -4
- package/dist/models/opencode-go-provider.d.ts.map +1 -1
- package/dist/models/opencode-go-provider.js +29 -35
- package/dist/models/providers.d.ts +1 -1
- package/dist/models/providers.d.ts.map +1 -1
- package/dist/prompts/system-prompt.d.ts +0 -2
- package/dist/prompts/system-prompt.d.ts.map +1 -1
- package/dist/prompts/system-prompt.js +6 -10
- package/dist/repl/index.d.ts +27 -11
- package/dist/repl/index.d.ts.map +1 -1
- package/dist/repl/index.js +238 -254
- package/dist/skills/index.d.ts +12 -2
- package/dist/skills/index.d.ts.map +1 -1
- package/dist/skills/index.js +123 -73
- package/dist/terminal/control.d.ts +1 -21
- package/dist/terminal/control.d.ts.map +1 -1
- package/dist/terminal/control.js +1 -32
- package/dist/terminal/formatting.d.ts +0 -33
- package/dist/terminal/formatting.d.ts.map +1 -1
- package/dist/terminal/formatting.js +0 -91
- package/dist/terminal/highlight/theme.d.ts +0 -37
- package/dist/terminal/highlight/theme.d.ts.map +1 -1
- package/dist/terminal/highlight/theme.js +1 -79
- package/dist/terminal/keys.d.ts +0 -97
- package/dist/terminal/keys.d.ts.map +1 -1
- package/dist/terminal/keys.js +0 -194
- package/dist/terminal/select-prompt.d.ts.map +1 -1
- package/dist/terminal/select-prompt.js +65 -51
- package/dist/terminal/style.d.ts +1 -1
- package/dist/terminal/style.d.ts.map +1 -1
- package/dist/terminal/supports-color.d.ts.map +1 -1
- package/dist/terminal/supports-color.js +38 -20
- package/dist/terminal/supports-hyperlinks.d.ts +3 -0
- package/dist/terminal/supports-hyperlinks.d.ts.map +1 -1
- package/dist/terminal/supports-hyperlinks.js +72 -31
- package/dist/terminal/table/layout-manager.d.ts +0 -20
- package/dist/terminal/table/layout-manager.d.ts.map +1 -1
- package/dist/terminal/table/layout-manager.js +68 -44
- package/dist/terminal/table/utils.d.ts +0 -1
- package/dist/terminal/table/utils.d.ts.map +1 -1
- package/dist/terminal/table/utils.js +2 -4
- package/dist/tools/apply-patch.d.ts +5 -3
- package/dist/tools/apply-patch.d.ts.map +1 -1
- package/dist/tools/apply-patch.js +154 -123
- package/dist/tools/bash.d.ts.map +1 -1
- package/dist/tools/bash.js +11 -8
- package/dist/tools/dynamic-tool-loader.d.ts +6 -1
- package/dist/tools/dynamic-tool-loader.d.ts.map +1 -1
- package/dist/tools/dynamic-tool-loader.js +154 -135
- package/dist/tools/index.d.ts +3 -133
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +0 -20
- package/dist/tools/read-file.d.ts.map +1 -1
- package/dist/tools/read-file.js +32 -13
- package/dist/tools/skill.d.ts.map +1 -1
- package/dist/tools/skill.js +20 -13
- package/dist/tools/web-fetch.d.ts +2 -6
- package/dist/tools/web-fetch.d.ts.map +1 -1
- package/dist/tools/web-fetch.js +59 -36
- package/dist/tools/web-search.d.ts +0 -4
- package/dist/tools/web-search.d.ts.map +1 -1
- package/dist/tools/web-search.js +40 -32
- package/dist/tui/autocomplete/utils.d.ts +0 -15
- package/dist/tui/autocomplete/utils.d.ts.map +1 -1
- package/dist/tui/autocomplete/utils.js +0 -85
- package/dist/tui/autocomplete.d.ts +1 -1
- package/dist/tui/autocomplete.d.ts.map +1 -1
- package/dist/tui/autocomplete.js +1 -1
- package/dist/tui/components/editor.d.ts +12 -0
- package/dist/tui/components/editor.d.ts.map +1 -1
- package/dist/tui/components/editor.js +181 -195
- package/dist/tui/components/input.d.ts +4 -0
- package/dist/tui/components/input.d.ts.map +1 -1
- package/dist/tui/components/input.js +33 -31
- package/dist/tui/components/markdown.d.ts +30 -0
- package/dist/tui/components/markdown.d.ts.map +1 -1
- package/dist/tui/components/markdown.js +274 -242
- package/dist/tui/components/modal.d.ts.map +1 -1
- package/dist/tui/components/modal.js +11 -11
- package/dist/tui/components/select-list.d.ts +5 -0
- package/dist/tui/components/select-list.d.ts.map +1 -1
- package/dist/tui/components/select-list.js +69 -98
- package/dist/tui/components/table.d.ts +6 -0
- package/dist/tui/components/table.d.ts.map +1 -1
- package/dist/tui/components/table.js +61 -52
- package/dist/tui/index.d.ts +1 -8
- package/dist/tui/index.d.ts.map +1 -1
- package/dist/tui/index.js +0 -8
- package/dist/tui/tui.d.ts +9 -0
- package/dist/tui/tui.d.ts.map +1 -1
- package/dist/tui/tui.js +78 -48
- package/dist/tui/utils.d.ts +7 -0
- package/dist/tui/utils.d.ts.map +1 -1
- package/dist/tui/utils.js +117 -53
- package/dist/utils/bash.d.ts.map +1 -1
- package/dist/utils/bash.js +121 -104
- package/dist/utils/command-protection.d.ts +3 -2
- package/dist/utils/command-protection.d.ts.map +1 -1
- package/dist/utils/command-protection.js +42 -33
- package/dist/utils/filesystem/operations.d.ts +0 -15
- package/dist/utils/filesystem/operations.d.ts.map +1 -1
- package/dist/utils/filesystem/operations.js +1 -38
- package/dist/utils/filesystem/security.d.ts.map +1 -1
- package/dist/utils/filesystem/security.js +22 -15
- package/dist/utils/filetype-detection.d.ts +0 -1
- package/dist/utils/filetype-detection.d.ts.map +1 -1
- package/dist/utils/filetype-detection.js +0 -12
- package/dist/utils/formatting.d.ts +0 -30
- package/dist/utils/formatting.d.ts.map +1 -1
- package/dist/utils/formatting.js +0 -44
- package/dist/utils/git.d.ts +4 -6
- package/dist/utils/git.d.ts.map +1 -1
- package/dist/utils/git.js +36 -46
- package/dist/utils/ignore.d.ts +1 -1
- package/dist/utils/ignore.d.ts.map +1 -1
- package/dist/utils/ignore.js +1 -1
- package/dist/utils/process.d.ts.map +1 -1
- package/dist/utils/process.js +77 -79
- package/dist/utils/yaml.d.ts +0 -1
- package/dist/utils/yaml.d.ts.map +1 -1
- package/dist/utils/yaml.js +80 -89
- package/dist/utils/zod.d.ts +0 -3
- package/dist/utils/zod.d.ts.map +1 -1
- package/dist/utils/zod.js +0 -7
- package/package.json +25 -24
- package/dist/agent/sub-agent.d.ts +0 -23
- package/dist/agent/sub-agent.d.ts.map +0 -1
- package/dist/agent/sub-agent.js +0 -109
- package/dist/commands/add-directory/index.d.ts +0 -3
- package/dist/commands/add-directory/index.d.ts.map +0 -1
- package/dist/commands/add-directory/index.js +0 -50
- package/dist/commands/add-directory/utils.d.ts +0 -3
- package/dist/commands/add-directory/utils.d.ts.map +0 -1
- package/dist/commands/add-directory/utils.js +0 -15
- package/dist/commands/clear/index.d.ts +0 -3
- package/dist/commands/clear/index.d.ts.map +0 -1
- package/dist/commands/clear/index.js +0 -13
- package/dist/commands/generate-rules/index.d.ts +0 -3
- package/dist/commands/generate-rules/index.d.ts.map +0 -1
- package/dist/commands/generate-rules/index.js +0 -206
- package/dist/commands/generate-rules/service.d.ts +0 -22
- package/dist/commands/generate-rules/service.d.ts.map +0 -1
- package/dist/commands/generate-rules/service.js +0 -103
- package/dist/commands/generate-rules/utils.d.ts +0 -5
- package/dist/commands/generate-rules/utils.d.ts.map +0 -1
- package/dist/commands/generate-rules/utils.js +0 -25
- package/dist/commands/handoff/index.d.ts +0 -3
- package/dist/commands/handoff/index.d.ts.map +0 -1
- package/dist/commands/handoff/index.js +0 -97
- package/dist/commands/handoff/utils.d.ts +0 -4
- package/dist/commands/handoff/utils.d.ts.map +0 -1
- package/dist/commands/handoff/utils.js +0 -123
- package/dist/commands/list-directories/index.d.ts +0 -3
- package/dist/commands/list-directories/index.d.ts.map +0 -1
- package/dist/commands/list-directories/index.js +0 -35
- package/dist/commands/pickup/index.d.ts +0 -3
- package/dist/commands/pickup/index.d.ts.map +0 -1
- package/dist/commands/pickup/index.js +0 -141
- package/dist/commands/pickup/types.d.ts +0 -6
- package/dist/commands/pickup/types.d.ts.map +0 -1
- package/dist/commands/pickup/types.js +0 -1
- package/dist/commands/pickup/utils.d.ts +0 -7
- package/dist/commands/pickup/utils.d.ts.map +0 -1
- package/dist/commands/pickup/utils.js +0 -56
- package/dist/commands/remove-directory/index.d.ts +0 -3
- package/dist/commands/remove-directory/index.d.ts.map +0 -1
- package/dist/commands/remove-directory/index.js +0 -55
- package/dist/commands/review/index.d.ts +0 -3
- package/dist/commands/review/index.d.ts.map +0 -1
- package/dist/commands/review/index.js +0 -12
- package/dist/commands/review/review-panel.d.ts +0 -3
- package/dist/commands/review/review-panel.d.ts.map +0 -1
- package/dist/commands/review/review-panel.js +0 -186
- package/dist/commands/review/utils.d.ts +0 -18
- package/dist/commands/review/utils.d.ts.map +0 -1
- package/dist/commands/review/utils.js +0 -146
- package/dist/commands/shell/index.d.ts +0 -3
- package/dist/commands/shell/index.d.ts.map +0 -1
- package/dist/commands/shell/index.js +0 -96
- package/dist/subagents/index.d.ts +0 -16
- package/dist/subagents/index.d.ts.map +0 -1
- package/dist/subagents/index.js +0 -231
- package/dist/terminal/index.d.ts +0 -9
- package/dist/terminal/index.d.ts.map +0 -1
- package/dist/terminal/index.js +0 -8
- package/dist/tools/agent.d.ts +0 -27
- package/dist/tools/agent.d.ts.map +0 -1
- package/dist/tools/agent.js +0 -81
- package/dist/tools/directory-tree.d.ts +0 -28
- package/dist/tools/directory-tree.d.ts.map +0 -1
- package/dist/tools/directory-tree.js +0 -154
- package/dist/tools/glob.d.ts +0 -35
- package/dist/tools/glob.d.ts.map +0 -1
- package/dist/tools/glob.js +0 -167
- package/dist/tools/grep.d.ts +0 -100
- package/dist/tools/grep.d.ts.map +0 -1
- package/dist/tools/grep.js +0 -608
- package/dist/tools/ls.d.ts +0 -26
- package/dist/tools/ls.d.ts.map +0 -1
- package/dist/tools/ls.js +0 -83
- package/dist/tui/components/header.d.ts +0 -21
- package/dist/tui/components/header.d.ts.map +0 -1
- package/dist/tui/components/header.js +0 -63
- package/dist/utils/bash/parse.d.ts +0 -19
- package/dist/utils/bash/parse.d.ts.map +0 -1
- package/dist/utils/bash/parse.js +0 -223
- package/dist/utils/bash/quote.d.ts +0 -6
- package/dist/utils/bash/quote.d.ts.map +0 -1
- package/dist/utils/bash/quote.js +0 -23
- package/dist/utils/generators.d.ts +0 -3
- package/dist/utils/generators.d.ts.map +0 -1
- package/dist/utils/generators.js +0 -25
- package/dist/utils/glob.d.ts +0 -52
- package/dist/utils/glob.d.ts.map +0 -1
- package/dist/utils/glob.js +0 -376
package/dist/utils/yaml.js
CHANGED
|
@@ -1,59 +1,48 @@
|
|
|
1
|
-
|
|
1
|
+
function parseYaml(input) {
|
|
2
2
|
const lines = input.split("\n");
|
|
3
3
|
const result = {};
|
|
4
4
|
let i = 0;
|
|
5
5
|
while (i < lines.length) {
|
|
6
6
|
const line = lines[i];
|
|
7
7
|
const trimmed = line.trim();
|
|
8
|
-
// Skip empty lines and comments
|
|
9
8
|
if (!trimmed || trimmed.startsWith("#")) {
|
|
10
9
|
i++;
|
|
11
10
|
continue;
|
|
12
11
|
}
|
|
13
|
-
// Check for key-value pair
|
|
14
12
|
const colonIndex = line.indexOf(":");
|
|
15
13
|
if (colonIndex === -1) {
|
|
16
14
|
i++;
|
|
17
15
|
continue;
|
|
18
16
|
}
|
|
19
|
-
const indent = getIndent(line);
|
|
20
17
|
const key = line.slice(0, colonIndex).trim();
|
|
21
18
|
const afterColon = line.slice(colonIndex + 1).trim();
|
|
22
19
|
if (afterColon) {
|
|
23
|
-
// Inline value
|
|
24
20
|
result[key] = parseValue(afterColon);
|
|
25
21
|
i++;
|
|
26
22
|
}
|
|
27
23
|
else {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const nextLine = lines[i];
|
|
32
|
-
const nextIndent = getIndent(nextLine);
|
|
33
|
-
const nextTrimmed = nextLine.trim();
|
|
34
|
-
if (nextTrimmed.startsWith("-")) {
|
|
35
|
-
// Array
|
|
36
|
-
const [arr, newIndex] = parseArray(lines, i, nextIndent);
|
|
37
|
-
result[key] = arr;
|
|
38
|
-
i = newIndex;
|
|
39
|
-
}
|
|
40
|
-
else if (nextIndent > indent && nextTrimmed.includes(":")) {
|
|
41
|
-
// Nested object
|
|
42
|
-
const [obj, newIndex] = parseObject(lines, i, nextIndent);
|
|
43
|
-
result[key] = obj;
|
|
44
|
-
i = newIndex;
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
result[key] = null;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
result[key] = null;
|
|
52
|
-
}
|
|
24
|
+
const [value, newIndex] = parseNestedContent(lines, i + 1, getIndent(line));
|
|
25
|
+
result[key] = value;
|
|
26
|
+
i = newIndex;
|
|
53
27
|
}
|
|
54
28
|
}
|
|
55
29
|
return result;
|
|
56
30
|
}
|
|
31
|
+
function parseNestedContent(lines, startIdx, parentIndent) {
|
|
32
|
+
if (startIdx >= lines.length) {
|
|
33
|
+
return [null, startIdx];
|
|
34
|
+
}
|
|
35
|
+
const nextLine = lines[startIdx];
|
|
36
|
+
const nextIndent = getIndent(nextLine);
|
|
37
|
+
const nextTrimmed = nextLine.trim();
|
|
38
|
+
if (nextTrimmed.startsWith("-")) {
|
|
39
|
+
return parseArray(lines, startIdx, nextIndent);
|
|
40
|
+
}
|
|
41
|
+
if (nextIndent > parentIndent && nextTrimmed.includes(":")) {
|
|
42
|
+
return parseObject(lines, startIdx, nextIndent);
|
|
43
|
+
}
|
|
44
|
+
return [null, startIdx];
|
|
45
|
+
}
|
|
57
46
|
function parseObject(lines, start, baseIndent) {
|
|
58
47
|
const obj = {};
|
|
59
48
|
let i = start;
|
|
@@ -68,42 +57,14 @@ function parseObject(lines, start, baseIndent) {
|
|
|
68
57
|
if (indent < baseIndent) {
|
|
69
58
|
break;
|
|
70
59
|
}
|
|
71
|
-
if (indent
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
if (afterColon) {
|
|
80
|
-
obj[key] = parseValue(afterColon);
|
|
81
|
-
i++;
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
i++;
|
|
85
|
-
if (i < lines.length) {
|
|
86
|
-
const nextLine = lines[i];
|
|
87
|
-
const nextIndent = getIndent(nextLine);
|
|
88
|
-
const nextTrimmed = nextLine.trim();
|
|
89
|
-
if (nextTrimmed.startsWith("-")) {
|
|
90
|
-
const [arr, newIndex] = parseArray(lines, i, nextIndent);
|
|
91
|
-
obj[key] = arr;
|
|
92
|
-
i = newIndex;
|
|
93
|
-
}
|
|
94
|
-
else if (nextIndent > indent && nextTrimmed.includes(":")) {
|
|
95
|
-
const [nested, newIndex] = parseObject(lines, i, nextIndent);
|
|
96
|
-
obj[key] = nested;
|
|
97
|
-
i = newIndex;
|
|
98
|
-
}
|
|
99
|
-
else {
|
|
100
|
-
obj[key] = null;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
else {
|
|
104
|
-
obj[key] = null;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
60
|
+
if (indent !== baseIndent) {
|
|
61
|
+
i++;
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
const result = processObjectLine(lines, i, indent);
|
|
65
|
+
if (result !== null) {
|
|
66
|
+
obj[result.key] = result.value;
|
|
67
|
+
i = result.nextIndex;
|
|
107
68
|
}
|
|
108
69
|
else {
|
|
109
70
|
i++;
|
|
@@ -111,6 +72,58 @@ function parseObject(lines, start, baseIndent) {
|
|
|
111
72
|
}
|
|
112
73
|
return [obj, i];
|
|
113
74
|
}
|
|
75
|
+
function processObjectLine(lines, currentIndex, indent) {
|
|
76
|
+
const line = lines[currentIndex];
|
|
77
|
+
const colonIndex = line.indexOf(":");
|
|
78
|
+
if (colonIndex === -1) {
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
const key = line.slice(0, colonIndex).trim();
|
|
82
|
+
const afterColon = line.slice(colonIndex + 1).trim();
|
|
83
|
+
if (afterColon) {
|
|
84
|
+
return { key, value: parseValue(afterColon), nextIndex: currentIndex + 1 };
|
|
85
|
+
}
|
|
86
|
+
// Empty value after colon - look at next line for nested content
|
|
87
|
+
const nextIndex = currentIndex + 1;
|
|
88
|
+
if (nextIndex >= lines.length) {
|
|
89
|
+
return { key, value: null, nextIndex };
|
|
90
|
+
}
|
|
91
|
+
const nextLine = lines[nextIndex];
|
|
92
|
+
const nextIndent = getIndent(nextLine);
|
|
93
|
+
const nextTrimmed = nextLine.trim();
|
|
94
|
+
if (nextTrimmed.startsWith("-")) {
|
|
95
|
+
const [arr, newIndex] = parseArray(lines, nextIndex, nextIndent);
|
|
96
|
+
return { key, value: arr, nextIndex: newIndex };
|
|
97
|
+
}
|
|
98
|
+
if (nextIndent > indent && nextTrimmed.includes(":")) {
|
|
99
|
+
const [nested, newIndex] = parseObject(lines, nextIndex, nextIndent);
|
|
100
|
+
return { key, value: nested, nextIndex: newIndex };
|
|
101
|
+
}
|
|
102
|
+
return { key, value: null, nextIndex };
|
|
103
|
+
}
|
|
104
|
+
function parseArrayItem(lines, currentIndex, arr) {
|
|
105
|
+
const line = lines[currentIndex];
|
|
106
|
+
const trimmed = line.trim();
|
|
107
|
+
const afterDash = trimmed.slice(1).trim();
|
|
108
|
+
if (afterDash) {
|
|
109
|
+
arr.push(parseValue(afterDash));
|
|
110
|
+
return currentIndex + 1;
|
|
111
|
+
}
|
|
112
|
+
// Empty dash - check next line for nested content
|
|
113
|
+
const nextIndex = currentIndex + 1;
|
|
114
|
+
if (nextIndex >= lines.length) {
|
|
115
|
+
return nextIndex;
|
|
116
|
+
}
|
|
117
|
+
const nextLine = lines[nextIndex];
|
|
118
|
+
const nextIndent = getIndent(nextLine);
|
|
119
|
+
const nextTrimmed = nextLine.trim();
|
|
120
|
+
if (nextTrimmed.includes(":")) {
|
|
121
|
+
const [obj, newIndex] = parseObject(lines, nextIndex, nextIndent);
|
|
122
|
+
arr.push(obj);
|
|
123
|
+
return newIndex;
|
|
124
|
+
}
|
|
125
|
+
return nextIndex + 1;
|
|
126
|
+
}
|
|
114
127
|
function parseArray(lines, start, baseIndent) {
|
|
115
128
|
const arr = [];
|
|
116
129
|
let i = start;
|
|
@@ -126,29 +139,7 @@ function parseArray(lines, start, baseIndent) {
|
|
|
126
139
|
break;
|
|
127
140
|
}
|
|
128
141
|
if (indent === baseIndent && trimmed.startsWith("-")) {
|
|
129
|
-
|
|
130
|
-
if (afterDash) {
|
|
131
|
-
// Inline array item
|
|
132
|
-
arr.push(parseValue(afterDash));
|
|
133
|
-
i++;
|
|
134
|
-
}
|
|
135
|
-
else {
|
|
136
|
-
// Check next line for nested content
|
|
137
|
-
i++;
|
|
138
|
-
if (i < lines.length) {
|
|
139
|
-
const nextLine = lines[i];
|
|
140
|
-
const nextIndent = getIndent(nextLine);
|
|
141
|
-
const nextTrimmed = nextLine.trim();
|
|
142
|
-
if (nextTrimmed.includes(":")) {
|
|
143
|
-
const [obj, newIndex] = parseObject(lines, i, nextIndent);
|
|
144
|
-
arr.push(obj);
|
|
145
|
-
i = newIndex;
|
|
146
|
-
}
|
|
147
|
-
else {
|
|
148
|
-
i++;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
142
|
+
i = parseArrayItem(lines, i, arr);
|
|
152
143
|
}
|
|
153
144
|
else {
|
|
154
145
|
i++;
|
package/dist/utils/zod.d.ts
CHANGED
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
import { ZodType } from "zod";
|
|
2
|
-
export declare function isZodSchema(obj: unknown): obj is ZodType<unknown>;
|
|
3
|
-
export declare function zodToJsonSchema(schema: ZodType<unknown>): Record<string, unknown>;
|
|
4
1
|
export declare const convertNullString: (value: unknown) => unknown;
|
|
5
2
|
//# sourceMappingURL=zod.d.ts.map
|
package/dist/utils/zod.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zod.d.ts","sourceRoot":"","sources":["../../source/utils/zod.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"zod.d.ts","sourceRoot":"","sources":["../../source/utils/zod.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB,GAAI,OAAO,OAAO,KAAG,OAgBlD,CAAC"}
|
package/dist/utils/zod.js
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
import z, { ZodType } from "zod";
|
|
2
|
-
export function isZodSchema(obj) {
|
|
3
|
-
return obj instanceof ZodType;
|
|
4
|
-
}
|
|
5
|
-
export function zodToJsonSchema(schema) {
|
|
6
|
-
return z.toJSONSchema(schema);
|
|
7
|
-
}
|
|
8
1
|
// Many models do not reliably pass null to optional tool fields. Instead they pass "null", "None", "undefined", or empty strings.
|
|
9
2
|
// This function will coerce all of those values into null.
|
|
10
3
|
export const convertNullString = (value) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travisennis/acai",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13",
|
|
4
4
|
"description": "An AI assistant for developing software.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -47,9 +47,11 @@
|
|
|
47
47
|
"dev": "node --no-warnings --env-file=.env ./source/index.ts",
|
|
48
48
|
"oxlint": "npm run oxlint:single -- ./source",
|
|
49
49
|
"oxlint:single": "oxlint --type-aware --ignore-path .gitignore -A all -c .oxlintrc.json",
|
|
50
|
-
"knip": "
|
|
51
|
-
"knip:prod": "
|
|
50
|
+
"knip": "knip",
|
|
51
|
+
"knip:prod": "knip --production",
|
|
52
|
+
"fallow": "fallow --format json",
|
|
52
53
|
"setup": "node scripts/setup.ts",
|
|
54
|
+
"bootstrap": "npm run setup",
|
|
53
55
|
"update": "npx npm-check-updates --interactive --format group",
|
|
54
56
|
"cpd": "npx jscpd ./source",
|
|
55
57
|
"typecheck": "tsc --noEmit --pretty -p tsconfig.json",
|
|
@@ -58,24 +60,22 @@
|
|
|
58
60
|
"lint:length": "find source -name '*.ts' | xargs -I{} awk 'END{if(NR>500)print FILENAME\": \"NR\" lines\"}' {}"
|
|
59
61
|
},
|
|
60
62
|
"dependencies": {
|
|
61
|
-
"@ai-sdk/
|
|
62
|
-
"@ai-sdk/
|
|
63
|
-
"@ai-sdk/
|
|
64
|
-
"@ai-sdk/
|
|
65
|
-
"@ai-sdk/
|
|
66
|
-
"@ai-sdk/
|
|
67
|
-
"@ai-sdk/
|
|
68
|
-
"@ai-sdk/openai": "^
|
|
69
|
-
"@ai-sdk/openai-compatible": "^2.0.45",
|
|
63
|
+
"@ai-sdk/anthropic": "^3.0.81",
|
|
64
|
+
"@ai-sdk/deepseek": "^2.0.35",
|
|
65
|
+
"@ai-sdk/devtools": "^0.0.18",
|
|
66
|
+
"@ai-sdk/google": "^3.0.80",
|
|
67
|
+
"@ai-sdk/groq": "^3.0.39",
|
|
68
|
+
"@ai-sdk/open-responses": "^1.0.16",
|
|
69
|
+
"@ai-sdk/openai": "^3.0.67",
|
|
70
|
+
"@ai-sdk/openai-compatible": "^2.0.48",
|
|
70
71
|
"@crosscopy/clipboard": "^0.3.6",
|
|
71
72
|
"@travisennis/stdlib": "^0.0.14",
|
|
72
|
-
"ai": "^6.0.
|
|
73
|
+
"ai": "^6.0.195",
|
|
73
74
|
"cheerio": "^1.2.0",
|
|
74
75
|
"diff": "^9.0.0",
|
|
75
|
-
"fast-glob": "^3.3.3",
|
|
76
76
|
"fdir": "^6.5.0",
|
|
77
77
|
"highlight.js": "^11.11.1",
|
|
78
|
-
"marked": "18.0.
|
|
78
|
+
"marked": "18.0.4",
|
|
79
79
|
"p-throttle": "^8.1.0",
|
|
80
80
|
"parse5": "^8.0.1",
|
|
81
81
|
"parse5-htmlparser2-tree-adapter": "^8.0.1",
|
|
@@ -83,24 +83,25 @@
|
|
|
83
83
|
"pino-pretty": "^13.1.3",
|
|
84
84
|
"pino-roll": "^4.0.0",
|
|
85
85
|
"tiktoken": "^1.0.22",
|
|
86
|
-
"zod": "^4.4.
|
|
86
|
+
"zod": "^4.4.3"
|
|
87
87
|
},
|
|
88
88
|
"devDependencies": {
|
|
89
89
|
"@ai-sdk/provider": "^3.0.10",
|
|
90
|
-
"@
|
|
91
|
-
"@
|
|
92
|
-
"@
|
|
93
|
-
"@types/node": "^25.6.0",
|
|
90
|
+
"@biomejs/biome": "2.4.16",
|
|
91
|
+
"@commitlint/config-conventional": "^21.0.2",
|
|
92
|
+
"@types/node": "^25.9.1",
|
|
94
93
|
"c8": "^11.0.0",
|
|
95
|
-
"commitlint": "^
|
|
94
|
+
"commitlint": "^21.0.2",
|
|
96
95
|
"domhandler": "^6.0.1",
|
|
96
|
+
"fallow": "^2.88.0",
|
|
97
97
|
"husky": "^9.1.7",
|
|
98
|
-
"
|
|
99
|
-
"oxlint
|
|
98
|
+
"knip": "^6.15.0",
|
|
99
|
+
"oxlint": "^1.68.0",
|
|
100
|
+
"oxlint-tsgolint": "^0.23.0",
|
|
100
101
|
"typescript": "^6.0.3"
|
|
101
102
|
},
|
|
102
103
|
"engines": {
|
|
103
|
-
"node": ">=
|
|
104
|
+
"node": ">=24"
|
|
104
105
|
},
|
|
105
106
|
"publishConfig": {
|
|
106
107
|
"access": "public"
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { WorkspaceContext } from "../index.ts";
|
|
2
|
-
import type { ModelName } from "../models/providers.ts";
|
|
3
|
-
export declare class SubAgent {
|
|
4
|
-
workspace: WorkspaceContext;
|
|
5
|
-
constructor(options: {
|
|
6
|
-
workspace: WorkspaceContext;
|
|
7
|
-
});
|
|
8
|
-
execute({ model, system, prompt, abortSignal, allowedTools, timeout, }: {
|
|
9
|
-
model: ModelName;
|
|
10
|
-
system: string;
|
|
11
|
-
prompt: string;
|
|
12
|
-
abortSignal?: AbortSignal;
|
|
13
|
-
allowedTools?: string[];
|
|
14
|
-
timeout?: number;
|
|
15
|
-
}): Promise<string>;
|
|
16
|
-
private prepareExecution;
|
|
17
|
-
private filterTools;
|
|
18
|
-
private createTimeoutSignal;
|
|
19
|
-
private combineAbortSignals;
|
|
20
|
-
private runGenerateText;
|
|
21
|
-
private transformError;
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=sub-agent.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sub-agent.d.ts","sourceRoot":"","sources":["../../source/agent/sub-agent.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAKxD,qBAAa,QAAQ;IACnB,SAAS,EAAE,gBAAgB,CAAC;gBAEhB,OAAO,EAAE;QACnB,SAAS,EAAE,gBAAgB,CAAC;KAC7B;IAIK,OAAO,CAAC,EACZ,KAAK,EACL,MAAM,EACN,MAAM,EACN,WAAW,EACX,YAAY,EACZ,OAAO,GACR,EAAE;QACD,KAAK,EAAE,SAAS,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;QACf,WAAW,CAAC,EAAE,WAAW,CAAC;QAC1B,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;QACxB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB;YAgCa,gBAAgB;IA2B9B,OAAO,CAAC,WAAW;IAiBnB,OAAO,CAAC,mBAAmB;IAkB3B,OAAO,CAAC,mBAAmB;YAmBb,eAAe;IAmC7B,OAAO,CAAC,cAAc;CASvB"}
|
package/dist/agent/sub-agent.js
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { generateText, stepCountIs } from "ai";
|
|
2
|
-
import { config } from "../config/index.js";
|
|
3
|
-
import { AiConfig } from "../models/ai-config.js";
|
|
4
|
-
import { getLanguageModel, getModelMetadata } from "../models/manager.js";
|
|
5
|
-
import { initTools } from "../tools/index.js";
|
|
6
|
-
import { toAiSdkTools } from "../tools/utils.js";
|
|
7
|
-
export class SubAgent {
|
|
8
|
-
workspace;
|
|
9
|
-
constructor(options) {
|
|
10
|
-
this.workspace = options.workspace;
|
|
11
|
-
}
|
|
12
|
-
async execute({ model, system, prompt, abortSignal, allowedTools, timeout, }) {
|
|
13
|
-
try {
|
|
14
|
-
const { tools, abortSignal: combinedSignal, timeoutId, } = await this.prepareExecution({
|
|
15
|
-
allowedTools,
|
|
16
|
-
timeout,
|
|
17
|
-
abortSignal,
|
|
18
|
-
});
|
|
19
|
-
try {
|
|
20
|
-
const result = await this.runGenerateText({
|
|
21
|
-
model,
|
|
22
|
-
system,
|
|
23
|
-
prompt,
|
|
24
|
-
tools,
|
|
25
|
-
abortSignal: combinedSignal,
|
|
26
|
-
});
|
|
27
|
-
return result.text;
|
|
28
|
-
}
|
|
29
|
-
finally {
|
|
30
|
-
if (timeoutId) {
|
|
31
|
-
clearTimeout(timeoutId);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
catch (error) {
|
|
36
|
-
throw this.transformError(error);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
async prepareExecution({ allowedTools, timeout, abortSignal, }) {
|
|
40
|
-
let tools = await initTools({
|
|
41
|
-
workspace: this.workspace,
|
|
42
|
-
});
|
|
43
|
-
tools = this.filterTools(tools, allowedTools);
|
|
44
|
-
const { signal: timeoutSignal, timeoutId } = this.createTimeoutSignal(timeout);
|
|
45
|
-
const combinedSignal = this.combineAbortSignals(timeoutSignal, abortSignal);
|
|
46
|
-
return { tools, abortSignal: combinedSignal, timeoutId };
|
|
47
|
-
}
|
|
48
|
-
filterTools(tools, allowedTools) {
|
|
49
|
-
if (!allowedTools || allowedTools.length === 0) {
|
|
50
|
-
return tools;
|
|
51
|
-
}
|
|
52
|
-
const filteredTools = {};
|
|
53
|
-
for (const [key, value] of Object.entries(tools)) {
|
|
54
|
-
if (allowedTools.includes(key)) {
|
|
55
|
-
filteredTools[key] = value;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
return filteredTools;
|
|
59
|
-
}
|
|
60
|
-
createTimeoutSignal(timeout) {
|
|
61
|
-
if (!timeout || timeout <= 0) {
|
|
62
|
-
return { signal: undefined, timeoutId: undefined };
|
|
63
|
-
}
|
|
64
|
-
const controller = new AbortController();
|
|
65
|
-
const timeoutId = setTimeout(() => {
|
|
66
|
-
controller.abort(new Error(`SubAgent timed out after ${timeout} seconds`));
|
|
67
|
-
}, timeout * 1000);
|
|
68
|
-
return { signal: controller.signal, timeoutId };
|
|
69
|
-
}
|
|
70
|
-
combineAbortSignals(timeoutSignal, abortSignal) {
|
|
71
|
-
const signals = [timeoutSignal, abortSignal].filter((s) => s != null);
|
|
72
|
-
if (signals.length === 0) {
|
|
73
|
-
return undefined;
|
|
74
|
-
}
|
|
75
|
-
if (signals.length === 1) {
|
|
76
|
-
return signals[0];
|
|
77
|
-
}
|
|
78
|
-
return AbortSignal.any(signals);
|
|
79
|
-
}
|
|
80
|
-
async runGenerateText({ model, system, prompt, tools, abortSignal, }) {
|
|
81
|
-
const modelConfig = getModelMetadata({ model });
|
|
82
|
-
const aiConfig = new AiConfig({
|
|
83
|
-
modelMetadata: modelConfig,
|
|
84
|
-
prompt,
|
|
85
|
-
});
|
|
86
|
-
const stateDir = await config.app.ensurePath("audit");
|
|
87
|
-
return generateText({
|
|
88
|
-
model: getLanguageModel({ model, app: "subagent", stateDir }),
|
|
89
|
-
maxOutputTokens: aiConfig.maxOutputTokens(),
|
|
90
|
-
system,
|
|
91
|
-
prompt,
|
|
92
|
-
temperature: aiConfig.temperature(),
|
|
93
|
-
topP: aiConfig.topP(),
|
|
94
|
-
stopWhen: stepCountIs(100),
|
|
95
|
-
providerOptions: aiConfig.providerOptions(),
|
|
96
|
-
tools: toAiSdkTools(tools),
|
|
97
|
-
abortSignal,
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
transformError(error) {
|
|
101
|
-
if (error.name === "AbortError" || error.name === "TimeoutError") {
|
|
102
|
-
if (error.message.includes("timed out")) {
|
|
103
|
-
return new Error(error.message);
|
|
104
|
-
}
|
|
105
|
-
return new Error(`SubAgent execution was aborted: ${error.message}`);
|
|
106
|
-
}
|
|
107
|
-
return error;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/commands/add-directory/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG/D,eAAO,MAAM,mBAAmB,GAAI,gBAEjC,cAAc,KAAG,WAwFnB,CAAC"}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import style from "../../terminal/style.js";
|
|
2
|
-
import { Text } from "../../tui/index.js";
|
|
3
|
-
import { resolveDirectoryPath, validateDirectory } from "./utils.js";
|
|
4
|
-
export const addDirectoryCommand = ({ workspace, }) => {
|
|
5
|
-
return {
|
|
6
|
-
command: "/add-directory",
|
|
7
|
-
description: "Add a directory to the list of allowed working directories",
|
|
8
|
-
getSubCommands: async () => {
|
|
9
|
-
return [];
|
|
10
|
-
},
|
|
11
|
-
async handle(args, { tui, container, editor, }) {
|
|
12
|
-
const directoryPath = args?.[0];
|
|
13
|
-
if (!directoryPath) {
|
|
14
|
-
container.addChild(new Text(style.red("Usage: /add-directory <path>"), 0, 1));
|
|
15
|
-
tui.requestRender();
|
|
16
|
-
editor.setText("");
|
|
17
|
-
return "continue";
|
|
18
|
-
}
|
|
19
|
-
try {
|
|
20
|
-
const resolvedPath = resolveDirectoryPath(directoryPath);
|
|
21
|
-
const isValid = await validateDirectory(resolvedPath);
|
|
22
|
-
if (!isValid) {
|
|
23
|
-
container.addChild(new Text(style.red(`Path is not a directory: ${resolvedPath}`), 1, 0));
|
|
24
|
-
tui.requestRender();
|
|
25
|
-
editor.setText("");
|
|
26
|
-
return "continue";
|
|
27
|
-
}
|
|
28
|
-
if (workspace.allowedDirs.includes(resolvedPath)) {
|
|
29
|
-
container.addChild(new Text(style.yellow(`Directory already in allowed list: ${resolvedPath}`), 1, 0));
|
|
30
|
-
tui.requestRender();
|
|
31
|
-
editor.setText("");
|
|
32
|
-
return "continue";
|
|
33
|
-
}
|
|
34
|
-
workspace.allowedDirs.push(resolvedPath);
|
|
35
|
-
container.addChild(new Text(`Added directory to allowed list: ${style.blue(resolvedPath)}`, 1, 0));
|
|
36
|
-
container.addChild(new Text(`Current allowed directories: ${style.blue(workspace.allowedDirs.join(", "))}`, 2, 0));
|
|
37
|
-
tui.requestRender();
|
|
38
|
-
editor.setText("");
|
|
39
|
-
return "continue";
|
|
40
|
-
}
|
|
41
|
-
catch (error) {
|
|
42
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
43
|
-
container.addChild(new Text(style.red(`Failed to add directory: ${errorMessage}`), 0, 1));
|
|
44
|
-
tui.requestRender();
|
|
45
|
-
editor.setText("");
|
|
46
|
-
return "continue";
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
};
|
|
50
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../source/commands/add-directory/utils.ts"],"names":[],"mappings":"AAGA,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAQzE;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE5D"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import fs from "node:fs/promises";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
export async function validateDirectory(dirPath) {
|
|
4
|
-
try {
|
|
5
|
-
const resolvedPath = path.resolve(dirPath);
|
|
6
|
-
const stats = await fs.stat(resolvedPath);
|
|
7
|
-
return stats.isDirectory();
|
|
8
|
-
}
|
|
9
|
-
catch {
|
|
10
|
-
return false;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
export function resolveDirectoryPath(dirPath) {
|
|
14
|
-
return path.resolve(dirPath);
|
|
15
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/commands/clear/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/D,eAAO,MAAM,YAAY,GAAI,UAAU,cAAc,KAAG,WAmBvD,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export const clearCommand = (_options) => {
|
|
2
|
-
return {
|
|
3
|
-
command: "/clear",
|
|
4
|
-
description: "Clears the terminal screen.",
|
|
5
|
-
getSubCommands: () => Promise.resolve([]),
|
|
6
|
-
async handle(_args, { tui, container, editor, }) {
|
|
7
|
-
container.clear();
|
|
8
|
-
tui.requestRender();
|
|
9
|
-
editor.setText("");
|
|
10
|
-
return "continue";
|
|
11
|
-
},
|
|
12
|
-
};
|
|
13
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/commands/generate-rules/index.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAI/D,eAAO,MAAM,oBAAoB,GAAI,oEAMlC,cAAc,KAAG,WA4HnB,CAAC"}
|