borgmcp-shared 0.13.1 → 1.0.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 (44) hide show
  1. package/README.md +4 -3
  2. package/RELEASES.md +7 -0
  3. package/dist/conformance/adapter.d.ts +15 -2
  4. package/dist/conformance/adapter.d.ts.map +1 -1
  5. package/dist/conformance/adapter.js +187 -41
  6. package/dist/conformance/adapter.js.map +1 -1
  7. package/dist/conformance/index.d.ts +49 -3
  8. package/dist/conformance/index.d.ts.map +1 -1
  9. package/dist/conformance/index.js +95 -18
  10. package/dist/conformance/index.js.map +1 -1
  11. package/dist/protocol/contract.d.ts +1 -1
  12. package/dist/protocol/contract.d.ts.map +1 -1
  13. package/dist/protocol/contract.js +13 -18
  14. package/dist/protocol/contract.js.map +1 -1
  15. package/dist/protocol/coordination.d.ts +36 -1
  16. package/dist/protocol/coordination.d.ts.map +1 -1
  17. package/dist/protocol/coordination.js +72 -6
  18. package/dist/protocol/coordination.js.map +1 -1
  19. package/dist/protocol/errors.d.ts +1 -1
  20. package/dist/protocol/errors.d.ts.map +1 -1
  21. package/dist/protocol/errors.js +1 -1
  22. package/dist/protocol/errors.js.map +1 -1
  23. package/dist/protocol/types.d.ts +1 -5
  24. package/dist/protocol/types.d.ts.map +1 -1
  25. package/dist/protocol/version.d.ts +1 -1
  26. package/dist/protocol/version.js +1 -1
  27. package/dist/templates.d.ts +1 -3
  28. package/dist/templates.d.ts.map +1 -1
  29. package/dist/templates.js +8 -79
  30. package/dist/templates.js.map +1 -1
  31. package/docs/compatibility.md +15 -0
  32. package/docs/release-records.json +28 -0
  33. package/docs/releases/0.14.0.md +8 -0
  34. package/docs/releases/1.0.0.md +11 -0
  35. package/docs/template-lifecycle.md +1 -1
  36. package/package.json +1 -1
  37. package/src/conformance/adapter.ts +369 -50
  38. package/src/conformance/index.ts +122 -22
  39. package/src/protocol/contract.ts +15 -21
  40. package/src/protocol/coordination.ts +136 -7
  41. package/src/protocol/errors.ts +1 -1
  42. package/src/protocol/types.ts +1 -5
  43. package/src/protocol/version.ts +2 -2
  44. package/src/templates.ts +8 -81
