maestro-agent-sdk 0.1.2 → 0.1.4

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 (91) hide show
  1. package/README.md +23 -14
  2. package/dist/agents/rollout/shared.d.ts +5 -5
  3. package/dist/agents/rollout/shared.js +5 -5
  4. package/dist/core/agent.d.ts +5 -5
  5. package/dist/core/agent.d.ts.map +1 -1
  6. package/dist/core/loop.d.ts +3 -2
  7. package/dist/core/loop.d.ts.map +1 -1
  8. package/dist/core/loop.js +12 -10
  9. package/dist/core/loop.js.map +1 -1
  10. package/dist/index.d.ts +1 -3
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +1 -3
  13. package/dist/index.js.map +1 -1
  14. package/dist/mcp/client.d.ts.map +1 -1
  15. package/dist/mcp/client.js +1 -1
  16. package/dist/mcp/client.js.map +1 -1
  17. package/dist/memory/active-task-template.d.ts +1 -1
  18. package/dist/memory/active-task-template.js +1 -1
  19. package/dist/memory/compressor.d.ts +9 -6
  20. package/dist/memory/compressor.d.ts.map +1 -1
  21. package/dist/memory/compressor.js +10 -4
  22. package/dist/memory/compressor.js.map +1 -1
  23. package/dist/memory/prune.d.ts +1 -1
  24. package/dist/memory/reminder.d.ts +5 -6
  25. package/dist/memory/reminder.d.ts.map +1 -1
  26. package/dist/memory/reminder.js +3 -19
  27. package/dist/memory/reminder.js.map +1 -1
  28. package/dist/memory/token-estimate.js +1 -1
  29. package/dist/platform/config.d.ts +0 -2
  30. package/dist/platform/config.d.ts.map +1 -1
  31. package/dist/platform/config.js +10 -19
  32. package/dist/platform/config.js.map +1 -1
  33. package/dist/platform/jsonl.d.ts +5 -5
  34. package/dist/platform/jsonl.js +5 -5
  35. package/dist/platform/lifecycle.d.ts +1 -1
  36. package/dist/platform/logger.d.ts +5 -5
  37. package/dist/platform/logger.js +5 -5
  38. package/dist/provider.d.ts.map +1 -1
  39. package/dist/provider.js +12 -15
  40. package/dist/provider.js.map +1 -1
  41. package/dist/providers/anthropic.d.ts +10 -9
  42. package/dist/providers/anthropic.d.ts.map +1 -1
  43. package/dist/providers/anthropic.js +10 -9
  44. package/dist/providers/anthropic.js.map +1 -1
  45. package/dist/skills/curator.d.ts +12 -12
  46. package/dist/skills/curator.d.ts.map +1 -1
  47. package/dist/skills/curator.js +5 -5
  48. package/dist/skills/curator.js.map +1 -1
  49. package/dist/skills/index-builder.d.ts +8 -9
  50. package/dist/skills/index-builder.d.ts.map +1 -1
  51. package/dist/skills/index-builder.js +8 -9
  52. package/dist/skills/index-builder.js.map +1 -1
  53. package/dist/skills/loader.d.ts +4 -4
  54. package/dist/skills/loader.d.ts.map +1 -1
  55. package/dist/skills/loader.js +4 -4
  56. package/dist/skills/loader.js.map +1 -1
  57. package/dist/skills/usage.d.ts +6 -5
  58. package/dist/skills/usage.d.ts.map +1 -1
  59. package/dist/skills/usage.js.map +1 -1
  60. package/dist/sub-agent/runner.d.ts.map +1 -1
  61. package/dist/sub-agent/runner.js +3 -5
  62. package/dist/sub-agent/runner.js.map +1 -1
  63. package/dist/tools/builtin/bash.d.ts +5 -4
  64. package/dist/tools/builtin/bash.d.ts.map +1 -1
  65. package/dist/tools/builtin/bash.js +5 -4
  66. package/dist/tools/builtin/bash.js.map +1 -1
  67. package/dist/tools/builtin/edit.d.ts.map +1 -1
  68. package/dist/tools/builtin/edit.js +0 -4
  69. package/dist/tools/builtin/edit.js.map +1 -1
  70. package/dist/tools/builtin/read.d.ts.map +1 -1
  71. package/dist/tools/builtin/read.js +0 -4
  72. package/dist/tools/builtin/read.js.map +1 -1
  73. package/dist/tools/builtin/write.d.ts +4 -9
  74. package/dist/tools/builtin/write.d.ts.map +1 -1
  75. package/dist/tools/builtin/write.js.map +1 -1
  76. package/dist/tools/file-state.d.ts +1 -1
  77. package/dist/tools/file-state.js +1 -1
  78. package/dist/tools/registry.d.ts +1 -1
  79. package/dist/types.d.ts +2 -1
  80. package/dist/types.d.ts.map +1 -1
  81. package/dist/types.js +2 -1
  82. package/dist/types.js.map +1 -1
  83. package/package.json +1 -1
  84. package/dist/tools/builtin/sandbox.d.ts +0 -16
  85. package/dist/tools/builtin/sandbox.d.ts.map +0 -1
  86. package/dist/tools/builtin/sandbox.js +0 -58
  87. package/dist/tools/builtin/sandbox.js.map +0 -1
  88. package/dist/tools/hooks/sandbox-fs.d.ts +0 -25
  89. package/dist/tools/hooks/sandbox-fs.d.ts.map +0 -1
  90. package/dist/tools/hooks/sandbox-fs.js +0 -48
  91. package/dist/tools/hooks/sandbox-fs.js.map +0 -1
