@sharedcontext/sdk 0.0.0-stage → 0.3.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 (36) hide show
  1. package/LICENSE-APACHE +201 -0
  2. package/LICENSE-MIT +21 -0
  3. package/NOTICE +8 -0
  4. package/README.md +94 -2
  5. package/dist/canonical.d.ts +47 -0
  6. package/dist/canonical.js +257 -0
  7. package/dist/client.d.ts +96 -0
  8. package/dist/client.js +205 -0
  9. package/dist/constants.d.ts +19 -0
  10. package/dist/constants.js +21 -0
  11. package/dist/event.d.ts +104 -0
  12. package/dist/event.js +173 -0
  13. package/dist/generated/content.d.ts +588 -0
  14. package/dist/generated/content.js +3 -0
  15. package/dist/generated/schemas.d.ts +10 -0
  16. package/dist/generated/schemas.js +22 -0
  17. package/dist/index.d.ts +8 -0
  18. package/dist/index.js +8 -0
  19. package/dist/reasons.d.ts +14 -0
  20. package/dist/reasons.js +142 -0
  21. package/dist/schema.d.ts +45 -0
  22. package/dist/schema.js +285 -0
  23. package/dist/types.d.ts +230 -0
  24. package/dist/types.js +3 -0
  25. package/package.json +46 -4
  26. package/schemas/sharedcontext-1/changes.schema.json +128 -0
  27. package/schemas/sharedcontext-1/content.schema.json +2076 -0
  28. package/schemas/sharedcontext-1/context.schema.json +218 -0
  29. package/schemas/sharedcontext-1/event.schema.json +55 -0
  30. package/schemas/sharedcontext-1/execution.schema.json +342 -0
  31. package/schemas/sharedcontext-1/history/content-1.0.schema.json +1915 -0
  32. package/schemas/sharedcontext-1/lineage.schema.json +753 -0
  33. package/schemas/sharedcontext-1/mcp-tools.schema.json +1357 -0
  34. package/schemas/sharedcontext-1/stored-event.schema.json +14 -0
  35. package/schemas/sharedcontext-directory-1/members.schema.json +52 -0
  36. package/schemas/sharedcontext-directory-1/memberships.schema.json +32 -0
