maestro-agent-sdk 0.1.8 → 0.1.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 (51) hide show
  1. package/dist/core/is-abort-error.d.ts +8 -0
  2. package/dist/core/is-abort-error.d.ts.map +1 -0
  3. package/dist/core/is-abort-error.js +17 -0
  4. package/dist/core/is-abort-error.js.map +1 -0
  5. package/dist/core/loop.d.ts.map +1 -1
  6. package/dist/core/loop.js +37 -1
  7. package/dist/core/loop.js.map +1 -1
  8. package/dist/platform/version.d.ts +1 -1
  9. package/dist/platform/version.d.ts.map +1 -1
  10. package/dist/platform/version.js +1 -1
  11. package/dist/platform/version.js.map +1 -1
  12. package/dist/provider.d.ts +2 -1
  13. package/dist/provider.d.ts.map +1 -1
  14. package/dist/provider.js +7 -10
  15. package/dist/provider.js.map +1 -1
  16. package/dist/registry.js +6 -6
  17. package/dist/registry.js.map +1 -1
  18. package/dist/sub-agent/runner.d.ts +1 -1
  19. package/dist/sub-agent/runner.d.ts.map +1 -1
  20. package/dist/sub-agent/runner.js +34 -23
  21. package/dist/sub-agent/runner.js.map +1 -1
  22. package/dist/tools/builtin/agent.d.ts +19 -7
  23. package/dist/tools/builtin/agent.d.ts.map +1 -1
  24. package/dist/tools/builtin/agent.js +13 -4
  25. package/dist/tools/builtin/agent.js.map +1 -1
  26. package/dist/tools/builtin/bash.d.ts +68 -3
  27. package/dist/tools/builtin/bash.d.ts.map +1 -1
  28. package/dist/tools/builtin/bash.js +224 -94
  29. package/dist/tools/builtin/bash.js.map +1 -1
  30. package/dist/tools/builtin/edit.d.ts.map +1 -1
  31. package/dist/tools/builtin/edit.js +8 -2
  32. package/dist/tools/builtin/edit.js.map +1 -1
  33. package/dist/tools/builtin/glob.d.ts +8 -4
  34. package/dist/tools/builtin/glob.d.ts.map +1 -1
  35. package/dist/tools/builtin/glob.js +105 -17
  36. package/dist/tools/builtin/glob.js.map +1 -1
  37. package/dist/tools/builtin/multi_edit.d.ts +16 -0
  38. package/dist/tools/builtin/multi_edit.d.ts.map +1 -0
  39. package/dist/tools/builtin/multi_edit.js +292 -0
  40. package/dist/tools/builtin/multi_edit.js.map +1 -0
  41. package/dist/tools/builtin/write.d.ts.map +1 -1
  42. package/dist/tools/builtin/write.js +8 -2
  43. package/dist/tools/builtin/write.js.map +1 -1
  44. package/dist/tools/file-state.d.ts +1 -1
  45. package/dist/tools/file-state.d.ts.map +1 -1
  46. package/dist/tools/file-state.js.map +1 -1
  47. package/dist/tools/path-guard.d.ts +23 -0
  48. package/dist/tools/path-guard.d.ts.map +1 -0
  49. package/dist/tools/path-guard.js +52 -0
  50. package/dist/tools/path-guard.js.map +1 -0
  51. package/package.json +1 -1
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Path-guard utilities shared across file-mutation tools (Write, Edit, MultiEdit).
3
+ *
4
+ * Centralises two concerns:
5
+ * 1. `checkBlockedPath` — rejects writes to sensitive files (.env, .ssh, etc.)
6
+ * that should never be silently overwritten by an agent, regardless of what
7
+ * the model requests.
8
+ *
9
+ * These are *last-resort* guards. The primary access control layer is the
10
+ * Read-before-Edit invariant enforced by FileStateTracker. The guards here
11
+ * are a belt-and-suspenders measure that survives even if the tracker is
12
+ * not wired (e.g. direct tool invocation in tests).
13
+ */
14
+ /**
15
+ * Returns an error string if `normalizedAbsPath` matches a blocked pattern,
16
+ * `null` otherwise. The returned string is ready to be wrapped in
17
+ * `JSON.stringify({ error: ... })` by the caller.
18
+ *
19
+ * @param toolName Display name used in the error message ("Write", "Edit", …).
20
+ * @param normalizedAbsPath An already-`normalize()`d absolute path.
21
+ */
22
+ export declare function checkBlockedPath(toolName: string, normalizedAbsPath: string): string | null;
23
+ //# sourceMappingURL=path-guard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path-guard.d.ts","sourceRoot":"","sources":["../../src/tools/path-guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAuBH;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAW3F"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Path-guard utilities shared across file-mutation tools (Write, Edit, MultiEdit).
3
+ *
4
+ * Centralises two concerns:
5
+ * 1. `checkBlockedPath` — rejects writes to sensitive files (.env, .ssh, etc.)
6
+ * that should never be silently overwritten by an agent, regardless of what
7
+ * the model requests.
8
+ *
9
+ * These are *last-resort* guards. The primary access control layer is the
10
+ * Read-before-Edit invariant enforced by FileStateTracker. The guards here
11
+ * are a belt-and-suspenders measure that survives even if the tracker is
12
+ * not wired (e.g. direct tool invocation in tests).
13
+ */
14
+ /**
15
+ * Patterns for files that must never be mutated by the agent's file tools.
16
+ * The check runs on the *normalized* absolute path, so `..` traversal cannot
17
+ * bypass it (normalization is the caller's responsibility — see edit.ts /
18
+ * write.ts / multi_edit.ts).
19
+ *
20
+ * Deliberately conservative: prefer false negatives over silently blocking
21
+ * legitimate writes. The model can still reach these files through bash if
22
+ * the operator allows it.
23
+ */
24
+ const BLOCKED_PATTERNS = [
25
+ /\/\.env(\.[^/]*)?$/i, // .env .env.local .env.production …
26
+ /\/\.ssh\//i, // ~/.ssh/ (any file inside)
27
+ /\/\.aws\//i, // ~/.aws/credentials …
28
+ /\/\.gnupg\//i, // GPG keyring
29
+ /\/\.netrc$/i, // FTP / HTTP creds
30
+ /\/\.npmrc$/i, // npm auth tokens
31
+ /\/\.pypirc$/i, // PyPI upload tokens
32
+ /\/\.git\/config$/i, // repo git config (may contain PATs)
33
+ ];
34
+ /**
35
+ * Returns an error string if `normalizedAbsPath` matches a blocked pattern,
36
+ * `null` otherwise. The returned string is ready to be wrapped in
37
+ * `JSON.stringify({ error: ... })` by the caller.
38
+ *
39
+ * @param toolName Display name used in the error message ("Write", "Edit", …).
40
+ * @param normalizedAbsPath An already-`normalize()`d absolute path.
41
+ */
42
+ export function checkBlockedPath(toolName, normalizedAbsPath) {
43
+ for (const pattern of BLOCKED_PATTERNS) {
44
+ if (pattern.test(normalizedAbsPath)) {
45
+ return (`${toolName}: writing to '${normalizedAbsPath}' is blocked — ` +
46
+ `this path matches a sensitive-file pattern (${pattern.source}). ` +
47
+ `Use bash to edit it explicitly if you are certain this is intentional.`);
48
+ }
49
+ }
50
+ return null;
51
+ }
52
+ //# sourceMappingURL=path-guard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path-guard.js","sourceRoot":"","sources":["../../src/tools/path-guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH;;;;;;;;;GASG;AACH,MAAM,gBAAgB,GAAa;IACjC,qBAAqB,EAAE,uCAAuC;IAC9D,YAAY,EAAE,8BAA8B;IAC5C,YAAY,EAAE,wBAAwB;IACtC,cAAc,EAAE,eAAe;IAC/B,aAAa,EAAE,oBAAoB;IACnC,aAAa,EAAE,mBAAmB;IAClC,cAAc,EAAE,sBAAsB;IACtC,mBAAmB,EAAE,sCAAsC;CAC5D,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAAgB,EAAE,iBAAyB;IAC1E,KAAK,MAAM,OAAO,IAAI,gBAAgB,EAAE,CAAC;QACvC,IAAI,OAAO,CAAC,IAAI,CAAC,iBAAiB,CAAC,EAAE,CAAC;YACpC,OAAO,CACL,GAAG,QAAQ,iBAAiB,iBAAiB,iBAAiB;gBAC9D,+CAA+C,OAAO,CAAC,MAAM,KAAK;gBAClE,wEAAwE,CACzE,CAAC;QACJ,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "maestro-agent-sdk",
3
- "version": "0.1.8",
3
+ "version": "0.1.11",
4
4
  "description": "Embeddable, provider-agnostic TypeScript agent SDK — pluggable providers, built-in tools, skills, memory, and MCP.",
5
5
  "license": "MIT",
6
6
  "author": "Yeonwoo Jeong <aadd4020@gmail.com>",