pi-daddy 0.49.4 → 0.49.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/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog — pi-daddy
2
2
 
3
+ ## 0.49.5 — 2026-11-03
4
+
5
+ - Retain native `not-started` operation evidence for non-approval admission-preview refusals, including missing workspace authority. Previously these refusals could leave a prepared coordinator attempt without a native operation record. The original typed refusal still throws; duplicate and conflicting IDs never overwrite an existing execution. After correcting authority, use the coordinator's explicit retry rather than redispatching the terminal ID. No permission or Auto setting changes.
6
+ - Distinguish an absent operation record from unavailable owner status in the status bridge diagnostic. Absence is not proof of no execution. This prevents future preview-refusal gaps; it does not recover historical missing records or failures before preview completion. Keep such attempts blocked pending qualified native evidence; do not fabricate a settlement or replacement ID.
7
+
3
8
  ## 0.49.4 — 2026-10-27
4
9
 
5
10
  - Show Pi custom-triggered runs as `Extension turn`, with their custom message type in details and their own starting text under the existing content-retention policy. They no longer create blank user turns or borrow queued user input. User turns and governed child authority are unchanged. Restart Pi after updating; this fixes attribution and does not by itself qualify every newer Pi integration.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # pi-daddy
2
2
 
3
- Source target: **0.49.4**. Before installation, verify that `npm view pi-daddy version` and Git tag `v0.49.4` both resolve to this release.
3
+ Source target: **0.49.5**. Before installation, verify that `npm view pi-daddy version` and Git tag `v0.49.5` both resolve to this release.
4
4
 
