pi-daddy 0.18.1 → 0.20.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 (218) hide show
  1. package/CHANGELOG.md +201 -0
  2. package/README.md +136 -23
  3. package/contracts/ledger/v2/README.md +59 -0
  4. package/contracts/ledger/v2/fixtures/capability-decision.json +95 -0
  5. package/contracts/ledger/v2/fixtures/check-receipt.json +40 -0
  6. package/contracts/ledger/v2/fixtures/child-lifecycle.json +42 -0
  7. package/contracts/ledger/v2/fixtures/workspace-lease.json +41 -0
  8. package/contracts/ledger/v2/ledger-event.schema.json +633 -0
  9. package/contracts/ledger/v3/README.md +36 -0
  10. package/contracts/ledger/v3/fixtures/capability-decision.json +98 -0
  11. package/contracts/ledger/v3/fixtures/check-receipt.json +42 -0
  12. package/contracts/ledger/v3/fixtures/child-lifecycle.json +45 -0
  13. package/contracts/ledger/v3/fixtures/workflow-fact.json +41 -0
  14. package/contracts/ledger/v3/fixtures/workspace-lease.json +43 -0
  15. package/contracts/ledger/v3/ledger-event.schema.json +930 -0
  16. package/dist/approval-prompt.d.ts +2 -1
  17. package/dist/approval-prompt.d.ts.map +1 -1
  18. package/dist/approval-prompt.js +9 -0
  19. package/dist/approval-prompt.js.map +1 -1
  20. package/dist/approval.d.ts +4 -2
  21. package/dist/approval.d.ts.map +1 -1
  22. package/dist/approval.js +4 -0
  23. package/dist/approval.js.map +1 -1
  24. package/dist/capabilities.d.ts +90 -0
  25. package/dist/capabilities.d.ts.map +1 -1
  26. package/dist/capabilities.js +114 -3
  27. package/dist/capabilities.js.map +1 -1
  28. package/dist/catalog.d.ts +15 -1
  29. package/dist/catalog.d.ts.map +1 -1
  30. package/dist/catalog.js +54 -3
  31. package/dist/catalog.js.map +1 -1
  32. package/dist/check-runner.d.ts.map +1 -1
  33. package/dist/check-runner.js +19 -7
  34. package/dist/check-runner.js.map +1 -1
  35. package/dist/cli.d.ts.map +1 -1
  36. package/dist/cli.js +21 -1
  37. package/dist/cli.js.map +1 -1
  38. package/dist/correlation.d.ts.map +1 -1
  39. package/dist/correlation.js +10 -0
  40. package/dist/correlation.js.map +1 -1
  41. package/dist/dashboard-cli.d.ts +18 -0
  42. package/dist/dashboard-cli.d.ts.map +1 -0
  43. package/dist/dashboard-cli.js +154 -0
  44. package/dist/dashboard-cli.js.map +1 -0
  45. package/dist/dashboard-handshake.d.ts +37 -0
  46. package/dist/dashboard-handshake.d.ts.map +1 -0
  47. package/dist/dashboard-handshake.js +127 -0
  48. package/dist/dashboard-handshake.js.map +1 -0
  49. package/dist/dashboard-herdr.d.ts +54 -0
  50. package/dist/dashboard-herdr.d.ts.map +1 -0
  51. package/dist/dashboard-herdr.js +286 -0
  52. package/dist/dashboard-herdr.js.map +1 -0
  53. package/dist/dashboard-projection.d.ts +73 -0
  54. package/dist/dashboard-projection.d.ts.map +1 -0
  55. package/dist/dashboard-projection.js +294 -0
  56. package/dist/dashboard-projection.js.map +1 -0
  57. package/dist/dashboard-render.d.ts +10 -0
  58. package/dist/dashboard-render.d.ts.map +1 -0
  59. package/dist/dashboard-render.js +208 -0
  60. package/dist/dashboard-render.js.map +1 -0
  61. package/dist/definitions.d.ts.map +1 -1
  62. package/dist/definitions.js +7 -1
  63. package/dist/definitions.js.map +1 -1
  64. package/dist/delegate-types.d.ts +6 -2
  65. package/dist/delegate-types.d.ts.map +1 -1
  66. package/dist/delegate-types.js.map +1 -1
  67. package/dist/delegate.d.ts.map +1 -1
  68. package/dist/delegate.js +34 -4
  69. package/dist/delegate.js.map +1 -1
  70. package/dist/delegation-approval.d.ts.map +1 -1
  71. package/dist/delegation-approval.js +37 -12
  72. package/dist/delegation-approval.js.map +1 -1
  73. package/dist/execution-id.d.ts +6 -0
  74. package/dist/execution-id.d.ts.map +1 -0
  75. package/dist/execution-id.js +13 -0
  76. package/dist/execution-id.js.map +1 -0
  77. package/dist/executor.d.ts +2 -1
  78. package/dist/executor.d.ts.map +1 -1
  79. package/dist/executor.js +1 -0
  80. package/dist/executor.js.map +1 -1
  81. package/dist/grant-env.d.ts +2 -0
  82. package/dist/grant-env.d.ts.map +1 -1
  83. package/dist/grant-env.js +26 -3
  84. package/dist/grant-env.js.map +1 -1
  85. package/dist/index.d.ts +4 -1
  86. package/dist/index.d.ts.map +1 -1
  87. package/dist/index.js +4 -1
  88. package/dist/index.js.map +1 -1
  89. package/dist/init.d.ts +13 -1
  90. package/dist/init.d.ts.map +1 -1
  91. package/dist/init.js +35 -2
  92. package/dist/init.js.map +1 -1
  93. package/dist/lease-helper.d.ts +58 -0
  94. package/dist/lease-helper.d.ts.map +1 -0
  95. package/dist/lease-helper.js +94 -0
  96. package/dist/lease-helper.js.map +1 -0
  97. package/dist/lease-record.d.ts +15 -3
  98. package/dist/lease-record.d.ts.map +1 -1
  99. package/dist/lease-record.js.map +1 -1
  100. package/dist/ledger-events.d.ts +59 -15
  101. package/dist/ledger-events.d.ts.map +1 -1
  102. package/dist/ledger-events.js +67 -5
  103. package/dist/ledger-events.js.map +1 -1
  104. package/dist/ledger-identifiers.d.ts +7 -0
  105. package/dist/ledger-identifiers.d.ts.map +1 -0
  106. package/dist/ledger-identifiers.js +20 -0
  107. package/dist/ledger-identifiers.js.map +1 -0
  108. package/dist/ledger-report.d.ts +5 -2
  109. package/dist/ledger-report.d.ts.map +1 -1
  110. package/dist/ledger-report.js +38 -14
  111. package/dist/ledger-report.js.map +1 -1
  112. package/dist/ledger-v3-validation.d.ts +11 -0
  113. package/dist/ledger-v3-validation.d.ts.map +1 -0
  114. package/dist/ledger-v3-validation.js +265 -0
  115. package/dist/ledger-v3-validation.js.map +1 -0
  116. package/dist/ledger.d.ts +27 -9
  117. package/dist/ledger.d.ts.map +1 -1
  118. package/dist/ledger.js +38 -6
  119. package/dist/ledger.js.map +1 -1
  120. package/dist/propagation.d.ts +19 -1
  121. package/dist/propagation.d.ts.map +1 -1
  122. package/dist/propagation.js +23 -1
  123. package/dist/propagation.js.map +1 -1
  124. package/dist/refusals.d.ts +1 -1
  125. package/dist/refusals.d.ts.map +1 -1
  126. package/dist/refusals.js +1 -0
  127. package/dist/refusals.js.map +1 -1
  128. package/dist/resolve.d.ts +10 -0
  129. package/dist/resolve.d.ts.map +1 -1
  130. package/dist/resolve.js +27 -3
  131. package/dist/resolve.js.map +1 -1
  132. package/dist/routing-authority.d.ts +71 -0
  133. package/dist/routing-authority.d.ts.map +1 -0
  134. package/dist/routing-authority.js +100 -0
  135. package/dist/routing-authority.js.map +1 -0
  136. package/dist/run-child.d.ts +3 -1
  137. package/dist/run-child.d.ts.map +1 -1
  138. package/dist/run-child.js +30 -2
  139. package/dist/run-child.js.map +1 -1
  140. package/dist/run-herdr.d.ts +2 -0
  141. package/dist/run-herdr.d.ts.map +1 -1
  142. package/dist/run-herdr.js +8 -0
  143. package/dist/run-herdr.js.map +1 -1
  144. package/dist/skill-packages.d.ts +11 -5
  145. package/dist/skill-packages.d.ts.map +1 -1
  146. package/dist/skill-packages.js +20 -11
  147. package/dist/skill-packages.js.map +1 -1
  148. package/dist/workflow-fact-id.d.ts +4 -0
  149. package/dist/workflow-fact-id.d.ts.map +1 -0
  150. package/dist/workflow-fact-id.js +14 -0
  151. package/dist/workflow-fact-id.js.map +1 -0
  152. package/dist/workflow-facts.d.ts +34 -0
  153. package/dist/workflow-facts.d.ts.map +1 -0
  154. package/dist/workflow-facts.js +43 -0
  155. package/dist/workflow-facts.js.map +1 -0
  156. package/dist/workspace-lease.d.ts +15 -3
  157. package/dist/workspace-lease.d.ts.map +1 -1
  158. package/dist/workspace-lease.js +81 -24
  159. package/dist/workspace-lease.js.map +1 -1
  160. package/dist/workspace.d.ts +25 -0
  161. package/dist/workspace.d.ts.map +1 -1
  162. package/dist/workspace.js +142 -5
  163. package/dist/workspace.js.map +1 -1
  164. package/extensions/chain-ledger.ts +4 -0
  165. package/extensions/chain-plan.ts +98 -0
  166. package/extensions/delegate-chain.ts +63 -122
  167. package/extensions/delegation-ledger.ts +60 -0
  168. package/extensions/delegation.ts +20 -14
  169. package/extensions/execute-child.ts +85 -21
  170. package/extensions/execution-occurrence.ts +20 -0
  171. package/extensions/grants-command.ts +33 -4
  172. package/extensions/grants.ts +50 -1
  173. package/extensions/init-command.ts +33 -2
  174. package/extensions/run-delegation.ts +36 -56
  175. package/extensions/session-report.ts +13 -20
  176. package/extensions/session.ts +16 -3
  177. package/extensions/workspace-runtime.ts +44 -4
  178. package/herdr-plugin/herdr-plugin.toml +18 -0
  179. package/package.json +22 -5
  180. package/src/approval-prompt.ts +2 -1
  181. package/src/approval.ts +4 -2
  182. package/src/capabilities.ts +120 -4
  183. package/src/catalog.ts +62 -4
  184. package/src/check-runner.ts +24 -8
  185. package/src/cli.ts +24 -1
  186. package/src/correlation.ts +11 -0
  187. package/src/dashboard-cli.ts +171 -0
  188. package/src/dashboard-handshake.ts +185 -0
  189. package/src/dashboard-herdr.ts +355 -0
  190. package/src/dashboard-projection.ts +390 -0
  191. package/src/dashboard-render.ts +254 -0
  192. package/src/definitions.ts +7 -1
  193. package/src/delegate-types.ts +6 -2
  194. package/src/delegate.ts +43 -4
  195. package/src/delegation-approval.ts +37 -12
  196. package/src/execution-id.ts +18 -0
  197. package/src/executor.ts +2 -1
  198. package/src/grant-env.ts +39 -7
  199. package/src/index.ts +26 -0
  200. package/src/init.ts +40 -2
  201. package/src/lease-helper.ts +97 -0
  202. package/src/lease-record.ts +15 -3
  203. package/src/ledger-events.ts +116 -28
  204. package/src/ledger-identifiers.ts +21 -0
  205. package/src/ledger-report.ts +40 -19
  206. package/src/ledger-v3-validation.ts +266 -0
  207. package/src/ledger.ts +75 -12
  208. package/src/propagation.ts +24 -1
  209. package/src/refusals.ts +1 -0
  210. package/src/resolve.ts +29 -3
  211. package/src/routing-authority.ts +121 -0
  212. package/src/run-child.ts +35 -3
  213. package/src/run-herdr.ts +9 -0
  214. package/src/skill-packages.ts +20 -13
  215. package/src/workflow-fact-id.ts +16 -0
  216. package/src/workflow-facts.ts +65 -0
  217. package/src/workspace-lease.ts +84 -24
  218. package/src/workspace.ts +179 -6
