maestro-agent-sdk 0.1.3 → 0.1.5

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 (102) hide show
  1. package/README.md +216 -20
  2. package/dist/agents/contracts.d.ts +10 -0
  3. package/dist/agents/contracts.d.ts.map +1 -1
  4. package/dist/agents/rollout/shared.d.ts +4 -4
  5. package/dist/agents/rollout/shared.js +4 -4
  6. package/dist/core/loop.d.ts.map +1 -1
  7. package/dist/core/loop.js +9 -8
  8. package/dist/core/loop.js.map +1 -1
  9. package/dist/index.d.ts +8 -7
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +8 -7
  12. package/dist/index.js.map +1 -1
  13. package/dist/memory/compressor.d.ts +8 -5
  14. package/dist/memory/compressor.d.ts.map +1 -1
  15. package/dist/memory/compressor.js +10 -4
  16. package/dist/memory/compressor.js.map +1 -1
  17. package/dist/memory/reminder.d.ts +11 -12
  18. package/dist/memory/reminder.d.ts.map +1 -1
  19. package/dist/memory/reminder.js +22 -32
  20. package/dist/memory/reminder.js.map +1 -1
  21. package/dist/platform/config.d.ts +0 -2
  22. package/dist/platform/config.d.ts.map +1 -1
  23. package/dist/platform/config.js +9 -18
  24. package/dist/platform/config.js.map +1 -1
  25. package/dist/platform/version.d.ts +13 -0
  26. package/dist/platform/version.d.ts.map +1 -0
  27. package/dist/platform/version.js +13 -0
  28. package/dist/platform/version.js.map +1 -0
  29. package/dist/provider.d.ts +62 -0
  30. package/dist/provider.d.ts.map +1 -1
  31. package/dist/provider.js +137 -30
  32. package/dist/provider.js.map +1 -1
  33. package/dist/registry.d.ts.map +1 -1
  34. package/dist/registry.js +16 -1
  35. package/dist/registry.js.map +1 -1
  36. package/dist/session-store.d.ts +95 -4
  37. package/dist/session-store.d.ts.map +1 -1
  38. package/dist/session-store.js +144 -13
  39. package/dist/session-store.js.map +1 -1
  40. package/dist/skills/curator.d.ts +8 -6
  41. package/dist/skills/curator.d.ts.map +1 -1
  42. package/dist/skills/curator.js +13 -7
  43. package/dist/skills/curator.js.map +1 -1
  44. package/dist/skills/loader.d.ts +45 -20
  45. package/dist/skills/loader.d.ts.map +1 -1
  46. package/dist/skills/loader.js +56 -11
  47. package/dist/skills/loader.js.map +1 -1
  48. package/dist/state/tasks.d.ts +107 -0
  49. package/dist/state/tasks.d.ts.map +1 -0
  50. package/dist/state/tasks.js +398 -0
  51. package/dist/state/tasks.js.map +1 -0
  52. package/dist/sub-agent/runner.d.ts +1 -1
  53. package/dist/sub-agent/runner.d.ts.map +1 -1
  54. package/dist/sub-agent/runner.js +3 -5
  55. package/dist/sub-agent/runner.js.map +1 -1
  56. package/dist/tools/builtin/edit.d.ts.map +1 -1
  57. package/dist/tools/builtin/edit.js +0 -4
  58. package/dist/tools/builtin/edit.js.map +1 -1
  59. package/dist/tools/builtin/glob.d.ts +17 -0
  60. package/dist/tools/builtin/glob.d.ts.map +1 -0
  61. package/dist/tools/builtin/glob.js +235 -0
  62. package/dist/tools/builtin/glob.js.map +1 -0
  63. package/dist/tools/builtin/grep.d.ts +3 -0
  64. package/dist/tools/builtin/grep.d.ts.map +1 -0
  65. package/dist/tools/builtin/grep.js +272 -0
  66. package/dist/tools/builtin/grep.js.map +1 -0
  67. package/dist/tools/builtin/read.d.ts.map +1 -1
  68. package/dist/tools/builtin/read.js +0 -4
  69. package/dist/tools/builtin/read.js.map +1 -1
  70. package/dist/tools/builtin/skill_write.d.ts +53 -0
  71. package/dist/tools/builtin/skill_write.d.ts.map +1 -0
  72. package/dist/tools/builtin/skill_write.js +264 -0
  73. package/dist/tools/builtin/skill_write.js.map +1 -0
  74. package/dist/tools/builtin/tasks.d.ts +34 -0
  75. package/dist/tools/builtin/tasks.d.ts.map +1 -0
  76. package/dist/tools/builtin/tasks.js +258 -0
  77. package/dist/tools/builtin/tasks.js.map +1 -0
  78. package/dist/tools/builtin/write.d.ts +4 -10
  79. package/dist/tools/builtin/write.d.ts.map +1 -1
  80. package/dist/tools/builtin/write.js.map +1 -1
  81. package/dist/tools/file-state.d.ts +1 -1
  82. package/dist/tools/file-state.js +1 -1
  83. package/dist/tools/registry.d.ts +1 -1
  84. package/dist/types.d.ts +64 -0
  85. package/dist/types.d.ts.map +1 -1
  86. package/package.json +1 -1
  87. package/dist/state/todos.d.ts +0 -95
  88. package/dist/state/todos.d.ts.map +0 -1
  89. package/dist/state/todos.js +0 -198
  90. package/dist/state/todos.js.map +0 -1
  91. package/dist/tools/builtin/sandbox.d.ts +0 -16
  92. package/dist/tools/builtin/sandbox.d.ts.map +0 -1
  93. package/dist/tools/builtin/sandbox.js +0 -59
  94. package/dist/tools/builtin/sandbox.js.map +0 -1
  95. package/dist/tools/builtin/todo_write.d.ts +0 -29
  96. package/dist/tools/builtin/todo_write.d.ts.map +0 -1
  97. package/dist/tools/builtin/todo_write.js +0 -96
  98. package/dist/tools/builtin/todo_write.js.map +0 -1
  99. package/dist/tools/hooks/sandbox-fs.d.ts +0 -25
  100. package/dist/tools/hooks/sandbox-fs.d.ts.map +0 -1
  101. package/dist/tools/hooks/sandbox-fs.js +0 -48
  102. package/dist/tools/hooks/sandbox-fs.js.map +0 -1