5
5
  **Capability governance and coordination for [pi](https://github.com/badlogic/pi-mono)'s multi-level agent system.**
6
6
  An orchestrator grants each sub-agent a deliberate subset of what it holds and withholds the rest. A sub-agent may
@@ -116,9 +116,10 @@ export async function claimDelegationOperation(
116
116
  ctx: DelegationToolContext,
117
117
  signal?: AbortSignal,
118
118
  ): Promise<OperationClaim | undefined> {
119
- if (spec.operation_id === undefined) return undefined;
119
+ const operationId = spec.operation_id;
120
+ if (operationId === undefined) return undefined;
120
121
  assertDelegationAuthority(session);
121
- if (!validOperationId(spec.operation_id)) throw Error("Invalid operation_id");
122
+ if (!validOperationId(operationId)) throw Error("Invalid operation_id");
122
123
  if (signal?.aborted) throw Error("Operation request aborted");
123
124
  await session.ensureDefinitions?.();
124
125
  assertDefinitionIdentity(session, spec);
@@ -135,47 +136,75 @@ export async function claimDelegationOperation(
135
136
  childExecutionId: ids.executionId,
136
137
  },
137
138
  );
138
- if (!preview.ok && !shouldSeekApproval(preview.result)) {
139
+ const denied = !preview.ok && !shouldSeekApproval(preview.result);
140
+ const elect = async () => {
141
+ const operations = session.autoMode?.operations;
142
+ if (!operations) throw Error("Session operation admission is unavailable; no dispatch started");
143
+ const cwd = await realpath(ctx.cwd);
144
+ const { operation_id: _id, ...request } = spec;
145
+ const requestDigest = createHash("sha256")
146
+ .update(
147
+ JSON.stringify(
148
+ canonical({
149
+ request,
150
+ cwd,
151
+ model,
152
+ piThinking: session.currentThinking?.(),
153
+ definitionDigest: preview.definitionDigest,
154
+ grant: [...session.ownGrant].sort(),
155
+ gated: [...session.gated].sort(),
156
+ depth: session.depth,
157
+ maxDepth: session.maxDepth,
158
+ executor: session.executor.kind,
159
+ definition: spec.agent ? session.definitions.get(spec.agent)?.body : null,
160
+ runtimeSettings: session.definitionRuntimeSettings,
161
+ runtimeOverrides: [...session.definitionRuntimeOverrides.entries()].sort(([a], [b]) => a.localeCompare(b)),
162
+ workspaceRoot: spec.workspace ? session.workspacePin?.get(spec.workspace.workspace_id) : null,
163
+ }),
164
+ ),
165
+ )
166
+ .digest("hex");
167
+ return operations.claim(
168
+ {
169
+ operationId,
170
+ requestDigest,
171
+ executionId: ids.executionId,
172
+ cwd,
173
+ workspaceId: spec.workspace?.workspace_id ?? null,
174
+ },
175
+ signal,
176
+ );
177
+ };
178
+ if (!denied) return elect();
179
+
180
+ const failure = preview.refusal
181
+ ? new GovernanceRefusal(preview.refusal)
182
+ : Error(preview.reason ?? "Operation request is not authorized");
183
+ const evidenceErrors: unknown[] = [];
184
+ try {
139
185
  await recordDelegationDecision({ session, plan: preview, ids, agent: spec.agent });
140
- if (preview.refusal) throw new GovernanceRefusal(preview.refusal);
141
- throw Error(preview.reason ?? "Operation request is not authorized");
186
+ } catch (error) {
187
+ // A refused request cannot execute, even if its audit append fails. Keep this
188
+ // failure visible without making independent no-start evidence depend on it.
189
+ evidenceErrors.push(error);
190
+ failure.message += `; ledger evidence unavailable: ${String(error)}`;
142
191
  }
143
- const operations = session.autoMode?.operations;
144
- if (!operations) throw Error("Session operation admission is unavailable; no dispatch started");
145
- const cwd = await realpath(ctx.cwd);
146
- const { operation_id: _id, ...request } = spec;
147
- const requestDigest = createHash("sha256")
148
- .update(
149
- JSON.stringify(
150
- canonical({
151
- request,
152
- cwd,
153
- model,
154
- piThinking: session.currentThinking?.(),
155
- definitionDigest: preview.definitionDigest,
156
- grant: [...session.ownGrant].sort(),
157
- gated: [...session.gated].sort(),
158
- depth: session.depth,
159
- maxDepth: session.maxDepth,
160
- executor: session.executor.kind,
161
- definition: spec.agent ? session.definitions.get(spec.agent)?.body : null,
162
- runtimeSettings: session.definitionRuntimeSettings,
163
- runtimeOverrides: [...session.definitionRuntimeOverrides.entries()].sort(([a], [b]) => a.localeCompare(b)),
164
- workspaceRoot: spec.workspace ? session.workspacePin?.get(spec.workspace.workspace_id) : null,
165
- }),
166
- ),
167
- )
168
- .digest("hex");
169
- return operations.claim(
170
- {
171
- operationId: spec.operation_id,
172
- requestDigest,
173
- executionId: ids.executionId,
174
- cwd,
175
- workspaceId: spec.workspace?.workspace_id ?? null,
176
- },
177
- signal,
178
- );
192
+ try {
193
+ // Election records identity, not permission. Only this newly elected, unlaunched
194
+ // occurrence may supply no-start proof; a duplicate must never rewrite its owner.
195
+ const claim = await elect();
196
+ if (!claim.reused) await claim.finish!("not-started", { cleanup: { state: "not-started" } });
197
+ } catch (error) {
198
+ // Keep the typed governance refusal and make missing/conflicting evidence explicit.
199
+ evidenceErrors.push(error);
200
+ failure.message += `; operation evidence unavailable: ${String(error)}`;
201
+ }
202
+ if (evidenceErrors.length)
203
+ failure.cause =
204
+ evidenceErrors.length === 1
205
+ ? evidenceErrors[0]
206
+ : new AggregateError(evidenceErrors, "Refusal evidence recording failed");
207
+ throw failure;
179
208
  }
180
209
  export function existingOperationOutcome(claim: OperationClaim, depth: number): DelegationOutcome {
181
210
  const active = ["admitting", "running"].includes(claim.operation.state);
@@ -145,6 +145,9 @@ export function registerRuntimeSnapshot(
145
145
  ...envelope,
146
146
  qualified: true,
147
147
  operation,
148
+ ...(!operation
149
+ ? { reason: "operation record is absent; this does not prove the dispatch was not started" }
150
+ : {}),
148
151
  ...(request.includeFinal === true && operation ? { final: operationFinal(session, operation) } : {}),
149
152
  });
150
153
  } catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-daddy",
3
- "version": "0.49.4",
3
+ "version": "0.49.5",
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",