package/src/templates.ts CHANGED
@@ -21,8 +21,6 @@ export interface TemplateRole {
21
21
  export interface MessageTaxonomyClass {
22
22
  class: string;
23
23
  prefixes?: string[];
24
- routing: 'broadcast' | 'directed';
25
- default_to?: string[];
26
24
  lifecycle?: 'dispatch' | 'completion';
27
25
  }
28
26
 
@@ -156,7 +154,7 @@ Same-repository workflow policy:
156
154
  - Run \`git remote get-url origin\` to determine whether a hosted origin exists.
157
155
  - When that command succeeds, publish the branch with \`git push -u origin <branch>\`; the branch is REVIEW-READY only after that push and exact remote-head verification.
158
156
  - When that command fails because no origin exists, omit the push; the work is REVIEW-READY when its exact commit SHA is available through the project review mechanism.
159
- - After every merge to the protected or main branch, broadcast the merge SHA.`;
157
+ - After every merge to the protected or main branch, post the merge SHA with \`to: "broadcast"\`.`;
160
158
 
161
159
  export const UNIVERSAL_SAFETY_DISCIPLINES = [WAKE_PATH_MONITOR_DISCIPLINE];
162
160
 
@@ -179,9 +177,10 @@ Drone addressing:
179
177
  const STRUCTURED_MESSAGE_ROUTING_DISCIPLINE = `
180
178
 
181
179
  Structured message routing:
182
- - Pass the intended recipient through borg_log's structured \`to:\` parameter for every directed message.
180
+ - Every borg_log call must set structured \`to:\` to either \`"broadcast"\` or a non-empty recipient selector array.
181
+ - Use \`to: "broadcast"\` only when every cube member is the intended audience; otherwise name every intended recipient explicitly.
183
182
  - Naming a recipient inside the message text does not route it.
184
- - The default is broadcast. Without \`to:\`, a matching directed class, or explicit direct visibility, the unrouted message broadcasts to every seat.`;
183
+ - Message classes and prefixes classify lifecycle signals only; they never choose recipients or provide a default audience.`;
185
184
 
186
185
  const DIRECTED_DISCUSSION_DISCIPLINE = `
187
186
  - Use QUESTION, ANSWER, or HEADS-UP with \`to:\` for directed discussion outside the role's terminal workflow signals.`;
@@ -215,82 +214,57 @@ const SOFTWARE_DEV_TAXONOMY: MessageTaxonomy = [
215
214
  {
216
215
  class: 'status-claim',
217
216
  prefixes: ['STARTING', 'PROGRESS', 'ACK', 'PONG', 'PUSHING'],
218
- routing: 'directed',
219
- default_to: ['coordinator', 'queen'],
220
217
  },
221
218
  {
222
219
  class: 'completion-status',
223
220
  prefixes: ['DONE'],
224
- routing: 'directed',
225
- default_to: ['coordinator', 'queen'],
226
221
  lifecycle: 'completion',
227
222
  },
228
223
  {
229
224
  class: 'review-request',
230
225
  prefixes: ['REVIEW-READY'],
231
- routing: 'directed',
232
- default_to: ['coordinator', 'queen'],
233
226
  },
234
227
  {
235
228
  class: 'review-feedback',
236
229
  prefixes: ['REVIEW-FEEDBACK', 'RQ-FEEDBACK', 'SECURITY-FEEDBACK', 'PD-FEEDBACK', 'PS-FEEDBACK'],
237
- routing: 'directed',
238
- default_to: ['coordinator', 'queen'],
239
230
  },
240
231
  {
241
232
  class: 'completion-gate',
242
233
  prefixes: ['REVIEW-APPROVED', 'RQ-APPROVED', 'SECURITY-APPROVED', 'PD-APPROVED', 'PS-APPROVED'],
243
- routing: 'directed',
244
- default_to: ['coordinator', 'queen'],
245
234
  lifecycle: 'completion',
246
235
  },
247
236
  {
248
237
  class: 'blocked-signal',
249
238
  prefixes: ['BLOCKED'],
250
- routing: 'directed',
251
- default_to: ['coordinator', 'queen'],
252
239
  },
253
240
  {
254
241
  class: 'dispatch-routing',
255
242
  prefixes: ['START NOW', 'RESUME NOW', 'REVIEW NOW', 'HOLD'],
256
- routing: 'directed',
257
- default_to: ['coordinator', 'queen'],
258
243
  lifecycle: 'dispatch',
259
244
  },
260
245
  {
261
246
  class: 'ping',
262
247
  prefixes: ['PING'],
263
- routing: 'directed',
264
- default_to: ['coordinator', 'queen'],
265
248
  },
266
249
  {
267
250
  class: 'peer-question',
268
251
  prefixes: ['QUESTION', 'ASK'],
269
- routing: 'directed',
270
- default_to: ['coordinator', 'queen'],
271
252
  },
272
253
  {
273
254
  class: 'peer-answer',
274
255
  prefixes: ['ANSWER'],
275
- routing: 'directed',
276
- default_to: ['coordinator', 'queen'],
277
256
  },
278
257
  {
279
258
  class: 'peer-heads-up',
280
259
  prefixes: ['HEADS-UP'],
281
- routing: 'directed',
282
- default_to: ['coordinator', 'queen'],
283
260
  },
284
261
  {
285
262
  class: 'finding',
286
263
  prefixes: ['PROPOSAL'],
287
- routing: 'directed',
288
- default_to: ['coordinator', 'queen'],
289
264
  },
290
265
  {
291
266
  class: 'cube-wide',
292
267
  prefixes: ['DECISION', 'HALT', 'MERGED'],
293
- routing: 'broadcast',
294
268
  },
295
269
  ];
296
270
 
@@ -308,6 +282,7 @@ Scope contract:
308
282
  Activation:
309
283
  - Order named drones to start exact authorized work with START NOW, RESUME NOW, REVIEW NOW, or HOLD; name the exact item and first concrete action.
310
284
  - ACK and claim are receipt only; neither means work has started or a review is complete.
285
+ - When receipt is uncertain, use \`borg_ack-status\` for the routed entry; it reports acknowledgements and claims without advancing unread cursors.
311
286
  - Verify activation and progress against the concrete milestones from the dispatch and acceptance evidence.
312
287
  - When a milestone is missing and status is uncertain, follow the ownership and liveness discipline. Do not interrupt slow local work merely to satisfy a reporting cadence.
313
288
  - Require BLOCKED when safe work stops, naming the missing input while independent work continues.
@@ -326,7 +301,7 @@ Communication:
326
301
  - Surface decisions, blockers, asks, and material evidence in the human conversation, not only the cube log.
327
302
  - Distinguish read-only findings, proposals, completed actions, and actions awaiting authority.
328
303
  - Send START NOW, RESUME NOW, REVIEW NOW, and HOLD with \`to:\` to the named implementer or reviewer. Use \`to:\` for every later directed transition.
329
- - Send PING with \`to:\` only for a directed liveness check. Use DECISION or HALT only for an intentional cube-wide human-seat message. After an authorized merge, broadcast MERGED with the exact merge SHA.
304
+ - Send PING with \`to:\` only for a directed liveness check. Use DECISION or HALT with \`to: "broadcast"\` only for an intentional cube-wide human-seat message. After an authorized merge, post MERGED with the exact merge SHA and \`to: "broadcast"\`.
330
305
  - Keep the primary playbook operational and concise. Delete obsolete, redundant, historical, cautionary, and example-heavy prose; do not relocate it into new runbooks, decisions, contracts, rationale, or case-study archives unless it has a current operational consumer.
331
306
 
332
307
  Builders implement; reviewers review; you coordinate. Integrate only when authorized.${COORDINATOR_FINDING_DISPATCH_DISCIPLINE}${SERIALIZED_REVIEW_ROUNDS_DISCIPLINE}${GIT_OPERATIONAL_DISCIPLINE_COORDINATOR}${PUSH_DISCIPLINE_COORDINATOR}${DRONE_ADDRESSING_CONVENTION}${STRUCTURED_MESSAGE_ROUTING_DISCIPLINE}${DIRECTED_DISCUSSION_DISCIPLINE}${RECEIPT_AND_LIVENESS_DISCIPLINE}${OPERATOR_CONTROLLED_OWNERSHIP_DISCIPLINE}`;
@@ -507,76 +482,53 @@ const STARTER_TAXONOMY: MessageTaxonomy = [
507
482
  {
508
483
  class: 'status-claim',
509
484
  prefixes: ['STARTING', 'PROGRESS', 'ACK', 'PONG'],
510
- routing: 'directed',
511
- default_to: ['coordinator', 'queen'],
512
485
  },
513
486
  {
514
487
  class: 'completion-status',
515
488
  prefixes: ['DONE'],
516
- routing: 'directed',
517
- default_to: ['coordinator', 'queen'],
518
489
  lifecycle: 'completion',
519
490
  },
520
491
  {
521
492
  class: 'review-request',
522
493
  prefixes: ['REVIEW-READY'],
523
- routing: 'directed',
524
- default_to: ['coordinator', 'queen'],
525
494
  },
526
495
  {
527
496
  class: 'review-feedback',
528
497
  prefixes: ['FEEDBACK'],
529
- routing: 'directed',
530
- default_to: ['coordinator', 'queen'],
531
498
  },
532
499
  {
533
500
  class: 'completion-gate',
534
501
  prefixes: ['APPROVED'],
535
- routing: 'directed',
536
- default_to: ['coordinator', 'queen'],
537
502
  lifecycle: 'completion',
538
503
  },
539
504
  {
540
505
  class: 'blocked-signal',
541
506
  prefixes: ['BLOCKED'],
542
- routing: 'directed',
543
- default_to: ['coordinator', 'queen'],
544
507
  },
545
508
  {
546
509
  class: 'dispatch-routing',
547
510
  prefixes: ['START NOW', 'RESUME NOW', 'REVIEW NOW', 'HOLD'],
548
- routing: 'directed',
549
- default_to: ['coordinator', 'queen'],
550
511
  lifecycle: 'dispatch',
551
512
  },
552
513
  {
553
514
  class: 'ping',
554
515
  prefixes: ['PING'],
555
- routing: 'directed',
556
- default_to: ['coordinator', 'queen'],
557
516
  },
558
517
  {
559
518
  class: 'peer-question',
560
519
  prefixes: ['QUESTION', 'ASK'],
561
- routing: 'directed',
562
- default_to: ['coordinator', 'queen'],
563
520
  },
564
521
  {
565
522
  class: 'peer-answer',
566
523
  prefixes: ['ANSWER'],
567
- routing: 'directed',
568
- default_to: ['coordinator', 'queen'],
569
524
  },
570
525
  {
571
526
  class: 'peer-heads-up',
572
527
  prefixes: ['HEADS-UP'],
573
- routing: 'directed',
574
- default_to: ['coordinator', 'queen'],
575
528
  },
576
529
  {
577
530
  class: 'cube-wide',
578
531
  prefixes: ['DECISION', 'HALT'],
579
- routing: 'broadcast',
580
532
  },
581
533
  ];
582
534
 
@@ -605,7 +557,7 @@ const STARTER: Template = {
605
557
  - Questions, findings, proposals, open queues, and spare capacity do not authorize new work.
606
558
  - Route completed work to the Reviewer only when review is required.
607
559
  - Send START NOW, RESUME NOW, REVIEW NOW, and HOLD with \`to:\` to the named Worker or Reviewer.
608
- - Send PING with \`to:\` only for a directed liveness check. Use DECISION or HALT only for an intentional cube-wide human-seat message.
560
+ - Send PING with \`to:\` only for a directed liveness check. Use DECISION or HALT with \`to: "broadcast"\` only for an intentional cube-wide human-seat message.
609
561
  - Ask the human before rescoping, abandoning, waiving, merging, shipping, publishing, or taking an irreversible action unless already delegated.
610
562
  - Waiting is valid when work is complete, blocked, under review, or awaiting authority.${COORDINATOR_FINDING_DISPATCH_DISCIPLINE}${ANTI_PASSIVE_STANDING_DISCIPLINE}${DRONE_ADDRESSING_CONVENTION}${STRUCTURED_MESSAGE_ROUTING_DISCIPLINE}${DIRECTED_DISCUSSION_DISCIPLINE}${RECEIPT_AND_LIVENESS_DISCIPLINE}${OPERATOR_CONTROLLED_OWNERSHIP_DISCIPLINE}`,
611
563
  },
@@ -641,83 +593,58 @@ const LOCAL_MODEL_TAXONOMY: MessageTaxonomy = [
641
593
  {
642
594
  class: 'executor-echo',
643
595
  prefixes: ['PACKET-ECHO'],
644
- routing: 'directed',
645
- default_to: ['shaper'],
646
596
  },
647
597
  {
648
598
  class: 'executor-refusal',
649
599
  prefixes: ['SPEC-GAP'],
650
- routing: 'directed',
651
- default_to: ['shaper'],
652
600
  },
653
601
  {
654
602
  class: 'executor-completion',
655
603
  prefixes: ['PACKET-DONE'],
656
- routing: 'directed',
657
- default_to: ['shaper'],
658
604
  lifecycle: 'completion',
659
605
  },
660
606
  {
661
607
  class: 'packet-dispatch',
662
608
  prefixes: ['EXECUTE PACKET'],
663
- routing: 'directed',
664
- default_to: ['executor'],
665
609
  lifecycle: 'dispatch',
666
610
  },
667
611
  {
668
612
  class: 'packet-verdict',
669
613
  prefixes: ['ACCEPT', 'REJECT'],
670
- routing: 'directed',
671
- default_to: ['executor'],
672
614
  },
673
615
  {
674
616
  class: 'blocked-signal',
675
617
  prefixes: ['BLOCKED'],
676
- routing: 'directed',
677
- default_to: ['director', 'queen'],
678
618
  },
679
619
  {
680
620
  class: 'review-request',
681
621
  prefixes: ['REVIEW-READY'],
682
- routing: 'directed',
683
- default_to: ['director', 'queen'],
684
622
  },
685
623
  {
686
624
  class: 'director-dispatch',
687
625
  prefixes: ['DISPATCH', 'HOLD'],
688
- routing: 'directed',
689
- default_to: ['shaper'],
690
626
  lifecycle: 'dispatch',
691
627
  },
692
628
  {
693
629
  class: 'director-approval',
694
630
  prefixes: ['APPROVED'],
695
- routing: 'directed',
696
- default_to: ['shaper'],
697
631
  lifecycle: 'completion',
698
632
  },
699
633
  {
700
634
  class: 'peer-question',
701
635
  prefixes: ['QUESTION'],
702
- routing: 'directed',
703
- default_to: ['director', 'queen'],
704
636
  },
705
637
  {
706
638
  class: 'peer-answer',
707
639
  prefixes: ['ANSWER'],
708
- routing: 'directed',
709
- default_to: ['director', 'queen'],
710
640
  },
711
641
  {
712
642
  class: 'peer-heads-up',
713
643
  prefixes: ['HEADS-UP'],
714
- routing: 'directed',
715
- default_to: ['director', 'queen'],
716
644
  },
717
645
  {
718
646
  class: 'cube-wide',
719
647
  prefixes: ['DECISION'],
720
- routing: 'broadcast',
721
648
  },
722
649
  ];
723
650
 
@@ -753,7 +680,7 @@ Direction and verification:
753
680
  - Never approve work you authored. If the Shaper implemented an unconvertible item, you are its independent verifier.
754
681
 
755
682
  Continuity:
756
- - Send DISPATCH, HOLD, APPROVED, QUESTION, ANSWER, and HEADS-UP with \`to:\` to the Shaper. Use DECISION only when the message is intentionally cube-wide.
683
+ - Send DISPATCH, HOLD, APPROVED, QUESTION, ANSWER, and HEADS-UP with \`to:\` to the Shaper. Use DECISION with \`to: "broadcast"\` only when the message is intentionally cube-wide.
757
684
  - DISPATCH, HOLD, and DECISION are not completion when they leave an authorized follow-on action.
758
685
  - After answering an interruption, resume any Director action you can advance in the same turn.
759
686
  - Waiting is valid only when no routed Director action or active outcome remains, or while a named Shaper/reviewer/human decision is outstanding and you have no independent action.