maestro-agent-sdk 0.1.25 → 0.1.26

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 (50) hide show
  1. package/README.md +11 -264
  2. package/dist/core/agent.d.ts +3 -1
  3. package/dist/core/agent.d.ts.map +1 -1
  4. package/dist/core/agent.js +5 -1
  5. package/dist/core/agent.js.map +1 -1
  6. package/dist/index.d.ts +0 -1
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +0 -1
  9. package/dist/index.js.map +1 -1
  10. package/dist/mcp/pool-cache.d.ts.map +1 -1
  11. package/dist/mcp/pool-cache.js +7 -1
  12. package/dist/mcp/pool-cache.js.map +1 -1
  13. package/dist/provider.d.ts +28 -22
  14. package/dist/provider.d.ts.map +1 -1
  15. package/dist/provider.js +54 -35
  16. package/dist/provider.js.map +1 -1
  17. package/dist/state/tasks.d.ts +10 -0
  18. package/dist/state/tasks.d.ts.map +1 -1
  19. package/dist/state/tasks.js +6 -0
  20. package/dist/state/tasks.js.map +1 -1
  21. package/dist/sub-agent/runner.d.ts.map +1 -1
  22. package/dist/sub-agent/runner.js +3 -8
  23. package/dist/sub-agent/runner.js.map +1 -1
  24. package/dist/tools/builtin/agent.d.ts +1 -1
  25. package/dist/tools/builtin/agent.js +1 -1
  26. package/dist/tools/builtin/agent.js.map +1 -1
  27. package/dist/tools/builtin/ask_user_question.d.ts +24 -0
  28. package/dist/tools/builtin/ask_user_question.d.ts.map +1 -0
  29. package/dist/tools/builtin/ask_user_question.js +67 -0
  30. package/dist/tools/builtin/ask_user_question.js.map +1 -0
  31. package/dist/tools/builtin/tasks.d.ts +20 -4
  32. package/dist/tools/builtin/tasks.d.ts.map +1 -1
  33. package/dist/tools/builtin/tasks.js +99 -1
  34. package/dist/tools/builtin/tasks.js.map +1 -1
  35. package/dist/tools/file-state.d.ts +1 -1
  36. package/dist/tools/file-state.d.ts.map +1 -1
  37. package/dist/tools/file-state.js.map +1 -1
  38. package/dist/tools/index.d.ts +1 -2
  39. package/dist/tools/index.d.ts.map +1 -1
  40. package/dist/tools/index.js +1 -2
  41. package/dist/tools/index.js.map +1 -1
  42. package/dist/tools/path-guard.d.ts +1 -1
  43. package/dist/tools/path-guard.js +2 -2
  44. package/dist/types.d.ts +19 -14
  45. package/dist/types.d.ts.map +1 -1
  46. package/package.json +1 -1
  47. package/dist/tools/builtin/multi_edit.d.ts +0 -16
  48. package/dist/tools/builtin/multi_edit.d.ts.map +0 -1
  49. package/dist/tools/builtin/multi_edit.js +0 -292
  50. package/dist/tools/builtin/multi_edit.js.map +0 -1
