@travisennis/acai 0.0.10 → 0.0.11

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.
Files changed (112) hide show
  1. package/README.md +5 -1
  2. package/dist/agent/index.d.ts.map +1 -1
  3. package/dist/agent/index.js +29 -27
  4. package/dist/cli/stdin.d.ts +2 -1
  5. package/dist/cli/stdin.d.ts.map +1 -1
  6. package/dist/commands/generate-rules/service.d.ts +3 -2
  7. package/dist/commands/generate-rules/service.d.ts.map +1 -1
  8. package/dist/commands/health/utils.d.ts +3 -2
  9. package/dist/commands/health/utils.d.ts.map +1 -1
  10. package/dist/commands/init-project/utils.d.ts +2 -1
  11. package/dist/commands/init-project/utils.d.ts.map +1 -1
  12. package/dist/commands/review/utils.d.ts +6 -1
  13. package/dist/commands/review/utils.d.ts.map +1 -1
  14. package/dist/index.js +1 -1
  15. package/dist/models/opencode-go-provider.d.ts +25 -0
  16. package/dist/models/opencode-go-provider.d.ts.map +1 -0
  17. package/dist/models/opencode-go-provider.js +78 -0
  18. package/dist/models/opencode-zen-provider.d.ts +3 -3
  19. package/dist/models/opencode-zen-provider.js +17 -17
  20. package/dist/models/openrouter-provider.d.ts +4 -1
  21. package/dist/models/openrouter-provider.d.ts.map +1 -1
  22. package/dist/models/openrouter-provider.js +39 -0
  23. package/dist/models/providers.d.ts +3 -3
  24. package/dist/models/providers.d.ts.map +1 -1
  25. package/dist/models/providers.js +6 -0
  26. package/dist/modes/manager.d.ts +2 -1
  27. package/dist/modes/manager.d.ts.map +1 -1
  28. package/dist/modes/prompts.d.ts +1 -1
  29. package/dist/modes/prompts.d.ts.map +1 -1
  30. package/dist/modes/prompts.js +1 -2
  31. package/dist/prompts/mentions.d.ts.map +1 -1
  32. package/dist/prompts/mentions.js +35 -6
  33. package/dist/repl/index.d.ts.map +1 -1
  34. package/dist/repl/index.js +9 -1
  35. package/dist/sessions/manager.d.ts +3 -3
  36. package/dist/sessions/manager.d.ts.map +1 -1
  37. package/dist/sessions/manager.js +1 -1
  38. package/dist/skills/index.d.ts +2 -1
  39. package/dist/skills/index.d.ts.map +1 -1
  40. package/dist/subagents/index.d.ts +2 -1
  41. package/dist/subagents/index.d.ts.map +1 -1
  42. package/dist/terminal/table/utils.d.ts +1 -1
  43. package/dist/terminal/table/utils.d.ts.map +1 -1
  44. package/dist/terminal/wrap-ansi.js +2 -2
  45. package/dist/tools/agent.js +1 -1
  46. package/dist/tools/apply-patch.d.ts +62 -0
  47. package/dist/tools/apply-patch.d.ts.map +1 -0
  48. package/dist/tools/apply-patch.js +377 -0
  49. package/dist/tools/bash.d.ts.map +1 -1
  50. package/dist/tools/bash.js +28 -7
  51. package/dist/tools/directory-tree.d.ts.map +1 -1
  52. package/dist/tools/directory-tree.js +1 -1
  53. package/dist/tools/dynamic-tool-loader.d.ts +1 -1
  54. package/dist/tools/dynamic-tool-loader.d.ts.map +1 -1
  55. package/dist/tools/edit-file.d.ts.map +1 -1
  56. package/dist/tools/edit-file.js +188 -79
  57. package/dist/tools/glob.d.ts.map +1 -1
  58. package/dist/tools/glob.js +22 -15
  59. package/dist/tools/grep.d.ts.map +1 -1
  60. package/dist/tools/grep.js +43 -29
  61. package/dist/tools/index.d.ts +15 -48
  62. package/dist/tools/index.d.ts.map +1 -1
  63. package/dist/tools/index.js +4 -4
  64. package/dist/tools/ls.d.ts.map +1 -1
  65. package/dist/tools/ls.js +1 -1
  66. package/dist/tools/read-file.d.ts +1 -3
  67. package/dist/tools/read-file.d.ts.map +1 -1
  68. package/dist/tools/read-file.js +21 -16
  69. package/dist/tools/save-file.d.ts.map +1 -1
  70. package/dist/tools/save-file.js +26 -21
  71. package/dist/tools/web-fetch.d.ts +0 -12
  72. package/dist/tools/web-fetch.d.ts.map +1 -1
  73. package/dist/tools/web-fetch.js +18 -1
  74. package/dist/tools/web-search.d.ts +0 -18
  75. package/dist/tools/web-search.d.ts.map +1 -1
  76. package/dist/tui/autocomplete/file-search-provider.js +1 -1
  77. package/dist/tui/autocomplete/utils.d.ts +2 -1
  78. package/dist/tui/autocomplete/utils.d.ts.map +1 -1
  79. package/dist/tui/autocomplete/utils.js +25 -23
  80. package/dist/tui/components/editor.d.ts +2 -1
  81. package/dist/tui/components/editor.d.ts.map +1 -1
  82. package/dist/tui/components/editor.js +1 -1
  83. package/dist/tui/components/markdown.d.ts +2 -2
  84. package/dist/tui/components/markdown.d.ts.map +1 -1
  85. package/dist/tui/components/welcome.d.ts +2 -1
  86. package/dist/tui/components/welcome.d.ts.map +1 -1
  87. package/dist/tui/editor-launcher.d.ts +3 -2
  88. package/dist/tui/editor-launcher.d.ts.map +1 -1
  89. package/dist/tui/index.d.ts +0 -1
  90. package/dist/tui/index.d.ts.map +1 -1
  91. package/dist/tui/tui.d.ts +1 -0
  92. package/dist/tui/tui.d.ts.map +1 -1
  93. package/dist/tui/tui.js +9 -0
  94. package/dist/tui/utils.d.ts +1 -5
  95. package/dist/tui/utils.d.ts.map +1 -1
  96. package/dist/tui/utils.js +271 -44
  97. package/package.json +18 -18
  98. package/dist/commands/add-directory/types.d.ts +0 -6
  99. package/dist/commands/add-directory/types.d.ts.map +0 -1
  100. package/dist/commands/add-directory/types.js +0 -1
  101. package/dist/commands/copy/types.d.ts +0 -3
  102. package/dist/commands/copy/types.d.ts.map +0 -1
  103. package/dist/commands/copy/types.js +0 -1
  104. package/dist/commands/review/types.d.ts +0 -12
  105. package/dist/commands/review/types.d.ts.map +0 -1
  106. package/dist/commands/review/types.js +0 -1
  107. package/dist/tools/code-search.d.ts +0 -41
  108. package/dist/tools/code-search.d.ts.map +0 -1
  109. package/dist/tools/code-search.js +0 -195
  110. package/dist/utils/iterables.d.ts +0 -2
  111. package/dist/utils/iterables.d.ts.map +0 -1
  112. package/dist/utils/iterables.js +0 -6
