@sylix/coworker 2.0.12 → 2.0.15

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 (221) hide show
  1. package/LICENSE +99 -0
  2. package/dist/cli/index.d.ts.map +1 -1
  3. package/dist/cli/index.js +3 -8
  4. package/dist/cli/index.js.map +1 -1
  5. package/dist/commands/slash/mem.d.ts +3 -0
  6. package/dist/commands/slash/mem.d.ts.map +1 -0
  7. package/dist/commands/slash/mem.js +167 -0
  8. package/dist/commands/slash/mem.js.map +1 -0
  9. package/dist/commands/slash/registry.d.ts.map +1 -1
  10. package/dist/commands/slash/registry.js +2 -0
  11. package/dist/commands/slash/registry.js.map +1 -1
  12. package/dist/core/CoWorkerAgent.d.ts +4 -1
  13. package/dist/core/CoWorkerAgent.d.ts.map +1 -1
  14. package/dist/core/CoWorkerAgent.js +159 -12
  15. package/dist/core/CoWorkerAgent.js.map +1 -1
  16. package/dist/services/BrowserService.d.ts.map +1 -1
  17. package/dist/services/BrowserService.js +111 -0
  18. package/dist/services/BrowserService.js.map +1 -1
  19. package/dist/services/ChromeExtensionService.d.ts +63 -0
  20. package/dist/services/ChromeExtensionService.d.ts.map +1 -0
  21. package/dist/services/ChromeExtensionService.js +237 -0
  22. package/dist/services/ChromeExtensionService.js.map +1 -0
  23. package/dist/services/browser/browser-manager.d.ts +2 -0
  24. package/dist/services/browser/browser-manager.d.ts.map +1 -1
  25. package/dist/services/browser/browser-manager.js +13 -4
  26. package/dist/services/browser/browser-manager.js.map +1 -1
  27. package/dist/services/browser/protocol.d.ts +4 -4
  28. package/dist/services/browser/sandbox/quickjs-sandbox.d.ts.map +1 -1
  29. package/dist/services/browser/sandbox/quickjs-sandbox.js +71 -1
  30. package/dist/services/browser/sandbox/quickjs-sandbox.js.map +1 -1
  31. package/dist/services/compact/CompactService.d.ts +22 -0
  32. package/dist/services/compact/CompactService.d.ts.map +1 -0
  33. package/dist/services/compact/CompactService.js +156 -0
  34. package/dist/services/compact/CompactService.js.map +1 -0
  35. package/dist/session/db.d.ts +29 -0
  36. package/dist/session/db.d.ts.map +1 -1
  37. package/dist/session/db.js +74 -0
  38. package/dist/session/db.js.map +1 -1
  39. package/dist/tasks/LocalBashTask.d.ts +18 -0
  40. package/dist/tasks/LocalBashTask.d.ts.map +1 -0
  41. package/dist/tasks/LocalBashTask.js +83 -0
  42. package/dist/tasks/LocalBashTask.js.map +1 -0
  43. package/dist/tasks/Task.d.ts +34 -0
  44. package/dist/tasks/Task.d.ts.map +1 -0
  45. package/dist/tasks/Task.js +98 -0
  46. package/dist/tasks/Task.js.map +1 -0
  47. package/dist/tasks/diskOutput.d.ts +13 -0
  48. package/dist/tasks/diskOutput.d.ts.map +1 -0
  49. package/dist/tasks/diskOutput.js +168 -0
  50. package/dist/tasks/diskOutput.js.map +1 -0
  51. package/dist/tasks/index.d.ts +7 -0
  52. package/dist/tasks/index.d.ts.map +1 -0
  53. package/dist/tasks/index.js +19 -0
  54. package/dist/tasks/index.js.map +1 -0
  55. package/dist/tools/AgentTool.d.ts +41 -0
  56. package/dist/tools/AgentTool.d.ts.map +1 -0
  57. package/dist/tools/AgentTool.js +32 -0
  58. package/dist/tools/AgentTool.js.map +1 -0
  59. package/dist/tools/AskUserQuestionTool.d.ts +71 -0
  60. package/dist/tools/AskUserQuestionTool.d.ts.map +1 -0
  61. package/dist/tools/AskUserQuestionTool.js +33 -0
  62. package/dist/tools/AskUserQuestionTool.js.map +1 -0
  63. package/dist/tools/BashTool.d.ts +43 -0
  64. package/dist/tools/BashTool.d.ts.map +1 -0
  65. package/dist/tools/BashTool.js +97 -0
  66. package/dist/tools/BashTool.js.map +1 -0
  67. package/dist/tools/BriefTool.d.ts +23 -0
  68. package/dist/tools/BriefTool.d.ts.map +1 -0
  69. package/dist/tools/BriefTool.js +61 -0
  70. package/dist/tools/BriefTool.js.map +1 -0
  71. package/dist/tools/ConfigTool.d.ts +35 -0
  72. package/dist/tools/ConfigTool.d.ts.map +1 -0
  73. package/dist/tools/ConfigTool.js +81 -0
  74. package/dist/tools/ConfigTool.js.map +1 -0
  75. package/dist/tools/EnterPlanModeTool.d.ts +23 -0
  76. package/dist/tools/EnterPlanModeTool.d.ts.map +1 -0
  77. package/dist/tools/EnterPlanModeTool.js +21 -0
  78. package/dist/tools/EnterPlanModeTool.js.map +1 -0
  79. package/dist/tools/ExitPlanModeTool.d.ts +23 -0
  80. package/dist/tools/ExitPlanModeTool.d.ts.map +1 -0
  81. package/dist/tools/ExitPlanModeTool.js +21 -0
  82. package/dist/tools/ExitPlanModeTool.js.map +1 -0
  83. package/dist/tools/FileEditTool.d.ts +41 -0
  84. package/dist/tools/FileEditTool.d.ts.map +1 -0
  85. package/dist/tools/FileEditTool.js +81 -0
  86. package/dist/tools/FileEditTool.js.map +1 -0
  87. package/dist/tools/FileReadTool.d.ts +35 -0
  88. package/dist/tools/FileReadTool.d.ts.map +1 -0
  89. package/dist/tools/FileReadTool.js +74 -0
  90. package/dist/tools/FileReadTool.js.map +1 -0
  91. package/dist/tools/FileWriteTool.d.ts +29 -0
  92. package/dist/tools/FileWriteTool.d.ts.map +1 -0
  93. package/dist/tools/FileWriteTool.js +67 -0
  94. package/dist/tools/FileWriteTool.js.map +1 -0
  95. package/dist/tools/GlobTool.d.ts +30 -0
  96. package/dist/tools/GlobTool.d.ts.map +1 -0
  97. package/dist/tools/GlobTool.js +98 -0
  98. package/dist/tools/GlobTool.js.map +1 -0
  99. package/dist/tools/GrepTool.d.ts +36 -0
  100. package/dist/tools/GrepTool.d.ts.map +1 -0
  101. package/dist/tools/GrepTool.js +112 -0
  102. package/dist/tools/GrepTool.js.map +1 -0
  103. package/dist/tools/LSPToolWrapper.d.ts +42 -0
  104. package/dist/tools/LSPToolWrapper.d.ts.map +1 -0
  105. package/dist/tools/LSPToolWrapper.js +49 -0
  106. package/dist/tools/LSPToolWrapper.js.map +1 -0
  107. package/dist/tools/ListMcpResourcesTool.d.ts +11 -0
  108. package/dist/tools/ListMcpResourcesTool.d.ts.map +1 -0
  109. package/dist/tools/ListMcpResourcesTool.js +19 -0
  110. package/dist/tools/ListMcpResourcesTool.js.map +1 -0
  111. package/dist/tools/NotebookEditTool.d.ts +41 -0
  112. package/dist/tools/NotebookEditTool.d.ts.map +1 -0
  113. package/dist/tools/NotebookEditTool.js +30 -0
  114. package/dist/tools/NotebookEditTool.js.map +1 -0
  115. package/dist/tools/SchemaGenerator.d.ts +3 -0
  116. package/dist/tools/SchemaGenerator.d.ts.map +1 -0
  117. package/dist/tools/SchemaGenerator.js +69 -0
  118. package/dist/tools/SchemaGenerator.js.map +1 -0
  119. package/dist/tools/SkillTool.d.ts +29 -0
  120. package/dist/tools/SkillTool.d.ts.map +1 -0
  121. package/dist/tools/SkillTool.js +28 -0
  122. package/dist/tools/SkillTool.js.map +1 -0
  123. package/dist/tools/TaskCreateTool.d.ts +41 -0
  124. package/dist/tools/TaskCreateTool.d.ts.map +1 -0
  125. package/dist/tools/TaskCreateTool.js +67 -0
  126. package/dist/tools/TaskCreateTool.js.map +1 -0
  127. package/dist/tools/TaskGetTool.d.ts +23 -0
  128. package/dist/tools/TaskGetTool.d.ts.map +1 -0
  129. package/dist/tools/TaskGetTool.js +66 -0
  130. package/dist/tools/TaskGetTool.js.map +1 -0
  131. package/dist/tools/TaskListTool.d.ts +11 -0
  132. package/dist/tools/TaskListTool.d.ts.map +1 -0
  133. package/dist/tools/TaskListTool.js +64 -0
  134. package/dist/tools/TaskListTool.js.map +1 -0
  135. package/dist/tools/TaskOutputTool.d.ts +29 -0
  136. package/dist/tools/TaskOutputTool.d.ts.map +1 -0
  137. package/dist/tools/TaskOutputTool.js +66 -0
  138. package/dist/tools/TaskOutputTool.js.map +1 -0
  139. package/dist/tools/TaskStopTool.d.ts +23 -0
  140. package/dist/tools/TaskStopTool.d.ts.map +1 -0
  141. package/dist/tools/TaskStopTool.js +66 -0
  142. package/dist/tools/TaskStopTool.js.map +1 -0
  143. package/dist/tools/TaskUpdateTool.d.ts +79 -0
  144. package/dist/tools/TaskUpdateTool.d.ts.map +1 -0
  145. package/dist/tools/TaskUpdateTool.js +73 -0
  146. package/dist/tools/TaskUpdateTool.js.map +1 -0
  147. package/dist/tools/TodoWriteTool.d.ts +63 -0
  148. package/dist/tools/TodoWriteTool.d.ts.map +1 -0
  149. package/dist/tools/TodoWriteTool.js +79 -0
  150. package/dist/tools/TodoWriteTool.js.map +1 -0
  151. package/dist/tools/Tool.d.ts +32 -0
  152. package/dist/tools/Tool.d.ts.map +1 -0
  153. package/dist/tools/Tool.js +20 -0
  154. package/dist/tools/Tool.js.map +1 -0
  155. package/dist/tools/ToolContext.d.ts +12 -0
  156. package/dist/tools/ToolContext.d.ts.map +1 -0
  157. package/dist/tools/ToolContext.js +3 -0
  158. package/dist/tools/ToolContext.js.map +1 -0
  159. package/dist/tools/ToolSearchTool.d.ts +23 -0
  160. package/dist/tools/ToolSearchTool.d.ts.map +1 -0
  161. package/dist/tools/ToolSearchTool.js +62 -0
  162. package/dist/tools/ToolSearchTool.js.map +1 -0
  163. package/dist/tools/WebFetchTool.d.ts +29 -0
  164. package/dist/tools/WebFetchTool.d.ts.map +1 -0
  165. package/dist/tools/WebFetchTool.js +42 -0
  166. package/dist/tools/WebFetchTool.js.map +1 -0
  167. package/dist/tools/WebSearchTool.d.ts +23 -0
  168. package/dist/tools/WebSearchTool.d.ts.map +1 -0
  169. package/dist/tools/WebSearchTool.js +38 -0
  170. package/dist/tools/WebSearchTool.js.map +1 -0
  171. package/dist/tools/bash/readOnly.d.ts +7 -0
  172. package/dist/tools/bash/readOnly.d.ts.map +1 -0
  173. package/dist/tools/bash/readOnly.js +41 -0
  174. package/dist/tools/bash/readOnly.js.map +1 -0
  175. package/dist/tools/bash/sandbox.d.ts +3 -0
  176. package/dist/tools/bash/sandbox.d.ts.map +1 -0
  177. package/dist/tools/bash/sandbox.js +27 -0
  178. package/dist/tools/bash/sandbox.js.map +1 -0
  179. package/dist/tools/bash/semantic.d.ts +5 -0
  180. package/dist/tools/bash/semantic.d.ts.map +1 -0
  181. package/dist/tools/bash/semantic.js +106 -0
  182. package/dist/tools/bash/semantic.js.map +1 -0
  183. package/dist/tools/index.d.ts +26 -0
  184. package/dist/tools/index.d.ts.map +1 -0
  185. package/dist/tools/index.js +74 -0
  186. package/dist/tools/index.js.map +1 -0
  187. package/dist/utils/claudeInChrome/chromeNativeHost.d.ts +3 -0
  188. package/dist/utils/claudeInChrome/chromeNativeHost.d.ts.map +1 -0
  189. package/dist/utils/claudeInChrome/chromeNativeHost.js +376 -0
  190. package/dist/utils/claudeInChrome/chromeNativeHost.js.map +1 -0
  191. package/dist/utils/claudeInChrome/common.d.ts +32 -0
  192. package/dist/utils/claudeInChrome/common.d.ts.map +1 -0
  193. package/dist/utils/claudeInChrome/common.js +301 -0
  194. package/dist/utils/claudeInChrome/common.js.map +1 -0
  195. package/dist/utils/claudeInChrome/mcpServer.d.ts +2 -0
  196. package/dist/utils/claudeInChrome/mcpServer.d.ts.map +1 -0
  197. package/dist/utils/claudeInChrome/mcpServer.js +143 -0
  198. package/dist/utils/claudeInChrome/mcpServer.js.map +1 -0
  199. package/dist/utils/claudeInChrome/setup.d.ts +22 -0
  200. package/dist/utils/claudeInChrome/setup.d.ts.map +1 -0
  201. package/dist/utils/claudeInChrome/setup.js +202 -0
  202. package/dist/utils/claudeInChrome/setup.js.map +1 -0
  203. package/dist/utils/contextManager.d.ts +1 -1
  204. package/dist/utils/contextManager.d.ts.map +1 -1
  205. package/dist/utils/contextManager.js +1 -1
  206. package/dist/utils/contextManager.js.map +1 -1
  207. package/dist/utils/features.d.ts +3 -0
  208. package/dist/utils/features.d.ts.map +1 -0
  209. package/dist/utils/features.js +31 -0
  210. package/dist/utils/features.js.map +1 -0
  211. package/dist/utils/inputbar.d.ts +2 -2
  212. package/dist/utils/inputbar.d.ts.map +1 -1
  213. package/dist/utils/inputbar.js +7 -6
  214. package/dist/utils/inputbar.js.map +1 -1
  215. package/dist/utils/output.js +1 -1
  216. package/dist/utils/output.js.map +1 -1
  217. package/dist/utils/permissions.d.ts +18 -0
  218. package/dist/utils/permissions.d.ts.map +1 -0
  219. package/dist/utils/permissions.js +25 -0
  220. package/dist/utils/permissions.js.map +1 -0
  221. package/package.json +3 -2
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BashTool = exports.BashInputSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const child_process_1 = require("child_process");
6
+ const Tool_1 = require("./Tool");
7
+ const semantic_1 = require("./bash/semantic");
8
+ const sandbox_1 = require("./bash/sandbox");
9
+ const readOnly_1 = require("./bash/readOnly");
10
+ exports.BashInputSchema = zod_1.z.object({
11
+ command: zod_1.z.string().describe('The shell command to execute'),
12
+ description: zod_1.z.string().optional().describe('Human-readable description'),
13
+ timeout: zod_1.z.number().optional().describe('Timeout in milliseconds'),
14
+ cwd: zod_1.z.string().optional().describe('Working directory'),
15
+ });
16
+ class BashTool extends Tool_1.Tool {
17
+ constructor() {
18
+ super(...arguments);
19
+ this.name = 'Bash';
20
+ this.description = 'Execute shell commands in the terminal';
21
+ this.inputSchema = exports.BashInputSchema;
22
+ }
23
+ async execute(ctx, input) {
24
+ const { command, description, timeout, cwd } = input;
25
+ const workingDir = cwd || ctx.cwd;
26
+ const semantic = this.classifyCommand(command);
27
+ if (semantic.isReadOnly) {
28
+ const constraint = (0, readOnly_1.checkReadOnlyConstraints)(command, workingDir);
29
+ if (!constraint.allowed) {
30
+ return `[Permission Denied] ${constraint.reason}`;
31
+ }
32
+ }
33
+ const sandbox = (0, sandbox_1.shouldUseSandbox)(command);
34
+ try {
35
+ const result = await this.execCommand(command, workingDir, timeout, sandbox);
36
+ return result;
37
+ }
38
+ catch (error) {
39
+ return `[Error] ${error.message}`;
40
+ }
41
+ }
42
+ classifyCommand(command) {
43
+ return {
44
+ isSearch: (0, semantic_1.isSearchOrReadCommand)(command),
45
+ isRead: (0, semantic_1.isSearchOrReadCommand)(command),
46
+ isList: (0, semantic_1.isListCommand)(command),
47
+ isSilent: (0, semantic_1.isSilentCommand)(command),
48
+ isReadOnly: (0, semantic_1.isSearchOrReadCommand)(command) || (0, semantic_1.isListCommand)(command),
49
+ };
50
+ }
51
+ execCommand(command, cwd, timeout, sandbox) {
52
+ return new Promise((resolve, reject) => {
53
+ const isWindows = process.platform === 'win32';
54
+ const shell = isWindows ? 'cmd.exe' : '/bin/sh';
55
+ const shellArgs = isWindows ? ['/c', command] : ['-c', command];
56
+ const opts = {
57
+ cwd,
58
+ shell,
59
+ stdio: ['pipe', 'pipe', 'pipe'],
60
+ env: { ...process.env },
61
+ };
62
+ if (sandbox) {
63
+ opts.env.SANDBOX = '1';
64
+ }
65
+ const proc = (0, child_process_1.spawn)(shell, shellArgs, opts);
66
+ let stdout = '';
67
+ let stderr = '';
68
+ const timer = timeout
69
+ ? setTimeout(() => {
70
+ proc.kill('SIGTERM');
71
+ reject(new Error(`Command timed out after ${timeout}ms`));
72
+ }, timeout)
73
+ : null;
74
+ proc.stdout?.on('data', (data) => {
75
+ stdout += data.toString();
76
+ });
77
+ proc.stderr?.on('data', (data) => {
78
+ stderr += data.toString();
79
+ });
80
+ proc.on('close', (code) => {
81
+ timer?.unref();
82
+ if (code === 0) {
83
+ resolve(stdout.slice(0, 100000));
84
+ }
85
+ else {
86
+ resolve(stderr ? `[Exit code ${code}] ${stderr.slice(0, 5000)}` : `[Exit code ${code}]`);
87
+ }
88
+ });
89
+ proc.on('error', (err) => {
90
+ timer?.unref();
91
+ reject(err);
92
+ });
93
+ });
94
+ }
95
+ }
96
+ exports.BashTool = BashTool;
97
+ //# sourceMappingURL=BashTool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BashTool.js","sourceRoot":"","sources":["../../src/tools/BashTool.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,iDAAyD;AAGzD,iCAAgD;AAChD,8CAAwF;AACxF,4CAAkD;AAClD,8CAA2D;AAE9C,QAAA,eAAe,GAAG,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,CAAC;gBACf,MAAM,CAAC,GAAG,CAAC,CAAC;YACd,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAnGD,4BAmGC"}
@@ -0,0 +1,23 @@
1
+ import { z } from 'zod';
2
+ import { Tool, type ToolContext } from './Tool';
3
+ export declare const BriefInputSchema: z.ZodObject<{
4
+ query: z.ZodString;
5
+ }, "strip", z.ZodTypeAny, {
6
+ query?: string;
7
+ }, {
8
+ query?: string;
9
+ }>;
10
+ export type BriefInput = z.infer<typeof BriefInputSchema>;
11
+ export declare class BriefTool extends Tool<BriefInput, string> {
12
+ name: string;
13
+ description: string;
14
+ inputSchema: z.ZodObject<{
15
+ query: z.ZodString;
16
+ }, "strip", z.ZodTypeAny, {
17
+ query?: string;
18
+ }, {
19
+ query?: string;
20
+ }>;
21
+ execute(ctx: ToolContext, input: BriefInput): Promise<string>;
22
+ }
23
+ //# sourceMappingURL=BriefTool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BriefTool.d.ts","sourceRoot":"","sources":["../../src/tools/BriefTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,IAAI,EAAE,KAAK,WAAW,EAAE,MAAM,QAAQ,CAAC;AAEhD,eAAO,MAAM,gBAAgB;;;;;;EAE3B,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,qBAAa,SAAU,SAAQ,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC;IACrD,IAAI,SAAW;IACf,WAAW,SAA4C;IACvD,WAAW;;;;;;OAAoB;IAEzB,OAAO,CAAC,GAAG,EAAE,WAAW,EAAE,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC;CASpE"}
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.BriefTool = exports.BriefInputSchema = void 0;
37
+ const zod_1 = require("zod");
38
+ const Tool_1 = require("./Tool");
39
+ exports.BriefInputSchema = zod_1.z.object({
40
+ query: zod_1.z.string().describe('Search query'),
41
+ });
42
+ class BriefTool extends Tool_1.Tool {
43
+ constructor() {
44
+ super(...arguments);
45
+ this.name = 'Brief';
46
+ this.description = 'Quick web search for brief information';
47
+ this.inputSchema = exports.BriefInputSchema;
48
+ }
49
+ async execute(ctx, input) {
50
+ try {
51
+ const { WebSearchInputSchema } = await Promise.resolve().then(() => __importStar(require('./WebSearchTool')));
52
+ const webSearchTool = new (await Promise.resolve().then(() => __importStar(require('./WebSearchTool')))).WebSearchTool();
53
+ return await webSearchTool.execute(ctx, { query: input.query });
54
+ }
55
+ catch (error) {
56
+ return `[Error] ${error.message}`;
57
+ }
58
+ }
59
+ }
60
+ exports.BriefTool = BriefTool;
61
+ //# sourceMappingURL=BriefTool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BriefTool.js","sourceRoot":"","sources":["../../src/tools/BriefTool.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6BAAwB;AACxB,iCAAgD;AAEnC,QAAA,gBAAgB,GAAG,OAAC,CAAC,MAAM,CAAC;IACvC,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,cAAc,CAAC;CAC3C,CAAC,CAAC;AAIH,MAAa,SAAU,SAAQ,WAAwB;IAAvD;;QACE,SAAI,GAAG,OAAO,CAAC;QACf,gBAAW,GAAG,wCAAwC,CAAC;QACvD,gBAAW,GAAG,wBAAgB,CAAC;IAWjC,CAAC;IATC,KAAK,CAAC,OAAO,CAAC,GAAgB,EAAE,KAAiB;QAC/C,IAAI,CAAC;YACH,MAAM,EAAE,oBAAoB,EAAE,GAAG,wDAAa,iBAAiB,GAAC,CAAC;YACjE,MAAM,aAAa,GAAG,IAAI,CAAC,wDAAa,iBAAiB,GAAC,CAAC,CAAC,aAAa,EAAE,CAAC;YAC5E,OAAO,MAAM,aAAa,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;QAClE,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,OAAO,WAAW,KAAK,CAAC,OAAO,EAAE,CAAC;QACpC,CAAC;IACH,CAAC;CACF;AAdD,8BAcC"}
@@ -0,0 +1,35 @@
1
+ import { z } from 'zod';
2
+ import { Tool, type ToolContext } from './Tool';
3
+ export declare const ConfigInputSchema: z.ZodObject<{
4
+ action: z.ZodEnum<["get", "set", "list"]>;
5
+ key: z.ZodOptional<z.ZodString>;
6
+ value: z.ZodOptional<z.ZodString>;
7
+ }, "strip", z.ZodTypeAny, {
8
+ key?: string;
9
+ value?: string;
10
+ action?: "get" | "set" | "list";
11
+ }, {
12
+ key?: string;
13
+ value?: string;
14
+ action?: "get" | "set" | "list";
15
+ }>;
16
+ export type ConfigInput = z.infer<typeof ConfigInputSchema>;
17
+ export declare class ConfigTool extends Tool<ConfigInput, string> {
18
+ name: string;
19
+ description: string;
20
+ inputSchema: z.ZodObject<{
21
+ action: z.ZodEnum<["get", "set", "list"]>;
22
+ key: z.ZodOptional<z.ZodString>;
23
+ value: z.ZodOptional<z.ZodString>;
24
+ }, "strip", z.ZodTypeAny, {
25
+ key?: string;
26
+ value?: string;
27
+ action?: "get" | "set" | "list";
28
+ }, {
29
+ key?: string;
30
+ value?: string;
31
+ action?: "get" | "set" | "list";
32
+ }>;
33
+ execute(ctx: ToolContext, input: ConfigInput): Promise<string>;
34
+ }
35
+ //# sourceMappingURL=ConfigTool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConfigTool.d.ts","sourceRoot":"","sources":["../../src/tools/ConfigTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,IAAI,EAAE,KAAK,WAAW,EAAE,MAAM,QAAQ,CAAC;AAKhD,eAAO,MAAM,iBAAiB;;;;;;;;;;;;EAI5B,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D,qBAAa,UAAW,SAAQ,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC;IACvD,IAAI,SAAY;IAChB,WAAW,SAAsC;IACjD,WAAW;;;;;;;;;;;;OAAqB;IAE1B,OAAO,CAAC,GAAG,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC;CA0BrE"}
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.ConfigTool = exports.ConfigInputSchema = void 0;
37
+ const zod_1 = require("zod");
38
+ const Tool_1 = require("./Tool");
39
+ const fs = __importStar(require("fs/promises"));
40
+ const path = __importStar(require("path"));
41
+ const os = __importStar(require("os"));
42
+ exports.ConfigInputSchema = zod_1.z.object({
43
+ action: zod_1.z.enum(['get', 'set', 'list']).describe('Config action'),
44
+ key: zod_1.z.string().optional().describe('Config key'),
45
+ value: zod_1.z.string().optional().describe('Config value'),
46
+ });
47
+ class ConfigTool extends Tool_1.Tool {
48
+ constructor() {
49
+ super(...arguments);
50
+ this.name = 'Config';
51
+ this.description = 'Get or set configuration options';
52
+ this.inputSchema = exports.ConfigInputSchema;
53
+ }
54
+ async execute(ctx, input) {
55
+ const configPath = path.join(os.homedir(), '.coworker', 'settings.json');
56
+ try {
57
+ const content = await fs.readFile(configPath, 'utf8');
58
+ const config = JSON.parse(content);
59
+ switch (input.action) {
60
+ case 'get':
61
+ return JSON.stringify(config[input.key || ''], null, 2);
62
+ case 'set':
63
+ if (input.key && input.value) {
64
+ config[input.key] = input.value;
65
+ await fs.writeFile(configPath, JSON.stringify(config, null, 2));
66
+ return `Set ${input.key} = ${input.value}`;
67
+ }
68
+ return '[Error] key and value required for set';
69
+ case 'list':
70
+ return JSON.stringify(config, null, 2);
71
+ default:
72
+ return '[Error] Invalid action';
73
+ }
74
+ }
75
+ catch (error) {
76
+ return `[Error] ${error.message}`;
77
+ }
78
+ }
79
+ }
80
+ exports.ConfigTool = ConfigTool;
81
+ //# sourceMappingURL=ConfigTool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConfigTool.js","sourceRoot":"","sources":["../../src/tools/ConfigTool.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6BAAwB;AACxB,iCAAgD;AAChD,gDAAkC;AAClC,2CAA6B;AAC7B,uCAAyB;AAEZ,QAAA,iBAAiB,GAAG,OAAC,CAAC,MAAM,CAAC;IACxC,MAAM,EAAE,OAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,eAAe,CAAC;IAChE,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,YAAY,CAAC;IACjD,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,cAAc,CAAC;CACtD,CAAC,CAAC;AAIH,MAAa,UAAW,SAAQ,WAAyB;IA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AAK,CAAC,OAAO,EAAE,CAAC;QACpC,CAAC;IACH,CAAC;CACF;AA/BD,gCA+BC"}
@@ -0,0 +1,23 @@
1
+ import { z } from 'zod';
2
+ import { Tool, type ToolContext } from './Tool';
3
+ export declare const EnterPlanModeInputSchema: z.ZodObject<{
4
+ prompt: z.ZodString;
5
+ }, "strip", z.ZodTypeAny, {
6
+ prompt?: string;
7
+ }, {
8
+ prompt?: string;
9
+ }>;
10
+ export type EnterPlanModeInput = z.infer<typeof EnterPlanModeInputSchema>;
11
+ export declare class EnterPlanModeTool extends Tool<EnterPlanModeInput, string> {
12
+ name: string;
13
+ description: string;
14
+ inputSchema: z.ZodObject<{
15
+ prompt: z.ZodString;
16
+ }, "strip", z.ZodTypeAny, {
17
+ prompt?: string;
18
+ }, {
19
+ prompt?: string;
20
+ }>;
21
+ execute(ctx: ToolContext, input: EnterPlanModeInput): Promise<string>;
22
+ }
23
+ //# sourceMappingURL=EnterPlanModeTool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EnterPlanModeTool.d.ts","sourceRoot":"","sources":["../../src/tools/EnterPlanModeTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,IAAI,EAAE,KAAK,WAAW,EAAE,MAAM,QAAQ,CAAC;AAEhD,eAAO,MAAM,wBAAwB;;;;;;EAEnC,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E,qBAAa,iBAAkB,SAAQ,IAAI,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACrE,IAAI,SAAmB;IACvB,WAAW,SAAoD;IAC/D,WAAW;;;;;;OAA4B;IAEjC,OAAO,CAAC,GAAG,EAAE,WAAW,EAAE,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;CAG5E"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EnterPlanModeTool = exports.EnterPlanModeInputSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const Tool_1 = require("./Tool");
6
+ exports.EnterPlanModeInputSchema = zod_1.z.object({
7
+ prompt: zod_1.z.string().describe('Reason for entering plan mode'),
8
+ });
9
+ class EnterPlanModeTool extends Tool_1.Tool {
10
+ constructor() {
11
+ super(...arguments);
12
+ this.name = 'EnterPlanMode';
13
+ this.description = 'Switch to plan mode for making complex changes';
14
+ this.inputSchema = exports.EnterPlanModeInputSchema;
15
+ }
16
+ async execute(ctx, input) {
17
+ return `Switching to plan mode. Reason: ${input.prompt}`;
18
+ }
19
+ }
20
+ exports.EnterPlanModeTool = EnterPlanModeTool;
21
+ //# sourceMappingURL=EnterPlanModeTool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EnterPlanModeTool.js","sourceRoot":"","sources":["../../src/tools/EnterPlanModeTool.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,iCAAgD;AAEnC,QAAA,wBAAwB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC/C,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,+BAA+B,CAAC;CAC7D,CAAC,CAAC;AAIH,MAAa,iBAAkB,SAAQ,WAAgC;IAAvE;;QACE,SAAI,GAAG,eAAe,CAAC;QACvB,gBAAW,GAAG,gDAAgD,CAAC;QAC/D,gBAAW,GAAG,gCAAwB,CAAC;IAKzC,CAAC;IAHC,KAAK,CAAC,OAAO,CAAC,GAAgB,EAAE,KAAyB;QACvD,OAAO,mCAAmC,KAAK,CAAC,MAAM,EAAE,CAAC;IAC3D,CAAC;CACF;AARD,8CAQC"}
@@ -0,0 +1,23 @@
1
+ import { z } from 'zod';
2
+ import { Tool, type ToolContext } from './Tool';
3
+ export declare const ExitPlanModeInputSchema: z.ZodObject<{
4
+ reason: z.ZodOptional<z.ZodString>;
5
+ }, "strip", z.ZodTypeAny, {
6
+ reason?: string;
7
+ }, {
8
+ reason?: string;
9
+ }>;
10
+ export type ExitPlanModeInput = z.infer<typeof ExitPlanModeInputSchema>;
11
+ export declare class ExitPlanModeTool extends Tool<ExitPlanModeInput, string> {
12
+ name: string;
13
+ description: string;
14
+ inputSchema: z.ZodObject<{
15
+ reason: z.ZodOptional<z.ZodString>;
16
+ }, "strip", z.ZodTypeAny, {
17
+ reason?: string;
18
+ }, {
19
+ reason?: string;
20
+ }>;
21
+ execute(ctx: ToolContext, input: ExitPlanModeInput): Promise<string>;
22
+ }
23
+ //# sourceMappingURL=ExitPlanModeTool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExitPlanModeTool.d.ts","sourceRoot":"","sources":["../../src/tools/ExitPlanModeTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,IAAI,EAAE,KAAK,WAAW,EAAE,MAAM,QAAQ,CAAC;AAEhD,eAAO,MAAM,uBAAuB;;;;;;EAElC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE,qBAAa,gBAAiB,SAAQ,IAAI,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnE,IAAI,SAAkB;IACtB,WAAW,SAA6C;IACxD,WAAW;;;;;;OAA2B;IAEhC,OAAO,CAAC,GAAG,EAAE,WAAW,EAAE,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC;CAG3E"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ExitPlanModeTool = exports.ExitPlanModeInputSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const Tool_1 = require("./Tool");
6
+ exports.ExitPlanModeInputSchema = zod_1.z.object({
7
+ reason: zod_1.z.string().optional().describe('Reason for exiting plan mode'),
8
+ });
9
+ class ExitPlanModeTool extends Tool_1.Tool {
10
+ constructor() {
11
+ super(...arguments);
12
+ this.name = 'ExitPlanMode';
13
+ this.description = 'Exit plan mode and return to build mode';
14
+ this.inputSchema = exports.ExitPlanModeInputSchema;
15
+ }
16
+ async execute(ctx, input) {
17
+ return `Exited plan mode. Reason: ${input.reason || 'User requested'}`;
18
+ }
19
+ }
20
+ exports.ExitPlanModeTool = ExitPlanModeTool;
21
+ //# sourceMappingURL=ExitPlanModeTool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExitPlanModeTool.js","sourceRoot":"","sources":["../../src/tools/ExitPlanModeTool.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,iCAAgD;AAEnC,QAAA,uBAAuB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC9C,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,8BAA8B,CAAC;CACvE,CAAC,CAAC;AAIH,MAAa,gBAAiB,SAAQ,WAA+B;IAArE;;QACE,SAAI,GAAG,cAAc,CAAC;QACtB,gBAAW,GAAG,yCAAyC,CAAC;QACxD,gBAAW,GAAG,+BAAuB,CAAC;IAKxC,CAAC;IAHC,KAAK,CAAC,OAAO,CAAC,GAAgB,EAAE,KAAwB;QACtD,OAAO,6BAA6B,KAAK,CAAC,MAAM,IAAI,gBAAgB,EAAE,CAAC;IACzE,CAAC;CACF;AARD,4CAQC"}
@@ -0,0 +1,41 @@
1
+ import { z } from 'zod';
2
+ import { Tool, type ToolContext } from './Tool';
3
+ export declare const FileEditInputSchema: z.ZodObject<{
4
+ file_path: z.ZodString;
5
+ old_string: z.ZodString;
6
+ new_string: z.ZodString;
7
+ replace_all: z.ZodOptional<z.ZodBoolean>;
8
+ }, "strip", z.ZodTypeAny, {
9
+ file_path?: string;
10
+ old_string?: string;
11
+ new_string?: string;
12
+ replace_all?: boolean;
13
+ }, {
14
+ file_path?: string;
15
+ old_string?: string;
16
+ new_string?: string;
17
+ replace_all?: boolean;
18
+ }>;
19
+ export type FileEditInput = z.infer<typeof FileEditInputSchema>;
20
+ export declare class FileEditTool extends Tool<FileEditInput, string> {
21
+ name: string;
22
+ description: string;
23
+ inputSchema: z.ZodObject<{
24
+ file_path: z.ZodString;
25
+ old_string: z.ZodString;
26
+ new_string: z.ZodString;
27
+ replace_all: z.ZodOptional<z.ZodBoolean>;
28
+ }, "strip", z.ZodTypeAny, {
29
+ file_path?: string;
30
+ old_string?: string;
31
+ new_string?: string;
32
+ replace_all?: boolean;
33
+ }, {
34
+ file_path?: string;
35
+ old_string?: string;
36
+ new_string?: string;
37
+ replace_all?: boolean;
38
+ }>;
39
+ execute(ctx: ToolContext, input: FileEditInput): Promise<string>;
40
+ }
41
+ //# sourceMappingURL=FileEditTool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileEditTool.d.ts","sourceRoot":"","sources":["../../src/tools/FileEditTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,IAAI,EAAE,KAAK,WAAW,EAAE,MAAM,QAAQ,CAAC;AAEhD,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;EAK9B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,qBAAa,YAAa,SAAQ,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC;IAC3D,IAAI,SAAU;IACd,WAAW,SAA4C;IACvD,WAAW;;;;;;;;;;;;;;;OAAuB;IAE5B,OAAO,CAAC,GAAG,EAAE,WAAW,EAAE,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC;CA0BvE"}
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.FileEditTool = exports.FileEditInputSchema = void 0;
37
+ const zod_1 = require("zod");
38
+ const fs = __importStar(require("fs/promises"));
39
+ const path = __importStar(require("path"));
40
+ const Tool_1 = require("./Tool");
41
+ exports.FileEditInputSchema = zod_1.z.object({
42
+ file_path: zod_1.z.string().describe('Path to file to edit'),
43
+ old_string: zod_1.z.string().describe('Text to find and replace'),
44
+ new_string: zod_1.z.string().describe('Text to replace it with'),
45
+ replace_all: zod_1.z.boolean().optional().describe('Replace all occurrences'),
46
+ });
47
+ class FileEditTool extends Tool_1.Tool {
48
+ constructor() {
49
+ super(...arguments);
50
+ this.name = 'Edit';
51
+ this.description = 'Edit a file by replacing specific text';
52
+ this.inputSchema = exports.FileEditInputSchema;
53
+ }
54
+ async execute(ctx, input) {
55
+ try {
56
+ const { file_path, old_string, new_string, replace_all } = input;
57
+ const fullPath = path.resolve(ctx.cwd, file_path);
58
+ let content = await fs.readFile(fullPath, 'utf-8');
59
+ if (replace_all) {
60
+ if (!content.includes(old_string)) {
61
+ return `[Error] Pattern not found: ${old_string}`;
62
+ }
63
+ content = content.split(old_string).join(new_string);
64
+ }
65
+ else {
66
+ if (!content.includes(old_string)) {
67
+ return `[Error] Pattern not found: ${old_string}`;
68
+ }
69
+ const index = content.indexOf(old_string);
70
+ content = content.slice(0, index) + new_string + content.slice(index + old_string.length);
71
+ }
72
+ await fs.writeFile(fullPath, content, 'utf-8');
73
+ return `[Done] Edited ${file_path}`;
74
+ }
75
+ catch (error) {
76
+ return `[Error] ${error.message}`;
77
+ }
78
+ }
79
+ }
80
+ exports.FileEditTool = FileEditTool;
81
+ //# sourceMappingURL=FileEditTool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileEditTool.js","sourceRoot":"","sources":["../../src/tools/FileEditTool.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6BAAwB;AACxB,gDAAkC;AAClC,2CAA6B;AAC7B,iCAAgD;AAEnC,QAAA,mBAAmB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC1C,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,sBAAsB,CAAC;IACtD,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,0BAA0B,CAAC;IAC3D,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,yBAAyB,CAAC;IAC1D,WAAW,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,yBAAyB,CAAC;CACxE,CAAC,CAAC;AAIH,MAAa,YAAa,SAAQ,WAA2B;IAA7D;;QACE,SAAI,GAAG,MAAM,CAAC;QACd,gBAAW,GAAG,wCAAw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,CAAC;CACF;AA/BD,oCA+BC"}
@@ -0,0 +1,35 @@
1
+ import { z } from 'zod';
2
+ import { Tool, type ToolContext } from './Tool';
3
+ export declare const FileReadInputSchema: z.ZodObject<{
4
+ file_path: z.ZodString;
5
+ offset: z.ZodOptional<z.ZodNumber>;
6
+ limit: z.ZodOptional<z.ZodNumber>;
7
+ }, "strip", z.ZodTypeAny, {
8
+ file_path?: string;
9
+ offset?: number;
10
+ limit?: number;
11
+ }, {
12
+ file_path?: string;
13
+ offset?: number;
14
+ limit?: number;
15
+ }>;
16
+ export type FileReadInput = z.infer<typeof FileReadInputSchema>;
17
+ export declare class FileReadTool extends Tool<FileReadInput, string> {
18
+ name: string;
19
+ description: string;
20
+ inputSchema: z.ZodObject<{
21
+ file_path: z.ZodString;
22
+ offset: z.ZodOptional<z.ZodNumber>;
23
+ limit: z.ZodOptional<z.ZodNumber>;
24
+ }, "strip", z.ZodTypeAny, {
25
+ file_path?: string;
26
+ offset?: number;
27
+ limit?: number;
28
+ }, {
29
+ file_path?: string;
30
+ offset?: number;
31
+ limit?: number;
32
+ }>;
33
+ execute(ctx: ToolContext, input: FileReadInput): Promise<string>;
34
+ }
35
+ //# sourceMappingURL=FileReadTool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileReadTool.d.ts","sourceRoot":"","sources":["../../src/tools/FileReadTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,IAAI,EAAE,KAAK,WAAW,EAAE,MAAM,QAAQ,CAAC;AAEhD,eAAO,MAAM,mBAAmB;;;;;;;;;;;;EAI9B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,qBAAa,YAAa,SAAQ,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC;IAC3D,IAAI,SAAU;IACd,WAAW,SAAiC;IAC5C,WAAW;;;;;;;;;;;;OAAuB;IAE5B,OAAO,CAAC,GAAG,EAAE,WAAW,EAAE,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC;CAuBvE"}