indusagi 0.12.5 → 0.12.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.
Files changed (125) hide show
  1. package/dist/agent/index.d.ts +1 -0
  2. package/dist/agent/index.d.ts.map +1 -1
  3. package/dist/agent/index.js +2 -0
  4. package/dist/agent/index.js.map +1 -1
  5. package/dist/agent/tools/bash.d.ts +45 -0
  6. package/dist/agent/tools/bash.d.ts.map +1 -0
  7. package/dist/agent/tools/bash.js +227 -0
  8. package/dist/agent/tools/bash.js.map +1 -0
  9. package/dist/agent/tools/edit-diff.d.ts +63 -0
  10. package/dist/agent/tools/edit-diff.d.ts.map +1 -0
  11. package/dist/agent/tools/edit-diff.js +241 -0
  12. package/dist/agent/tools/edit-diff.js.map +1 -0
  13. package/dist/agent/tools/edit.d.ts +37 -0
  14. package/dist/agent/tools/edit.d.ts.map +1 -0
  15. package/dist/agent/tools/edit.js +146 -0
  16. package/dist/agent/tools/edit.js.map +1 -0
  17. package/dist/agent/tools/find.d.ts +24 -0
  18. package/dist/agent/tools/find.d.ts.map +1 -0
  19. package/dist/agent/tools/find.js +132 -0
  20. package/dist/agent/tools/find.js.map +1 -0
  21. package/dist/agent/tools/grep.d.ts +43 -0
  22. package/dist/agent/tools/grep.d.ts.map +1 -0
  23. package/dist/agent/tools/grep.js +178 -0
  24. package/dist/agent/tools/grep.js.map +1 -0
  25. package/dist/agent/tools/index.d.ts +158 -0
  26. package/dist/agent/tools/index.d.ts.map +1 -0
  27. package/dist/agent/tools/index.js +128 -0
  28. package/dist/agent/tools/index.js.map +1 -0
  29. package/dist/agent/tools/ls.d.ts +38 -0
  30. package/dist/agent/tools/ls.d.ts.map +1 -0
  31. package/dist/agent/tools/ls.js +118 -0
  32. package/dist/agent/tools/ls.js.map +1 -0
  33. package/dist/agent/tools/path-utils.d.ts +8 -0
  34. package/dist/agent/tools/path-utils.d.ts.map +1 -0
  35. package/dist/agent/tools/path-utils.js +53 -0
  36. package/dist/agent/tools/path-utils.js.map +1 -0
  37. package/dist/agent/tools/read.d.ts +37 -0
  38. package/dist/agent/tools/read.d.ts.map +1 -0
  39. package/dist/agent/tools/read.js +168 -0
  40. package/dist/agent/tools/read.js.map +1 -0
  41. package/dist/agent/tools/task.d.ts +26 -0
  42. package/dist/agent/tools/task.d.ts.map +1 -0
  43. package/dist/agent/tools/task.js +30 -0
  44. package/dist/agent/tools/task.js.map +1 -0
  45. package/dist/agent/tools/todo-store.d.ts +20 -0
  46. package/dist/agent/tools/todo-store.d.ts.map +1 -0
  47. package/dist/agent/tools/todo-store.js +24 -0
  48. package/dist/agent/tools/todo-store.js.map +1 -0
  49. package/dist/agent/tools/todo.d.ts +26 -0
  50. package/dist/agent/tools/todo.d.ts.map +1 -0
  51. package/dist/agent/tools/todo.js +52 -0
  52. package/dist/agent/tools/todo.js.map +1 -0
  53. package/dist/agent/tools/truncate.d.ts +70 -0
  54. package/dist/agent/tools/truncate.d.ts.map +1 -0
  55. package/dist/agent/tools/truncate.js +205 -0
  56. package/dist/agent/tools/truncate.js.map +1 -0
  57. package/dist/agent/tools/utils/hook-runner.d.ts +9 -0
  58. package/dist/agent/tools/utils/hook-runner.d.ts.map +1 -0
  59. package/dist/agent/tools/utils/hook-runner.js +14 -0
  60. package/dist/agent/tools/utils/hook-runner.js.map +1 -0
  61. package/dist/agent/tools/utils/image-resize.d.ts +32 -0
  62. package/dist/agent/tools/utils/image-resize.d.ts.map +1 -0
  63. package/dist/agent/tools/utils/image-resize.js +42 -0
  64. package/dist/agent/tools/utils/image-resize.js.map +1 -0
  65. package/dist/agent/tools/utils/mime.d.ts +10 -0
  66. package/dist/agent/tools/utils/mime.d.ts.map +1 -0
  67. package/dist/agent/tools/utils/mime.js +48 -0
  68. package/dist/agent/tools/utils/mime.js.map +1 -0
  69. package/dist/agent/tools/utils/shell.d.ts +30 -0
  70. package/dist/agent/tools/utils/shell.d.ts.map +1 -0
  71. package/dist/agent/tools/utils/shell.js +137 -0
  72. package/dist/agent/tools/utils/shell.js.map +1 -0
  73. package/dist/agent/tools/webfetch.d.ts +34 -0
  74. package/dist/agent/tools/webfetch.d.ts.map +1 -0
  75. package/dist/agent/tools/webfetch.js +244 -0
  76. package/dist/agent/tools/webfetch.js.map +1 -0
  77. package/dist/agent/tools/websearch.d.ts +29 -0
  78. package/dist/agent/tools/websearch.d.ts.map +1 -0
  79. package/dist/agent/tools/websearch.js +69 -0
  80. package/dist/agent/tools/websearch.js.map +1 -0
  81. package/dist/agent/tools/write.d.ts +27 -0
  82. package/dist/agent/tools/write.d.ts.map +1 -0
  83. package/dist/agent/tools/write.js +78 -0
  84. package/dist/agent/tools/write.js.map +1 -0
  85. package/dist/ai/index.d.ts +0 -1
  86. package/dist/ai/index.d.ts.map +1 -1
  87. package/dist/ai/index.js +0 -1
  88. package/dist/ai/index.js.map +1 -1
  89. package/dist/ai/models.generated.d.ts +34 -208
  90. package/dist/ai/models.generated.d.ts.map +1 -1
  91. package/dist/ai/models.generated.js +37 -211
  92. package/dist/ai/models.generated.js.map +1 -1
  93. package/dist/ai/providers/google-shared.d.ts +6 -1
  94. package/dist/ai/providers/google-shared.d.ts.map +1 -1
  95. package/dist/ai/providers/google-shared.js.map +1 -1
  96. package/dist/ai/providers/google-vertex.d.ts +1 -1
  97. package/dist/ai/providers/google-vertex.d.ts.map +1 -1
  98. package/dist/ai/providers/google-vertex.js.map +1 -1
  99. package/dist/ai/providers/google.d.ts +1 -1
  100. package/dist/ai/providers/google.d.ts.map +1 -1
  101. package/dist/ai/providers/google.js.map +1 -1
  102. package/dist/ai/providers/register-builtins.d.ts.map +1 -1
  103. package/dist/ai/providers/register-builtins.js +0 -6
  104. package/dist/ai/providers/register-builtins.js.map +1 -1
  105. package/dist/ai/types.d.ts +2 -2
  106. package/dist/ai/types.d.ts.map +1 -1
  107. package/dist/ai/utils/oauth/index.d.ts +1 -4
  108. package/dist/ai/utils/oauth/index.d.ts.map +1 -1
  109. package/dist/ai/utils/oauth/index.js +1 -10
  110. package/dist/ai/utils/oauth/index.js.map +1 -1
  111. package/dist/ai/utils/oauth/openai-codex.js +1 -1
  112. package/dist/ai/utils/oauth/openai-codex.js.map +1 -1
  113. package/package.json +1 -1
  114. package/dist/ai/providers/google-gemini-cli.d.ts +0 -74
  115. package/dist/ai/providers/google-gemini-cli.d.ts.map +0 -1
  116. package/dist/ai/providers/google-gemini-cli.js +0 -816
  117. package/dist/ai/providers/google-gemini-cli.js.map +0 -1
  118. package/dist/ai/utils/oauth/google-antigravity.d.ts +0 -26
  119. package/dist/ai/utils/oauth/google-antigravity.d.ts.map +0 -1
  120. package/dist/ai/utils/oauth/google-antigravity.js +0 -390
  121. package/dist/ai/utils/oauth/google-antigravity.js.map +0 -1
  122. package/dist/ai/utils/oauth/google-gemini-cli.d.ts +0 -26
  123. package/dist/ai/utils/oauth/google-gemini-cli.d.ts.map +0 -1
  124. package/dist/ai/utils/oauth/google-gemini-cli.js +0 -462
  125. package/dist/ai/utils/oauth/google-gemini-cli.js.map +0 -1
