pi-daddy 0.15.0 → 0.16.0

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 (66) hide show
  1. package/CHANGELOG.md +91 -0
  2. package/README.md +27 -12
  3. package/dist/cli.js +0 -0
  4. package/dist/executor.d.ts +38 -0
  5. package/dist/executor.d.ts.map +1 -0
  6. package/dist/executor.js +93 -0
  7. package/dist/executor.js.map +1 -0
  8. package/dist/herdr-cli.d.ts +78 -0
  9. package/dist/herdr-cli.d.ts.map +1 -0
  10. package/dist/herdr-cli.js +113 -0
  11. package/dist/herdr-cli.js.map +1 -0
  12. package/dist/herdr-name.d.ts +37 -0
  13. package/dist/herdr-name.d.ts.map +1 -0
  14. package/dist/herdr-name.js +59 -0
  15. package/dist/herdr-name.js.map +1 -0
  16. package/dist/herdr-poll.d.ts +104 -0
  17. package/dist/herdr-poll.d.ts.map +1 -0
  18. package/dist/herdr-poll.js +150 -0
  19. package/dist/herdr-poll.js.map +1 -0
  20. package/dist/herdr-stage.d.ts +40 -0
  21. package/dist/herdr-stage.d.ts.map +1 -0
  22. package/dist/herdr-stage.js +54 -0
  23. package/dist/herdr-stage.js.map +1 -0
  24. package/dist/ledger-report.d.ts +18 -0
  25. package/dist/ledger-report.d.ts.map +1 -1
  26. package/dist/ledger-report.js +10 -0
  27. package/dist/ledger-report.js.map +1 -1
  28. package/dist/ledger.d.ts +17 -0
  29. package/dist/ledger.d.ts.map +1 -1
  30. package/dist/ledger.js +1 -0
  31. package/dist/ledger.js.map +1 -1
  32. package/dist/pane-reaper.d.ts +66 -4
  33. package/dist/pane-reaper.d.ts.map +1 -1
  34. package/dist/pane-reaper.js +131 -9
  35. package/dist/pane-reaper.js.map +1 -1
  36. package/dist/progress.d.ts +96 -0
  37. package/dist/progress.d.ts.map +1 -0
  38. package/dist/progress.js +167 -0
  39. package/dist/progress.js.map +1 -0
  40. package/dist/run-child.d.ts +27 -0
  41. package/dist/run-child.d.ts.map +1 -1
  42. package/dist/run-child.js +84 -7
  43. package/dist/run-child.js.map +1 -1
  44. package/dist/run-herdr.d.ts +41 -28
  45. package/dist/run-herdr.d.ts.map +1 -1
  46. package/dist/run-herdr.js +150 -167
  47. package/dist/run-herdr.js.map +1 -1
  48. package/extensions/delegation.ts +94 -2
  49. package/extensions/grants-command.ts +26 -1
  50. package/extensions/grants.ts +85 -163
  51. package/extensions/run-delegation.ts +70 -8
  52. package/extensions/session-report.ts +231 -0
  53. package/extensions/session.ts +63 -11
  54. package/extensions/tripwire.ts +44 -0
  55. package/package.json +17 -1
  56. package/src/executor.ts +122 -0
  57. package/src/herdr-cli.ts +125 -0
  58. package/src/herdr-name.ts +61 -0
  59. package/src/herdr-poll.ts +185 -0
  60. package/src/herdr-stage.ts +55 -0
  61. package/src/ledger-report.ts +21 -0
  62. package/src/ledger.ts +18 -0
  63. package/src/pane-reaper.ts +147 -9
  64. package/src/progress.ts +206 -0
  65. package/src/run-child.ts +96 -7
  66. package/src/run-herdr.ts +170 -174
