@staix/agent-hub 0.36.0 → 0.37.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 (102) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +6 -2
  3. package/THIRD_PARTY_NOTICES.md +0 -18
  4. package/docs/agent-notes/README.md +13 -3
  5. package/docs/agent-notes/daemon.md +4 -4
  6. package/docs/agent-notes/local-worker.md +1 -0
  7. package/docs/agent-notes/models.md +2 -1
  8. package/docs/agent-notes/tasks.md +1 -1
  9. package/docs/agent-notes/tests.md +1 -2
  10. package/docs/contracts/companion-cli-v1.json +70 -0
  11. package/docs/design/adapters.md +43 -2
  12. package/docs/design/agent-hub-architecture.md +9 -1
  13. package/docs/design/guidance-probes.md +802 -0
  14. package/docs/design/model-routes.md +437 -12
  15. package/docs/dogfood.md +11 -13
  16. package/docs/events.md +20 -1
  17. package/docs/memory.md +3 -3
  18. package/docs/operations.md +112 -148
  19. package/docs/quickstart.md +9 -3
  20. package/docs/research.md +1 -1
  21. package/docs/sdlc.md +5 -3
  22. package/docs/security.md +21 -1
  23. package/docs/specs/2026-09-19-agent-hub-design.md +9 -7
  24. package/docs/specs/2026-10-04-switchyard-source-port-design.md +3 -1
  25. package/docs/verification/2026-11-08-qwen-0269-model-setter-1317.md +25 -11
  26. package/docs/verification/2026-11-09-qwen-0270-model-setter-1317.md +21 -6
  27. package/docs/verification/2026-11-11-0.37.0.md +40 -0
  28. package/docs/verification/2026-11-11-guidance-probe-t2-1226.md +153 -0
  29. package/docs/verification/2026-11-11-qwen-setter-suggestions-off.md +167 -0
  30. package/docs/verified.json +24 -24
  31. package/package.json +3 -4
  32. package/plugins/agent-hub/.claude-plugin/plugin.json +1 -1
  33. package/plugins/agent-hub/kimi-hook.js +2373 -1436
  34. package/plugins/agent-hub/server.js +2445 -1497
  35. package/src/adapters/channel-peer.ts +7 -1
  36. package/src/adapters/compat.ts +1 -1
  37. package/src/adapters/local-probe.ts +174 -0
  38. package/src/adapters/local-worker.ts +232 -21
  39. package/src/cli/console-state.ts +25 -6
  40. package/src/cli/console-versions.ts +99 -0
  41. package/src/cli/console.ts +13 -1
  42. package/src/cli/help.ts +2 -1
  43. package/src/cli/install-paths.ts +7 -2
  44. package/src/cli/main.ts +60 -4
  45. package/src/cli/runtime-version-warning.ts +2 -2
  46. package/src/cli/sdlc-output.ts +9 -5
  47. package/src/hub/config-apply.ts +4 -2
  48. package/src/hub/config-trust.ts +6 -1
  49. package/src/hub/control-client.ts +5 -2
  50. package/src/hub/daemon.ts +169 -9
  51. package/src/hub/events.ts +3 -2
  52. package/src/hub/guidance-probe-store.ts +713 -0
  53. package/src/hub/guidance-probes.ts +358 -0
  54. package/src/hub/inference.ts +18 -5
  55. package/src/hub/operational-authority.ts +13 -1
  56. package/src/hub/peers.ts +5 -0
  57. package/src/hub/ports.ts +1 -1
  58. package/src/hub/progress.ts +23 -16
  59. package/src/hub/report.ts +2 -0
  60. package/src/hub/research.ts +1 -0
  61. package/src/hub/restart.ts +7 -0
  62. package/src/hub/sdlc-release-authorization.ts +139 -17
  63. package/src/hub/sdlc-release-policy.ts +100 -0
  64. package/src/hub/sdlc-release.ts +59 -7
  65. package/src/hub/tasks.ts +317 -6
  66. package/src/local/probe-errors.ts +28 -0
  67. package/src/local/probe-sandbox.ts +224 -0
  68. package/src/local/probe-types.ts +108 -0
  69. package/src/local/probe-workspace.ts +237 -0
  70. package/src/local/sandbox.ts +71 -2
  71. package/src/local/tools.ts +135 -9
  72. package/src/models/route/advisor-trigger.ts +88 -0
  73. package/src/models/route/config.ts +21 -17
  74. package/src/models/route/conversation-view.ts +179 -0
  75. package/src/models/route/decision-evidence.ts +1 -1
  76. package/src/models/route/decision.ts +114 -19
  77. package/src/models/route/escalation-control.ts +30 -0
  78. package/src/models/route/hub-prompts.ts +97 -0
  79. package/src/models/route/judge-choice.ts +155 -0
  80. package/src/models/route/judge-replies.ts +102 -0
  81. package/src/models/route/labels.ts +14 -70
  82. package/src/models/route/observation-signals.ts +250 -0
  83. package/src/models/route/plan-execute-choice.ts +27 -0
  84. package/src/models/route/relay-selector.ts +2 -2
  85. package/src/models/route/runtime.ts +115 -52
  86. package/src/models/route/turn-state.ts +77 -0
  87. package/src/omniroute/client.ts +3 -0
  88. package/src/ui/plugin.ts +70 -20
  89. package/src/version.ts +4 -0
  90. package/templates/adec/README.md +32 -0
  91. package/templates/adec/ahub.plan-execute.json +23 -0
  92. package/templates/adec/ahub.stage.json +23 -0
  93. package/LICENSES/Apache-2.0.txt +0 -204
  94. package/src/models/route/advisor.ts +0 -102
  95. package/src/models/route/escalation.ts +0 -82
  96. package/src/models/route/judge.ts +0 -23
  97. package/src/models/route/normalize.ts +0 -103
  98. package/src/models/route/plan-execute.ts +0 -52
  99. package/src/models/route/prompts.ts +0 -8
  100. package/src/models/route/signals.ts +0 -247
  101. package/src/models/route/state.ts +0 -54
  102. package/src/models/route/text.ts +0 -61
