pi-daddy 0.40.0 → 0.40.1

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/CHANGELOG.md CHANGED
@@ -12,6 +12,31 @@ the record of how the package got here and are worth keeping; they are not worth
12
12
  > the record of how the package arrived at what it does, and because the reasoning behind each one is
13
13
  > usually the clearest statement of why the current behaviour is what it is.
14
14
 
15
+ ## 0.40.1 — a `context:` capability could not be written to the ledger, so delegation was denied
16
+
17
+ **A session whose grant held any `context:` id could not delegate at all.** Reported from a live session:
18
+
19
+ ```
20
+ delegation refused: grants: ledger write failed, denying — TypeError: invalid ledger v3 event:
21
+ capability decision requested must contain capability identifiers
22
+ ```
23
+
24
+ `ledger-identifiers.ts` kept its OWN copy of the capability namespaces, and ADR-0078 added `context:` to the
25
+ kernel's list without it. Every capability-decision event validates six capability arrays with that predicate,
26
+ and a ledger write that throws denies the delegation — so the whole namespace took delegation down wherever it
27
+ appeared, and the message named neither the namespace nor the list.
28
+
29
+ 0.40.0 widened it rather than causing it: held-back definitions began contributing `context:` ids to the
30
+ generated grant, so far more sessions carry one. Anyone whose skills declare a handoff mode was affected from
31
+ 0.33.0 onward.
32
+
33
+ **The ledger now derives its namespaces from the kernel's list** instead of restating them, and a test asserts
34
+ every namespace the kernel defines is a valid ledger identifier. Adding a namespace without the ledger following
35
+ now fails.
36
+
37
+ This is the same shape this package has spent a session finding: one rule, two spellings, the guard on the
38
+ quieter one. A validator that restates what it validates is that shape with a ledger behind it.
39
+
15
40
  ## 0.40.0 — the file-writing tools are gated, and a held-back definition keeps its context modes
16
41
 
17
42
  **`tool:write`, `tool:edit` and `tool:edit-diff` join `tool:bash` and `context:fork` in `DEFAULT_GATED`**, by
@@ -1 +1 @@
1
- {"version":3,"file":"ledger-identifiers.d.ts","sourceRoot":"","sources":["../../src/kernel/ledger-identifiers.ts"],"names":[],"mappings":"AAKA,2GAA2G;AAC3G,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAEzE;AAED,8FAA8F;AAC9F,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAE7E;AAED,0GAA0G;AAC1G,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAI5E"}
1
+ {"version":3,"file":"ledger-identifiers.d.ts","sourceRoot":"","sources":["../../src/kernel/ledger-identifiers.ts"],"names":[],"mappings":"AAyBA,2GAA2G;AAC3G,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAEzE;AAED,8FAA8F;AAC9F,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAE7E;AAED,0GAA0G;AAC1G,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAI5E"}
@@ -1,7 +1,26 @@
1
1
  const DISPLAY_IDENTIFIER = /^[A-Za-z0-9@*][A-Za-z0-9@*._:/-]{0,511}$/;
2
2
  const CORRELATION_IDENTIFIER = /^[A-Za-z0-9@*][A-Za-z0-9@*._:/-]{0,127}$/;
3
3
  const CAPABILITY_TAIL = /^[A-Za-z0-9@*][A-Za-z0-9@*._/-]{0,255}$/;
4
- const CAPABILITY_PREFIXES = ["tool:", "skill:", "agent:", "workspace:", "ext:"];
4
+ /**
5
+ * The namespaces a ledger capability field may hold — **derived, not restated.**
6
+ *
7
+ * **This was a second copy of the list and it took a whole namespace down.** ADR-0078 added `context:` to
8
+ * `CAPABILITY_NAMESPACE_PREFIXES` and nothing added it here, so `isLedgerCapabilityIdentifier("context:summary")`
9
+ * was false. Every capability-decision event carries `requested`, `parentGrant`, `effective`, `denied`, `clipped`
10
+ * and `gatedBlocked`, all validated with this, so a session whose grant contained ANY `context:` id could not
11
+ * write a decision at all — and a ledger write that throws denies the delegation. The operator saw
12
+ * `delegation refused: grants: ledger write failed, denying — TypeError: invalid ledger v3 event: capability
13
+ * decision requested must contain capability identifiers`, with no indication that the cause was the namespace.
14
+ *
15
+ * 0.40.0 widened the blast radius rather than causing it: held-back definitions began contributing `context:`
16
+ * ids to the generated grant, so far more sessions carry one.
17
+ *
18
+ * Importing the kernel's list is the fix, and the point. This package has spent a whole session finding the same
19
+ * shape — one rule, two spellings, the guard on the quieter one — and a validator that restates what it
20
+ * validates is that shape with a ledger behind it.
21
+ */
22
+ import { CAPABILITY_NAMESPACE_PREFIXES } from "./capabilities.js";
23
+ const CAPABILITY_PREFIXES = CAPABILITY_NAMESPACE_PREFIXES;
5
24
  /** Identifier text safe to copy onto the operator's terminal; prose belongs in no ledger display field. */
