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.
- package/README.md +216 -20
- package/dist/agents/contracts.d.ts +10 -0
- package/dist/agents/contracts.d.ts.map +1 -1
- package/dist/agents/rollout/shared.d.ts +4 -4
- package/dist/agents/rollout/shared.js +4 -4
- package/dist/core/loop.d.ts.map +1 -1
- package/dist/core/loop.js +9 -8
- package/dist/core/loop.js.map +1 -1
- package/dist/index.d.ts +8 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -7
- package/dist/index.js.map +1 -1
- package/dist/memory/compressor.d.ts +8 -5
- package/dist/memory/compressor.d.ts.map +1 -1
- package/dist/memory/compressor.js +10 -4
- package/dist/memory/compressor.js.map +1 -1
- package/dist/memory/reminder.d.ts +11 -12
- package/dist/memory/reminder.d.ts.map +1 -1
- package/dist/memory/reminder.js +22 -32
- package/dist/memory/reminder.js.map +1 -1
- package/dist/platform/config.d.ts +0 -2
- package/dist/platform/config.d.ts.map +1 -1
- package/dist/platform/config.js +9 -18
- package/dist/platform/config.js.map +1 -1
- package/dist/platform/version.d.ts +13 -0
- package/dist/platform/version.d.ts.map +1 -0
- package/dist/platform/version.js +13 -0
- package/dist/platform/version.js.map +1 -0
- package/dist/provider.d.ts +62 -0
- package/dist/provider.d.ts.map +1 -1
- package/dist/provider.js +137 -30
- package/dist/provider.js.map +1 -1
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +16 -1
- package/dist/registry.js.map +1 -1
- package/dist/session-store.d.ts +95 -4
- package/dist/session-store.d.ts.map +1 -1
- package/dist/session-store.js +144 -13
- package/dist/session-store.js.map +1 -1
- package/dist/skills/curator.d.ts +8 -6
- package/dist/skills/curator.d.ts.map +1 -1
- package/dist/skills/curator.js +13 -7
- package/dist/skills/curator.js.map +1 -1
- package/dist/skills/loader.d.ts +45 -20
- package/dist/skills/loader.d.ts.map +1 -1
- package/dist/skills/loader.js +56 -11
- package/dist/skills/loader.js.map +1 -1
- package/dist/state/tasks.d.ts +107 -0
- package/dist/state/tasks.d.ts.map +1 -0
- package/dist/state/tasks.js +398 -0
- package/dist/state/tasks.js.map +1 -0
- package/dist/sub-agent/runner.d.ts +1 -1
- package/dist/sub-agent/runner.d.ts.map +1 -1
- package/dist/sub-agent/runner.js +3 -5
- package/dist/sub-agent/runner.js.map +1 -1
- package/dist/tools/builtin/edit.d.ts.map +1 -1
- package/dist/tools/builtin/edit.js +0 -4
- package/dist/tools/builtin/edit.js.map +1 -1
- package/dist/tools/builtin/glob.d.ts +17 -0
- package/dist/tools/builtin/glob.d.ts.map +1 -0
- package/dist/tools/builtin/glob.js +235 -0
- package/dist/tools/builtin/glob.js.map +1 -0
- package/dist/tools/builtin/grep.d.ts +3 -0
- package/dist/tools/builtin/grep.d.ts.map +1 -0
- package/dist/tools/builtin/grep.js +272 -0
- package/dist/tools/builtin/grep.js.map +1 -0
- package/dist/tools/builtin/read.d.ts.map +1 -1
- package/dist/tools/builtin/read.js +0 -4
- package/dist/tools/builtin/read.js.map +1 -1
- package/dist/tools/builtin/skill_write.d.ts +53 -0
- package/dist/tools/builtin/skill_write.d.ts.map +1 -0
- package/dist/tools/builtin/skill_write.js +264 -0
- package/dist/tools/builtin/skill_write.js.map +1 -0
- package/dist/tools/builtin/tasks.d.ts +34 -0
- package/dist/tools/builtin/tasks.d.ts.map +1 -0
- package/dist/tools/builtin/tasks.js +258 -0
- package/dist/tools/builtin/tasks.js.map +1 -0
- package/dist/tools/builtin/write.d.ts +4 -10
- package/dist/tools/builtin/write.d.ts.map +1 -1
- package/dist/tools/builtin/write.js.map +1 -1
- package/dist/tools/file-state.d.ts +1 -1
- package/dist/tools/file-state.js +1 -1
- package/dist/tools/registry.d.ts +1 -1
- package/dist/types.d.ts +64 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/state/todos.d.ts +0 -95
- package/dist/state/todos.d.ts.map +0 -1
- package/dist/state/todos.js +0 -198
- package/dist/state/todos.js.map +0 -1
- package/dist/tools/builtin/sandbox.d.ts +0 -16
- package/dist/tools/builtin/sandbox.d.ts.map +0 -1
- package/dist/tools/builtin/sandbox.js +0 -59
- package/dist/tools/builtin/sandbox.js.map +0 -1
- package/dist/tools/builtin/todo_write.d.ts +0 -29
- package/dist/tools/builtin/todo_write.d.ts.map +0 -1
- package/dist/tools/builtin/todo_write.js +0 -96
- package/dist/tools/builtin/todo_write.js.map +0 -1
- package/dist/tools/hooks/sandbox-fs.d.ts +0 -25
- package/dist/tools/hooks/sandbox-fs.d.ts.map +0 -1
- package/dist/tools/hooks/sandbox-fs.js +0 -48
- package/dist/tools/hooks/sandbox-fs.js.map +0 -1
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import type { FileStateTracker } from "../../tools/file-state.js";
|
|
2
2
|
import type { ToolHandler } from "../../tools/registry.js";
|
|
3
|
-
/**
|
|
4
|
-
* NOTE: filesystem sandboxing now lives in the `sandbox-fs` PreToolUse hook.
|
|
5
|
-
* Standalone callers (tests, scripts) without the registry get NO sandbox.
|
|
6
|
-
*/
|
|
7
3
|
/**
|
|
8
4
|
* Write builtin — claude SDK `Write` tool parity for maestro.
|
|
9
5
|
*
|
|
@@ -13,12 +9,10 @@ import type { ToolHandler } from "../../tools/registry.js";
|
|
|
13
9
|
* additive writes should use the bash tool with `>>` for now (Phase 5 may add
|
|
14
10
|
* a separate `Edit` builtin that handles the read-modify-write cycle).
|
|
15
11
|
*
|
|
16
|
-
* Path safety: absolute path is enforced.
|
|
17
|
-
*
|
|
18
|
-
* via `ToolRegistry
|
|
19
|
-
* loop's abort plumbing
|
|
20
|
-
* can land later without breaking the schema (the model only sees the public
|
|
21
|
-
* fields).
|
|
12
|
+
* Path safety: absolute path is enforced. Any further restriction (workspace
|
|
13
|
+
* allowlist, owner check, etc.) is the host's job — register a PreToolUse
|
|
14
|
+
* hook via `ToolRegistry.use()` and inspect `ctx.input.file_path` there.
|
|
15
|
+
* The agent loop's abort plumbing remains the authoritative cancel path.
|
|
22
16
|
*/
|
|
23
17
|
export interface WriteToolOptions {
|
|
24
18
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write.d.ts","sourceRoot":"","sources":["../../../src/tools/builtin/write.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD
|
|
1
|
+
{"version":3,"file":"write.d.ts","sourceRoot":"","sources":["../../../src/tools/builtin/write.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD;;;;;;;;;;;;;GAaG;AAEH,MAAM,WAAW,gBAAgB;IAC/B;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,gBAAgB,CAAC;CAC5B;AAED,wBAAgB,eAAe,CAAC,IAAI,GAAE,gBAAqB,GAAG,WAAW,CAkExE;AAED,mDAAmD;AACnD,eAAO,MAAM,SAAS,EAAE,WAA+B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write.js","sourceRoot":"","sources":["../../../src/tools/builtin/write.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"write.js","sourceRoot":"","sources":["../../../src/tools/builtin/write.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AA8BhD,MAAM,UAAU,eAAe,CAAC,OAAyB,EAAE;I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AE,CAAC;gBACtC,OAAO,IAAI,CAAC,SAAS,CAAC;oBACpB,KAAK,EAAE,0CAA0C,OAAO,KAAK,CAAC,OAAO,EAAE;iBACxE,CAAC,CAAC;YACL,CAAC;YACD,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;YAE9B,IAAI,CAAC;gBACH,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;gBAClD,aAAa,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;YAC5C,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,OAAO,IAAI,CAAC,SAAS,CAAC;oBACpB,KAAK,EAAE,kBAAkB,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE;iBACtE,CAAC,CAAC;YACL,CAAC;YAED,qEAAqE;YACrE,uDAAuD;YACvD,OAAO,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;YAE1B,MAAM,KAAK,GAAG,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAClD,OAAO,iBAAiB,QAAQ,KAAK,KAAK,SAAS,CAAC;QACtD,CAAC;KACF,CAAC;AACJ,CAAC;AAED,mDAAmD;AACnD,MAAM,CAAC,MAAM,SAAS,GAAgB,eAAe,EAAE,CAAC"}
|
|
@@ -63,7 +63,7 @@ export declare class FileStateTracker {
|
|
|
63
63
|
/**
|
|
64
64
|
* Check whether `absPath` may be Edit/Write'd. Returns null on allow,
|
|
65
65
|
* or a string error on deny — callers stringify into `{error}` so the
|
|
66
|
-
* model sees the same shape as
|
|
66
|
+
* model sees the same shape as arg-validation rejections.
|
|
67
67
|
*
|
|
68
68
|
* Three reject paths:
|
|
69
69
|
* - "no_read": never Read this session. Forces the model to Read first.
|
package/dist/tools/file-state.js
CHANGED
|
@@ -29,7 +29,7 @@ export class FileStateTracker {
|
|
|
29
29
|
/**
|
|
30
30
|
* Check whether `absPath` may be Edit/Write'd. Returns null on allow,
|
|
31
31
|
* or a string error on deny — callers stringify into `{error}` so the
|
|
32
|
-
* model sees the same shape as
|
|
32
|
+
* model sees the same shape as arg-validation rejections.
|
|
33
33
|
*
|
|
34
34
|
* Three reject paths:
|
|
35
35
|
* - "no_read": never Read this session. Forces the model to Read first.
|
package/dist/tools/registry.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import type { ProviderToolSchema } from "../providers/base.js";
|
|
|
8
8
|
*
|
|
9
9
|
* Phase 2 adds a hook chain around `dispatch` (PreToolUse / PostToolUse)
|
|
10
10
|
* matching Claude Code's settings.json hook surface. Hooks centralize
|
|
11
|
-
* policy that would otherwise be sprinkled across tools —
|
|
11
|
+
* policy that would otherwise be sprinkled across tools — path allowlists,
|
|
12
12
|
* automatic redaction, telemetry.
|
|
13
13
|
*/
|
|
14
14
|
/**
|
package/dist/types.d.ts
CHANGED
|
@@ -84,6 +84,24 @@ export interface AgentQueryOptions {
|
|
|
84
84
|
agent: AgentKind;
|
|
85
85
|
prompt: string;
|
|
86
86
|
sessionId?: string | null;
|
|
87
|
+
/**
|
|
88
|
+
* Working-directory hint for this session.
|
|
89
|
+
*
|
|
90
|
+
* The SDK uses this for two narrow purposes:
|
|
91
|
+
* 1. `mkdir -p` so the path exists when subsequent host code stats it
|
|
92
|
+
* (e.g. resume flows that read files from the session's expected root).
|
|
93
|
+
* 2. Stamp it into the rollout `_meta` header (since v0.1.5) so a future
|
|
94
|
+
* indexer / forensic sweep can attribute the on-disk JSONL to a project.
|
|
95
|
+
*
|
|
96
|
+
* Note: the SDK loop itself does **not** chdir, and the built-in tools
|
|
97
|
+
* (Read/Write/Edit) require absolute paths regardless of this value. The
|
|
98
|
+
* Bash tool's `cwd` is per-call input from the model, NOT auto-injected
|
|
99
|
+
* from this field. Future minor versions may evolve tools to respect this
|
|
100
|
+
* hint, but today it is treated as metadata.
|
|
101
|
+
*
|
|
102
|
+
* Pass the canonical project / workspace path the host wants associated
|
|
103
|
+
* with this session.
|
|
104
|
+
*/
|
|
87
105
|
cwd: string;
|
|
88
106
|
systemPrompt: string;
|
|
89
107
|
userId?: string;
|
|
@@ -106,5 +124,51 @@ export interface AgentQueryOptions {
|
|
|
106
124
|
mcpExtra?: Record<string, unknown>;
|
|
107
125
|
isCron?: boolean;
|
|
108
126
|
silent?: boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Named skill profile within the per-cwd `.skills/` directory. The SDK
|
|
129
|
+
* resolves the skill catalog source as:
|
|
130
|
+
*
|
|
131
|
+
* - `<cwd>/.skills/<skillKey>/` when set
|
|
132
|
+
* - `<cwd>/.skills/<MAESTRO_DEFAULT_SKILL_KEY>/` when omitted (literally
|
|
133
|
+
* `<cwd>/.skills/default/` — the constant is exported so hosts can
|
|
134
|
+
* reference it symbolically).
|
|
135
|
+
*
|
|
136
|
+
* Every skill lives under a named key — the SDK never loads from the
|
|
137
|
+
* `.skills/` root directly. This keeps the layout uniform so a caller
|
|
138
|
+
* scanning the filesystem can answer "which profiles exist?" with one
|
|
139
|
+
* `readdir`.
|
|
140
|
+
*
|
|
141
|
+
* Use case: one workspace, multiple disjoint skill sets. A topic /
|
|
142
|
+
* session passes a key (e.g. "legal", "coding"); the agent's catalog
|
|
143
|
+
* is whatever lives under that subdirectory. New skills the agent
|
|
144
|
+
* writes during the session naturally land in the same subdir — the
|
|
145
|
+
* keyed dir IS the loader root, so created skills stay scoped to the
|
|
146
|
+
* key without extra plumbing.
|
|
147
|
+
*
|
|
148
|
+
* This is the only knob the SDK exposes for skill-source routing —
|
|
149
|
+
* `(cwd, skillKey)` is a deterministic pair, so two sessions with the
|
|
150
|
+
* same pair load the same catalog and there's no env-var / explicit-
|
|
151
|
+
* dir precedence chain to reason about.
|
|
152
|
+
*/
|
|
153
|
+
skillKey?: string;
|
|
154
|
+
/**
|
|
155
|
+
* Whitelist of skill names this call may surface. When provided, the
|
|
156
|
+
* loaded catalog is filtered down to entries whose `name` matches one
|
|
157
|
+
* of the listed values BEFORE curation, index rendering, and
|
|
158
|
+
* `skill_view` registration. Unknown names in the list are silently
|
|
159
|
+
* ignored (no error) so a host can safely pass a superset.
|
|
160
|
+
*
|
|
161
|
+
* Omit (or pass `undefined`) to allow every loaded skill — the default
|
|
162
|
+
* pre-0.1.5 behavior.
|
|
163
|
+
*/
|
|
164
|
+
allowedSkills?: string[];
|
|
165
|
+
/**
|
|
166
|
+
* Opaque host-controlled bag persisted alongside the session as part of
|
|
167
|
+
* the rollout `_meta` header. The SDK reads and writes this verbatim and
|
|
168
|
+
* never interprets its shape — useful for round-tripping `topicId`,
|
|
169
|
+
* `groupId`, or any other host-side identifiers that should follow the
|
|
170
|
+
* session across persistence.
|
|
171
|
+
*/
|
|
172
|
+
sessionMetadata?: Record<string, unknown>;
|
|
109
173
|
}
|
|
110
174
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,UAAU;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,oDAAqD,CAAC;AACxF,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC;AAElF;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAC;AACvD,eAAO,MAAM,gBAAgB,EAAE,SAAS,SAAS,EAA4C,CAAC;AAC9F,eAAO,MAAM,cAAc,EAAE,SAAoB,CAA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,EAAE,OAAO,CAAC,CAAC;IACnC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;;;;;OASG;IACH,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC3C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "maestro-agent-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
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>",
|
package/dist/state/todos.d.ts
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Per-session todo list backing TodoWrite.
|
|
3
|
-
*
|
|
4
|
-
* The model gets a single `todo_write` tool to upsert / mutate the list. There
|
|
5
|
-
* is no `todo_list` tool — read-side surfaces via the per-turn system
|
|
6
|
-
* reminder, which keeps the model from juggling two near-identical tools
|
|
7
|
-
* (and saves a per-turn round-trip for what is fundamentally a snapshot view).
|
|
8
|
-
*
|
|
9
|
-
* Persistence: one JSON file at `~/.maestro/sessions/<sid>.todos.json` — a
|
|
10
|
-
* snapshot of the current list, atomically written. Not JSONL: `todo_write`
|
|
11
|
-
* semantically OVERWRITES the list each call, so an append-only stream
|
|
12
|
-
* would accumulate dead entries the loader has to filter. A single JSON
|
|
13
|
-
* snapshot matches the actual semantics and is cheaper to read.
|
|
14
|
-
*
|
|
15
|
-
* Lifecycle:
|
|
16
|
-
* - `getTodoStore(sid)` lazy-creates the store and hydrates from disk if
|
|
17
|
-
* a prior turn wrote one.
|
|
18
|
-
* - `dropTodoStore(sid)` is called from `deleteMaestroSession` and
|
|
19
|
-
* `cleanupStaleMaestroSessions` (same pattern as `file-state.ts`) so the
|
|
20
|
-
* module-level map can't outlive its sessions.
|
|
21
|
-
*
|
|
22
|
-
* Invariants enforced at upsert time:
|
|
23
|
-
* - At most one entry is `in_progress`. Setting a second one to
|
|
24
|
-
* `in_progress` flips any prior one to `pending` and warns the caller
|
|
25
|
-
* via the tool result. Mirrors Claude Code's TodoWrite contract.
|
|
26
|
-
* - IDs are auto-assigned (`task-1`, `task-2`, …) when omitted. Short IDs
|
|
27
|
-
* so the model can refer back to them in prose without bloat.
|
|
28
|
-
*/
|
|
29
|
-
export type TodoStatus = "pending" | "in_progress" | "completed";
|
|
30
|
-
export interface TodoEntry {
|
|
31
|
-
id: string;
|
|
32
|
-
content: string;
|
|
33
|
-
status: TodoStatus;
|
|
34
|
-
/** Optional present-continuous form for spinner/status display
|
|
35
|
-
* ("Reading config" vs the imperative "Read config"). */
|
|
36
|
-
activeForm?: string;
|
|
37
|
-
}
|
|
38
|
-
export interface TodoUpsert {
|
|
39
|
-
id?: string;
|
|
40
|
-
content: string;
|
|
41
|
-
status: TodoStatus;
|
|
42
|
-
activeForm?: string;
|
|
43
|
-
}
|
|
44
|
-
export interface UpsertResult {
|
|
45
|
-
todos: TodoEntry[];
|
|
46
|
-
/** Set when the upsert had to flip a prior in_progress to pending to
|
|
47
|
-
* enforce the 1-in-progress invariant. The tool surfaces this in its
|
|
48
|
-
* result so the model knows the previously-active item was bumped. */
|
|
49
|
-
demotedId?: string;
|
|
50
|
-
}
|
|
51
|
-
export declare class TodoStore {
|
|
52
|
-
private readonly path;
|
|
53
|
-
private todos;
|
|
54
|
-
private nextCounter;
|
|
55
|
-
constructor(path: string);
|
|
56
|
-
/** Read the current list. Caller must not mutate. */
|
|
57
|
-
list(): readonly TodoEntry[];
|
|
58
|
-
/** True when the list is empty (no in-flight or pending work). */
|
|
59
|
-
isEmpty(): boolean;
|
|
60
|
-
/**
|
|
61
|
-
* Replace / upsert the entire list. Entries with an `id` that matches an
|
|
62
|
-
* existing one update that entry; entries without an id (or with an id
|
|
63
|
-
* not in the current list) become new entries with an auto-assigned id.
|
|
64
|
-
*
|
|
65
|
-
* The shape mirrors Claude Code's TodoWrite: the model passes a complete
|
|
66
|
-
* snapshot of "what I want the list to look like now," and we reconcile.
|
|
67
|
-
* That means an existing id NOT included in the incoming snapshot is
|
|
68
|
-
* dropped — TodoWrite is a snapshot replace, not a partial update.
|
|
69
|
-
*
|
|
70
|
-
* Returns `{todos, demotedId?}` so the tool can tell the model exactly
|
|
71
|
-
* what landed (incl. any in-progress demotion).
|
|
72
|
-
*/
|
|
73
|
-
upsert(incoming: TodoUpsert[]): UpsertResult;
|
|
74
|
-
/** Drop the on-disk file. Called by deleteMaestroSession via dropTodoStore. */
|
|
75
|
-
unlinkFile(): void;
|
|
76
|
-
/** Test-only: snapshot the path the store is backed by. */
|
|
77
|
-
__path(): string;
|
|
78
|
-
private nextId;
|
|
79
|
-
private hydrate;
|
|
80
|
-
/** Recover the counter from existing IDs when the file lacked the field
|
|
81
|
-
* (defensive — recent hydrate writes always include it). */
|
|
82
|
-
private deriveCounter;
|
|
83
|
-
private persist;
|
|
84
|
-
}
|
|
85
|
-
/** Resolve the absolute todos-file path for a session. Mirrors
|
|
86
|
-
* `maestroSessionPath` but with `.todos.json` instead of `.jsonl`. */
|
|
87
|
-
export declare function todosPathFor(sessionId: string): string;
|
|
88
|
-
export declare function getTodoStore(sessionId: string): TodoStore;
|
|
89
|
-
/** Drop a session's store + unlink its on-disk file. */
|
|
90
|
-
export declare function dropTodoStore(sessionId: string): void;
|
|
91
|
-
/** Test-only. Reset every store. */
|
|
92
|
-
export declare function __resetAllStores(): void;
|
|
93
|
-
/** Test-only. Count of currently-tracked sessions. */
|
|
94
|
-
export declare function __storeCount(): number;
|
|
95
|
-
//# sourceMappingURL=todos.d.ts.map
|
|
@@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AM,GAAG,MAAM,CAEtD;AAeD,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CAOzD;AAED,wDAAwD;AACxD,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAMrD;AAED,oCAAoC;AACpC,wBAAgB,gBAAgB,IAAI,IAAI,CAEvC;AAED,sDAAsD;AACtD,wBAAgB,YAAY,IAAI,MAAM,CAErC"}
|
package/dist/state/todos.js
DELETED
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
import { existsSync, mkdirSync, readFileSync, renameSync, unlinkSync, writeFileSync, } from "node:fs";
|
|
2
|
-
import { homedir } from "node:os";
|
|
3
|
-
import { dirname, join } from "node:path";
|
|
4
|
-
import { logger } from "../platform/logger.js";
|
|
5
|
-
/** Mirror of `maestroSessionsDir()` from session-store.ts — inlined here to
|
|
6
|
-
* avoid a circular import (session-store.ts needs to call
|
|
7
|
-
* `dropTodoStore` for cleanup). Two single-line copies are cheaper than
|
|
8
|
-
* extracting a shared util file for one path. */
|
|
9
|
-
function sessionsDir() {
|
|
10
|
-
return join(homedir(), ".maestro", "sessions");
|
|
11
|
-
}
|
|
12
|
-
export class TodoStore {
|
|
13
|
-
path;
|
|
14
|
-
todos = [];
|
|
15
|
-
nextCounter = 1;
|
|
16
|
-
constructor(path) {
|
|
17
|
-
this.path = path;
|
|
18
|
-
this.hydrate();
|
|
19
|
-
}
|
|
20
|
-
/** Read the current list. Caller must not mutate. */
|
|
21
|
-
list() {
|
|
22
|
-
return this.todos;
|
|
23
|
-
}
|
|
24
|
-
/** True when the list is empty (no in-flight or pending work). */
|
|
25
|
-
isEmpty() {
|
|
26
|
-
return this.todos.length === 0;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Replace / upsert the entire list. Entries with an `id` that matches an
|
|
30
|
-
* existing one update that entry; entries without an id (or with an id
|
|
31
|
-
* not in the current list) become new entries with an auto-assigned id.
|
|
32
|
-
*
|
|
33
|
-
* The shape mirrors Claude Code's TodoWrite: the model passes a complete
|
|
34
|
-
* snapshot of "what I want the list to look like now," and we reconcile.
|
|
35
|
-
* That means an existing id NOT included in the incoming snapshot is
|
|
36
|
-
* dropped — TodoWrite is a snapshot replace, not a partial update.
|
|
37
|
-
*
|
|
38
|
-
* Returns `{todos, demotedId?}` so the tool can tell the model exactly
|
|
39
|
-
* what landed (incl. any in-progress demotion).
|
|
40
|
-
*/
|
|
41
|
-
upsert(incoming) {
|
|
42
|
-
const out = [];
|
|
43
|
-
let demotedId;
|
|
44
|
-
// First pass: build the new list, assigning IDs to entries that need
|
|
45
|
-
// them. We do this BEFORE the 1-in-progress sweep so the auto-IDs are
|
|
46
|
-
// available for the warning message.
|
|
47
|
-
for (const item of incoming) {
|
|
48
|
-
const id = item.id?.trim() || this.nextId();
|
|
49
|
-
out.push({
|
|
50
|
-
id,
|
|
51
|
-
content: item.content,
|
|
52
|
-
status: item.status,
|
|
53
|
-
...(item.activeForm ? { activeForm: item.activeForm } : {}),
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
// Second pass: enforce 1-in-progress. Walk in incoming order; the LAST
|
|
57
|
-
// in_progress wins (mirrors how a model batch-updates and the final
|
|
58
|
-
// entry expresses current intent). Earlier in_progress entries are
|
|
59
|
-
// flipped to pending and surfaced via `demotedId`.
|
|
60
|
-
let lastInProgressIdx = -1;
|
|
61
|
-
for (let i = 0; i < out.length; i++) {
|
|
62
|
-
if (out[i].status === "in_progress")
|
|
63
|
-
lastInProgressIdx = i;
|
|
64
|
-
}
|
|
65
|
-
if (lastInProgressIdx >= 0) {
|
|
66
|
-
for (let i = 0; i < out.length; i++) {
|
|
67
|
-
if (i === lastInProgressIdx)
|
|
68
|
-
continue;
|
|
69
|
-
if (out[i].status === "in_progress") {
|
|
70
|
-
out[i] = { ...out[i], status: "pending" };
|
|
71
|
-
demotedId = out[i].id;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
this.todos = out;
|
|
76
|
-
this.persist();
|
|
77
|
-
return demotedId !== undefined ? { todos: out, demotedId } : { todos: out };
|
|
78
|
-
}
|
|
79
|
-
/** Drop the on-disk file. Called by deleteMaestroSession via dropTodoStore. */
|
|
80
|
-
unlinkFile() {
|
|
81
|
-
try {
|
|
82
|
-
unlinkSync(this.path);
|
|
83
|
-
}
|
|
84
|
-
catch (e) {
|
|
85
|
-
if (e?.code !== "ENOENT") {
|
|
86
|
-
logger.warn({ err: e, path: this.path }, "TodoStore.unlinkFile failed");
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
/** Test-only: snapshot the path the store is backed by. */
|
|
91
|
-
__path() {
|
|
92
|
-
return this.path;
|
|
93
|
-
}
|
|
94
|
-
// --- internals ---------------------------------------------------------
|
|
95
|
-
nextId() {
|
|
96
|
-
const id = `task-${this.nextCounter}`;
|
|
97
|
-
this.nextCounter++;
|
|
98
|
-
return id;
|
|
99
|
-
}
|
|
100
|
-
hydrate() {
|
|
101
|
-
if (!existsSync(this.path))
|
|
102
|
-
return;
|
|
103
|
-
try {
|
|
104
|
-
const raw = readFileSync(this.path, "utf8");
|
|
105
|
-
const parsed = JSON.parse(raw);
|
|
106
|
-
if (parsed.version !== 1 || !Array.isArray(parsed.todos)) {
|
|
107
|
-
logger.warn({ path: this.path }, "TodoStore.hydrate: unsupported schema, ignoring");
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
this.todos = parsed.todos.filter(isWellFormedEntry);
|
|
111
|
-
this.nextCounter = Math.max(1, parsed.nextCounter ?? this.deriveCounter());
|
|
112
|
-
}
|
|
113
|
-
catch (e) {
|
|
114
|
-
logger.warn({ err: e, path: this.path }, "TodoStore.hydrate: parse failed, starting empty");
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
/** Recover the counter from existing IDs when the file lacked the field
|
|
118
|
-
* (defensive — recent hydrate writes always include it). */
|
|
119
|
-
deriveCounter() {
|
|
120
|
-
let max = 0;
|
|
121
|
-
for (const t of this.todos) {
|
|
122
|
-
const m = /^task-(\d+)$/.exec(t.id);
|
|
123
|
-
if (m)
|
|
124
|
-
max = Math.max(max, Number.parseInt(m[1], 10));
|
|
125
|
-
}
|
|
126
|
-
return max + 1;
|
|
127
|
-
}
|
|
128
|
-
persist() {
|
|
129
|
-
const file = {
|
|
130
|
-
version: 1,
|
|
131
|
-
nextCounter: this.nextCounter,
|
|
132
|
-
todos: this.todos,
|
|
133
|
-
};
|
|
134
|
-
writeAtomic(this.path, file);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
/** Atomic write: tmp → rename. Same pattern as skills/usage.ts. */
|
|
138
|
-
function writeAtomic(path, contents) {
|
|
139
|
-
mkdirSync(dirname(path), { recursive: true });
|
|
140
|
-
const tmp = `${path}.tmp-${process.pid}-${Date.now()}`;
|
|
141
|
-
writeFileSync(tmp, JSON.stringify(contents, null, 2));
|
|
142
|
-
renameSync(tmp, path);
|
|
143
|
-
}
|
|
144
|
-
function isWellFormedEntry(v) {
|
|
145
|
-
if (!v || typeof v !== "object")
|
|
146
|
-
return false;
|
|
147
|
-
const o = v;
|
|
148
|
-
if (typeof o.id !== "string" || typeof o.content !== "string")
|
|
149
|
-
return false;
|
|
150
|
-
if (o.status !== "pending" && o.status !== "in_progress" && o.status !== "completed") {
|
|
151
|
-
return false;
|
|
152
|
-
}
|
|
153
|
-
if (o.activeForm !== undefined && typeof o.activeForm !== "string")
|
|
154
|
-
return false;
|
|
155
|
-
return true;
|
|
156
|
-
}
|
|
157
|
-
/** Resolve the absolute todos-file path for a session. Mirrors
|
|
158
|
-
* `maestroSessionPath` but with `.todos.json` instead of `.jsonl`. */
|
|
159
|
-
export function todosPathFor(sessionId) {
|
|
160
|
-
return join(sessionsDir(), `${sessionId}.todos.json`);
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* Module-level registry — same pattern as `file-state.ts`.
|
|
164
|
-
*
|
|
165
|
-
* The maestroProvider rebuilds tools each turn but the sessionId persists
|
|
166
|
-
* across turns. A registry-local store would re-hydrate every turn (cheap
|
|
167
|
-
* but wasteful); a module-level cache keeps the in-memory list hot.
|
|
168
|
-
*
|
|
169
|
-
* Cleanup is wired into `deleteMaestroSession` and
|
|
170
|
-
* `cleanupStaleMaestroSessions` (see session-store.ts) so the map can't
|
|
171
|
-
* outlive its sessions.
|
|
172
|
-
*/
|
|
173
|
-
const stores = new Map();
|
|
174
|
-
export function getTodoStore(sessionId) {
|
|
175
|
-
let s = stores.get(sessionId);
|
|
176
|
-
if (!s) {
|
|
177
|
-
s = new TodoStore(todosPathFor(sessionId));
|
|
178
|
-
stores.set(sessionId, s);
|
|
179
|
-
}
|
|
180
|
-
return s;
|
|
181
|
-
}
|
|
182
|
-
/** Drop a session's store + unlink its on-disk file. */
|
|
183
|
-
export function dropTodoStore(sessionId) {
|
|
184
|
-
const s = stores.get(sessionId);
|
|
185
|
-
if (s) {
|
|
186
|
-
s.unlinkFile();
|
|
187
|
-
stores.delete(sessionId);
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
/** Test-only. Reset every store. */
|
|
191
|
-
export function __resetAllStores() {
|
|
192
|
-
stores.clear();
|
|
193
|
-
}
|
|
194
|
-
/** Test-only. Count of currently-tracked sessions. */
|
|
195
|
-
export function __storeCount() {
|
|
196
|
-
return stores.size;
|
|
197
|
-
}
|
|
198
|
-
//# sourceMappingURL=todos.js.map
|
package/dist/state/todos.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"todos.js","sourceRoot":"","sources":["../../src/state/todos.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,SAAS,EACT,YAAY,EACZ,UAAU,EACV,UAAU,EACV,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,MAAM,EAA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@@
|
|
|
1
|
-
/**
|
|
2
|
-
* Check whether `filePath` is allowed by the sandbox. Returns null on allow,
|
|
3
|
-
* or an error message string on deny. Callers stringify the error into a
|
|
4
|
-
* `{error}` payload so the model sees a structured rejection.
|
|
5
|
-
*
|
|
6
|
-
* The path is normalized (`..` collapsed) but symlinks are NOT followed.
|
|
7
|
-
* Caller is responsible for ensuring `filePath` is already absolute — the
|
|
8
|
-
* Read/Write/Edit tools enforce that at the top of `execute`.
|
|
9
|
-
*/
|
|
10
|
-
export declare function checkFilesystemAccess(filePath: string): string | null;
|
|
11
|
-
/** Whether the sandbox is currently active. Default is OFF; the operator
|
|
12
|
-
* opts in by exporting `MAESTRO_FS_SANDBOX_ENABLED=1`. Read each call so a
|
|
13
|
-
* test can toggle it without restarting the process. */
|
|
14
|
-
export declare function isSandboxEnabled(): boolean;
|
|
15
|
-
export declare const __ENV_ENABLED = "MAESTRO_FS_SANDBOX_ENABLED";
|
|
16
|
-
//# sourceMappingURL=sandbox.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sandbox.d.ts","sourceRoot":"","sources":["../../../src/tools/builtin/sandbox.ts"],"names":[],"mappings":"AA+BA;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAYrE;AAED;;yDAEyD;AACzD,wBAAgB,gBAAgB,IAAI,OAAO,CAE1C;AAED,eAAO,MAAM,aAAa,+BAAc,CAAC"}
|
|
@@ -1,59 +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}` (defaults to `~/maestro-workspace`, override via
|
|
17
|
-
* `MAESTRO_WORKSPACE_DIR`) are allowed when enabled; system paths
|
|
18
|
-
* (`~/.ssh`, `/etc`, `/usr`, sibling project clones, etc.) are rejected.
|
|
19
|
-
* Useful for multi-tenant or hardened setups where the model should not be
|
|
20
|
-
* trusted with arbitrary FS access.
|
|
21
|
-
*
|
|
22
|
-
* Symlink note: we resolve `..` segments via `path.resolve` but do NOT
|
|
23
|
-
* follow symlinks (no `realpathSync`) — a symlink inside the workspace
|
|
24
|
-
* pointing OUT is still considered inside (the link target is what gets
|
|
25
|
-
* written/read, and the user explicitly placed that link there). Tightening
|
|
26
|
-
* this is a follow-up if it ever matters.
|
|
27
|
-
*/
|
|
28
|
-
const ENV_ENABLED = "MAESTRO_FS_SANDBOX_ENABLED";
|
|
29
|
-
/**
|
|
30
|
-
* Check whether `filePath` is allowed by the sandbox. Returns null on allow,
|
|
31
|
-
* or an error message string on deny. Callers stringify the error into a
|
|
32
|
-
* `{error}` payload so the model sees a structured rejection.
|
|
33
|
-
*
|
|
34
|
-
* The path is normalized (`..` collapsed) but symlinks are NOT followed.
|
|
35
|
-
* Caller is responsible for ensuring `filePath` is already absolute — the
|
|
36
|
-
* Read/Write/Edit tools enforce that at the top of `execute`.
|
|
37
|
-
*/
|
|
38
|
-
export function checkFilesystemAccess(filePath) {
|
|
39
|
-
if (!isSandboxEnabled())
|
|
40
|
-
return null;
|
|
41
|
-
const resolved = resolvePath(filePath);
|
|
42
|
-
// Allow path === root and any descendant. The separator suffix avoids
|
|
43
|
-
// `WORKSPACE_DIR-sibling` style false-allows.
|
|
44
|
-
if (resolved === WORKSPACE_DIR)
|
|
45
|
-
return null;
|
|
46
|
-
const prefix = WORKSPACE_DIR.endsWith("/") ? WORKSPACE_DIR : `${WORKSPACE_DIR}/`;
|
|
47
|
-
if (resolved.startsWith(prefix))
|
|
48
|
-
return null;
|
|
49
|
-
return (`Sandbox: path '${filePath}' is outside the workspace root (${WORKSPACE_DIR}). ` +
|
|
50
|
-
`Unset ${ENV_ENABLED} or scope the operation under the workspace.`);
|
|
51
|
-
}
|
|
52
|
-
/** Whether the sandbox is currently active. Default is OFF; the operator
|
|
53
|
-
* opts in by exporting `MAESTRO_FS_SANDBOX_ENABLED=1`. Read each call so a
|
|
54
|
-
* test can toggle it without restarting the process. */
|
|
55
|
-
export function isSandboxEnabled() {
|
|
56
|
-
return process.env[ENV_ENABLED] === "1";
|
|
57
|
-
}
|
|
58
|
-
export const __ENV_ENABLED = ENV_ENABLED;
|
|
59
|
-
//# 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;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;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,29 +0,0 @@
|
|
|
1
|
-
import type { TodoStore } from "../../state/todos.js";
|
|
2
|
-
import type { ToolHandler } from "../../tools/registry.js";
|
|
3
|
-
/**
|
|
4
|
-
* `todo_write` builtin — TodoWrite-style task tracking for maestro.
|
|
5
|
-
*
|
|
6
|
-
* One tool, snapshot-replace semantics: the model passes the COMPLETE list
|
|
7
|
-
* it wants in place, and the store reconciles (upsert by id, drop entries
|
|
8
|
-
* absent from the snapshot, auto-assign ids on new items).
|
|
9
|
-
*
|
|
10
|
-
* Claude Code parity:
|
|
11
|
-
* - No separate `todo_list`. Read-side surfaces via the per-turn system
|
|
12
|
-
* reminder, which renders the current list each turn — no extra
|
|
13
|
-
* round-trip + no decision surface for "which tool do I call?".
|
|
14
|
-
* - 1-in-progress invariant. The LAST `in_progress` in the incoming
|
|
15
|
-
* snapshot wins; earlier in_progress entries are flipped to `pending`
|
|
16
|
-
* and the demoted id is reported back so the model knows.
|
|
17
|
-
*
|
|
18
|
-
* Side-effecting: every call mutates the store + persists to disk.
|
|
19
|
-
* `parallelSafe: false` is the right default — running two `todo_write`
|
|
20
|
-
* calls in parallel would race the snapshot.
|
|
21
|
-
*/
|
|
22
|
-
export interface TodoWriteToolOptions {
|
|
23
|
-
/** Required. The per-session store. Built by maestroProvider via
|
|
24
|
-
* `getTodoStore(sessionId)` so the same instance is shared across
|
|
25
|
-
* every tool call in this turn. */
|
|
26
|
-
store: TodoStore;
|
|
27
|
-
}
|
|
28
|
-
export declare function createTodoWriteTool(opts: TodoWriteToolOptions): ToolHandler;
|
|
29
|
-
//# sourceMappingURL=todo_write.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"todo_write.d.ts","sourceRoot":"","sources":["../../../src/tools/builtin/todo_write.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAc,MAAM,eAAe,CAAC;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD;;;;;;;;;;;;;;;;;;GAkBG;AAEH,MAAM,WAAW,oBAAoB;IACnC;;wCAEoC;IACpC,KAAK,EAAE,SAAS,CAAC;CAClB;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,oBAAoB,GAAG,WAAW,CA+E3E"}
|