@skill-harness/adapters 0.9.0 → 0.11.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.
@@ -0,0 +1,649 @@
1
+ // GENERATED by scripts/vendor-pi-daddy-contract.mjs — do not edit by hand.
2
+ //
3
+ // The runtime copy of pi-daddy's canonical `ledgerVersion: 2` JSON Schema, pinned to
4
+ // producer commit 1948b9406c13c9730f2fc103e68023d6e58c5e85.
5
+ // It is a module rather than a file read so it survives bundling (the pi extension is a
6
+ // committed esbuild bundle) and so the published package needs no data asset.
7
+ //
8
+ // contracts/pi-daddy/ledger/v2/ holds the byte-exact producer artifact and its recorded
9
+ // SHA-256 digests; packages/adapters/test/pi-daddy-contract.test.ts asserts those digests
10
+ // and that this object still deep-equals the vendored bytes. Re-pin with:
11
+ // node scripts/vendor-pi-daddy-contract.mjs <pi-daddy-checkout> <commit> [pr]
12
+ /** pi-daddy commit whose contract artifact this schema was taken from. */
13
+ export const PI_DADDY_CONTRACT_COMMIT = "1948b9406c13c9730f2fc103e68023d6e58c5e85";
14
+ /** SHA-256 of the byte-exact producer schema file this object was generated from. */
15
+ export const PI_DADDY_LEDGER_V2_SCHEMA_SHA256 = "69c3a6856481b9250587c5785a8aadda87baba6cb03c79b209cff4f55f70a81c";
16
+ /** pi-daddy's canonical, closed ledgerVersion 2 event schema (JSON Schema draft 2020-12). */
17
+ export const PI_DADDY_LEDGER_V2_SCHEMA = {
18
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
19
+ "$id": "https://github.com/mojomanyana/pi-daddy/contracts/ledger/v2/ledger-event.schema.json",
20
+ "title": "pi-daddy ledgerVersion 2 event",
21
+ "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.",
22
+ "oneOf": [
23
+ {
24
+ "$ref": "#/$defs/capabilityDecision"
25
+ },
26
+ {
27
+ "$ref": "#/$defs/workspaceLease"
28
+ },
29
+ {
30
+ "$ref": "#/$defs/childLifecycle"
31
+ },
32
+ {
33
+ "$ref": "#/$defs/checkReceipt"
34
+ }
35
+ ],
36
+ "$defs": {
37
+ "correlation": {
38
+ "type": "object",
39
+ "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.",
40
+ "properties": {
41
+ "schema_version": {
42
+ "type": "string",
43
+ "maxLength": 512
44
+ },
45
+ "run_id": {
46
+ "type": "string",
47
+ "maxLength": 512
48
+ },
49
+ "task_id": {
50
+ "type": "string",
51
+ "maxLength": 512
52
+ },
53
+ "workspace_id": {
54
+ "type": "string",
55
+ "maxLength": 512
56
+ },
57
+ "context_id": {
58
+ "type": "string",
59
+ "maxLength": 512
60
+ },
61
+ "phase": {
62
+ "type": "string",
63
+ "maxLength": 512
64
+ },
65
+ "assurance": {
66
+ "type": "string",
67
+ "maxLength": 512
68
+ },
69
+ "assurance_effective": {
70
+ "type": "string",
71
+ "maxLength": 512
72
+ },
73
+ "policy_label": {
74
+ "type": "string",
75
+ "maxLength": 512
76
+ },
77
+ "assurance_source": {
78
+ "type": "string",
79
+ "maxLength": 512
80
+ },
81
+ "assurance_scope": {},
82
+ "activated_at": {
83
+ "type": "string",
84
+ "maxLength": 512
85
+ },
86
+ "plan_digest": {
87
+ "type": "string",
88
+ "maxLength": 512
89
+ },
90
+ "definition_digest": {
91
+ "type": "string",
92
+ "maxLength": 512
93
+ },
94
+ "task_digest": {
95
+ "type": "string",
96
+ "maxLength": 512
97
+ },
98
+ "base_sha": {
99
+ "type": "string",
100
+ "maxLength": 512
101
+ },
102
+ "head_sha": {
103
+ "type": "string",
104
+ "maxLength": 512
105
+ },
106
+ "tree_sha": {
107
+ "type": "string",
108
+ "maxLength": 512
109
+ },
110
+ "event_seq": {
111
+ "type": "number"
112
+ },
113
+ "last_change_seq": {
114
+ "type": "number"
115
+ },
116
+ "last_authority_seq": {
117
+ "type": "number"
118
+ },
119
+ "check_receipt_id": {
120
+ "type": "string",
121
+ "maxLength": 512
122
+ }
123
+ },
124
+ "additionalProperties": false
125
+ },
126
+ "refusalCode": {
127
+ "type": "string",
128
+ "enum": [
129
+ "CAPABILITY_ESCALATION",
130
+ "GRANT_ID_MALFORMED",
131
+ "DEFINITION_NOT_AUTHORIZED",
132
+ "UNDECLARED_TOOLS",
133
+ "UNKNOWN_TOOL",
134
+ "GATED_UNAPPROVED",
135
+ "APPROVAL_EXPIRED",
136
+ "APPROVAL_SCOPE_MISMATCH",
137
+ "APPROVAL_FLOW_FAILED",
138
+ "DEPTH_EXCEEDED",
139
+ "FANOUT_EXCEEDED",
140
+ "EXECUTOR_UNAVAILABLE",
141
+ "CHILD_TIMED_OUT",
142
+ "CHILD_CANCELLED",
143
+ "CHILD_EXIT_NONZERO",
144
+ "TASK_MISSING",
145
+ "UNKNOWN_DEFINITION",
146
+ "CEILING_PATTERNS_UNRESOLVED",
147
+ "NARROWING_VIOLATED",
148
+ "DEFINITION_UNREADABLE",
149
+ "CORRELATION_TOO_LARGE",
150
+ "CORRELATION_INVALID",
151
+ "LEDGER_WRITE_FAILED",
152
+ "FANOUT_FAILED",
153
+ "WORKSPACE_NOT_REGISTERED",
154
+ "WORKSPACE_WRITE_CONFLICT",
155
+ "WORKSPACE_LEASE_STALE",
156
+ "CHECK_NOT_CONFIGURED",
157
+ "CHECK_CONFIGURATION_INVALID",
158
+ "CHECK_IDENTITY_UNAVAILABLE",
159
+ "CHECK_IDENTITY_MISMATCH"
160
+ ]
161
+ },
162
+ "refusal": {
163
+ "type": "object",
164
+ "properties": {
165
+ "code": {
166
+ "$ref": "#/$defs/refusalCode"
167
+ },
168
+ "message": {
169
+ "type": "string"
170
+ },
171
+ "details": {
172
+ "type": "object",
173
+ "additionalProperties": {
174
+ "type": [
175
+ "string",
176
+ "number",
177
+ "boolean",
178
+ "null"
179
+ ]
180
+ }
181
+ }
182
+ },
183
+ "required": [
184
+ "code",
185
+ "message"
186
+ ],
187
+ "additionalProperties": false
188
+ },
189
+ "approvalSource": {
190
+ "type": "string",
191
+ "enum": [
192
+ "prompt",
193
+ "session",
194
+ "persisted",
195
+ "inherited"
196
+ ]
197
+ },
198
+ "approvalScope": {
199
+ "type": "string",
200
+ "enum": [
201
+ "once",
202
+ "session",
203
+ "always"
204
+ ]
205
+ },
206
+ "approvalUse": {
207
+ "type": "object",
208
+ "properties": {
209
+ "max": {
210
+ "type": "integer",
211
+ "minimum": 0
212
+ },
213
+ "remaining": {
214
+ "type": "integer",
215
+ "minimum": 0
216
+ }
217
+ },
218
+ "required": [
219
+ "max",
220
+ "remaining"
221
+ ],
222
+ "additionalProperties": false
223
+ },
224
+ "definitionDigest": {
225
+ "type": "object",
226
+ "properties": {
227
+ "name": {
228
+ "type": "string"
229
+ },
230
+ "source": {
231
+ "type": "string"
232
+ },
233
+ "sha256": {
234
+ "type": "string",
235
+ "pattern": "^[a-fA-F0-9]{64}$"
236
+ }
237
+ },
238
+ "required": [
239
+ "name",
240
+ "source",
241
+ "sha256"
242
+ ],
243
+ "additionalProperties": false
244
+ },
245
+ "capabilityDecision": {
246
+ "type": "object",
247
+ "properties": {
248
+ "ledgerVersion": {
249
+ "const": 2
250
+ },
251
+ "event": {
252
+ "const": "capability_decision"
253
+ },
254
+ "ts": {
255
+ "type": "string",
256
+ "format": "date-time"
257
+ },
258
+ "parentId": {
259
+ "type": "string",
260
+ "minLength": 1
261
+ },
262
+ "childId": {
263
+ "type": "string",
264
+ "minLength": 1
265
+ },
266
+ "depth": {
267
+ "type": "integer",
268
+ "minimum": 0
269
+ },
270
+ "agentType": {
271
+ "type": "string"
272
+ },
273
+ "requested": {
274
+ "type": "array",
275
+ "items": {
276
+ "type": "string"
277
+ }
278
+ },
279
+ "parentGrant": {
280
+ "type": "array",
281
+ "items": {
282
+ "type": "string"
283
+ }
284
+ },
285
+ "effective": {
286
+ "type": "array",
287
+ "items": {
288
+ "type": "string"
289
+ }
290
+ },
291
+ "denied": {
292
+ "type": "array",
293
+ "items": {
294
+ "type": "string"
295
+ }
296
+ },
297
+ "clipped": {
298
+ "type": "array",
299
+ "items": {
300
+ "type": "string"
301
+ }
302
+ },
303
+ "gatedBlocked": {
304
+ "type": "array",
305
+ "items": {
306
+ "type": "string"
307
+ }
308
+ },
309
+ "blocked": {
310
+ "type": "boolean"
311
+ },
312
+ "reason": {
313
+ "type": "string"
314
+ },
315
+ "approved": {
316
+ "type": "array",
317
+ "items": {
318
+ "type": "string"
319
+ }
320
+ },
321
+ "approvalSource": {
322
+ "$ref": "#/$defs/approvalSource"
323
+ },
324
+ "approvalSources": {
325
+ "type": "object",
326
+ "additionalProperties": {
327
+ "$ref": "#/$defs/approvalSource"
328
+ }
329
+ },
330
+ "approvalScopes": {
331
+ "type": "object",
332
+ "additionalProperties": {
333
+ "$ref": "#/$defs/approvalScope"
334
+ }
335
+ },
336
+ "approvalExpiresAt": {
337
+ "type": "object",
338
+ "additionalProperties": {
339
+ "type": "string",
340
+ "format": "date-time"
341
+ }
342
+ },
343
+ "approvalUses": {
344
+ "type": "object",
345
+ "additionalProperties": {
346
+ "$ref": "#/$defs/approvalUse"
347
+ }
348
+ },
349
+ "approvalScope": {
350
+ "$ref": "#/$defs/approvalScope"
351
+ },
352
+ "humanDenied": {
353
+ "const": true
354
+ },
355
+ "gateOutcome": {
356
+ "type": "string",
357
+ "enum": [
358
+ "declined",
359
+ "dismissed",
360
+ "no-ui",
361
+ "error"
362
+ ]
363
+ },
364
+ "definitionDigest": {
365
+ "$ref": "#/$defs/definitionDigest"
366
+ },
367
+ "executor": {
368
+ "type": "string",
369
+ "enum": [
370
+ "process",
371
+ "herdr"
372
+ ]
373
+ },
374
+ "taskFrom": {
375
+ "type": "string"
376
+ },
377
+ "taskDigest": {
378
+ "type": "string",
379
+ "pattern": "^[a-fA-F0-9]{64}$"
380
+ },
381
+ "correlation": {
382
+ "$ref": "#/$defs/correlation"
383
+ },
384
+ "refusal": {
385
+ "$ref": "#/$defs/refusal"
386
+ }
387
+ },
388
+ "required": [
389
+ "ledgerVersion",
390
+ "event",
391
+ "ts",
392
+ "parentId",
393
+ "childId",
394
+ "depth",
395
+ "requested",
396
+ "parentGrant",
397
+ "effective",
398
+ "denied",
399
+ "clipped",
400
+ "gatedBlocked",
401
+ "blocked",
402
+ "executor",
403
+ "taskDigest"
404
+ ],
405
+ "additionalProperties": false
406
+ },
407
+ "workspaceLease": {
408
+ "type": "object",
409
+ "properties": {
410
+ "ledgerVersion": {
411
+ "const": 2
412
+ },
413
+ "event": {
414
+ "const": "workspace_lease"
415
+ },
416
+ "ts": {
417
+ "type": "string",
418
+ "format": "date-time"
419
+ },
420
+ "childId": {
421
+ "type": "string",
422
+ "minLength": 1
423
+ },
424
+ "workspaceId": {
425
+ "type": "string",
426
+ "minLength": 1
427
+ },
428
+ "root": {
429
+ "type": "string",
430
+ "minLength": 1
431
+ },
432
+ "access": {
433
+ "type": "string",
434
+ "enum": [
435
+ "read",
436
+ "write"
437
+ ]
438
+ },
439
+ "outcome": {
440
+ "type": "string",
441
+ "enum": [
442
+ "acquired",
443
+ "uncontended",
444
+ "refused",
445
+ "released",
446
+ "released-unrecorded",
447
+ "lost",
448
+ "retained",
449
+ "timeout",
450
+ "recovered"
451
+ ]
452
+ },
453
+ "recovered": {
454
+ "oneOf": [
455
+ {
456
+ "type": "boolean"
457
+ },
458
+ {
459
+ "const": "unknown"
460
+ }
461
+ ]
462
+ },
463
+ "releaseReason": {
464
+ "type": "string"
465
+ },
466
+ "refusal": {
467
+ "$ref": "#/$defs/refusal"
468
+ },
469
+ "correlation": {
470
+ "$ref": "#/$defs/correlation"
471
+ }
472
+ },
473
+ "required": [
474
+ "ledgerVersion",
475
+ "event",
476
+ "ts",
477
+ "childId",
478
+ "workspaceId",
479
+ "root",
480
+ "access",
481
+ "outcome"
482
+ ],
483
+ "additionalProperties": false
484
+ },
485
+ "childLifecycle": {
486
+ "type": "object",
487
+ "properties": {
488
+ "ledgerVersion": {
489
+ "const": 2
490
+ },
491
+ "event": {
492
+ "const": "child_lifecycle"
493
+ },
494
+ "ts": {
495
+ "type": "string",
496
+ "format": "date-time"
497
+ },
498
+ "childId": {
499
+ "type": "string",
500
+ "minLength": 1
501
+ },
502
+ "state": {
503
+ "type": "string",
504
+ "enum": [
505
+ "starting",
506
+ "completed",
507
+ "failed"
508
+ ]
509
+ },
510
+ "executor": {
511
+ "type": "string",
512
+ "enum": [
513
+ "process",
514
+ "herdr"
515
+ ]
516
+ },
517
+ "exitCode": {
518
+ "type": [
519
+ "integer",
520
+ "null"
521
+ ]
522
+ },
523
+ "signal": {
524
+ "oneOf": [
525
+ {
526
+ "type": "string",
527
+ "enum": [
528
+ "SIGABRT",
529
+ "SIGALRM",
530
+ "SIGBUS",
531
+ "SIGCHLD",
532
+ "SIGCONT",
533
+ "SIGFPE",
534
+ "SIGHUP",
535
+ "SIGILL",
536
+ "SIGINT",
537
+ "SIGIO",
538
+ "SIGIOT",
539
+ "SIGKILL",
540
+ "SIGPIPE",
541
+ "SIGPOLL",
542
+ "SIGPROF",
543
+ "SIGPWR",
544
+ "SIGQUIT",
545
+ "SIGSEGV",
546
+ "SIGSTKFLT",
547
+ "SIGSTOP",
548
+ "SIGSYS",
549
+ "SIGTERM",
550
+ "SIGTRAP",
551
+ "SIGTSTP",
552
+ "SIGTTIN",
553
+ "SIGTTOU",
554
+ "SIGUNUSED",
555
+ "SIGURG",
556
+ "SIGUSR1",
557
+ "SIGUSR2",
558
+ "SIGVTALRM",
559
+ "SIGWINCH",
560
+ "SIGXCPU",
561
+ "SIGXFSZ",
562
+ "SIGBREAK",
563
+ "SIGLOST",
564
+ "SIGINFO"
565
+ ]
566
+ },
567
+ {
568
+ "type": "null"
569
+ }
570
+ ]
571
+ },
572
+ "timedOut": {
573
+ "const": true
574
+ },
575
+ "aborted": {
576
+ "const": true
577
+ },
578
+ "truncated": {
579
+ "const": true
580
+ },
581
+ "reason": {
582
+ "type": "string"
583
+ },
584
+ "correlation": {
585
+ "$ref": "#/$defs/correlation"
586
+ }
587
+ },
588
+ "required": [
589
+ "ledgerVersion",
590
+ "event",
591
+ "ts",
592
+ "childId",
593
+ "state",
594
+ "executor"
595
+ ],
596
+ "additionalProperties": false
597
+ },
598
+ "checkReceipt": {
599
+ "type": "object",
600
+ "properties": {
601
+ "ledgerVersion": {
602
+ "const": 2
603
+ },
604
+ "event": {
605
+ "const": "check_receipt"
606
+ },
607
+ "ts": {
608
+ "type": "string",
609
+ "format": "date-time"
610
+ },
611
+ "childId": {
612
+ "type": "string",
613
+ "minLength": 1
614
+ },
615
+ "receiptId": {
616
+ "type": "string",
617
+ "pattern": "^[a-fA-F0-9]{64}$"
618
+ },
619
+ "workspaceId": {
620
+ "type": "string",
621
+ "minLength": 1
622
+ },
623
+ "checkId": {
624
+ "type": "string",
625
+ "minLength": 1
626
+ },
627
+ "treeSha": {
628
+ "type": "string",
629
+ "minLength": 1
630
+ },
631
+ "correlation": {
632
+ "$ref": "#/$defs/correlation"
633
+ }
634
+ },
635
+ "required": [
636
+ "ledgerVersion",
637
+ "event",
638
+ "ts",
639
+ "childId",
640
+ "receiptId",
641
+ "workspaceId",
642
+ "checkId",
643
+ "treeSha"
644
+ ],
645
+ "additionalProperties": false
646
+ }
647
+ }
648
+ };
649
+ //# sourceMappingURL=pi-daddy-ledger-v2.js.map
package/dist/pi-json.d.ts CHANGED
@@ -32,6 +32,11 @@ export interface PiJsonRunOptions {
32
32
  turn: number;
33
33
  changedPaths?: string[];
34
34
  homeDir?: string;
35
+ /**
36
+ * Extra env for the subject process, from the arm. `spawn` treats `undefined`
37
+ * as "inherit", so the control arm (which never sets this) is unaffected.
38
+ */
39
+ env?: NodeJS.ProcessEnv;
35
40
  }
36
41
  export interface PiJsonRunResult {
37
42
  trace: ExecutionTraceV1;
@@ -39,5 +44,12 @@ export interface PiJsonRunResult {
39
44
  malformedLines: number;
40
45
  code: number | null;
41
46
  stderr: string;
47
+ /**
48
+ * Set when a line on the stream carried a provider-side failure diagnostic
49
+ * (auth, transport) rather than the model answering badly. `runStructured`
50
+ * collects this across turns; `run.ts` turns it into ERROR — never a model
51
+ * verdict.
52
+ */
53
+ providerFailure: string | null;
42
54
  }
43
55
  export declare function runPiJson(opts: PiJsonRunOptions): Promise<PiJsonRunResult>;