@@ -1,58 +0,0 @@
1
- import { resolve as resolvePath } from "node:path";
2
- import { WORKSPACE_DIR } from "../../platform/config.js";
3
- /**
4
- * Maestro builtin filesystem sandbox.
5
- *
6
- * Optional gate Read/Write/Edit (and any PreToolUse hook that consults it)
7
- * can use to constrain file access to `${WORKSPACE_DIR}`. Default is
8
- * **disabled** — claude/codex providers grant unconstrained FS access via
9
- * `bypassPermissions` / `danger-full-access`, and forcing a stricter posture
10
- * on maestro alone silently breaks any workflow that legitimately reaches
11
- * outside the workspace (reading `~/.config`, writing into a sibling repo,
12
- * etc.). The single-tenant Mac deployments maestro targets trust the model
13
- * with the whole UID anyway.
14
- *
15
- * Opt-in: set `MAESTRO_FS_SANDBOX_ENABLED=1` to enforce. Only paths under
16
- * `${WORKSPACE_DIR}` (`~/claude-code-workspace`) are allowed when enabled;
17
- * system paths (`~/.ssh`, `/etc`, `/usr`, sibling clawgram clones, etc.)
18
- * are rejected. Useful for multi-tenant or hardened setups where the
19
- * model should not be trusted with arbitrary FS access.
20
- *
21
- * Symlink note: we resolve `..` segments via `path.resolve` but do NOT
22
- * follow symlinks (no `realpathSync`) — a symlink inside the workspace
23
- * pointing OUT is still considered inside (the link target is what gets
24
- * written/read, and the user explicitly placed that link there). Tightening
25
- * this is a follow-up if it ever matters.
26
- */
27
- const ENV_ENABLED = "MAESTRO_FS_SANDBOX_ENABLED";
28
- /**
29
- * Check whether `filePath` is allowed by the sandbox. Returns null on allow,
30
- * or an error message string on deny. Callers stringify the error into a
31
- * `{error}` payload so the model sees a structured rejection.
32
- *
33
- * The path is normalized (`..` collapsed) but symlinks are NOT followed.
34
- * Caller is responsible for ensuring `filePath` is already absolute — the
35
- * Read/Write/Edit tools enforce that at the top of `execute`.
36
- */
37
- export function checkFilesystemAccess(filePath) {
38
- if (!isSandboxEnabled())
39
- return null;
40
- const resolved = resolvePath(filePath);
41
- // Allow path === root and any descendant. The separator suffix avoids
42
- // `WORKSPACE_DIR-sibling` style false-allows.
43
- if (resolved === WORKSPACE_DIR)
44
- return null;
45
- const prefix = WORKSPACE_DIR.endsWith("/") ? WORKSPACE_DIR : `${WORKSPACE_DIR}/`;
46
- if (resolved.startsWith(prefix))
47
- return null;
48
- return (`Sandbox: path '${filePath}' is outside the workspace root (${WORKSPACE_DIR}). ` +
49
- `Unset ${ENV_ENABLED} or scope the operation under the workspace.`);
50
- }
51
- /** Whether the sandbox is currently active. Default is OFF; the operator
52
- * opts in by exporting `MAESTRO_FS_SANDBOX_ENABLED=1`. Read each call so a
53
- * test can toggle it without restarting the process. */
54
- export function isSandboxEnabled() {
55
- return process.env[ENV_ENABLED] === "1";
56
- }
57
- export const __ENV_ENABLED = ENV_ENABLED;
58
- //# sourceMappingURL=sandbox.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sandbox.js","sourceRoot":"","sources":["../../../src/tools/builtin/sandbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,MAAM,WAAW,GAAG,4BAA4B,CAAC;AAEjD;;;;;;;;GAQG;AACH,MAAM,UAAU,qBAAqB,CAAC,QAAgB;IACpD,IAAI,CAAC,gBAAgB,EAAE;QAAE,OAAO,IAAI,CAAC;IACrC,MAAM,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC;IACvC,sEAAsE;IACtE,8CAA8C;IAC9C,IAAI,QAAQ,KAAK,aAAa;QAAE,OAAO,IAAI,CAAC;IAC5C,MAAM,MAAM,GAAG,aAAa,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,aAAa,GAAG,CAAC;IACjF,IAAI,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC;QAAE,OAAO,IAAI,CAAC;IAC7C,OAAO,CACL,kBAAkB,QAAQ,oCAAoC,aAAa,KAAK;QAChF,SAAS,WAAW,8CAA8C,CACnE,CAAC;AACJ,CAAC;AAED;;yDAEyD;AACzD,MAAM,UAAU,gBAAgB;IAC9B,OAAO,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,KAAK,GAAG,CAAC;AAC1C,CAAC;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,WAAW,CAAC"}
@@ -1,25 +0,0 @@
1
- import type { HookRegistration } from "../../tools/registry.js";
2
- /**
3
- * Filesystem sandbox as a PreToolUse hook.
4
- *
5
- * Centralized opt-in gate for any tool whose input carries a `file_path`
6
- * argument (Read/Write/Edit today, future FS-touching MCP tools by
7
- * inheritance). Default is **disabled** to match the unconstrained FS
8
- * posture of claude (`bypassPermissions`) and codex (`danger-full-access`)
9
- * providers — divergence here used to silently break maestro-only workflows
10
- * that legitimately reach outside the workspace. Operator opts in by
11
- * exporting `MAESTRO_FS_SANDBOX_ENABLED=1`.
12
- *
13
- * Scope: only tools whose `input.file_path` is a non-empty string are
14
- * inspected. Tools that don't surface a file path (bash, web_fetch, MCP
15
- * tools without an FS argument) are unaffected — this hook is FS-specific
16
- * by design. A future bash-sandbox hook would be a separate registration.
17
- *
18
- * Absolute-path enforcement is left to the tool itself: the model's error
19
- * message is clearer when it comes from the tool (`Read: file_path must be
20
- * absolute`) than from the sandbox hook ("path is not absolute"). The
21
- * sandbox only weighs in once an absolute path has been confirmed —
22
- * mirroring how the inline check used to work.
23
- */
24
- export declare function createSandboxFsHook(): HookRegistration;
25
- //# sourceMappingURL=sandbox-fs.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sandbox-fs.d.ts","sourceRoot":"","sources":["../../../src/tools/hooks/sandbox-fs.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,mBAAmB,IAAI,gBAAgB,CAsBtD"}
@@ -1,48 +0,0 @@
1
- import { isAbsolute } from "node:path";
2
- import { checkFilesystemAccess, isSandboxEnabled } from "../../tools/builtin/sandbox.js";
3
- /**
4
- * Filesystem sandbox as a PreToolUse hook.
5
- *
6
- * Centralized opt-in gate for any tool whose input carries a `file_path`
7
- * argument (Read/Write/Edit today, future FS-touching MCP tools by
8
- * inheritance). Default is **disabled** to match the unconstrained FS
9
- * posture of claude (`bypassPermissions`) and codex (`danger-full-access`)
10
- * providers — divergence here used to silently break maestro-only workflows
11
- * that legitimately reach outside the workspace. Operator opts in by
12
- * exporting `MAESTRO_FS_SANDBOX_ENABLED=1`.
13
- *
14
- * Scope: only tools whose `input.file_path` is a non-empty string are
15
- * inspected. Tools that don't surface a file path (bash, web_fetch, MCP
16
- * tools without an FS argument) are unaffected — this hook is FS-specific
17
- * by design. A future bash-sandbox hook would be a separate registration.
18
- *
19
- * Absolute-path enforcement is left to the tool itself: the model's error
20
- * message is clearer when it comes from the tool (`Read: file_path must be
21
- * absolute`) than from the sandbox hook ("path is not absolute"). The
22
- * sandbox only weighs in once an absolute path has been confirmed —
23
- * mirroring how the inline check used to work.
24
- */
25
- export function createSandboxFsHook() {
26
- return {
27
- name: "sandbox-fs",
28
- pre(ctx) {
29
- // Cheap exit when the operator hasn't opted into the sandbox — the
30
- // common case, so skip the work before doing any property reads.
31
- if (!isSandboxEnabled())
32
- return { decision: "allow" };
33
- const filePath = ctx.input.file_path;
34
- if (typeof filePath !== "string" || filePath.length === 0) {
35
- return { decision: "allow" };
36
- }
37
- // Defer absolute-path errors to the tool — its message is clearer.
38
- if (!isAbsolute(filePath))
39
- return { decision: "allow" };
40
- const err = checkFilesystemAccess(filePath);
41
- if (err) {
42
- return { decision: "block", error: `${ctx.toolName}: ${err}` };
43
- }
44
- return { decision: "allow" };
45
- },
46
- };
47
- }
48
- //# sourceMappingURL=sandbox-fs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sandbox-fs.js","sourceRoot":"","sources":["../../../src/tools/hooks/sandbox-fs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAGlF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,mBAAmB;IACjC,OAAO;QACL,IAAI,EAAE,YAAY;QAClB,GAAG,CAAC,GAAG;YACL,mEAAmE;YACnE,iEAAiE;YACjE,IAAI,CAAC,gBAAgB,EAAE;gBAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;YAEtD,MAAM,QAAQ,GAAG,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC;YACrC,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC1D,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;YAC/B,CAAC;YACD,mEAAmE;YACnE,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC;gBAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;YAExD,MAAM,GAAG,GAAG,qBAAqB,CAAC,QAAQ,CAAC,CAAC;YAC5C,IAAI,GAAG,EAAE,CAAC;gBACR,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,GAAG,CAAC,QAAQ,KAAK,GAAG,EAAE,EAAE,CAAC;YACjE,CAAC;YACD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;QAC/B,CAAC;KACF,CAAC;AACJ,CAAC"}