@@ -0,0 +1,104 @@
1
+ /**
2
+ * Waiting for a herdr agent to settle, and reading what it printed on the way.
3
+ *
4
+ * Split out of `src/run-herdr.ts` when that file hit **404 of the 400-line ceiling** adding ADR-0032's output
5
+ * polling. The seam was named in the plan before it was needed, and it is a real one: this module is about
6
+ * *observing* an agent, `run-herdr.ts` is about *starting and cleaning up after* one. Nothing here creates or
7
+ * destroys anything.
8
+ *
9
+ * The two facts it is built on were measured against real herdr 0.7.5 (`docs/probes/g16-herdr`) and both are
10
+ * counter-intuitive enough to be worth the module comment: `agent wait --until idle` matches the state the
11
+ * agent was **already** in, and `agent read` is the one command that does **not** return a JSON envelope.
12
+ */
13
+ import { type HerdrExec } from "./herdr-cli.ts";
14
+ /**
15
+ * What `waitForSettled` needs from a run request.
16
+ *
17
+ * Declared here rather than importing `HerdrRunRequest`, which would make the two modules mutually dependent
18
+ * for no benefit. `HerdrRunRequest` satisfies it structurally, so the call site needs no adapter.
19
+ */
20
+ export interface PollTarget {
21
+ /** herdr agent name. */
22
+ name: string;
23
+ signal?: AbortSignal;
24
+ /**
25
+ * The pane's last few lines, re-reported on every poll — a SNAPSHOT, not a stream (ADR-0032).
26
+ *
27
+ * The consumer must **replace** what it holds rather than append. `agent read` returns a snapshot of a
28
+ * bounded terminal, and treating it as append-only is what produced an 89,000× amplification; see
29
+ * `tailLines`.
30
+ */
31
+ onSnapshot?: (lines: string[]) => void;
32
+ /** How many lines the display wants. Bounds the per-poll cost regardless of how big the pane is. */
33
+ snapshotLines?: number;
34
+ /** Poll cadence override. Exists so tests do not wait `POLL_INTERVAL_MS` per state transition. */
35
+ pollIntervalMs?: number;
36
+ }
37
+ /** How often to poll `agent get` while waiting for the child to settle. */
38
+ export declare const POLL_INTERVAL_MS = 750;
39
+ /** Lines of pane tail reported per poll. Matches the status block's own tail, so nothing is fetched unused. */
40
+ export declare const DEFAULT_SNAPSHOT_LINES = 3;
41
+ /**
42
+ * Wait for the child to settle, without accepting the state it was already in.
43
+ *
44
+ * **R-33, measured.** `herdr agent wait --until idle` called right after `agent prompt` returned
45
+ * *immediately*, matching the agent's **pre-existing** idle state with `state_change_seq` unchanged — a
46
+ * reply indistinguishable from a completed run. For fan-out that is not an inconvenience but a
47
+ * correctness bug: an orchestrator would "collect" N children that never ran and merge N empty results
48
+ * into a confident summary (R-03 with a new cause).
49
+ *
50
+ * So this polls `agent get` and requires **both** that the status is terminal **and** that
51
+ * `state_change_seq` has advanced past the value observed before prompting. `agent wait` is deliberately
52
+ * not used at all: its contract cannot express "settled *after* this point".
53
+ */
54
+ export declare function waitForSettled(exec: HerdrExec, request: PollTarget, before: number, deadline: number, maxOutputBytes: number): Promise<{
55
+ status?: string;
56
+ timedOut?: boolean;
57
+ aborted?: boolean;
58
+ spawnError?: string;
59
+ }>;
60
+ /**
61
+ * The last `keep` non-blank lines of a pane snapshot — what the display actually needs.
62
+ *
63
+ * **This replaces a `newSuffix` diff, and the replacement is a correction rather than a tune-up.** The old
64
+ * design treated `agent read` as a *stream* and tried to report only what was new, by testing whether the new
65
+ * text extended the old. That is wrong about the substrate: `agent read` returns a **snapshot of a bounded
66
+ * terminal**, and a snapshot is not an append-only log. Two ordinary things break the prefix test forever —
67
+ * the pane **scrolling** (its top lines are gone, so the new text is not an extension of the old) and
68
+ * `readPane` **truncating to the tail** past `maxOutputBytes` (each read is a different window of a growing
69
+ * buffer). Once either happens, every poll reported the whole buffer.
70
+ *
71
+ * Measured before the fix: **51 MiB streamed for ~600 bytes of real output — 89,000× amplification** in 37
72
+ * seconds, per child, with a scrolling pane also delivering the same real lines three times each. The old
73
+ * docstring named that exact failure as the thing it prevented.
74
+ *
75
+ * So the herdr path now reports a **bounded snapshot** and the consumer *replaces* rather than appends. There
76
+ * is no diff to get wrong, the per-poll cost is `keep` lines regardless of buffer size, and a scrolling pane
77
+ * simply shows its current tail — which is what a human looking at that pane would see.
78
+ */
79
+ export declare function tailLines(snapshot: string, keep: number): string[];
80
+ /**
81
+ * Read the pane's contents.
82
+ *
83
+ * `agent read` is the ONE command that does not return herdr's JSON envelope — it writes the terminal's
84
+ * text straight to stdout. Running it through `parseReply` turned every successful read into
85
+ * "unparseable herdr reply", i.e. reported the child's actual answer as a failure to read it. Found by the
86
+ * end-to-end run; the unit fake had been written to the envelope shape and so agreed with the bug.
87
+ *
88
+ * A JSON envelope is still accepted first, because an `error` reply here IS JSON and must not be mistaken
89
+ * for terminal output.
90
+ *
91
+ * **`readFailed` is separate from `text`, and that separation is the fix for an R-03 defect.** A failed read
92
+ * used to return its own diagnostic *as* `text` — so `runHerdrPane` returned
93
+ * `[grants] could not read the agent pane: pane is gone` **as the child's answer, with `code: 0`**, and the
94
+ * orchestrator read a failure message as a completed sub-agent's report. Measured. It mattered little when this
95
+ * ran once per child; ADR-0032 made it run on every poll, up to 800 times for a ten-minute child, so a
96
+ * transient failure went from unlikely to expected. The caller must now decide, and it cannot do so by
97
+ * inspecting a string.
98
+ */
99
+ export declare function readPane(exec: HerdrExec, name: string, maxOutputBytes: number): Promise<{
100
+ text: string;
101
+ truncated: boolean;
102
+ readFailed?: string;
103
+ }>;
104
+ //# sourceMappingURL=herdr-poll.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"herdr-poll.d.ts","sourceRoot":"","sources":["../src/herdr-poll.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE5D;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB,wBAAwB;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACvC,oGAAoG;IACpG,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kGAAkG;IAClG,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAKD,2EAA2E;AAC3E,eAAO,MAAM,gBAAgB,MAAM,CAAC;AACpC,+GAA+G;AAC/G,eAAO,MAAM,sBAAsB,IAAI,CAAC;AAExC;;;;;;;;;;;;GAYG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,SAAS,EACf,OAAO,EAAE,UAAU,EACnB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAoC1F;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAalE;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,QAAQ,CAC5B,IAAI,EAAE,SAAS,EACf,IAAI,EAAE,MAAM,EACZ,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAuBpE"}
@@ -0,0 +1,150 @@
1
+ /**
2
+ * Waiting for a herdr agent to settle, and reading what it printed on the way.
3
+ *
4
+ * Split out of `src/run-herdr.ts` when that file hit **404 of the 400-line ceiling** adding ADR-0032's output
5
+ * polling. The seam was named in the plan before it was needed, and it is a real one: this module is about
6
+ * *observing* an agent, `run-herdr.ts` is about *starting and cleaning up after* one. Nothing here creates or
7
+ * destroys anything.
8
+ *
9
+ * The two facts it is built on were measured against real herdr 0.7.5 (`docs/probes/g16-herdr`) and both are
10
+ * counter-intuitive enough to be worth the module comment: `agent wait --until idle` matches the state the
11
+ * agent was **already** in, and `agent read` is the one command that does **not** return a JSON envelope.
12
+ */
13
+ import { parseReply } from "./herdr-cli.js";
14
+ /** Statuses herdr reports for a settled agent. `blocked` counts: it is waiting for a human, not working. */
15
+ const TERMINAL = new Set(["idle", "done", "blocked"]);
16
+ /** How often to poll `agent get` while waiting for the child to settle. */
17
+ export const POLL_INTERVAL_MS = 750;
18
+ /** Lines of pane tail reported per poll. Matches the status block's own tail, so nothing is fetched unused. */
19
+ export const DEFAULT_SNAPSHOT_LINES = 3;
20
+ /**
21
+ * Wait for the child to settle, without accepting the state it was already in.
22
+ *
23
+ * **R-33, measured.** `herdr agent wait --until idle` called right after `agent prompt` returned
24
+ * *immediately*, matching the agent's **pre-existing** idle state with `state_change_seq` unchanged — a
25
+ * reply indistinguishable from a completed run. For fan-out that is not an inconvenience but a
26
+ * correctness bug: an orchestrator would "collect" N children that never ran and merge N empty results
27
+ * into a confident summary (R-03 with a new cause).
28
+ *
29
+ * So this polls `agent get` and requires **both** that the status is terminal **and** that
30
+ * `state_change_seq` has advanced past the value observed before prompting. `agent wait` is deliberately
31
+ * not used at all: its contract cannot express "settled *after* this point".
32
+ */
33
+ export async function waitForSettled(exec, request, before, deadline, maxOutputBytes) {
34
+ const interval = request.pollIntervalMs ?? POLL_INTERVAL_MS;
35
+ // ADR-0032. The pane is read on every poll so the parent can show what the child is doing, rather than the
36
+ // one word `delegate` for up to ten minutes.
37
+ //
38
+ // No cross-poll state is kept, deliberately: the previous design remembered what it had reported so it could
39
+ // send a diff, and that is what broke — see `tailLines`. A snapshot needs no memory.
40
+ const keep = request.snapshotLines ?? DEFAULT_SNAPSHOT_LINES;
41
+ for (;;) {
42
+ if (request.signal?.aborted)
43
+ return { aborted: true };
44
+ if (Date.now() >= deadline)
45
+ return { timedOut: true };
46
+ const reply = parseReply(await exec(["agent", "get", request.name]));
47
+ if (reply.error)
48
+ return { spawnError: `herdr agent get failed: ${reply.error}` };
49
+ const agent = (reply.result?.agent ?? reply.result ?? {});
50
+ const status = agent.agent_status;
51
+ const seq = typeof agent.state_change_seq === "number" ? agent.state_change_seq : -1;
52
+ if (request.onSnapshot) {
53
+ // Read BEFORE the terminal check returns, so a child that settles on this iteration still has its last
54
+ // output shown. `readFailed` is passed so a failed read renders as such instead of silently freezing the
55
+ // block on the previous frame — and, crucially, is never mistaken for the child's output.
56
+ const read = await readPane(exec, request.name, maxOutputBytes);
57
+ try {
58
+ request.onSnapshot(read.readFailed ? ["[pane could not be read]"] : tailLines(read.text, keep));
59
+ }
60
+ catch {
61
+ /* display only — a renderer must not break a governed run */
62
+ }
63
+ }
64
+ if (status && TERMINAL.has(status) && seq > before)
65
+ return { status };
66
+ await new Promise((r) => setTimeout(r, Math.min(interval, Math.max(0, deadline - Date.now()))));
67
+ }
68
+ }
69
+ /**
70
+ * The last `keep` non-blank lines of a pane snapshot — what the display actually needs.
71
+ *
72
+ * **This replaces a `newSuffix` diff, and the replacement is a correction rather than a tune-up.** The old
73
+ * design treated `agent read` as a *stream* and tried to report only what was new, by testing whether the new
74
+ * text extended the old. That is wrong about the substrate: `agent read` returns a **snapshot of a bounded
75
+ * terminal**, and a snapshot is not an append-only log. Two ordinary things break the prefix test forever —
76
+ * the pane **scrolling** (its top lines are gone, so the new text is not an extension of the old) and
77
+ * `readPane` **truncating to the tail** past `maxOutputBytes` (each read is a different window of a growing
78
+ * buffer). Once either happens, every poll reported the whole buffer.
79
+ *
80
+ * Measured before the fix: **51 MiB streamed for ~600 bytes of real output — 89,000× amplification** in 37
81
+ * seconds, per child, with a scrolling pane also delivering the same real lines three times each. The old
82
+ * docstring named that exact failure as the thing it prevented.
83
+ *
84
+ * So the herdr path now reports a **bounded snapshot** and the consumer *replaces* rather than appends. There
85
+ * is no diff to get wrong, the per-poll cost is `keep` lines regardless of buffer size, and a scrolling pane
86
+ * simply shows its current tail — which is what a human looking at that pane would see.
87
+ */
88
+ export function tailLines(snapshot, keep) {
89
+ if (keep <= 0)
90
+ return [];
91
+ const lines = [];
92
+ // Walked from the END, so a 1 MiB buffer costs the last few lines rather than a full split.
93
+ let end = snapshot.length;
94
+ while (end > 0 && lines.length < keep) {
95
+ const start = snapshot.lastIndexOf("\n", end - 1);
96
+ const line = snapshot.slice(start + 1, end).replace(/\r/g, "").trimEnd();
97
+ if (line.length > 0)
98
+ lines.unshift(line);
99
+ if (start === -1)
100
+ break;
101
+ end = start;
102
+ }
103
+ return lines;
104
+ }
105
+ /**
106
+ * Read the pane's contents.
107
+ *
108
+ * `agent read` is the ONE command that does not return herdr's JSON envelope — it writes the terminal's
109
+ * text straight to stdout. Running it through `parseReply` turned every successful read into
110
+ * "unparseable herdr reply", i.e. reported the child's actual answer as a failure to read it. Found by the
111
+ * end-to-end run; the unit fake had been written to the envelope shape and so agreed with the bug.
112
+ *
113
+ * A JSON envelope is still accepted first, because an `error` reply here IS JSON and must not be mistaken
114
+ * for terminal output.
115
+ *
116
+ * **`readFailed` is separate from `text`, and that separation is the fix for an R-03 defect.** A failed read
117
+ * used to return its own diagnostic *as* `text` — so `runHerdrPane` returned
118
+ * `[grants] could not read the agent pane: pane is gone` **as the child's answer, with `code: 0`**, and the
119
+ * orchestrator read a failure message as a completed sub-agent's report. Measured. It mattered little when this
120
+ * ran once per child; ADR-0032 made it run on every poll, up to 800 times for a ten-minute child, so a
121
+ * transient failure went from unlikely to expected. The caller must now decide, and it cannot do so by
122
+ * inspecting a string.
123
+ */
124
+ export async function readPane(exec, name, maxOutputBytes) {
125
+ const reply = await exec(["agent", "read", name]);
126
+ let text;
127
+ try {
128
+ const parsed = JSON.parse(reply.stdout);
129
+ if (parsed.error) {
130
+ return { text: "", truncated: false, readFailed: parsed.error.message ?? "unknown error" };
131
+ }
132
+ const raw = parsed.result?.output ?? parsed.result?.text ?? parsed.result?.content ?? "";
133
+ text = typeof raw === "string" ? raw : JSON.stringify(raw);
134
+ }
135
+ catch {
136
+ text = reply.stdout;
137
+ }
138
+ if (Buffer.byteLength(text) <= maxOutputBytes)
139
+ return { text, truncated: false };
140
+ // Keep the TAIL, not the head: a terminal's useful content is its most recent output, and the head is
141
+ // the startup banner. `runChild` keeps the head because it streams and must stop a runaway producer;
142
+ // here the output is already complete, so the choice is free and the tail is the answer.
143
+ //
144
+ // Sliced by BYTES via a Buffer round trip rather than by code units, for `takeBytes`'s reason in
145
+ // `run-child.ts`: `slice(-maxOutputBytes)` on a CJK pane overran the cap by three times. `toString` repairs
146
+ // a character split at the cut by replacing it, which is the right trade for a tail — one replacement
147
+ // character at the boundary, versus a cap that does not hold.
148
+ return { text: Buffer.from(text, "utf8").subarray(-maxOutputBytes).toString("utf8"), truncated: true };
149
+ }
150
+ //# sourceMappingURL=herdr-poll.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"herdr-poll.js","sourceRoot":"","sources":["../src/herdr-poll.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,UAAU,EAAkB,MAAM,gBAAgB,CAAC;AA0B5D,4GAA4G;AAC5G,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM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,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,cAAc;QAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;IACjF,sGAAsG;IACtG,qGAAqG;IACrG,yFAAyF;IACzF,EAAE;IACF,iGAAiG;IACjG,4GAA4G;IAC5G,sGAAsG;IACtG,8DAA8D;IAC9D,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,cAAc,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;AACzG,CAAC"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Staging a definition's instructions to a file, because herdr cannot carry them in argv.
3
+ *
4
+ * Split out of `src/run-herdr.ts` at the 400-line ceiling. A real seam rather than an arbitrary cut: this is
5
+ * the one place that works around a **herdr encoding limit**, and it is the only part of the herdr path that
6
+ * touches the filesystem. `run-herdr.ts` starts and reaps agents; this prepares one argument.
7
+ */
8
+ /**
9
+ * Move a multi-line `--append-system-prompt` out of argv, because herdr cannot encode it.
10
+ *
11
+ * **Measured.** `herdr agent start` types the argv into the pane's shell, so a value containing newlines
12
+ * is rejected outright: `invalid_agent_argument — agent arguments cannot be encoded safely for the target
13
+ * shell`. A definition's `SKILL.md` body is always multi-line, so every `delegate({agent})` spawn would
14
+ * fail on this path.
15
+ *
16
+ * pi accepts a **file path** there as readily as literal text (`resolvePromptInput` + `existsSync` in
17
+ * `dist/core/resource-loader.js`), so the fix is to write the body to a temp file and pass its path — one
18
+ * short, shell-safe argument.
19
+ *
20
+ * The split lives here rather than in `planSpawn` because the constraint is **herdr's**, not pi's: the
21
+ * direct executor passes the same text inline with no trouble, and a plan builder that pre-emptively wrote
22
+ * temp files for everybody would be paying one executor's tax on both paths.
23
+ */
24
+ export declare function splitSystemPrompt(args: string[]): {
25
+ args: string[];
26
+ systemPrompt?: string;
27
+ };
28
+ /**
29
+ * Move a multi-line system prompt into a temp file and return argv pointing at it.
30
+ *
31
+ * Returns the directory so the caller can remove it — and **every** early return on the herdr path must, because
32
+ * nothing else can: a reviewer measured a permanent `/tmp/grants-herdr-*` per failed `tab create`, unreachable by
33
+ * either pane sweep because the pane it belonged to never existed.
34
+ */
35
+ export declare function stageSystemPrompt(args: string[]): Promise<{
36
+ args: string[];
37
+ promptDir?: string;
38
+ error?: string;
39
+ }>;
40
+ //# sourceMappingURL=herdr-stage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"herdr-stage.d.ts","sourceRoot":"","sources":["../src/herdr-stage.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG;IAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,CAI3F;AAED;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,MAAM,EAAE,GACb,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAWjE"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Staging a definition's instructions to a file, because herdr cannot carry them in argv.
3
+ *
4
+ * Split out of `src/run-herdr.ts` at the 400-line ceiling. A real seam rather than an arbitrary cut: this is
5
+ * the one place that works around a **herdr encoding limit**, and it is the only part of the herdr path that
6
+ * touches the filesystem. `run-herdr.ts` starts and reaps agents; this prepares one argument.
7
+ */
8
+ import { mkdtemp, writeFile } from "node:fs/promises";
9
+ import { tmpdir } from "node:os";
10
+ import { join } from "node:path";
11
+ /**
12
+ * Move a multi-line `--append-system-prompt` out of argv, because herdr cannot encode it.
13
+ *
14
+ * **Measured.** `herdr agent start` types the argv into the pane's shell, so a value containing newlines
15
+ * is rejected outright: `invalid_agent_argument — agent arguments cannot be encoded safely for the target
16
+ * shell`. A definition's `SKILL.md` body is always multi-line, so every `delegate({agent})` spawn would
17
+ * fail on this path.
18
+ *
19
+ * pi accepts a **file path** there as readily as literal text (`resolvePromptInput` + `existsSync` in
20
+ * `dist/core/resource-loader.js`), so the fix is to write the body to a temp file and pass its path — one
21
+ * short, shell-safe argument.
22
+ *
23
+ * The split lives here rather than in `planSpawn` because the constraint is **herdr's**, not pi's: the
24
+ * direct executor passes the same text inline with no trouble, and a plan builder that pre-emptively wrote
25
+ * temp files for everybody would be paying one executor's tax on both paths.
26
+ */
27
+ export function splitSystemPrompt(args) {
28
+ const at = args.indexOf("--append-system-prompt");
29
+ if (at === -1 || at + 1 >= args.length)
30
+ return { args };
31
+ return { args: [...args.slice(0, at), ...args.slice(at + 2)], systemPrompt: args[at + 1] };
32
+ }
33
+ /**
34
+ * Move a multi-line system prompt into a temp file and return argv pointing at it.
35
+ *
36
+ * Returns the directory so the caller can remove it — and **every** early return on the herdr path must, because
37
+ * nothing else can: a reviewer measured a permanent `/tmp/grants-herdr-*` per failed `tab create`, unreachable by
38
+ * either pane sweep because the pane it belonged to never existed.
39
+ */
40
+ export async function stageSystemPrompt(args) {
41
+ const split = splitSystemPrompt(args);
42
+ if (split.systemPrompt === undefined)
43
+ return { args: split.args };
44
+ try {
45
+ const promptDir = await mkdtemp(join(tmpdir(), "grants-herdr-"));
46
+ const file = join(promptDir, "system-prompt.md");
47
+ await writeFile(file, split.systemPrompt, "utf8");
48
+ return { args: [...split.args, "--append-system-prompt", file], promptDir };
49
+ }
50
+ catch (error) {
51
+ return { args: split.args, error: `could not stage the system prompt for herdr: ${String(error)}` };
52
+ }
53
+ }
54
+ //# sourceMappingURL=herdr-stage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"herdr-stage.js","sourceRoot":"","sources":["../src/herdr-stage.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,OA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;IAC9E,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,gDAAgD,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC;IACtG,CAAC;AACH,CAAC"}
@@ -23,6 +23,24 @@ export interface LedgerReport {
23
23
  }>;