@@ -14,6 +14,23 @@ paths:
14
14
  - test/model-stage-fallback.test.ts
15
15
  - test/fixtures/model-stage-sizing-v1.json
16
16
  - test/progress.test.ts
17
+ - src/hub/inference.ts
18
+ - templates/adec/**
19
+ - test/model-advisor-trigger.test.ts
20
+ - test/model-conversation-view.test.ts
21
+ - test/model-escalation-control.test.ts
22
+ - test/model-hub-prompts.test.ts
23
+ - test/model-judge-replies.test.ts
24
+ - test/model-plan-execute-choice.test.ts
25
+ - test/model-turn-state.test.ts
26
+ - test/model-observation-signals.test.ts
27
+ - test/model-judge-choice.test.ts
28
+ - test/model-route-event-parity.test.ts
29
+ - test/benchmarks/model-routing-gate.test.ts
30
+ - test/model-route-scope-lifetime.test.ts
31
+ - test/model-route-public-api-scalars.test.ts
32
+ - test/fixtures/model-route-public-api-scalars-v1.json
33
+ - test/route-stage-classifier.test.ts
17
34
  ---
18
35
 
19
36
  # Hub Model Routes
@@ -22,7 +39,9 @@ This document defines agent-hub's replacement route design for issue #1352. Its
22
39
  inputs are the project's configuration, operational contracts and nonported
23
40
  consumers. It is a newly authored rewrite. R1 covers
24
41
  stage evidence and deterministic fallback; R2 owns the remaining route decisions
25
- and judge/prompt replacement; R3 owns notice and remnant cleanup.
42
+ and judge/prompt replacement; R3 retires the derived modules, their upstream
43
+ checker and the corresponding Apache license/notice. The unrelated Tabler Icons
44
+ notice remains in the package.
26
45
 
27
46
  **Review basis:** the recorded R1 contract review for issue #1352 accepted the
28
47
  ownership split, packet bounds and numerical contract. The sizing
@@ -33,6 +52,18 @@ consumer wiring implement this contract; validation conclusions remain bound
33
52
  to their exact-head receipts. Accepted design choices are not measurements of
34
53
  implementation equivalence or runtime behavior.
35
54
 
55
+ ## R3 retirement
56
+
57
+ The active route implementation uses the owned `stage-*`, `turn-state`,
58
+ `conversation-view`, `observation-signals`, `escalation-control`,
59
+ `advisor-trigger`, `plan-execute-choice`, `judge-choice`, `judge-replies` and
60
+ `hub-prompts` modules. R3 removes the replaced source-port modules and their
61
+ ported vector suites, the upstream checker, and the corresponding Apache
62
+ license/notice. The owned `stage.ts` compatibility re-export remains.
63
+ `RESERVED_SIDECAR = 3` keeps the unused port offset stable; no listener is added.
64
+ The Tabler Icons notice remains packaged. This retirement changes no routing
65
+ behavior, configuration grammar or generic decision-evidence v1 payload.
66
+
36
67
  ## Decision ownership
37
68
 
38
69
  | Question | Owner | R1 status |
@@ -55,6 +86,10 @@ below; judge/plan-execute choice questions require later reviewed wiring (R2).
55
86
 
56
87
  ## Route contracts and compatibility
57
88
 
89
+ The slice references below record the R1/R2 ownership split. R2 now supplies
90
+ the owned host decision and judge implementations; R3 removes their replaced
91
+ source-port counterparts.
92
+
58
93
  - `stage` produces stage evidence, a deterministic efficient/capable fallback and
59
94
  the existing session-aware switch plan. With `classifier = "decision"` it may
60
95
  also ask adec, and only when its own score sits in the ambiguity band; the
@@ -159,6 +194,10 @@ implementation measurements or permission for an undocumented behavior change:
159
194
  - A stage packet has at most 1024 serialized UTF-8 bytes. Counts reflect inspected
160
195
  observations only. Malformed/over-cap input is incomplete or unavailable;
161
196
  neither a source fragment nor an arbitrary property enters the packet.
197
+ Before service HTTP, measure the serialized non-generic numeric packet with
198
+ `Buffer.byteLength`; overflow is unavailable and sends no request. This is a
199
+ whole-packet refusal, not truncation, and does not change generic decision
200
+ evidence v1 or its separate 8 KiB contract.
162
201
 
163
202
  The local input view is separate from provider transport. It captures supported
164
203
  roles, call/result association, explicit outcome flags and bounded local text for
@@ -361,7 +400,9 @@ a freshly authored re-export facade, containing no former implementation body.
361
400
  In particular `CodingAgentDimensions` is defined in `stage-evidence.ts` with the
362
401
  four existing numeric fields, and `estimateInputTokens` is an export of the new
363
402
  input-sizing unit. The generic v1 builder/test imports keep their existing path
364
- and behavior until R3 retires that compatibility boundary.
403
+ and behavior; the freshly authored facade remains an owned compatibility API.
404
+ R3 removes derived implementations and migrates remaining type-only consumers
405
+ to owned types without changing generic v1 evidence bytes.
365
406
 
366
407
  ```ts
367
408
  type StaySwitchMode = "off" | "shadow" | "enforce";
@@ -465,6 +506,373 @@ CHANGELOG. No unique absolute-count pin was found in the inspected owned caller
465
506
  assertions; their fit outcomes and relay/local equality still remain authority.
466
507
  A later discovered owned absolute pin must be preserved explicitly.
467
508
 
509
+ ## Host route policies and model-choice observation (R2)
510
+
511
+ This section defines the R2 integration contract for review before shared wiring.
512
+ The self-contained helpers and focused receipts are separate from acceptance of
513
+ that integration. It adds no permission to consult the protected route bodies,
514
+ source-port vectors or `src/hub/ports.ts`. R1's four stage units are owned inputs;
515
+ R3 retires the derived implementations, provenance checker and corresponding
516
+ license/notice, and preserves reserved port offset 3 under a neutral name.
517
+
518
+ ### Configuration and service ownership
519
+
520
+ Use the existing top-level `decision_backend`, `decision_mode`, `policy_id`,
521
+ `adec_endpoint`, `candidates` and `decision_timeout_ms` keys. A `plan_execute`
522
+ route with a valid optional service binding asks the phase-model question; an
523
+ `advisor` or `escalation` route with a valid binding asks the judge-model question.
524
+ An ordinary route without that binding keeps its host policy. No `judge_choice`
525
+ block or other TOML key is introduced. Service fields that are present must form
526
+ a valid binding rather than being silently ignored. Every supported choice path
527
+ defaults off, accepts shadow and refuses enforce at load with the #554 follow-up.
528
+
529
+ One common service validator checks the existing backend/mode, bounded policy
530
+ identifier, numeric-loopback `/v1/route` endpoint, timeout and alias/effort options.
531
+ The S2 stage classifier, tier offerings, ambiguity band/defaults and stage-specific
532
+ validation retain their existing behavior. It does not turn into the phase or
533
+ judge route. The memo purposes are `stage`, `decision`, `phase` and `judge`,
534
+ separated by purpose, route, scope, configuration and opaque user turn. S2's
535
+ one-stage-question-per-turn held answer remains its own contract. Phase/judge
536
+ observation does not cache a valid pair as applied host authority; the service
537
+ rechecks its own pins and hard rules.
538
+
539
+ All these questions use policy-backed `POST /v1/route`. No generic ask or
540
+ System One shortcut is added. The host owns whether to review/escalate,
541
+ APPROVE/REDO, feedback, PII screening and peer assignment. A configured service
542
+ chooses only eligible model/effort pairs; off/shadow leaves the actual fallback
543
+ model, effort and forwarded conversation unchanged. Explicit model overrides
544
+ continue to bypass optional choice. The two shipped policy examples are
545
+ `ahub.stage` and `ahub.plan-execute` under `templates/adec`; the person supplies
546
+ provider, aliases and residency and copies policies into their own adec home.
547
+ The hub neither reads nor writes that home or a provider key.
548
+
549
+ ### Numeric question evidence
550
+
551
+ The proposed ordinary R2 packet is closed and contains no transcript or arguments:
552
+
553
+ ```ts
554
+ type HostChoicePurpose = "plan_execute_model" |
555
+ "advisor_judge_model" | "escalation_judge_model";
556
+ interface HostChoiceEvidence {
557
+ schemaVersion: 1;
558
+ kind: "host-route-choice-evidence";
559
+ purpose: HostChoicePurpose;
560
+ phase?: "planning" | "executing"; // phase question only
561
+ stage: StageEvidence;
562
+ }
563
+ ```
564
+
565
+ The entire serialized packet must fit 1024 UTF-8 bytes at the request boundary.
566
+ Overflow is unavailable and sends no HTTP; no fragment is silently removed to
567
+ make it fit. `phase` and `judge` are memo purposes, not additional request-wire
568
+ fields. A sensitive request retains only R1's `schemaVersion`, `kind` and four
569
+ dimensions, with contextTokens zero; purpose, phase, history counts and text size
570
+ are omitted from its evidence. The request's opaque hashed turn identity still
571
+ separates purposes. Generic #813 decision evidence v1 and its tests remain
572
+ unchanged, including their distinct bounded-fragment contract.
573
+
574
+ ### Host state and completed mutation
575
+
576
+ `PlanPhase.observe(view, scope)` starts capable/planning and adds the newly
577
+ written planning instruction. An associated, individually complete, non-error
578
+ mutation result establishes efficient/executing for that scope. Explicit failed,
579
+ denied, refused or cancelled results do not prove success. This is protocol
580
+ completion evidence, not filesystem-effect attestation. A clipped old history
581
+ does not block a complete current mutation; clipped/unknown current text cannot
582
+ prove completion. Once established, the scope latch survives later partial views.
583
+ A fresh or unavailable no-mutation view remains planning, not presumed execution.
584
+
585
+ `captureRouteView` reuses R1 association and diagnostics and adds only a local
586
+ `sourceTextComplete` observation. It uses the same bounded positions before R1
587
+ capture, rejects proxies/accessors/inherited data, and aligns captured results by
588
+ chronological tool ordinal. An inspected malformed record can make the local view
589
+ unavailable; that is unknown evidence, not proof that no mutation happened.
590
+ No completeness bit or other field is added to the StageEvidence wire.
591
+
592
+ The generic `ScopeStore` intentionally uses explicit 512-entry/one-hour limits:
593
+ expiry is since the last successful get or set, so active scopes renew their
594
+ idle lifetime and preserve established latches, execution phase, advisor budgets
595
+ and stage holds. Reads also update LRU order. Undefined values refuse, and a
596
+ backward clock clears all retained state. Opaque
597
+ local keys have a new 4096-byte ceiling. These explicit defaults/expiry semantics
598
+ are declared choices where the former default/clock behavior was not observed;
599
+ they are not claims of measured equivalence and belong in CHANGELOG.
600
+
601
+ ### Advisor and escalation authority
602
+
603
+ Advisor uses a separate 1024-entry FIFO budget ledger and 1024-scope FIFO stalled
604
+ set, not the generic ScopeStore. The `instance` budget entry is never evicted.
605
+ A pending reservation is charged immediately; success keeps the charge, failure
606
+ refunds one and increments failures. Omitted review budget is one, and three
607
+ failed reviews block further review. Check budget before either trigger.
608
+
609
+ The ordinary primary trigger is a terminal no-tool answer with at least the
610
+ configured completed tool-result count (omitted minimum zero). The pattern primary
611
+ uses the configured Unicode regular expression instead. Assistant-message count
612
+ supplies stall turns. Omitted/zero stall is disabled; a positive threshold offers
613
+ a checkpoint at or above that count only when the scope is not already stalled.
614
+ Only a stall without a simultaneous primary marks the checkpoint. Success does
615
+ not rearm it. Failure settlement, budget-refused reservation and explicit eviction
616
+ clear the checkpoint. Automatic budget eviction deletes only its ledger entry;
617
+ the stalled set keeps its separate FIFO lifetime.
618
+
619
+ The capacity correction is intentional: only inserting a new key into a full
620
+ ledger trims that ledger. Same-key updates and unrelated-ledger operations cannot
621
+ evict charged reviews or rearm stalled scopes. Record this difference in CHANGELOG.
622
+ Escalation confirms two fresh same-category replies by default. Explicit old or
623
+ negative evidence breaks the streak, category change restarts it, unavailable
624
+ reply preserves it and an established latch remains set. Store no judge reason
625
+ in event or confirmation state. Runtime accepts only the checked reply parser's
626
+ output, never an assert-cast foreign verdict.
627
+
628
+ ### Full local judge context and fresh prompt wording
629
+
630
+ `captureJudgeConversation` projects full inert native string/null messages,
631
+ function-call/result metadata, local opaque argument strings, instruction order,
632
+ assistant/tool counts and terminal-answer facts. It is separate from the recent
633
+ stage window and the service packet. It rejects malformed/explicitly unknown
634
+ fields instead of assembling partial judge context. The actual relay/local caller
635
+ must establish the supported native shape; unsupported formats are unavailable,
636
+ not blanket claims that every provider format is malformed. The existing 2M-byte
637
+ whole-wire ceiling applies before prompt construction and admits all valid
638
+ 200000-codepoint cases. Getters, custom serialization and proxies do not execute.
639
+
640
+ Advisor transcript default is 200000 Unicode code points, with the existing
641
+ 256..200000 validator. Serialize instructions first and messages next as JSON;
642
+ then retain floor(cap/4) points at the head and the remaining cap points at the
643
+ tail, separated by `\n...<middle of the conversation truncated>...\n`. The marker
644
+ is outside the cap. Only afterward append the latest-turn suffix without a byte
645
+ cut. Discarded telemetry counts code points. This preserves the recorded main
646
+ behavior rather than introducing a new transcript default. Advisor output is
647
+ 2048 tokens; escalation output is 256. Its owned input window is the most recent
648
+ 12 assistant turns with their following tool results, the closest preceding user
649
+ task, and system/developer instructions. Bound each serialized message to 1500
650
+ Unicode code points with an explicit middle-drop marker, then bound the assembled
651
+ transcript to 16000 code points including its middle-drop marker. Fixed prompt
652
+ and turn headers stay outside those bounds. Discarded telemetry counts omitted
653
+ original transcript code points, excluding inserted markers. These owned bounds
654
+ retain history for repetition/false-progress assessment while limiting one large
655
+ result's share; they provide no live quality or eight-second latency guarantee. Surrounding planning,
656
+ review, escalation and redo prompt wording is newly written; the owned caller's
657
+ short `senior reviewer` feedback cue remains.
658
+ The fresh request bytes invalidate former live request digests for these prompts.
659
+ Keep historical receipts unchanged; the new prompt-quality live leg is manual
660
+ and UNRUN, without a model call or restamp. Model-free protocol tests do not
661
+ establish real-model judgement quality.
662
+
663
+ Reply parsing is anchored APPROVE/REDO after optional leading Markdown/quote
664
+ decoration and an optional `Verdict:` prefix, case-insensitive. Closing verdict
665
+ decoration is removed before REDO feedback. Arbitrary leading prose remains
666
+ unparsed. Escalation accepts one optionally JSON-fenced object with the documented
667
+ consumed fields and closed categories. Unused extra keys remain ignored as before;
668
+ surrounding commentary or multiple objects refuse. New accepted-data ceilings
669
+ are 64 KiB reply input and 4096 bytes local feedback/reason; oversized input is
670
+ unavailable, not a partial verdict. These safety ceilings are declared in
671
+ CHANGELOG rather than described as observed former defaults. No prompt, reason,
672
+ argument, diagnostic or native identifier enters the numeric service packet.
673
+
674
+ ### Owned observation outcomes and existing progress fences
675
+
676
+ `observation-signals` follows the owned R1 evidence/diagnostic precedence and
677
+ shared critical predicate, not former signal tables or source-port fixtures.
678
+ A full outcome batch must not be reported as complete from the recent 16-result
679
+ stage window. Unknown/over-bound input stays unavailable and omits an unproven
680
+ `next` label rather than inventing an all-clear value. Local native projection
681
+ uses the existing 2M whole-wire ceiling; native progress retains its existing
682
+ 28-observation/name-80/text-500/source-40/turn-120 caller bounds.
683
+
684
+ The local adapter has explicit per-result facts: `readOnly`, `nativeError`,
685
+ `assertionDiagnostic`, `testInvocation` and `testMention`, plus the owned
686
+ `diagnoseStageResult` result. Read-only classification includes the owned
687
+ `text_editor` operation `view`; command/argument inspection is bounded and local,
688
+ never part of StageEvidence or service evidence. A missing/ambiguous association
689
+ or malformed flags do not establish a qualified complete batch.
690
+
691
+ - A successful read/view creates no execution failure, test failure or digest.
692
+ It also does not clear prior qualified test failures.
693
+ - Otherwise the shared R1 critical classification has first priority (severity
694
+ 1). An explicit native error, AssertionError diagnostic or R1 exception has
695
+ local label severity 0.7. Other reported diagnostics retain 0.3, except an
696
+ unflagged test-failure-only report without those stronger flags is test evidence
697
+ only, with label severity zero. This preserves the owned wrapped numeric-test
698
+ fixture containing `exit code 0` without treating that text as native exit
699
+ attestation. This label adapter does not change stage severity or scoring.
700
+ - A test context is an owned test-invocation name/command or an observed test
701
+ term. A qualified failure in that context is retained across the full batch;
702
+ an unrelated execution failure is retained separately. Process all results in
703
+ chronological order. Only a non-read, non-error genuine positive test pass
704
+ accepted by R1's closed grammar clears retained test-category failures, not
705
+ unrelated failures. A commandless result may also inherit a retained qualified
706
+ failure from the exact same declared tool/operation name, within this batch or
707
+ across consecutive decisions in the same tracker run. Its own result must pass
708
+ R1's closed positive-pass grammar, and this inherited pass clears only that
709
+ operation's qualified failures. No retained failure, a different operation or
710
+ an explicit non-test command supplies no inherited test context. This preserves
711
+ recovery labels without turning arbitrary numeric migration summaries into test
712
+ evidence. Numeric failure takes priority over a simultaneous positive pass
713
+ count. An empty zero/zero run creates no pass and clears no failure.
714
+ - The tracker's existing private prior-failure entries extend their digest with
715
+ a declared operation name only for qualified test failures. Names are bounded
716
+ to 256 UTF-8 bytes; an oversized/unavailable name cannot grant inherited context.
717
+ Entries retain the existing two-million-byte source admission and at most
718
+ `2000000 / 20` result-entry ceiling. The metadata has the existing decision/turn
719
+ lifetime and is removed when cleared or the turn ends. No arguments, result
720
+ text, diagnostic fingerprint, persisted state, configuration or event field is
721
+ added. Prior context only qualifies the new batch's observed pass; it does not
722
+ copy an earlier batch's severity into a later outcome.
723
+ - Retained qualified test failure means `tests: "fail"` even after later plain
724
+ read or `ok` results. With none retained, the latest genuine qualified test pass
725
+ means `pass`; a batch with no eligible test evidence means `none`. Ordinary rows
726
+ do not replace qualified test evidence. This is an explicit LOCAL divergence
727
+ from R1's `signals.tests`, which describes the latest inspected result.
728
+ - Retain only SHA256 digests of the owned R1 diagnostic fingerprint for qualified
729
+ failures. Diagnostic text and raw fingerprints are transient local values,
730
+ never state/event fields. Repetition still passes the existing separate native
731
+ cross-turn predicate before progress judging. No source-port calibration is
732
+ inferred from these owned fixtures.
733
+
734
+ The fresh local APIs are `ToolObservation` (name plus optional command/resultText/
735
+ isError/source), `projectOutcomeBatch(assistant, tools)`,
736
+ `priorFailureDigests(messages)`, `failureFingerprint(text, isError)` and
737
+ `repeatedObservationFailure(observations)`. A batch projection returns bounded
738
+ severity, pass/fail/none and failure digests, or unavailable. The runtime obtains
739
+ assistant count from its complete JudgeConversation and phase from PlanPhase;
740
+ this is not a new general tier-picking ToolSignals formula.
741
+
742
+ Native `progressDimensions`, its eight-distinct-known-turn rule, cross-turn
743
+ failure predicate, attempted-frame deduplication, generation, owner/open-task and
744
+ privacy fences remain unchanged. Only owned observation/reply/type dependencies
745
+ migrate. Peer-reassignment advice remains a host inference purpose; this change
746
+ does not add an adec path to pure peer assignment or PII screening.
747
+
748
+ ### Deadline, currentness and publication ceiling
749
+
750
+ For optional host judges, fallback has priority and does not wait for the shadow
751
+ model-choice answer. Priority means invoking the existing fallback execute port
752
+ before observer admission starts, after private common campus/currentness
753
+ preparation. The actual house quota transaction runs before that port's first
754
+ await; this does not attest downstream provider/GPU generation order or a custom
755
+ asynchronous host's physical admission. One absolute deadline covers common preparation and the judge/observation window;
756
+ there is no fresh timeout after a slow admission. The current common budget and
757
+ campus APIs cannot be cancelled: the deadline races them, it does not join them.
758
+ There is no strict physical eight-second completion or zero-pending-common-host
759
+ claim. Keep a `ponytail:` ceiling naming the optional abort/currentness API upgrade
760
+ if an actual hang is observed. No LocalWorker or OmniRoute API edit is part of
761
+ this approved choice. The separately owned `requestAdecRoute` observation is
762
+ aborted and joined when fallback finishes. A normal window close is not a failed
763
+ service memo or warning; actual failed transports keep bounded failure handling.
764
+ Cleanup always aborts the fallback signal even when observer close propagates an
765
+ authority or teardown error; preserving that error never skips the abort.
766
+
767
+ Re-read current actor/privacy/observer facts after awaits and before owned service
768
+ HTTP, metadata publication and feedback delivery. Changed/unavailable authority
769
+ propagates as `DecisionPolicyChangedError`; it is not converted into fallback or
770
+ swallowed as optional telemetry. Review/remote observer exclusion skips service,
771
+ and sensitive work requires positive campus admission. A client abort does not
772
+ prove the external service stopped provider generation.
773
+
774
+ The sole additional event field is `RouteEvent.decisionTarget?: "judge"`.
775
+ Absence preserves the executor event contract. A judge-choice observation uses a
776
+ separate existing `onRoute` callback: `tier` is the requested fallback judge
777
+ alias, `source` is `default`, and the remaining metadata uses existing checked
778
+ decision fields. It does not claim a served or applied model and adds no purpose
779
+ or phase field. Publication bypasses `addDecision` and the executor label path,
780
+ with no label, progress or usage credit. Off emits no observation. Recheck
781
+ privacy/currentness immediately before publication; sink failures stay optional,
782
+ but authority refusals are not swallowed as telemetry errors.
783
+
784
+ Before emission is enabled, executor consumers exclude `decisionTarget: "judge"`:
785
+ the report before timestamp/switch accounting, task research before generic
786
+ accumulation/peer involvement, and the owned routing corpus harness before its
787
+ last-executor-observation collector. This changes no corpus input, guard, expected
788
+ result or scoring. The raw research-quality `events.present` census remains a
789
+ truthful count of recorded event types, including metadata; it is not business
790
+ or executor credit. Token/cost and SDLC measures retain their separate inputs.
791
+ The closed operational projection already withholds the entire `route` kind,
792
+ while raw event export retains the target; this adds no console/display feature.
793
+
794
+ ### Internal model-free lifecycle proof seams
795
+
796
+ An optional third `HubRouteRuntime` constructor proof port may receive
797
+ `choicePrepared(ready: Promise<void>)`. The promise is derived from the actual
798
+ owned observation result after selection settles; it exposes no choice data,
799
+ permission or cancel method, and readiness alone does not attest a valid choice.
800
+ The original result is still awaited and confirmed independently. Proof-sink
801
+ failure is isolated. With the port absent, no readiness promise is created.
802
+ There is no RouteHost, LocalWorker, OmniRoute, configuration or event-field change.
803
+
804
+ `ChoiceWindow.commonSettled` reports consumption of common preparation fulfillment
805
+ or rejection; close does not join it. This lets a controlled late-common test
806
+ release its host barrier and await consumption directly without elapsed-time
807
+ waits or guessed event-loop turns. The separately started owned HTTP task remains
808
+ the only abort-and-join claim.
809
+
810
+ The owned model-free routing harness has optional `beforeJudgeReply`,
811
+ `choicePrepared` and `observeRoute` proof ports. A value-only optional
812
+ `turnContext` binds one controlled fake logical user turn using the existing
813
+ trusted begin/end API, with end in finally. Its fixture must explicitly name the
814
+ owned loopback fake service endpoint, never an implicit default. Default absence
815
+ retains canonical missing-turn/no-HTTP behavior; no native/provider/person identity
816
+ or inferred multi-user lifecycle is introduced. The first pauses a scripted reply
817
+ only after execute arguments have been recorded; the last receives a detached,
818
+ frozen copy and has no return authority. An optional `observeExecute` read-only
819
+ tap similarly receives a detached/frozen snapshot of the actual requested model,
820
+ messages, judge flag and maxTokens arguments, never the signal. It is invoked
821
+ only when supplied, introduces no default clone/await/promise, and cannot alter
822
+ scripted replies or scoring. Exact host-input JSON bytes are compared, not
823
+ claimed as native/provider wire. The execute API has no effort argument, so no
824
+ effective/served effort value is invented. Absent ports introduce no new await or
825
+ readiness promise in canonical corpus execution. These ports do not change corpus
826
+ cases, expected outputs, splits, guards or scoring. Integration proof must still
827
+ show an actual judge-target event, off-mode absence and identical actual model,
828
+ input, judge-call count and last executor observation; a fulfilled void readiness
829
+ promise alone cannot satisfy it.
830
+
831
+ The test and report name is normalized event parity. In controlled judge-choice
832
+ off/shadow comparisons, executor events must be JSON-byte-identical after canonicalizing only `ms` and the opaque decision UUID
833
+ through a validated one-to-one mapping, with identical presence, count and type.
834
+ Every other field matches exactly. Actual execute model and input stay raw
835
+ byte-identical; the execute API exposes no effort argument to normalize or invent.
836
+ Judge observations are separate, one per admitted observation call and none when
837
+ off. No clock or UUID generation seam is added.
838
+
839
+ ### R2 observation and inspection record
840
+
841
+ One approved public-API observation ran on committed baseline
842
+ `78891c179954f80adc90bec716f9f78107a2e872` with 24 newly authored synthetic cases,
843
+ no account/model/decider call, no dependency installation and scalar-only output.
844
+ The private guarded driver/fixture/command have distinct hashes; Git blob bindings
845
+ identify the opaque baseline APIs. All 24 scalar rows passed the closed collector;
846
+ network/process/server/output/write effect counters were zero, native-network and
847
+ owned-canary guard controls passed, source bindings matched before/after, and
848
+ owned stop/drains/temp cleanup succeeded. This is finite API evidence, not general
849
+ implementation equivalence, routing quality or live acceptance.
850
+
851
+ The committed fixture is `test/fixtures/model-route-public-api-scalars-v1.json`.
852
+ The exact argv is retained privately at workspace-relative
853
+ `scratchpad/temp/task856/public-api-scalars-v1/command.json`, SHA256
854
+ `43e1c7919945847f9d2859822901e42e6418f52488faa90417bacbd5f2395a4d`;
855
+ its raw result log SHA256 is
856
+ `e9790c07cae5e974cdc9695b08ecf7099bf72d2679a1a747bfc18078a57cb338`.
857
+ The fixture's redacted command shape is not executable; an exact-argv reference
858
+ requires that retained artifact, not an invented public reproducer. No additional
859
+ API probe, model call or TTL wait is implied.
860
+
861
+ On 2026-11-10 a conductor instruction mistakenly allowed AdvisorGate and text
862
+ helper reuse. The AdvisorGate class, one named stall test and the middleDrop
863
+ exported signature were read under that instruction. The helper body was not
864
+ read, and its temporary import was removed; truncation is newly authored from
865
+ the owner's literal behavior contract. The own advisor unit was written and
866
+ reviewed against that contract, including the later capacity correction, without
867
+ copying a ported function body. An earlier broad historical-doc search exposed
868
+ advisor behavior notes; review preparation also exposed limited excluded inventory
869
+ expression/key-pattern metadata after initial algorithm commits. These exposures
870
+ are recorded as process limits, not represented as unread history. No further
871
+ protected body, prompt, vector or ports read/import was authorized under R2.
872
+ This is a newly authored rewrite with explicit provenance. R3 removes the derived
873
+ implementations and their corresponding license/notice; this process record
874
+ remains historical evidence.
875
+
468
876
  ## Native progress projection, separate from stage selection
469
877
 
470
878
  The nonported progress observer has a different public calibration from stage
@@ -489,8 +897,12 @@ native-turn fields; it does not inspect commands or tool arguments. It emits onl
489
897
  dimension grants no execution, reassignment or model-routing authority.
490
898
 
491
899
  This replacement removes the observer's dependency on the former stage helper.
492
- Generic decision evidence v1 and remaining legacy route signal/judge code are
493
- unchanged. The existing owned progress tests remain acceptance authority.
900
+ At the R1 boundary, generic decision evidence v1 and the remaining legacy route
901
+ signal/judge code were unchanged. R2 supplies the owned signal/judge replacements;
902
+ R3 removes the replaced modules. Generic decision evidence v1 stays unchanged,
903
+ and the existing owned progress tests remain acceptance authority. The existing
904
+ progress observation type is exported as `NativeToolObservation`, including its
905
+ optional native `turn`, for host callers; this adds no runtime or event field.
494
906
 
495
907
  ## Privacy, authority and events
496
908
 
@@ -585,8 +997,9 @@ committed as our fixture at `test/fixtures/model-stage-sizing-v1.json`. The PR
585
997
  records that the former function was observed only through its public API.
586
998
  No second characterization, model request or quiet/no-op follow-up is implied.
587
999
 
588
- ## Implementation and consumer map
1000
+ ## Historical R1 implementation and consumer map
589
1001
 
1002
+ This section records the R1 boundary before R2 replacement and R3 retirement.
590
1003
  Fresh stage-only units were added under the reviewed task plan:
591
1004
 
592
1005
  | Unit | Responsibility |
@@ -610,13 +1023,16 @@ implementations:
610
1023
  | `src/models/route/decision-evidence.ts` | Four-dimension type dependency only; its function, payload and tests stay unchanged |
611
1024
  | `src/models/route/labels.ts` / `src/hub/inference.ts` | Remaining generic normalization/signal/fingerprint or Conversation consumers; migration/compatibility needs separate path approval |
612
1025
 
613
- `parseAdvisorVerdict` and legacy `text.ts` remain R2. Generic normalization,
614
- signal/observation and outcome-label consumers still exist; R1 does not remove
615
- those bodies by assuming the stage route was their only consumer. A small newly
616
- authored compatibility facade may retain an existing type/import boundary where
617
- required by unchanged consumers. A replaced stage-function file with no remaining
618
- consumer is removed without reading its removed body. The PR lists retained
619
- R2/R3 source-port files; R1 does not remove licenses/notices or upstream tooling.
1026
+ At R1, `parseAdvisorVerdict` and legacy `text.ts` remained R2 work. Generic
1027
+ normalization, signal/observation and outcome-label consumers still existed; R1
1028
+ did not remove those bodies by assuming the stage route was their only consumer.
1029
+ A small newly authored compatibility facade could retain an existing type/import
1030
+ boundary where required by unchanged consumers. A replaced stage-function file
1031
+ with no remaining consumer was removed without reading its removed body. The R1 PR listed retained
1032
+ R2/R3 source-port files; R1 did not remove licenses/notices or upstream tooling.
1033
+ R2 supplies the owned replacements and R3 retires the remaining derived modules
1034
+ and vectors without reading or copying their bodies. Nonported integration
1035
+ assertions remain in place, with owned type/import bindings where needed.
620
1036
 
621
1037
  The precise new exports, compatibility facade and consumer wiring paths were
622
1038
  pinned in the board plan before production edits. The own unit tests are
@@ -626,3 +1042,12 @@ independently authored cases from this contract. Existing relay/local-worker/dec
626
1042
  no source-port golden cases are read or copied. Seed review uses id/path/test
627
1043
  metadata only. Current route-directory seed count is zero; any consumer anchor
628
1044
  that wiring touches is reviewed/rebound without weakening its named guard.
1045
+
1046
+ ### Owned benchmark binding migration (R2)
1047
+
1048
+ The existing model-routing benchmark binds its prompt identities to the fresh
1049
+ exported host prompt constants. This is the R2 test-binding migration: assertions,
1050
+ corpus vectors, splits, guards, scores and thresholds remain unchanged. The receipt
1051
+ request builder captures the same completed advisor conversation and latest-turn
1052
+ suffix as the runtime, and preserves the public conversation-turn marker. This
1053
+ checks measurement fidelity; it supplies no live quality or promotion evidence.