@@ -1,96 +0,0 @@
1
- export function createTodoWriteTool(opts) {
2
- const { store } = opts;
3
- return {
4
- parallelSafe: false,
5
- schema: {
6
- name: "todo_write",
7
- description: "Write the current task list. Pass the COMPLETE snapshot of what you want the list " +
8
- "to look like — entries with an existing `id` are updated, new entries (id omitted) " +
9
- "get an auto-assigned id (task-N), and entries absent from the snapshot are dropped. " +
10
- "At most one entry may have status `in_progress`; if you mark more than one, the LAST " +
11
- "in_progress wins and the others are flipped to `pending`. The current list is " +
12
- "surfaced to you in the system reminder each turn — call this whenever a multi-step " +
13
- "plan starts, mid-flight when a step finishes, or to add/drop items.",
14
- input_schema: {
15
- type: "object",
16
- properties: {
17
- todos: {
18
- type: "array",
19
- description: "Complete snapshot of the task list. Each item: " +
20
- "{id?: string, content: string, status: 'pending'|'in_progress'|'completed', " +
21
- "activeForm?: string}. Include EVERY task you want to keep — omitting one drops it.",
22
- },
23
- },
24
- required: ["todos"],
25
- },
26
- },
27
- async execute(input) {
28
- const raw = input.todos;
29
- if (!Array.isArray(raw)) {
30
- return JSON.stringify({
31
- error: "todo_write: 'todos' must be an array",
32
- });
33
- }
34
- const incoming = [];
35
- for (let i = 0; i < raw.length; i++) {
36
- const item = raw[i];
37
- if (!item || typeof item !== "object") {
38
- return JSON.stringify({
39
- error: `todo_write: todos[${i}] must be an object`,
40
- });
41
- }
42
- const obj = item;
43
- const content = obj.content;
44
- const status = obj.status;
45
- if (typeof content !== "string" || content.length === 0) {
46
- return JSON.stringify({
47
- error: `todo_write: todos[${i}].content must be a non-empty string`,
48
- });
49
- }
50
- if (status !== "pending" && status !== "in_progress" && status !== "completed") {
51
- return JSON.stringify({
52
- error: `todo_write: todos[${i}].status must be 'pending', 'in_progress', or 'completed'`,
53
- });
54
- }
55
- const upsert = { content, status };
56
- if (typeof obj.id === "string" && obj.id.length > 0)
57
- upsert.id = obj.id;
58
- if (typeof obj.activeForm === "string" && obj.activeForm.length > 0) {
59
- upsert.activeForm = obj.activeForm;
60
- }
61
- incoming.push(upsert);
62
- }
63
- const result = store.upsert(incoming);
64
- const summary = summarize(result.todos);
65
- const parts = [
66
- `Task list updated (${result.todos.length} item${result.todos.length === 1 ? "" : "s"}).`,
67
- summary,
68
- ];
69
- if (result.demotedId) {
70
- parts.push(`Note: more than one item was marked in_progress; '${result.demotedId}' was flipped to pending so only the last in_progress entry stays active.`);
71
- }
72
- return parts.join("\n\n");
73
- },
74
- };
75
- }
76
- /**
77
- * Render a compact ascii summary of the list. Used in the tool result so
78
- * the model immediately sees what landed (mirrors how Edit returns a
79
- * preview after a successful write).
80
- *
81
- * Format:
82
- * [✓] task-1 Done thing here
83
- * [→] task-2 In-flight thing
84
- * [ ] task-3 Pending thing
85
- */
86
- function summarize(todos) {
87
- if (todos.length === 0)
88
- return "(list is empty)";
89
- return todos
90
- .map((t) => {
91
- const mark = t.status === "completed" ? "✓" : t.status === "in_progress" ? "→" : " ";
92
- return `[${mark}] ${t.id} ${t.content}`;
93
- })
94
- .join("\n");
95
- }
96
- //# sourceMappingURL=todo_write.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"todo_write.js","sourceRoot":"","sources":["../../../src/tools/builtin/todo_write.ts"],"names":[],"mappings":"AA8BA,MAAM,UAAU,mBAAmB,CAAC,IAA0B;IAC5D,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;IACvB,OAAO;QACL,YAAY,EAAE,KAAK;QACnB,MAAM,EAAE;YACN,IAAI,EAAE,YAAY;YAClB,WAAW,EACT,oFAAoF;gBACpF,qFAAqF;gBACrF,sFAAsF;gBACtF,uFAAuF;gBACvF,gFAAgF;gBAChF,qFAAqF;gBACrF,qEAAqE;YACvE,YAAY,EAAE;gBACZ,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,KAAK,EAAE;wBACL,IAAI,EAAE,OAAO;wBACb,WAAW,EACT,iDAAiD;4BACjD,8EAA8E;4BAC9E,oFAAoF;qBACvF;iBACF;gBACD,QAAQ,EAAE,CAAC,OAAO,CAAC;aACpB;SACF;QACD,KAAK,CAAC,OAAO,CAAC,KAAK;YACjB,MAAM,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC;YACxB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;gBACxB,OAAO,IAAI,CAAC,SAAS,CAAC;oBACpB,KAAK,EAAE,sCAAsC;iBAC9C,CAAC,CAAC;YACL,CAAC;YAED,MAAM,QAAQ,GAAiB,EAAE,CAAC;YAClC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBACpC,MAAM,IAAI,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;gBACpB,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,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CAAC,CAAC;YACxC,MAAM,KAAK,GAAa;gBACtB,sBAAsB,MAAM,CAAC,KAAK,CAAC,MAAM,QAAQ,MAAM,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI;gBACzF,OAAO;aACR,CAAC;YACF,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC;gBACrB,KAAK,CAAC,IAAI,CACR,qDAAqD,MAAM,CAAC,SAAS,2EAA2E,CACjJ,CAAC;YACJ,CAAC;YACD,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC5B,CAAC;KACF,CAAC;AACJ,CAAC;AAED;;;;;;;;;GASG;AACH,SAAS,SAAS,CAAC,KAAiE;IAClF,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,iBAAiB,CAAC;IACjD,OAAO,KAAK;SACT,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QACT,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;QACrF,OAAO,IAAI,IAAI,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC;IAC3C,CAAC,CAAC;SACD,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,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"}