24
24
  /** Records where an agent asked for more than it held — ADR-0008's designated signal. */
25
25
  escalationAttempts: number;
26
+ /**
27
+ * How many records ran under each executor, plus how many name none — ADR-0031.
28
+ *
29
+ * **Added because the field was written and never read, which is R-51's shape exactly.** R-51 was
30
+ * `definitionDigest`: recorded from the start, absent from every report, so the questions ADR-0018 advertised
31
+ * needed hand-written `jq`. `executor` arrived the same way — `src/ledger.ts` justifies making it *required*
32
+ * with "reading it back is the only reason it exists", and nothing read it back. `docs/SPEC.md` claims the
33
+ * executor is "announced three times… per child in the ledger"; without this the third announcement was to
34
+ * `jq` only.
35
+ *
36
+ * `unknown` counts pre-0.16 lines, which have no such field. Reported rather than folded into `process`,
37
+ * because "written before the executor was recorded" and "ran as a subprocess" are different facts.
38
+ */
39
+ executors: {
40
+ herdr: number;
41
+ process: number;
42
+ unknown: number;
43
+ };
26
44
  /**
27
45
  * Every distinct set of instructions this ledger saw run, with how many spawns used it (R-51).
28
46
  *
@@ -1 +1 @@
1
- {"version":3,"file":"ledger-report.d.ts","sourceRoot":"","sources":["../src/ledger-report.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAIpD,MAAM,WAAW,YAAY;IAC3B,yEAAyE;IACzE,MAAM,EAAE,OAAO,CAAC;IAChB,oCAAoC;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,iFAAiF;IACjF,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/C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,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/D;;;;;;;;;;;;OAYG;IACH,WAAW,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACrF;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,SAAS,EAAE;QACT,2FAA2F;QAC3F,QAAQ,EAAE,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;QACzC,2EAA2E;QAC3E,gBAAgB,EAAE,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;QACjD,0GAA0G;QAC1G,YAAY,EAAE,MAAM,CAAC;QACrB,uFAAuF;QACvF,WAAW,EAAE,MAAM,CAAC;QACpB;;;;;;;;WAQG;QACH,gBAAgB,EAAE,MAAM,CAAC;KAC1B,CAAC;IACF,EAAE,EAAE,OAAO,CAAC;CACb;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAiItE"}
@@ -36,6 +36,7 @@ export async function verifyLedger(path) {
36
36
  records: 0,
37
37
  corrupt: [],
38
38
  escalationAttempts: 0,
39
+ executors: { herdr: 0, process: 0, unknown: 0 },
39
40
  definitions: [],
40
41
  approvals: {
41
42
  bySource: { prompt: 0, session: 0, persisted: 0, inherited: 0 },
@@ -54,6 +55,7 @@ export async function verifyLedger(path) {
54
55
  const digests = new Map();
55
56
  let records = 0;
56
57
  let escalationAttempts = 0;
58
+ const executors = { herdr: 0, process: 0, unknown: 0 };
57
59
  const bySource = { prompt: 0, session: 0, persisted: 0, inherited: 0 };
58
60
  // `capability@subject` seen per source, so the report can state a bound as well as a raw count.
59
61
  const distinct = {
@@ -77,6 +79,13 @@ export async function verifyLedger(path) {
77
79
  records += 1;
78
80
  if (isEscalationAttempt(parsed))
79
81
  escalationAttempts += 1;
82
+ const executor = parsed.executor;
83
+ if (executor === "herdr")
84
+ executors.herdr += 1;
85
+ else if (executor === "process")
86
+ executors.process += 1;
87
+ else
88
+ executors.unknown += 1;
80
89
  if (parsed.humanDenied) {
81
90
  humanDenied += 1;
82
91
  const subject = parsed.agentType === undefined || parsed.agentType === "delegate" ? DELEGATE_SUBJECT : parsed.agentType;
@@ -138,6 +147,7 @@ export async function verifyLedger(path) {
138
147
  records,
139
148
  corrupt,
140
149
  escalationAttempts,
150
+ executors,
141
151
  definitions: [...digests.values()].sort((a, b) => a.name.localeCompare(b.name) || a.sha256.localeCompare(b.sha256)),
142
152
  approvals: {
143
153
  bySource,
@@ -1 +1 @@
1
- {"version":3,"file":"ledger-report.js","sourceRoot":"","sources":["../src/ledger-report.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAGjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AA2ElD;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,IAAY;IAC7C,IAAI,IAAY,CAAC;IACjB,IAAI,CAAC;QACH,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACtC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAK,KAA2B,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YACnD,OAAO;gBACL,MAAM,EAAE,KAAK;gBACb,OAAO,EAAE,CAAC;gBACV,OAAO,EAAE,EAAE;gBACX,kBAAkB,EAAE,CAAC;gBACrB,WAAW,EAAE,EAAE;gBACf,SAAS,EAAE;oBACT,QAAQ,EAAE,EAAE,MAAM,EAAE,CAAC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AAE,IAAI;QACZ,OAAO;QACP,OAAO;QACP,kBAAkB;QAClB,SAAS;QACT,WAAW,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;QACnH,SAAS,EAAE;YACT,QAAQ;YACR,gBAAgB,EAAE;gBAChB,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,IAAI;gBAC5B,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,IAAI;gBAC9B,SAAS,EAAE,QAAQ,CAAC,SAAS,CAAC,IAAI;gBAClC,SAAS,EAAE,QAAQ,CAAC,SAAS,CAAC,IAAI;aACnC;YACD,YAAY;YACZ,WAAW;YACX,gBAAgB,EAAE,WAAW,CAAC,IAAI;SACnC;QACD,EAAE,EAAE,OAAO,CAAC,MAAM,KAAK,CAAC;KACzB,CAAC;AACJ,CAAC"}
package/dist/ledger.d.ts CHANGED
@@ -19,6 +19,7 @@
19
19
  * "what was this child told to do?" is out of the ledger by decision, not by omission.
20
20
  */