@@ -0,0 +1,633 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://github.com/mojomanyana/pi-daddy/contracts/ledger/v2/ledger-event.schema.json",
4
+ "title": "pi-daddy ledgerVersion 2 event",
5
+ "description": "One JSON object per JSONL line. This schema covers only explicit ledgerVersion 2 events; legacy GrantRecord lines have no version/event discriminator and are intentionally outside this schema.",
6
+ "oneOf": [
7
+ {
8
+ "$ref": "#/$defs/capabilityDecision"
9
+ },
10
+ {
11
+ "$ref": "#/$defs/workspaceLease"
12
+ },
13
+ {
14
+ "$ref": "#/$defs/childLifecycle"
15
+ },
16
+ {
17
+ "$ref": "#/$defs/checkReceipt"
18
+ }
19
+ ],
20
+ "$defs": {
21
+ "correlation": {
22
+ "type": "object",
23
+ "description": "Opaque, non-authoritative controller metadata. String and aggregate byte limits are additionally enforced by the runtime and cannot be represented exactly in JSON Schema.",
24
+ "properties": {
25
+ "schema_version": {
26
+ "type": "string",
27
+ "maxLength": 512
28
+ },
29
+ "run_id": {
30
+ "type": "string",
31
+ "maxLength": 512
32
+ },
33
+ "task_id": {
34
+ "type": "string",
35
+ "maxLength": 512
36
+ },
37
+ "workspace_id": {
38
+ "type": "string",
39
+ "maxLength": 512
40
+ },
41
+ "context_id": {
42
+ "type": "string",
43
+ "maxLength": 512
44
+ },
45
+ "phase": {
46
+ "type": "string",
47
+ "maxLength": 512
48
+ },
49
+ "assurance": {
50
+ "type": "string",
51
+ "maxLength": 512
52
+ },
53
+ "assurance_effective": {
54
+ "type": "string",
55
+ "maxLength": 512
56
+ },
57
+ "policy_label": {
58
+ "type": "string",
59
+ "maxLength": 512
60
+ },
61
+ "assurance_source": {
62
+ "type": "string",
63
+ "maxLength": 512
64
+ },
65
+ "assurance_scope": {},
66
+ "activated_at": {
67
+ "type": "string",
68
+ "maxLength": 512
69
+ },
70
+ "plan_digest": {
71
+ "type": "string",
72
+ "maxLength": 512
73
+ },
74
+ "definition_digest": {
75
+ "type": "string",
76
+ "maxLength": 512
77
+ },
78
+ "task_digest": {
79
+ "type": "string",
80
+ "maxLength": 512
81
+ },
82
+ "base_sha": {
83
+ "type": "string",
84
+ "maxLength": 512
85
+ },
86
+ "head_sha": {
87
+ "type": "string",
88
+ "maxLength": 512
89
+ },
90
+ "tree_sha": {
91
+ "type": "string",
92
+ "maxLength": 512
93
+ },
94
+ "event_seq": {
95
+ "type": "number"
96
+ },
97
+ "last_change_seq": {
98
+ "type": "number"
99
+ },
100
+ "last_authority_seq": {
101
+ "type": "number"
102
+ },
103
+ "check_receipt_id": {
104
+ "type": "string",
105
+ "maxLength": 512
106
+ }
107
+ },
108
+ "additionalProperties": false
109
+ },
110
+ "refusalCode": {
111
+ "type": "string",
112
+ "enum": [
113
+ "CAPABILITY_ESCALATION",
114
+ "GRANT_ID_MALFORMED",
115
+ "DEFINITION_NOT_AUTHORIZED",
116
+ "UNDECLARED_TOOLS",
117
+ "UNKNOWN_TOOL",
118
+ "GATED_UNAPPROVED",
119
+ "APPROVAL_EXPIRED",
120
+ "APPROVAL_SCOPE_MISMATCH",
121
+ "APPROVAL_FLOW_FAILED",
122
+ "DEPTH_EXCEEDED",
123
+ "FANOUT_EXCEEDED",
124
+ "EXECUTOR_UNAVAILABLE",
125
+ "CHILD_TIMED_OUT",
126
+ "CHILD_CANCELLED",
127
+ "CHILD_EXIT_NONZERO",
128
+ "TASK_MISSING",
129
+ "UNKNOWN_DEFINITION",
130
+ "CEILING_PATTERNS_UNRESOLVED",
131
+ "NARROWING_VIOLATED",
132
+ "DEFINITION_UNREADABLE",
133
+ "CORRELATION_TOO_LARGE",
134
+ "CORRELATION_INVALID",
135
+ "LEDGER_WRITE_FAILED",
136
+ "FANOUT_FAILED",
137
+ "WORKSPACE_NOT_REGISTERED",
138
+ "WORKSPACE_NOT_AUTHORIZED",
139
+ "WORKSPACE_WRITE_CONFLICT",
140
+ "WORKSPACE_LEASE_STALE",
141
+ "CHECK_NOT_CONFIGURED",
142
+ "CHECK_CONFIGURATION_INVALID",
143
+ "CHECK_IDENTITY_UNAVAILABLE",
144
+ "CHECK_IDENTITY_MISMATCH"
145
+ ]
146
+ },
147
+ "refusal": {
148
+ "type": "object",
149
+ "properties": {
150
+ "code": {
151
+ "$ref": "#/$defs/refusalCode"
152
+ },
153
+ "message": {
154
+ "type": "string"
155
+ },
156
+ "details": {
157
+ "type": "object",
158
+ "additionalProperties": {
159
+ "type": [
160
+ "string",
161
+ "number",
162
+ "boolean",
163
+ "null"
164
+ ]
165
+ }
166
+ }
167
+ },
168
+ "required": [
169
+ "code",
170
+ "message"
171
+ ],
172
+ "additionalProperties": false
173
+ },
174
+ "approvalSource": {
175
+ "type": "string",
176
+ "enum": [
177
+ "prompt",
178
+ "session",
179
+ "persisted",
180
+ "inherited"
181
+ ]
182
+ },
183
+ "approvalScope": {
184
+ "type": "string",
185
+ "enum": [
186
+ "once",
187
+ "session",
188
+ "always"
189
+ ]
190
+ },
191
+ "approvalUse": {
192
+ "type": "object",
193
+ "properties": {
194
+ "max": {
195
+ "type": "integer",
196
+ "minimum": 0
197
+ },
198
+ "remaining": {
199
+ "type": "integer",
200
+ "minimum": 0
201
+ }
202
+ },
203
+ "required": [
204
+ "max",
205
+ "remaining"
206
+ ],
207
+ "additionalProperties": false
208
+ },
209
+ "definitionDigest": {
210
+ "type": "object",
211
+ "properties": {
212
+ "name": {
213
+ "type": "string"
214
+ },
215
+ "source": {
216
+ "type": "string"
217
+ },
218
+ "sha256": {
219
+ "type": "string",
220
+ "pattern": "^[a-fA-F0-9]{64}$"
221
+ }
222
+ },
223
+ "required": [
224
+ "name",
225
+ "source",
226
+ "sha256"
227
+ ],
228
+ "additionalProperties": false
229
+ },
230
+ "capabilityDecision": {
231
+ "type": "object",
232
+ "properties": {
233
+ "ledgerVersion": {
234
+ "const": 2
235
+ },
236
+ "event": {
237
+ "const": "capability_decision"
238
+ },
239
+ "ts": {
240
+ "type": "string",
241
+ "format": "date-time"
242
+ },
243
+ "parentId": {
244
+ "type": "string",
245
+ "minLength": 1
246
+ },
247
+ "childId": {
248
+ "type": "string",
249
+ "minLength": 1
250
+ },
251
+ "depth": {
252
+ "type": "integer",
253
+ "minimum": 0
254
+ },
255
+ "agentType": {
256
+ "type": "string"
257
+ },
258
+ "requested": {
259
+ "type": "array",
260
+ "items": {
261
+ "type": "string"
262
+ }
263
+ },
264
+ "parentGrant": {
265
+ "type": "array",
266
+ "items": {
267
+ "type": "string"
268
+ }
269
+ },
270
+ "effective": {
271
+ "type": "array",
272
+ "items": {
273
+ "type": "string"
274
+ }
275
+ },
276
+ "denied": {
277
+ "type": "array",
278
+ "items": {
279
+ "type": "string"
280
+ }
281
+ },
282
+ "clipped": {
283
+ "type": "array",
284
+ "items": {
285
+ "type": "string"
286
+ }
287
+ },
288
+ "gatedBlocked": {
289
+ "type": "array",
290
+ "items": {
291
+ "type": "string"
292
+ }
293
+ },
294
+ "blocked": {
295
+ "type": "boolean"
296
+ },
297
+ "reason": {
298
+ "type": "string"
299
+ },
300
+ "approved": {
301
+ "type": "array",
302
+ "items": {
303
+ "type": "string"
304
+ }
305
+ },
306
+ "approvalSource": {
307
+ "$ref": "#/$defs/approvalSource"
308
+ },
309
+ "approvalSources": {
310
+ "type": "object",
311
+ "additionalProperties": {
312
+ "$ref": "#/$defs/approvalSource"
313
+ }
314
+ },
315
+ "approvalScopes": {
316
+ "type": "object",
317
+ "additionalProperties": {
318
+ "$ref": "#/$defs/approvalScope"
319
+ }
320
+ },
321
+ "approvalExpiresAt": {
322
+ "type": "object",
323
+ "additionalProperties": {
324
+ "type": "string",
325
+ "format": "date-time"
326
+ }
327
+ },
328
+ "approvalUses": {
329
+ "type": "object",
330
+ "additionalProperties": {
331
+ "$ref": "#/$defs/approvalUse"
332
+ }
333
+ },
334
+ "approvalScope": {
335
+ "$ref": "#/$defs/approvalScope"
336
+ },
337
+ "humanDenied": {
338
+ "const": true
339
+ },
340
+ "gateOutcome": {
341
+ "type": "string",
342
+ "enum": [
343
+ "declined",
344
+ "dismissed",
345
+ "no-ui",
346
+ "error"
347
+ ]
348
+ },
349
+ "definitionDigest": {
350
+ "$ref": "#/$defs/definitionDigest"
351
+ },
352
+ "executor": {
353
+ "type": "string",
354
+ "enum": [
355
+ "process",
356
+ "herdr"
357
+ ]
358
+ },
359
+ "taskFrom": {
360
+ "type": "string"
361
+ },
362
+ "taskDigest": {
363
+ "type": "string",
364
+ "pattern": "^[a-fA-F0-9]{64}$"
365
+ },
366
+ "correlation": {
367
+ "$ref": "#/$defs/correlation"
368
+ },
369
+ "refusal": {
370
+ "$ref": "#/$defs/refusal"
371
+ }
372
+ },
373
+ "required": [
374
+ "ledgerVersion",
375
+ "event",
376
+ "ts",
377
+ "parentId",
378
+ "childId",
379
+ "depth",
380
+ "requested",
381
+ "parentGrant",
382
+ "effective",
383
+ "denied",
384
+ "clipped",
385
+ "gatedBlocked",
386
+ "blocked",
387
+ "executor",
388
+ "taskDigest"
389
+ ],
390
+ "additionalProperties": false
391
+ },
392
+ "workspaceLease": {
393
+ "type": "object",
394
+ "properties": {
395
+ "ledgerVersion": {
396
+ "const": 2
397
+ },
398
+ "event": {
399
+ "const": "workspace_lease"
400
+ },
401
+ "ts": {
402
+ "type": "string",
403
+ "format": "date-time"
404
+ },
405
+ "childId": {
406
+ "type": "string",
407
+ "minLength": 1
408
+ },
409
+ "workspaceId": {
410
+ "type": "string",
411
+ "minLength": 1
412
+ },
413
+ "root": {
414
+ "type": "string",
415
+ "minLength": 1
416
+ },
417
+ "access": {
418
+ "type": "string",
419
+ "enum": [
420
+ "read",
421
+ "write"
422
+ ]
423
+ },
424
+ "outcome": {
425
+ "type": "string",
426
+ "enum": [
427
+ "acquired",
428
+ "uncontended",
429
+ "refused",
430
+ "released",
431
+ "released-unrecorded",
432
+ "lost",
433
+ "retained",
434
+ "timeout",
435
+ "recovered"
436
+ ]
437
+ },
438
+ "recovered": {
439
+ "oneOf": [
440
+ {
441
+ "type": "boolean"
442
+ },
443
+ {
444
+ "const": "unknown"
445
+ }
446
+ ]
447
+ },
448
+ "releaseReason": {
449
+ "type": "string"
450
+ },
451
+ "refusal": {
452
+ "$ref": "#/$defs/refusal"
453
+ },
454
+ "correlation": {
455
+ "$ref": "#/$defs/correlation"
456
+ }
457
+ },
458
+ "required": [
459
+ "ledgerVersion",
460
+ "event",
461
+ "ts",
462
+ "childId",
463
+ "workspaceId",
464
+ "root",
465
+ "access",
466
+ "outcome"
467
+ ],
468
+ "additionalProperties": false
469
+ },
470
+ "childLifecycle": {
471
+ "type": "object",
472
+ "properties": {
473
+ "ledgerVersion": {
474
+ "const": 2
475
+ },
476
+ "event": {
477
+ "const": "child_lifecycle"
478
+ },
479
+ "ts": {
480
+ "type": "string",
481
+ "format": "date-time"
482
+ },
483
+ "childId": {
484
+ "type": "string",
485
+ "minLength": 1
486
+ },
487
+ "state": {
488
+ "type": "string",
489
+ "enum": [
490
+ "starting",
491
+ "completed",
492
+ "failed"
493
+ ]
494
+ },
495
+ "executor": {
496
+ "type": "string",
497
+ "enum": [
498
+ "process",
499
+ "herdr"
500
+ ]
501
+ },
502
+ "exitCode": {
503
+ "type": [
504
+ "integer",
505
+ "null"
506
+ ]
507
+ },
508
+ "signal": {
509
+ "oneOf": [
510
+ {
511
+ "type": "string",
512
+ "enum": [
513
+ "SIGABRT",
514
+ "SIGALRM",
515
+ "SIGBUS",
516
+ "SIGCHLD",
517
+ "SIGCONT",
518
+ "SIGFPE",
519
+ "SIGHUP",
520
+ "SIGILL",
521
+ "SIGINT",
522
+ "SIGIO",
523
+ "SIGIOT",
524
+ "SIGKILL",
525
+ "SIGPIPE",
526
+ "SIGPOLL",
527
+ "SIGPROF",
528
+ "SIGPWR",
529
+ "SIGQUIT",
530
+ "SIGSEGV",
531
+ "SIGSTKFLT",
532
+ "SIGSTOP",
533
+ "SIGSYS",
534
+ "SIGTERM",
535
+ "SIGTRAP",
536
+ "SIGTSTP",
537
+ "SIGTTIN",
538
+ "SIGTTOU",
539
+ "SIGUNUSED",
540
+ "SIGURG",
541
+ "SIGUSR1",
542
+ "SIGUSR2",
543
+ "SIGVTALRM",
544
+ "SIGWINCH",
545
+ "SIGXCPU",
546
+ "SIGXFSZ",
547
+ "SIGBREAK",
548
+ "SIGLOST",
549
+ "SIGINFO"
550
+ ]
551
+ },
552
+ {
553
+ "type": "null"
554
+ }
555
+ ]
556
+ },
557
+ "timedOut": {
558
+ "const": true
559
+ },
560
+ "aborted": {
561
+ "const": true
562
+ },
563
+ "truncated": {
564
+ "const": true
565
+ },
566
+ "reason": {
567
+ "type": "string"
568
+ },
569
+ "correlation": {
570
+ "$ref": "#/$defs/correlation"
571
+ }
572
+ },
573
+ "required": [
574
+ "ledgerVersion",
575
+ "event",
576
+ "ts",
577
+ "childId",
578
+ "state",
579
+ "executor"
580
+ ],
581
+ "additionalProperties": false
582
+ },
583
+ "checkReceipt": {
584
+ "type": "object",
585
+ "properties": {
586
+ "ledgerVersion": {
587
+ "const": 2
588
+ },
589
+ "event": {
590
+ "const": "check_receipt"
591
+ },
592
+ "ts": {
593
+ "type": "string",
594
+ "format": "date-time"
595
+ },
596
+ "childId": {
597
+ "type": "string",
598
+ "minLength": 1
599
+ },
600
+ "receiptId": {
601
+ "type": "string",
602
+ "pattern": "^[a-fA-F0-9]{64}$"
603
+ },
604
+ "workspaceId": {
605
+ "type": "string",
606
+ "minLength": 1
607
+ },
608
+ "checkId": {
609
+ "type": "string",
610
+ "minLength": 1
611
+ },
612
+ "treeSha": {
613
+ "type": "string",
614
+ "minLength": 1
615
+ },
616
+ "correlation": {
617
+ "$ref": "#/$defs/correlation"
618
+ }
619
+ },
620
+ "required": [
621
+ "ledgerVersion",
622
+ "event",
623
+ "ts",
624
+ "childId",
625
+ "receiptId",
626
+ "workspaceId",
627
+ "checkId",
628
+ "treeSha"
629
+ ],
630
+ "additionalProperties": false
631
+ }
632
+ }
633
+ }
@@ -0,0 +1,36 @@
1
+ # pi-daddy ledger contract — version 3
2
+
3
+ Canonical machine contract for one `ledgerVersion: 3` JSONL line:
4
+
5
+ - `ledger-event.schema.json` — closed JSON Schema draft 2020-12 event union.
6
+ - `fixtures/*.json` — deterministic examples generated through the production builders by
7
+ `scripts/generate-ledger-v3-contract.ts`.
8
+
9
+ ## Dispatch and compatibility
10
+
11
+ 1. No `ledgerVersion` and no `event` is a legacy 0.17 grant record.
12
+ 2. `ledgerVersion: 2` is validated against the frozen v2 contract.
13
+ 3. `ledgerVersion: 3` requires one known event and validation against this schema.
14
+ 4. Any unsupported explicit version, missing discriminator, unknown event, or malformed required identity is corrupt. It is never reinterpreted as legacy.
15
+
16
+ The schema is closed. Adding/removing a field, event or enum member, changing requiredness, or changing meaning requires a new ledger version and versioned path. V3 is still unreleased, so its review repairs are folded into this one initial contract rather than creating a public v4.
17
+
18
+ ## Execution identity
19
+
20
+ Every v3 **execution** event carries:
21
+
22
+ - `executionId`: globally unique identity of one execution occurrence.
23
+ - `parentExecutionId`: the unique governed execution that delegated it, or explicit `null` at a root.
24
+ - `childId`: the readable logical tree position, retained for operators and deterministic comparisons.
25
+
26
+ `workflow_fact` is not an execution event; it carries its own `factId` and explicit provenance instead.
27
+
28
+ Consumers join lifecycle and lease events by `executionId`, never by `childId`. Repeated or concurrent calls may reuse a logical position such as `d0.1`; they may never reuse an execution id.
29
+
30
+ A lifecycle `running` event may include `herdrPaneId` and `herdrAgentName` for navigation. These are runtime observations, not enforcement boundaries. `deadlineAt` is immutable within one occurrence and bounds how long a non-terminal start can be rendered as live; after it, the truthful state is incomplete.
31
+
32
+ All timestamp fields share one schema/runtime profile: JSON Schema `date-time` with seconds restricted to `00`–`59`. Leap-second strings are excluded because JavaScript deadline and duration arithmetic cannot represent them.
33
+
34
+ ## Privacy and provenance
35
+
36
+ The privacy boundary is unchanged: no task text, prompts, tool arguments, child output, or tool results. Fields displayed as identities and every capability use explicit ASCII identifier grammars in both schema and runtime; public builders assert that their serialized event passes the same exact reader. Correlation display fields use the identifier grammar rather than free-form prose, and a top-level null `assurance_scope` is omitted/rejected consistently. Trusted task/definition digests remain outside `correlation`. Correlation is caller-declared join metadata and never becomes proof that a workflow transition was validated or that an inline skill executed.