@@ -1,195 +0,0 @@
1
- import { execSync } from "node:child_process";
2
- import { inspect } from "node:util";
3
- import { z } from "zod";
4
- import style from "../terminal/style.js";
5
- import { toDisplayPath } from "../utils/filesystem/path-display.js";
6
- import { convertNullString } from "../utils/zod.js";
7
- // default limit
8
- const DEFAULT_MAX_RESULTS = 15;
9
- const DEFAULT_CONTEXT_LINES = 6;
10
- export const CodeSearchTool = {
11
- name: "CodeSearch",
12
- };
13
- const inputSchema = z.object({
14
- query: z.string().describe("Natural language query for semantic search"),
15
- path: z.string().describe("Path to search in").default("."),
16
- regexPattern: z
17
- .preprocess((val) => convertNullString(val), z.string().nullable())
18
- .describe("Regex pre-filter (-e flag)"),
19
- filePattern: z
20
- .preprocess((val) => convertNullString(val), z.string().nullable())
21
- .describe("File filter (--include flag)"),
22
- excludePattern: z
23
- .preprocess((val) => convertNullString(val), z.string().nullable())
24
- .describe("Exclude pattern (--exclude flag)"),
25
- excludeDir: z
26
- .preprocess((val) => convertNullString(val), z.string().nullable())
27
- .describe("Exclude directories (--exclude-dir flag)"),
28
- maxResults: z
29
- .preprocess((val) => convertNullString(val), z.coerce.number().nullable())
30
- .describe("Number of results (-k flag)"),
31
- contextLines: z
32
- .preprocess((val) => convertNullString(val), z.coerce.number().nullable())
33
- .describe("Context lines (-n flag)"),
34
- filesOnly: z
35
- .preprocess((val) => convertNullString(val), z.coerce.boolean().nullable())
36
- .describe("List only files (-l flag)"),
37
- showContent: z
38
- .preprocess((val) => convertNullString(val), z.coerce.boolean().nullable())
39
- .describe("Show full content (-c flag)"),
40
- codeOnly: z
41
- .preprocess((val) => convertNullString(val), z.coerce.boolean().nullable())
42
- .describe("Skip config/text files (--code-only flag)"),
43
- });
44
- /**
45
- * Converts string "null"/"undefined" back to actual null.
46
- * Zod preprocess converts null to "null" string, this reverses that.
47
- */
48
- function normalizeNullableString(value) {
49
- if (value === "null" || value === "undefined") {
50
- return null;
51
- }
52
- return value;
53
- }
54
- /**
55
- * Builds colgrep command arguments from search options
56
- */
57
- function buildColgrepArgs(options) {
58
- const effectivePath = options.path !== "." ? options.path : ".";
59
- const effectiveMaxResults = options.maxResults ?? DEFAULT_MAX_RESULTS;
60
- const effectiveContextLines = options.contextLines ?? DEFAULT_CONTEXT_LINES;
61
- const safeRegexPattern = normalizeNullableString(options.regexPattern);
62
- const safeFilePattern = normalizeNullableString(options.filePattern);
63
- const safeExcludePattern = normalizeNullableString(options.excludePattern);
64
- const safeExcludeDir = normalizeNullableString(options.excludeDir);
65
- const quotedQuery = JSON.stringify(options.query);
66
- const args = [quotedQuery];
67
- if (effectivePath !== ".") {
68
- args.push(effectivePath);
69
- }
70
- if (safeRegexPattern) {
71
- args.push("-e", safeRegexPattern);
72
- }
73
- if (safeFilePattern) {
74
- args.push("--include", safeFilePattern);
75
- }
76
- if (safeExcludePattern) {
77
- args.push("--exclude", safeExcludePattern);
78
- }
79
- if (safeExcludeDir) {
80
- args.push("--exclude-dir", safeExcludeDir);
81
- }
82
- if (effectiveMaxResults !== DEFAULT_MAX_RESULTS) {
83
- args.push("-k", String(effectiveMaxResults));
84
- }
85
- if (effectiveContextLines !== DEFAULT_CONTEXT_LINES) {
86
- args.push("-n", String(effectiveContextLines));
87
- }
88
- if (options.filesOnly) {
89
- args.push("-l");
90
- }
91
- if (options.showContent) {
92
- args.push("-c");
93
- }
94
- if (options.codeOnly) {
95
- args.push("--code-only");
96
- }
97
- return args;
98
- }
99
- /**
100
- * Converts execSync error to user-friendly message
101
- */
102
- function handleColgrepError(error, query, path) {
103
- const errorMessage = error.message;
104
- // Check if colgrep is not installed
105
- if (errorMessage.includes("ENOENT") || errorMessage.includes("not found")) {
106
- throw new Error("colgrep is not installed. Please install it from https://github.com/lightonai/next-plaid");
107
- }
108
- let userFriendlyError = `Error searching "${query}" in ${path}: ${errorMessage}`;
109
- if (errorMessage.includes("No such file or directory")) {
110
- userFriendlyError = `Path not found: "${path}" - check if the path exists and is accessible`;
111
- }
112
- else if (errorMessage.includes("permission denied")) {
113
- userFriendlyError = `Permission denied accessing "${path}"`;
114
- }
115
- else if (errorMessage.includes("timed out")) {
116
- userFriendlyError =
117
- "Search timed out after 30 seconds - try reducing maxResults";
118
- }
119
- throw new Error(userFriendlyError);
120
- }
121
- export const createCodeSearchTool = () => {
122
- return {
123
- toolDef: {
124
- description: "Semantic code search using natural language.",
125
- inputSchema,
126
- },
127
- display({ query, path, regexPattern, filePattern, excludePattern, excludeDir, maxResults, contextLines, filesOnly, showContent, codeOnly, }) {
128
- const safeRegexPattern = normalizeNullableString(regexPattern);
129
- const safeFilePattern = normalizeNullableString(filePattern);
130
- const safeExcludePattern = normalizeNullableString(excludePattern);
131
- const safeExcludeDir = normalizeNullableString(excludeDir);
132
- const displayPath = toDisplayPath(path);
133
- const effectiveMaxResults = maxResults ?? DEFAULT_MAX_RESULTS;
134
- const effectiveContextLines = contextLines ?? DEFAULT_CONTEXT_LINES;
135
- let initMessage = `${style.cyan(inspect(query))} in ${style.cyan(displayPath)}`;
136
- if (safeRegexPattern) {
137
- initMessage += ` ${style.dim(`(regex: ${safeRegexPattern})`)}`;
138
- }
139
- if (safeFilePattern) {
140
- initMessage += ` ${style.dim(`(include: ${safeFilePattern})`)}`;
141
- }
142
- if (safeExcludePattern) {
143
- initMessage += ` ${style.dim(`(exclude: ${safeExcludePattern})`)}`;
144
- }
145
- if (safeExcludeDir) {
146
- initMessage += ` ${style.dim(`(exclude-dir: ${safeExcludeDir})`)}`;
147
- }
148
- if (effectiveMaxResults !== DEFAULT_MAX_RESULTS) {
149
- initMessage += ` ${style.dim(`(max: ${effectiveMaxResults})`)}`;
150
- }
151
- if (effectiveContextLines !== DEFAULT_CONTEXT_LINES) {
152
- initMessage += ` ${style.dim(`(context: ${effectiveContextLines})`)}`;
153
- }
154
- if (filesOnly) {
155
- initMessage += ` ${style.dim("(files only)")}`;
156
- }
157
- if (showContent) {
158
- initMessage += ` ${style.dim("(show content)")}`;
159
- }
160
- if (codeOnly) {
161
- initMessage += ` ${style.dim("(code only)")}`;
162
- }
163
- return initMessage;
164
- },
165
- async execute({ query, path, regexPattern, filePattern, excludePattern, excludeDir, maxResults, contextLines, filesOnly, showContent, codeOnly, }, { abortSignal }) {
166
- if (abortSignal?.aborted) {
167
- throw new Error("CodeSearch aborted");
168
- }
169
- const args = buildColgrepArgs({
170
- query,
171
- path,
172
- regexPattern: normalizeNullableString(regexPattern),
173
- filePattern: normalizeNullableString(filePattern),
174
- excludePattern: normalizeNullableString(excludePattern),
175
- excludeDir: normalizeNullableString(excludeDir),
176
- maxResults,
177
- contextLines,
178
- filesOnly,
179
- showContent,
180
- codeOnly,
181
- });
182
- try {
183
- const colgrepResult = execSync(["colgrep", ...args].join(" "), {
184
- encoding: "utf-8",
185
- stdio: ["pipe", "pipe", "pipe"],
186
- timeout: 30000,
187
- });
188
- return colgrepResult;
189
- }
190
- catch (error) {
191
- handleColgrepError(error, query, path);
192
- }
193
- },
194
- };
195
- };
@@ -1,2 +0,0 @@
1
- export declare function isAsyncIterable<T>(value: unknown): value is AsyncIterable<T>;
2
- //# sourceMappingURL=iterables.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"iterables.d.ts","sourceRoot":"","sources":["../../source/utils/iterables.ts"],"names":[],"mappings":"AAAA,wBAAgB,eAAe,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAAC,CAAC,CAAC,CAQ5E"}
@@ -1,6 +0,0 @@
1
- export function isAsyncIterable(value) {
2
- if (value === null || typeof value !== "object") {
3
- return false;
4
- }
5
- return (typeof value[Symbol.asyncIterator] === "function");
6
- }