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