@@ -1,292 +0,0 @@
1
- import { existsSync, readFileSync, statSync, writeFileSync } from "node:fs";
2
- import { isAbsolute, normalize } from "node:path";
3
- import { countOccurrences } from "../../tools/builtin/edit.js";
4
- import { checkBlockedPath } from "../../tools/path-guard.js";
5
- /**
6
- * MultiEdit builtin — claude SDK `MultiEdit` tool parity for maestro.
7
- *
8
- * Applies an ordered list of (old_string, new_string) replacements to a
9
- * single file **atomically**. The contract that makes this tool valuable:
10
- *
11
- * 1. Read the file once.
12
- * 2. Apply edits sequentially to the in-memory buffer — each edit sees
13
- * the state left by the previous one (so a follow-up edit can target
14
- * text inserted by the previous step).
15
- * 3. If ANY edit fails (`old_string` not found, ambiguous match without
16
- * `replace_all`, no-op replacement) we abort BEFORE writing. The
17
- * file on disk is left untouched. The model then sees a structured
18
- * `failedAt: <index>` payload it can react to without having to
19
- * reason about which earlier edits did or didn't land.
20
- * 4. Only after all edits succeed do we write once.
21
- *
22
- * Why a separate tool (rather than have the model call `Edit` in a loop):
23
- *
24
- * - Halves API round-trips for the common "fix N spots in one file"
25
- * refactor — the model emits one tool call instead of N.
26
- * - Atomic-by-default eliminates a real class of bug where edit #3 of
27
- * 5 fails and the file is left with edits 1–2 applied but the model
28
- * thinks the whole batch is done.
29
- * - The Read-before-Edit gate fires once for the whole batch instead
30
- * of forcing a re-Read between each step.
31
- *
32
- * Same constraints as Edit:
33
- * - file_path must be absolute.
34
- * - File must exist (MultiEdit never creates — use Write for that).
35
- * - Each edit's `old_string` must occur exactly once in the current
36
- * buffer unless `replace_all: true` is passed for that edit.
37
- * - `old_string === new_string` is rejected as a no-op.
38
- * - 10MB cap on file size (matches Edit / Read).
39
- *
40
- * Returns a short summary (`File edited: <path> (N edits, M total replacements)`)
41
- * followed by a line-numbered preview of the region around the first edit's
42
- * new_string — same shape Edit returns post-edit, kept consistent so the
43
- * model's verification instinct transfers.
44
- */
45
- const MAX_FILE_BYTES = 10 * 1024 * 1024; // 10MB — same cap as Read / Edit
46
- const MAX_EDITS = 64; // ceiling on edits per call; prevents pathological batches
47
- const PREVIEW_LINES_AROUND = 3;
48
- export function createMultiEditTool(opts = {}) {
49
- const { tracker } = opts;
50
- return {
51
- schema: {
52
- name: "MultiEdit",
53
- description: "Apply multiple find-and-replace edits to a single file atomically. " +
54
- "Each `edits[i].old_string` is matched against the buffer state left " +
55
- "by the previous edit, so chained edits can target inserted text. " +
56
- "If any edit fails (not found, ambiguous, or no-op) the file is left " +
57
- "untouched and a `failedAt` index is returned. file_path must be " +
58
- "absolute and the file must already exist (use Write for new files).",
59
- input_schema: {
60
- type: "object",
61
- properties: {
62
- file_path: {
63
- type: "string",
64
- description: "Absolute path to the file. MultiEdit never creates new files.",
65
- },
66
- edits: {
67
- type: "array",
68
- description: "Ordered list of edits to apply. Capped at 64 entries per call. " +
69
- "Each edit obeys the same uniqueness contract as the single-Edit tool " +
70
- "unless its own `replace_all: true` is set.",
71
- items: {
72
- type: "object",
73
- properties: {
74
- old_string: {
75
- type: "string",
76
- description: "Exact text to find in the current buffer. Must be non-empty.",
77
- },
78
- new_string: {
79
- type: "string",
80
- description: "Replacement text. Must differ from old_string.",
81
- },
82
- replace_all: {
83
- type: "boolean",
84
- description: "When true, replace every occurrence in the current buffer. " +
85
- "Default false (unique-match required).",
86
- },
87
- },
88
- required: ["old_string", "new_string"],
89
- },
90
- },
91
- },
92
- required: ["file_path", "edits"],
93
- },
94
- },
95
- async execute(input) {
96
- // normalize() collapses `..` segments before the isAbsolute guard so
97
- // that path traversal (e.g. /safe/../etc/passwd) cannot bypass it.
98
- const filePath = normalize(typeof input.file_path === "string" ? input.file_path : "");
99
- if (!filePath) {
100
- return JSON.stringify({ error: "MultiEdit: missing 'file_path' argument" });
101
- }
102
- if (!isAbsolute(filePath)) {
103
- return JSON.stringify({
104
- error: `MultiEdit: file_path must be absolute, got '${filePath}'`,
105
- });
106
- }
107
- const blockErr = checkBlockedPath("MultiEdit", filePath);
108
- if (blockErr)
109
- return JSON.stringify({ error: blockErr });
110
- // Read-before-Edit gate. Fires once for the whole batch.
111
- if (tracker) {
112
- const gateErr = tracker.checkBeforeMutate(filePath, "MultiEdit");
113
- if (gateErr) {
114
- return JSON.stringify({ error: gateErr });
115
- }
116
- }
117
- const rawEdits = input.edits;
118
- if (!Array.isArray(rawEdits) || rawEdits.length === 0) {
119
- return JSON.stringify({
120
- error: "MultiEdit: 'edits' must be a non-empty array",
121
- });
122
- }
123
- if (rawEdits.length > MAX_EDITS) {
124
- return JSON.stringify({
125
- error: `MultiEdit: 'edits' length ${rawEdits.length} exceeds cap of ${MAX_EDITS}. Split into multiple calls.`,
126
- });
127
- }
128
- // Validate every edit up-front so we don't perform a partial dry-run
129
- // before realising one edit is malformed. The validation block only
130
- // checks shape — the per-edit `old_string` existence check happens
131
- // during the apply loop because it depends on prior edits.
132
- const edits = [];
133
- for (let i = 0; i < rawEdits.length; i++) {
134
- const e = rawEdits[i];
135
- if (e === null || typeof e !== "object" || Array.isArray(e)) {
136
- return JSON.stringify({
137
- error: `MultiEdit: edit[${i}] must be an object`,
138
- });
139
- }
140
- const rec = e;
141
- if (typeof rec.old_string !== "string") {
142
- return JSON.stringify({
143
- error: `MultiEdit: edit[${i}].old_string must be a string, got ${typeof rec.old_string}`,
144
- });
145
- }
146
- if (typeof rec.new_string !== "string") {
147
- return JSON.stringify({
148
- error: `MultiEdit: edit[${i}].new_string must be a string, got ${typeof rec.new_string}`,
149
- });
150
- }
151
- if (rec.old_string.length === 0) {
152
- return JSON.stringify({
153
- error: `MultiEdit: edit[${i}].old_string must be non-empty`,
154
- });
155
- }
156
- if (rec.old_string === rec.new_string) {
157
- return JSON.stringify({
158
- error: `MultiEdit: edit[${i}] is a no-op (old_string === new_string)`,
159
- });
160
- }
161
- edits.push({
162
- old_string: rec.old_string,
163
- new_string: rec.new_string,
164
- replace_all: Boolean(rec.replace_all),
165
- });
166
- }
167
- if (!existsSync(filePath)) {
168
- return JSON.stringify({
169
- error: `MultiEdit: file does not exist: ${filePath}. Use Write to create new files.`,
170
- });
171
- }
172
- let stat;
173
- try {
174
- stat = statSync(filePath);
175
- }
176
- catch (e) {
177
- return JSON.stringify({
178
- error: `MultiEdit: stat failed: ${e instanceof Error ? e.message : String(e)}`,
179
- });
180
- }
181
- if (stat.isDirectory()) {
182
- return JSON.stringify({
183
- error: `MultiEdit: '${filePath}' is a directory, not a file.`,
184
- });
185
- }
186
- if (stat.size > MAX_FILE_BYTES) {
187
- return JSON.stringify({
188
- error: `MultiEdit: file size ${stat.size} exceeds 10MB cap. Use bash sed/awk for large files.`,
189
- });
190
- }
191
- let raw;
192
- try {
193
- raw = readFileSync(filePath, "utf-8");
194
- }
195
- catch (e) {
196
- return JSON.stringify({
197
- error: `MultiEdit: read failed: ${e instanceof Error ? e.message : String(e)}`,
198
- });
199
- }
200
- // Apply edits sequentially to an in-memory buffer. Each edit sees the
201
- // state left by the previous one. Any failure aborts the whole batch —
202
- // the file on disk is untouched and we return `failedAt: <index>` so
203
- // the model can pinpoint where the cascade broke.
204
- let buffer = raw;
205
- let totalReplacements = 0;
206
- let firstEditNewString = null;
207
- for (let i = 0; i < edits.length; i++) {
208
- const { old_string, new_string, replace_all } = edits[i];
209
- const occurrences = countOccurrences(buffer, old_string);
210
- if (occurrences === 0) {
211
- return JSON.stringify({
212
- error: `MultiEdit: edit[${i}].old_string not found in current buffer ` +
213
- "(may have been consumed by an earlier edit, or never present).",
214
- failedAt: i,
215
- });
216
- }
217
- if (!replace_all && occurrences > 1) {
218
- return JSON.stringify({
219
- error: `MultiEdit: edit[${i}].old_string appears ${occurrences} times. ` +
220
- "Enlarge old_string for uniqueness, or set replace_all=true on this edit.",
221
- failedAt: i,
222
- occurrences,
223
- });
224
- }
225
- if (replace_all) {
226
- buffer = buffer.split(old_string).join(new_string);
227
- totalReplacements += occurrences;
228
- }
229
- else {
230
- const idx = buffer.indexOf(old_string);
231
- buffer = buffer.slice(0, idx) + new_string + buffer.slice(idx + old_string.length);
232
- totalReplacements += 1;
233
- }
234
- if (firstEditNewString === null && new_string.length > 0) {
235
- firstEditNewString = new_string;
236
- }
237
- }
238
- try {
239
- writeFileSync(filePath, buffer, "utf-8");
240
- }
241
- catch (e) {
242
- return JSON.stringify({
243
- error: `MultiEdit: write failed: ${e instanceof Error ? e.message : String(e)}`,
244
- });
245
- }
246
- tracker?.forget(filePath);
247
- const preview = firstEditNewString
248
- ? buildPreview(buffer, firstEditNewString)
249
- : "[change preview unavailable]";
250
- const editCount = edits.length;
251
- return [
252
- `File edited: ${filePath} (${editCount} edit${editCount === 1 ? "" : "s"}, ` +
253
- `${totalReplacements} total replacement${totalReplacements === 1 ? "" : "s"})`,
254
- "",
255
- preview,
256
- ].join("\n");
257
- },
258
- };
259
- }
260
- /** Backwards-compatible singleton (no tracker — Read-before-Edit gate off). */
261
- export const multiEditTool = createMultiEditTool();
262
- /**
263
- * Build a line-numbered preview of the buffer around the first occurrence
264
- * of `marker`. Same shape as Edit's post-edit preview so the model's
265
- * verification habit transfers.
266
- */
267
- function buildPreview(buffer, marker) {
268
- const idx = buffer.indexOf(marker);
269
- if (idx < 0)
270
- return "";
271
- const allLines = buffer.split("\n");
272
- let acc = 0;
273
- let changedLine = 0;
274
- for (let i = 0; i < allLines.length; i++) {
275
- const next = acc + allLines[i].length + 1; // +1 for the dropped \n
276
- if (next > idx) {
277
- changedLine = i;
278
- break;
279
- }
280
- acc = next;
281
- }
282
- const start = Math.max(0, changedLine - PREVIEW_LINES_AROUND);
283
- const end = Math.min(allLines.length, changedLine + PREVIEW_LINES_AROUND + 1);
284
- return allLines
285
- .slice(start, end)
286
- .map((line, i) => `${String(start + i + 1).padStart(6, " ")}\t${line}`)
287
- .join("\n");
288
- }
289
- // Internal exports for tests.
290
- export const __MAX_FILE_BYTES = MAX_FILE_BYTES;
291
- export const __MAX_EDITS = MAX_EDITS;
292
- //# sourceMappingURL=multi_edit.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"multi_edit.js","sourceRoot":"","sources":["../../../src/tools/builtin/multi_edit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAc,QAAQ,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxF,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,MAAM,cAAc,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,iCAAiC;AAC1E,MAAM,SAAS,GAAG,EAAE,CAAC,CAAC,2DAA2D;AACjF,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAiB/B,MAAM,UAAU,mBAAmB,CAAC,OAA6B,EAAE;IACjE,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IACzB,OAAO;QACL,MAAM,EAAE;YACN,IAAI,EAAE,WAAW;YACjB,WAAW,EACT,qEAAqE;gBACrE,sEAAsE;gBACtE,mEAAmE;gBACnE,sEAAsE;gBACtE,kEAAkE;gBAClE,qEAAqE;YACvE,YAAY,EAAE;gBACZ,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,SAAS,EAAE;wBACT,IAAI,EAAE,QAAQ;wBACd,WA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