21
21
  import type { Capability, ResolveResult } from "./resolve.ts";
22
+ import type { ExecutorKind } from "./executor.ts";
22
23
  import type { DefinitionDigest } from "./definitions.ts";
23
24
  import type { ApprovalScope, ApprovalSource } from "./approval.ts";
24
25
  import type { PromptOutcomeKind } from "./approval-prompt.ts";
@@ -101,6 +102,20 @@ export interface GrantRecord {
101
102
  * it. Absent for a `tools:`-style delegation, which has no definition.
102
103
  */
103
104
  definitionDigest?: DefinitionDigest;
105
+ /**
106
+ * WHERE this child ran — ADR-0031.
107
+ *
108
+ * **Required rather than optional**, which is unusual in this record and deliberate. Before ADR-0031 the
109
+ * executor was a variable an operator set, so "which one ran?" was answerable from configuration after the
110
+ * fact. It is now decided by a **runtime probe** at session start, so nothing outside the record preserves
111
+ * the answer — and the two paths do not produce the same argv, because the herdr plan withholds `--print`
112
+ * (`delegationContext.interactive`). A trail that cannot say where a child ran cannot be read back
113
+ * reliably, and reading it back is the only reason it exists.
114
+ *
115
+ * Written on refusals too, including the tripwire's: the honest value there is the executor the session
116
+ * *would* have used, because a refused spawn has no executor of its own.
117
+ */
118
+ executor: ExecutorKind;
104
119
  }