6
25
  export function isLedgerDisplayIdentifier(value) {
7
26
  return typeof value === "string" && DISPLAY_IDENTIFIER.test(value);
@@ -1 +1 @@
1
- {"version":3,"file":"ledger-identifiers.js","sourceRoot":"","sources":["../../src/kernel/ledger-identifiers.ts"],"names":[],"mappings":"AAAA,MAAM,kBAAkB,GAAG,0CAA0C,CAAC;AACtE,MAAM,sBAAsB,GAAG,0CAA0C,CAAC;AAC1E,MAAM,eAAe,GAAG,yCAAyC,CAAC;AAClE,MAAM,mBAAmB,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,CAAU,CAAC;AAEzF,2GAA2G;AAC3G,MAAM,UAAU,yBAAyB,CAAC,KAAc;IACtD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACrE,CAAC;AAED,8FAA8F;AAC9F,MAAM,UAAU,6BAA6B,CAAC,KAAc;IAC1D,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,sBAAsB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACzE,CAAC;AAED,0GAA0G;AAC1G,MAAM,UAAU,4BAA4B,CAAC,KAAc;IACzD,IAAI,OAAO,KAAK,KA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,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AAC7E,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-daddy",
3
- "version": "0.40.0",
3
+ "version": "0.40.1",
4
4
  "description": "Capability governance for pi sub-agents: spawn Agent Skills (SKILL.md) definitions whose allowed-tools becomes a grant that can only narrow going down a delegation tree, enforced by pi's own --tools allowlist, with an append-only ledger.",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -1,7 +1,27 @@
1
1
  const DISPLAY_IDENTIFIER = /^[A-Za-z0-9@*][A-Za-z0-9@*._:/-]{0,511}$/;
2
2
  const CORRELATION_IDENTIFIER = /^[A-Za-z0-9@*][A-Za-z0-9@*._:/-]{0,127}$/;
3
3
  const CAPABILITY_TAIL = /^[A-Za-z0-9@*][A-Za-z0-9@*._/-]{0,255}$/;
4
- const CAPABILITY_PREFIXES = ["tool:", "skill:", "agent:", "workspace:", "ext:"] as const;
4
+ /**
5
+ * The namespaces a ledger capability field may hold — **derived, not restated.**
6
+ *
7
+ * **This was a second copy of the list and it took a whole namespace down.** ADR-0078 added `context:` to
8
+ * `CAPABILITY_NAMESPACE_PREFIXES` and nothing added it here, so `isLedgerCapabilityIdentifier("context:summary")`
9
+ * was false. Every capability-decision event carries `requested`, `parentGrant`, `effective`, `denied`, `clipped`
10
+ * and `gatedBlocked`, all validated with this, so a session whose grant contained ANY `context:` id could not
11
+ * write a decision at all — and a ledger write that throws denies the delegation. The operator saw
12
+ * `delegation refused: grants: ledger write failed, denying — TypeError: invalid ledger v3 event: capability
13
+ * decision requested must contain capability identifiers`, with no indication that the cause was the namespace.
14
+ *
15
+ * 0.40.0 widened the blast radius rather than causing it: held-back definitions began contributing `context:`
16
+ * ids to the generated grant, so far more sessions carry one.
17
+ *
18
+ * Importing the kernel's list is the fix, and the point. This package has spent a whole session finding the same
19
+ * shape — one rule, two spellings, the guard on the quieter one — and a validator that restates what it
20
+ * validates is that shape with a ledger behind it.
21
+ */
22
+ import { CAPABILITY_NAMESPACE_PREFIXES } from "./capabilities.ts";
23
+
24
+ const CAPABILITY_PREFIXES = CAPABILITY_NAMESPACE_PREFIXES;
5
25
 
6
26
  /** Identifier text safe to copy onto the operator's terminal; prose belongs in no ledger display field. */
7
27
  export function isLedgerDisplayIdentifier(value: unknown): value is string {