feat(companion/phase1): ModelRuntimeAdapter lane selector + consent gate + 7-tier tests
Phase 1 of the Companion App build plan (gate §12, 🔀 Hybrid). Adds the Knowtation-side pure-function seam that Hub/Scooling consume:
lib/model-runtime-lane.mjs: - selectLane(capabilities, preferences) — D2.2 default-lane selection logic; individual: local > self_hosted > enterprise > openrouter > direct_provider > disabled; orgPrivacyMode: never direct_provider; keepOnDevice: biases to local with managed fallback. - isManagedLane(lane) — D1.2 metering boundary; only 'direct_provider' is metered. - enforceConsentPolicy({lane, containsPrivateData, consentId, isDelegate, delegatedManagedAllowed}) — D1.4 consent/policy gate; policy denial beats consent. Returns 'allow' | 'cloud_consent_required' | 'lane_policy_denied'. Pure functions only — no I/O, no env reads, no network; composable at any layer.
docs/COMPANION-APP-PHASE-1-ADAPTER-SEAM.md: Full seam contract spec: types, algorithms, metering×lane matrix, threat model table, Scooling interface additions, and what Phase 2+ builds on this.
test/model-runtime-lane-*.test.mjs (7 tiers, 107 cases, all green): unit, integration, e2e, stress, data-integrity, performance, security. Key security cases: orgPrivacyMode bypass, policy-before-consent evaluation order, private-data-without-consent, fail-closed on empty caps, no secret in return values.
Cross-repo (Scooling): ModelResponse.reason gains 'lane_policy_denied'; createMockModelRuntimeAdapter() updated to return it for delegate actors on managed lane. TypeScript compiles clean (tsc --noEmit: 0 errors).
Semantic Changes
27 symbols
0 comments
muse hub commit comment sha256:06bcc4854a5644481fef328207c64092d93bb8da3e8f6d25949496fa9cb2965d --body "your comment"
No comments yet. Be the first to start the discussion.