@deepwatch/dsh-client-settings 0.1.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 @@
1
+ {"version":3,"file":"client.js","names":["toneFor","Modal","css","IconCheckOutline16","IconSettingsOutline16","Button","IconRightUpOutline16","useId","useRef","useState","useSyncExternalStore","useCallback","useMemo","useSyncExternalStore","useState","useSyncExternalStore"],"sources":["../../brand/lib/identity.js","../../brand/lib/mark.js","../../technology/lib/ocr.js","../../contracts/lib/readiness.js","../../contracts/lib/bindings.js","../../contracts/lib/failures.js","../src/client/readiness.tsx","../src/ocr-measured.ts","../src/client/components.tsx","../src/client/onboarding.tsx","../src/client/binding-state.ts","../src/providers.ts","../src/client/role-bindings.tsx","../src/client/chat-gate.tsx","../src/client/index.tsx"],"sourcesContent":["/**\n * The Watch product identity, and the one colour rule that matters.\n *\n * Kept as data rather than as markup so the same strings reach the sidebar,\n * the conversation hero, the About panel, the window title and the release\n * notes without four copies drifting apart. Attribution in particular has to\n * be identical everywhere it appears, because it is a legal statement rather\n * than a design element.\n *\n * @module @deepwatch/dsh-client-brand/identity\n */\n/** What the product is called. Never \"DeepSeek\" anything. */\nexport const PRODUCT_NAME = 'DeepWatch';\n/** The short form, for a tab title or a cramped header. */\nexport const PRODUCT_SHORT_NAME = 'Watch';\n/**\n * The document title this product should be showing.\n *\n * The `<title>` belongs to DSH's built HTML shell, which this distribution\n * does not fork, and DSH's session layer rewrites it on every navigation as\n * `<session> — <foundation>`. Left alone that reads\n * `Say hello — DeepSeek Harness · DeepWatch`: two products named in one tab,\n * and the wrong one first.\n *\n * So both names come off before ours goes back on, and ours comes off *first*\n * — the observer that calls this fires on the change this makes, and a version\n * that stripped only the foundation appended a second `· DeepWatch` each time.\n *\n * @param current - the title as it stands right now.\n * @param foundation - the shell's own title, from before hydration.\n */\nexport function productTitle(current, foundation) {\n const ours = ` · ${PRODUCT_NAME}`;\n let text = current;\n while (text.endsWith(ours))\n text = text.slice(0, -ours.length);\n if (foundation !== '') {\n for (const separator of [' — ', ' · ', ' - ', ' | ']) {\n const suffix = `${separator}${foundation}`;\n if (text.endsWith(suffix)) {\n text = text.slice(0, -suffix.length);\n break;\n }\n }\n }\n return text === '' || text === foundation || text === PRODUCT_NAME\n ? PRODUCT_NAME\n : `${text} · ${PRODUCT_NAME}`;\n}\n/**\n * Attribution to the upstream project.\n *\n * Required, and required to be visible. Watch is built on DeepSeek Harness and\n * says so; the alternative — quietly shipping someone else's foundation — is\n * both wrong and against the MIT notice this distribution inherits.\n */\nexport const ATTRIBUTION = 'Built on DeepSeek Harness · Powered by Watch Skill';\n/**\n * The independence disclosure.\n *\n * Equally required, and for the opposite reason: attribution without it could\n * read as endorsement, and no such endorsement exists.\n */\nexport const INDEPENDENCE = 'DeepWatch and Watch Skill are independent projects and are not affiliated with or endorsed by DeepSeek.';\n/** One line for a tooltip or an empty state. */\nexport const TAGLINE = 'An agent that sees, remembers, and can prove what actually happened.';\n/** Every status the product renders, and the tone it is permitted. */\nexport const STATUS_TONE = {\n // Verification — the only place `success` is reachable.\n VERIFIED: 'success',\n FAILED: 'error',\n UNVERIFIED: 'caution',\n INCONCLUSIVE: 'caution',\n STALE: 'caution',\n BLOCKED: 'caution',\n // Agent execution — deliberately never `success`. A completed turn is a\n // statement about the agent, not about the world.\n queued: 'neutral',\n running: 'active',\n completed: 'info',\n failed: 'error',\n cancelled: 'neutral',\n // Evidence health.\n current: 'neutral',\n gap: 'caution',\n expired: 'caution',\n unavailable: 'caution',\n};\n/**\n * The tone one status is allowed.\n *\n * Anything unrecognized is `neutral`, never `success`. A new status added\n * elsewhere and not registered here renders as unremarkable rather than\n * accidentally as a win.\n */\nexport function toneFor(status) {\n return STATUS_TONE[status] ?? 'neutral';\n}\n/** Whether a status may be rendered with the success affordance. */\nexport function isSuccessTone(status) {\n return toneFor(status) === 'success';\n}\n/**\n * The semantic token a tone maps to.\n *\n * Feature packages ask for a tone and get a CSS variable. They never write a\n * hex value, which is what stops the palette from being re-invented slightly\n * differently in every panel — and what makes a theme change one edit.\n */\nexport function tokenFor(tone) {\n return `var(--watch-tone-${tone})`;\n}\n//# sourceMappingURL=identity.js.map","/**\n * The Watch mark, inlined.\n *\n * Generated by `scripts/brand-assets.mjs` from `assets/watch-orca-master.png`.\n * Do not edit by hand: the master is the brand source of truth and this is a\n * mechanical derivation of it at 64px, which covers a 32px slot at 2x.\n *\n * @module @deepwatch/dsh-client-brand/mark\n */\n/** The orca, as a transparent PNG data URI. */\nexport const WATCH_MARK_PNG = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAF+UlEQVR42u1Za4hUZRhezbxladcfSkmpuO7sfJf5Y5EFupDRDcK0nTnf934nJNDKrCTCROyHv6JCEaWyP9mPjESQiH4EW4iYREkZhGDQRSq7kGl7cc/7zpz23M+M67qrM7s6ngc+dvYwwznP8z7v5ftOS0uGDBkyZMiQIUOGDBnGGtKmFqaQCcDnpcF3pcFPBeAnTFNnUxPPdeIUYXC1NPi9AHSlIbdgk1sw5AqNfQJoeVMSz2saL4BWSoPHfcIhaV+A4O+XAqitKckLoFkc8LOIbFqAgqGKBNzFNU1szsgrWiqA/pRRtKvJe9feYwrHN2mRo3XSEFURtwMhpJ//eJgBTW468kx5+Y5bBZDrLWnKbsEuJ+R9AagiDN19+VVxRdcJQ23C0CIBtEQaXCxtWpgr0XxmcEauRNO5xt0+8ZC8tMPlfTaxCIcvD8LaJwzC4PsC8JeAFLnCJH+9diY0utxfVPGvx9GnkHxyzf8+0M5L28YaZ3ON2wXQ6eTBz7N0QjoWwE4LFX3PF2vfJUm8reRcxTSt54C93sNyTS5XPrmKF2EvdyOCMrZ5DUEztFDebzgQMaDVCyyacAn1a7yJa/zci1DwoOgWN1LvF99VevvR7a9U3L6/Trr9e7rKPR1PY39EPixq1bavWenrkQihUMcGlsUtGttWmLfoVq7xKA/Je6tgk/Nfr3vGHQT/nHadjjXUH5NJRz8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cTIAYWaly0S6DS38CBX+FXrivL0ermASYN/hAJU+Bi8wsorbBWAFLgxHr9Phe2yWxr6WBpaxjVNakxH0DjX2xYXDHrn+ZtGXQBNG9NTYbhJWiJtmjTcKfPiRbCcCVw7nRywY9TfNBnaHXeAoBvt9eaVlisFPJwFCoH9dzbty9QhDmTeCvN/y1gV4bF2gMWVczQPdHXLlYjW5TQpV8SHWjJkyJAhQ4YMGTJkyJAhQ4YMGTIMH/8DqnZ5/XHc+csAAAAASUVORK5CYII=';\n/** The master artwork's own blue. Measured from it, never chosen. */\nexport const MASTER_BLUE = '#3160fc';\n//# sourceMappingURL=mark.js.map","/**\n * The OCR engine family, and what it is honest to claim about each one.\n *\n * The governing decision (spec §33): DeepSeek-OCR is integrated as an\n * **optional, measured engine**, not as a dependency and not as the only\n * source of text. OCR2 is the high-quality document candidate where the\n * hardware suits it; the lightweight local route stays the default because it\n * is what works on a laptop with no GPU, which is most machines.\n *\n * Two rules are structural here rather than advisory.\n *\n * **Isolation.** DeepSeek-OCR's published inference path uses\n * `trust_remote_code=True`. That code does not run inside the DSH Host or the\n * Watch Core main process — it runs in a worker with a pinned revision, so a\n * crash, an OOM or a surprise in a model repository takes down a worker\n * instead of the workspace.\n *\n * **Qualification is per workload, never a single score.** An engine that\n * scores well on clean documents can be worse than a lighter one on subtitles,\n * dark-mode UI, or mixed scripts. One global number would hide exactly the\n * cases a user cares about, so the matrix is per engine × workload × script.\n *\n * @module @deepwatch/dsh-technology/ocr\n */\n/** Every workload, for enumerating a qualification matrix. */\nexport const OCR_WORKLOADS = [\n 'ui_text', 'browser_form', 'subtitles', 'video_overlay', 'document',\n 'table', 'reading_order', 'low_resolution', 'dark_mode', 'mixed_script',\n];\n/** Every script the matrix is structured around. */\nexport const SCRIPTS = [\n 'Latin', 'Arabic', 'Han_Simplified', 'Han_Traditional', 'Japanese',\n 'Korean', 'Cyrillic', 'Devanagari', 'Thai', 'Greek', 'Hebrew', 'Mixed',\n];\n/** An untested cell: structurally present, honestly empty. */\nexport function notTested(engineId, workload, script) {\n return {\n engineId,\n workload,\n script,\n state: 'NOT_TESTED',\n metrics: {},\n limitations: [],\n measuredAt: null,\n measuredOn: null,\n };\n}\n/**\n * Whether an engine may be selected as a default for a workload.\n *\n * Only a qualified engine. An untested one may be *chosen* by a user who wants\n * it, but it never becomes what happens when nobody chose — which is the\n * mechanism by which \"we integrated OCR2\" would otherwise turn into \"OCR2 runs\n * on everything, including the cases it is bad at\".\n */\nexport function canDefault(entry) {\n return entry.state === 'QUALIFIED' || entry.state === 'QUALIFIED_WITH_LIMITATIONS';\n}\n/**\n * Choose an OCR engine.\n *\n * Deterministic filtering first, preference second — the model never picks\n * from a menu. Hardware, privacy and qualification decide what is *allowed*,\n * and only then does the quality profile choose among what is left. Every\n * exclusion is recorded, so \"why did it use the light one?\" has an answer.\n */\nexport function routeOcr(request, engines, qualification, health) {\n const excluded = [];\n const candidates = [];\n for (const engine of engines) {\n const engineHealth = health.get(engine.id);\n if (engineHealth === undefined || !engineHealth.usable) {\n excluded.push({\n engineId: engine.id,\n reason: `not usable (${engineHealth?.state ?? 'unknown'})`,\n });\n continue;\n }\n if (request.offlineOnly && !engine.privacy.worksOffline) {\n excluded.push({ engineId: engine.id, reason: 'offline-only profile' });\n continue;\n }\n if (engine.privacy.requiresEgressConsent && !request.egressConsent) {\n excluded.push({ engineId: engine.id, reason: 'egress consent not given' });\n continue;\n }\n if (engine.hardware.gpu === 'required' && !request.hasGpu) {\n excluded.push({ engineId: engine.id, reason: 'requires a GPU' });\n continue;\n }\n candidates.push(engine);\n }\n if (candidates.length === 0) {\n return {\n engineId: null,\n reason: 'No OCR engine is available under this policy and hardware.',\n excluded,\n };\n }\n /** Whether an engine is qualified for what is being asked. */\n const qualified = (engineId) => request.scripts.every(script => qualification.some(entry => entry.engineId === engineId\n && entry.workload === request.workload\n && entry.script === script\n && canDefault(entry)));\n const ranked = [...candidates].sort((a, b) => {\n // Qualified beats unqualified, always. An engine nobody measured on this\n // workload does not get chosen for it by default, however capable it is\n // elsewhere.\n const aQualified = qualified(a.id) ? 1 : 0;\n const bQualified = qualified(b.id) ? 1 : 0;\n if (aQualified !== bQualified)\n return bQualified - aQualified;\n // Then the quality profile. `fast` prefers something with no GPU need;\n // `best` prefers the heavier engine when the hardware allows it.\n const weight = (engine) => engine.hardware.gpu === 'none' ? 0 : engine.hardware.gpu === 'optional' ? 1 : 2;\n const direction = request.quality === 'fast' ? 1 : -1;\n const byWeight = (weight(a) - weight(b)) * direction;\n if (byWeight !== 0)\n return byWeight;\n return a.id.localeCompare(b.id);\n });\n const chosen = ranked[0];\n if (chosen === undefined) {\n return { engineId: null, reason: 'No OCR engine remained after filtering.', excluded };\n }\n for (const engine of ranked.slice(1)) {\n excluded.push({ engineId: engine.id, reason: 'a better-matching engine was available' });\n }\n return {\n engineId: chosen.id,\n reason: qualified(chosen.id)\n ? `qualified for ${request.workload} on ${request.scripts.join(', ')}`\n : `no engine is qualified for ${request.workload} on ${request.scripts.join(', ')}; `\n + `${chosen.displayName} was the best available and its output is unqualified`,\n excluded,\n };\n}\n// ── the shipped engine family ───────────────────────────────────────────────\n/** Shared resource limits for a local OCR engine. */\nconst LOCAL_LIMITS = { maxConcurrency: 2, timeoutMs: 120_000, maxMemoryMb: 4096 };\n/**\n * The lightweight local route.\n *\n * The default, because it runs everywhere. Not because it is the most accurate\n * — on clean documents it is not — but because a default that needs a GPU is\n * not a default.\n */\nexport const RAPID_OCR = {\n id: 'ocr.rapidocr',\n displayName: 'RapidOCR (ONNX)',\n version: '1.x',\n kind: 'engine',\n capabilities: ['document_ocr', 'visual'],\n modalities: ['image'],\n roles: ['ocr_layout'],\n runtime: 'local_library',\n protocols: [],\n endpoints: [],\n credentialReference: null,\n hardware: { gpu: 'none', minVramGb: null, minRamGb: 2, accelerators: [] },\n privacy: { egress: 'none', worksOffline: true, requiresEgressConsent: false },\n install: { method: 'package_manager', downloadBytes: null, automatic: false },\n provenance: {\n codeLicense: 'Apache-2.0',\n weightsLicense: 'Apache-2.0',\n revision: null,\n sourceUrl: 'https://github.com/RapidAI/RapidOCR',\n weightsLicenseReviewed: true,\n },\n resources: LOCAL_LIMITS,\n trust: 'built_in',\n probeMethod: 'import check',\n testMethod: 'recognize a bundled fixture image',\n};\n/** The deterministic system fallback, for scripts the ONNX route cannot read. */\nexport const TESSERACT = {\n id: 'ocr.tesseract',\n displayName: 'Tesseract',\n version: '5.x',\n kind: 'engine',\n capabilities: ['document_ocr'],\n modalities: ['image'],\n roles: ['ocr_layout'],\n runtime: 'local_process',\n protocols: [],\n endpoints: [],\n credentialReference: null,\n hardware: { gpu: 'none', minVramGb: null, minRamGb: 1, accelerators: [] },\n privacy: { egress: 'none', worksOffline: true, requiresEgressConsent: false },\n install: { method: 'package_manager', downloadBytes: null, automatic: false },\n provenance: {\n codeLicense: 'Apache-2.0',\n weightsLicense: 'Apache-2.0',\n revision: null,\n sourceUrl: 'https://github.com/tesseract-ocr/tesseract',\n weightsLicenseReviewed: true,\n },\n resources: LOCAL_LIMITS,\n trust: 'built_in',\n probeMethod: 'tesseract --version',\n testMethod: 'recognize a bundled fixture image',\n};\n/**\n * DeepSeek-OCR, the compatibility and comparison route.\n *\n * Pinned to a reviewed revision. `trust_remote_code` in its published\n * inference path is why `trust` is `isolated` and the runtime is a separate\n * process: a surprise in a model repository should cost a worker, not the\n * workspace.\n */\nexport const DEEPSEEK_OCR = {\n id: 'ocr.deepseek-ocr',\n displayName: 'DeepSeek-OCR',\n version: '1.0',\n kind: 'engine',\n capabilities: ['document_ocr', 'visual'],\n modalities: ['image'],\n roles: ['ocr_layout'],\n runtime: 'local_process',\n protocols: [],\n endpoints: [],\n credentialReference: null,\n hardware: { gpu: 'required', minVramGb: 12, minRamGb: 16, accelerators: ['cuda'] },\n privacy: { egress: 'none', worksOffline: true, requiresEgressConsent: false },\n install: { method: 'download', downloadBytes: null, automatic: false },\n provenance: {\n codeLicense: 'MIT',\n // Not asserted from the repository licence. An MIT repository does not\n // make its published weights MIT, and this stays null until a licence has\n // actually been read.\n weightsLicense: null,\n revision: '09eaf526153e7a01ed16c9dea8c96282aaea29c0',\n sourceUrl: 'https://github.com/deepseek-ai/DeepSeek-OCR',\n weightsLicenseReviewed: false,\n },\n resources: { maxConcurrency: 1, timeoutMs: 300_000, maxMemoryMb: 16_384 },\n trust: 'isolated',\n probeMethod: 'worker handshake',\n testMethod: 'recognize a bundled fixture image in the worker',\n};\n/** DeepSeek-OCR2, the high-quality document candidate. */\nexport const DEEPSEEK_OCR2 = {\n ...DEEPSEEK_OCR,\n id: 'ocr.deepseek-ocr2',\n displayName: 'DeepSeek-OCR2',\n version: '2.0',\n provenance: {\n codeLicense: 'Apache-2.0',\n weightsLicense: null,\n revision: '2f3699ebbb96fa8af32212e8c170f2cc28730fad',\n sourceUrl: 'https://github.com/deepseek-ai/DeepSeek-OCR-2',\n weightsLicenseReviewed: false,\n },\n};\n/**\n * A cloud OCR route, behind an explicit consent.\n *\n * Present as a descriptor rather than as an integration: the point of having\n * it here is that the routing rules can *refuse* it. `requiresEgressConsent`\n * and `worksOffline: false` together mean `routeOcr` excludes it under an\n * offline-only profile and under a profile where cloud perception was never\n * agreed to — which is a different consent from holding a provider API key.\n *\n * No endpoint is baked in. A deployment that wants a cloud OCR route names its\n * own, and the route it names is what appears in the receipt.\n */\nexport const CLOUD_OCR = {\n id: 'ocr.cloud',\n displayName: 'Cloud OCR (deployment-configured)',\n version: '1.0',\n kind: 'engine',\n capabilities: ['document_ocr', 'visual'],\n modalities: ['image'],\n roles: ['ocr_layout'],\n runtime: 'remote',\n protocols: ['https'],\n endpoints: [],\n credentialReference: 'dsh:connection',\n hardware: { gpu: 'none', minVramGb: null, minRamGb: 0, accelerators: [] },\n privacy: { egress: 'content', worksOffline: false, requiresEgressConsent: true },\n install: { method: 'none', downloadBytes: null, automatic: false },\n provenance: {\n codeLicense: 'proprietary',\n weightsLicense: 'proprietary',\n revision: null,\n sourceUrl: '',\n // A hosted service's terms are the deployment's to accept, and the flag\n // here is about redistributing weights — which never applies to a service\n // whose weights nobody receives.\n weightsLicenseReviewed: true,\n },\n resources: { maxConcurrency: 4, timeoutMs: 60_000, maxMemoryMb: 256 },\n trust: 'untrusted',\n probeMethod: 'endpoint reachability',\n testMethod: 'recognize a bundled fixture image over the wire',\n};\n/**\n * Build a descriptor for a third-party OCR engine.\n *\n * The custom-provider seam. A capability author supplies what they know and\n * gets a descriptor that the same routing, health and licence rules apply to —\n * which is the point: a third-party engine is subject to every gate a built-in\n * one is, and cannot opt out of any of them.\n *\n * Two fields are forced regardless of what the caller passes. `trust` is\n * `third_party`, and `install.automatic` is false. Neither is something a\n * plugin gets to decide about itself.\n */\nexport function customOcrEngine(input) {\n return {\n id: input.id,\n displayName: input.displayName,\n version: input.version,\n kind: 'engine',\n capabilities: ['document_ocr'],\n modalities: ['image'],\n roles: ['ocr_layout'],\n runtime: input.runtime,\n protocols: [],\n endpoints: input.endpoints ?? [],\n credentialReference: input.credentialReference ?? null,\n hardware: input.hardware,\n privacy: input.privacy,\n install: { method: 'none', downloadBytes: null, automatic: false },\n provenance: input.provenance,\n resources: input.resources,\n // Not the plugin's call. A third-party engine is assumed hostile however\n // it describes itself, and the trust tier is what decides whether its code\n // is allowed anywhere except a worker.\n trust: 'untrusted',\n probeMethod: input.probeMethod,\n testMethod: input.testMethod,\n };\n}\n/**\n * Whether an engine's code may run in the host process.\n *\n * Only a built-in library. Everything else — third party, and anything marked\n * `isolated` because its inference path executes code fetched from a model\n * repository — runs in a worker, and this is what a caller checks before\n * choosing how to run it.\n */\nexport function mayRunInProcess(descriptor) {\n return descriptor.trust === 'built_in' && descriptor.runtime === 'local_library';\n}\n/** The engines this build knows about. */\nexport const OCR_ENGINES = [\n RAPID_OCR, TESSERACT, DEEPSEEK_OCR, DEEPSEEK_OCR2, CLOUD_OCR,\n];\n/**\n * Whether an engine's weights may be distributed or auto-fetched.\n *\n * A release gate. The repository licence is about the code; shipping or\n * downloading weights on someone's behalf needs the weight licence to have\n * been read, and `weightsLicenseReviewed` is the record that it was.\n */\nexport function mayDistributeWeights(descriptor) {\n return descriptor.provenance.weightsLicense !== null\n && descriptor.provenance.weightsLicenseReviewed;\n}\n//# sourceMappingURL=ocr.js.map","/**\n * Whether a role can actually run, kept as four separate facts.\n *\n * This module exists because they were one. A provider row showed a green dot\n * the moment a credential was saved, and a person reasonably read that as \"the\n * product is ready\" — so they typed a prompt, and the runtime routed it to a\n * provider they had never configured, failed on a missing environment\n * variable, and left a failed turn in their session. Every step of that was a\n * consequence of one indicator standing for four different questions:\n *\n * 1. is there a credential? {@link ProviderCredentialStatus}\n * 2. does the provider answer? {@link ProviderReachability}\n * 3. is a model chosen? {@link ModelSelectionStatus}\n * 4. is a role bound and runnable? {@link RoleBindingStatus}\n *\n * A credential is the *first* of those and implies none of the others.\n * {@link roleReadiness} is the only thing in this product allowed to answer\n * \"ready\", and it requires all four to line up, plus a route that supports the\n * role and a policy state that permits the request.\n *\n * **Nothing here ever carries secret material.** Not a value, not a prefix, a\n * suffix, a length or a hash. A credential appears in these types only as a\n * *reference* — an opaque handle the Host can resolve — and as a status word.\n * `configured_unverified` is the honest state after a save: something is\n * stored, and nobody has asked the provider whether it works.\n *\n * Verification is deliberately not automatic. Saving a credential must not\n * quietly spend a request, and discovering models must be distinguishable from\n * a billable completion — so both are user actions with their own results, and\n * {@link ProviderReachability} stays `unknown` until one of them runs.\n *\n * @module @deepwatch/dsh-contracts/readiness\n */\n/**\n * The order blockers are reported in.\n *\n * Not alphabetical and not arbitrary: it is the order a person has to fix them\n * in. Telling somebody their model is unavailable when they have not chosen a\n * provider sends them to the wrong screen.\n */\nconst BLOCKER_ORDER = [\n 'no_binding',\n 'provider_unknown',\n 'credential_absent',\n 'credential_inaccessible',\n 'credential_rejected',\n 'model_unset',\n 'model_invalid',\n 'model_unavailable',\n 'provider_untested',\n 'provider_unreachable',\n 'provider_rate_limited',\n 'route_lacks_role',\n 'modality_unsupported',\n 'contract_mismatch',\n 'consent_required',\n 'policy_forbids',\n];\n/**\n * Whether a role can run, and if not, exactly what is missing.\n *\n * The single gate. A caller may not assemble \"ready\" from parts: every surface\n * that shows readiness, and both halves of preflight, ask this function, so\n * there is one definition of executable and it is testable on its own.\n *\n * @param inputs - every fact that bears on the decision.\n * @param role - the role being asked about.\n * @returns the status and the blockers, in the order they must be fixed.\n */\nexport function roleReadiness(role, inputs) {\n const found = new Set();\n const { binding, route } = inputs;\n if (binding === null) {\n found.add('no_binding');\n }\n else {\n if (route === null)\n found.add('provider_unknown');\n if (inputs.credential === 'absent')\n found.add('credential_absent');\n if (inputs.credential === 'inaccessible')\n found.add('credential_inaccessible');\n if (inputs.credential === 'rejected')\n found.add('credential_rejected');\n if (inputs.credential === 'configured_unverified')\n found.add('provider_untested');\n // A rejected credential is also what an `unauthorized` probe reports; both\n // are the same missing step for a person, so they collapse to one blocker.\n if (inputs.reachability === 'unauthorized')\n found.add('credential_rejected');\n if (inputs.reachability === 'unknown')\n found.add('provider_untested');\n if (inputs.reachability === 'unreachable')\n found.add('provider_unreachable');\n if (inputs.reachability === 'rate_limited')\n found.add('provider_rate_limited');\n if (inputs.model === 'none' || binding.model === '')\n found.add('model_unset');\n if (inputs.model === 'invalid')\n found.add('model_invalid');\n if (inputs.model === 'unavailable')\n found.add('model_unavailable');\n if (route !== null) {\n if (!route.roles.includes(role))\n found.add('route_lacks_role');\n const supported = new Set(route.modalities);\n if (!binding.modalities.every(modality => supported.has(modality))) {\n found.add('modality_unsupported');\n }\n }\n if (!inputs.contractMatches)\n found.add('contract_mismatch');\n if (!inputs.consentGranted)\n found.add('consent_required');\n if (!inputs.policyPermits)\n found.add('policy_forbids');\n }\n const blockers = BLOCKER_ORDER.filter(blocker => found.has(blocker));\n if (blockers.length === 0) {\n return { role, status: 'executable', blockers: [], primaryBlocker: null };\n }\n // `unbound` and `blocked` are different answers to \"what do I do now?\": one\n // needs a first choice, the other needs something repaired.\n const status = binding === null\n ? 'unbound'\n : blockers.every(blocker => blocker === 'provider_untested')\n ? 'bound_unverified'\n : 'blocked';\n return { role, status, blockers, primaryBlocker: blockers[0] ?? null };\n}\n/**\n * Whether a role may be described to a person as ready.\n *\n * A helper rather than a comparison at each call site, because \"ready\" is\n * exactly the word this whole module exists to stop being used loosely.\n */\nexport function isExecutable(readiness) {\n return readiness.status === 'executable';\n}\n/** What a person should be told to do about one blocker, in their words. */\nconst BLOCKER_COPY = {\n no_binding: 'Choose a provider and model for this capability.',\n provider_unknown: 'The bound provider is no longer available. Choose another.',\n credential_absent: 'Add a credential for this provider.',\n credential_inaccessible: 'The saved credential could not be read. Save it again.',\n credential_rejected: 'The provider rejected the saved credential. Update it.',\n provider_untested: 'Run the provider test before using this capability.',\n provider_unreachable: 'The provider did not answer. Check the network and try again.',\n provider_rate_limited: 'The provider rate-limited the test. Wait, then try again.',\n model_unset: 'Choose a model for this capability.',\n model_invalid: 'The chosen model is not valid for this provider. Choose another.',\n model_unavailable: 'The provider no longer offers the chosen model. Choose another.',\n route_lacks_role: 'This provider cannot serve this capability. Choose another.',\n modality_unsupported: 'This model does not support what this capability needs.',\n contract_mismatch: 'This version of DeepWatch cannot talk to that provider.',\n consent_required: 'This capability needs a consent that has not been granted.',\n policy_forbids: 'Policy on this machine forbids this request.',\n};\n/**\n * One sentence a person can act on, for the blocker that matters most.\n *\n * Deliberately free of route ids, package names and environment variables:\n * those belong in Diagnostics, and a person reading their first error should\n * be told what to do rather than what broke internally.\n */\nexport function blockerMessage(readiness) {\n const blocker = readiness.primaryBlocker;\n return blocker === null ? null : BLOCKER_COPY[blocker];\n}\n/**\n * Whether a status word may be drawn with the affordance that reads as \"good\".\n *\n * Only a proved binding earns it. `bound_unverified` deliberately does not:\n * that is the state a green dot used to claim, and claiming it is what sent a\n * prompt to an unconfigured provider.\n */\nexport function isPositiveBindingStatus(status) {\n return status === 'executable';\n}\n/**\n * The accessible label for a status, so colour is never the only signal.\n *\n * Every surface uses these words, so a screen reader and a sighted reader are\n * told the same thing, and a red or green dot is decoration on top of text\n * rather than the fact itself.\n */\nexport const BINDING_STATUS_LABEL = {\n unbound: 'Not configured',\n bound_unverified: 'Configured · not tested',\n executable: 'Ready',\n blocked: 'Blocked',\n};\n/** The accessible label for a credential status. */\nexport const CREDENTIAL_STATUS_LABEL = {\n absent: 'No credential',\n configured_unverified: 'Credential saved · not yet assigned',\n verified: 'Credential accepted',\n rejected: 'Credential rejected',\n inaccessible: 'Credential unreadable',\n};\n/** The accessible label for provider reachability. */\nexport const REACHABILITY_LABEL = {\n unknown: 'Not tested',\n reachable: 'Answered',\n unreachable: 'No answer',\n rate_limited: 'Rate limited',\n unauthorized: 'Rejected the credential',\n};\n//# sourceMappingURL=readiness.js.map","/**\n * What a person actually chose: which provider, which model, for which role.\n *\n * {@link module:@deepwatch/dsh-contracts/readiness} answers \"can this run?\"\n * from four separate facts. This module is where three of those facts are\n * *kept* — a durable document recording the decisions, so that reopening the\n * product finds the same bindings rather than an empty screen and a composer\n * pointed at somebody else's default.\n *\n * **A binding is a reference, never a credential.** The document below can be\n * read by anything: it is written to the Harness's own settings file, it rides\n * the settings RPC, it appears in Diagnostics, and it is included in a session\n * export. None of that is safe unless the rule is absolute, so it is: the only\n * credential-shaped field here is {@link RoleBindingRecord.credentialRef}, an\n * opaque handle the Host resolves against its own store. No value, no prefix,\n * no suffix, no length, no hash. {@link assertNoSecretMaterial} is the test\n * this file is held to.\n *\n * **Nothing is bound implicitly.** There is no \"default role\", no inheritance\n * from one role to another, and no provider that becomes bound because it was\n * the only one configured. A role with no entry in {@link WatchBindings.roles}\n * is unbound, and unbound means the composer refuses. That is the whole point\n * of the module: the failure it exists to prevent was a product that treated a\n * saved credential as a decision the person never made.\n *\n * @module @deepwatch/dsh-contracts/bindings\n */\n/**\n * The settings namespace this document lives in.\n *\n * A DeepWatch-owned section of the Harness's own user-settings document, which\n * is what makes the binding durable, hot-reloaded and editable by hand without\n * DeepWatch inventing a second configuration store beside the one the product\n * already has.\n */\nexport const BINDINGS_NAMESPACE = 'watch-bindings';\n/**\n * The document revision this build writes.\n *\n * Read forward, never rewritten in place: an older document is migrated on\n * read and a newer one is refused rather than silently reinterpreted, because\n * misreading a binding routes somebody's prompt somewhere they did not choose.\n */\nexport const BINDINGS_VERSION = 1;\n/**\n * The roles a person can bind to a provider, in the order setup presents them.\n *\n * These ids are `RoleId`s from `@deepwatch/dsh-technology`, spelled here rather\n * than imported because `contracts` is the package everything else depends on\n * and must not depend on anything. `tests/bindings-store.test.mjs` asserts the\n * two lists agree, so the duplication is checked rather than trusted -- one\n * role vocabulary with a gate on it, instead of two that drift.\n *\n * It is a *subset*. `verifier`, `ocr_layout`, `reranking` and\n * `speaker_diarization` are served by local engines rather than chosen from a\n * provider catalogue, so offering them here would offer a choice that is not\n * there.\n *\n * `agent_model` is first and is the only one the first conversation needs. The\n * rest are progressive: a product that demanded five bindings before the first\n * message would be a product nobody finished configuring.\n */\nexport const BINDABLE_ROLES = [\n 'agent_model', 'visual_perception', 'asr', 'audio_understanding', 'embeddings',\n];\n/** The role the first conversation needs, named once so nothing spells it twice. */\nexport const PRIMARY_ROLE = 'agent_model';\n/**\n * What each role is called on screen.\n *\n * `agent_model` is labelled **Chat**, and the difference is not cosmetic. A\n * person configuring this product is not choosing an \"agent model\" -- they are\n * choosing what answers them in the surface the Harness calls Chat, and every\n * blocked-composer message and setup step has to name the thing they are\n * looking at. The id stays `agent_model` because that is the vocabulary the\n * descriptors and the routing rules already use.\n */\nexport const ROLE_LABEL = {\n agent_model: 'Chat',\n visual_perception: 'Visual perception',\n asr: 'Speech to text',\n audio_understanding: 'Audio understanding',\n embeddings: 'Embeddings and retrieval',\n};\n/** Whether a string is a role this product binds. */\nexport function isBindableRole(value) {\n return BINDABLE_ROLES.includes(value);\n}\n/**\n * What each role is for, in a person's words.\n *\n * Here rather than in a component because the setup flow, the Role Bindings\n * screen and the blocked-composer card all name the same role, and three\n * copies of this sentence would eventually be three different sentences.\n */\nexport const ROLE_PURPOSE = {\n agent_model: 'Plans, reasons and writes. This is what answers you in a conversation.',\n visual_perception: 'Reads what is on screen or in a frame.',\n asr: 'Speech to text, with timings a citation can point at.',\n audio_understanding: 'Non-speech audio: events, tone, music.',\n embeddings: 'Search over the library and over memory.',\n};\n/** The modalities each role's work actually needs a route to support. */\nexport const ROLE_MODALITIES = {\n agent_model: ['text'],\n visual_perception: ['vision'],\n asr: ['audio'],\n audio_understanding: ['audio'],\n embeddings: ['embedding'],\n};\n/** The actors a stored document may name. */\nexport const BINDING_ACTORS = ['person', 'setup', 'unknown'];\n/** Whether a stored value is an actor this build understands. */\nexport function isBindingActor(value) {\n return typeof value === 'string' && BINDING_ACTORS.includes(value);\n}\n/** The document a profile that has never been configured has. */\nexport const EMPTY_BINDINGS = { version: BINDINGS_VERSION, roles: {} };\n/**\n * A model id worth storing.\n *\n * Deliberately permissive about shape — provider model ids are provider-owned\n * and this product does not get to decide that `openai/gpt-4o` is malformed —\n * and deliberately strict about the things that make a stored value dangerous:\n * control characters, newlines and absurd length, all of which arrive from a\n * hand-edited settings file rather than from the picker.\n */\nexport function isStorableId(value) {\n return typeof value === 'string'\n && value !== ''\n && value.length <= 200\n // eslint-disable-next-line no-control-regex -- rejecting these is the point.\n && !/[\\u0000-\\u001f\\u007f]/.test(value);\n}\n/**\n * Read a stored document, keeping only what is well-formed.\n *\n * A hand-edited settings file is a supported way to configure this product, so\n * a malformed entry must not take the whole document with it: the bad role is\n * dropped and the rest survive. Dropping is the safe direction — an unbound\n * role refuses at the composer, where a person is told what to fix, whereas a\n * half-read binding would route a prompt somewhere nobody chose.\n *\n * @param raw - whatever the settings document held.\n * @returns a document this build can act on.\n */\nexport function readBindings(raw) {\n if (typeof raw !== 'object' || raw === null)\n return EMPTY_BINDINGS;\n const record = raw;\n // A document from a future build is not merged, not guessed at, and not\n // partially honoured: the shape it uses is one this build has never seen.\n if (typeof record.version === 'number' && record.version > BINDINGS_VERSION) {\n return EMPTY_BINDINGS;\n }\n if (typeof record.roles !== 'object' || record.roles === null)\n return EMPTY_BINDINGS;\n const roles = {};\n for (const [role, value] of Object.entries(record.roles)) {\n if (!isBindableRole(role))\n continue;\n const entry = readBindingRecord(value);\n if (entry !== null)\n roles[role] = entry;\n }\n return { version: BINDINGS_VERSION, roles };\n}\n/** One entry, or null when it is not something this build can honour. */\nfunction readBindingRecord(value) {\n if (typeof value !== 'object' || value === null)\n return null;\n const entry = value;\n if (!isStorableId(entry['provider']) || !isStorableId(entry['model']))\n return null;\n const ref = entry['credentialRef'];\n // A non-string reference is read as \"no reference\" rather than refused: the\n // binding's provider and model are still the person's choice, and the Host\n // reports an unresolvable credential as a blocker they can act on.\n const credentialRef = typeof ref === 'string' && ref !== '' ? ref : null;\n const boundAt = typeof entry['boundAt'] === 'string' ? entry['boundAt'] : '';\n // Anything this build does not recognise reads as `unknown`, including the\n // absence of the field. A document from an earlier version is unattributed,\n // which is true, rather than attributed to a person who may not have written\n // it.\n const boundBy = isBindingActor(entry['boundBy']) ? entry['boundBy'] : 'unknown';\n return {\n provider: entry['provider'], model: entry['model'], credentialRef, boundAt, boundBy,\n };\n}\n/**\n * The document with one role bound, as a new value.\n *\n * Never mutates: the caller holds a snapshot it may still be rendering from,\n * and a document edited underneath a React tree is a stale-render bug that\n * shows somebody the binding they had a moment ago.\n */\nexport function withBinding(current, role, record) {\n return { version: BINDINGS_VERSION, roles: { ...current.roles, [role]: record } };\n}\n/** The document with one role unbound. */\nexport function withoutBinding(current, role) {\n const roles = Object.fromEntries(Object.entries(current.roles).filter(([key]) => key !== role));\n return { version: BINDINGS_VERSION, roles };\n}\n/**\n * The readiness-shaped view of one stored role, or null when it is unbound.\n *\n * The join between this module and `readiness`: storage keeps records, the\n * gate takes {@link RoleBinding}s, and this is the only place that converts\n * one into the other — so the modalities a role is checked against always come\n * from {@link ROLE_MODALITIES} rather than from whatever a call site guessed.\n */\nexport function bindingFor(bindings, role) {\n const record = bindings.roles[role];\n if (record === undefined)\n return null;\n return {\n role,\n provider: record.provider,\n model: record.model,\n credentialRef: record.credentialRef,\n modalities: ROLE_MODALITIES[role],\n };\n}\n/** Whether a role has a stored decision at all. Not whether it can run. */\nexport function isBound(bindings, role) {\n return bindings.roles[role] !== undefined;\n}\n/**\n * Every provider a stored binding names, once each.\n *\n * What Settings uses to decide which providers to show credential state for:\n * the ones a person actually pointed something at, rather than all\n * thirty-seven routes the catalogue carries.\n */\nexport function boundProviders(bindings) {\n const seen = new Set();\n for (const record of Object.values(bindings.roles))\n seen.add(record.provider);\n return [...seen].sort();\n}\n/**\n * Whether a provider/model pair is one this profile actually bound.\n *\n * The authoritative question, and deliberately the *narrow* one. It does not\n * ask whether the route exists, whether a credential is stored, or whether the\n * provider is reachable — those are the Host's to answer at the moment of the\n * request. It asks the only thing a stored document can answer: did somebody\n * choose this pair for something.\n *\n * That is what makes it usable as a gate at a routing boundary. A request for\n * a pair nobody bound is a request nobody authorised, whatever the client that\n * produced it believed — a stale tab holding a selection that has since been\n * changed, or a caller that set one directly and skipped the screens.\n *\n * Any bound role counts, not only the one being served: a person who bound\n * OpenRouter to Chat has authorised that route, and the title and compaction\n * calls that ride the same selection are the same authorisation, not new ones.\n *\n * @param bindings - the stored document.\n * @param provider - the route the request names.\n * @param model - the model the request names.\n * @returns whether some role in this profile is bound to exactly that pair.\n */\nexport function isRoutePermitted(bindings, provider, model) {\n if (provider === '' || model === '')\n return false;\n return Object.values(bindings.roles).some(record => record.provider === provider && record.model === model);\n}\n/**\n * Every distinct provider/model pair this profile bound, for a diagnostic.\n *\n * A refusal that says \"this route is not bound\" is not much use without the\n * ability to say what *is*, and that list is a set of choices rather than\n * anything sensitive — no credential, no reference, no host path.\n */\nexport function permittedRoutes(bindings) {\n const seen = new Set();\n for (const record of Object.values(bindings.roles)) {\n seen.add(`${record.provider}/${record.model}`);\n }\n return [...seen].sort();\n}\n/**\n * Patterns that must never appear in a stored binding.\n *\n * Not an exhaustive secret detector — there is no such thing — but a guard on\n * the shapes a credential takes when somebody pastes one into a field meant to\n * hold a reference.\n *\n * `OPENROUTER_API_KEY` is deliberately *not* one of them, and that distinction\n * is the design rather than an omission: it is a reference — the name of a\n * place the Host looks — and naming a place is exactly what `credentialRef` is\n * for. A guard that refused it would refuse every legitimate binding, be\n * switched off within a day, and stop catching what it was written for. What\n * is refused is a *value*: the shapes a key has when the key itself is pasted.\n */\nconst SECRET_SHAPES = [\n /\\bsk-[A-Za-z0-9_-]{8,}/,\n /\\bsk_live_[A-Za-z0-9]{8,}/,\n /\\bBearer\\s+[A-Za-z0-9._-]{8,}/i,\n // A long run of mixed-case token characters. A reference is a name a person\n // could read aloud; anything this long that is not one is a value somebody\n // pasted where a name belongs.\n /(?=[A-Za-z0-9+/_-]{32,})(?=[^\\n]*[a-z])(?=[^\\n]*[A-Z])(?=[^\\n]*\\d)[A-Za-z0-9+/_-]{32,}/,\n];\n/**\n * Throw when a document about to be stored or shown carries secret material.\n *\n * A programming error rather than a runtime condition: every write path builds\n * this document from a picker, so a value matching one of these means a code\n * path has started copying a credential into a place that is read back in\n * plain text. Failing loudly at the write is the only point where that is\n * still cheap to fix.\n *\n * @param where - the surface being guarded, for a message that can be acted on.\n * @param bindings - the document about to leave a trusted boundary.\n */\nexport function assertNoSecretMaterial(where, bindings) {\n for (const [role, record] of Object.entries(bindings.roles)) {\n for (const [field, value] of Object.entries(record)) {\n if (typeof value !== 'string')\n continue;\n for (const shape of SECRET_SHAPES) {\n if (!shape.test(value))\n continue;\n throw new Error(`${where}: the ${role} binding's ${field} looks like credential material. `\n + 'A binding stores a reference the Host resolves, never a value.');\n }\n }\n }\n}\n//# sourceMappingURL=bindings.js.map","/**\n * What a person is told when a conversation cannot run, and what they are not.\n *\n * A prompt failed and the Chat surface showed the reader\n * `@deepseek-ai/dsh-system-prompt`, the route id `llm-deepseek`, the provider\n * key `deepseek-official`, the environment variable `DEEPSEEK_API_KEY`, and a\n * paragraph of sandbox-policy text. Every one of those is true, and not one of\n * them told the reader what to do. Worse, two of them named a provider they had\n * never chosen, so the message actively misled: it read as *DeepWatch is a\n * DeepSeek product that is broken* rather than *nothing is bound yet*.\n *\n * This module draws the line. A raw provider or runtime failure is classified\n * into one of a small closed set of {@link FailureKind}s, each of which becomes\n * a card with a title, one sentence, and exactly one next action. The detailed\n * technical facts are not destroyed — they go to Diagnostics and the Session\n * Log, redacted — but they never render in an ordinary conversation.\n *\n * **Two rules hold everything here together.**\n *\n * The first is that a card carries no implementation identity.\n * {@link assertNoInternalDisclosure} is the executable form of that rule, and\n * it is applied to every card this module produces rather than trusted to\n * review.\n *\n * The second is that nothing here ever carries credential material — and\n * \"material\" includes the things people reach for when they are trying to be\n * helpful about a key without printing it: a prefix, a suffix, a length, a\n * fingerprint, a hash. A reader does not need to be told their key is 51\n * characters long, and an attacker reading a shared screenshot does.\n *\n * @module @deepwatch/dsh-contracts/failures\n */\n/** The card each kind renders as. */\nconst CARDS = {\n not_configured: {\n title: 'Chat model is not configured',\n detail: 'Choose a provider and a model, then assign one to Chat. Nothing is sent until you do.',\n action: 'Choose models and roles',\n target: 'role-bindings',\n },\n not_tested: {\n title: 'Chat provider has not been tested',\n detail: 'The provider and model are assigned, but no provider request has succeeded yet.',\n action: 'Run provider test',\n target: 'role-bindings',\n },\n credential_unavailable: {\n title: 'Credential is unavailable',\n detail: 'A credential is assigned to this provider, and it could not be read on this machine.',\n action: 'Review the provider credential',\n target: 'provider-credential',\n },\n credential_rejected: {\n title: 'Provider rejected the credential',\n detail: 'The provider answered and would not accept the credential saved for it.',\n action: 'Update the provider credential',\n target: 'provider-credential',\n },\n model_unavailable: {\n title: 'Model is no longer available',\n detail: 'The provider no longer offers the model assigned to this capability.',\n action: 'Choose another model',\n target: 'model-selection',\n },\n provider_unreachable: {\n title: 'Provider is temporarily unreachable',\n detail: 'No usable answer came back from the provider. Nothing was charged and no turn was recorded.',\n action: 'Try again',\n target: 'retry',\n },\n rate_limited: {\n title: 'Request was rate-limited',\n detail: 'The provider declined this request for rate reasons. Waiting and retrying usually clears it.',\n action: 'Try again',\n target: 'retry',\n },\n policy_forbids: {\n title: 'This machine’s policy blocked the request',\n detail: 'A policy in force here does not permit this request. Diagnostics records which one.',\n action: 'Open Diagnostics',\n target: 'diagnostics',\n },\n unavailable: {\n title: 'The request could not be completed',\n detail: 'Something went wrong before a reply could be produced. Diagnostics has the detail.',\n action: 'Open Diagnostics',\n target: 'diagnostics',\n },\n};\n/**\n * The card for one kind.\n *\n * @param kind - the classified failure.\n * @param hasDiagnostics - whether a redacted record was written for it.\n * @returns a card safe to render in an ordinary conversation.\n */\nexport function failureCard(kind, hasDiagnostics = true) {\n const card = CARDS[kind];\n return { kind, ...card, hasDiagnostics };\n}\n/**\n * The card a readiness blocker becomes.\n *\n * The two vocabularies are separate because they answer different questions —\n * a blocker is \"what is missing\", a card is \"what a person sees when they tried\n * anyway\" — and this is the one place they are joined, so a blocker can never\n * reach a reader with no card defined for it.\n */\nexport function cardForBlocker(blocker) {\n const kind = blocker === 'credential_inaccessible'\n ? 'credential_unavailable'\n : blocker === 'provider_untested'\n ? 'not_tested'\n : blocker === 'credential_rejected'\n ? 'credential_rejected'\n : blocker === 'provider_unreachable'\n ? 'provider_unreachable'\n : blocker === 'provider_rate_limited'\n ? 'rate_limited'\n : blocker === 'model_unavailable' || blocker === 'model_invalid'\n ? 'model_unavailable'\n : blocker === 'policy_forbids' || blocker === 'consent_required'\n ? 'policy_forbids'\n : 'not_configured';\n return failureCard(kind);\n}\n/**\n * Classify a raw failure without letting its words through.\n *\n * The input is read for *signals* — an HTTP status, a taxonomy code the\n * Harness already normalised — and the output is a kind. The raw text is\n * never returned, never embedded, and never partially quoted, because a\n * provider's message is exactly where the internal identifiers come from.\n *\n * @param signal - what the runtime managed to normalise about the failure.\n * @returns the kind a reader is told about.\n */\nexport function classifyFailure(signal) {\n const { status, code } = signal;\n if (code === 'MISSING_CREDENTIAL')\n return 'credential_unavailable';\n if (code === 'NO_ADAPTER' || code === 'MODEL_NOT_FOUND')\n return 'model_unavailable';\n if (code === 'AUTH')\n return 'credential_rejected';\n if (code === 'RATE_LIMIT')\n return 'rate_limited';\n if (status === 401 || status === 403)\n return 'credential_rejected';\n if (status === 404)\n return 'model_unavailable';\n if (status === 429)\n return 'rate_limited';\n if (status !== undefined && status >= 500)\n return 'provider_unreachable';\n return 'unavailable';\n}\n/**\n * Implementation identity that may not appear in an ordinary conversation.\n *\n * Each of these was on screen when a person's first prompt failed. They are\n * matched as *shapes* rather than as a list of literals, because the list\n * would go stale on the next baseline bump while the shapes — a scoped package\n * name, an adapter route id, a screaming-snake environment variable — do not.\n */\nconst INTERNAL_SHAPES = [\n { what: 'a scoped package name', pattern: /@(?:deepseek-ai|deepwatch|earendil-works)\\/[a-z0-9-]+/i },\n { what: 'an adapter route id', pattern: /\\bllm-[a-z0-9-]+\\b/i },\n { what: 'a provider route key', pattern: /\\b[a-z0-9]+-official\\b/i },\n { what: 'an environment variable name', pattern: /\\b[A-Z][A-Z0-9]*_(?:API_KEY|KEY|TOKEN|SECRET|BASE_URL)\\b/ },\n { what: 'a stack frame', pattern: /\\bat\\s+[\\w$.<>]+\\s+\\([^)]*:\\d+:\\d+\\)/ },\n { what: 'a module specifier', pattern: /\\b(?:node|file):[/\\\\]{2}?[^\\s\"']+/i },\n { what: 'a sandbox or approval policy identifier', pattern: /\\b(?:sandbox|approval)Policy\\b|\\bpolicy:[a-z-]+/i },\n];\n/**\n * Throw when text bound for an ordinary conversation carries an internal name.\n *\n * Applied to cards at construction rather than to the screen at review time.\n * The failure it prevents is not hypothetical: every shape above is one that\n * actually reached a reader, and the reason each got there was that some layer\n * passed a provider or runtime string through \"just this once\".\n *\n * @param where - the surface being guarded, so a failure says what to fix.\n * @param text - the candidate copy.\n */\nexport function assertNoInternalDisclosure(where, text) {\n for (const { what, pattern } of INTERNAL_SHAPES) {\n const found = pattern.exec(text);\n if (found === null)\n continue;\n throw new Error(`${where} carries ${what} (${found[0]}). Implementation identity belongs in `\n + 'Diagnostics, not in a conversation.');\n }\n}\n/**\n * Whether a card is safe to render, as a boolean rather than a throw.\n *\n * The same check for callers that are validating a table of copy rather than\n * building one value — a test over every kind, typically.\n */\nexport function isDisclosureSafe(text) {\n return !INTERNAL_SHAPES.some(shape => shape.pattern.test(text));\n}\n//# sourceMappingURL=failures.js.map","/** Truthful capability readiness shared by onboarding and Diagnostics. */\n\nimport type { ReactNode } from 'react'\nimport {\n BINDING_STATUS_LABEL, ROLE_LABEL, blockerMessage, isExecutable,\n} from '@deepwatch/dsh-contracts'\nimport type { BindableRole } from '@deepwatch/dsh-contracts'\nimport type {\n CapabilityHealthDetail, CoreHealthReport,\n} from '@deepwatch/dsh-contracts/query/wire'\nimport { StatusChip } from './components.js'\nimport type { ChipTone } from './components.js'\nimport type { RoleRow } from './binding-state.js'\n\n/** The complete UI vocabulary. No surface may invent a more flattering state. */\nexport type ReadinessStatus =\n | 'loading'\n | 'ready'\n | 'degraded'\n | 'unconfigured'\n | 'unavailable'\n | 'not_tested'\n | 'error'\n\nexport const READINESS_STATUS_LABEL: Readonly<Record<ReadinessStatus, string>> = {\n loading: 'Loading…', ready: 'Ready', degraded: 'Degraded',\n unconfigured: 'Not configured', unavailable: 'Unavailable',\n not_tested: 'Not tested', error: 'Error',\n}\n\n/** One capability definition. Runtime state is deliberately not stored here. */\nexport interface ReadinessDefinition {\n readonly name: string\n readonly detail: string\n readonly section?: string\n readonly role?: BindableRole\n readonly coreCapabilities?: readonly string[]\n readonly defaultStatus?: 'unconfigured' | 'not_tested'\n}\n\n/** One capability after live facts have been folded through the shared model. */\nexport interface ReadinessRow extends ReadinessDefinition {\n readonly status: ReadinessStatus\n readonly statusLabel: string\n readonly tone: ChipTone\n}\n\nexport const READINESS: readonly ReadinessDefinition[] = [\n {\n name: 'Watch Core',\n detail: 'The engine that mints evidence and issues verdicts. Runs as a child of this workspace.',\n section: 'watch-diagnostics',\n },\n {\n name: 'Memory', detail: 'Durable, correctable memory with provenance on every record.',\n section: 'watch-memory', coreCapabilities: ['watch.memory.recall'],\n },\n {\n name: 'Verification', detail: 'Deterministic checks against the world. Needs no model.',\n section: 'watch-verification', coreCapabilities: ['watch.verification.run'],\n },\n {\n name: 'Browser',\n detail: 'A supervised browser that acts and returns Core-owned evidence and a receipt.',\n section: 'watch-sources',\n coreCapabilities: ['watch.browser.observe', 'watch.browser.operate', 'watch.evidence.resolve'],\n },\n {\n name: 'Agent Model', role: 'agent_model',\n detail: 'Plans, reasons and writes. Any provider DSH supports — DeepSeek is one of them.',\n section: 'watch-roles',\n },\n {\n name: 'Visual Perception', role: 'visual_perception',\n detail: 'Reads what is on screen or in a frame. A local model works.', section: 'watch-roles',\n },\n {\n name: 'OCR', detail: 'Text out of images and pages. A CPU engine is available.',\n section: 'watch-engines', defaultStatus: 'not_tested',\n },\n {\n name: 'ASR', role: 'asr',\n detail: 'Speech to text, with timings a citation can point at.', section: 'watch-roles',\n },\n {\n name: 'Audio Understanding', role: 'audio_understanding',\n detail: 'Non-speech audio: events, tone, music.', section: 'watch-roles',\n },\n {\n name: 'Speaker / Diarization', detail: 'Who spoke, and when.',\n section: 'watch-roles', defaultStatus: 'unconfigured',\n },\n {\n name: 'Embeddings / Retrieval', role: 'embeddings',\n detail: 'Search over the library and over memory. Falls back to lexical matching.',\n section: 'watch-roles',\n },\n {\n name: 'Capture',\n detail: 'Screen, window, camera and microphone. Permission is asked at first use.',\n section: 'watch-sources', defaultStatus: 'unconfigured',\n },\n]\n\nexport interface ReadinessFacts {\n readonly roles?: readonly RoleRow[] | undefined\n readonly health?: CoreHealthReport | null | undefined\n readonly reading?: boolean | undefined\n}\n\nfunction toneFor(status: ReadinessStatus): ChipTone {\n if (status === 'ready') return 'active'\n if (status === 'degraded' || status === 'unavailable' || status === 'error') return 'caution'\n return 'neutral'\n}\n\nfunction coreStatus(health: CoreHealthReport | null | undefined, reading: boolean): ReadinessStatus {\n if (reading) return 'loading'\n if (health === null || health === undefined) return 'error'\n if (health.isTestOnlyMock) return 'degraded'\n if (health.blocker === 'connected') return health.phase === 'ready' ? 'ready' : 'degraded'\n if (health.blocker === 'core_missing' || health.blocker === 'bridge_surface_missing') {\n return 'unavailable'\n }\n return health.phase === 'degraded' ? 'degraded' : 'error'\n}\n\n/**\n * Core's evidence level, said in the vocabulary a surface may use.\n *\n * The interesting line is `probed`. Core separates three facts on purpose:\n * the code exists, its dependencies were found (`probed`), and a real request\n * ran here and succeeded (`machine_tested`). Only the third is *ready*.\n *\n * `probed` was drawn as **Degraded** for one release, and that was a false\n * alarm in the opposite direction to the green dot: a machine with Chromium\n * installed and a healthy memory index reported two capabilities as impaired\n * when nothing was wrong with either — they simply had not been exercised.\n * Degraded means working and hurt. Ignorance is `not_tested`, which is a\n * neutral word and the accurate one.\n */\nfunction capabilityStatus(detail: CapabilityHealthDetail | undefined): ReadinessStatus {\n if (detail === undefined) return 'not_tested'\n if (!detail.usable) return detail.status === 'unavailable' ? 'unavailable' : 'degraded'\n if (detail.status === 'machine_tested') return 'ready'\n if (detail.status === 'unavailable') return 'unavailable'\n return 'not_tested'\n}\n\nconst STATUS_PRIORITY: Readonly<Record<ReadinessStatus, number>> = {\n error: 7, unavailable: 6, degraded: 5, loading: 4,\n not_tested: 3, unconfigured: 2, ready: 1,\n}\n\n/** Of two states, the one that promises less. */\nfunction worse(left: ReadinessStatus, right: ReadinessStatus): ReadinessStatus {\n return STATUS_PRIORITY[right] > STATUS_PRIORITY[left] ? right : left\n}\n\n/** Derive every row from runtime facts. Used by both first-run and Diagnostics. */\nexport function deriveReadiness(facts: ReadinessFacts): readonly ReadinessRow[] {\n const reading = facts.reading === true\n const health = facts.health\n const details = new Map((health?.capabilityDetails ?? []).map(item => [item.capabilityId, item]))\n const roles = new Map((facts.roles ?? []).map(row => [row.role, row]))\n const core = coreStatus(health, reading)\n\n return READINESS.map((definition, index) => {\n let status: ReadinessStatus\n let detail = definition.detail\n let statusLabel: string | undefined\n\n if (index === 0) {\n status = core\n if (health !== null && health !== undefined && health.blocker !== 'connected' && health.fix !== '') {\n detail = health.fix\n }\n } else if (definition.coreCapabilities !== undefined) {\n // Core is the floor, not a separate row that happens to sit above these.\n // A capability cannot be in better shape than the engine carrying it,\n // and the case that proves it is the in-process fixture: it reports five\n // machine-tested capabilities, and without this fold a mock backend\n // renders as a working installation. Folding also means a group is only\n // as good as its weakest member — two thirds of a browser is not a\n // browser that can finish the job.\n const states = definition.coreCapabilities.map(id => capabilityStatus(details.get(id)))\n status = states.reduce(worse, core)\n const problem = definition.coreCapabilities\n .map(id => details.get(id))\n .find(item => item !== undefined && (!item.usable || item.status !== 'machine_tested'))\n if (problem !== undefined) {\n detail = problem.fixes[0] ?? (problem.missing.length === 0\n ? definition.detail\n : `Missing: ${problem.missing.join(', ')}.`)\n } else if (status !== 'ready' && health !== null && health !== undefined\n && health.fix !== '') {\n // Core could not be read, so these rows have nothing of their own to\n // report. What to do about Core is the only actionable sentence there is.\n detail = health.fix\n }\n } else if (definition.role !== undefined) {\n const role = roles.get(definition.role)\n if (role === undefined) status = 'unconfigured'\n else if (isExecutable(role.readiness)) status = 'ready'\n else if (role.readiness.status === 'bound_unverified') status = 'not_tested'\n else if (role.readiness.status === 'unbound') status = 'unconfigured'\n else status = 'error'\n if (role !== undefined) {\n statusLabel = BINDING_STATUS_LABEL[role.readiness.status]\n if (!isExecutable(role.readiness)) detail = blockerMessage(role.readiness) ?? detail\n }\n } else {\n status = definition.defaultStatus ?? 'not_tested'\n }\n\n return {\n ...definition, detail, status,\n statusLabel: statusLabel ?? READINESS_STATUS_LABEL[status], tone: toneFor(status),\n }\n })\n}\n\nexport function ReadinessList(\n { openSection, roles, health, reading }: ReadinessFacts & {\n readonly openSection?: ((id: string) => void) | undefined\n },\n): ReactNode {\n const rows = deriveReadiness({ roles, health, reading })\n return (\n <div style={{\n border: '1px solid color-mix(in srgb, var(--watch-accent) 10%, var(--dsw-alias-border-l2))',\n borderRadius: '14px', overflow: 'hidden',\n background: 'linear-gradient(145deg, color-mix(in srgb, var(--watch-accent) 3%, var(--dsw-alias-bg-layer-2)), var(--dsw-alias-bg-base))',\n boxShadow: '0 10px 28px color-mix(in srgb, black 8%, transparent)',\n }}\n >\n {rows.map((item, index) => (\n <div key={item.name} style={{\n display: 'flex', alignItems: 'flex-start', gap: '12px', padding: '12px 16px',\n borderTop: index === 0 ? 'none' : '1px solid var(--dsw-alias-border-l2)',\n }}\n >\n <div style={{ flex: 1, minWidth: 0 }}>\n <div style={{ fontSize: '13px', fontWeight: 500 }}>\n {item.role === undefined ? item.name : ROLE_LABEL[item.role]}\n </div>\n <div style={{\n fontSize: '12px', lineHeight: 1.5, marginTop: '2px',\n color: 'var(--dsw-alias-label-tertiary)',\n }}\n >\n {item.detail}\n </div>\n </div>\n <span style={{ display: 'flex', gap: '8px', alignItems: 'center', flexShrink: 0 }}>\n <StatusChip tone={item.tone}>{item.statusLabel}</StatusChip>\n {item.section === undefined || openSection === undefined ? null : (\n <button type=\"button\" onClick={() => { openSection(item.section as string) }}\n style={{\n background: 'none', border: 'none', cursor: 'pointer', fontSize: '11px',\n padding: '2px 4px', color: 'var(--dsw-alias-label-secondary)',\n textDecoration: 'underline',\n }}\n >\n Configure\n </button>\n )}\n </span>\n </div>\n ))}\n </div>\n )\n}\n","/**\n * What OCR actually measured on this machine.\n *\n * Generated by `scripts/ocr-benchmark.mjs` from a real run over a versioned\n * ground-truth corpus. Do not edit: a number typed into a component is a\n * number nobody measured.\n *\n * @module @deepwatch/dsh-client-settings/ocr-measured\n */\n\n/** One workload tier, with the numbers the run produced. */\nexport interface MeasuredWorkload {\n readonly workload: string\n readonly samples: number\n readonly cer: number\n readonly wordAccuracy: number\n readonly hallucination: number\n /** Against thresholds committed before the benchmark existed. */\n readonly passes: boolean\n}\n\n/** Whether any engine has been measured here at all. */\nexport const OCR_MEASURED = true\n\n/** The engine that was run, and where. */\nexport const OCR_ENGINE = \"rapidocr\"\nexport const OCR_DEVICE = \"cpu\"\n\n/** Per workload, because qualification is per workload and not an average. */\nexport const OCR_BY_WORKLOAD: readonly MeasuredWorkload[] = [\n {\n \"workload\": \"dark_mode\",\n \"samples\": 1,\n \"cer\": 0,\n \"wordAccuracy\": 1,\n \"hallucination\": 0,\n \"passes\": true\n },\n {\n \"workload\": \"document\",\n \"samples\": 1,\n \"cer\": 0,\n \"wordAccuracy\": 1,\n \"hallucination\": 0,\n \"passes\": true\n },\n {\n \"workload\": \"low_resolution\",\n \"samples\": 4,\n \"cer\": 0.6111,\n \"wordAccuracy\": 0.25,\n \"hallucination\": 0.25,\n \"passes\": false\n },\n {\n \"workload\": \"mixed_script\",\n \"samples\": 2,\n \"cer\": 0.75,\n \"wordAccuracy\": 0.25,\n \"hallucination\": 0,\n \"passes\": false\n },\n {\n \"workload\": \"ui_text\",\n \"samples\": 8,\n \"cer\": 0.0074,\n \"wordAccuracy\": 0.9792,\n \"hallucination\": 0,\n \"passes\": true\n },\n {\n \"workload\": \"video_overlay\",\n \"samples\": 1,\n \"cer\": 0,\n \"wordAccuracy\": 1,\n \"hallucination\": 0,\n \"passes\": true\n }\n]\n","/**\n * The Technology & Capability Center.\n *\n * Seven surfaces that answer one question each, and one rule that governs all\n * of them: **nothing here may claim a capability works.** Every status shown is\n * either read from a descriptor that says what was actually established, or\n * labelled as not established. A settings page that flatters the installation\n * is worse than no settings page, because it is the screen a person checks\n * before trusting a result.\n *\n * That is why there is no \"Ready\" anywhere that is not backed by\n * `machine_tested`, and no accuracy or speed figure at all for an engine that\n * has not run on this machine.\n *\n * @module @deepwatch/dsh-client-settings/components\n */\n\nimport type { ReactNode } from 'react'\nimport type { CoreHealthReport } from '@deepwatch/dsh-contracts/query/wire'\nimport { ATTRIBUTION, INDEPENDENCE, PRODUCT_NAME, WATCH_MARK_PNG, tokenFor } from '@deepwatch/dsh-client-brand'\nimport type { BrandTone } from '@deepwatch/dsh-client-brand'\n// The `/descriptors` subpath, not the package root: the root re-exports the\n// OCR worker, which imports `node:child_process` to supervise a real process.\n// Correct on the host, fatal in a browser bundle.\nimport { OCR_ENGINES } from '@deepwatch/dsh-technology/descriptors'\nimport { ReadinessList } from './readiness.js'\nimport type { RoleRow } from './binding-state.js'\nimport { OCR_BY_WORKLOAD, OCR_DEVICE, OCR_ENGINE, OCR_MEASURED } from '../ocr-measured.js'\nimport type { TechnologyDescriptor } from '@deepwatch/dsh-technology/descriptors'\n\n/** What a settings section is handed by DSH. */\nexport interface SectionProps {\n readonly close?: () => void\n}\n\n/* ── shared presentation ────────────────────────────────────────────────── */\n\n/**\n * The panel vocabulary every surface here shares.\n *\n * Exported because Role Bindings moved into its own file once it stopped being\n * static copy, and two settings screens with independently-invented padding is\n * how a panel starts looking like two products.\n */\nexport const T = {\n page: {\n padding: '6px 4px 30px', maxWidth: '880px',\n background: 'radial-gradient(circle at 0 0, color-mix(in srgb, var(--watch-accent) 5%, transparent), transparent 34%)',\n },\n lead: {\n fontSize: '13.5px', lineHeight: 1.65,\n color: 'var(--dsw-alias-label-secondary)', margin: '0 0 20px', maxWidth: '72ch',\n },\n card: {\n border: '1px solid color-mix(in srgb, var(--watch-accent) 9%, var(--dsw-alias-border-l2))',\n borderRadius: '14px',\n padding: '16px 18px',\n marginBottom: '12px',\n background: 'linear-gradient(145deg, color-mix(in srgb, var(--watch-accent) 3%, var(--dsw-alias-bg-layer-2)), var(--dsw-alias-bg-base))',\n boxShadow: '0 10px 28px color-mix(in srgb, black 8%, transparent)',\n },\n cardHead: {\n display: 'flex', alignItems: 'baseline', gap: '10px',\n justifyContent: 'space-between', flexWrap: 'wrap' as const,\n },\n title: { fontSize: '14px', fontWeight: 620, margin: 0, letterSpacing: '-0.01em' },\n meta: {\n display: 'grid',\n gridTemplateColumns: 'max-content 1fr',\n columnGap: '14px', rowGap: '4px',\n fontSize: '12px', marginTop: '10px',\n },\n key: { color: 'var(--dsw-alias-label-tertiary)' },\n value: { color: 'var(--dsw-alias-label-secondary)' },\n note: {\n fontSize: '12px', lineHeight: 1.55,\n color: 'var(--dsw-alias-label-tertiary)',\n borderInlineStart: '2px solid var(--watch-accent)',\n paddingInlineStart: '10px', margin: '14px 0 0',\n },\n h2: { fontSize: '11px', fontWeight: 700, letterSpacing: '0.11em', textTransform: 'uppercase' as const, color: 'var(--watch-accent)', margin: '24px 0 9px' },\n}\n\n/**\n * The tones a settings chip may use.\n *\n * `success` is deliberately not among them. Green is reserved for a VERIFIED\n * verdict, and nothing on a settings page is a verdict — a configured\n * capability reads as `active`, which is a different colour and a different\n * claim.\n */\nexport type ChipTone = Exclude<BrandTone, 'success'>\n\n/**\n * A status chip.\n *\n * The tone vocabulary is the brand's, and `success` is deliberately absent:\n * nothing in a settings page is a verification verdict, so nothing here is\n * allowed to be green. A capability that is genuinely working reads as\n * `active`, which is a different colour and a different claim.\n */\nexport function StatusChip(\n { tone, children }: { readonly tone: ChipTone, readonly children: ReactNode },\n): ReactNode {\n // `tokenFor` rather than a colour: a feature package asks for a tone and gets\n // a custom property, which is what keeps the palette from being re-invented\n // slightly differently in every panel and makes a theme change one edit.\n const colour = tokenFor(tone)\n return (\n <span style={{\n display: 'inline-flex', alignItems: 'center', gap: '5px',\n fontSize: '11px', lineHeight: 1.4, padding: '2px 8px',\n borderRadius: '999px', whiteSpace: 'nowrap',\n border: `1px solid color-mix(in srgb, ${colour} 60%, transparent)`, color: colour,\n background: `color-mix(in srgb, ${colour} 8%, transparent)`,\n }}\n >\n {children}\n </span>\n )\n}\n\n/** A local/remote label, because where the data goes is a product fact. */\nfunction Where({ local }: { readonly local: boolean }): ReactNode {\n return <StatusChip tone={local ? 'active' : 'info'}>{local ? 'Local' : 'Remote'}</StatusChip>\n}\n\nfunction Row({ label, children }: { readonly label: string, readonly children: ReactNode }): ReactNode {\n return (\n <>\n <span style={T.key}>{label}</span>\n <span style={T.value}>{children}</span>\n </>\n )\n}\n\n/**\n * The empty state every surface here needs.\n *\n * A capability that is not configured must still render something a person can\n * act on. A dead control that fails when clicked teaches people the product is\n * broken; a sentence explaining what is missing and what would fix it does not.\n */\nexport function NotConfigured(\n { what, why, fix }: { readonly what: string, readonly why: string, readonly fix: string },\n): ReactNode {\n return (\n <div style={{ ...T.card, borderStyle: 'dashed' }}>\n <div style={T.cardHead}>\n <h3 style={T.title}>{what}</h3>\n <StatusChip tone=\"neutral\">Not configured</StatusChip>\n </div>\n <p style={{ ...T.lead, margin: '8px 0 0' }}>{why}</p>\n <p style={{ ...T.note, marginTop: '10px' }}>{fix}</p>\n </div>\n )\n}\n\n\n/* ── 2. Perception Engines ──────────────────────────────────────────────── */\n\n/**\n * Lifecycle words a person can act on, and the tone each earns.\n *\n * `not_tested` is the state every engine is in on a machine where no capability\n * check has run, and it is what `untestedHealth` returns. It is deliberately\n * not styled as an error: nothing is broken, nobody has looked.\n */\nfunction lifecycleChip(state: string): ReactNode {\n const map: Record<string, { readonly tone: ChipTone, readonly text: string }> = {\n machine_tested: { tone: 'active', text: 'Machine tested' },\n ready: { tone: 'active', text: 'Ready' },\n probed: { tone: 'caution', text: 'Probed, not measured' },\n installed: { tone: 'caution', text: 'Installed, not tested' },\n discovered: { tone: 'neutral', text: 'Not tested' },\n not_tested: { tone: 'neutral', text: 'Not tested' },\n not_installed: { tone: 'neutral', text: 'Not installed' },\n installing: { tone: 'caution', text: 'Installing' },\n degraded: { tone: 'error', text: 'Degraded' },\n unavailable: { tone: 'error', text: 'Unavailable' },\n incompatible: { tone: 'error', text: 'Incompatible' },\n disabled: { tone: 'neutral', text: 'Disabled' },\n }\n const entry = map[state] ?? { tone: 'neutral' as const, text: state }\n return <StatusChip tone={entry.tone}>{entry.text}</StatusChip>\n}\n\nfunction gigabytes(bytes: number | null): string {\n if (bytes === null) return 'unknown'\n return `${(bytes / 1_000_000_000).toFixed(1)} GB`\n}\n\n/**\n * Perception Engines.\n *\n * An Engine Runtime is not a Provider Connection, and the distinction is the\n * whole point of the screen: a provider is a credential and an endpoint, an\n * engine is software that runs here. Presence on disk is not readiness, so the\n * lifecycle state is shown verbatim rather than collapsed into a tick.\n *\n * No engine shows a quality or speed number. On a machine where nothing has\n * been measured, every such number would be invented.\n */\nexport function EnginesSection(): ReactNode {\n return (\n <div style={T.page}>\n <p style={T.lead}>\n An engine runs on this machine; a provider is something you connect to.\n Presence on disk is not readiness, so each engine shows the furthest\n state actually reached. Nothing here shows an accuracy or speed figure:\n none has been measured on this hardware, and a figure that was not\n measured would be fiction.\n </p>\n <h2 style={T.h2}>OCR and layout</h2>\n {OCR_ENGINES.map((engine: TechnologyDescriptor) => (\n <div key={engine.id} style={T.card}>\n <div style={T.cardHead}>\n <h3 style={T.title}>{engine.displayName}</h3>\n <span style={{ display: 'flex', gap: '6px' }}>\n <Where local={engine.runtime !== 'remote'} />\n {lifecycleChip('not_tested')}\n </span>\n </div>\n <div style={T.meta}>\n <Row label=\"Version\">{engine.version}</Row>\n <Row label=\"Runtime\">{engine.runtime}</Row>\n <Row label=\"Hardware\">\n {engine.hardware.gpu === 'required'\n ? `GPU required${engine.hardware.minVramGb === null ? '' : `, ${String(engine.hardware.minVramGb)} GB VRAM`}`\n : engine.hardware.gpu === 'optional' ? 'GPU optional' : 'CPU only'}\n </Row>\n <Row label=\"Egress\">\n {engine.privacy.egress === 'none'\n ? 'Nothing leaves this machine'\n : engine.privacy.egress === 'metadata_only' ? 'Metadata only' : 'Sends content off this machine'}\n </Row>\n <Row label=\"Offline\">{engine.privacy.worksOffline ? 'Works offline' : 'Requires network'}</Row>\n <Row label=\"Install\">\n {engine.install.method === 'bundled' ? 'Bundled' : engine.install.method}\n {engine.install.downloadBytes === null ? '' : ` · ${gigabytes(engine.install.downloadBytes)} download`}\n </Row>\n <Row label=\"Quality\">\n {OCR_MEASURED && engine.id.includes(OCR_ENGINE)\n ? 'Measured on this machine — see the table below.'\n : 'Not measured on this machine'}\n </Row>\n <Row label=\"How it would be checked\">\n {engine.testMethod ?? engine.probeMethod ?? 'No check is defined for this engine'}\n </Row>\n </div>\n </div>\n ))}\n {OCR_MEASURED\n ? (\n <>\n <h2 style={T.h2}>{`Measured accuracy — ${OCR_ENGINE} on ${OCR_DEVICE}`}</h2>\n <div style={T.card}>\n <p style={{ ...T.lead, margin: '0 0 10px' }}>\n A real run over a versioned ground-truth corpus, scored against\n thresholds committed before the benchmark existed. Reported per\n workload rather than as one average: an engine can be entirely\n fit for reading a settings panel and entirely unfit for reading\n grey-on-grey, and a single number hides both.\n </p>\n <div style={T.meta}>\n {OCR_BY_WORKLOAD.map(row => (\n <Row key={row.workload} label={row.workload}>\n <StatusChip tone={row.passes ? 'active' : 'error'}>\n {row.passes ? 'Qualified' : 'Not qualified'}\n </StatusChip>\n {` CER ${String(row.cer)} · word accuracy ${String(row.wordAccuracy)} `}\n {`· invented words ${String(row.hallucination)} · ${String(row.samples)} sample(s)`}\n </Row>\n ))}\n </div>\n <p style={T.note}>\n Accuracy is not a GPU question and is measured here. GPU\n throughput is not, because there is no GPU on this machine —\n that remains externally unvalidated.\n </p>\n </div>\n </>\n )\n : null}\n\n <p style={T.note}>\n An install is never automatic. Where a download is required, its size,\n hardware requirement and licence are shown before anything is fetched —\n multi-gigabyte weights are not something a product should acquire\n because a page was opened.\n </p>\n </div>\n )\n}\n\n/* ── 3. Sources & Devices ───────────────────────────────────────────────── */\n\nconst SOURCES = [\n { id: 'files', name: 'Files', purpose: 'Documents and recordings you open.', local: true, permission: 'Granted per file, when you pick one' },\n { id: 'video', name: 'Video', purpose: 'Recorded footage, indexed so a citation can point at a moment.', local: true, permission: 'Granted per file' },\n { id: 'browser', name: 'Browser', purpose: 'A supervised browser that acts and reports a receipt.', local: true, permission: 'No OS permission needed' },\n { id: 'screen', name: 'Screen', purpose: 'The whole display.', local: true, permission: 'Requested at first use' },\n { id: 'window', name: 'Window', purpose: 'One application window.', local: true, permission: 'Requested at first use' },\n { id: 'camera', name: 'Camera', purpose: 'Live visual input.', local: true, permission: 'Requested at first use' },\n { id: 'microphone', name: 'Microphone', purpose: 'Live audio input.', local: true, permission: 'Requested at first use' },\n { id: 'live', name: 'Live session', purpose: 'A continuous session over one or more of the above.', local: true, permission: 'Inherits its sources' },\n]\n\n/**\n * Sources & Devices.\n *\n * Nothing here asks the operating system for anything. A permission prompt on\n * page load trains people to click Allow without reading, so a permission is\n * requested when a capability is first used and not before — which is also why\n * every row says when it would ask.\n */\nexport function SourcesSection(): ReactNode {\n return (\n <div style={T.page}>\n <p style={T.lead}>\n Opening this page requests nothing. A permission is asked for when a\n capability is first used, because a prompt on load teaches people to\n allow without reading. Every source below is local: what it captures\n stays on this machine unless a separate media-upload consent is given.\n </p>\n {SOURCES.map(source => (\n <div key={source.id} style={T.card}>\n <div style={T.cardHead}>\n <h3 style={T.title}>{source.name}</h3>\n <span style={{ display: 'flex', gap: '6px' }}>\n <Where local={source.local} />\n <StatusChip tone=\"neutral\">Not requested</StatusChip>\n </span>\n </div>\n <p style={{ ...T.lead, margin: '6px 0 0' }}>{source.purpose}</p>\n <div style={T.meta}><Row label=\"Permission\">{source.permission}</Row></div>\n </div>\n ))}\n </div>\n )\n}\n\n/* ── 4. Memory & Retrieval ──────────────────────────────────────────────── */\n\nconst MEMORY_MODES = [\n { id: 'off', name: 'Off', detail: 'Nothing is written and nothing is recalled.' },\n { id: 'session_only', name: 'Session only', detail: 'Kept for this session and never reaches a later one.' },\n { id: 'local_personal', name: 'Local Personal', detail: 'A ledger on this machine, for this profile.' },\n { id: 'workspace_shared', name: 'Workspace Shared', detail: 'Knowledge and decisions are shared; personal taste is not.' },\n]\n\n/**\n * Memory & Retrieval.\n *\n * The encryption row is the one that matters. The ledger is a plain file with\n * the profile's permissions, and saying so is the difference between a product\n * a person can calibrate their trust against and one that misleads them about\n * where their data sits.\n */\nexport function MemorySection(): ReactNode {\n return (\n <div style={T.page}>\n <p style={T.lead}>\n Memory is a product capability, not a plugin. The ledger is the\n authority and every projection — taste, index, log — is rebuilt from it,\n which is what makes Forget remove a record rather than hide it.\n </p>\n <h2 style={T.h2}>Mode</h2>\n {MEMORY_MODES.map(mode => (\n <div key={mode.id} style={T.card}>\n <div style={T.cardHead}>\n <h3 style={T.title}>{mode.name}</h3>\n {mode.id === 'local_personal'\n ? <StatusChip tone=\"active\">Selected in this profile</StatusChip>\n : <StatusChip tone=\"neutral\">Available</StatusChip>}\n </div>\n <p style={{ ...T.lead, margin: '6px 0 0' }}>{mode.detail}</p>\n </div>\n ))}\n <h2 style={T.h2}>Storage</h2>\n <div style={T.card}>\n <div style={T.meta}>\n <Row label=\"Ledger\">An append-only event log on this machine</Row>\n <Row label=\"Projections\">Rebuilt from the ledger, never edited in place</Row>\n <Row label=\"Embeddings\">\n Unbound — see Role Bindings. Retrieval falls back to lexical matching.\n </Row>\n <Row label=\"Retention\">Kept until forgotten. Forget writes a tombstone.</Row>\n <Row label=\"Encryption at rest\">\n <StatusChip tone=\"caution\">Not encrypted</StatusChip>\n </Row>\n </div>\n <p style={T.note}>\n The ledger is a plain file. It is created owner-only — no group, no\n others — on systems that enforce file permissions; Windows has no\n equivalent and the file inherits the folder it sits in. On Desktop it\n is intended to move behind the OS keychain; until that is implemented\n and tested, this page will keep saying it is not encrypted. Claiming\n otherwise would be the one thing a privacy setting must never do.\n </p>\n </div>\n </div>\n )\n}\n\n/* ── 5. Verification ────────────────────────────────────────────────────── */\n\n/**\n * Verification.\n *\n * The screen leads with the distinction the whole product rests on, because\n * this is where somebody configures how much proof they want and needs to know\n * what a verdict does and does not mean.\n */\nexport function VerificationSection(): ReactNode {\n return (\n <div style={T.page}>\n <div style={{ ...T.card, borderColor: 'var(--watch-accent)' }}>\n <h3 style={T.title}>Agent completed ≠ Verified</h3>\n <p style={{ ...T.lead, margin: '8px 0 0' }}>\n A tool returning without an error means the call finished. It does not\n mean the thing happened. Only a verification against the world\n produces a verdict, and only Watch Core produces one — no plugin, no\n client and no model can mint a verdict, by construction rather than by\n convention.\n </p>\n </div>\n <h2 style={T.h2}>Verifier</h2>\n <div style={T.card}>\n <div style={T.cardHead}>\n <h3 style={T.title}>Deterministic checks</h3>\n <span style={{ display: 'flex', gap: '6px' }}>\n <Where local />\n <StatusChip tone=\"active\">Available</StatusChip>\n </span>\n </div>\n <p style={{ ...T.lead, margin: '6px 0 0' }}>\n Reads a row, an HTTP status, a file, an exit code. Needs no model, so\n it works offline and its result does not depend on a provider.\n </p>\n </div>\n <div style={T.card}>\n <div style={T.cardHead}>\n <h3 style={T.title}>Model-assisted checks</h3>\n <StatusChip tone=\"neutral\">Verifier role not bound</StatusChip>\n </div>\n <p style={{ ...T.lead, margin: '6px 0 0' }}>\n For expectations a deterministic check cannot express. Bind the\n Verifier role to enable them; until then, expectations that need one\n return INCONCLUSIVE rather than a guess.\n </p>\n </div>\n <h2 style={T.h2}>Verdicts</h2>\n <div style={T.card}>\n <div style={T.meta}>\n <Row label=\"VERIFIED\">Checked against the world, and it held.</Row>\n <Row label=\"FAILED\">Checked, and it did not hold.</Row>\n <Row label=\"UNVERIFIED\">Not checked. Not a failure — an absence.</Row>\n <Row label=\"INCONCLUSIVE\">Checked, and the evidence did not settle it.</Row>\n </div>\n <p style={T.note}>\n Green is reserved for VERIFIED and nothing else reaches it — not a\n high confidence, not a completed turn, not five checks out of six.\n </p>\n </div>\n </div>\n )\n}\n\n/* ── 6. Diagnostics ─────────────────────────────────────────────────────── */\n\n/**\n * What the engine is doing, in one chip.\n *\n * `connected` is the only state that gets the active tone. Everything else —\n * including the mock backend, which is *working* and is still not the product\n * — reads as a problem, because on this screen it is one.\n */\nfunction CoreStateChip(\n { health, reading }: {\n readonly health?: CoreHealthReport | null | undefined\n readonly reading: boolean\n },\n): ReactNode {\n if (health === null || health === undefined) {\n return (\n <StatusChip tone=\"neutral\">\n {reading ? 'Reading…' : 'Could not be read'}\n </StatusChip>\n )\n }\n if (health.blocker === 'connected') return <StatusChip tone=\"active\">Connected</StatusChip>\n if (health.isTestOnlyMock) return <StatusChip tone=\"caution\">Test-only mock</StatusChip>\n return <StatusChip tone=\"caution\">{health.phase}</StatusChip>\n}\n\n/**\n * Diagnostics. What is actually running, and what is not.\n *\n * The capability readiness list lives here rather than in the first-run notice.\n * It needs the settings panel's width; the onboarding seat is 256 pixels wide,\n * and putting this there once already spilled two thousand pixels out of a\n * clipped sidebar column.\n */\nexport function DiagnosticsSection(\n { openSection, roles, health, reading, onRefresh }: {\n readonly openSection?: ((id: string) => void) | undefined\n /** Live role readiness, so this screen and Role Bindings agree. */\n readonly roles?: readonly RoleRow[] | undefined\n /** The engine, as the Host last read it. Null when it could not be read. */\n readonly health?: CoreHealthReport | null | undefined\n readonly reading?: boolean | undefined\n readonly onRefresh?: (() => void) | undefined\n } = {},\n): ReactNode {\n return (\n <div style={T.page}>\n <p style={T.lead}>\n What this installation actually consists of. Where a value cannot be\n read from the running system it says so, rather than showing a plausible\n default.\n </p>\n <h2 style={T.h2}>Capability readiness</h2>\n <ReadinessList openSection={openSection} roles={roles} health={health} reading={reading} />\n\n <h2 style={T.h2}>Versions</h2>\n <div style={T.card}>\n <div style={T.meta}>\n <Row label=\"DeepWatch\">0.1.0</Row>\n <Row label=\"DeepSeek Harness\">0.1.1-rc.2</Row>\n {/* Read from the engine, not from this build's own constant. The\n version beside it used to be typed in, on the screen that\n promises it does not do that. */}\n <Row label=\"Watch Core\">\n {health === null || health === undefined || health.coreVersion === null\n ? <StatusChip tone=\"neutral\">Not reported</StatusChip>\n : health.coreVersion}\n </Row>\n <Row label=\"Bridge protocol\">\n {health === null || health === undefined || health.protocolVersion === null\n ? <StatusChip tone=\"neutral\">Not reported</StatusChip>\n : `${String(health.protocolVersion)} (Core supports ${\n health.protocolMin === null ? '?' : String(health.protocolMin)\n }-${health.protocolVersion === null ? '?' : String(health.protocolVersion)})`}\n </Row>\n <Row label=\"Memory store schema\">1</Row>\n </div>\n </div>\n <h2 style={T.h2}>Health</h2>\n <div style={T.card}>\n <div style={T.meta}>\n {/* Every row below is the Host's reading of the running engine,\n fetched through `watchQuery.coreHealth` when this screen opens.\n\n It used to say \"Connected over stdio\" as a literal — on the one\n screen whose opening sentence promises it does not do that, and\n it was wrong: the Bridge was on its mock backend because the Core\n it named shipped no `bridge` surface. The interim honesty fix\n said \"not read from here\", which was true and was not a product.\n This is the channel that was missing. */}\n <Row label=\"Watch Core\">\n <span style={{ display: 'inline-flex', alignItems: 'center', gap: '8px' }}>\n <CoreStateChip health={health} reading={reading === true} />\n {onRefresh === undefined\n ? null\n : (\n <button type=\"button\" onClick={onRefresh} disabled={reading === true}\n style={{\n background: 'none', border: 'none', padding: 0,\n font: 'inherit', fontSize: '12px', cursor: 'pointer',\n color: tokenFor('info'), textDecoration: 'underline',\n }}\n >\n Re-read\n </button>\n )}\n </span>\n </Row>\n <Row label=\"Bridge transport\">\n {health === null || health === undefined\n ? <StatusChip tone=\"neutral\">Not reported</StatusChip>\n : health.isTestOnlyMock\n ? <StatusChip tone=\"caution\">Test-only mock backend</StatusChip>\n : health.transport === null\n ? <StatusChip tone=\"neutral\">Not reported</StatusChip>\n : health.transport}\n </Row>\n <Row label=\"Contract\">\n {health === null || health === undefined\n ? <StatusChip tone=\"neutral\">Not reported</StatusChip>\n : health.contractsMatch\n ? <StatusChip tone=\"active\">Matches this build</StatusChip>\n : <StatusChip tone=\"caution\">\n {health.contractDrift.length === 0\n ? 'Unverified'\n : `Drifted: ${health.contractDrift.join(', ')}`}\n </StatusChip>}\n </Row>\n <Row label=\"Capabilities\">\n {health === null || health === undefined\n ? <StatusChip tone=\"neutral\">Not reported</StatusChip>\n : `${String(health.capabilities.ready)} ready · `\n + `${String(health.capabilities.degraded)} degraded · `\n + `${String(health.capabilities.unavailable)} unavailable · `\n + `${String(health.capabilities.unknown)} unknown`}\n </Row>\n <Row label=\"Last handshake\">\n {health === null || health === undefined || health.lastHandshakeAt === null\n ? <StatusChip tone=\"neutral\">Never</StatusChip>\n : health.lastHandshakeAt}\n </Row>\n <Row label=\"Engine starts\">\n {health === null || health === undefined\n ? <StatusChip tone=\"neutral\">Not reported</StatusChip>\n : String(health.restartCount)}\n </Row>\n {health !== null && health !== undefined && health.blocker !== 'connected'\n ? (\n <Row label=\"Blocker\">\n <span>\n <StatusChip tone=\"caution\">{health.blocker}</StatusChip>\n {health.fix === '' ? null : <span style={T.note}> {health.fix}</span>}\n </span>\n </Row>\n )\n : null}\n <Row label=\"Offline\">\n <StatusChip tone=\"active\">Offline only</StatusChip>\n </Row>\n <Row label=\"Media upload consent\">\n <StatusChip tone=\"neutral\">Not given</StatusChip>\n </Row>\n </div>\n <p style={T.note}>\n Offline-only and media-upload consent are two separate settings on\n purpose. Holding a provider credential is not permission to upload a\n frame, a transcript or a screen capture, and no agent can change\n either from inside a session.\n </p>\n </div>\n </div>\n )\n}\n\n/* ── 7. About ───────────────────────────────────────────────────────────── */\n\n/**\n * About.\n *\n * This is where the foundation becomes explicit. Watch is the product and\n * DeepSeek Harness is what it is built on; both statements belong on the same\n * screen, and the independence disclosure belongs beside them so the\n * attribution cannot be read as an endorsement.\n */\nexport function AboutSection(): ReactNode {\n return (\n <div style={T.page}>\n <div style={{ display: 'flex', alignItems: 'center', gap: '14px', marginBottom: '4px' }}>\n {/* The mark carries the name here, because the heading beside it is the\n same words — announcing them twice helps nobody. */}\n <img src={WATCH_MARK_PNG} width={44} height={44} alt=\"\" aria-hidden=\"true\"\n style={{ width: '44px', height: '44px', objectFit: 'contain', flexShrink: 0 }}\n />\n <div>\n <h3 style={{ ...T.title, fontSize: '19px' }}>{PRODUCT_NAME}</h3>\n <p style={{ ...T.lead, margin: '2px 0 0' }}>\n An agent that sees, remembers, and can prove what actually happened.\n </p>\n </div>\n </div>\n <div style={T.card}>\n <div style={T.meta}>\n <Row label=\"DeepWatch\">0.1.0</Row>\n {/* The version the Bridge negotiates, not one this screen can read;\n a build number typed into a component is a claim about somebody\n else's machine. */}\n <Row label=\"Watch Core\">Reported by the Bridge, not read from here</Row>\n <Row label=\"Built on\">DeepSeek Harness 0.1.1-rc.2</Row>\n <Row label=\"DSH commit\">b150a551b8d465e31e418e1b2eaf5e79bbb7d28e</Row>\n </div>\n </div>\n <div style={{ ...T.card, borderColor: 'var(--watch-accent)' }}>\n <p style={{ margin: 0, fontSize: '13px', lineHeight: 1.6 }}>{ATTRIBUTION}</p>\n <p style={{ margin: '8px 0 0', fontSize: '13px', lineHeight: 1.6, color: 'var(--dsw-alias-label-secondary)' }}>\n {INDEPENDENCE}\n </p>\n </div>\n <h2 style={T.h2}>Licences</h2>\n <div style={T.card}>\n <div style={T.meta}>\n <Row label=\"DeepWatch\">MIT</Row>\n <Row label=\"DeepSeek Harness\">MIT, and its notice is carried unmodified</Row>\n <Row label=\"Third-party notices\">THIRD_PARTY_NOTICES.md, shipped with this distribution</Row>\n <Row label=\"Model weights\">\n Distributed with none. A code licence is not a weights licence.\n </Row>\n </div>\n </div>\n </div>\n )\n}\n","/**\n * DeepWatch's first-run product surface.\n *\n * The settings.onboarding slot renders from a narrow sidebar seat, so this\n * component owns a real modal. DSH's Modal keeps the focus, Escape and mask\n * behavior; this component only owns the product layout inside it.\n *\n * Both counts come from the same normalized runtime snapshot as Diagnostics.\n * Nothing is shown ready while it loads, and a saved credential is not a\n * successful provider test.\n *\n * @module @deepwatch/dsh-client-settings/onboarding\n */\n\nimport type { ReactNode } from 'react'\nimport {\n Button,\n IconCheckOutline16,\n IconRightUpOutline16,\n IconSettingsOutline16,\n Modal,\n} from '@deepseek-ai/dsh-client-ui-primitives'\nimport { PRODUCT_NAME, WATCH_MARK_PNG } from '@deepwatch/dsh-client-brand'\nimport type { CoreHealthReport } from '@deepwatch/dsh-contracts/query/wire'\nimport { deriveReadiness } from './readiness.js'\nimport type { RoleRow } from './binding-state.js'\nimport css from './onboarding.module.css'\n\n/** What DSH hands an onboarding step. */\nexport interface OnboardingProps {\n readonly stepId?: string\n readonly complete?: () => void\n readonly openSection?: (id: string) => void\n readonly roles?: readonly RoleRow[]\n readonly health?: CoreHealthReport | null\n readonly reading?: boolean\n}\n\n/** A human list that stays useful at zero, one and many items. */\nfunction names(items: readonly { readonly name: string }[]): string {\n if (items.length === 0) return 'None yet'\n if (items.length <= 3) return items.map(item => item.name).join(' · ')\n return items.slice(0, 2).map(item => item.name).join(' · ')\n + ' · +' + String(items.length - 2) + ' more'\n}\n\n/** The truthful, intentional first impression of DeepWatch. */\nexport function WatchOnboarding(\n { complete, openSection, roles, health, reading }: OnboardingProps,\n): ReactNode {\n const readiness = deriveReadiness({ roles, health, reading })\n const ready = readiness.filter(item => item.status === 'ready')\n const pending = readiness.filter(item => item.status !== 'ready')\n const finish = (): void => { complete?.() }\n const go = (section: string): void => {\n openSection?.(section)\n finish()\n }\n\n return (\n <Modal\n open\n title={'Welcome to ' + PRODUCT_NAME}\n onClose={finish}\n headless\n className={css.dialog ?? ''}\n >\n <section className={css.card} aria-labelledby=\"watch-welcome-title\">\n <header className={css.hero}>\n <div className={css.identity}>\n <div className={css.markFrame} aria-hidden=\"true\">\n <img src={WATCH_MARK_PNG} width={58} height={58} alt=\"\" className={css.mark} />\n </div>\n <div className={css.titleBlock}>\n <span className={css.eyebrow}>DEEPWATCH / INTO THE KNOW</span>\n <h2 id=\"watch-welcome-title\" className={css.title}>\n See what happened.<br />\n Prove what worked.\n </h2>\n <p className={css.tagline}>See · Remember · Act · Verify</p>\n </div>\n </div>\n <p className={css.lead}>\n Your local evidence workspace is ready to begin. Connect a model\n when you want conversation; local capabilities need no provider\n and no network.\n </p>\n </header>\n\n <div className={css.statusSection}>\n <div className={css.statusHeading}>\n <span className={css.eyebrow}>INSTALLATION STATUS</span>\n <span className={css.liveLabel} aria-live=\"polite\">\n <span\n className={[css.liveDot, reading === true ? css.checkingDot : '']\n .filter(Boolean).join(' ')}\n aria-hidden=\"true\"\n />\n {reading === true ? 'Checking runtime' : 'Runtime checked'}\n </span>\n </div>\n\n <div className={css.statusGrid} role=\"group\" aria-label=\"What is ready now\">\n <article\n className={[css.metricCard, css.readyCard].filter(Boolean).join(' ')}\n data-watch-readiness=\"ready\"\n >\n <div className={css.metricTop}>\n <span className={css.metricLabel}>\n <IconCheckOutline16 size={16} />\n Ready now\n </span>\n <strong className={css.metricValue} data-watch-count>\n {reading === true ? '—' : ready.length}\n </strong>\n </div>\n <p className={css.metricCopy}>\n {reading === true\n ? 'Checking this installation. Nothing is assumed ready.'\n : names(ready) + ' passed ' + (ready.length === 1 ? 'its' : 'their')\n + ' runtime gates.'}\n </p>\n </article>\n\n <article className={css.metricCard} data-watch-readiness=\"pending\">\n <div className={css.metricTop}>\n <span className={css.metricLabel}>\n <IconSettingsOutline16 size={16} />\n Needs setup\n </span>\n <strong className={css.metricValue} data-watch-count>{pending.length}</strong>\n </div>\n <p className={css.metricCopy}>\n Configure, test or repair these when you need them. Saved is\n never presented as tested.\n </p>\n </article>\n </div>\n </div>\n\n <div className={css.consent}>\n <span className={css.consentIcon} aria-hidden=\"true\">\n <IconCheckOutline16 size={14} />\n </span>\n <div>\n <strong>Private by default</strong>\n <p>\n Connecting a model does not permit uploading frames, audio,\n transcripts or evidence. Media access is separate and stays off.\n </p>\n </div>\n </div>\n\n <footer className={css.footer}>\n <Button\n variant=\"ghost\"\n icon={<IconRightUpOutline16 size={16} />}\n onClick={() => { go('watch-diagnostics') }}\n >\n View diagnostics\n </Button>\n <div className={css.primaryActions}>\n <Button variant=\"outline\" onClick={finish}>Explore offline</Button>\n <Button variant=\"primary\" onClick={() => { go('watch-roles') }}>\n Finish setup\n </Button>\n </div>\n </footer>\n </section>\n </Modal>\n )\n}\n","/**\n * The browser's view of what is configured, assembled from four Host answers.\n *\n * A person saved an OpenRouter credential, saw a green dot and the words\n * \"Saved openrouter.\", and reasonably concluded the product was ready. It was\n * not: no model had been chosen and nothing had been assigned to anything. The\n * dot was answering \"is a credential stored?\" while the reader was asking \"can\n * I send a message?\", and those turn out to be four separate questions.\n *\n * So this store never derives readiness itself. It gathers the four facts —\n * from `llm.providers`, `llm.models`, `credentials.describe` and the stored\n * bindings in `settings.describe` — and hands them to `roleReadiness`, which\n * is the only thing in this product allowed to answer \"ready\". A surface that\n * wanted to shade a dot green would have to go through the same gate.\n *\n * **Nothing here contacts a provider.** Opening a settings page must not spend\n * somebody's money or rate budget, so reachability stays `unknown` until a\n * person asks for a check. That is why a freshly saved credential reads\n * \"Credential saved · not yet assigned\" rather than a claim about whether it\n * works: the honest state after a save is *stored*, and the product says so.\n *\n * **No value crosses this boundary.** `credentials.describe` is structurally\n * value-free — it answers `configured`, `source`, `writable` and has no slot\n * for a value — and the binding this store writes holds a reference the Host\n * resolves. There is nowhere in this file for a key to be, which is the\n * property that makes the store safe to render, log and screenshot.\n *\n * @module @deepwatch/dsh-client-settings/binding-state\n */\n\nimport {\n BINDABLE_ROLES, BINDINGS_NAMESPACE, BINDINGS_VERSION, EMPTY_BINDINGS, PRIMARY_ROLE,\n ROLE_MODALITIES, assertNoSecretMaterial, bindingFor, readBindings, roleReadiness,\n withBinding, withoutBinding,\n} from '@deepwatch/dsh-contracts'\nimport type {\n BindableRole, ProviderCredentialStatus, ProviderReachability, RoleReadiness,\n RouteCapability, WatchBindings,\n} from '@deepwatch/dsh-contracts'\n\n/**\n * Upstream's own settings section for the selection a new session starts with.\n *\n * Spelled here rather than imported: `AGENT_DEFAULT_MODEL_SETTINGS_NAMESPACE`\n * lives in a Host package, and a browser bundle that imported it would carry\n * the Harness's server-side settings machinery to learn one string.\n * `tests/binding-flow.test.mjs` holds it to the value the pinned baseline\n * composes.\n */\nexport const DEFAULT_MODEL_NAMESPACE = 'agent-default-model'\n\n/* ── the Host surface this store uses ───────────────────────────────────── */\n\n/**\n * The RPC envelope, narrowed to what a caller reads.\n *\n * Declared structurally rather than imported, which is the same choice\n * `./index.tsx` makes for the slot service. A browser bundle that imported the\n * Host's contract package for four method signatures would carry the whole\n * gateway's types to describe calls it makes by name anyway.\n */\ntype Rpc<T> = { readonly result: { ok: true, value: T } | { ok: false, error: { code: string, message: string } } }\n\n/** One namespace as the settings domain describes it. */\nexport interface NamespaceView {\n readonly ns: string\n readonly value: unknown\n readonly user?: unknown\n readonly revision: number\n}\n\n/** One provider route, as the provider directory describes it. */\nexport interface ProviderView {\n readonly provider: string\n readonly displayName: string\n readonly settingsNs: string\n readonly settingsPath: readonly string[]\n /** Whether an adapter currently serves the route. */\n readonly active: boolean\n}\n\n/** One model a provider advertised. */\nexport interface CatalogModel {\n readonly id: string\n readonly name: string\n readonly description?: string\n}\n\n/** One provider and the models it advertised. */\nexport interface ModelGroup {\n readonly id: string\n readonly name: string\n readonly models: readonly CatalogModel[]\n}\n\n/** What the Host will answer about a credential. Never a value. */\nexport interface CredentialView {\n readonly configured: boolean\n readonly source?: string\n readonly writable: boolean\n}\n\n/** The Host methods this store calls, by the names the gateway gives them. */\nexport interface HostApi {\n readonly settings: {\n describe(payload: Record<string, never>): Promise<Rpc<{\n writable: boolean\n namespaces: readonly NamespaceView[]\n }>>\n replace(payload: { ns: string, section: object, expectedRevision?: number }):\n Promise<Rpc<NamespaceView>>\n }\n readonly llm: {\n providers(payload: Record<string, never>): Promise<Rpc<{ providers: readonly ProviderView[] }>>\n models(payload: Record<string, never>): Promise<Rpc<{\n groups: readonly ModelGroup[]\n failures: readonly { id: string, message: string }[]\n }>>\n }\n readonly credentials: {\n describe(payload: { refs: string[] }): Promise<Rpc<{\n credentials: Record<string, CredentialView>\n }>>\n }\n}\n\n/**\n * The identity a provider test result belongs to.\n *\n * Provider and model alone are not enough. Rebinding a role to a route served\n * through a different credential must not inherit the previous verdict — that\n * is the same \"saved means working\" claim this whole file exists to remove,\n * wearing a route it was never asked about. So the credential *reference* is\n * part of the key.\n *\n * What it deliberately cannot see: a value rotated behind a reference that\n * did not change. No credential value crosses this boundary, so the browser\n * half has nothing to compare. A result therefore lives only as long as the\n * session that produced it, and is never persisted or restored — an untested\n * binding after a reload reads as untested, which is the truthful answer.\n */\nexport function providerTestKey(\n provider: string, model: string, credentialRef: string | null,\n): string {\n return [provider, model, credentialRef ?? ''].join('\\u0000')\n}\n\n/** Provider-neutral result of the explicit, user-triggered one-token test. */\nexport interface ProviderTestFacts {\n readonly provider: string\n readonly model: string\n readonly ok: boolean\n readonly credential: 'configured_unverified' | 'verified' | 'rejected'\n readonly reachability: Exclude<ProviderReachability, 'unknown'>\n readonly message: string\n}\n\nexport type ProviderTester = (\n provider: string, model: string, signal: AbortSignal,\n) => Promise<ProviderTestFacts>\n\n/** The Host's own verdict on one route, and why, when it is not ready. */\nexport interface RouteReadinessFacts {\n readonly proved: boolean\n readonly reason: 'proved' | 'never_tested' | 'configuration_changed' | 'unreadable'\n}\n\n/**\n * Ask the Host whether it would serve a route, without spending anything.\n *\n * Optional, because a deployment may mount this panel against a Host without\n * the read plane. Absent, the tab falls back to its own memory of the tests it\n * ran — which is what this exists to stop being the only answer, and is still\n * better than refusing to draw the screen.\n */\nexport type RouteReadinessReader = (\n provider: string, model: string, signal: AbortSignal,\n) => Promise<RouteReadinessFacts>\n\n/* ── what a surface renders from ────────────────────────────────────────── */\n\n/** One provider, with everything a setup screen needs to talk about it. */\nexport interface ProviderRow {\n readonly provider: string\n readonly displayName: string\n /** Whether an adapter serves the route right now. */\n readonly active: boolean\n /** The opaque handle the Host resolves a credential through. Never a value. */\n readonly credentialRef: string | null\n readonly credential: ProviderCredentialStatus\n /** Models the provider advertised, empty when it advertised none. */\n readonly models: readonly CatalogModel[]\n /** Why the catalogue is empty, when the provider said. */\n readonly catalogError: string | null\n}\n\n/** One role, its stored decision, and whether that decision can run. */\nexport interface RoleRow {\n readonly role: BindableRole\n readonly provider: string | null\n readonly model: string | null\n readonly readiness: RoleReadiness\n}\n\n/** Everything a binding surface reads. */\nexport interface BindingSnapshot {\n readonly status: 'idle' | 'loading' | 'ready' | 'error'\n /** A message for the reader when the Host could not be asked. */\n readonly error: string | null\n /** False when the settings document cannot be written here. */\n readonly writable: boolean\n readonly providers: readonly ProviderRow[]\n readonly roles: readonly RoleRow[]\n /** The stored document, for a surface that needs the raw decision. */\n readonly bindings: WatchBindings\n /** True while a write is in flight, so a form can disable itself. */\n readonly saving: boolean\n readonly testingRole: BindableRole | null\n readonly testMessage: string | null\n}\n\nconst EMPTY: BindingSnapshot = {\n status: 'idle',\n error: null,\n writable: false,\n providers: [],\n roles: [],\n bindings: EMPTY_BINDINGS,\n saving: false,\n testingRole: null,\n testMessage: null,\n}\n\n/* ── deriving the four facts ────────────────────────────────────────────── */\n\n/**\n * The credential reference a provider's own settings section names.\n *\n * Walked out of the described value rather than asked for separately: the\n * settings domain already returns each namespace's resolved value, and\n * `apiKeyEnv` is a field in it. The walk is plain property access because the\n * described value is plain JSON — the secret slots have already been removed\n * by the seam, which is what makes reading this safe.\n */\nexport function credentialRefOf(\n view: NamespaceView | undefined, path: readonly string[],\n): string | null {\n if (view === undefined) return null\n let cursor: unknown = view.value\n for (const step of path) {\n if (typeof cursor !== 'object' || cursor === null) return null\n cursor = (cursor as Record<string, unknown>)[step]\n }\n if (typeof cursor !== 'object' || cursor === null) return null\n const ref = (cursor as Record<string, unknown>)['apiKeyEnv']\n return typeof ref === 'string' && ref !== '' ? ref : null\n}\n\n/**\n * What is known about a provider's credential.\n *\n * `configured_unverified` rather than `verified` is the whole point. The Host\n * can say a value resolves; only a provider can say it works, and nothing here\n * has asked one. Calling a stored credential verified is the claim that sent a\n * prompt to a provider nobody had configured.\n */\nexport function credentialStatusOf(\n ref: string | null, described: Record<string, CredentialView>, readable: boolean,\n): ProviderCredentialStatus {\n if (ref === null) return 'absent'\n // A store that could not be read is a fault to report, not an empty slot to\n // fill: telling somebody to add a credential they already added is how a\n // person ends up entering a key three times.\n if (!readable) return 'inaccessible'\n return described[ref]?.configured === true ? 'configured_unverified' : 'absent'\n}\n\n/** The route capability a provider row amounts to. */\nfunction routeOf(row: ProviderRow | undefined, role: BindableRole): RouteCapability | null {\n if (row === undefined || !row.active) return null\n return {\n provider: row.provider,\n // Every bindable role, because DSH's directory describes routes rather\n // than roles: a chat-completions endpoint is not annotated with which of\n // this product's capabilities it could serve. Narrowing it here would\n // invent a restriction the provider never stated.\n roles: [...BINDABLE_ROLES],\n modalities: ROLE_MODALITIES[role],\n // Null, not empty, when the provider advertised nothing: \"nobody asked\" and\n // \"the provider offers no models\" are different, and only the second one\n // should make a stored model read as unavailable.\n models: row.models.length === 0 ? null : row.models.map(model => model.id),\n }\n}\n\n/** Everything known about one role, folded through the single readiness gate. */\nexport function roleRowOf(\n role: BindableRole, bindings: WatchBindings, providers: readonly ProviderRow[],\n tests: ReadonlyMap<string, ProviderTestFacts> = new Map(),\n): RoleRow {\n const binding = bindingFor(bindings, role)\n const row = binding === null\n ? undefined\n : providers.find(entry => entry.provider === binding.provider)\n const route = routeOf(row, role)\n const known = route?.models ?? null\n const tested = binding === null\n ? undefined\n : tests.get(providerTestKey(binding.provider, binding.model, row?.credentialRef ?? null))\n const readiness = roleReadiness(role, {\n binding,\n credential: tested?.credential ?? row?.credential ?? 'absent',\n // Never probed from a settings page. A person asks for a check; opening a\n // screen is not asking.\n reachability: tested?.reachability ?? 'unknown',\n model: binding === null\n ? 'none'\n : known === null || known.includes(binding.model) ? 'selected' : 'unavailable',\n route,\n consentGranted: true,\n policyPermits: true,\n contractMatches: true,\n })\n return {\n role,\n provider: binding?.provider ?? null,\n model: binding?.model ?? null,\n readiness,\n }\n}\n\n/* ── the store ──────────────────────────────────────────────────────────── */\n\n/**\n * The binding store, shaped for `useSyncExternalStore`.\n *\n * Deliberately a plain object with `subscribe`/`getSnapshot` rather than a\n * framework store: this package's browser half is loaded into somebody else's\n * React tree, and bringing a state library into a plugin bundle to hold six\n * fields is how a distribution ends up shipping two of them.\n */\nexport class BindingStore {\n private snapshot: BindingSnapshot = EMPTY\n private readonly listeners = new Set<() => void>()\n /** Guards against a slow load landing after a newer one. */\n private generation = 0\n private revision: number | undefined\n private defaultRevision: number | undefined\n private readonly providerTests = new Map<string, ProviderTestFacts>()\n private providerTestAbort: AbortController | null = null\n\n constructor(\n private readonly api: HostApi,\n private readonly providerTester?: ProviderTester,\n private readonly readinessReader?: RouteReadinessReader,\n ) {}\n\n /**\n * Replace what this tab believes about tested routes with what the Host says.\n *\n * The browser used to be the only place a provider-test verdict lived, and a\n * tab cannot see a Host restart, an edit made in another tab, or a key\n * rotated behind a reference that did not change. It drew a tested badge over\n * routes the Host had already stopped being willing to serve, and the\n * composer that badge unlocks opened onto a refusal.\n *\n * So the Host is asked, per bound route, and its answer wins in both\n * directions: a route it still proves is tested even in a tab that has just\n * been reloaded and ran no test, and a route it no longer proves stops being\n * tested here the moment this is read.\n */\n private async reconcileReadiness(\n bindings: WatchBindings, providers: readonly ProviderRow[], signal: AbortSignal,\n ): Promise<void> {\n if (this.readinessReader === undefined) return\n for (const role of BINDABLE_ROLES) {\n const binding = bindingFor(bindings, role)\n if (binding === null) continue\n const credentialRef = providers\n .find(entry => entry.provider === binding.provider)?.credentialRef ?? null\n const key = providerTestKey(binding.provider, binding.model, credentialRef)\n let verdict: RouteReadinessFacts\n try {\n verdict = await this.readinessReader(binding.provider, binding.model, signal)\n } catch {\n // A read that failed says nothing about the route, and inventing\n // either answer would be the defect. The tab keeps what it has.\n continue\n }\n if (signal.aborted) return\n if (verdict.proved) {\n this.providerTests.set(key, {\n provider: binding.provider,\n model: binding.model,\n ok: true,\n credential: 'verified',\n reachability: 'reachable',\n // Deliberately not \"the provider test succeeded\": this tab did not\n // run one. What is true is that the Host still holds the proof.\n message: 'The Host still holds a proof for this route.',\n })\n } else {\n this.providerTests.delete(key)\n }\n }\n }\n\n /** @returns the current snapshot; stable between changes. */\n getSnapshot = (): BindingSnapshot => this.snapshot\n\n /** @param listener - called after every change. @returns the unsubscriber. */\n subscribe = (listener: () => void): (() => void) => {\n this.listeners.add(listener)\n return () => { this.listeners.delete(listener) }\n }\n\n private publish(next: Partial<BindingSnapshot>): void {\n this.snapshot = { ...this.snapshot, ...next }\n for (const listener of this.listeners) listener()\n }\n\n /**\n * Ask the Host everything, and fold it into one snapshot.\n *\n * The three reads run together because they are independent and a settings\n * page that took three round trips in series felt broken on a slow link.\n * Their failures are not equal, though: providers and settings are the page,\n * so losing either is an error, while a credential describe that fails\n * downgrades those providers to `inaccessible` and leaves the rest readable.\n */\n async load(): Promise<void> {\n const generation = ++this.generation\n this.publish({ status: 'loading', error: null })\n\n let providers: readonly ProviderView[]\n let namespaces: readonly NamespaceView[]\n let groups: readonly ModelGroup[] = []\n let failures: readonly { id: string, message: string }[] = []\n let writable = false\n try {\n const [directory, settings, catalogue] = await Promise.all([\n this.api.llm.providers({}),\n this.api.settings.describe({}),\n // A catalogue read can fail per provider without failing the page, so\n // its rejection is absorbed rather than allowed to take the load down.\n this.api.llm.models({}).catch(() => null),\n ])\n if (!directory.result.ok) throw new Error(directory.result.error.message)\n if (!settings.result.ok) throw new Error(settings.result.error.message)\n providers = directory.result.value.providers\n namespaces = settings.result.value.namespaces\n writable = settings.result.value.writable\n if (catalogue !== null && catalogue.result.ok) {\n groups = catalogue.result.value.groups\n failures = catalogue.result.value.failures\n }\n } catch (error) {\n if (generation !== this.generation) return\n this.publish({\n status: 'error',\n error: error instanceof Error ? error.message : String(error),\n })\n return\n }\n\n const byNs = new Map(namespaces.map(view => [view.ns, view]))\n const stored = byNs.get(BINDINGS_NAMESPACE)\n this.revision = stored?.revision\n const bindings = readBindings(stored?.value)\n\n const refs = new Map<string, string | null>()\n for (const entry of providers) {\n refs.set(entry.provider, credentialRefOf(byNs.get(entry.settingsNs), entry.settingsPath))\n }\n const wanted = [...new Set([...refs.values()].filter((ref): ref is string => ref !== null))]\n\n let credentials: Record<string, CredentialView> = {}\n let readable = true\n if (wanted.length > 0) {\n try {\n const answer = await this.api.credentials.describe({ refs: wanted })\n if (answer.result.ok) credentials = answer.result.value.credentials\n else readable = false\n } catch {\n readable = false\n }\n }\n if (generation !== this.generation) return\n\n const catalogByProvider = new Map(groups.map(group => [group.id, group]))\n const failureByProvider = new Map(failures.map(entry => [entry.id, entry.message]))\n const rows: ProviderRow[] = providers.map((entry) => {\n const ref = refs.get(entry.provider) ?? null\n return {\n provider: entry.provider,\n displayName: entry.displayName,\n active: entry.active,\n credentialRef: ref,\n credential: credentialStatusOf(ref, credentials, readable),\n models: catalogByProvider.get(entry.provider)?.models ?? [],\n catalogError: failureByProvider.get(entry.provider) ?? null,\n }\n })\n\n // Before the first publish, so no frame is ever drawn from this tab's own\n // memory when the Host has a different answer.\n const readiness = new AbortController()\n await this.reconcileReadiness(bindings, rows, readiness.signal)\n if (generation !== this.generation) return\n\n this.publish({\n status: 'ready',\n error: null,\n writable,\n providers: rows,\n bindings,\n roles: BINDABLE_ROLES.map(role => roleRowOf(role, bindings, rows, this.providerTests)),\n })\n\n // The binding is the authority; the Harness selection is a projection of\n // it. Reconciling on read rather than only on write means a profile bound\n // by an earlier build -- or a settings file somebody edited by hand -- is\n // repaired by being looked at, instead of staying in the state this whole\n // subsystem exists to prevent: a decision recorded, and a runtime that\n // never heard about it.\n if (writable) await this.reconcileDefaultSelection(bindings, byNs.get(DEFAULT_MODEL_NAMESPACE))\n }\n\n /**\n * Write the Harness selection only when it disagrees with the binding.\n *\n * Guarded on disagreement because this runs on every load: rewriting an\n * already-correct section would bump its revision, invalidate every other\n * open editor's `expectedRevision`, and turn a read into a source of write\n * conflicts.\n */\n private async reconcileDefaultSelection(\n bindings: WatchBindings, view: NamespaceView | undefined,\n ): Promise<void> {\n this.defaultRevision = view?.revision\n const chat = bindings.roles[PRIMARY_ROLE]\n const wanted = chat === undefined\n ? { provider: '', model: '' }\n : { provider: chat.provider, model: chat.model }\n const current = (view?.value ?? {}) as { provider?: unknown, model?: unknown }\n if (current.provider === wanted.provider && current.model === wanted.model) return\n await this.syncDefaultSelection(bindings)\n }\n\n /**\n * Bind one role to one provider and model, and persist the decision.\n *\n * `replace` rather than `update`, because unbinding has to be expressible:\n * a merge cannot remove a key, and a role that could be added but not\n * removed is a role somebody is stuck with. The whole document is rewritten\n * from the snapshot the caller is looking at, and `expectedRevision` is what\n * turns a concurrent edit into a refusal rather than a silent overwrite.\n */\n async bind(role: BindableRole, provider: string, model: string): Promise<void> {\n const row = this.snapshot.providers.find(entry => entry.provider === provider)\n await this.write(withBinding(this.snapshot.bindings, role, {\n provider,\n model,\n credentialRef: row?.credentialRef ?? null,\n boundAt: new Date().toISOString(),\n // This path is reached only from Role Bindings, where somebody chose a\n // provider and a model and pressed Save. Nothing else in the product\n // calls it, and a writer that cannot say this truthfully must leave the\n // field alone rather than claim it.\n boundBy: 'person',\n }))\n }\n\n /** Remove one role's binding. The role becomes unbound, never inherited. */\n async unbind(role: BindableRole): Promise<void> {\n await this.write(withoutBinding(this.snapshot.bindings, role))\n }\n\n /** Run the exact bound route once; saving a credential never calls this. */\n async testRole(role: BindableRole): Promise<void> {\n const binding = bindingFor(this.snapshot.bindings, role)\n if (binding === null || this.providerTester === undefined) {\n this.publish({ testMessage: 'Assign a provider and model before running the test.' })\n return\n }\n const credentialRef = this.snapshot.providers\n .find(entry => entry.provider === binding.provider)?.credentialRef ?? null\n const controller = new AbortController()\n this.providerTestAbort?.abort()\n this.providerTestAbort = controller\n this.publish({ testingRole: role, testMessage: null })\n try {\n const facts = await this.providerTester(binding.provider, binding.model, controller.signal)\n if (controller.signal.aborted) return\n this.providerTests.set(\n providerTestKey(binding.provider, binding.model, credentialRef), facts)\n this.publish({\n testingRole: null,\n testMessage: facts.message,\n roles: BINDABLE_ROLES.map(current => roleRowOf(\n current, this.snapshot.bindings, this.snapshot.providers, this.providerTests,\n )),\n })\n } catch {\n if (controller.signal.aborted) return\n this.publish({\n testingRole: null,\n testMessage: 'The provider test could not be started. Check Diagnostics and try again.',\n })\n } finally {\n if (this.providerTestAbort === controller) this.providerTestAbort = null\n }\n }\n\n /** Cancel only the explicit provider probe; no Chat turn is involved. */\n cancelProviderTest(): void {\n if (this.providerTestAbort === null) return\n this.providerTestAbort.abort()\n this.providerTestAbort = null\n this.publish({\n testingRole: null,\n testMessage: 'Provider test cancelled. This binding remains not tested.',\n })\n }\n\n /**\n * Point the Harness's own default selection at what Chat is bound to.\n *\n * The link this subsystem was missing, and the failure it caused is worth\n * stating plainly: a person added a provider, chose a model and assigned it\n * to Chat, and still could not send. Every DeepWatch surface agreed the\n * binding existed. It did — in DeepWatch's document. But the thing that\n * actually routes a prompt is the Harness's model selection, which this\n * distribution had *emptied* so that nothing would be chosen for anybody,\n * and binding Chat never filled it in. Two records of one decision, and the\n * one the runtime reads was the one nobody was writing.\n *\n * So a Chat binding writes both. `agent-default-model` is upstream's own\n * settings section, read live by `AgentDefaultModelConfig` and re-read by a\n * blank session on every look — so a session opened before the binding\n * picks it up without being told.\n *\n * Only Chat. The other roles are DeepWatch's own concepts and have no\n * upstream selection to keep in step; writing one for them would point the\n * conversation at a model chosen for something else.\n */\n private async syncDefaultSelection(next: WatchBindings): Promise<void> {\n const chat = next.roles[PRIMARY_ROLE]\n const section = chat === undefined\n // Emptied rather than removed: the row stays mounted and its schema\n // requires both keys, so \"nothing chosen\" is two empty strings -- which\n // is exactly the value a fresh profile composes.\n ? { provider: '', model: '' }\n : { provider: chat.provider, model: chat.model }\n try {\n const response = await this.api.settings.replace({\n ns: DEFAULT_MODEL_NAMESPACE,\n section,\n ...this.defaultRevision === undefined ? {} : { expectedRevision: this.defaultRevision },\n })\n if (response.result.ok) this.defaultRevision = response.result.value.revision\n else this.publish({ error: response.result.error.message })\n } catch (error) {\n this.publish({ error: error instanceof Error ? error.message : String(error) })\n }\n }\n\n private async write(next: WatchBindings): Promise<void> {\n // Before the document leaves the browser, not after somebody reports it in\n // a screenshot. Every write path builds this from a picker, so a value\n // matching a credential shape means a code path started copying one.\n assertNoSecretMaterial('the binding document', next)\n this.publish({ saving: true, error: null })\n try {\n const response = await this.api.settings.replace({\n ns: BINDINGS_NAMESPACE,\n section: { version: BINDINGS_VERSION, roles: next.roles },\n ...this.revision === undefined ? {} : { expectedRevision: this.revision },\n })\n if (!response.result.ok) {\n this.publish({ saving: false, error: response.result.error.message })\n return\n }\n this.revision = response.result.value.revision\n const bindings = readBindings(response.result.value.value)\n // After the binding is durable, never before: a default pointing at a\n // binding that failed to save would route somewhere the record does not\n // admit to.\n await this.syncDefaultSelection(bindings)\n this.publish({\n saving: false,\n bindings,\n roles: BINDABLE_ROLES.map(role => roleRowOf(\n role, bindings, this.snapshot.providers, this.providerTests,\n )),\n })\n } catch (error) {\n this.publish({\n saving: false,\n error: error instanceof Error ? error.message : String(error),\n })\n }\n }\n}\n\n/**\n * Whether the capability a conversation needs can actually run.\n *\n * The one question the composer asks, given its own name so no surface has to\n * remember which role Chat is or re-derive readiness to find out.\n */\nexport function chatReadiness(snapshot: BindingSnapshot): RoleReadiness | null {\n return snapshot.roles.find(row => row.role === PRIMARY_ROLE)?.readiness ?? null\n}\n","/**\n * What the pinned DSH provider catalogue contains.\n *\n * Generated by `scripts/gen-provider-inventory.mjs` from\n * `@earendil-works/pi-ai`. Do not edit: the catalogue is the source of\n * truth and this is a count of it.\n *\n * @module @deepwatch/dsh-client-settings/providers\n */\n\n/** Every provider route the pinned DSH ships. */\nexport const PROVIDER_COUNT = 37\n\n/** Routes you reach over a network somebody else runs. */\nexport const HOSTED_COUNT = 30\n\n/**\n * Routes where you supply the endpoint.\n *\n * This is the same mechanism a local model uses: an OpenAI-compatible\n * server on your own machine — Ollama, vLLM, LM Studio, llama.cpp — is a\n * base URL you provide, not a separate feature.\n */\nexport const SELF_HOSTED_COUNT = 7\n\n/** Whether DeepSeek is one route among many rather than the only one. */\nexport const DEEPSEEK_IS_OPTIONAL = true\n\n/** A few recognisable names, for a sentence that has to stay short. */\nexport const SAMPLE_PROVIDERS = [\"amazon-bedrock\",\"anthropic\",\"deepseek\",\"google\",\"groq\",\"mistral\",\"openai\",\"openrouter\"]\n","/**\n * Role Bindings, as a screen somebody can actually finish setup on.\n *\n * This surface used to be four rows of static copy saying \"Not bound\" and a\n * paragraph explaining that bindings were stored by DSH. Both true. Neither\n * gave anybody a way to bind anything — so a person who had saved an OpenRouter\n * credential arrived here, read that nothing was bound, and had no control to\n * change it. The screen described the product's design instead of operating it.\n *\n * What it does now is the four steps in order, because they *are* ordered and\n * pretending otherwise is what made a saved credential look like a finished\n * setup:\n *\n * 1. a provider has a credential — stored, and nothing more\n * 2. that provider advertises models — asked for, never assumed\n * 3. a model is assigned to a capability — explicitly, by a person\n * 4. the capability can run — derived, never stored\n *\n * **Nothing here is signalled by colour alone.** Every state carries the word\n * for it, and the chip is decoration on top of that word. A status conveyed by\n * a green dot is a status a screen reader does not have, and — as the incident\n * that produced this file showed — one a sighted reader misreads too.\n *\n * **Nothing is chosen implicitly.** There is no \"use my only credential\", no\n * defaulting to the first model in the list, and no provider that becomes\n * bound because it was configured. Every binding here is a button somebody\n * pressed.\n *\n * @module @deepwatch/dsh-client-settings/role-bindings\n */\n\nimport { useCallback, useEffect, useId, useMemo, useRef, useState, useSyncExternalStore } from 'react'\nimport type { ReactNode } from 'react'\nimport {\n BINDABLE_ROLES, BINDING_STATUS_LABEL, CREDENTIAL_STATUS_LABEL, PRIMARY_ROLE,\n ROLE_LABEL, ROLE_PURPOSE, blockerMessage, isExecutable,\n} from '@deepwatch/dsh-contracts'\nimport type { BindableRole, RoleReadiness } from '@deepwatch/dsh-contracts'\nimport { StatusChip, T } from './components.js'\nimport {\n DEEPSEEK_IS_OPTIONAL, HOSTED_COUNT, PROVIDER_COUNT, SAMPLE_PROVIDERS, SELF_HOSTED_COUNT,\n} from '../providers.js'\nimport type { ChipTone } from './components.js'\nimport type { BindingSnapshot, BindingStore, ProviderRow, RoleRow } from './binding-state.js'\n\n/** What the section is handed by whoever mounts it. */\nexport interface RoleBindingsProps {\n readonly store: BindingStore\n}\n\n/**\n * The tone a readiness status earns.\n *\n * `bound_unverified` is deliberately not `active`. That is precisely the state\n * a green dot used to claim, and claiming it is what sent a prompt to a\n * provider nobody had configured.\n */\nfunction toneFor(readiness: RoleReadiness): ChipTone {\n if (isExecutable(readiness)) return 'active'\n return readiness.status === 'blocked' ? 'caution' : 'neutral'\n}\n\n/** The tone a credential state earns. Stored is not working. */\nfunction credentialTone(status: string): ChipTone {\n if (status === 'verified') return 'active'\n if (status === 'rejected' || status === 'inaccessible') return 'caution'\n return 'neutral'\n}\n\nexport const CONTROL = {\n select: {\n font: 'inherit', fontSize: '13px', padding: '7px 10px', borderRadius: '10px',\n border: '1px solid color-mix(in srgb, var(--watch-accent) 12%, var(--dsw-alias-border-l2))',\n background: 'var(--dsw-alias-bg-layer-2)', color: 'var(--dsw-alias-label-primary)',\n minWidth: '180px', maxWidth: '100%',\n },\n primary: {\n font: 'inherit', fontSize: '13px', fontWeight: 600, padding: '8px 15px',\n borderRadius: '10px', cursor: 'pointer',\n border: '1px solid var(--watch-accent)',\n background: 'var(--watch-accent)', color: 'white',\n boxShadow: '0 6px 18px color-mix(in srgb, var(--watch-accent) 22%, transparent)',\n },\n quiet: {\n font: 'inherit', fontSize: '13px', padding: '8px 13px', borderRadius: '10px',\n cursor: 'pointer', border: '1px solid var(--dsw-alias-border-l2)',\n background: 'color-mix(in srgb, var(--dsw-alias-bg-layer-2) 80%, transparent)', color: 'var(--dsw-alias-label-secondary)',\n },\n field: {\n display: 'flex', flexDirection: 'column' as const, gap: '4px', minWidth: 0,\n },\n label: {\n fontSize: '11px', letterSpacing: '0.03em', textTransform: 'uppercase' as const,\n color: 'var(--dsw-alias-label-tertiary)',\n },\n // Wraps rather than scrolls: a narrow settings panel is the common case, and\n // a row of controls that overflows horizontally hides the one on the right.\n row: {\n display: 'flex', flexWrap: 'wrap' as const, gap: '10px',\n alignItems: 'flex-end', marginTop: '12px',\n },\n}\n\n/**\n * The editor for one role: pick a provider, pick one of its models, assign it.\n *\n * Two selects rather than one combined list, because the two choices fail\n * differently. A provider with no credential is a different problem from a\n * provider whose catalogue is empty, and a single flattened list would report\n * both as \"nothing to choose\".\n *\n * Exported because the blocked composer offers the same choice in place. A\n * person who is stopped from sending should be able to fix it where they are\n * standing, and offering them a *second* picker written separately is how two\n * screens end up disagreeing about what a provider offers.\n */\nexport function BindingEditor(\n { row, providers, saving, onBind, onCancel }: {\n readonly row: RoleRow\n readonly providers: readonly ProviderRow[]\n readonly saving: boolean\n readonly onBind: (provider: string, model: string) => void\n readonly onCancel: () => void\n },\n): ReactNode {\n const providerId = useId()\n const modelId = useId()\n const noticeId = useId()\n const first = useRef<HTMLSelectElement>(null)\n\n const [provider, setProvider] = useState(row.provider ?? '')\n const [model, setModel] = useState(row.model ?? '')\n\n // Focus the first control when the editor opens: a person who pressed\n // \"Choose a model\" is already looking here, and leaving focus on the button\n // they just activated means the next Tab goes backwards through the card.\n useEffect(() => { first.current?.focus() }, [])\n\n const chosen = providers.find(entry => entry.provider === provider)\n const models = chosen?.models ?? []\n\n // The chosen model is cleared when the provider changes, rather than carried\n // over. A model id from one provider is not a model id for another, and\n // keeping it produced bindings that looked complete and could not run.\n const pickProvider = (next: string): void => {\n setProvider(next)\n setModel('')\n }\n\n const notice = chosen === undefined\n ? 'Choose a provider to see the models it offers.'\n : chosen.credential === 'absent'\n ? `${chosen.displayName} has no credential yet. Add one in Models & Providers, then come back.`\n : chosen.catalogError !== null\n ? `${chosen.displayName} did not return a model list.`\n : models.length === 0\n ? `${chosen.displayName} advertised no models.`\n : `${String(models.length)} model(s) offered by ${chosen.displayName}.`\n\n return (\n <div style={CONTROL.row}>\n <span style={CONTROL.field}>\n <label htmlFor={providerId} style={CONTROL.label}>Provider</label>\n <select\n id={providerId}\n ref={first}\n style={CONTROL.select}\n value={provider}\n disabled={saving}\n aria-describedby={noticeId}\n onChange={event => { pickProvider(event.target.value) }}\n >\n <option value=\"\">Choose a provider…</option>\n {providers.map(entry => (\n <option key={entry.provider} value={entry.provider}>\n {`${entry.displayName} — ${CREDENTIAL_STATUS_LABEL[entry.credential]}`}\n </option>\n ))}\n </select>\n </span>\n\n <span style={CONTROL.field}>\n <label htmlFor={modelId} style={CONTROL.label}>Model</label>\n <select\n id={modelId}\n style={CONTROL.select}\n value={model}\n disabled={saving || models.length === 0}\n aria-describedby={noticeId}\n onChange={event => { setModel(event.target.value) }}\n >\n <option value=\"\">Choose a model…</option>\n {models.map(entry => (\n <option key={entry.id} value={entry.id}>{entry.name === '' ? entry.id : entry.name}</option>\n ))}\n </select>\n </span>\n\n <button\n type=\"button\"\n style={{ ...CONTROL.primary, opacity: provider === '' || model === '' || saving ? 0.5 : 1 }}\n disabled={provider === '' || model === '' || saving}\n onClick={() => { onBind(provider, model) }}\n >\n {saving ? 'Assigning…' : `Assign to ${ROLE_LABEL[row.role]}`}\n </button>\n <button type=\"button\" style={CONTROL.quiet} onClick={onCancel} disabled={saving}>\n Cancel\n </button>\n\n <p\n id={noticeId}\n style={{\n flexBasis: '100%', margin: '2px 0 0', fontSize: '12px', lineHeight: 1.5,\n color: 'var(--dsw-alias-label-tertiary)',\n }}\n >\n {notice}\n </p>\n </div>\n )\n}\n\n/** One role: what it is, what it is bound to, and whether that can run. */\nfunction RoleCard(\n { row, providers, snapshot, store, openEditor, editing, onEdit, onClose }: {\n readonly row: RoleRow\n readonly providers: readonly ProviderRow[]\n readonly snapshot: BindingSnapshot\n readonly store: BindingStore\n readonly openEditor: boolean\n readonly editing: BindableRole | null\n readonly onEdit: (role: BindableRole) => void\n readonly onClose: () => void\n },\n): ReactNode {\n const provider = providers.find(entry => entry.provider === row.provider)\n const blocker = blockerMessage(row.readiness)\n const ready = isExecutable(row.readiness)\n\n return (\n <div style={T.card}>\n <div style={T.cardHead}>\n <h3 style={T.title}>{ROLE_LABEL[row.role]}</h3>\n {/* The word first, the chip second. The chip repeats the word rather\n than replacing it, so nothing here is carried by colour alone. */}\n <StatusChip tone={toneFor(row.readiness)}>\n {BINDING_STATUS_LABEL[row.readiness.status]}\n </StatusChip>\n </div>\n <p style={{ ...T.lead, margin: '6px 0 0' }}>{ROLE_PURPOSE[row.role]}</p>\n\n <div style={T.meta}>\n <span style={T.key}>Provider</span>\n <span style={T.value}>{provider?.displayName ?? row.provider ?? 'Nothing assigned'}</span>\n <span style={T.key}>Model</span>\n <span style={T.value}>{row.model ?? 'Nothing assigned'}</span>\n <span style={T.key}>Status</span>\n <span style={T.value}>\n {ready\n ? `${ROLE_LABEL[row.role]} can run.`\n : blocker ?? 'Not configured.'}\n </span>\n </div>\n\n {openEditor && editing === row.role\n ? (\n <BindingEditor\n row={row}\n providers={providers}\n saving={snapshot.saving}\n onBind={(chosenProvider, chosenModel) => {\n void store.bind(row.role, chosenProvider, chosenModel).then(onClose)\n }}\n onCancel={onClose}\n />\n )\n : (\n <div style={CONTROL.row}>\n <button\n type=\"button\"\n style={CONTROL.primary}\n disabled={!snapshot.writable}\n aria-describedby={snapshot.writable ? undefined : 'watch-bindings-readonly'}\n onClick={() => { onEdit(row.role) }}\n >\n {row.model === null ? 'Choose a model' : 'Change model'}\n </button>\n {row.model === null\n ? null\n : (\n <button\n type=\"button\"\n style={CONTROL.quiet}\n disabled={(snapshot.testingRole !== null && snapshot.testingRole !== row.role) || snapshot.saving}\n onClick={() => {\n if (snapshot.testingRole === row.role) store.cancelProviderTest()\n else void store.testRole(row.role)\n }}\n >\n {snapshot.testingRole === row.role ? 'Cancel provider test' : 'Run provider test'}\n </button>\n )}\n {row.model === null\n ? null\n : (\n <button\n type=\"button\"\n style={CONTROL.quiet}\n disabled={!snapshot.writable || snapshot.saving}\n aria-describedby={snapshot.writable ? undefined : 'watch-bindings-readonly'}\n onClick={() => { void store.unbind(row.role) }}\n >\n {`Unassign ${ROLE_LABEL[row.role]}`}\n </button>\n )}\n </div>\n )}\n </div>\n )\n}\n\n/** The providers a person has actually configured, and what is known of each. */\nfunction ProviderList({ providers }: { readonly providers: readonly ProviderRow[] }): ReactNode {\n const configured = providers.filter(entry => entry.credential !== 'absent')\n if (configured.length === 0) {\n return (\n <div style={{ ...T.card, borderStyle: 'dashed' }}>\n <div style={T.cardHead}>\n <h3 style={T.title}>No provider is configured yet</h3>\n <StatusChip tone=\"neutral\">No credential</StatusChip>\n </div>\n <p style={{ ...T.lead, margin: '8px 0 0' }}>\n Add a credential in the Harness’s own Models &amp; Providers screen. A\n saved credential is the first of four steps — it stores a key and\n assigns nothing.\n </p>\n </div>\n )\n }\n return (\n <>\n {/* The catalogue, before the configured rows: a person whose only\n provider is one they half-set-up should be able to see that there are\n thirty-odd others and that none of them is required. The numbers are\n generated from the pinned catalogue, never typed. */}\n <div style={T.card}>\n <div style={T.cardHead}>\n <h3 style={T.title}>{`${String(PROVIDER_COUNT)} routes are available`}</h3>\n <StatusChip tone=\"neutral\">\n {`${String(configured.length)} configured`}\n </StatusChip>\n </div>\n <p style={{ ...T.lead, margin: '8px 0 0' }}>\n {`${String(HOSTED_COUNT)} hosted and ${String(SELF_HOSTED_COUNT)} where you supply the endpoint — `}\n {SAMPLE_PROVIDERS.join(', ')}\n {' and others. Watch adds none of these and removes none of them: the '}\n {'catalogue is the Harness’s, reached through its own Models & Providers screen.'}\n </p>\n <div style={T.meta}>\n <span style={T.key}>A local model</span>\n <span style={T.value}>\n An OpenAI-compatible server you run — Ollama, vLLM, LM Studio,\n llama.cpp — is a base URL you supply, not a separate feature.\n </span>\n <span style={T.key}>DeepSeek</span>\n <span style={T.value}>\n {DEEPSEEK_IS_OPTIONAL\n ? 'One route among many. Nothing here requires it, and nothing selects it for you.'\n : 'The only route in this catalogue.'}\n </span>\n </div>\n </div>\n {configured.map(entry => (\n <div key={entry.provider} style={T.card}>\n <div style={T.cardHead}>\n <h3 style={T.title}>{entry.displayName}</h3>\n <StatusChip tone={credentialTone(entry.credential)}>\n {CREDENTIAL_STATUS_LABEL[entry.credential]}\n </StatusChip>\n </div>\n <div style={T.meta}>\n <span style={T.key}>Route</span>\n <span style={T.value}>{entry.active ? 'Served by an adapter' : 'Not currently served'}</span>\n <span style={T.key}>Models offered</span>\n <span style={T.value}>\n {entry.catalogError !== null\n ? 'The provider did not return a list.'\n : entry.models.length === 0\n ? 'None advertised.'\n : String(entry.models.length)}\n </span>\n <span style={T.key}>Credential save</span>\n <span style={T.value}>\n Does not contact the provider. Tests are explicit and apply to\n one exact provider/model binding.\n </span>\n </div>\n </div>\n ))}\n </>\n )\n}\n\n/**\n * Role Bindings.\n *\n * @param props.store - the binding store this surface reads and writes.\n * @returns the section body.\n */\nexport function RoleBindings({ store }: RoleBindingsProps): ReactNode {\n const snapshot = useSyncExternalStore(store.subscribe, store.getSnapshot, store.getSnapshot)\n const [editing, setEditing] = useState<BindableRole | null>(null)\n\n useEffect(() => { void store.load() }, [store])\n\n const onEdit = useCallback((role: BindableRole) => { setEditing(role) }, [])\n const onClose = useCallback(() => { setEditing(null) }, [])\n\n const chat = useMemo(\n () => snapshot.roles.find(row => row.role === PRIMARY_ROLE) ?? null,\n [snapshot.roles])\n\n if (snapshot.status === 'error') {\n return (\n <div style={T.page}>\n <div style={{ ...T.card, borderStyle: 'dashed' }}>\n <div style={T.cardHead}>\n <h3 style={T.title}>Settings could not be read</h3>\n <StatusChip tone=\"caution\">Unavailable</StatusChip>\n </div>\n <p style={{ ...T.lead, margin: '8px 0 0' }}>\n The Harness did not answer. Nothing has been changed, and no\n capability has been reconfigured.\n </p>\n <div style={CONTROL.row}>\n <button type=\"button\" style={CONTROL.primary} onClick={() => { void store.load() }}>\n Try again\n </button>\n </div>\n </div>\n </div>\n )\n }\n\n return (\n <div style={T.page}>\n <p style={T.lead}>\n A capability is assigned per role, not per provider. One provider may\n serve several roles, and a role with nothing assigned says so — it never\n falls back to another role’s model, and a stored credential never\n assigns itself.\n </p>\n\n {/* Every control below is disabled when the Harness will not accept a\n settings write, and three greyed-out buttons with no reason is the\n kind of screen a person blames themselves for. The reason is stated\n once, here, and referenced by the controls it explains. */}\n {snapshot.writable\n ? null\n : (\n <div id=\"watch-bindings-readonly\" style={{ ...T.card, borderStyle: 'dashed' }}>\n <div style={T.cardHead}>\n <h3 style={T.title}>Settings are read-only</h3>\n <StatusChip tone=\"caution\">Not writable</StatusChip>\n </div>\n <p style={{ ...T.lead, margin: '8px 0 0' }}>\n This Workspace was opened against a configuration the Harness\n will not let it change, so assignments cannot be edited here.\n Nothing is wrong with the capabilities themselves — what is\n shown below is accurate and read from the running system.\n </p>\n </div>\n )}\n\n {/* The one thing a person has to finish before a conversation works, at\n the top and stated as a fact rather than a warning. It disappears the\n moment Chat can run, so a configured product is not still being told\n to configure itself. */}\n {chat !== null && !isExecutable(chat.readiness)\n ? (\n <div style={{ ...T.card, borderColor: 'var(--watch-accent)' }}>\n <div style={T.cardHead}>\n <h3 style={T.title}>Chat is not ready yet</h3>\n <StatusChip tone=\"neutral\">{BINDING_STATUS_LABEL[chat.readiness.status]}</StatusChip>\n </div>\n <p style={{ ...T.lead, margin: '8px 0 0' }}>\n {blockerMessage(chat.readiness) ?? 'Choose a provider and model for Chat.'}\n {' Until then the composer stays closed and nothing is sent.'}\n </p>\n <div style={CONTROL.row}>\n <button\n type=\"button\"\n style={CONTROL.primary}\n disabled={!snapshot.writable}\n aria-describedby={snapshot.writable ? undefined : 'watch-bindings-readonly'}\n onClick={() => { setEditing(PRIMARY_ROLE) }}\n >\n Choose models and roles\n </button>\n </div>\n </div>\n )\n : null}\n\n {/* Announced rather than only drawn: a save that changes a chip a person\n is not looking at is a save they have no way to know happened. */}\n <p\n role=\"status\"\n aria-live=\"polite\"\n style={{\n margin: '0 0 10px', fontSize: '12px',\n color: 'var(--dsw-alias-label-tertiary)',\n minHeight: '1em',\n }}\n >\n {snapshot.saving\n ? 'Saving the assignment…'\n : snapshot.testingRole !== null\n ? `Testing ${ROLE_LABEL[snapshot.testingRole]} with one bounded provider request…`\n : snapshot.testMessage !== null\n ? snapshot.testMessage\n : snapshot.error !== null\n ? snapshot.error\n : ''}\n </p>\n\n <h2 style={T.h2}>Capabilities</h2>\n {BINDABLE_ROLES.map((role) => {\n const row = snapshot.roles.find(entry => entry.role === role)\n return row === undefined\n ? null\n : (\n <RoleCard\n key={role}\n row={row}\n providers={snapshot.providers}\n snapshot={snapshot}\n store={store}\n openEditor={editing === role}\n editing={editing}\n onEdit={onEdit}\n onClose={onClose}\n />\n )\n })}\n\n <h2 style={T.h2}>Providers</h2>\n <ProviderList providers={snapshot.providers} />\n\n <p style={T.note}>\n Assignments are stored beside the Harness’s own settings, and reference\n a credential rather than holding one. Watch keeps no second credential\n store and never sees a key.\n </p>\n </div>\n )\n}\n","/**\n * The composer, closed until something is actually bound to Chat — and the\n * fastest way to bind it, offered where the person is standing.\n *\n * A person typed a message into a composer that looked ready, pressed send,\n * and the prompt was routed to a provider they had never configured. Nothing\n * about the composer had told them otherwise: the model chip named a DeepSeek\n * model they had not chosen, the send button was live, and the first thing\n * that disagreed was a failed turn.\n *\n * This is the client half of preflight. It raises the block upstream provides\n * for exactly this — *\"Composer blocks: the one way another plugin stops a\n * session's input\"* — so the textarea goes inert, the send button stops\n * accepting, and the placeholder says why in the words of whoever knows.\n *\n * **This is an affordance, and it is not the enforcement.** It lives in a\n * browser tab. The Host refuses an unbound route regardless of what any client\n * disables (`@deepwatch/dsh-technology/routing`), and the composed default\n * names no route so the Harness's own admission boundary refuses a turn before\n * one exists. The value of this layer is not that it makes refusal certain — it\n * is that a person finds out *before* typing rather than after sending.\n *\n * **The draft survives.** Blocking is one inert textarea, never a second tree:\n * the composer keeps its DOM, so whatever was typed is still there when the\n * binding is fixed. That is upstream's design and this file's reason for using\n * it rather than rendering a replacement.\n *\n * **The way out is here, not somewhere else.** The settings panel's open state\n * is component-local to `SettingsRoot`, so no plugin can navigate to a section\n * — and a button that names a screen it cannot open is worse than no button.\n * So the fix is offered inline: the same provider-and-model picker the Role\n * Bindings screen uses, writing through the same store, so the two surfaces\n * cannot disagree about what a provider offers.\n *\n * @module @deepwatch/dsh-client-settings/chat-gate\n */\n\nimport { useEffect, useState, useSyncExternalStore } from 'react'\nimport type { ReactNode } from 'react'\nimport { PRIMARY_ROLE, ROLE_LABEL, cardForBlocker, isExecutable } from '@deepwatch/dsh-contracts'\nimport { StatusChip } from './components.js'\nimport { BindingEditor, CONTROL } from './role-bindings.js'\nimport { chatReadiness } from './binding-state.js'\nimport type { BindingSnapshot, BindingStore } from './binding-state.js'\n\n/** The block registry, as `ctx.conversation.blocks` exposes it. */\nexport interface ComposerBlocks {\n set(sessionId: string, block: { readonly reason: string } | undefined): void\n}\n\n/** What the gate needs to do its job. */\nexport interface ChatGateProps {\n /** The session whose composer this gate governs. */\n readonly sessionId: string\n readonly store: BindingStore\n /**\n * The block registry, resolved when the gate renders rather than when the\n * plugin loads.\n *\n * A getter, and the reason is a bug this had. Registering the seat behind\n * `ctx.inject(['conversation'], …)` parked the registration on a service\n * that arrives with the conversation plugin, and the callback never ran --\n * so the card never drew and the composer was never blocked, silently, while\n * every other surface in this package worked. Upstream's own model-selection\n * plugin reaches the same registry with a plain `ctx.get('conversation')` at\n * the moment it needs it, which is late enough to be there and cheap enough\n * to repeat.\n */\n readonly blocks: () => ComposerBlocks | undefined\n}\n\n/**\n * The placeholder an inert composer carries.\n *\n * The blocker's own sentence, prefixed with the capability it is about. A\n * placeholder reading only \"Not configured\" leaves a person guessing which of\n * six things is missing, which is the failure the ordered blocker list exists\n * to prevent.\n */\nexport function blockReason(detail: string): string {\n return `${ROLE_LABEL[PRIMARY_ROLE]} is not ready — ${detail}`\n}\n\n/**\n * The block this snapshot calls for, or undefined when the composer may open.\n *\n * A pure function rather than a branch inside the effect, so the decision can\n * be tested as the decision. A test that re-derived the same condition beside\n * the component would agree with itself and prove nothing about what a person\n * gets.\n *\n * `idle` and `loading` deliberately produce nothing. Blocking a composer\n * because an answer has not arrived yet would make every reload look like a\n * misconfiguration — and the Host refuses an unbound route regardless, so the\n * safe direction here is to say nothing until something is known.\n *\n * @param snapshot - what the store currently knows.\n * @returns the block to raise, or undefined to lift any standing one.\n */\nexport function blockFor(snapshot: BindingSnapshot): { readonly reason: string } | undefined {\n if (snapshot.status !== 'ready') return undefined\n const chat = chatReadiness(snapshot)\n if (chat === null || isExecutable(chat) || chat.primaryBlocker === null) return undefined\n return { reason: blockReason(cardForBlocker(chat.primaryBlocker).detail) }\n}\n\n/**\n * Raise or clear this session's composer block, and offer the way out.\n *\n * @param props - see {@link ChatGateProps}.\n * @returns the setup card while Chat cannot run, and nothing once it can.\n */\nexport function ChatGate({ sessionId, store, blocks }: ChatGateProps): ReactNode {\n const snapshot = useSyncExternalStore(store.subscribe, store.getSnapshot, store.getSnapshot)\n const [open, setOpen] = useState(false)\n\n // One load per mounted gate, not one per render. The store guards against a\n // slow answer landing after a newer one, so a second session mounting while\n // the first is loading does not produce a stale snapshot.\n useEffect(() => { void store.load() }, [store])\n\n const chat = chatReadiness(snapshot)\n const ready = chat !== null && isExecutable(chat)\n const card = chat === null || chat.primaryBlocker === null\n ? null\n : cardForBlocker(chat.primaryBlocker)\n\n // The same decision function the tests assert on, so what a person gets and\n // what is asserted cannot drift apart.\n const block = blockFor(snapshot)\n useEffect(() => {\n const registry = blocks()\n if (registry === undefined) return\n registry.set(sessionId, block)\n // Clearing on unmount matters: a session whose gate is gone must not keep\n // a block nothing is left to lift.\n return () => { registry.set(sessionId, undefined) }\n }, [blocks, sessionId, block?.reason])\n\n if (ready || card === null || chat === null) return null\n\n return (\n <section\n aria-label={`${ROLE_LABEL[PRIMARY_ROLE]} setup`}\n style={{\n border: '1px solid color-mix(in srgb, var(--watch-accent) 68%, var(--dsw-alias-border-l2))',\n borderRadius: '14px',\n padding: '15px 17px',\n margin: '0 0 8px',\n background: 'linear-gradient(145deg, color-mix(in srgb, var(--watch-accent) 7%, var(--dsw-alias-bg-layer-2)), var(--dsw-alias-bg-base))',\n boxShadow: '0 10px 30px color-mix(in srgb, var(--watch-accent) 9%, transparent)',\n }}\n >\n <div style={{\n display: 'flex', alignItems: 'baseline', gap: '10px',\n justifyContent: 'space-between', flexWrap: 'wrap',\n }}\n >\n <h3 style={{ fontSize: '13px', fontWeight: 600, margin: 0 }}>{card.title}</h3>\n {/* The word, then the chip. Nothing here is carried by colour. */}\n <StatusChip tone=\"neutral\">\n {chat.status === 'bound_unverified' ? 'Configured · not tested' : 'Not ready'}\n </StatusChip>\n </div>\n <p style={{\n fontSize: '12px', lineHeight: 1.55, margin: '6px 0 0',\n color: 'var(--dsw-alias-label-secondary)',\n }}\n >\n {card.detail}\n </p>\n\n {open\n ? (\n <BindingEditor\n row={{\n role: PRIMARY_ROLE,\n provider: null,\n model: null,\n readiness: chat,\n }}\n providers={snapshot.providers}\n saving={snapshot.saving}\n onBind={(provider, model) => {\n void store.bind(PRIMARY_ROLE, provider, model).then(() => { setOpen(false) })\n }}\n onCancel={() => { setOpen(false) }}\n />\n )\n : (\n <div style={CONTROL.row}>\n <button\n type=\"button\"\n style={CONTROL.primary}\n disabled={!snapshot.writable || snapshot.testingRole !== null}\n aria-describedby={snapshot.writable ? undefined : 'watch-chat-gate-readonly'}\n onClick={() => {\n if (chat.primaryBlocker === 'provider_untested') void store.testRole(PRIMARY_ROLE)\n else setOpen(true)\n }}\n >\n {snapshot.testingRole === PRIMARY_ROLE ? 'Testing provider…' : card.action}\n </button>\n {snapshot.writable\n ? null\n : (\n <span id=\"watch-chat-gate-readonly\" style={{ fontSize: '12px', color: 'var(--dsw-alias-label-tertiary)' }}>\n This Workspace cannot change settings here, so Chat cannot\n be bound from this screen. What is shown is still read from\n the running system.\n </span>\n )}\n <span style={{ fontSize: '12px', color: 'var(--dsw-alias-label-tertiary)' }}>\n {/* Named rather than linked: the settings panel's open state is\n local to its own component, so nothing can navigate there,\n and a button that fails when pressed teaches people the\n product is broken. */}\n Settings → Role Bindings has the full view.\n </span>\n </div>\n )}\n </section>\n )\n}\n","/**\n * The Watch Technology & Capability Center, registered into DSH's settings.\n *\n * `settings.section` is a list, so these seven sit alongside DSH's General,\n * Models and Plugins rather than replacing any of them. That is the whole\n * arrangement: the foundation keeps its settings, and Watch adds the surfaces\n * that make its own capabilities inspectable.\n *\n * The `order` values start at 20 so upstream's sections keep the top of the\n * list, and they are grouped so the reading order tells a story — what the\n * agent is (Intelligence), what it can perceive (Perception), what it keeps\n * (Memory), what it can prove (Truth), and what it actually is (System).\n *\n * @module @deepwatch/dsh-client-settings/client\n */\n\nimport { useEffect, useSyncExternalStore } from 'react'\nimport type { ReactNode } from 'react'\nimport type { Context } from '@deepseek-ai/cordis'\nimport type { CoreHealthReport } from '@deepwatch/dsh-contracts/query/wire'\nimport {\n AboutSection,\n DiagnosticsSection,\n EnginesSection,\n MemorySection,\n SourcesSection,\n VerificationSection,\n} from './components.js'\nimport { WatchOnboarding } from './onboarding.js'\nimport type { OnboardingProps } from './onboarding.js'\nimport { BindingStore } from './binding-state.js'\nimport { RoleBindings } from './role-bindings.js'\nimport { ChatGate } from './chat-gate.js'\nimport type { ComposerBlocks } from './chat-gate.js'\nimport type { HostApi } from './binding-state.js'\nimport type { ProviderTestFacts, RouteReadinessFacts } from './binding-state.js'\n\nexport * from './components.js'\nexport * from './onboarding.js'\nexport * from './readiness.js'\nexport * from './binding-state.js'\nexport * from './role-bindings.js'\nexport * from './chat-gate.js'\n\n/**\n * Services this half needs before it can register anything.\n *\n * `connection` is what makes Role Bindings a working screen rather than a\n * description of one: it carries the RPC face this package asks for the\n * provider directory, the model catalogue, credential state and the stored\n * assignments. Registering the section without it would put a control on\n * screen that fails when pressed.\n */\n// `remote` is listed because Diagnostics reads the engine through\n// `remote.watchQuery`, and cordis refuses a property no inject entry claims —\n// the Health card rendered as a crashed slot until this said so.\n//\n// `remote.watchQuery` is listed for the same reason: cordis guards the nested\n// namespace separately, and reaching it without the entry crashed the settings\n// slot rather than returning undefined.\n//\n// Listing it parks this plugin until the namespace is mounted, which is only\n// safe because `@deepwatch/dsh-client-remotes` is now a declared\n// `dsh.client.inject` dependency in package.json — the boot graph reads that,\n// not this constant, and without it the mount ordering was not guaranteed.\n// The lookup below is still written defensively, so a profile that somehow\n// lacks the namespace gets \"could not be read\" rather than a blank card.\nexport const inject = ['slots', 'connection', 'remote', 'remote.watchQuery']\n\n/** The minimal shape of DSH's slot service this module uses. */\ninterface SlotService {\n inject(name: string, register: () => void): void\n register(entry: Record<string, unknown>, component: unknown): void\n}\n\n/** The half of the conversation service a composer block needs. */\n/** What Diagnostics renders: a health report, or nothing it could read. */\ntype CoreHealth = CoreHealthReport\n\n/**\n * The one read plane method this package calls.\n *\n * Typed locally rather than imported from the Library's declared namespace:\n * this package needs one method and importing the whole face would make\n * Settings depend on the Library's view of a service it shares.\n */\ntype CoreHealthReader = (\n request: { protocol: number, requestId: string, deadlineMs: number },\n signal?: AbortSignal,\n) => Promise<{ ok: true, value: unknown } | { ok: false }>\n\ntype ProviderTestReader = (\n request: {\n protocol: number\n requestId: string\n deadlineMs: number\n provider: string\n model: string\n },\n signal?: AbortSignal,\n) => Promise<{ ok: true, value: unknown } | { ok: false }>\n\n/** The same envelope, for the read that spends nothing. */\ntype RouteReadinessReader = (\n request: {\n protocol: number\n requestId: string\n deadlineMs: number\n provider: string\n model: string\n },\n signal?: AbortSignal,\n) => Promise<{ ok: true, value: unknown } | { ok: false }>\n\ninterface HealthSnapshot {\n readonly health: CoreHealth | null\n readonly reading: boolean\n readonly loaded: boolean\n}\n\n/** One live Core reading shared by onboarding and Diagnostics. */\nclass CoreHealthStore {\n private snapshot: HealthSnapshot = { health: null, reading: true, loaded: false }\n private readonly listeners = new Set<() => void>()\n private generation = 0\n private inFlight: Promise<void> | null = null\n\n constructor(private readonly reader: () => CoreHealthReader | null) {}\n\n getSnapshot = (): HealthSnapshot => this.snapshot\n subscribe = (listener: () => void): (() => void) => {\n this.listeners.add(listener)\n return () => { this.listeners.delete(listener) }\n }\n\n private publish(snapshot: HealthSnapshot): void {\n this.snapshot = snapshot\n for (const listener of this.listeners) listener()\n }\n\n /**\n * Read once, however many surfaces ask.\n *\n * Onboarding and Diagnostics mount independently and both need the same\n * reading. Firing a second Core handshake because a second surface appeared\n * is two readings that can disagree, and the one a person is looking at\n * would be whichever landed last.\n */\n ensureLoaded(): void {\n if (this.snapshot.loaded || this.inFlight !== null) return\n this.inFlight = this.refresh().finally(() => { this.inFlight = null })\n }\n\n async refresh(): Promise<void> {\n const generation = ++this.generation\n this.publish({ ...this.snapshot, reading: true })\n const reader = this.reader()\n if (reader === null) {\n this.publish({ health: null, reading: false, loaded: true })\n return\n }\n try {\n const result = await reader({\n protocol: 1, requestId: `req_${Date.now().toString(36)}`, deadlineMs: 15_000,\n }, new AbortController().signal)\n if (generation !== this.generation) return\n const report = result.ok ? result.value as CoreHealth | null | undefined : null\n this.publish({\n health: report?.outcome === 'core_health' ? report : null,\n reading: false,\n loaded: true,\n })\n } catch {\n if (generation === this.generation) {\n this.publish({ health: null, reading: false, loaded: true })\n }\n }\n }\n}\n\ninterface ConversationService {\n readonly blocks: ComposerBlocks\n}\n\n/** Add the Watch sections to DSH's settings panel. */\nexport function apply(ctx: Context): void {\n const slots = (ctx as unknown as { slots: SlotService }).slots\n // One store for the whole panel. Two would be two answers to \"is Chat\n // ready?\", and the screen that showed a stale one would be the screen\n // somebody trusted.\n // Diagnostics reads the same store, so \"Agent Model — Not configured\" cannot\n // sit beside a Role Bindings screen saying Chat is ready. One store, one\n // answer, on every surface that asks.\n /**\n * The channel to the engine, looked up when Diagnostics renders.\n *\n * Deliberately *not* an `inject` entry. Naming `remote.watchQuery` there\n * parks this whole plugin until the service exists, and the cost of being\n * wrong about that is not a missing Health card — it is every Watch settings\n * section disappearing, which is what happened: \"View diagnostics\" became a\n * button that did nothing. The same mistake is recorded twenty lines below\n * about `conversation`, and it is the same mistake.\n *\n * So this is read at the point of use, and its absence is a state the panel\n * already renders honestly: \"could not be read\" rather than a plausible\n * default. A screen that says it does not know beats a screen that is not\n * there.\n */\n const readHealth = (): CoreHealthReader | null => {\n const remote = (ctx as unknown as {\n remote?: { watchQuery?: { coreHealth?: CoreHealthReader } }\n }).remote\n return remote?.watchQuery?.coreHealth ?? null\n }\n const runProviderTest = async (\n provider: string, model: string, signal: AbortSignal,\n ): Promise<ProviderTestFacts> => {\n const method = (ctx as unknown as {\n remote?: { watchQuery?: { providerTest?: ProviderTestReader } }\n }).remote?.watchQuery?.providerTest\n if (method === undefined) throw new Error('provider test remote unavailable')\n const result = await method({\n protocol: 1, requestId: `req_provider_${Date.now().toString(36)}`,\n deadlineMs: 15_000, provider, model,\n }, signal)\n if (!result.ok) throw new Error('provider test remote refused the request')\n const value = result.value as ProviderTestFacts & { outcome?: string }\n if (value.outcome !== 'provider_test' || value.provider !== provider || value.model !== model) {\n throw new Error('provider test returned a mismatched response')\n }\n return value\n }\n /**\n * The Host's verdict on a route, read rather than remembered.\n *\n * Shaped like `runProviderTest` and deliberately not like it: this spends\n * nothing, reaches no provider, and is asked on every load. It is what stops\n * a tab that has been open across a Host restart, or across an edit made\n * somewhere else, from drawing a tested badge over a route the Host would\n * refuse.\n */\n const readRouteReadiness = async (\n provider: string, model: string, signal: AbortSignal,\n ): Promise<RouteReadinessFacts> => {\n const method = (ctx as unknown as {\n remote?: { watchQuery?: { routeReadiness?: RouteReadinessReader } }\n }).remote?.watchQuery?.routeReadiness\n if (method === undefined) throw new Error('route readiness remote unavailable')\n const result = await method({\n protocol: 1, requestId: `req_readiness_${Date.now().toString(36)}`,\n deadlineMs: 5_000, provider, model,\n }, signal)\n if (!result.ok) throw new Error('route readiness remote refused the request')\n const value = result.value as RouteReadinessFacts & {\n outcome?: string, provider?: string, model?: string\n }\n if (value.outcome !== 'route_readiness' || value.provider !== provider || value.model !== model) {\n throw new Error('route readiness returned a mismatched response')\n }\n return { proved: value.proved, reason: value.reason }\n }\n const store = new BindingStore(\n (ctx.get('connection') as { api: HostApi }).api, runProviderTest, readRouteReadiness,\n )\n const RoleBindingsSection = (): ReactNode => RoleBindings({ store })\n const healthStore = new CoreHealthStore(readHealth)\n\n const DiagnosticsWithRoles = (): ReactNode => {\n // Subscribed, not sampled: a Diagnostics page that read the snapshot once\n // would show the readiness that happened to be loaded when it mounted, and\n // go quietly stale the moment somebody bound something in the next tab.\n const snapshot = useSyncExternalStore(store.subscribe, store.getSnapshot, store.getSnapshot)\n useEffect(() => { void store.load() }, [])\n\n const core = useSyncExternalStore(\n healthStore.subscribe, healthStore.getSnapshot, healthStore.getSnapshot,\n )\n useEffect(() => { healthStore.ensureLoaded() }, [])\n\n return DiagnosticsSection({\n roles: snapshot.roles, health: core.health, reading: core.reading,\n onRefresh: () => { void healthStore.refresh() },\n })\n }\n\n const OnboardingWithReadiness = (props: OnboardingProps): ReactNode => {\n const snapshot = useSyncExternalStore(store.subscribe, store.getSnapshot, store.getSnapshot)\n const core = useSyncExternalStore(\n healthStore.subscribe, healthStore.getSnapshot, healthStore.getSnapshot,\n )\n useEffect(() => { void store.load(); healthStore.ensureLoaded() }, [])\n return WatchOnboarding({\n ...props, roles: snapshot.roles, health: core.health, reading: core.reading,\n })\n }\n\n const section = (id: string, label: string, order: number, component: unknown): void => {\n slots.inject('settings.section', () => {\n slots.register({ name: 'settings.section', id, label, order }, component)\n })\n }\n\n // A section label has 112px, measured in the running settings nav.\n //\n // \"Perception Engines\", \"Sources & Devices\" and \"Memory & Retrieval\" were\n // 118px, 114px and 124px, so all three ellipsised to \"Perception Engi…\",\n // \"Sources & Devic…\" and \"Memory & Retri…\" — three of eight Watch sections\n // unreadable in every screenshot. The one-word forms are 66px, 49px and\n // 52px, and they sit consistently beside the labels that already fit:\n // Role Bindings 84px, Verification 70px, Diagnostics 72px, About 39px.\n //\n // The nav width is DSH's, so the label is the half that has to give.\n\n // INTELLIGENCE — what the agent is, and what each capability is bound to.\n // DSH's own Models section stays where it is; this adds the per-role view it\n // has no reason to carry, since roles are a Watch concept.\n section('watch-roles', 'Role Bindings', 20, RoleBindingsSection)\n\n // PERCEPTION — what runs here, and what it is allowed to see.\n section('watch-engines', 'Perception', 30, EnginesSection)\n section('watch-sources', 'Sources', 40, SourcesSection)\n\n // MEMORY — what is kept, under which rules.\n section('watch-memory', 'Memory', 50, MemorySection)\n\n // TRUTH — what a verdict means and who may issue one.\n section('watch-verification', 'Verification', 60, VerificationSection)\n\n // SYSTEM — what this installation actually is.\n section('watch-diagnostics', 'Diagnostics', 70, DiagnosticsWithRoles)\n section('watch-about', 'About', 80, AboutSection)\n\n // The composer's own preflight, in the seat beside it.\n //\n // The seat is claimed unconditionally and the conversation service is looked\n // up when the gate renders. Parking the registration behind\n // `ctx.inject(['conversation'], …)` looked tidier and was wrong: the\n // callback never ran, so the card never drew and the composer was never\n // blocked -- silently, while every other surface in this package worked.\n // Upstream's own model-selection plugin reaches the same registry with a\n // plain `ctx.get('conversation')` at the point of use, which is late enough\n // to be there.\n //\n // It lives here rather than in the shell because this is the package that\n // knows. Upstream's note on composer blocks says the model-selection plugin\n // is what raises one -- \"the composer cannot read the plugins that would\n // know\" -- and in this distribution that is this package: it holds the\n // store, the readiness and the picker. Anywhere else would mean a second\n // store, and two answers to \"can Chat run?\".\n const blocks = (): ComposerBlocks | undefined =>\n (ctx.get('conversation') as ConversationService | undefined)?.blocks\n slots.inject('conversation.input.dock', () => {\n slots.register(\n // Order 5, ahead of the Watch composer panel at 10: a person who cannot\n // send yet should meet the reason before the turn controls.\n { name: 'conversation.input.dock', id: 'watch-chat-gate', order: 5 },\n ({ sessionId }: { readonly sessionId: string }): ReactNode =>\n ChatGate({ sessionId, store, blocks }),\n )\n })\n\n // The first-run screen, ahead of upstream's.\n //\n // `settings.onboarding` is a list and DSH renders `{ only: currentStep }`, so\n // order decides what a person sees first. Upstream registers\n // `deepseek-official` at 0; this sits at -50 and leads instead with what the\n // product is and what is actually ready.\n //\n // Upstream's step is not removed. DeepSeek remains a perfectly good provider\n // choice, and continuing past this screen reaches it unchanged — the change\n // is that connecting it is no longer presented as the price of entry.\n slots.inject('settings.onboarding', () => {\n slots.register(\n { name: 'settings.onboarding', id: 'watch-welcome', order: -50 },\n OnboardingWithReadiness,\n )\n })\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;EAYA,MAAa,eAAe;;;;;;;;EA4C5B,MAAa,cAAc;;;;;;;EAO3B,MAAa,eAAe;;;;;;;;EA8C5B,SAAgB,SAAS,MAAM;GAC3B,OAAO,oBAAoB,KAAK;EACpC;;;;;;;;;;;;;ECrGA,MAAa,iBAAiB;;;;ECiI9B,MAAM,eAAe;GAAE,gBAAgB;GAAG,WAAW;GAAS,aAAa;EAAK;;;;;;;;EAQhF,MAAa,YAAY;GACrB,IAAI;GACJ,aAAa;GACb,SAAS;GACT,MAAM;GACN,cAAc,CAAC,gBAAgB,QAAQ;GACvC,YAAY,CAAC,OAAO;GACpB,OAAO,CAAC,YAAY;GACpB,SAAS;GACT,WAAW,CAAC;GACZ,WAAW,CAAC;GACZ,qBAAqB;GACrB,UAAU;IAAE,KAAK;IAAQ,WAAW;IAAM,UAAU;IAAG,cAAc,CAAC;GAAE;GACxE,SAAS;IAAE,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