@@ -0,0 +1,1915 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "sharedcontext/1.0 event content (frozen)",
4
+ "description": "The content of each work event type, keyed by the event's w tag: use \"#/$defs/<type>\" (for example \"#/$defs/claim.taken\"). Fields are optional at this level because every payload field has a serde default; which fields a type needs, and the cross-field and state rules, are the log's (crates/sharedcontext/src/work/log.rs), so content that passes this schema can still be refused. Enumerations are given only where the log checks a fixed list in code; the rest (states, severities, gate kinds, roles in rules) come from the policy and grow without a schema change. An unknown type is refused by the log (unknown_type) and skipped by the fold.",
5
+ "$comment": "Frozen: the sharedcontext/1.0 content shape exactly as it was before 1.1 (multi-repo) moved into ../content.schema.json. Kept only so contract-check.mjs can answer what a 1.0 log answers for a case marked older (an older log refuses a newer field). Not the contract in force. Source: crates/sharedcontext/src/work/types.rs (payload structs, KNOWN_TYPES, content_fields) and crates/sharedcontext/src/work/log.rs (the fixed-list checks); crates/sharedcontext/src/signed/registry.rs (Actor, Limits). Option fields accept null, as serde does. Types (34, KNOWN_TYPES order): project.created, project.policy_set, node.created, node.updated, node.moved, node.linked, node.unlinked, node.split, node.merged, node.closed, node.reopened, note.added, context.pinned, claim.taken, claim.renewed, claim.released, claim.expired, state.transitioned, gate.cleared, evidence.attached, findings.seen, ref.set, adapter.synced, change.external_event, external.state_changed, goal.measures_set, measure.observed, actor.enrolled, project.profile_set, project.budget_set, project.rule_set, project.budget_incident, cost.recorded, gate.approved.",
6
+ "type": "object",
7
+ "$defs": {
8
+ "SessionRef": {
9
+ "type": "object",
10
+ "$comment": "crates/sharedcontext/src/work/types.rs SessionRef",
11
+ "properties": {
12
+ "agent_cli": {
13
+ "type": [
14
+ "string",
15
+ "null"
16
+ ],
17
+ "$comment": "at most 64 bytes (MAX_AGENT_CLI_BYTES)"
18
+ },
19
+ "session_id": {
20
+ "type": "string",
21
+ "$comment": "at most 128 bytes (MAX_SESSION_ID_BYTES)"
22
+ }
23
+ }
24
+ },
25
+ "Repo": {
26
+ "type": "object",
27
+ "$comment": "crates/sharedcontext/src/work/types.rs Repo",
28
+ "properties": {
29
+ "host": {
30
+ "type": "string"
31
+ },
32
+ "owner": {
33
+ "type": "string"
34
+ },
35
+ "name": {
36
+ "type": "string"
37
+ }
38
+ }
39
+ },
40
+ "PrRef": {
41
+ "type": "object",
42
+ "$comment": "crates/sharedcontext/src/work/types.rs PrRef",
43
+ "properties": {
44
+ "host": {
45
+ "type": "string"
46
+ },
47
+ "owner": {
48
+ "type": "string"
49
+ },
50
+ "repo": {
51
+ "type": "string"
52
+ },
53
+ "number": {
54
+ "type": "integer",
55
+ "minimum": 0
56
+ }
57
+ }
58
+ },
59
+ "Origin": {
60
+ "type": "object",
61
+ "$comment": "crates/sharedcontext/src/work/types.rs Origin",
62
+ "properties": {
63
+ "source": {
64
+ "type": "string"
65
+ },
66
+ "ref": {
67
+ "type": [
68
+ "string",
69
+ "null"
70
+ ]
71
+ }
72
+ }
73
+ },
74
+ "Marker": {
75
+ "type": "object",
76
+ "$comment": "crates/sharedcontext/src/work/types.rs Marker: a sha plus a time, never a key",
77
+ "properties": {
78
+ "sha": {
79
+ "type": [
80
+ "string",
81
+ "null"
82
+ ]
83
+ },
84
+ "run_id": {
85
+ "type": [
86
+ "string",
87
+ "null"
88
+ ]
89
+ },
90
+ "at": {
91
+ "type": [
92
+ "integer",
93
+ "null"
94
+ ],
95
+ "minimum": 0
96
+ }
97
+ }
98
+ },
99
+ "Horizon": {
100
+ "type": "object",
101
+ "$comment": "crates/sharedcontext/src/work/types.rs Horizon (unix seconds)",
102
+ "properties": {
103
+ "from": {
104
+ "type": "integer",
105
+ "minimum": 0
106
+ },
107
+ "to": {
108
+ "type": "integer",
109
+ "minimum": 0
110
+ }
111
+ }
112
+ },
113
+ "Measure": {
114
+ "type": "object",
115
+ "$comment": "crates/sharedcontext/src/work/types.rs Measure",
116
+ "properties": {
117
+ "name": {
118
+ "type": "string"
119
+ },
120
+ "target": {
121
+ "type": [
122
+ "integer",
123
+ "null"
124
+ ],
125
+ "$comment": "integer; the unit carries the scale"
126
+ },
127
+ "unit": {
128
+ "type": "string"
129
+ },
130
+ "source": {
131
+ "type": "string"
132
+ },
133
+ "direction": {
134
+ "enum": [
135
+ "at_least",
136
+ "at_most",
137
+ null
138
+ ],
139
+ "$comment": "crates/sharedcontext/src/work/log.rs: MEASURE_DIRECTIONS; at_least when absent"
140
+ }
141
+ }
142
+ },
143
+ "SplitPart": {
144
+ "type": "object",
145
+ "$comment": "crates/sharedcontext/src/work/types.rs SplitPart",
146
+ "properties": {
147
+ "node_id": {
148
+ "type": "string"
149
+ },
150
+ "title": {
151
+ "type": [
152
+ "string",
153
+ "null"
154
+ ]
155
+ },
156
+ "body": {
157
+ "type": [
158
+ "string",
159
+ "null"
160
+ ]
161
+ },
162
+ "severity": {
163
+ "type": [
164
+ "string",
165
+ "null"
166
+ ]
167
+ },
168
+ "covers": {
169
+ "type": "array",
170
+ "items": {
171
+ "type": "string"
172
+ }
173
+ }
174
+ }
175
+ },
176
+ "CloseEvidence": {
177
+ "type": "object",
178
+ "$comment": "crates/sharedcontext/src/work/types.rs CloseEvidence",
179
+ "properties": {
180
+ "run_id": {
181
+ "type": "string"
182
+ },
183
+ "record_digest": {
184
+ "type": [
185
+ "string",
186
+ "null"
187
+ ]
188
+ },
189
+ "sha": {
190
+ "type": [
191
+ "string",
192
+ "null"
193
+ ]
194
+ },
195
+ "facts_digest": {
196
+ "type": [
197
+ "string",
198
+ "null"
199
+ ]
200
+ },
201
+ "rules_digest": {
202
+ "type": [
203
+ "string",
204
+ "null"
205
+ ]
206
+ },
207
+ "covered": {
208
+ "type": "array",
209
+ "items": {
210
+ "type": "string"
211
+ }
212
+ }
213
+ }
214
+ },
215
+ "Override": {
216
+ "type": "object",
217
+ "$comment": "crates/sharedcontext/src/work/types.rs Override",
218
+ "properties": {
219
+ "reason": {
220
+ "type": "string"
221
+ },
222
+ "policy_clause": {
223
+ "type": "string"
224
+ }
225
+ }
226
+ },
227
+ "Cancel": {
228
+ "type": "object",
229
+ "$comment": "crates/sharedcontext/src/work/types.rs Cancel",
230
+ "properties": {
231
+ "reason": {
232
+ "type": "string"
233
+ }
234
+ }
235
+ },
236
+ "Unverified": {
237
+ "type": "object",
238
+ "$comment": "crates/sharedcontext/src/work/types.rs Unverified",
239
+ "properties": {
240
+ "system": {
241
+ "type": "string"
242
+ },
243
+ "external_state": {
244
+ "type": "string"
245
+ },
246
+ "actor": {
247
+ "type": [
248
+ "string",
249
+ "null"
250
+ ]
251
+ }
252
+ }
253
+ },
254
+ "ClosedAt": {
255
+ "type": "object",
256
+ "$comment": "crates/sharedcontext/src/work/types.rs ClosedAt",
257
+ "properties": {
258
+ "sha": {
259
+ "type": [
260
+ "string",
261
+ "null"
262
+ ]
263
+ },
264
+ "at": {
265
+ "type": [
266
+ "integer",
267
+ "null"
268
+ ],
269
+ "minimum": 0
270
+ }
271
+ }
272
+ },
273
+ "RegressionEvidence": {
274
+ "type": "object",
275
+ "$comment": "crates/sharedcontext/src/work/types.rs RegressionEvidence",
276
+ "properties": {
277
+ "run_id": {
278
+ "type": "string"
279
+ },
280
+ "sha": {
281
+ "type": [
282
+ "string",
283
+ "null"
284
+ ]
285
+ },
286
+ "seen": {
287
+ "type": "array",
288
+ "items": {
289
+ "type": "string"
290
+ }
291
+ }
292
+ }
293
+ },
294
+ "Blob": {
295
+ "type": "object",
296
+ "$comment": "crates/sharedcontext/src/work/types.rs Blob",
297
+ "properties": {
298
+ "digest": {
299
+ "type": "string"
300
+ },
301
+ "media_type": {
302
+ "type": "string"
303
+ },
304
+ "bytes": {
305
+ "type": "integer",
306
+ "minimum": 0
307
+ }
308
+ }
309
+ },
310
+ "Gate": {
311
+ "type": "object",
312
+ "$comment": "crates/sharedcontext/src/work/types.rs Gate",
313
+ "properties": {
314
+ "kind": {
315
+ "type": "string",
316
+ "$comment": "gate kinds come from the policy (GATE_KINDS is the default list, crates/sharedcontext/src/work/policy.rs)"
317
+ },
318
+ "ref": {
319
+ "type": "string"
320
+ }
321
+ }
322
+ },
323
+ "Verdict": {
324
+ "type": "object",
325
+ "$comment": "crates/sharedcontext/src/work/types.rs Verdict",
326
+ "properties": {
327
+ "finding_fp": {
328
+ "type": "string"
329
+ },
330
+ "verdict": {
331
+ "type": "string"
332
+ },
333
+ "record_ref": {
334
+ "type": [
335
+ "string",
336
+ "null"
337
+ ]
338
+ }
339
+ }
340
+ },
341
+ "Provenance": {
342
+ "type": "object",
343
+ "$comment": "crates/sharedcontext/src/work/types.rs Provenance: the log refuses keys outside this list inside source (invalid_value, unknown_provenance_fields)",
344
+ "properties": {
345
+ "system": {
346
+ "type": "string"
347
+ },
348
+ "via": {
349
+ "enum": [
350
+ "webhook",
351
+ "poll",
352
+ "reconcile",
353
+ null
354
+ ],
355
+ "$comment": "crates/sharedcontext/src/work/log.rs: PROVENANCE_VIA"
356
+ },
357
+ "id": {
358
+ "type": [
359
+ "string",
360
+ "null"
361
+ ]
362
+ },
363
+ "url": {
364
+ "type": [
365
+ "string",
366
+ "null"
367
+ ]
368
+ },
369
+ "actor": {
370
+ "type": [
371
+ "string",
372
+ "null"
373
+ ]
374
+ },
375
+ "delivered_at": {
376
+ "type": [
377
+ "integer",
378
+ "null"
379
+ ],
380
+ "minimum": 0
381
+ }
382
+ },
383
+ "additionalProperties": false
384
+ },
385
+ "Scope": {
386
+ "type": "object",
387
+ "$comment": "crates/sharedcontext/src/work/types.rs Scope",
388
+ "properties": {
389
+ "kind": {
390
+ "type": "string"
391
+ },
392
+ "id": {
393
+ "type": "string"
394
+ }
395
+ }
396
+ },
397
+ "Flags": {
398
+ "type": "object",
399
+ "$comment": "crates/sharedcontext/src/work/types.rs Flags",
400
+ "properties": {
401
+ "enrol_agents": {
402
+ "type": "boolean"
403
+ },
404
+ "create_skills": {
405
+ "type": "boolean"
406
+ },
407
+ "assign_work": {
408
+ "type": "boolean"
409
+ }
410
+ }
411
+ },
412
+ "Limits": {
413
+ "type": "object",
414
+ "$comment": "crates/sharedcontext/src/signed/registry.rs Limits: both fields required (no serde default)",
415
+ "properties": {
416
+ "events_per_min": {
417
+ "type": "integer",
418
+ "minimum": 0,
419
+ "maximum": 4294967295
420
+ },
421
+ "open_claims": {
422
+ "type": "integer",
423
+ "minimum": 0,
424
+ "maximum": 4294967295
425
+ }
426
+ },
427
+ "required": [
428
+ "events_per_min",
429
+ "open_claims"
430
+ ]
431
+ },
432
+ "Actor": {
433
+ "type": "object",
434
+ "$comment": "crates/sharedcontext/src/signed/registry.rs Actor: role required",
435
+ "properties": {
436
+ "role": {
437
+ "enum": [
438
+ "agent",
439
+ "person",
440
+ "steward",
441
+ "system",
442
+ "adapter"
443
+ ],
444
+ "$comment": "crates/sharedcontext/src/work/log.rs: signed::ROLES, checked on project.policy_set"
445
+ },
446
+ "label": {
447
+ "type": "string"
448
+ },
449
+ "stage": {
450
+ "enum": [
451
+ "shadow",
452
+ "nonprod",
453
+ "prod"
454
+ ],
455
+ "$comment": "crates/sharedcontext/src/signed/registry.rs STAGES; default nonprod"
456
+ },
457
+ "limits": {
458
+ "$ref": "#/$defs/Limits"
459
+ },
460
+ "owner": {
461
+ "type": [
462
+ "string",
463
+ "null"
464
+ ]
465
+ },
466
+ "expires_at": {
467
+ "type": [
468
+ "integer",
469
+ "null"
470
+ ],
471
+ "minimum": 0
472
+ }
473
+ },
474
+ "required": [
475
+ "role"
476
+ ]
477
+ },
478
+ "ProfileFields": {
479
+ "type": "object",
480
+ "$comment": "crates/sharedcontext/src/work/types.rs ProfileFields",
481
+ "properties": {
482
+ "org": {
483
+ "type": [
484
+ "string",
485
+ "null"
486
+ ]
487
+ },
488
+ "teams": {
489
+ "type": "array",
490
+ "items": {
491
+ "type": "string"
492
+ }
493
+ },
494
+ "member_id": {
495
+ "type": [
496
+ "string",
497
+ "null"
498
+ ]
499
+ },
500
+ "role": {
501
+ "type": [
502
+ "string",
503
+ "null"
504
+ ]
505
+ },
506
+ "flags": {
507
+ "anyOf": [
508
+ {
509
+ "type": "null"
510
+ },
511
+ {
512
+ "$ref": "#/$defs/Flags"
513
+ }
514
+ ]
515
+ },
516
+ "trust": {
517
+ "enum": [
518
+ "standard",
519
+ "review",
520
+ null
521
+ ],
522
+ "$comment": "crates/sharedcontext/src/work/log.rs: TRUST_LEVELS"
523
+ },
524
+ "lifecycle": {
525
+ "enum": [
526
+ "active",
527
+ "paused",
528
+ "retired",
529
+ null
530
+ ],
531
+ "$comment": "crates/sharedcontext/src/work/log.rs: LIFECYCLES"
532
+ }
533
+ }
534
+ },
535
+ "project.created": {
536
+ "type": "object",
537
+ "additionalProperties": false,
538
+ "properties": {
539
+ "name": {
540
+ "type": "string"
541
+ },
542
+ "repo": {
543
+ "anyOf": [
544
+ {
545
+ "type": "null"
546
+ },
547
+ {
548
+ "$ref": "#/$defs/Repo"
549
+ }
550
+ ]
551
+ },
552
+ "default_branch": {
553
+ "type": [
554
+ "string",
555
+ "null"
556
+ ]
557
+ },
558
+ "policy_ref": {
559
+ "type": [
560
+ "string",
561
+ "null"
562
+ ]
563
+ }
564
+ },
565
+ "$comment": "crates/sharedcontext/src/work/types.rs ProjectCreated. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source."
566
+ },
567
+ "project.policy_set": {
568
+ "type": "object",
569
+ "additionalProperties": false,
570
+ "properties": {
571
+ "policy_ref": {
572
+ "type": "string"
573
+ },
574
+ "effective_from_seq": {
575
+ "type": [
576
+ "integer",
577
+ "null"
578
+ ],
579
+ "minimum": 0
580
+ },
581
+ "actors": {
582
+ "type": [
583
+ "object",
584
+ "null"
585
+ ],
586
+ "additionalProperties": {
587
+ "$ref": "#/$defs/Actor"
588
+ },
589
+ "$comment": "hex pubkey → actor"
590
+ },
591
+ "params": {
592
+ "$comment": "any JSON value"
593
+ }
594
+ },
595
+ "$comment": "crates/sharedcontext/src/work/types.rs ProjectPolicySet. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source."
596
+ },
597
+ "node.created": {
598
+ "type": "object",
599
+ "additionalProperties": false,
600
+ "properties": {
601
+ "kind": {
602
+ "enum": [
603
+ "epic",
604
+ "issue",
605
+ "task",
606
+ "subtask",
607
+ "change",
608
+ "goal"
609
+ ],
610
+ "$comment": "crates/sharedcontext/src/work/log.rs: NODE_KINDS"
611
+ },
612
+ "title": {
613
+ "type": [
614
+ "string",
615
+ "null"
616
+ ]
617
+ },
618
+ "body": {
619
+ "type": [
620
+ "string",
621
+ "null"
622
+ ]
623
+ },
624
+ "parent": {
625
+ "type": [
626
+ "string",
627
+ "null"
628
+ ]
629
+ },
630
+ "origin": {
631
+ "anyOf": [
632
+ {
633
+ "type": "null"
634
+ },
635
+ {
636
+ "$ref": "#/$defs/Origin"
637
+ }
638
+ ]
639
+ },
640
+ "labels": {
641
+ "type": "array",
642
+ "items": {
643
+ "type": "string"
644
+ }
645
+ },
646
+ "severity": {
647
+ "type": [
648
+ "string",
649
+ "null"
650
+ ]
651
+ },
652
+ "priority": {
653
+ "type": [
654
+ "string",
655
+ "null"
656
+ ]
657
+ },
658
+ "cluster_key": {
659
+ "type": [
660
+ "string",
661
+ "null"
662
+ ]
663
+ },
664
+ "fp_scheme": {
665
+ "type": [
666
+ "string",
667
+ "null"
668
+ ]
669
+ },
670
+ "covers": {
671
+ "type": "array",
672
+ "items": {
673
+ "type": "string"
674
+ }
675
+ },
676
+ "declaration_ref": {
677
+ "type": [
678
+ "string",
679
+ "null"
680
+ ]
681
+ },
682
+ "opened_at": {
683
+ "anyOf": [
684
+ {
685
+ "type": "null"
686
+ },
687
+ {
688
+ "$ref": "#/$defs/Marker"
689
+ }
690
+ ]
691
+ },
692
+ "pr": {
693
+ "anyOf": [
694
+ {
695
+ "type": "null"
696
+ },
697
+ {
698
+ "$ref": "#/$defs/PrRef"
699
+ }
700
+ ]
701
+ },
702
+ "for": {
703
+ "type": "array",
704
+ "items": {
705
+ "type": "string"
706
+ }
707
+ },
708
+ "base_sha": {
709
+ "type": [
710
+ "string",
711
+ "null"
712
+ ]
713
+ },
714
+ "head_sha": {
715
+ "type": [
716
+ "string",
717
+ "null"
718
+ ]
719
+ },
720
+ "owner": {
721
+ "type": [
722
+ "string",
723
+ "null"
724
+ ]
725
+ },
726
+ "horizon": {
727
+ "anyOf": [
728
+ {
729
+ "type": "null"
730
+ },
731
+ {
732
+ "$ref": "#/$defs/Horizon"
733
+ }
734
+ ]
735
+ },
736
+ "weight": {
737
+ "type": [
738
+ "integer",
739
+ "null"
740
+ ]
741
+ },
742
+ "measures": {
743
+ "type": "array",
744
+ "items": {
745
+ "$ref": "#/$defs/Measure"
746
+ }
747
+ }
748
+ },
749
+ "$comment": "crates/sharedcontext/src/work/types.rs NodeCreated. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source."
750
+ },
751
+ "node.updated": {
752
+ "type": "object",
753
+ "additionalProperties": false,
754
+ "properties": {
755
+ "patch": {
756
+ "type": "object",
757
+ "$comment": "field → new value"
758
+ },
759
+ "reason": {
760
+ "type": [
761
+ "string",
762
+ "null"
763
+ ]
764
+ }
765
+ },
766
+ "$comment": "crates/sharedcontext/src/work/types.rs NodeUpdated. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source."
767
+ },
768
+ "node.moved": {
769
+ "type": "object",
770
+ "additionalProperties": false,
771
+ "properties": {
772
+ "parent": {
773
+ "type": [
774
+ "string",
775
+ "null"
776
+ ]
777
+ }
778
+ },
779
+ "$comment": "crates/sharedcontext/src/work/types.rs NodeMoved. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source."
780
+ },
781
+ "node.linked": {
782
+ "type": "object",
783
+ "additionalProperties": false,
784
+ "properties": {
785
+ "edge": {
786
+ "enum": [
787
+ "blocks",
788
+ "relates",
789
+ "duplicates",
790
+ "split_from",
791
+ "merged_into",
792
+ "derived_from",
793
+ "serves"
794
+ ],
795
+ "$comment": "crates/sharedcontext/src/work/log.rs: EDGES (invalid_edge)"
796
+ },
797
+ "to": {
798
+ "type": "string"
799
+ }
800
+ },
801
+ "$comment": "crates/sharedcontext/src/work/types.rs NodeLinked. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source."
802
+ },
803
+ "node.unlinked": {
804
+ "type": "object",
805
+ "additionalProperties": false,
806
+ "properties": {
807
+ "edge": {
808
+ "enum": [
809
+ "blocks",
810
+ "relates",
811
+ "duplicates",
812
+ "split_from",
813
+ "merged_into",
814
+ "derived_from",
815
+ "serves"
816
+ ],
817
+ "$comment": "crates/sharedcontext/src/work/log.rs: EDGES (invalid_edge)"
818
+ },
819
+ "to": {
820
+ "type": "string"
821
+ }
822
+ },
823
+ "$comment": "crates/sharedcontext/src/work/types.rs NodeLinked. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source."
824
+ },
825
+ "node.split": {
826
+ "type": "object",
827
+ "additionalProperties": false,
828
+ "properties": {
829
+ "into": {
830
+ "type": "array",
831
+ "items": {
832
+ "$ref": "#/$defs/SplitPart"
833
+ }
834
+ }
835
+ },
836
+ "$comment": "crates/sharedcontext/src/work/types.rs NodeSplit. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source."
837
+ },
838
+ "node.merged": {
839
+ "type": "object",
840
+ "additionalProperties": false,
841
+ "properties": {
842
+ "into": {
843
+ "type": "string"
844
+ }
845
+ },
846
+ "$comment": "crates/sharedcontext/src/work/types.rs NodeMerged. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source."
847
+ },
848
+ "node.closed": {
849
+ "type": "object",
850
+ "additionalProperties": false,
851
+ "properties": {
852
+ "outcome": {
853
+ "enum": [
854
+ "done",
855
+ "cancelled",
856
+ "duplicate"
857
+ ],
858
+ "$comment": "crates/sharedcontext/src/work/log.rs: OUTCOMES; a goal's close takes GOAL_OUTCOMES (done, cancelled)"
859
+ },
860
+ "evidence": {
861
+ "anyOf": [
862
+ {
863
+ "type": "null"
864
+ },
865
+ {
866
+ "$ref": "#/$defs/CloseEvidence"
867
+ }
868
+ ]
869
+ },
870
+ "override": {
871
+ "anyOf": [
872
+ {
873
+ "type": "null"
874
+ },
875
+ {
876
+ "$ref": "#/$defs/Override"
877
+ }
878
+ ]
879
+ },
880
+ "cancel": {
881
+ "anyOf": [
882
+ {
883
+ "type": "null"
884
+ },
885
+ {
886
+ "$ref": "#/$defs/Cancel"
887
+ }
888
+ ]
889
+ },
890
+ "unverified": {
891
+ "anyOf": [
892
+ {
893
+ "type": "null"
894
+ },
895
+ {
896
+ "$ref": "#/$defs/Unverified"
897
+ }
898
+ ]
899
+ },
900
+ "closed_at": {
901
+ "anyOf": [
902
+ {
903
+ "type": "null"
904
+ },
905
+ {
906
+ "$ref": "#/$defs/ClosedAt"
907
+ }
908
+ ]
909
+ },
910
+ "reason": {
911
+ "type": [
912
+ "string",
913
+ "null"
914
+ ]
915
+ }
916
+ },
917
+ "$comment": "crates/sharedcontext/src/work/types.rs NodeClosed. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source."
918
+ },
919
+ "node.reopened": {
920
+ "type": "object",
921
+ "additionalProperties": false,
922
+ "properties": {
923
+ "cause": {
924
+ "enum": [
925
+ "regression",
926
+ "override_reversed",
927
+ "cancel_reversed"
928
+ ],
929
+ "$comment": "crates/sharedcontext/src/work/log.rs: REOPEN_CAUSES"
930
+ },
931
+ "evidence": {
932
+ "anyOf": [
933
+ {
934
+ "type": "null"
935
+ },
936
+ {
937
+ "$ref": "#/$defs/RegressionEvidence"
938
+ }
939
+ ]
940
+ },
941
+ "reason": {
942
+ "type": [
943
+ "string",
944
+ "null"
945
+ ]
946
+ }
947
+ },
948
+ "$comment": "crates/sharedcontext/src/work/types.rs NodeReopened. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source."
949
+ },
950
+ "note.added": {
951
+ "type": "object",
952
+ "additionalProperties": false,
953
+ "properties": {
954
+ "layer": {
955
+ "enum": [
956
+ "pinned",
957
+ "working",
958
+ "summary"
959
+ ],
960
+ "$comment": "crates/sharedcontext/src/work/types.rs: NOTE_LAYERS"
961
+ },
962
+ "text": {
963
+ "type": [
964
+ "string",
965
+ "null"
966
+ ]
967
+ },
968
+ "blob": {
969
+ "anyOf": [
970
+ {
971
+ "type": "null"
972
+ },
973
+ {
974
+ "$ref": "#/$defs/Blob"
975
+ }
976
+ ]
977
+ },
978
+ "supersedes": {
979
+ "type": [
980
+ "string",
981
+ "null"
982
+ ]
983
+ },
984
+ "session": {
985
+ "anyOf": [
986
+ {
987
+ "type": "null"
988
+ },
989
+ {
990
+ "$ref": "#/$defs/SessionRef"
991
+ }
992
+ ]
993
+ }
994
+ },
995
+ "$comment": "crates/sharedcontext/src/work/types.rs NoteAdded. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source."
996
+ },
997
+ "context.pinned": {
998
+ "type": "object",
999
+ "additionalProperties": false,
1000
+ "properties": {
1001
+ "text": {
1002
+ "type": [
1003
+ "string",
1004
+ "null"
1005
+ ]
1006
+ },
1007
+ "blob": {
1008
+ "anyOf": [
1009
+ {
1010
+ "type": "null"
1011
+ },
1012
+ {
1013
+ "$ref": "#/$defs/Blob"
1014
+ }
1015
+ ]
1016
+ },
1017
+ "supersedes": {
1018
+ "type": [
1019
+ "string",
1020
+ "null"
1021
+ ]
1022
+ },
1023
+ "session": {
1024
+ "anyOf": [
1025
+ {
1026
+ "type": "null"
1027
+ },
1028
+ {
1029
+ "$ref": "#/$defs/SessionRef"
1030
+ }
1031
+ ]
1032
+ }
1033
+ },
1034
+ "$comment": "crates/sharedcontext/src/work/types.rs ContextPinned. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source."
1035
+ },
1036
+ "claim.taken": {
1037
+ "type": "object",
1038
+ "additionalProperties": false,
1039
+ "properties": {
1040
+ "lease_s": {
1041
+ "type": [
1042
+ "integer",
1043
+ "null"
1044
+ ],
1045
+ "minimum": 0
1046
+ },
1047
+ "intent": {
1048
+ "enum": [
1049
+ "fix",
1050
+ "triage",
1051
+ "review",
1052
+ "verify"
1053
+ ],
1054
+ "$comment": "crates/sharedcontext/src/work/log.rs: CLAIM_INTENTS"
1055
+ },
1056
+ "on_sha": {
1057
+ "type": [
1058
+ "string",
1059
+ "null"
1060
+ ]
1061
+ },
1062
+ "session": {
1063
+ "anyOf": [
1064
+ {
1065
+ "type": "null"
1066
+ },
1067
+ {
1068
+ "$ref": "#/$defs/SessionRef"
1069
+ }
1070
+ ]
1071
+ }
1072
+ },
1073
+ "$comment": "crates/sharedcontext/src/work/types.rs ClaimTaken. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source."
1074
+ },
1075
+ "claim.renewed": {
1076
+ "type": "object",
1077
+ "additionalProperties": false,
1078
+ "properties": {
1079
+ "lease_s": {
1080
+ "type": [
1081
+ "integer",
1082
+ "null"
1083
+ ],
1084
+ "minimum": 0
1085
+ },
1086
+ "progress": {
1087
+ "type": [
1088
+ "string",
1089
+ "null"
1090
+ ]
1091
+ },
1092
+ "session": {
1093
+ "anyOf": [
1094
+ {
1095
+ "type": "null"
1096
+ },
1097
+ {
1098
+ "$ref": "#/$defs/SessionRef"
1099
+ }
1100
+ ]
1101
+ }
1102
+ },
1103
+ "$comment": "crates/sharedcontext/src/work/types.rs ClaimRenewed. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source."
1104
+ },
1105
+ "claim.released": {
1106
+ "type": "object",
1107
+ "additionalProperties": false,
1108
+ "properties": {
1109
+ "reason": {
1110
+ "enum": [
1111
+ "done",
1112
+ "blocked",
1113
+ "handoff",
1114
+ "abandoned",
1115
+ "needs_input"
1116
+ ],
1117
+ "$comment": "crates/sharedcontext/src/work/log.rs: RELEASE_REASONS; handoff also needs a p tag"
1118
+ },
1119
+ "to": {
1120
+ "type": [
1121
+ "string",
1122
+ "null"
1123
+ ]
1124
+ },
1125
+ "session": {
1126
+ "anyOf": [
1127
+ {
1128
+ "type": "null"
1129
+ },
1130
+ {
1131
+ "$ref": "#/$defs/SessionRef"
1132
+ }
1133
+ ]
1134
+ }
1135
+ },
1136
+ "$comment": "crates/sharedcontext/src/work/types.rs ClaimReleased. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source."
1137
+ },
1138
+ "claim.expired": {
1139
+ "type": "object",
1140
+ "additionalProperties": false,
1141
+ "properties": {
1142
+ "claim": {
1143
+ "type": "string"
1144
+ },
1145
+ "lease_until": {
1146
+ "type": "integer",
1147
+ "minimum": 0
1148
+ },
1149
+ "swept_at": {
1150
+ "type": "integer",
1151
+ "minimum": 0
1152
+ }
1153
+ },
1154
+ "$comment": "crates/sharedcontext/src/work/types.rs ClaimExpired. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source."
1155
+ },
1156
+ "state.transitioned": {
1157
+ "type": "object",
1158
+ "additionalProperties": false,
1159
+ "properties": {
1160
+ "from": {
1161
+ "type": "string"
1162
+ },
1163
+ "to": {
1164
+ "type": "string"
1165
+ },
1166
+ "reason": {
1167
+ "type": [
1168
+ "string",
1169
+ "null"
1170
+ ]
1171
+ },
1172
+ "by_rule": {
1173
+ "type": [
1174
+ "string",
1175
+ "null"
1176
+ ]
1177
+ },
1178
+ "gate": {
1179
+ "anyOf": [
1180
+ {
1181
+ "type": "null"
1182
+ },
1183
+ {
1184
+ "$ref": "#/$defs/Gate"
1185
+ }
1186
+ ]
1187
+ }
1188
+ },
1189
+ "$comment": "crates/sharedcontext/src/work/types.rs StateTransitioned. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source."
1190
+ },
1191
+ "gate.cleared": {
1192
+ "type": "object",
1193
+ "additionalProperties": false,
1194
+ "properties": {
1195
+ "ref": {
1196
+ "type": "string"
1197
+ },
1198
+ "reason": {
1199
+ "type": [
1200
+ "string",
1201
+ "null"
1202
+ ]
1203
+ }
1204
+ },
1205
+ "$comment": "crates/sharedcontext/src/work/types.rs GateCleared. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source."
1206
+ },
1207
+ "evidence.attached": {
1208
+ "type": "object",
1209
+ "additionalProperties": false,
1210
+ "properties": {
1211
+ "run_id": {
1212
+ "type": "string"
1213
+ },
1214
+ "record_digest": {
1215
+ "type": [
1216
+ "string",
1217
+ "null"
1218
+ ]
1219
+ },
1220
+ "sha": {
1221
+ "type": [
1222
+ "string",
1223
+ "null"
1224
+ ]
1225
+ },
1226
+ "stage": {
1227
+ "type": "string"
1228
+ },
1229
+ "verdicts": {
1230
+ "type": "array",
1231
+ "items": {
1232
+ "$ref": "#/$defs/Verdict"
1233
+ }
1234
+ },
1235
+ "coverage": {
1236
+ "type": "string"
1237
+ },
1238
+ "confidence": {
1239
+ "type": "string"
1240
+ }
1241
+ },
1242
+ "$comment": "crates/sharedcontext/src/work/types.rs EvidenceAttached. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source."
1243
+ },
1244
+ "findings.seen": {
1245
+ "type": "object",
1246
+ "additionalProperties": false,
1247
+ "properties": {
1248
+ "run_id": {
1249
+ "type": "string"
1250
+ },
1251
+ "sha": {
1252
+ "type": [
1253
+ "string",
1254
+ "null"
1255
+ ]
1256
+ },
1257
+ "seen": {
1258
+ "type": "array",
1259
+ "items": {
1260
+ "type": "string"
1261
+ }
1262
+ },
1263
+ "gone": {
1264
+ "type": "array",
1265
+ "items": {
1266
+ "type": "string"
1267
+ }
1268
+ },
1269
+ "fp_scheme": {
1270
+ "type": "string"
1271
+ }
1272
+ },
1273
+ "$comment": "crates/sharedcontext/src/work/types.rs FindingsSeen. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source."
1274
+ },
1275
+ "ref.set": {
1276
+ "type": "object",
1277
+ "additionalProperties": false,
1278
+ "properties": {
1279
+ "system": {
1280
+ "type": "string"
1281
+ },
1282
+ "external_id": {
1283
+ "type": "string"
1284
+ },
1285
+ "url": {
1286
+ "type": [
1287
+ "string",
1288
+ "null"
1289
+ ]
1290
+ },
1291
+ "fields_owned": {
1292
+ "type": "array",
1293
+ "items": {
1294
+ "type": "string"
1295
+ }
1296
+ },
1297
+ "blocked_by": {
1298
+ "type": [
1299
+ "array",
1300
+ "null"
1301
+ ],
1302
+ "items": {
1303
+ "type": "string"
1304
+ },
1305
+ "$comment": "the whole current list for this system; absent leaves it as it was"
1306
+ }
1307
+ },
1308
+ "$comment": "crates/sharedcontext/src/work/types.rs RefSet. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source."
1309
+ },
1310
+ "adapter.synced": {
1311
+ "type": "object",
1312
+ "additionalProperties": false,
1313
+ "properties": {
1314
+ "system": {
1315
+ "type": "string"
1316
+ },
1317
+ "external_id": {
1318
+ "type": "string"
1319
+ },
1320
+ "direction": {
1321
+ "type": "string"
1322
+ },
1323
+ "fields": {
1324
+ "type": "array",
1325
+ "items": {
1326
+ "type": "string"
1327
+ }
1328
+ },
1329
+ "external_version": {
1330
+ "type": [
1331
+ "string",
1332
+ "null"
1333
+ ]
1334
+ },
1335
+ "source": {
1336
+ "anyOf": [
1337
+ {
1338
+ "type": "null"
1339
+ },
1340
+ {
1341
+ "$ref": "#/$defs/Provenance"
1342
+ }
1343
+ ]
1344
+ }
1345
+ },
1346
+ "$comment": "crates/sharedcontext/src/work/types.rs AdapterSynced. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source."
1347
+ },
1348
+ "change.external_event": {
1349
+ "type": "object",
1350
+ "additionalProperties": false,
1351
+ "properties": {
1352
+ "system": {
1353
+ "type": "string"
1354
+ },
1355
+ "event": {
1356
+ "enum": [
1357
+ "opened",
1358
+ "synchronized",
1359
+ "review_requested",
1360
+ "approved",
1361
+ "merged",
1362
+ "closed"
1363
+ ],
1364
+ "$comment": "crates/sharedcontext/src/work/log.rs: EXTERNAL_EVENTS"
1365
+ },
1366
+ "head_sha": {
1367
+ "type": [
1368
+ "string",
1369
+ "null"
1370
+ ]
1371
+ },
1372
+ "merge_sha": {
1373
+ "type": [
1374
+ "string",
1375
+ "null"
1376
+ ]
1377
+ },
1378
+ "at": {
1379
+ "type": [
1380
+ "integer",
1381
+ "null"
1382
+ ],
1383
+ "minimum": 0
1384
+ },
1385
+ "ref": {
1386
+ "type": [
1387
+ "string",
1388
+ "null"
1389
+ ]
1390
+ },
1391
+ "pr": {
1392
+ "anyOf": [
1393
+ {
1394
+ "type": "null"
1395
+ },
1396
+ {
1397
+ "$ref": "#/$defs/PrRef"
1398
+ }
1399
+ ]
1400
+ },
1401
+ "external_status": {
1402
+ "type": [
1403
+ "string",
1404
+ "null"
1405
+ ]
1406
+ },
1407
+ "source": {
1408
+ "anyOf": [
1409
+ {
1410
+ "type": "null"
1411
+ },
1412
+ {
1413
+ "$ref": "#/$defs/Provenance"
1414
+ }
1415
+ ]
1416
+ }
1417
+ },
1418
+ "$comment": "crates/sharedcontext/src/work/types.rs ChangeExternalEvent. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source."
1419
+ },
1420
+ "external.state_changed": {
1421
+ "type": "object",
1422
+ "additionalProperties": false,
1423
+ "properties": {
1424
+ "system": {
1425
+ "type": "string"
1426
+ },
1427
+ "from": {
1428
+ "type": [
1429
+ "string",
1430
+ "null"
1431
+ ]
1432
+ },
1433
+ "to": {
1434
+ "type": "string"
1435
+ },
1436
+ "actor": {
1437
+ "type": [
1438
+ "string",
1439
+ "null"
1440
+ ]
1441
+ },
1442
+ "ref": {
1443
+ "type": [
1444
+ "string",
1445
+ "null"
1446
+ ]
1447
+ },
1448
+ "at": {
1449
+ "type": [
1450
+ "integer",
1451
+ "null"
1452
+ ],
1453
+ "minimum": 0
1454
+ },
1455
+ "reason": {
1456
+ "type": [
1457
+ "string",
1458
+ "null"
1459
+ ]
1460
+ },
1461
+ "external_status": {
1462
+ "type": [
1463
+ "string",
1464
+ "null"
1465
+ ]
1466
+ },
1467
+ "source": {
1468
+ "anyOf": [
1469
+ {
1470
+ "type": "null"
1471
+ },
1472
+ {
1473
+ "$ref": "#/$defs/Provenance"
1474
+ }
1475
+ ]
1476
+ }
1477
+ },
1478
+ "$comment": "crates/sharedcontext/src/work/types.rs ExternalStateChanged. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source."
1479
+ },
1480
+ "goal.measures_set": {
1481
+ "type": "object",
1482
+ "additionalProperties": false,
1483
+ "properties": {
1484
+ "measures": {
1485
+ "type": "array",
1486
+ "items": {
1487
+ "$ref": "#/$defs/Measure"
1488
+ }
1489
+ },
1490
+ "reason": {
1491
+ "type": [
1492
+ "string",
1493
+ "null"
1494
+ ]
1495
+ }
1496
+ },
1497
+ "$comment": "crates/sharedcontext/src/work/types.rs GoalMeasuresSet. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source."
1498
+ },
1499
+ "measure.observed": {
1500
+ "type": "object",
1501
+ "additionalProperties": false,
1502
+ "properties": {
1503
+ "measure": {
1504
+ "type": "string"
1505
+ },
1506
+ "value": {
1507
+ "type": [
1508
+ "integer",
1509
+ "null"
1510
+ ]
1511
+ },
1512
+ "at": {
1513
+ "type": "integer",
1514
+ "minimum": 0
1515
+ },
1516
+ "source_ref": {
1517
+ "type": [
1518
+ "string",
1519
+ "null"
1520
+ ]
1521
+ }
1522
+ },
1523
+ "$comment": "crates/sharedcontext/src/work/types.rs MeasureObserved. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source."
1524
+ },
1525
+ "actor.enrolled": {
1526
+ "type": "object",
1527
+ "additionalProperties": false,
1528
+ "properties": {
1529
+ "pubkey": {
1530
+ "type": "string"
1531
+ },
1532
+ "sponsor": {
1533
+ "type": "string"
1534
+ },
1535
+ "label": {
1536
+ "type": "string"
1537
+ },
1538
+ "stage": {
1539
+ "enum": [
1540
+ "shadow",
1541
+ "nonprod",
1542
+ "prod",
1543
+ null
1544
+ ],
1545
+ "$comment": "crates/sharedcontext/src/work/log.rs: signed::STAGES"
1546
+ },
1547
+ "limits": {
1548
+ "anyOf": [
1549
+ {
1550
+ "type": "null"
1551
+ },
1552
+ {
1553
+ "$ref": "#/$defs/Limits"
1554
+ }
1555
+ ]
1556
+ },
1557
+ "expires_at": {
1558
+ "type": [
1559
+ "integer",
1560
+ "null"
1561
+ ],
1562
+ "minimum": 0
1563
+ },
1564
+ "profile": {
1565
+ "anyOf": [
1566
+ {
1567
+ "type": "null"
1568
+ },
1569
+ {
1570
+ "$ref": "#/$defs/ProfileFields"
1571
+ }
1572
+ ]
1573
+ }
1574
+ },
1575
+ "$comment": "crates/sharedcontext/src/work/types.rs ActorEnrolled. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source."
1576
+ },
1577
+ "project.profile_set": {
1578
+ "type": "object",
1579
+ "additionalProperties": false,
1580
+ "properties": {
1581
+ "pubkey": {
1582
+ "type": "string"
1583
+ },
1584
+ "kind": {
1585
+ "enum": [
1586
+ "person",
1587
+ "agent"
1588
+ ],
1589
+ "$comment": "crates/sharedcontext/src/work/types.rs MEMBER_KINDS"
1590
+ },
1591
+ "sponsor": {
1592
+ "type": [
1593
+ "string",
1594
+ "null"
1595
+ ]
1596
+ },
1597
+ "reason": {
1598
+ "type": [
1599
+ "string",
1600
+ "null"
1601
+ ]
1602
+ },
1603
+ "org": {
1604
+ "type": [
1605
+ "string",
1606
+ "null"
1607
+ ]
1608
+ },
1609
+ "teams": {
1610
+ "type": "array",
1611
+ "items": {
1612
+ "type": "string"
1613
+ }
1614
+ },
1615
+ "member_id": {
1616
+ "type": [
1617
+ "string",
1618
+ "null"
1619
+ ]
1620
+ },
1621
+ "role": {
1622
+ "type": [
1623
+ "string",
1624
+ "null"
1625
+ ]
1626
+ },
1627
+ "flags": {
1628
+ "anyOf": [
1629
+ {
1630
+ "type": "null"
1631
+ },
1632
+ {
1633
+ "$ref": "#/$defs/Flags"
1634
+ }
1635
+ ]
1636
+ },
1637
+ "trust": {
1638
+ "enum": [
1639
+ "standard",
1640
+ "review",
1641
+ null
1642
+ ],
1643
+ "$comment": "crates/sharedcontext/src/work/log.rs: TRUST_LEVELS"
1644
+ },
1645
+ "lifecycle": {
1646
+ "enum": [
1647
+ "active",
1648
+ "paused",
1649
+ "retired",
1650
+ null
1651
+ ],
1652
+ "$comment": "crates/sharedcontext/src/work/log.rs: LIFECYCLES"
1653
+ }
1654
+ },
1655
+ "$comment": "crates/sharedcontext/src/work/types.rs ProfileSet (flattens ProfileFields). Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source."
1656
+ },
1657
+ "project.budget_set": {
1658
+ "type": "object",
1659
+ "additionalProperties": false,
1660
+ "properties": {
1661
+ "id": {
1662
+ "type": "string"
1663
+ },
1664
+ "scope": {
1665
+ "allOf": [
1666
+ {
1667
+ "$ref": "#/$defs/Scope"
1668
+ }
1669
+ ],
1670
+ "properties": {
1671
+ "kind": {
1672
+ "enum": [
1673
+ "org",
1674
+ "team",
1675
+ "project",
1676
+ "goal",
1677
+ "agent",
1678
+ "session"
1679
+ ],
1680
+ "$comment": "crates/sharedcontext/src/work/log.rs: BUDGET_SCOPES"
1681
+ }
1682
+ }
1683
+ },
1684
+ "metric": {
1685
+ "enum": [
1686
+ "billed_cents",
1687
+ "tokens",
1688
+ "compute_minutes"
1689
+ ],
1690
+ "$comment": "crates/sharedcontext/src/work/log.rs: BUDGET_METRICS"
1691
+ },
1692
+ "window": {
1693
+ "enum": [
1694
+ "calendar_month_utc",
1695
+ "lifetime"
1696
+ ],
1697
+ "$comment": "crates/sharedcontext/src/work/log.rs: BUDGET_WINDOWS"
1698
+ },
1699
+ "amount": {
1700
+ "type": [
1701
+ "integer",
1702
+ "null"
1703
+ ]
1704
+ },
1705
+ "warn_percent": {
1706
+ "type": [
1707
+ "integer",
1708
+ "null"
1709
+ ],
1710
+ "minimum": 0
1711
+ },
1712
+ "hard_stop": {
1713
+ "type": "boolean"
1714
+ },
1715
+ "unpriced": {
1716
+ "type": [
1717
+ "string",
1718
+ "null"
1719
+ ],
1720
+ "$comment": "block (default) · allow"
1721
+ },
1722
+ "active": {
1723
+ "type": [
1724
+ "boolean",
1725
+ "null"
1726
+ ],
1727
+ "$comment": "false withdraws the budget; default true"
1728
+ },
1729
+ "reason": {
1730
+ "type": [
1731
+ "string",
1732
+ "null"
1733
+ ]
1734
+ }
1735
+ },
1736
+ "$comment": "crates/sharedcontext/src/work/types.rs BudgetSet. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source."
1737
+ },
1738
+ "project.rule_set": {
1739
+ "type": "object",
1740
+ "additionalProperties": false,
1741
+ "properties": {
1742
+ "id": {
1743
+ "type": "string"
1744
+ },
1745
+ "scope": {
1746
+ "allOf": [
1747
+ {
1748
+ "$ref": "#/$defs/Scope"
1749
+ }
1750
+ ],
1751
+ "properties": {
1752
+ "kind": {
1753
+ "enum": [
1754
+ "org",
1755
+ "team",
1756
+ "agent",
1757
+ "member"
1758
+ ],
1759
+ "$comment": "crates/sharedcontext/src/work/log.rs: RULE_SCOPES"
1760
+ }
1761
+ }
1762
+ },
1763
+ "effect": {
1764
+ "enum": [
1765
+ "permit",
1766
+ "forbid"
1767
+ ],
1768
+ "$comment": "crates/sharedcontext/src/work/log.rs: RULE_EFFECTS"
1769
+ },
1770
+ "actions": {
1771
+ "type": "array",
1772
+ "items": {
1773
+ "type": "string"
1774
+ }
1775
+ },
1776
+ "active": {
1777
+ "type": [
1778
+ "boolean",
1779
+ "null"
1780
+ ]
1781
+ },
1782
+ "reason": {
1783
+ "type": [
1784
+ "string",
1785
+ "null"
1786
+ ]
1787
+ }
1788
+ },
1789
+ "$comment": "crates/sharedcontext/src/work/types.rs RuleSet. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source."
1790
+ },
1791
+ "project.budget_incident": {
1792
+ "type": "object",
1793
+ "additionalProperties": false,
1794
+ "properties": {
1795
+ "budget": {
1796
+ "type": "string"
1797
+ },
1798
+ "scope": {
1799
+ "$ref": "#/$defs/Scope"
1800
+ },
1801
+ "metric": {
1802
+ "type": "string"
1803
+ },
1804
+ "window": {
1805
+ "type": "string"
1806
+ },
1807
+ "spent": {
1808
+ "type": "integer"
1809
+ },
1810
+ "amount": {
1811
+ "type": "integer"
1812
+ },
1813
+ "cost": {
1814
+ "type": "string",
1815
+ "$comment": "the cost.recorded event that crossed the limit"
1816
+ },
1817
+ "node": {
1818
+ "type": [
1819
+ "string",
1820
+ "null"
1821
+ ]
1822
+ },
1823
+ "unpriced": {
1824
+ "type": "boolean"
1825
+ }
1826
+ },
1827
+ "$comment": "crates/sharedcontext/src/work/types.rs BudgetIncident. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source."
1828
+ },
1829
+ "cost.recorded": {
1830
+ "type": "object",
1831
+ "additionalProperties": false,
1832
+ "properties": {
1833
+ "agent": {
1834
+ "type": "string"
1835
+ },
1836
+ "node": {
1837
+ "type": [
1838
+ "string",
1839
+ "null"
1840
+ ]
1841
+ },
1842
+ "goal": {
1843
+ "type": [
1844
+ "string",
1845
+ "null"
1846
+ ]
1847
+ },
1848
+ "job": {
1849
+ "type": [
1850
+ "string",
1851
+ "null"
1852
+ ]
1853
+ },
1854
+ "session": {
1855
+ "type": [
1856
+ "string",
1857
+ "null"
1858
+ ]
1859
+ },
1860
+ "provider": {
1861
+ "type": "string"
1862
+ },
1863
+ "biller": {
1864
+ "type": "string"
1865
+ },
1866
+ "billing_type": {
1867
+ "enum": [
1868
+ "metered",
1869
+ "subscription_included",
1870
+ "subscription_overage"
1871
+ ],
1872
+ "$comment": "crates/sharedcontext/src/work/log.rs: BILLING_TYPES"
1873
+ },
1874
+ "amount": {
1875
+ "type": [
1876
+ "integer",
1877
+ "null"
1878
+ ]
1879
+ },
1880
+ "unit": {
1881
+ "enum": [
1882
+ "billed_cents",
1883
+ "tokens",
1884
+ "compute_minutes"
1885
+ ],
1886
+ "$comment": "crates/sharedcontext/src/work/log.rs: BUDGET_METRICS as the unit"
1887
+ },
1888
+ "unpriced": {
1889
+ "type": "boolean"
1890
+ },
1891
+ "idempotency_key": {
1892
+ "type": "string"
1893
+ }
1894
+ },
1895
+ "$comment": "crates/sharedcontext/src/work/types.rs CostRecorded. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source."
1896
+ },
1897
+ "gate.approved": {
1898
+ "type": "object",
1899
+ "additionalProperties": false,
1900
+ "properties": {
1901
+ "ref": {
1902
+ "type": "string",
1903
+ "$comment": "the open approval gate"
1904
+ },
1905
+ "reason": {
1906
+ "type": [
1907
+ "string",
1908
+ "null"
1909
+ ]
1910
+ }
1911
+ },
1912
+ "$comment": "crates/sharedcontext/src/work/types.rs GateApproved. Top-level fields are strict: the log refuses any other (unknown_field); nested objects are lenient except source."
1913
+ }
1914
+ }
1915
+ }