105
120
  export interface LedgerOptions {
106
121
  /** Path to the JSONL file. Parent directories are created on demand. */
@@ -129,6 +144,8 @@ export declare function buildRecord(args: {
129
144
  humanDenied?: boolean;
130
145
  gateOutcome?: PromptOutcomeKind;
131
146
  definitionDigest?: DefinitionDigest;
147
+ /** Where the child ran (ADR-0031). Required: the probe's answer survives nowhere else. */
148
+ executor: ExecutorKind;
132
149
  now: Date;
133
150
  }): GrantRecord;
134
151
  export { LOCK_TIMEOUT_MS, STALE_LOCK_MS } from "./file-lock.ts";
@@ -1 +1 @@
1
- {"version":3,"file":"ledger.d.ts","sourceRoot":"","sources":["../src/ledger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAKH,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAE9D,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,UAAU,EAAE,CAAC;IACxB,WAAW,EAAE,UAAU,EAAE,CAAC;IAC1B,SAAS,EA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B,MAAM,EAAE,aAAa,CAAC;IACtB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,UAAU,EAAE,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;IACrD,cAAc,CAAC,EAAE,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;IACnD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAChC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,0FAA0F;IAC1F,QAAQ,EAAE,YAAY,CAAC;IACvB,GAAG,EAAE,IAAI,CAAC;CACX,GAAG,WAAW,CAkCd;AAID,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAIhE,OAAO,EAAE,YAAY,EAAE,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAgBrE,wBAAsB,YAAY,CAAC,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAW7F;AAED,0EAA0E;AAC1E,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAEhE"}
package/dist/ledger.js CHANGED
@@ -35,6 +35,7 @@ export function buildRecord(args) {
35
35
  childId: args.childId,
36
36
  depth: args.depth,
37
37
  agentType: args.agentType,
38
+ executor: args.executor,
38
39
  requested: args.requested,
39
40
  parentGrant: args.parentGrant,
40
41
  effective: args.result.effective,
@@ -1 +1 @@
1
- {"version":3,"file":"ledger.js","sourceRoot":"","sources":["../src/ledger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;A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