@@ -2,4 +2,5 @@ export * from "./agent.js";
2
2
  export * from "./agent-loop.js";
3
3
  export * from "./proxy.js";
4
4
  export * from "./types.js";
5
+ export * from "./tools/index.js";
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agent/index.ts"],"names":[],"mappings":"AACA,cAAc,YAAY,CAAC;AAE3B,cAAc,iBAAiB,CAAC;AAEhC,cAAc,YAAY,CAAC;AAE3B,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agent/index.ts"],"names":[],"mappings":"AACA,cAAc,YAAY,CAAC;AAE3B,cAAc,iBAAiB,CAAC;AAEhC,cAAc,YAAY,CAAC;AAE3B,cAAc,YAAY,CAAC;AAE3B,cAAc,kBAAkB,CAAC"}
@@ -6,4 +6,6 @@ export * from "./agent-loop.js";
6
6
  export * from "./proxy.js";
7
7
  // Types
8
8
  export * from "./types.js";
9
+ // Tools
10
+ export * from "./tools/index.js";
9
11
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/agent/index.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,cAAc,YAAY,CAAC;AAC3B,iBAAiB;AACjB,cAAc,iBAAiB,CAAC;AAChC,kBAAkB;AAClB,cAAc,YAAY,CAAC;AAC3B,QAAQ;AACR,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/agent/index.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,cAAc,YAAY,CAAC;AAC3B,iBAAiB;AACjB,cAAc,iBAAiB,CAAC;AAChC,kBAAkB;AAClB,cAAc,YAAY,CAAC;AAC3B,QAAQ;AACR,cAAc,YAAY,CAAC;AAC3B,QAAQ;AACR,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,45 @@
1
+ import type { AgentTool } from "../types.js";
2
+ import { type TruncationResult } from "./truncate.js";
3
+ declare const bashSchema: import("@sinclair/typebox").TObject<{
4
+ command: import("@sinclair/typebox").TString;
5
+ timeout: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
6
+ }>;
7
+ export interface BashToolDetails {
8
+ truncation?: TruncationResult;
9
+ fullOutputPath?: string;
10
+ }
11
+ /**
12
+ * Pluggable operations for bash tool.
13
+ * Override these to delegate command execution to remote systems (e.g., SSH).
14
+ */
15
+ export interface BashOperations {
16
+ /**
17
+ * Execute a command and stream output.
18
+ * @param command - The command to execute
19
+ * @param cwd - Working directory
20
+ * @param options - Execution options
21
+ * @returns Promise resolving to exit code (null if killed)
22
+ */
23
+ exec: (command: string, cwd: string, options: {
24
+ onData: (data: Buffer) => void;
25
+ signal?: AbortSignal;
26
+ timeout?: number;
27
+ env?: NodeJS.ProcessEnv;
28
+ }) => Promise<{
29
+ exitCode: number | null;
30
+ }>;
31
+ }
32
+ export interface BashToolOptions {
33
+ /** Custom operations for command execution. Default: local shell */
34
+ operations?: BashOperations;
35
+ /** Command prefix prepended to every command (e.g., "shopt -s expand_aliases" for alias support) */
36
+ commandPrefix?: string;
37
+ }
38
+ export declare function createBashTool(cwd: string, options?: BashToolOptions): AgentTool<typeof bashSchema>;
39
+ /** Default bash tool using process.cwd() - for backwards compatibility */
40
+ export declare const bashTool: AgentTool<import("@sinclair/typebox").TObject<{
41
+ command: import("@sinclair/typebox").TString;
42
+ timeout: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
43
+ }>, any>;
44
+ export {};
45
+ //# sourceMappingURL=bash.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bash.d.ts","sourceRoot":"","sources":["../../../src/agent/tools/bash.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAI7C,OAAO,EAIN,KAAK,gBAAgB,EAErB,MAAM,eAAe,CAAC;AAUvB,QAAA,MAAM,UAAU;;;EAGd,CAAC;AAEH,MAAM,WAAW,eAAe;IAC/B,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC9B;;;;;;OAMG;IACH,IAAI,EAAE,CACL,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,MAAM,EACX,OAAO,EAAE;QACR,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;QAC/B,MAAM,CAAC,EAAE,WAAW,CAAC;QACrB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;KACxB,KACG,OAAO,CAAC;QAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC,CAAC;CAC1C;AAsFD,MAAM,WAAW,eAAe;IAC/B,oEAAoE;IACpE,UAAU,CAAC,EAAE,cAAc,CAAC;IAC5B,oGAAoG;IACpG,aAAa,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,SAAS,CAAC,OAAO,UAAU,CAAC,CAiJnG;AAED,0EAA0E;AAC1E,eAAO,MAAM,QAAQ;;;QAAgC,CAAC"}
@@ -0,0 +1,227 @@
1
+ import { randomBytes } from "node:crypto";
2
+ import { createWriteStream, existsSync } from "node:fs";
3
+ import { tmpdir } from "node:os";
4
+ import { join } from "node:path";
5
+ import { Type } from "@sinclair/typebox";
6
+ import { spawn } from "child_process";
7
+ import { getShellConfig, getShellEnv, killProcessTree } from "./utils/shell.js";
8
+ import { DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, formatSize, truncateTail, } from "./truncate.js";
9
+ /**
10
+ * Generate a unique temp file path for bash output
11
+ */
12
+ function getTempFilePath() {
13
+ const id = randomBytes(8).toString("hex");
14
+ return join(tmpdir(), `indusagi-bash-${id}.log`);
15
+ }
16
+ const bashSchema = Type.Object({
17
+ command: Type.String({ description: "Bash command to execute" }),
18
+ timeout: Type.Optional(Type.Number({ description: "Timeout in seconds (optional, no default timeout)" })),
19
+ });
20
+ /**
21
+ * Default bash operations using local shell
22
+ */
23
+ const defaultBashOperations = {
24
+ exec: (command, cwd, { onData, signal, timeout, env }) => {
25
+ return new Promise((resolve, reject) => {
26
+ const { shell, args } = getShellConfig();
27
+ if (!existsSync(cwd)) {
28
+ reject(new Error(`Working directory does not exist: ${cwd}\nCannot execute bash commands.`));
29
+ return;
30
+ }
31
+ const child = spawn(shell, [...args, command], {
32
+ cwd,
33
+ detached: true,
34
+ env: { ...getShellEnv(), ...(env ?? {}) },
35
+ stdio: ["ignore", "pipe", "pipe"],
36
+ });
37
+ let timedOut = false;
38
+ // Set timeout if provided
39
+ let timeoutHandle;
40
+ if (timeout !== undefined && timeout > 0) {
41
+ timeoutHandle = setTimeout(() => {
42
+ timedOut = true;
43
+ if (child.pid) {
44
+ killProcessTree(child.pid);
45
+ }
46
+ }, timeout * 1000);
47
+ }
48
+ // Stream stdout and stderr
49
+ if (child.stdout) {
50
+ child.stdout.on("data", onData);
51
+ }
52
+ if (child.stderr) {
53
+ child.stderr.on("data", onData);
54
+ }
55
+ // Handle shell spawn errors
56
+ child.on("error", (err) => {
57
+ if (timeoutHandle)
58
+ clearTimeout(timeoutHandle);
59
+ if (signal)
60
+ signal.removeEventListener("abort", onAbort);
61
+ reject(err);
62
+ });
63
+ // Handle abort signal - kill entire process tree
64
+ const onAbort = () => {
65
+ if (child.pid) {
66
+ killProcessTree(child.pid);
67
+ }
68
+ };
69
+ if (signal) {
70
+ if (signal.aborted) {
71
+ onAbort();
72
+ }
73
+ else {
74
+ signal.addEventListener("abort", onAbort, { once: true });
75
+ }
76
+ }
77
+ // Handle process exit
78
+ child.on("close", (code) => {
79
+ if (timeoutHandle)
80
+ clearTimeout(timeoutHandle);
81
+ if (signal)
82
+ signal.removeEventListener("abort", onAbort);
83
+ if (signal?.aborted) {
84
+ reject(new Error("aborted"));
85
+ return;
86
+ }
87
+ if (timedOut) {
88
+ reject(new Error(`timeout:${timeout}`));
89
+ return;
90
+ }
91
+ resolve({ exitCode: code });
92
+ });
93
+ });
94
+ },
95
+ };
96
+ export function createBashTool(cwd, options) {
97
+ const ops = options?.operations ?? defaultBashOperations;
98
+ const commandPrefix = options?.commandPrefix;
99
+ return {
100
+ name: "bash",
101
+ label: "bash",
102
+ description: `Execute a bash command in current working directory. Returns stdout and stderr. Output is truncated to last ${DEFAULT_MAX_LINES} lines or ${DEFAULT_MAX_BYTES / 1024}KB (whichever is hit first). If truncated, full output is saved to a temp file. Optionally provide a timeout in seconds.`,
103
+ parameters: bashSchema,
104
+ execute: async (_toolCallId, { command, timeout }, signal, onUpdate) => {
105
+ // Apply command prefix if configured (e.g., "shopt -s expand_aliases" for alias support)
106
+ const resolvedCommand = commandPrefix ? `${commandPrefix}\n${command}` : command;
107
+ return new Promise((resolve, reject) => {
108
+ // We'll stream to a temp file if output gets large
109
+ let tempFilePath;
110
+ let tempFileStream;
111
+ let totalBytes = 0;
112
+ // Keep a rolling buffer of last chunk for tail truncation
113
+ const chunks = [];
114
+ let chunksBytes = 0;
115
+ // Keep more than we need so we have enough for truncation
116
+ const maxChunksBytes = DEFAULT_MAX_BYTES * 2;
117
+ const handleData = (data) => {
118
+ totalBytes += data.length;
119
+ // Start writing to temp file once we exceed threshold
120
+ if (totalBytes > DEFAULT_MAX_BYTES && !tempFilePath) {
121
+ tempFilePath = getTempFilePath();
122
+ tempFileStream = createWriteStream(tempFilePath);
123
+ // Write all buffered chunks to file
124
+ for (const chunk of chunks) {
125
+ tempFileStream.write(chunk);
126
+ }
127
+ }
128
+ // Write to temp file if we have one
129
+ if (tempFileStream) {
130
+ tempFileStream.write(data);
131
+ }
132
+ // Keep rolling buffer of recent data
133
+ chunks.push(data);
134
+ chunksBytes += data.length;
135
+ // Trim old chunks if buffer is too large
136
+ while (chunksBytes > maxChunksBytes && chunks.length > 1) {
137
+ const removed = chunks.shift();
138
+ chunksBytes -= removed.length;
139
+ }
140
+ // Stream partial output to callback (truncated rolling buffer)
141
+ if (onUpdate) {
142
+ const fullBuffer = Buffer.concat(chunks);
143
+ const fullText = fullBuffer.toString("utf-8");
144
+ const truncation = truncateTail(fullText);
145
+ onUpdate({
146
+ content: [{ type: "text", text: truncation.content || "" }],
147
+ details: {
148
+ truncation: truncation.truncated ? truncation : undefined,
149
+ fullOutputPath: tempFilePath,
150
+ },
151
+ });
152
+ }
153
+ };
154
+ ops.exec(resolvedCommand, cwd, { onData: handleData, signal, timeout })
155
+ .then(({ exitCode }) => {
156
+ // Close temp file stream
157
+ if (tempFileStream) {
158
+ tempFileStream.end();
159
+ }
160
+ // Combine all buffered chunks
161
+ const fullBuffer = Buffer.concat(chunks);
162
+ const fullOutput = fullBuffer.toString("utf-8");
163
+ // Apply tail truncation
164
+ const truncation = truncateTail(fullOutput);
165
+ let outputText = truncation.content || "(no output)";
166
+ // Build details with truncation info
167
+ let details;
168
+ if (truncation.truncated) {
169
+ details = {
170
+ truncation,
171
+ fullOutputPath: tempFilePath,
172
+ };
173
+ // Build actionable notice
174
+ const startLine = truncation.totalLines - truncation.outputLines + 1;
175
+ const endLine = truncation.totalLines;
176
+ if (truncation.lastLinePartial) {
177
+ // Edge case: last line alone > 30KB
178
+ const lastLineSize = formatSize(Buffer.byteLength(fullOutput.split("\n").pop() || "", "utf-8"));
179
+ outputText += `\n\n[Showing last ${formatSize(truncation.outputBytes)} of line ${endLine} (line is ${lastLineSize}). Full output: ${tempFilePath}]`;
180
+ }
181
+ else if (truncation.truncatedBy === "lines") {
182
+ outputText += `\n\n[Showing lines ${startLine}-${endLine} of ${truncation.totalLines}. Full output: ${tempFilePath}]`;
183
+ }
184
+ else {
185
+ outputText += `\n\n[Showing lines ${startLine}-${endLine} of ${truncation.totalLines} (${formatSize(DEFAULT_MAX_BYTES)} limit). Full output: ${tempFilePath}]`;
186
+ }
187
+ }
188
+ if (exitCode !== 0 && exitCode !== null) {
189
+ outputText += `\n\nCommand exited with code ${exitCode}`;
190
+ reject(new Error(outputText));
191
+ }
192
+ else {
193
+ resolve({ content: [{ type: "text", text: outputText }], details });
194
+ }
195
+ })
196
+ .catch((err) => {
197
+ // Close temp file stream
198
+ if (tempFileStream) {
199
+ tempFileStream.end();
200
+ }
201
+ // Combine all buffered chunks for error output
202
+ const fullBuffer = Buffer.concat(chunks);
203
+ let output = fullBuffer.toString("utf-8");
204
+ if (err.message === "aborted") {
205
+ if (output)
206
+ output += "\n\n";
207
+ output += "Command aborted";
208
+ reject(new Error(output));
209
+ }
210
+ else if (err.message.startsWith("timeout:")) {
211
+ const timeoutSecs = err.message.split(":")[1];
212
+ if (output)
213
+ output += "\n\n";
214
+ output += `Command timed out after ${timeoutSecs} seconds`;
215
+ reject(new Error(output));
216
+ }
217
+ else {
218
+ reject(err);
219
+ }
220
+ });
221
+ });
222
+ },
223
+ };
224
+ }
225
+ /** Default bash tool using process.cwd() - for backwards compatibility */
226
+ export const bashTool = createBashTool(process.cwd());
227
+ //# sourceMappingURL=bash.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bash.js","sourceRoot":"","sources":["../../../src/agent/tools/bash.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAChF,OAAO,EACN,iBAAiB,EACjB,iBAAiB,EACjB,UAAU,EAEV,YAAY,GACZ,MAAM,eAAe,CAAC;AAEvB;;GAEG;AACH,SAAS,eAAe;IACvB,MAAM,EAAE,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC1C,OAAO,IAAI,CAAC,MAAM,EAAE,EAAE,iBAAiB,EAAE,MAAM,CAAC,CAAC;AAClD,CAAC;AAED,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC;IAC9B,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,yBAAyB,EAAE,CAAC;IAChE,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,mDAAmD,EAAE,CAAC,CAAC;CACzG,CAAC,CAAC;AA+BH;;GAEG;AACH,MAAM,qBAAqB,GAAmB;IAC7C,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,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,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;wBAC9C,IAAI,MAAM;4BAAE,MAAM,IAAI,MAAM,CAAC;wBAC7B,MAAM,IAAI,2BAA2B,WAAW,UAAU,CAAC;wBAC3D,MAAM,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;oBAC3B,CAAC;yBAAM,CAAC;wBACP,MAAM,CAAC,GAAG,CAAC,CAAC;oBACb,CAAC;gBACF,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACJ,CAAC;KACD,CAAC;AACH,CAAC;AAED,0EAA0E;AAC1E,MAAM,CAAC,MAAM,QAAQ,GAAG,cAAc,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Shared diff computation utilities for edit tool.
3
+ * Simplified version for indusagi agent framework.
4
+ */
5
+ export declare function detectLineEnding(content: string): "\r\n" | "\n";
6
+ export declare function normalizeToLF(text: string): string;
7
+ export declare function restoreLineEndings(text: string, ending: "\r\n" | "\n"): string;
8
+ /**
9
+ * Normalize text for fuzzy matching. Applies progressive transformations:
10
+ * - Strip trailing whitespace from each line
11
+ * - Normalize smart quotes to ASCII equivalents
12
+ * - Normalize Unicode dashes/hyphens to ASCII hyphen
13
+ * - Normalize special Unicode spaces to regular space
14
+ */
15
+ export declare function normalizeForFuzzyMatch(text: string): string;
16
+ export interface FuzzyMatchResult {
17
+ /** Whether a match was found */
18
+ found: boolean;
19
+ /** The index where match starts (in the content that should be used for replacement) */
20
+ index: number;
21
+ /** Length of matched text */
22
+ matchLength: number;
23
+ /** Whether fuzzy matching was used (false = exact match) */
24
+ usedFuzzyMatch: boolean;
25
+ /**
26
+ * The content to use for replacement operations.
27
+ * When exact match: original content. When fuzzy match: normalized content.
28
+ */
29
+ contentForReplacement: string;
30
+ }
31
+ /**
32
+ * Find oldText in content, trying exact match first, then fuzzy match.
33
+ * When fuzzy matching is used, the returned contentForReplacement is the
34
+ * fuzzy-normalized version of content (trailing whitespace stripped,
35
+ * Unicode quotes/dashes normalized to ASCII).
36
+ */
37
+ export declare function fuzzyFindText(content: string, oldText: string): FuzzyMatchResult;
38
+ /** Strip UTF-8 BOM if present, return both BOM (if any) and text without it */
39
+ export declare function stripBom(content: string): {
40
+ bom: string;
41
+ text: string;
42
+ };
43
+ /**
44
+ * Simple line-by-line diff without using external diff library.
45
+ * Returns both diff string and first changed line number (in the new file).
46
+ */
47
+ export declare function generateDiffString(oldContent: string, newContent: string, contextLines?: number): {
48
+ diff: string;
49
+ firstChangedLine: number | undefined;
50
+ };
51
+ export interface EditDiffResult {
52
+ diff: string;
53
+ firstChangedLine: number | undefined;
54
+ }
55
+ export interface EditDiffError {
56
+ error: string;
57
+ }
58
+ /**
59
+ * Compute the diff for an edit operation without applying it.
60
+ * Used for preview rendering in TUI before tool executes.
61
+ */
62
+ export declare function computeEditDiff(path: string, oldText: string, newText: string, cwd: string): Promise<EditDiffResult | EditDiffError>;
63
+ //# sourceMappingURL=edit-diff.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edit-diff.d.ts","sourceRoot":"","sources":["../../../src/agent/tools/edit-diff.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAM/D;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAElD;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAE9E;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAoB3D;AAED,MAAM,WAAW,gBAAgB;IAChC,gCAAgC;IAChC,KAAK,EAAE,OAAO,CAAC;IACf,wFAAwF;IACxF,KAAK,EAAE,MAAM,CAAC;IACd,6BAA6B;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,4DAA4D;IAC5D,cAAc,EAAE,OAAO,CAAC;IACxB;;;OAGG;IACH,qBAAqB,EAAE,MAAM,CAAC;CAC9B;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,gBAAgB,CAsChF;AAED,+EAA+E;AAC/E,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAEvE;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CACjC,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,YAAY,SAAI,GACd;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CA+CxD;AA4CD,MAAM,WAAW,cAAc;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAC;CACrC;AAED,MAAM,WAAW,aAAa;IAC7B,KAAK,EAAE,MAAM,CAAC;CACd;AAED;;;GAGG;AACH,wBAAsB,eAAe,CACpC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,MAAM,GACT,OAAO,CAAC,cAAc,GAAG,aAAa,CAAC,CA6DzC"}
@@ -0,0 +1,241 @@
1
+ /**
2
+ * Shared diff computation utilities for edit tool.
3
+ * Simplified version for indusagi agent framework.
4
+ */
5
+ import { constants } from "fs";
6
+ import { access, readFile } from "fs/promises";
7
+ import { resolveToCwd } from "./path-utils.js";
8
+ export function detectLineEnding(content) {
9
+ const crlfIdx = content.indexOf("\r\n");
10
+ const lfIdx = content.indexOf("\n");
11
+ if (lfIdx === -1)
12
+ return "\n";
13
+ if (crlfIdx === -1)
14
+ return "\n";
15
+ return crlfIdx < lfIdx ? "\r\n" : "\n";
16
+ }
17
+ export function normalizeToLF(text) {
18
+ return text.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
19
+ }
20
+ export function restoreLineEndings(text, ending) {
21
+ return ending === "\r\n" ? text.replace(/\n/g, "\r\n") : text;
22
+ }
23
+ /**
24
+ * Normalize text for fuzzy matching. Applies progressive transformations:
25
+ * - Strip trailing whitespace from each line
26
+ * - Normalize smart quotes to ASCII equivalents
27
+ * - Normalize Unicode dashes/hyphens to ASCII hyphen
28
+ * - Normalize special Unicode spaces to regular space
29
+ */
30
+ export function normalizeForFuzzyMatch(text) {
31
+ return (text
32
+ // Strip trailing whitespace per line
33
+ .split("\n")
34
+ .map((line) => line.trimEnd())
35
+ .join("\n")
36
+ // Smart single quotes → '
37
+ .replace(/[\u2018\u2019\u201A\u201B]/g, "'")
38
+ // Smart double quotes → "
39
+ .replace(/[\u201C\u201D\u201E\u201F]/g, '"')
40
+ // Various dashes/hyphens → -
41
+ // U+2010 hyphen, U+2011 non-breaking hyphen, U+2012 figure dash,
42
+ // U+2013 en-dash, U+2014 em-dash, U+2015 horizontal bar, U+2212 minus
43
+ .replace(/[\u2010\u2011\u2012\u2013\u2014\u2015\u2212]/g, "-")
44
+ // Special spaces → regular space
45
+ // U+00A0 NBSP, U+2002-U+200A various spaces, U+202F narrow NBSP,
46
+ // U+205F medium math space, U+3000 ideographic space
47
+ .replace(/[\u00A0\u2002-\u200A\u202F\u205F\u3000]/g, " "));
48
+ }
49
+ /**
50
+ * Find oldText in content, trying exact match first, then fuzzy match.
51
+ * When fuzzy matching is used, the returned contentForReplacement is the
52
+ * fuzzy-normalized version of content (trailing whitespace stripped,
53
+ * Unicode quotes/dashes normalized to ASCII).
54
+ */
55
+ export function fuzzyFindText(content, oldText) {
56
+ // Try exact match first
57
+ const exactIndex = content.indexOf(oldText);
58
+ if (exactIndex !== -1) {
59
+ return {
60
+ found: true,
61
+ index: exactIndex,
62
+ matchLength: oldText.length,
63
+ usedFuzzyMatch: false,
64
+ contentForReplacement: content,
65
+ };
66
+ }
67
+ // Try fuzzy match - work entirely in normalized space
68
+ const fuzzyContent = normalizeForFuzzyMatch(content);
69
+ const fuzzyOldText = normalizeForFuzzyMatch(oldText);
70
+ const fuzzyIndex = fuzzyContent.indexOf(fuzzyOldText);
71
+ if (fuzzyIndex === -1) {
72
+ return {
73
+ found: false,
74
+ index: -1,
75
+ matchLength: 0,
76
+ usedFuzzyMatch: false,
77
+ contentForReplacement: content,
78
+ };
79
+ }
80
+ // When fuzzy matching, we work in the normalized space for replacement.
81
+ // This means the output will have normalized whitespace/quotes/dashes,
82
+ // which is acceptable since we're fixing minor formatting differences anyway.
83
+ return {
84
+ found: true,
85
+ index: fuzzyIndex,
86
+ matchLength: fuzzyOldText.length,
87
+ usedFuzzyMatch: true,
88
+ contentForReplacement: fuzzyContent,
89
+ };
90
+ }
91
+ /** Strip UTF-8 BOM if present, return both BOM (if any) and text without it */
92
+ export function stripBom(content) {
93
+ return content.startsWith("\uFEFF") ? { bom: "\uFEFF", text: content.slice(1) } : { bom: "", text: content };
94
+ }
95
+ /**
96
+ * Simple line-by-line diff without using external diff library.
97
+ * Returns both diff string and first changed line number (in the new file).
98
+ */
99
+ export function generateDiffString(oldContent, newContent, contextLines = 4) {
100
+ const oldLines = oldContent.split("\n");
101
+ const newLines = newContent.split("\n");
102
+ const maxLineNum = Math.max(oldLines.length, newLines.length);
103
+ const lineNumWidth = String(maxLineNum).length;
104
+ const output = [];
105
+ let i = 0;
106
+ let j = 0;
107
+ let firstChangedLine;
108
+ let oldLineNum = 1;
109
+ // Simple LCS (Longest Common Subsequence) for diff
110
+ const lcs = computeLCS(oldLines, newLines);
111
+ // Output diff
112
+ while (i < oldLines.length || j < newLines.length) {
113
+ if (i < oldLines.length && j < newLines.length && oldLines[i] === newLines[j]) {
114
+ // No change
115
+ if (firstChangedLine !== undefined) {
116
+ const lineNum = String(oldLineNum).padStart(lineNumWidth, " ");
117
+ output.push(` ${lineNum} ${oldLines[i]}`);
118
+ }
119
+ i++;
120
+ j++;
121
+ oldLineNum++;
122
+ }
123
+ else if (j < newLines.length && (i >= oldLines.length || (lcs.get(i) || []).includes(j))) {
124
+ // Added line
125
+ if (firstChangedLine === undefined) {
126
+ firstChangedLine = j + 1;
127
+ }
128
+ const lineNum = String(j + 1).padStart(lineNumWidth, " ");
129
+ output.push(`+${lineNum} ${newLines[j]}`);
130
+ j++;
131
+ }
132
+ else {
133
+ // Removed line
134
+ if (firstChangedLine === undefined) {
135
+ firstChangedLine = j + 1;
136
+ }
137
+ const lineNum = String(oldLineNum).padStart(lineNumWidth, " ");
138
+ output.push(`-${lineNum} ${oldLines[i]}`);
139
+ i++;
140
+ oldLineNum++;
141
+ }
142
+ }
143
+ return { diff: output.join("\n"), firstChangedLine };
144
+ }
145
+ /**
146
+ * Compute Longest Common Subsequence (LCS) for two arrays.
147
+ * Returns a map from old line index to array of matching new line indices.
148
+ */
149
+ function computeLCS(a, b) {
150
+ const m = a.length;
151
+ const n = b.length;
152
+ const dp = Array.from({ length: m + 1 }, () => Array(n + 1).fill(0));
153
+ // Fill DP table
154
+ for (let i = 1; i <= m; i++) {
155
+ for (let j = 1; j <= n; j++) {
156
+ if (a[i - 1] === b[j - 1]) {
157
+ dp[i][j] = dp[i - 1][j - 1] + 1;
158
+ }
159
+ else {
160
+ dp[i][j] = Math.max(dp[i - 1][j], dp[i][j - 1]);
161
+ }
162
+ }
163
+ }
164
+ // Backtrack to find matches
165
+ const result = new Map();
166
+ let i = m;
167
+ let j = n;
168
+ while (i > 0 && j > 0) {
169
+ if (a[i - 1] === b[j - 1]) {
170
+ const existing = result.get(i - 1) || [];
171
+ existing.push(j - 1);
172
+ result.set(i - 1, existing);
173
+ i--;
174
+ j--;
175
+ }
176
+ else if (dp[i - 1][j] >= dp[i][j - 1]) {
177
+ i--;
178
+ }
179
+ else {
180
+ j--;
181
+ }
182
+ }
183
+ return result;
184
+ }
185
+ /**
186
+ * Compute the diff for an edit operation without applying it.
187
+ * Used for preview rendering in TUI before tool executes.
188
+ */
189
+ export async function computeEditDiff(path, oldText, newText, cwd) {
190
+ const absolutePath = resolveToCwd(path, cwd);
191
+ try {
192
+ // Check if file exists and is readable
193
+ try {
194
+ await access(absolutePath, constants.R_OK);
195
+ }
196
+ catch {
197
+ return { error: `File not found: ${path}` };
198
+ }
199
+ // Read the file
200
+ const rawContent = await readFile(absolutePath, "utf-8");
201
+ // Strip BOM before matching (LLM won't include invisible BOM in oldText)
202
+ const { text: content } = stripBom(rawContent);
203
+ const normalizedContent = normalizeToLF(content);
204
+ const normalizedOldText = normalizeToLF(oldText);
205
+ const normalizedNewText = normalizeToLF(newText);
206
+ // Find old text using fuzzy matching (tries exact match first, then fuzzy)
207
+ const matchResult = fuzzyFindText(normalizedContent, normalizedOldText);
208
+ if (!matchResult.found) {
209
+ return {
210
+ error: `Could not find the exact text in ${path}. The old text must match exactly including all whitespace and newlines.`,
211
+ };
212
+ }
213
+ // Count occurrences using fuzzy-normalized content for consistency
214
+ const fuzzyContent = normalizeForFuzzyMatch(normalizedContent);
215
+ const fuzzyOldText = normalizeForFuzzyMatch(normalizedOldText);
216
+ const occurrences = fuzzyContent.split(fuzzyOldText).length - 1;
217
+ if (occurrences > 1) {
218
+ return {
219
+ error: `Found ${occurrences} occurrences of the text in ${path}. The text must be unique. Please provide more context to make it unique.`,
220
+ };
221
+ }
222
+ // Compute the new content using the matched position
223
+ // When fuzzy matching was used, contentForReplacement is the normalized version
224
+ const baseContent = matchResult.contentForReplacement;
225
+ const newContent = baseContent.substring(0, matchResult.index) +
226
+ normalizedNewText +
227
+ baseContent.substring(matchResult.index + matchResult.matchLength);
228
+ // Check if it would actually change anything
229
+ if (baseContent === newContent) {
230
+ return {
231
+ error: `No changes would be made to ${path}. The replacement produces identical content.`,
232
+ };
233
+ }
234
+ // Generate the diff
235
+ return generateDiffString(baseContent, newContent);
236
+ }
237
+ catch (err) {
238
+ return { error: err instanceof Error ? err.message : String(err) };
239
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