Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.
TypeScript cross-platformelectronffmpegopen-sourceproduct-demorustscreen-capturescreen-recorderscreen-recordingscreen-studioscreencastspeech-to-texttypescriptvideo-editingvideo-editorwaylandwgpuwhisper
feat(workbench): keep versioned measurements and offline replay
超超超超超级喜欢你的达妮娅c61a2f80b242
diff --git a/.gitattributes b/.gitattributesindex 441b9c43f..2c38460da 100644--- a/.gitattributes+++ b/.gitattributes@@ -16,3 +16,6 @@ CMakeLists.txt text eol=lf# so the next one-line edit showed up as a whole-file rewrite in two locales.*.md text eol=lf*.mdx text eol=lf++# Adopted measurement manifests hash exact bytes; keep their artifacts unchanged.+workbench/measurements/** -textdiff --git a/biome.json b/biome.jsonindex 4b65d5382..fb2c6a910 100644--- a/biome.json+++ b/biome.json@@ -111,6 +111,10 @@},"javascript": { "formatter": { "quoteStyle": "double" } },"overrides": [+ {+ "includes": ["workbench/measurements/**/*.json"],+ "formatter": { "enabled": false }+ },{"includes": ["*.ts", "*.tsx", "*.mts", "*.cts"],"linter": {diff --git a/electron/ai-edition/chat-service.ts b/electron/ai-edition/chat-service.tsindex 20e635062..067b957ed 100644--- a/electron/ai-edition/chat-service.ts+++ b/electron/ai-edition/chat-service.ts@@ -270,6 +270,8 @@ export interface ChatRunEnv {/** Reads recorded cursor telemetry for an asset. Built in `electron/ipc/* handlers.ts`, where the path allow-list lives. */cursor?: CursorTelemetryReader;+ /** Runtime-only model retry override used by bounded measurement harnesses. */+ maxRetries?: number;}// ponytail: zero-config noop for sink callbacks that the caller did not provide.@@ -405,6 +407,7 @@ export async function runChat(apiKey: apiKey ?? undefined,baseUrl: config.baseUrl,reasoningEffort: config.reasoningEffort,+ maxRetries: env.maxRetries,},history,userMessage: message,diff --git a/electron/ai-edition/deep-agent/chat-model.test.ts b/electron/ai-edition/deep-agent/chat-model.test.tsindex 477f5bece..2b917ca5b 100644--- a/electron/ai-edition/deep-agent/chat-model.test.ts+++ b/electron/ai-edition/deep-agent/chat-model.test.ts@@ -91,6 +91,33 @@ describe("createOpenScreenChatModel — Anthropic-wire output budget", () => {});});+describe("createOpenScreenChatModel — runtime retry override", () => {+ function retries(model: unknown): number | undefined {+ return (model as { caller?: { maxRetries?: number } }).caller?.maxRetries;+ }++ it("passes an explicit zero to LangChain", async () => {+ const model = await createOpenScreenChatModel({+ provider: "openai-compatible",+ model: "gpt-5-test",+ apiKey: "test-key",+ baseUrl: "http://127.0.0.1:1/v1",+ maxRetries: 0,+ });+ expect(retries(model)).toBe(0);+ });++ it("keeps LangChain's default when the override is omitted", async () => {+ const model = await createOpenScreenChatModel({+ provider: "openai-compatible",+ model: "gpt-5-test",+ apiKey: "test-key",+ baseUrl: "http://127.0.0.1:1/v1",+ });+ expect(retries(model)).toBe(6);+ });+});+describe("messageContentToText", () => {it("passes a plain string through", () => {expect(messageContentToText("hello")).toBe("hello");diff --git a/electron/ai-edition/deep-agent/chat-model.ts b/electron/ai-edition/deep-agent/chat-model.tsindex 037343262..3b57f379e 100644--- a/electron/ai-edition/deep-agent/chat-model.ts+++ b/electron/ai-edition/deep-agent/chat-model.ts@@ -283,6 +283,8 @@ export interface OpenScreenChatModelConfig {apiKey?: string;baseUrl?: string;reasoningEffort?: string;+ /** Runtime-only retry override. Omitted callers keep LangChain's default. */+ maxRetries?: number;}// ponytail: placeholder API key for self-hosted OpenAI-compatible endpoints@@ -422,6 +424,7 @@ export async function createOpenScreenChatModel(...(reasoningOptions.reasoning ? { reasoning: reasoningOptions.reasoning } : {}),...(reasoningOptions.useResponsesApi ? { useResponsesApi: true } : {}),...(reasoningOptions.modelKwargs ? { modelKwargs: reasoningOptions.modelKwargs } : {}),+ ...(config.maxRetries !== undefined ? { maxRetries: config.maxRetries } : {}),// ponytail: Gemini's OpenAI-compat path can't stream + tool-call at once// — disable streaming so the ChatOpenAI compat layer buffers and returns// cleanly. axcut does the same.diff --git a/package.json b/package.jsonindex bb6c7956c..10fa781f3 100644--- a/package.json+++ b/package.json@@ -67,6 +67,7 @@"wb:judge": "npm run wb:build --silent && node --env-file=.env.workbench workbench/.build/cli.cjs judge","wb:judge:replay": "npm run wb:build --silent && node workbench/.build/cli.cjs judge --replay","wb:compare": "npm run wb:build --silent && node workbench/.build/cli.cjs compare",+ "wb:measurement": "esbuild workbench/measurement-entry.ts --bundle --platform=node --format=cjs --packages=external --outfile=workbench/.build/measurement-cli.cjs --log-level=warning && node workbench/.build/measurement-cli.cjs","test:watch": "vitest","test:cursor-native:win": "node scripts/test-windows-native-cursor.mjs","test:wgc-helper:win": "node scripts/test-windows-wgc-helper.mjs",diff --git a/workbench/README.md b/workbench/README.mdindex 32131b47e..1ff4d8ebd 100644--- a/workbench/README.md+++ b/workbench/README.md@@ -66,8 +66,36 @@ par `node --env-file`. Aucun parseur maison, jamais `dotenv`.OPENSCREEN_WORKBENCH_API_KEY=…OPENSCREEN_WORKBENCH_BASE_URL=…OPENSCREEN_WORKBENCH_MODEL=…+OPENSCREEN_WORKBENCH_WIRE_API=responses+OPENSCREEN_WORKBENCH_USER_AGENT=codex_exec/…+OPENSCREEN_WORKBENCH_ORIGINATOR=codex_exec```+`WIRE_API` vaut `chat-completions` par défaut ou `responses`. Les deux en-têtes sont facultatifs,+validés comme valeurs publiques ordinaires, et leur profil normalisé est lié à l'identité de+transport sans enregistrer la clé. En mode Responses, le modèle configuré doit réellement+sélectionner le client Responses natif ; un désaccord échoue avant tout transfert.++Un run Responses borné nomme toujours ses deux plafonds :++```bash+node workbench/.build/cli.cjs run --scenario target-right-clip --reps 1 \+ --label <label> --record --timeout 180000 --max-requests 6 --max-output-tokens 2048+```++Le plafond de requêtes appartient à toute l'invocation. Le recorder impose `store:false`, le+plafond de sortie demandé, 64 KiB par requête, 1 MiB par réponse, 60 s par requête, zéro retry SDK+et zéro répétition de secours. Il conserve les octets de réponse décodés par HTTP avec leur SHA,+statut et Content-Type exacts. Le replay principal ne lit aucun environnement live :++```bash+node workbench/.build/cli.cjs replay --scenario <id> --cassette <path> \+ --label <nouveau-label> --timeout <ms>+```++Il écrit `workbench/runs/<label>/<scenario>/replay-receipt.json`, avec l'usage relu depuis les+octets effectivement servis par le replay, puis exige `assertFresh()`.+`workbench/lib/env.ts` est le **seul** fichier autorisé à nommer ces variables. Si l'une manque,on échoue avec un message nommé plutôt que de chercher ailleurs : sans `baseUrl`, ChatOpenAI partsilencieusement sur `api.openai.com` et la clé partirait chez un tiers ; sans `apiKey`, le 401@@ -77,6 +105,110 @@ La valeur n'est **jamais** lue, journalisée ni écrite : `report.ts` et `writeCd'écrire un payload qui la contient, et `scenarios/contract.wb.ts` interdit à tout fichier de`workbench/**` de toucher au trousseau, à `safeStorage` ou à `Application Support`.+### Usage observé dans les cassettes++`workbench/lib/cassette.ts` ajoute, quand le flux le fournit, `rounds[].usage` à partir du dernier+objet `usage` valide rencontré avant `[DONE]`. Pour Responses, l'usage vient exclusivement de+`response.completed.response.usage`. Le champ est optionnel : son absence signifie+« inconnu », jamais zéro. Les champs de détail propres au provider sont conservés tels quels ; le+SSE brut reste dans `rounds[].sse`. Le profil Chat historique transmet le corps inchangé ; le+profil Responses conserve le corps effectif après sa mutation déclarée (`store:false` et+`max_output_tokens`). Les+anciennes cassettes sans ce champ restent lisibles et rejouables.++Cette extension couvre uniquement la métadonnée observée de l'issue #459 : elle ne demande pas+`include_usage`, n'estime pas les tokens et ne réécrit ni les cassettes ni les baselines.++### Adopter une mesure versionnée++Un run enregistré garde d'abord ses artefacts exploratoires sous+`workbench/runs/<label>/<scénario>/`. La cassette, les résultats check par check, le rapport et+`measurement-candidate.json` y restent gitignorés. La fin d'un run ne les publie pas, ne les ajoute+pas à Git et ne marque aucune revue comme approuvée.++Si le scénario porte des checks jugés, ce candidat reste `complete: false` jusqu'à+`npm run wb:judge -- --label <label> --record`. Cette passe doit utiliser le même provider et le+même endpoint que le run agent ; elle ajoute `judge-cassette.json`, remplace les résultats+indéterminés par les verdicts réellement enregistrés, puis rend le candidat exportable. Un juge+interrompu ou exécuté contre une autre destination ne le complète pas.++Une mesure qui doit étayer une baseline ou une PR passe par une adoption explicite :++```bash+npm run wb:record -- --scenario target-right-clip --reps 3 --label pr-123+npm run wb:measurement -- export \+ --run workbench/runs/pr-123/target-right-clip \+ --id pr-123-target-right-clip \+ --review checks/pr-123-target-right-clip-review.json+npm run wb:measurement -- verify --id pr-123-target-right-clip+npm run wb:measurement -- replay --id pr-123-target-right-clip+npm run wb:measurement -- baseline --id pr-123-target-right-clip \+ --out workbench/runs/pr-123/target-right-clip/baseline-candidate.json+npm run wb:measurement -- compare \+ --left pr-123-target-right-clip --right pr-124-target-right-clip+```++`export` valide tout avant de renommer atomiquement le paquet vers+`workbench/measurements/<id>/`, un emplacement suivi par défaut. Un identifiant existant n'est+jamais écrasé. La commande ne parcourt pas le répertoire : elle ne copie que les références+énumérées et autorisées (`input-fixture`, cassettes agent/juge, résultats, rapport et reçu de+revue), chacune sous un chemin POSIX relatif, sans lien symbolique ni jonction, et avec son SHA256.++Les fichiers adoptés sont des preuves figées : leurs empreintes couvrent les octets, y compris+les espaces et les fins de ligne. `.gitattributes` empêche leur conversion par Git, et Biome+conserve le JSON sans le reformater, tout en gardant la validation syntaxique et le lint actifs.+Ne normalisez pas ces fichiers manuellement : utilisez `verify`, puis `replay`. Une correction+doit produire une nouvelle mesure avec un nouvel identifiant.++Le manifeste version 1 porte une identité source de schéma 2 : `commit`, `dirtyManifest` et+`dirtySha256` gardent la provenance HEAD + changements ; `effectiveManifest` et+`effectiveSha256` décrivent les octets courants de tout le code et de la configuration concernés.+Le manifeste effectif couvre les fichiers racine package/TypeScript/Vitest et les extensions de+code/config sous `workbench/`, `src/` et `electron/`, avec quatorze ancres obligatoires. Il exclut+les tests L0/L1, baselines, fixtures, runs, rapports, cassettes, builds et mesures adoptées. Un+commit des mêmes octets, un commit d'artefact seul et son clone changent la provenance sans+changer l'identité effective ; modifier, ajouter, supprimer ou renommer une source la change.+Ce périmètre est volontairement conservateur, pas un graphe minimal de dépendances : une autre+source TypeScript incluse peut donc rendre deux mesures incompatibles même si ce scénario ne+l'importe pas directement.+Une ancienne identité `contentManifest`/`contentSha256`, limitée au diff sale, reste+legacy/non-comparable et n'est jamais interprétée comme l'arbre effectif.++Le même manifeste lie les identités fixture/document/télémétrie, le prompt, les instructions haut+niveau, les outils, le wire et le rubric. Il garde séparément les modèles demandés et observés+pour l'agent et le juge. Le provider est un libellé ; l'endpoint n'apparaît que par le SHA256 de+son origine et de son chemin+normalisés. Une URL portant des credentials, une query ou un fragment est refusée. Une valeur+`unknown` reste inconnue et interdit une assertion de comparabilité.++Le reçu de revue est fourni par l'appelant. Il nomme l'id de mesure, un reviewer `human` ou+`independent`, un verdict `approved` ou `rejected`, une date et un résumé. Le logiciel le vérifie+et le référence ; il ne fabrique jamais un accord à partir d'une suite verte. Seule une mesure+explicitement approuvée peut produire une baseline liée.++Les nombres liés sont recalculés depuis chaque verdict de check **avec son poids**. Un indéterminé+sort de `k` et de `n`, et son poids sort du score de sa répétition, mais il reste compté séparément.+`behaviour` et `dsl` gardent donc leur sens historique : la moyenne des scores pondérés de chaque+répétition, pas un nouveau taux brut de checks. `verify` recalcule les deux formes et refuse un+dénominateur, un poids, un score d'axe, un résumé ou un hash modifié ;+`replay` refait le tour contre les cassettes hors ligne et exige le même résultat. `compare` exige+la même identité de scénario, fixture, document, télémétrie, source, prompts/outils/wire/rubric,+endpoint et modèles. S'ils diffèrent, il affiche les deux comptes et rend+`INCOMPATIBLE_IDENTITIES` au lieu de présenter un delta comme une comparaison canonique.++Les trois JSON historiques de `workbench/baselines/` restent le cliquet des ids d'échec. Leurs+champs `behaviour` et `dsl` sont toutefois **legacy/unbound** : aucun artefact ne permet de les+recalculer, donc ils ne constituent pas une baseline numérique actuelle. Toute nouvelle+affirmation quantitative doit venir de `baseline --id`, jamais d'une valeur recopiée dans un de+ces fichiers.++La barrière d'adoption est volontairement plus stricte que le stockage exploratoire. Elle refuse+les secrets connus fournis par l'appelant, les en-têtes d'autorisation, clés API, endpoints bruts,+chemins privés absolus et champs arbitraires de transcript/document. Seules les fixtures+synthétiques publiques inscrites dans le registre peuvent être adoptées. Pour une PR jugée, le+paquet versionné avec ses cassettes et son reçu relu fait partie de l'évidence à committer ; un run+de réglage, incomplet ou non relu reste sous `workbench/runs/`.+---## Lire un rapport@@ -88,13 +220,17 @@ Les rapports vont dans `workbench/reports/` (gitignoré), en JSON et en Markdown1. **L'effet minimal détectable**, imprimé en tête. À `--reps 3` il vaut ~81 points : à ce *n*,seule une différence énorme est lisible. Un check qui passe de 2/3 à 3/3 n'est pas uneamélioration, c'est du bruit.-2. **L'empreinte du run** : `systemSha256` (le message système réellement envoyé), `toolsSha256`,+2. **L'empreinte du run** : `systemSha256` (tous les messages `system` et `developer` réellement+ envoyés, avec leurs rôles), `toolsSha256`,`toolNames[]` (exactement `OPENSCREEN_TOOL_NAMES` — aucun compte n'est écrit ici : le rosterest épinglé en CI par `deep-agent/service.test.ts` contre ce que `buildTools` construitvraiment, et un nombre recopié en prose est précisément ce qui a laissé ce banc en annoncer- 19 pendant que le produit en livrait 21), l'id du modèle, le sha git. Deux rapports- d'empreintes différentes ne sont pas comparables. C'est arrivé le jour où `createAgent` a- remplacé `createDeepAgent` : le message système est passé de ~8 700 à 2 968 caractères et la+ 19 pendant que le produit en livrait 21), l'id du modèle et `effectiveSourceSha256`. Le sha Git+ et l'état dirty restent affichés comme provenance ; ils ne rendent pas seuls deux arbres+ effectifs identiques incompatibles. Deux rapports dont les identités effectives, prompts,+ outils, wires, rubrics, endpoints ou modèles diffèrent ne sont pas comparables. C'est arrivé le+ jour où `createAgent` a remplacé `createDeepAgent` : le message système est passé de ~8 700 à+ 2 968 caractères et lasurface d'outils de 25 à 17. Elle a **rebougé trois fois depuis** — `moveClip` (18ᵉ outil),les descriptions de `replaceTimeline`/zoom/caméra, deux règles de sélection d'outil et lebloc de consentement ajouté au prompt quand `allowAgentEdits` est faux ; puis@@ -141,7 +277,7 @@ perdrait les six premières) :```workbench/runs/<label>/<scénario>/rep-<n>.json appels, documents avant/après, texte final-workbench/runs/<label>/<scénario>/system-<sha>.txt le message système, une fois par empreinte+workbench/runs/<label>/<scénario>/system-<sha>.txt instructions system/developer, une fois par empreinte````--no-persist` s'en passe. Trois règles :@@ -151,7 +287,8 @@ workbench/runs/<label>/<scénario>/system-<sha>.txt le message système, une foile nettoyer — un fichier nettoyé cacherait qu'un secret y est passé.2. **Borné.** Les résultats d'outils sont illimités par nature. Au-delà de `MAX_FIELD_CHARS` lechamp est coupé et **nommé** dans `truncated[]` : on ne lit jamais un fragment sans le savoir.-3. Le message système est écrit **à côté**, une fois par sha, et référencé par nom — le sha est+3. Les instructions `system`/`developer` sont écrites **à côté**, une fois par sha, et référencées+ par nom — le sha estcelui de l'empreinte du rapport, donc la référence est vérifiable.### Le ratchet tourne dans les deux sens@@ -376,7 +513,8 @@ autrement. C'est l'obligation de `scenario-pack.wb.ts` déplacée sur ce qui resDeux pièges à connaître avant d'écrire un `facts` :-- **`wire.systemBlocks` et `toolsSent` ne survivent pas au fichier persisté** (`persist.ts`). Un+- **`wire.systemBlocks` (instructions `system`/`developer`) et `toolsSent` ne survivent pas au+ fichier persisté** (`persist.ts`). Unfait qui les lirait verrait des tableaux vides, ce qui ressemble à « rien n'a été envoyé ». Leréglage `allowAgentEdits`, lui, EST persisté et arrive jusqu'au contexte (`EvalContext`) : sanslui on demanderait au juge si l'assistant devait solliciter un accord sans lui dire s'il en avait@@ -572,11 +710,20 @@ pas de `fixtures/README.md` versionné à aller lire, seulement celui que se garprise. Rien d'autre que `lib/real-fixture.ts` ne doit les ouvrir.Conséquence à connaître avant de lancer le banc : **44 tests L0 échouent dans un clone neuf**,-tous sur le même `ENOENT` (`l0/real-fixture.wb.ts`, `real-screencast-truth.wb.ts`,+tous avec le code nommé `ORIGINAL_FIXTURE_UNAVAILABLE` (`l0/real-fixture.wb.ts`,+`real-screencast-truth.wb.ts`,`quality.wb.ts`, et `score.wb.ts` qui construit le document de chaque scénario du registre).Fournir sa propre prise donnera d'autres chiffres que ceux assertés ici. Rien de tout cela n'estvu par le CI, qui ne lance pas le banc.+Le paquet original requis est exactement+`workbench/fixtures/real-screencast.openscreen` et+`workbench/fixtures/real-screencast.mp4.cursor.json`. Il n'est plus disponible auprès de son+propriétaire. Les résumés 66,154 s, 129 mots et 1521 échantillons ne permettent pas de le+reconstruire. Les quatre scénarios `real-*` restent donc indisponibles : on ne les remplace pas par+une autre prise sous les mêmes ids, on ne transforme pas l'absence en skip vert, et on ne gèle pas+leurs anciennes notes comme si elles avaient été relues.+Le document arrive **tel qu'il est sur le disque**, y compris son `cameraTrack: null` alors qu'unfichier webcam existe à côté de l'enregistrement. Ce n'est pas un oubli de la copie ; c'est l'étatque l'app a écrit, et `l0/real-fixture.wb.ts` l'épingle pour que personne ne « complète » ladiff --git a/workbench/cli.ts b/workbench/cli.tsindex 4707ddc3d..a5a9d6b8c 100644--- a/workbench/cli.ts+++ b/workbench/cli.ts@@ -11,16 +11,29 @@// printed, never written, and `report.ts` refuses any payload that carries it.// The app itself only ever talks to the local proxy — see runner.ts.+import { mkdirSync, writeFileSync } from "node:fs";+import { dirname } from "node:path";import {assertAgainstBaseline,baselineFromRun,readBaseline,writeBaseline,} from "./lib/baseline";-import { cassetteExists, type ReplayHandle, startRecorder, startReplay } from "./lib/cassette";-import { requireLiveEnv } from "./lib/env";-import { DEFAULT_TURN_TIMEOUT_MS } from "./lib/harness";+import {+ cassetteExists,+ type ReplayHandle,+ readCassette,+ startRecorder,+ startReplay,+} from "./lib/cassette";+import { containsSecret, requireLiveEnv } from "./lib/env";+import { DEFAULT_TURN_TIMEOUT_MS, normalizeIds, offlineStore } from "./lib/harness";import { askJudge, type JudgeReading } from "./lib/judge";+import {+ CANDIDATE_FILE,+ finalizeJudgedMeasurementCandidate,+ prepareMeasurementCandidate,+} from "./lib/measurement";import type { ModelServerHandle } from "./lib/model-server";import {contextFromPersistedTurn,@@ -29,6 +42,7 @@ import {RUNS_DIR,readPersistedTurn,} from "./lib/persist";+import { captureSourceIdentity, endpointIdentity } from "./lib/provenance";import {buildReport,fingerprintOf,@@ -36,9 +50,10 @@ import {summarizeScenario,writeReport,} from "./lib/report";-import { type RepetitionResult, runScenarioReps } from "./lib/runner";+import { type RepetitionResult, runRepetition, runScenarioReps } from "./lib/runner";import { allResults, scoreRun } from "./lib/score";import { formatPercent, minDetectableEffect } from "./lib/stats";+import { createInvocationBudget, transportIdentity } from "./lib/transport";import { getScenario, selectScenarios } from "./scenarios/registry";const REPORTS_DIR = "workbench/reports";@@ -46,7 +61,7 @@ const BASELINES_DIR = "workbench/baselines";const CASSETTES_DIR = "workbench/cassettes";interface Options {- command: "run" | "judge" | "compare" | "help";+ command: "run" | "replay" | "judge" | "compare" | "help";scenarios: string[];tags: string[];reps: number;@@ -64,6 +79,9 @@ interface Options {/** `judge` only: rejoue les cassettes du juge au lieu d'appeler le provider.* Sans clé, sans réseau sortant, et le même verdict à chaque fois. */replay: boolean;+ cassette?: string;+ maxRequests?: number;+ maxOutputTokens?: number;}/**@@ -99,9 +117,14 @@ function parseArgs(argv: string[]): Options {record: false,persist: true,replay: false,+ cassette: undefined,+ maxRequests: undefined,+ maxOutputTokens: undefined,};const [command, ...rest] = argv;- if (command === "run" || command === "judge" || command === "compare") options.command = command;+ if (command === "run" || command === "replay" || command === "judge" || command === "compare") {+ options.command = command;+ }for (let i = 0; i < rest.length; i += 1) {const flag = rest[i];const value = rest[i + 1];@@ -139,6 +162,18 @@ function parseArgs(argv: string[]): Options {case "--replay":options.replay = true;break;+ case "--cassette":+ options.cassette = value;+ i += 1;+ break;+ case "--max-requests":+ options.maxRequests = Number(value);+ i += 1;+ break;+ case "--max-output-tokens":+ options.maxOutputTokens = Number(value);+ i += 1;+ break;default:break;}@@ -146,6 +181,14 @@ function parseArgs(argv: string[]): Options {if (!Number.isInteger(options.reps) || options.reps < 1) {throw new Error(`--reps doit être un entier positif, reçu ${options.reps}`);}+ for (const [name, value] of [+ ["--max-requests", options.maxRequests],+ ["--max-output-tokens", options.maxOutputTokens],+ ] as const) {+ if (value !== undefined && (!Number.isInteger(value) || value <= 0)) {+ throw new Error(`${name} doit être un entier positif, reçu ${value}`);+ }+ }return options;}@@ -157,7 +200,24 @@ async function commandRun(options: Options): Promise<number> {// Fails here, loudly and by name, rather than letting a missing baseUrl// silently retarget api.openai.com with the user's Deepseek key.const env = requireLiveEnv();- log(`modèle ${env.model} · endpoint ${env.baseUrl} · clé présente (${env.apiKey.length} car.)`);+ const provider = endpointIdentity("openai-compatible", env.baseUrl);+ log(+ `modèle demandé ${env.model} · provider ${provider.provider} · endpoint sha ${provider.endpointSha256.slice(0, 12)}`,+ );+ const source = captureSourceIdentity();+ if (env.wireApi === "responses" && (!options.maxRequests || !options.maxOutputTokens)) {+ throw new Error("Responses run exige --max-requests et --max-output-tokens");+ }+ const liveTransport = transportIdentity({+ wireApi: env.wireApi,+ maxOutputTokens: options.maxOutputTokens,+ publicHeadersSha256: env.publicHeaders.sha256,+ limits: {+ ...(options.maxRequests ? { maxRequests: options.maxRequests } : {}),+ invocationTimeoutMs: options.timeoutMs,+ },+ });+ const liveBudget = createInvocationBudget(liveTransport.limits);const scenarios = selectScenarios({ ids: options.scenarios, tags: options.tags });// ponytail: a scenario may pin its own `reps`, so the headline figure must@@ -174,19 +234,33 @@ async function commandRun(options: Options): Promise<number> {const summaries: ScenarioReport[] = [];const notices: string[] = [];const everyResult: RepetitionResult[] = [];+ const candidates: Array<{+ scenario: (typeof scenarios)[number];+ results: RepetitionResult[];+ summary: ScenarioReport;+ cassetteFiles: string[];+ }> = [];let failed = false;for (const scenario of scenarios) {const reps = effectiveReps(scenario, options);+ const cassetteFiles = Array.from(+ { length: reps },+ (_, rep) => `${RUNS_DIR}/${options.label}/${scenario.id}/main-cassette-rep-${rep}.json`,+ );log(`\n▸ ${scenario.id} — ${scenario.title} (n=${reps})`);const { results, discarded } = await runScenarioReps({scenario,reps,live: {- record: (rep) =>- options.record ? `${CASSETTES_DIR}/${scenario.id}-rep${rep}.json` : undefined,+ record: (rep) => (options.record ? cassetteFiles[rep] : undefined),+ maxRequests: options.maxRequests,+ maxOutputTokens: options.maxOutputTokens,+ transport: liveTransport,+ budget: liveBudget,},timeoutMs: options.timeoutMs,+ maxRetries: env.wireApi === "responses" ? 0 : undefined,onRepetition: (result) => {log(` rep ${result.rep}: comportement ${formatPercent(result.scored.behaviour.score)} · ` +@@ -220,6 +294,7 @@ async function commandRun(options: Options): Promise<number> {results,});summaries.push(summary);+ if (options.record) candidates.push({ scenario, results, summary, cassetteFiles });// The ratchet is fed by the union of the repetitions: a check that failed// at least once is a failure for baseline purposes.@@ -274,6 +349,7 @@ async function commandRun(options: Options): Promise<number> {wire: everyResult[0]?.run.wire,model: env.model,reps: smallestN,+ effectiveSourceSha256: source.effectiveSha256,}),scenarios: summaries,notices,@@ -285,9 +361,115 @@ async function commandRun(options: Options): Promise<number> {report,});log(`\nrapport : ${written.markdown}`);+ for (const candidate of candidates) {+ const observed = [+ ...new Set(+ candidate.cassetteFiles+ .map((file) => readCassette(file).resolvedModel)+ .filter((model): model is string => typeof model === "string" && model.length > 0),+ ),+ ];+ const candidateReport = buildReport({+ label: `${options.label}/${candidate.scenario.id}`,+ fingerprint: fingerprintOf({+ wire: candidate.results[0]?.run.wire,+ model: env.model,+ reps: candidate.results.length,+ effectiveSourceSha256: source.effectiveSha256,+ }),+ scenarios: [candidate.summary],+ notices: notices.filter((notice) => notice.includes(`${candidate.scenario.id}/`)),+ });+ const prepared = prepareMeasurementCandidate({+ runDir: `${RUNS_DIR}/${options.label}/${candidate.scenario.id}`,+ scenario: candidate.scenario,+ results: candidate.results,+ cassetteFiles: candidate.cassetteFiles,+ report: candidateReport,+ requestedModel: env.model,+ observedModel: observed.length === 1 ? observed[0] : undefined,+ provider: provider.provider,+ endpoint: env.baseUrl,+ source,+ });+ log(+ `candidat de mesure : ${prepared.file}${prepared.manifest.complete ? "" : " (juge requis)"}`,+ );+ }return failed ? 1 : 0;}+async function commandReplay(options: Options): Promise<number> {+ if (options.scenarios.length !== 1 || !options.cassette) {+ throw new Error("replay exige --scenario <id> et --cassette <path>");+ }+ const scenario = getScenario(options.scenarios[0]);+ const cassette = readCassette(options.cassette);+ if (cassette.scenario !== scenario.id) {+ throw new Error(`cassette scenario mismatch: ${cassette.scenario} != ${scenario.id}`);+ }+ const replay = await startReplay({ file: options.cassette, onStale: "throw" });+ let result: RepetitionResult;+ try {+ result = await runRepetition({+ scenario,+ rep: 0,+ endpoint: replay,+ store: offlineStore({+ baseUrl: replay.url,+ allowAgentEdits: scenario.allowAgentEdits ?? true,+ model: cassette.model,+ }),+ timeoutMs: options.timeoutMs,+ maxRetries: cassette.wireApi === "responses" ? 0 : undefined,+ });+ replay.assertFresh();+ } finally {+ replay.close();+ }+ const persisted = persistRepetition({+ label: options.label,+ result,+ prompt: scenario.prompt,+ allowAgentEdits: scenario.allowAgentEdits ?? true,+ });+ const receiptFile = `${RUNS_DIR}/${options.label}/${scenario.id}/replay-receipt.json`;+ const receipt = {+ schema: 1,+ kind: "offline-main-replay",+ label: options.label,+ scenario: scenario.id,+ cassette: options.cassette,+ fresh: replay.staleRounds.length === 0,+ upstreamRequests: 0,+ localReplayRequests: replay.requests.length,+ observedUsage: replay.servedRounds.map(({ round, terminalStatus, usage }) => ({+ round,+ terminalStatus,+ usage,+ })),+ result: normalizeIds({+ ok: result.run.ok,+ answer: result.run.answer,+ document: result.run.document ?? null,+ toolSequence: result.run.wire.calls.map((call) => ({+ id: call.id,+ name: call.name,+ args: call.args,+ resultJson: call.resultJson,+ resultOk: call.resultOk,+ })),+ }),+ };+ const payload = `${JSON.stringify(receipt, null, "\t")}\n`;+ if (containsSecret(payload)) throw new Error("replay receipt contains a secret");+ mkdirSync(dirname(receiptFile), { recursive: true });+ writeFileSync(receiptFile, payload, "utf8");+ log(`replay turn: ${persisted.file}`);+ log(`replay receipt: ${receiptFile}`);+ return result.run.ok ? 0 : 1;+}+/*** ponytail: la passe du juge tourne APRÈS le run, sur `workbench/runs/`, et pas* pendant le tour.@@ -316,8 +498,13 @@ async function commandJudge(options: Options): Promise<number> {}// En replay la clé n'est pas lue du tout : le proxy ne sort pas de 127.0.0.1.const env = options.replay ? null : requireLiveEnv();- if (env) log(`juge : modèle ${env.model} · endpoint ${env.baseUrl}`);- else log("juge : replay de cassettes, aucun appel sortant");+ if (env) {+ const provider = endpointIdentity("openai-compatible", env.baseUrl);+ log(+ `juge : modèle demandé ${env.model} · provider ${provider.provider} · ` ++ `endpoint sha ${provider.endpointSha256.slice(0, 12)}`,+ );+ } else log("juge : replay de cassettes, aucun appel sortant");const summaries: ScenarioReport[] = [];const notices: string[] = [];@@ -339,7 +526,15 @@ async function commandJudge(options: Options): Promise<number> {if ((scenario.judged ?? []).length === 0) continue;log(`\n▸ ${scenario.id} — ${(scenario.judged ?? []).length} check(s) jugé(s)`);- const cassetteFile = `${CASSETTES_DIR}/judge-${options.label}-${scenario.id}.json`;+ const candidateRunDir = `${RUNS_DIR}/${options.label}/${scenario.id}`;+ const recordedJudgeCassette = `${candidateRunDir}/judge-cassette.json`;+ const legacyJudgeCassette = `${CASSETTES_DIR}/judge-${options.label}-${scenario.id}.json`;+ const cassetteFile =+ env === null && cassetteExists(recordedJudgeCassette)+ ? recordedJudgeCassette+ : env !== null && options.record+ ? recordedJudgeCassette+ : legacyJudgeCassette;if (env === null && !cassetteExists(cassetteFile)) {// Nommé, comme `env.ts` nomme la variable manquante : sans cette ligne// le replay ressort en ENOENT sur un chemin que personne n'a tapé.@@ -348,11 +543,23 @@ async function commandJudge(options: Options): Promise<number> {}let replayHandle: ReplayHandle | null = null;let endpoint: ModelServerHandle;+ let judgeWireApi: "chat-completions" | "responses" = "chat-completions";try {if (env === null) {+ judgeWireApi = readCassette(cassetteFile).wireApi ?? "chat-completions";replayHandle = await startReplay({ file: cassetteFile });endpoint = replayHandle;} else {+ judgeWireApi = env.wireApi;+ const transport = transportIdentity({+ wireApi: env.wireApi,+ maxOutputTokens: options.maxOutputTokens ?? 2048,+ publicHeadersSha256: env.publicHeaders.sha256,+ limits: {+ maxRequests: options.maxRequests ?? 100,+ invocationTimeoutMs: options.timeoutMs,+ },+ });endpoint = await startRecorder({// Le proxy, pas le provider en direct — même règle que `runner.ts` :// c'est le seul endroit d'où une cassette peut sortir, et le seul@@ -362,6 +569,10 @@ async function commandJudge(options: Options): Promise<number> {scenario: `judge-${scenario.id}`,provider: "openai-compatible",model: env.model,+ wireApi: env.wireApi,+ transport,+ publicHeaders: env.publicHeaders,+ budget: createInvocationBudget(transport.limits),});}} catch (error) {@@ -374,7 +585,8 @@ async function commandJudge(options: Options): Promise<number> {failed = true;continue;}- const scored: Array<{ scored: ReturnType<typeof scoreRun> }> = [];+ const scored: Array<{ rep: number; scored: ReturnType<typeof scoreRun> }> = [];+ let scenarioWire: ReturnType<typeof readPersistedTurn>["wire"] | undefined;// ponytail: une panne reste une ERREUR — `askJudge` lève toujours sur un// transport mort, et c'est voulu : « le juge n'a pas répondu » n'est pas// « la réponse ne tranche pas ». Ce qui change est sa PORTÉE. Non bornée,@@ -386,6 +598,7 @@ async function commandJudge(options: Options): Promise<number> {for (const file of group.files) {const turn = readPersistedTurn(file);firstWire ??= turn.wire;+ scenarioWire ??= turn.wire;const context = contextFromPersistedTurn(turn);const readings = new Map<string, JudgeReading>();for (const judged of scenario.judged ?? []) {@@ -394,6 +607,7 @@ async function commandJudge(options: Options): Promise<number> {baseUrl: endpoint.url,model: env?.model ?? "cassette",...(env ? { apiKey: env.apiKey } : {}),+ wireApi: judgeWireApi,},rubric: judged.rubric,input: { prompt: turn.prompt, answer: turn.answer, facts: judged.facts(context) },@@ -402,7 +616,7 @@ async function commandJudge(options: Options): Promise<number> {readings.set(judged.id, reading);log(` rep ${turn.rep} ${judged.id} : ${reading.verdict} — ${reading.reason}`);}- scored.push({ scored: scoreRun(scenario, context, readings) });+ scored.push({ rep: turn.rep, scored: scoreRun(scenario, context, readings) });}} catch (error) {interrompu = error instanceof Error ? error.message : String(error);@@ -496,6 +710,39 @@ async function commandJudge(options: Options): Promise<number> {);log(` baseline écrite : ${baselineFile}`);}++ if (env && options.record && cassetteExists(`${candidateRunDir}/${CANDIDATE_FILE}`)) {+ try {+ const candidateReport = buildReport({+ label: `${options.label}/${scenario.id}/judge`,+ fingerprint: fingerprintOf({+ wire: scenarioWire,+ model: env.model,+ reps: scored.length,+ effectiveSourceSha256: captureSourceIdentity().effectiveSha256,+ }),+ scenarios: [summary],+ notices: notices.filter((notice) => notice.includes(`${scenario.id}/`)),+ });+ const prepared = finalizeJudgedMeasurementCandidate({+ runDir: candidateRunDir,+ scenario,+ scored,+ judgeCassetteFile: recordedJudgeCassette,+ report: candidateReport,+ requestedJudgeModel: env.model,+ observedJudgeModel: endpoint.resolvedModel,+ provider: "openai-compatible",+ endpoint: env.baseUrl,+ });+ log(` candidat de mesure jugé : ${prepared.file}`);+ } catch (error) {+ const message = `CANDIDAT INCOMPLET ${scenario.id} : ${error instanceof Error ? error.message : String(error)}`;+ notices.push(message);+ log(` ! ${message}`);+ failed = true;+ }+ }}if (summaries.length === 0) {@@ -540,6 +787,8 @@ function commandHelp(): number {""," wb:live [--scenario <id>] [--tag <tag>] [--reps <n>] [--label <nom>]"," [--timeout <ms>] [--update-baseline] [--record] [--no-persist]",+ " [--max-requests <n>] [--max-output-tokens <n>]",+ " replay --scenario <id> --cassette <path> --label <nom> [--timeout <ms>]"," wb:judge --label <nom> [--scenario <id>] [--record] [--replay]"," [--update-baseline]"," wb:compare <rapport-a.json> <rapport-b.json>",@@ -574,6 +823,9 @@ export async function main(): Promise<void> {case "run":code = await commandRun(options);break;+ case "replay":+ code = await commandReplay(options);+ break;case "judge":code = await commandJudge(options);break;diff --git a/workbench/l0/baseline.wb.ts b/workbench/l0/baseline.wb.tsnew file mode 100644index 000000000..269b9a462--- /dev/null+++ b/workbench/l0/baseline.wb.ts@@ -0,0 +1,40 @@+import { mkdtempSync, rmSync, writeFileSync } from "node:fs";+import { tmpdir } from "node:os";+import { join } from "node:path";+import { afterAll, describe, expect, it } from "vitest";+import { baselineBinding, baselineFromRun, readBaseline } from "../lib/baseline";++const DIRECTORY = mkdtempSync(join(tmpdir(), "wb-baseline-binding-"));++afterAll(() => rmSync(DIRECTORY, { recursive: true, force: true }));++describe("legacy baseline binding", () => {+ it("keeps historical check-id ratchets while labelling their numbers unbound", () => {+ const file = join(DIRECTORY, "legacy.json");+ writeFileSync(+ file,+ JSON.stringify({+ scenario: "legacy",+ expectedFailures: ["beh.known"],+ behaviour: 0.5,+ dsl: 1,+ recordedAt: "2026-07-31",+ }),+ "utf8",+ );+ const baseline = readBaseline(file);+ expect(baseline?.expectedFailures).toEqual(["beh.known"]);+ expect(baseline && baselineBinding(baseline)).toBe("legacy-unbound");+ });++ it("marks newly written check-id ratchets as legacy/unbound too", () => {+ const baseline = baselineFromRun({+ scenarioId: "probe",+ results: [],+ behaviour: 0.75,+ dsl: 1,+ now: new Date("2026-09-12T00:00:00Z"),+ });+ expect(baseline).toMatchObject({ schema: 1, binding: "legacy-unbound" });+ });+});diff --git a/workbench/l0/measurements.wb.ts b/workbench/l0/measurements.wb.tsnew file mode 100644index 000000000..3acd03064--- /dev/null+++ b/workbench/l0/measurements.wb.ts@@ -0,0 +1,623 @@+import { randomUUID } from "node:crypto";+import {+ mkdirSync,+ mkdtempSync,+ readFileSync,+ renameSync,+ rmSync,+ symlinkSync,+ writeFileSync,+} from "node:fs";+import { tmpdir } from "node:os";+import { dirname, join } from "node:path";+import { afterEach, describe, expect, it, vi } from "vitest";+import {+ type ArtifactReference,+ assertComparable,+ boundBaselineFromMeasurement,+ exportMeasurement,+ MeasurementError,+ type MeasurementManifest,+ type RecordedChecks,+ recomputeMeasurementCounts,+ verifyBoundBaseline,+ verifyMeasurementDirectory,+ verifyMeasurementId,+} from "../lib/measurement";+import {+ MANDATORY_SOURCE_ANCHORS,+ sha256Bytes,+ sourceIdentityFromManifests,+} from "../lib/provenance";+import { wilson95 } from "../lib/stats";+import { runMeasurementCli } from "../measurement-cli";++const roots: string[] = [];+const cliOutputs: string[] = [];+const HASH = (letter: string) => letter.repeat(64);++function writeJson(file: string, value: unknown): void {+ writeFileSync(file, `${JSON.stringify(value, null, "\t")}\n`, "utf8");+}++function testSourceIdentity() {+ return sourceIdentityFromManifests({+ commit: HASH("a").slice(0, 40),+ dirtyManifest: [],+ effectiveManifest: MANDATORY_SOURCE_ANCHORS.map((path) => ({+ path,+ kind: "text" as const,+ sha256: sha256Bytes(`test source ${path}\n`),+ })),+ });+}++function createCandidate(root: string): {+ runDir: string;+ measurementsDir: string;+ review: string;+ manifest: MeasurementManifest;+} {+ const runDir = join(root, "run");+ const measurementsDir = join(root, "measurements");+ mkdirSync(runDir, { recursive: true });+ const recorded: RecordedChecks = {+ schema: 1,+ scenarioId: "target-right-clip",+ complete: true,+ repetitions: [+ {+ rep: 0,+ checks: [+ {+ id: "beh.remove",+ axis: "behaviour",+ weight: 1,+ ok: true,+ indeterminate: false,+ },+ {+ id: "dsl.remove",+ axis: "dsl",+ weight: 3,+ ok: false,+ indeterminate: false,+ },+ ],+ },+ ],+ };+ const counts = recomputeMeasurementCounts(recorded);+ const source = testSourceIdentity();+ const fixture = {+ schema: 1,+ kind: "public-synthetic",+ scenarioId: "target-right-clip",+ generator: "workbench/scenarios/target-right-clip.scn.ts",+ documentSha256: HASH("b"),+ telemetrySha256: HASH("c"),+ };+ const report = {+ label: "test-only",+ createdAt: "2026-09-12T00:00:00.000Z",+ fingerprint: {+ systemSha256: HASH("d"),+ systemChars: 1,+ toolsSha256: HASH("e"),+ toolNames: [],+ model: "loopback-model",+ gitSha: "abc1234",+ gitDirty: true,+ effectiveSourceSha256: source.effectiveSha256,+ overlayId: null,+ reps: 1,+ },+ minDetectableEffect: 1,+ scenarios: [+ {+ scenarioId: "target-right-clip",+ title: "test",+ tags: [],+ gate: 0,+ reps: 1,+ behaviour: { ...wilson95(1, 1), rate: counts.axisScores.behaviour },+ dsl: { ...wilson95(0, 1), rate: counts.axisScores.dsl },+ gateScoreMean: 0,+ passRate: wilson95(0, 1),+ failureClasses: { NONE: 1 },+ checks: counts.checks.map((check) => ({+ id: check.id,+ axis: check.axis,+ weight: check.weight,+ passed: check.passed,+ total: check.total,+ indeterminate: check.indeterminate,+ wilson: wilson95(check.passed, check.decided),+ expected: false,+ evidence: [],+ })),+ unmeasuredAxes: [],+ msMean: 1,+ },+ ],+ notices: [],+ };+ const files: Array<{ name: string; role: ArtifactReference["role"]; value: unknown }> = [+ { name: "input-fixture.json", role: "input-fixture", value: fixture },+ {+ name: "main-cassette.json",+ role: "main-cassette",+ value: {+ scenario: "target-right-clip",+ provider: "loopback",+ model: "loopback-model",+ resolvedModel: "loopback-model",+ recordedAt: "2026-09-12",+ rounds: [+ {+ round: 0,+ requestHash: "0123456789abcdef",+ digest: { systemChars: 1, toolCount: 1, roles: ["user"], lastUserText: "test" },+ sse: "data: [DONE]\\n\\n",+ },+ ],+ },+ },+ { name: "recorded-checks.json", role: "recorded-checks", value: recorded },+ { name: "measurement-report.json", role: "report", value: report },+ ];+ const artifacts = files.map(({ name, role, value }) => {+ const file = join(runDir, name);+ writeJson(file, value);+ return { role, path: name, sha256: sha256Bytes(readFileSync(file)) };+ });+ const manifest: MeasurementManifest = {+ schema: 1,+ id: "candidate",+ createdAt: "2026-09-12T00:00:00.000Z",+ complete: true,+ scenario: { id: "target-right-clip", kind: "public-synthetic", judged: false },+ source,+ input: {+ fixtureSha256: artifacts[0].sha256,+ documentSha256: fixture.documentSha256,+ telemetrySha256: fixture.telemetrySha256,+ },+ fingerprints: {+ promptSha256: HASH("1"),+ systemSha256: HASH("d"),+ toolsSha256: HASH("e"),+ wireSha256: HASH("4"),+ rubricSha256: HASH("5"),+ },+ models: {+ agent: { requested: "loopback-model", observed: "loopback-model" },+ judge: { requested: "none", observed: "none" },+ },+ provider: { provider: "loopback", endpointSha256: HASH("6") },+ artifacts,+ results: counts,+ review: { disposition: "unreviewed", reviewerKind: "unknown" },+ };+ writeJson(join(runDir, "measurement-candidate.json"), manifest);+ const review = join(root, "review.json");+ writeJson(review, {+ schema: 1,+ measurementId: "valid-measurement",+ reviewer: { kind: "independent", label: "test fixture reviewer" },+ disposition: "approved",+ reviewedAt: "2026-09-12T00:10:00.000Z",+ summary: "Test-only review fixture for measurement mechanism validation.",+ });+ return { runDir, measurementsDir, review, manifest };+}++function root(): string {+ const value = mkdtempSync(join(tmpdir(), "wb-measurement-"));+ roots.push(value);+ return value;+}++function expectCode(action: () => unknown, code: string): void {+ try {+ action();+ throw new Error("expected measurement error");+ } catch (error) {+ expect(error).toBeInstanceOf(MeasurementError);+ expect((error as MeasurementError).code).toBe(code);+ }+}++function rewriteCandidate(runDir: string, change: (manifest: MeasurementManifest) => void): void {+ const file = join(runDir, "measurement-candidate.json");+ const manifest = JSON.parse(readFileSync(file, "utf8")) as MeasurementManifest;+ change(manifest);+ writeJson(file, manifest);+}++function exportValid(base: ReturnType<typeof createCandidate>): string {+ return exportMeasurement({+ runDir: base.runDir,+ id: "valid-measurement",+ reviewFile: base.review,+ measurementsDir: base.measurementsDir,+ });+}++afterEach(() => {+ for (const value of roots.splice(0)) rmSync(value, { recursive: true, force: true });+ for (const value of cliOutputs.splice(0)) rmSync(value, { recursive: true, force: true });+});++describe("versioned measurement export and verification", () => {+ it("recomputes the existing weighted axis mean while excluding indeterminate weight", () => {+ const checks = (heavyPasses: boolean) => [+ {+ id: "beh.light",+ axis: "behaviour" as const,+ weight: 1,+ ok: true,+ indeterminate: false,+ },+ {+ id: "beh.heavy",+ axis: "behaviour" as const,+ weight: 3,+ ok: heavyPasses,+ indeterminate: false,+ },+ {+ id: "beh.unread",+ axis: "behaviour" as const,+ weight: 10,+ ok: false,+ indeterminate: true,+ },+ {+ id: "dsl.complete",+ axis: "dsl" as const,+ weight: 2,+ ok: true,+ indeterminate: false,+ },+ ];+ const counts = recomputeMeasurementCounts({+ schema: 1,+ scenarioId: "weighted-probe",+ complete: true,+ repetitions: [+ { rep: 0, checks: checks(false) },+ { rep: 1, checks: checks(true) },+ ],+ });+ // Unweighted behaviour k/n is 3/4 = .75. Existing score semantics are+ // mean((1/4), (4/4)) = .625; the undecided weight 10 is in neither term.+ expect(counts.axes.behaviour).toEqual({+ passed: 3,+ decided: 4,+ indeterminate: 2,+ total: 6,+ });+ expect(counts.axisScores.behaviour).toBe(0.625);+ expect(counts.axisScores.dsl).toBe(1);+ });++ it("accepts the exact finite CLI argument shapes without reading environment configuration", async () => {+ const base = createCandidate(root());+ const id = `test-cli-${randomUUID()}`;+ writeJson(base.review, {+ schema: 1,+ measurementId: id,+ reviewer: { kind: "independent", label: "test fixture reviewer" },+ disposition: "approved",+ reviewedAt: "2026-09-12T00:10:00.000Z",+ summary: "Test-only review fixture for CLI validation.",+ });+ cliOutputs.push(join(process.cwd(), "workbench", "measurements", id));+ const output = vi.spyOn(process.stdout, "write").mockImplementation(() => true);+ const errors = vi.spyOn(process.stderr, "write").mockImplementation(() => true);+ try {+ expect(+ await runMeasurementCli([+ "export",+ "--run",+ base.runDir,+ "--id",+ id,+ "--review",+ base.review,+ ]),+ ).toBe(0);+ expect(await runMeasurementCli(["verify", "--id", id])).toBe(0);+ expect(+ await runMeasurementCli([+ "baseline",+ "--id",+ id,+ "--out",+ join(base.runDir, "bound-baseline.json"),+ ]),+ ).toBe(0);+ expect(await runMeasurementCli(["compare", "--left", id, "--right", id])).toBe(0);+ expect(await runMeasurementCli(["verify", "--left", "wrong"])).toBe(1);+ expect(errors).toHaveBeenCalledWith(expect.stringContaining("ARGUMENT_ERROR"));+ expect(output).toHaveBeenCalled();+ } finally {+ output.mockRestore();+ errors.mockRestore();+ }+ });++ it("atomically adopts an allowlisted candidate and refuses overwrite", () => {+ const base = createCandidate(root());+ const directory = exportValid(base);+ const verified = verifyMeasurementDirectory(directory, { requireApprovedReview: true });+ expect(verified.manifest.id).toBe("valid-measurement");+ expect(verified.manifest.review).toEqual({+ disposition: "approved",+ reviewerKind: "independent",+ });+ expectCode(() => exportValid(base), "DUPLICATE_MEASUREMENT");+ });++ it("rejects an invalid embedded id and a requested-folder id mismatch", () => {+ const invalid = createCandidate(root());+ const invalidDirectory = exportValid(invalid);+ const manifestFile = join(invalidDirectory, "measurement.json");+ const manifest = JSON.parse(readFileSync(manifestFile, "utf8")) as MeasurementManifest;+ manifest.id = "../not-portable";+ writeJson(manifestFile, manifest);+ expectCode(() => verifyMeasurementDirectory(invalidDirectory), "MEASUREMENT_ID_INVALID");++ const mismatch = createCandidate(root());+ const adopted = exportValid(mismatch);+ const requestedId = "requested-measurement";+ const renamed = join(mismatch.measurementsDir, requestedId);+ renameSync(adopted, renamed);+ expectCode(+ () => verifyMeasurementId(requestedId, mismatch.measurementsDir),+ "MEASUREMENT_ID_MISMATCH",+ );+ });++ it("rejects missing review, traversal, and unallowlisted roles", () => {+ const missing = createCandidate(root());+ expectCode(+ () =>+ exportMeasurement({+ runDir: missing.runDir,+ id: "valid-measurement",+ reviewFile: join(missing.runDir, "absent.json"),+ measurementsDir: missing.measurementsDir,+ }),+ "REVIEW_MISSING",+ );++ const traversal = createCandidate(root());+ rewriteCandidate(traversal.runDir, (manifest) => {+ manifest.artifacts[0].path = "../outside.json";+ });+ expectCode(() => exportValid(traversal), "ARTIFACT_PATH_INVALID");++ const role = createCandidate(root());+ rewriteCandidate(role.runDir, (manifest) => {+ (manifest.artifacts[0] as { role: string }).role = "raw-config";+ });+ expectCode(() => exportValid(role), "ARTIFACT_ROLE_INVALID");+ });++ it("rejects hash and recomputed count tampering", () => {+ const hash = createCandidate(root());+ writeFileSync(join(hash.runDir, "main-cassette.json"), "tampered\n", "utf8");+ expectCode(() => exportValid(hash), "ARTIFACT_HASH_MISMATCH");++ const counts = createCandidate(root());+ rewriteCandidate(counts.runDir, (manifest) => {+ manifest.results.axes.behaviour.passed = 0;+ });+ expectCode(() => exportValid(counts), "CHECK_COUNT_MISMATCH");+ expect(() =>+ readFileSync(join(counts.measurementsDir, "valid-measurement", "measurement.json")),+ ).toThrow();++ const source = createCandidate(root());+ rewriteCandidate(source.runDir, (manifest) => {+ manifest.source.effectiveManifest[0].sha256 = HASH("0");+ });+ expectCode(() => exportValid(source), "MANIFEST_INVALID");++ const legacy = createCandidate(root());+ rewriteCandidate(legacy.runDir, (manifest) => {+ manifest.source = {+ commit: manifest.source.commit,+ contentManifest: manifest.source.dirtyManifest,+ contentSha256: manifest.source.dirtySha256,+ } as unknown as typeof manifest.source;+ });+ expectCode(() => exportValid(legacy), "LEGACY_SOURCE_IDENTITY");+ });++ it("rejects fixture and report identity mismatches even when their artifact hashes are updated", () => {+ const fixture = createCandidate(root());+ const fixtureFile = join(fixture.runDir, "input-fixture.json");+ const fixtureValue = JSON.parse(readFileSync(fixtureFile, "utf8")) as {+ documentSha256: string;+ };+ fixtureValue.documentSha256 = HASH("9");+ writeJson(fixtureFile, fixtureValue);+ rewriteCandidate(fixture.runDir, (manifest) => {+ const ref = manifest.artifacts.find((entry) => entry.path === "input-fixture.json")!;+ ref.sha256 = sha256Bytes(readFileSync(fixtureFile));+ manifest.input.fixtureSha256 = ref.sha256;+ });+ expectCode(() => exportValid(fixture), "MANIFEST_INVALID");++ const report = createCandidate(root());+ const reportFile = join(report.runDir, "measurement-report.json");+ const reportValue = JSON.parse(readFileSync(reportFile, "utf8")) as {+ fingerprint: { model: string };+ };+ reportValue.fingerprint.model = "different-model";+ writeJson(reportFile, reportValue);+ rewriteCandidate(report.runDir, (manifest) => {+ manifest.artifacts.find((entry) => entry.path === "measurement-report.json")!.sha256 =+ sha256Bytes(readFileSync(reportFile));+ });+ expectCode(() => exportValid(report), "INCOMPATIBLE_IDENTITIES");++ const axis = createCandidate(root());+ const axisReportFile = join(axis.runDir, "measurement-report.json");+ const axisReport = JSON.parse(readFileSync(axisReportFile, "utf8")) as {+ scenarios: Array<{ behaviour: { rate: number } }>;+ };+ axisReport.scenarios[0].behaviour.rate = 0.5;+ writeJson(axisReportFile, axisReport);+ rewriteCandidate(axis.runDir, (manifest) => {+ manifest.artifacts.find((entry) => entry.path === "measurement-report.json")!.sha256 =+ sha256Bytes(readFileSync(axisReportFile));+ });+ expectCode(() => exportValid(axis), "AXIS_SCORE_MISMATCH");+ });++ it.each([+ ["Authorization: Bearer test-secret-value", "PRIVACY_SECRET"],+ ['{"note":"C:\\\\Users\\\\private\\\\fixture.json"}', "PRIVACY_PRIVATE_PATH"],+ ['{"transcript":"private words"}', "PRIVACY_TRANSCRIPT"],+ ['{"baseUrl":"https://private.invalid/v1"}', "PRIVACY_RAW_CONFIG"],+ ])("rejects unsafe exported material (%s)", (payload, code) => {+ const base = createCandidate(root());+ const file = join(base.runDir, "main-cassette.json");+ writeFileSync(file, payload, "utf8");+ rewriteCandidate(base.runDir, (manifest) => {+ manifest.artifacts.find((ref) => ref.path === "main-cassette.json")!.sha256 = sha256Bytes(+ readFileSync(file),+ );+ });+ expectCode(() => exportValid(base), code);+ });++ it("rejects a credential literal supplied by the caller even without a familiar prefix", () => {+ const base = createCandidate(root());+ const file = join(base.runDir, "main-cassette.json");+ const secret = "opaque-credential-literal-459";+ writeFileSync(file, `provider response ${secret}\n`, "utf8");+ rewriteCandidate(base.runDir, (manifest) => {+ manifest.artifacts.find((ref) => ref.path === "main-cassette.json")!.sha256 = sha256Bytes(+ readFileSync(file),+ );+ });+ expectCode(+ () =>+ exportMeasurement({+ runDir: base.runDir,+ id: "valid-measurement",+ reviewFile: base.review,+ measurementsDir: base.measurementsDir,+ knownSecrets: [secret],+ }),+ "PRIVACY_SECRET",+ );+ });++ it("rejects a symlink or junction artifact when the platform can create one", ({ skip }) => {+ const base = createCandidate(root());+ const outsideDirectory = join(dirname(base.runDir), "outside");+ mkdirSync(outsideDirectory);+ const outside = join(outsideDirectory, "outside.json");+ writeFileSync(outside, "{}\n", "utf8");+ const link = join(base.runDir, "linked");+ try {+ symlinkSync(outsideDirectory, link, process.platform === "win32" ? "junction" : "dir");+ } catch {+ skip();+ return;+ }+ rewriteCandidate(base.runDir, (manifest) => {+ manifest.artifacts[0] = {+ role: "input-fixture",+ path: "linked/outside.json",+ sha256: sha256Bytes(readFileSync(outside)),+ };+ });+ expectCode(() => exportValid(base), "SYMLINK_TRAVERSAL");+ });+});++describe("measurement identity and bound baseline", () => {+ it("recomputes weighted axis means while excluding indeterminate weight", () => {+ const counts = recomputeMeasurementCounts({+ schema: 1,+ scenarioId: "weighted-probe",+ complete: true,+ repetitions: [+ {+ rep: 0,+ checks: [+ { id: "beh.light", axis: "behaviour", weight: 1, ok: true, indeterminate: false },+ { id: "beh.heavy", axis: "behaviour", weight: 3, ok: false, indeterminate: false },+ { id: "beh.unknown", axis: "behaviour", weight: 9, ok: false, indeterminate: true },+ { id: "dsl.pass", axis: "dsl", weight: 2, ok: true, indeterminate: false },+ ],+ },+ ],+ });+ // Unweighted behaviour is 1/2; the existing weighted metric is 1/(1+3).+ expect(counts.axes.behaviour).toEqual({ passed: 1, decided: 2, indeterminate: 1, total: 3 });+ expect(counts.axisScores).toEqual({ behaviour: 0.25, dsl: 1 });+ expect(counts.checks.find((check) => check.id === "beh.unknown")?.weight).toBe(9);+ });++ it("refuses unknown or incompatible identities and never silently compares them", () => {+ const base = createCandidate(root());+ const left = base.manifest;+ const committed = structuredClone(left);+ committed.source = sourceIdentityFromManifests({+ commit: HASH("b").slice(0, 40),+ dirtyManifest: [left.source.effectiveManifest[0]],+ effectiveManifest: left.source.effectiveManifest,+ });+ expect(() => assertComparable(left, committed)).not.toThrow();+ const unknown = structuredClone(left);+ unknown.models.agent.observed = "unknown";+ expectCode(() => assertComparable(left, unknown), "IDENTITY_UNKNOWN");+ const changed = structuredClone(left);+ changed.input.documentSha256 = HASH("9");+ expectCode(() => assertComparable(left, changed), "INCOMPATIBLE_IDENTITIES");+ const legacy = structuredClone(left) as unknown as {+ source: unknown;+ };+ legacy.source = {+ commit: HASH("a").slice(0, 40),+ contentManifest: [],+ contentSha256: HASH("1"),+ };+ expectCode(+ () => assertComparable(legacy as unknown as typeof left, left),+ "LEGACY_SOURCE_IDENTITY",+ );+ });++ it("binds k/n to approved evidence and rejects a changed baseline summary", () => {+ const directory = exportValid(createCandidate(root()));+ const verified = verifyMeasurementDirectory(directory, { requireApprovedReview: true });+ const baseline = boundBaselineFromMeasurement(verified);+ expect(() => verifyBoundBaseline(baseline, verified)).not.toThrow();+ const changed = structuredClone(baseline);+ changed.counts.axes.dsl.decided += 1;+ expectCode(() => verifyBoundBaseline(changed, verified), "CHECK_COUNT_MISMATCH");+ const changedSource = structuredClone(baseline);+ changedSource.effectiveSourceSha256 = HASH("0");+ expectCode(() => verifyBoundBaseline(changedSource, verified), "SOURCE_IDENTITY_MISMATCH");+ expect(() => assertComparable(baseline.identity, verified.manifest)).not.toThrow();+ });++ it("never turns an explicit rejected review into baseline approval", () => {+ const base = createCandidate(root());+ const receipt = JSON.parse(readFileSync(base.review, "utf8")) as { disposition: string };+ receipt.disposition = "rejected";+ writeJson(base.review, receipt);+ const verified = verifyMeasurementDirectory(exportValid(base));+ expect(verified.review.disposition).toBe("rejected");+ expectCode(() => boundBaselineFromMeasurement(verified), "REVIEW_NOT_APPROVED");+ });+});diff --git a/workbench/l0/persist.wb.ts b/workbench/l0/persist.wb.tsindex 592086f27..699b17022 100644--- a/workbench/l0/persist.wb.ts+++ b/workbench/l0/persist.wb.ts@@ -32,8 +32,11 @@ import { getScenario } from "../scenarios/registry";const SYSTEM_TEXT = "You are OpenScreen's editing agent. Ten thousand characters, abridged.";const scenario = getScenario("describe-project");-function capturedRequests(options: { resultJson: string }): CapturedRequest[] {- const system = { role: "system", content: SYSTEM_TEXT };+function capturedRequests(options: {+ resultJson: string;+ instructionRole?: "system" | "developer";+}): CapturedRequest[] {+ const system = { role: options.instructionRole ?? "system", content: SYSTEM_TEXT };const user = { role: "user", content: scenario.prompt };const assistant = {role: "assistant",@@ -83,10 +86,12 @@ function repetition(options?: {resultJson?: string;document?: AxcutDocument;rep?: number;+ instructionRole?: "system" | "developer";}): RepetitionResult {const before = options?.document ?? twoClipsWithTrim();const requests = capturedRequests({resultJson: options?.resultJson ?? '{"trimRangeId":"trim_9"}',+ instructionRole: options?.instructionRole,});const wire = wireFromRequests(requests);const context = buildEvalContext({@@ -183,6 +188,22 @@ describe("persistRepetition", () => {expect(turn.wire.systemFile).toContain(turn.wire.systemSha256.slice(0, 12));});+ it("persists a developer instruction with its role and matching fingerprint", () => {+ const root = scratch();+ const written = persistRepetition({+ root,+ label: "developer-prompt",+ result: repetition({ instructionRole: "developer" }),+ prompt: scenario.prompt,+ allowAgentEdits: true,+ });+ const turn = readTurn(written.file);+ expect(turn.wire.instructionRoles).toEqual(["developer"]);+ expect(turn.wire.systemChars).toBe(SYSTEM_TEXT.length);+ expect(readFileSync(written.systemFile, "utf8")).toBe(`[developer]\n${SYSTEM_TEXT}`);+ expect(turn.wire.systemFile).toContain(turn.wire.systemSha256.slice(0, 12));+ });+it("bounds a tool result instead of writing a hundred kilobytes of it", () => {const huge = `{"segments":"${"x".repeat(MAX_FIELD_CHARS * 2)}"}`;const turn = buildPersistedTurn({diff --git a/workbench/l0/provenance.wb.ts b/workbench/l0/provenance.wb.tsnew file mode 100644index 000000000..3e7e1baa0--- /dev/null+++ b/workbench/l0/provenance.wb.ts@@ -0,0 +1,395 @@+import { execFileSync } from "node:child_process";+import { mkdirSync, mkdtempSync, readFileSync, rmSync, symlinkSync, writeFileSync } from "node:fs";+import { tmpdir } from "node:os";+import { dirname, join } from "node:path";+import { afterEach, describe, expect, it } from "vitest";+import { assertReplaySourceCompatible, MeasurementError } from "../lib/measurement";+import {+ captureSourceIdentity,+ endpointIdentity,+ isRelevantSourcePath,+ MANDATORY_SOURCE_ANCHORS,+ MINIMUM_SOURCE_ANCHORS,+ normalizeEndpoint,+ SourceIdentityError,+ sha256Bytes,+ sha256Canonical,+ validateSourceIdentity,+} from "../lib/provenance";++const roots: string[] = [];++function git(root: string, args: string[]): string {+ return execFileSync("git", args, { cwd: root, encoding: "utf8" }).trim();+}++function write(root: string, path: string, contents: string | Buffer): void {+ const file = join(root, ...path.split("/"));+ mkdirSync(dirname(file), { recursive: true });+ writeFileSync(file, contents);+}++function commit(root: string, message: string): string {+ git(root, ["add", "-A"]);+ git(root, [+ "-c",+ "user.name=Workbench",+ "-c",+ "[email protected]",+ "commit",+ "-m",+ message,+ "--quiet",+ ]);+ return git(root, ["rev-parse", "HEAD"]);+}++function expectReplaySourceMismatch(recorded: unknown, current: unknown): void {+ try {+ assertReplaySourceCompatible(recorded, current);+ throw new Error("expected replay source mismatch");+ } catch (error) {+ expect(error).toBeInstanceOf(MeasurementError);+ expect((error as MeasurementError).code).toBe("SOURCE_IDENTITY_MISMATCH");+ }+}++function seedRepository(): string {+ const root = mkdtempSync(join(tmpdir(), "wb-source-identity-"));+ roots.push(root);+ git(root, ["init", "--quiet"]);+ git(root, ["config", "core.autocrlf", "false"]);+ for (const path of MANDATORY_SOURCE_ANCHORS) write(root, path, `anchor ${path}\n`);+ for (const path of ["tsconfig.json", "tsconfig.node.json", "vitest.workbench.config.ts"]) {+ write(root, path, `config ${path}\n`);+ }+ commit(root, "seed source anchors");+ return root;+}++afterEach(() => {+ for (const root of roots.splice(0)) rmSync(root, { recursive: true, force: true });+});++describe("source relevance and endpoint identity", () => {+ it("uses the closed relevance predicate and retains its fourteen anchors", () => {+ expect(MINIMUM_SOURCE_ANCHORS).toBe(14);+ expect(MANDATORY_SOURCE_ANCHORS).toHaveLength(14);+ for (const anchor of MANDATORY_SOURCE_ANCHORS) expect(isRelevantSourcePath(anchor)).toBe(true);+ expect(isRelevantSourcePath("src/feature.tsx")).toBe(true);+ expect(isRelevantSourcePath("electron/native/helper.wasm")).toBe(true);+ expect(isRelevantSourcePath("workbench/lib/check.mts")).toBe(true);+ expect(isRelevantSourcePath("tsconfig.test.json")).toBe(false);+ expect(isRelevantSourcePath("workbench/l0/probe.ts")).toBe(false);+ expect(isRelevantSourcePath("workbench/l1/probe.ts")).toBe(false);+ expect(isRelevantSourcePath("workbench/baselines/probe.json")).toBe(false);+ expect(isRelevantSourcePath("workbench/docs/example.ts")).toBe(false);+ expect(isRelevantSourcePath("workbench/measurements/probe/measurement.json")).toBe(false);+ expect(isRelevantSourcePath("src/node_modules/pkg/index.ts")).toBe(false);+ expect(isRelevantSourcePath("src/generated.TS")).toBe(false);+ expect(isRelevantSourcePath("docs/example.ts")).toBe(false);+ });++ it.each(["workbench", "src", "electron"])("includes the %s source root", (root) => {+ expect(isRelevantSourcePath(`${root}/feature.ts`)).toBe(true);+ });++ it.each([+ ".ts",+ ".tsx",+ ".js",+ ".jsx",+ ".mjs",+ ".cjs",+ ".mts",+ ".cts",+ ".json",+ ".wasm",+ ])("includes the case-sensitive %s suffix", (suffix) => {+ expect(isRelevantSourcePath(`src/feature${suffix}`)).toBe(true);+ });++ it.each([+ "workbench/.build/probe.ts",+ "workbench/baselines/probe.json",+ "workbench/cassettes/probe.json",+ "workbench/docs/probe.ts",+ "workbench/fixtures/probe.json",+ "workbench/l0/probe.ts",+ "workbench/l1/probe.ts",+ "workbench/measurements/probe/measurement.json",+ "workbench/reports/probe.json",+ "workbench/runs/probe.json",+ "src/probe.test.ts",+ "src/probe.test.tsx",+ "src/probe.wb.ts",+ ])("excludes the non-runtime path %s", (path) => {+ expect(isRelevantSourcePath(path)).toBe(false);+ });++ it.each([+ "node_modules",+ "build",+ "target",+ "dist",+ "dist-electron",+ ".agent-evidence",+ "goal-runs",+ "__snapshots__",+ ])("excludes the %s path segment", (segment) => {+ expect(isRelevantSourcePath(`src/${segment}/probe.ts`)).toBe(false);+ });++ it("includes only the six exact root configuration files", () => {+ for (const path of [+ "package.json",+ "package-lock.json",+ "tsconfig.json",+ "tsconfig.node.json",+ "tsconfig.workbench.json",+ "vitest.workbench.config.ts",+ ]) {+ expect(isRelevantSourcePath(path)).toBe(true);+ }+ expect(isRelevantSourcePath("tsconfig.test.json")).toBe(false);+ expect(isRelevantSourcePath("vite.config.ts")).toBe(false);+ });++ it("normalizes origin/path while rejecting credentials, query, and fragment", () => {+ const raw = "HTTPS://Example.COM:443/v1//";+ expect(normalizeEndpoint(raw)).toBe("https://example.com/v1");+ const identity = endpointIdentity("openai-compatible", raw);+ expect(identity).toEqual({+ provider: "openai-compatible",+ endpointSha256: sha256Bytes("https://example.com/v1"),+ });+ expect(JSON.stringify(identity)).not.toContain("example.com");+ expect(() => normalizeEndpoint("https://user:[email protected]/v1")).toThrow(/credentials/);+ expect(() => normalizeEndpoint("https://example.com/v1?deployment=a")).toThrow(/query/);+ expect(() => normalizeEndpoint("https://example.com/v1#fragment")).toThrow(/fragment/);+ });+});++describe("effective source identity across commits and clones", () => {+ it("survives committing identical source, an artifact-only commit, and a local clone", () => {+ const root = seedRepository();+ const initial = captureSourceIdentity(root);+ write(root, "workbench/lib/runner.ts", "edited runner\r\nsecond line\r\n");+ write(root, "src/new-source.ts", "export const value = 1;\n");+ const dirty = captureSourceIdentity(root);+ expect(dirty.commit).toBe(initial.commit);+ expect(dirty.dirtyManifest.map((entry) => entry.path)).toEqual([+ "src/new-source.ts",+ "workbench/lib/runner.ts",+ ]);+ expect(dirty.effectiveSha256).not.toBe(initial.effectiveSha256);++ const sourceCommit = commit(root, "commit identical source bytes");+ const clean = captureSourceIdentity(root);+ expect(clean.commit).toBe(sourceCommit);+ expect(clean.commit).not.toBe(dirty.commit);+ expect(clean.dirtyManifest).toEqual([]);+ expect(clean.dirtySha256).not.toBe(dirty.dirtySha256);+ expect(clean.effectiveSha256).toBe(dirty.effectiveSha256);+ expect(clean.effectiveManifest).toEqual(dirty.effectiveManifest);+ expect(() => assertReplaySourceCompatible(dirty, clean)).not.toThrow();++ write(root, "workbench/measurements/m1/measurement.json", '{"schema":1}\n');+ const artifactCommit = commit(root, "add measurement evidence only");+ const withArtifact = captureSourceIdentity(root);+ expect(withArtifact.commit).toBe(artifactCommit);+ expect(withArtifact.commit).not.toBe(clean.commit);+ expect(withArtifact.effectiveSha256).toBe(clean.effectiveSha256);+ expect(() => assertReplaySourceCompatible(clean, withArtifact)).not.toThrow();+ write(root, "workbench/README.md", "documentation only\n");+ const docsCommit = commit(root, "add excluded documentation");+ const withDocs = captureSourceIdentity(root);+ expect(withDocs.commit).toBe(docsCommit);+ expect(withDocs.effectiveSha256).toBe(withArtifact.effectiveSha256);+ expect(() => assertReplaySourceCompatible(withArtifact, withDocs)).not.toThrow();++ const clone = `${root}-clone`;+ roots.push(clone);+ execFileSync("git", ["clone", "--quiet", root, clone]);+ const cloned = captureSourceIdentity(clone);+ expect(cloned.commit).toBe(withDocs.commit);+ expect(cloned.dirtyManifest).toEqual([]);+ expect(cloned.effectiveSha256).toBe(withDocs.effectiveSha256);+ expect(cloned.effectiveManifest).toEqual(withDocs.effectiveManifest);+ expect(() => assertReplaySourceCompatible(dirty, cloned)).not.toThrow();+ });++ it("changes effective identity for source additions, edits, deletions, and renames", () => {+ const root = seedRepository();+ const initial = captureSourceIdentity(root);+ write(root, "src/new-source.ts", "export const value = 1;\n");+ const added = captureSourceIdentity(root);+ expect(added.effectiveSha256).not.toBe(initial.effectiveSha256);+ expectReplaySourceMismatch(initial, added);+ commit(root, "add source");++ write(root, "electron/ai-edition/agent-tools.ts", "edited agent tools\n");+ const edited = captureSourceIdentity(root);+ expect(edited.effectiveSha256).not.toBe(added.effectiveSha256);+ expectReplaySourceMismatch(added, edited);+ git(root, ["checkout", "--", "electron/ai-edition/agent-tools.ts"]);++ git(root, ["mv", "src/new-source.ts", "src/renamed-source.ts"]);+ const renamed = captureSourceIdentity(root);+ expect(renamed.effectiveSha256).not.toBe(added.effectiveSha256);+ expectReplaySourceMismatch(added, renamed);+ expect(renamed.dirtyManifest.some((entry) => entry.kind === "deleted")).toBe(true);+ git(root, ["reset", "--hard", "HEAD"]);++ rmSync(join(root, "src", "new-source.ts"));+ const deleted = captureSourceIdentity(root);+ expect(deleted.effectiveSha256).not.toBe(added.effectiveSha256);+ expectReplaySourceMismatch(added, deleted);+ expect(deleted.dirtyManifest).toContainEqual({+ path: "src/new-source.ts",+ kind: "deleted",+ sha256: sha256Bytes("<deleted>\n"),+ });+ const deletionCommit = commit(root, "commit source deletion");+ const committedDeletion = captureSourceIdentity(root);+ expect(committedDeletion.commit).toBe(deletionCommit);+ expect(committedDeletion.dirtyManifest).toEqual([]);+ expect(committedDeletion.effectiveSha256).toBe(deleted.effectiveSha256);+ expect(() => assertReplaySourceCompatible(deleted, committedDeletion)).not.toThrow();+ });++ it("canonicalizes text line endings and hashes binary bytes raw", () => {+ const root = seedRepository();+ write(root, "src/line-endings.ts", "first\r\nsecond\r\n");+ write(root, "src/payload.wasm", Buffer.from([0x00, 0x0d, 0x0a]));+ const crlf = captureSourceIdentity(root);+ const binary = crlf.effectiveManifest.find((entry) => entry.path === "src/payload.wasm");+ expect(binary).toEqual({+ path: "src/payload.wasm",+ kind: "binary",+ sha256: sha256Bytes(Buffer.from([0x00, 0x0d, 0x0a])),+ });+ write(root, "src/line-endings.ts", "first\nsecond\n");+ expect(captureSourceIdentity(root).effectiveSha256).toBe(crlf.effectiveSha256);+ write(root, "src/payload.wasm", Buffer.from([0x00, 0x0a]));+ expect(captureSourceIdentity(root).effectiveSha256).not.toBe(crlf.effectiveSha256);+ });++ it("rejects malformed digests, missing anchors, legacy schema, and symlink traversal", ({+ skip,+ }) => {+ const root = seedRepository();+ const source = captureSourceIdentity(root);+ expect(() =>+ captureSourceIdentity(root, {+ readFile: (file) => {+ if (file.replace(/\\/g, "/").endsWith("workbench/lib/runner.ts")) {+ throw new Error("synthetic read denial");+ }+ return readFileSync(file);+ },+ }),+ ).toThrow(/runner\.ts is unreadable: synthetic read denial/);+ const badDigest = structuredClone(source);+ badDigest.effectiveSha256 = "0".repeat(64);+ expect(() => validateSourceIdentity(badDigest)).toThrow(/effectiveSha256/);+ const missingAnchor = structuredClone(source);+ missingAnchor.effectiveManifest = missingAnchor.effectiveManifest.slice(1);+ missingAnchor.effectiveSha256 = sha256Canonical(missingAnchor.effectiveManifest);+ expect(() => validateSourceIdentity(missingAnchor)).toThrow(/missing anchor/);+ const duplicate = structuredClone(source);+ duplicate.effectiveManifest.splice(1, 0, structuredClone(duplicate.effectiveManifest[0]));+ duplicate.effectiveSha256 = sha256Canonical(duplicate.effectiveManifest);+ expect(() => validateSourceIdentity(duplicate)).toThrow(/duplicated/);+ const caseFolded = structuredClone(source);+ const schemaAnchor = caseFolded.effectiveManifest.find(+ (entry) => entry.path === "src/lib/ai-edition/schema/index.ts",+ )!;+ caseFolded.effectiveManifest.push({+ ...schemaAnchor,+ path: "src/lib/ai-edition/schema/Index.ts",+ });+ caseFolded.effectiveManifest.sort((left, right) =>+ left.path < right.path ? -1 : left.path > right.path ? 1 : 0,+ );+ caseFolded.effectiveSha256 = sha256Canonical(caseFolded.effectiveManifest);+ expect(() => validateSourceIdentity(caseFolded)).toThrow(/duplicated/);+ const unsorted = structuredClone(source);+ unsorted.effectiveManifest.reverse();+ unsorted.effectiveSha256 = sha256Canonical(unsorted.effectiveManifest);+ expect(() => validateSourceIdentity(unsorted)).toThrow(/code-point order/);+ const nonportable = structuredClone(source);+ nonportable.effectiveManifest[0].path = "../escape.ts";+ nonportable.effectiveSha256 = sha256Canonical(nonportable.effectiveManifest);+ expect(() => validateSourceIdentity(nonportable)).toThrow(/not portable/);+ const invalidKind = structuredClone(source);+ invalidKind.effectiveManifest[0].kind = "deleted";+ invalidKind.effectiveSha256 = sha256Canonical(invalidKind.effectiveManifest);+ expect(() => validateSourceIdentity(invalidKind)).toThrow(/invalid source kind/);+ const malformedHash = structuredClone(source);+ malformedHash.effectiveManifest[0].sha256 = "not-a-hash";+ malformedHash.effectiveSha256 = sha256Canonical(malformedHash.effectiveManifest);+ expect(() => validateSourceIdentity(malformedHash)).toThrow(/invalid SHA256/);+ expect(() =>+ validateSourceIdentity({+ commit: source.commit,+ contentManifest: source.dirtyManifest,+ contentSha256: source.dirtySha256,+ }),+ ).toThrow(/legacy dirty-only/);+ expect(() =>+ validateSourceIdentity({+ ...source,+ contentManifest: source.dirtyManifest,+ contentSha256: source.dirtySha256,+ }),+ ).toThrow(/legacy dirty-only/);++ const outside = mkdtempSync(join(tmpdir(), "wb-source-outside-"));+ roots.push(outside);+ write(outside, "nested.ts", "outside source\n");+ const link = join(root, "src", "linked");+ try {+ symlinkSync(outside, link, process.platform === "win32" ? "junction" : "dir");+ } catch {+ skip();+ return;+ }+ expect(() => captureSourceIdentity(root)).toThrow(SourceIdentityError);+ });++ it("fails closed on an empty effective tree and a non-regular mandatory anchor", () => {+ const empty = mkdtempSync(join(tmpdir(), "wb-source-empty-"));+ roots.push(empty);+ git(empty, ["init", "--quiet"]);+ git(empty, ["config", "core.autocrlf", "false"]);+ write(empty, "README.md", "irrelevant\n");+ commit(empty, "irrelevant file only");+ expect(() => captureSourceIdentity(empty)).toThrow(/missing anchor/);++ const irregular = seedRepository();+ rmSync(join(irregular, "package.json"));+ mkdirSync(join(irregular, "package.json"));+ expect(() => captureSourceIdentity(irregular)).toThrow(/not a regular source file/);+ });++ it("refuses a relevant Git submodule instead of hashing through it", () => {+ const root = seedRepository();+ const submodule = mkdtempSync(join(tmpdir(), "wb-source-submodule-"));+ roots.push(submodule);+ git(submodule, ["init", "--quiet"]);+ git(submodule, ["config", "core.autocrlf", "false"]);+ write(submodule, "index.ts", "export const fromSubmodule = true;\n");+ commit(submodule, "seed local submodule");+ git(root, [+ "-c",+ "protocol.file.allow=always",+ "submodule",+ "add",+ "--quiet",+ submodule,+ "src/submodule",+ ]);+ expect(() => captureSourceIdentity(root)).toThrow(/submodule/);+ });+});diff --git a/workbench/l0/responses-wire.wb.ts b/workbench/l0/responses-wire.wb.tsnew file mode 100644index 000000000..8026f7bd9--- /dev/null+++ b/workbench/l0/responses-wire.wb.ts@@ -0,0 +1,316 @@+// L0 — native Responses requests are evidence in their own wire shape.+// These assertions intentionally inspect the request objects the provider saw:+// top-level instructions, role-preserving input, flat function schemas, and+// call_id-linked outputs. They do not exercise a live provider.++import { describe, expect, it } from "vitest";+import { hashRequest, hashResponsesRequest } from "../lib/cassette";+import type { CapturedRequest } from "../lib/model-server";+import { applyRequestPolicy, transportIdentity } from "../lib/transport";+import { systemTextOf, wireFromRequests } from "../lib/wire";++function request(round: number, body: unknown): CapturedRequest {+ return { round, systemChars: 0, toolNames: [], messages: [], raw: body };+}++const responsesTransport = transportIdentity({+ wireApi: "responses",+ maxOutputTokens: 2048,+});++describe("native Responses wire transcript", () => {+ it("keeps top-level instructions and input roles in priority order", () => {+ const topInstructions = "Top-level policy: preserve the document and use the supplied tools.";+ const systemText = "System policy from the input history.";+ const developerText = "Developer policy from the input history.";+ const wire = wireFromRequests([+ request(0, {+ model: "gpt-5-test",+ instructions: topInstructions,+ input: [+ { type: "message", role: "system", content: [{ type: "input_text", text: systemText }] },+ {+ type: "message",+ role: "developer",+ content: [{ type: "input_text", text: developerText }],+ },+ {+ type: "message",+ role: "user",+ content: [{ type: "input_text", text: "Apply the edit." }],+ },+ ],+ tools: [],+ }),+ ]);++ expect(wire.instructionMessages).toEqual([+ { role: "developer", blocks: [topInstructions] },+ { role: "system", blocks: [{ type: "input_text", text: systemText }] },+ { role: "developer", blocks: [{ type: "input_text", text: developerText }] },+ ]);+ expect(wire.systemBlocks).toEqual([+ topInstructions,+ { type: "input_text", text: systemText },+ { type: "input_text", text: developerText },+ ]);+ expect(wire.systemChars).toBe(`${topInstructions}\n${systemText}\n${developerText}`.length);+ expect(systemTextOf(wire)).toBe(+ `[developer]\n${topInstructions}\n[system]\n${systemText}\n[developer]\n${developerText}`,+ );+ expect(wire.instructionMessages?.map((message) => message.role)).toEqual([+ "developer",+ "system",+ "developer",+ ]);+ });++ it("reads flat Responses function schemas without a Chat wrapper", () => {+ const parameters = {+ type: "object",+ properties: {+ startSec: { type: "number" },+ endSec: { type: "number" },+ },+ required: ["startSec", "endSec"],+ };+ const wire = wireFromRequests([+ request(0, {+ input: [{ type: "message", role: "user", content: "Add a zoom." }],+ tools: [+ {+ type: "function",+ name: "addZoom",+ description: "Add a zoom segment.",+ parameters,+ },+ ],+ }),+ ]);++ expect(wire.toolsSent).toEqual([+ {+ name: "addZoom",+ description: "Add a zoom segment.",+ parameters,+ },+ ]);+ expect(wire.toolNames).toEqual(["addZoom"]);+ });++ it("pairs arguments and results by call_id, ignoring item_id", () => {+ const wire = wireFromRequests([+ request(0, {+ input: [{ type: "message", role: "user", content: "Make both edits." }],+ tools: [],+ }),+ request(1, {+ input: [+ {+ type: "function_call",+ id: "fc_item_a",+ item_id: "response_item_a",+ call_id: "call_a",+ name: "addZoom",+ arguments: '{"startSec":1,"endSec":2}',+ },+ {+ type: "function_call",+ id: "fc_item_b",+ item_id: "response_item_b",+ call_id: "call_b",+ name: "addZoom",+ arguments: '{"startSec":9,"endSec":10}',+ },+ ],+ }),+ request(2, {+ input: [+ // A real history repeats the function-call items. They must not+ // create a second call in the transcript.+ {+ type: "function_call",+ id: "fc_item_a",+ call_id: "call_a",+ name: "addZoom",+ arguments: '{"startSec":1,"endSec":2}',+ },+ {+ type: "function_call",+ id: "fc_item_b",+ call_id: "call_b",+ name: "addZoom",+ arguments: '{"startSec":9,"endSec":10}',+ },+ {+ type: "function_call_output",+ id: "output_item_for_b",+ item_id: "fc_item_a",+ call_id: "call_b",+ output: '{"zoomId":"zoom_b","startSec":9,"endSec":10}',+ },+ {+ type: "function_call_output",+ id: "output_item_for_a",+ item_id: "fc_item_b",+ call_id: "call_a",+ output: '{"zoomId":"zoom_a","startSec":1,"endSec":2}',+ },+ ],+ }),+ ]);++ expect(wire.calls).toHaveLength(2);+ expect(wire.calls.map((call) => call.id)).toEqual(["call_a", "call_b"]);+ expect(wire.calls[0]).toMatchObject({+ name: "addZoom",+ argsJson: '{"startSec":1,"endSec":2}',+ args: { startSec: 1, endSec: 2 },+ resultJson: '{"zoomId":"zoom_a","startSec":1,"endSec":2}',+ resultOk: true,+ mutating: true,+ });+ expect(wire.calls[1]).toMatchObject({+ args: { startSec: 9, endSec: 10 },+ resultJson: '{"zoomId":"zoom_b","startSec":9,"endSec":10}',+ resultOk: true,+ });+ });++ it("keeps malformed arguments and marks missing or failed results", () => {+ const wire = wireFromRequests([+ request(0, { input: [{ type: "message", role: "user", content: "Inspect the document." }] }),+ request(1, {+ input: [+ {+ type: "function_call",+ id: "fc_bad_args",+ call_id: "call_bad_args",+ name: "addZoom",+ arguments: "{not-json",+ },+ {+ type: "function_call",+ id: "fc_missing",+ call_id: "call_missing",+ name: "getCurrentDocument",+ arguments: "{}",+ },+ {+ type: "function_call",+ id: "fc_failed",+ call_id: "call_failed",+ name: "getCurrentDocument",+ arguments: "{}",+ },+ ],+ }),+ request(2, {+ input: [+ {+ type: "function_call_output",+ id: "out_failed",+ item_id: "fc_bad_args",+ call_id: "call_failed",+ output: '{"error":"synthetic tool failure"}',+ },+ ],+ }),+ ]);++ expect(wire.calls[0]).toMatchObject({+ argsJson: "{not-json",+ args: undefined,+ resultJson: undefined,+ resultOk: false,+ });+ expect(wire.calls[1]).toMatchObject({+ args: {},+ resultJson: undefined,+ resultOk: false,+ mutating: false,+ });+ expect(wire.calls[2]).toMatchObject({+ resultJson: '{"error":"synthetic tool failure"}',+ resultOk: false,+ });+ });+});++describe("Responses request fingerprints", () => {+ const body = {+ model: "gpt-5-test",+ instructions: "Keep edits bounded.",+ reasoning: { effort: "medium" },+ input: [+ { type: "message", role: "developer", content: "Use addZoom." },+ { type: "message", role: "user", content: "Zoom the clip." },+ {+ type: "function_call",+ id: "fc_00000000-0000-4000-8000-000000000001",+ call_id: "call_00000000-0000-4000-8000-000000000001",+ name: "addZoom",+ arguments: '{"startSec":1,"endSec":2}',+ },+ ],+ tools: [+ {+ type: "function",+ name: "addZoom",+ description: "Add a zoom.",+ parameters: { type: "object", properties: { startSec: { type: "number" } } },+ },+ ],+ };++ it("binds schema, role, and full effective request changes", () => {+ const inbound = { ...body, store: true, max_output_tokens: 1 };+ const effective = applyRequestPolicy(inbound, responsesTransport);+ const effectiveInput = effective.input as Array<Record<string, unknown>>;+ const effectiveTools = effective.tools as Array<Record<string, unknown>>;++ expect(effective).toEqual({ ...inbound, store: false, max_output_tokens: 2048 });+ expect(inbound.store).toBe(true);+ expect(hashResponsesRequest(effective)).not.toBe(hashResponsesRequest(inbound));+ expect(hashResponsesRequest(effective)).not.toBe(+ hashResponsesRequest({+ ...effective,+ input: effectiveInput.map((item) =>+ item.role === "developer" ? { ...item, role: "system" } : item,+ ),+ }),+ );+ expect(hashResponsesRequest(effective)).not.toBe(+ hashResponsesRequest({+ ...effective,+ tools: effectiveTools.map((tool) => ({+ ...tool,+ parameters: {+ ...(tool.parameters as Record<string, unknown>),+ additionalProperties: false,+ },+ })),+ }),+ );+ expect(hashResponsesRequest(effective)).not.toBe(+ hashResponsesRequest({ ...effective, max_output_tokens: 1025 }),+ );+ });++ it("keeps the historical Chat request hash compatible", () => {+ const legacy = {+ messages: [+ { role: "system", content: "legacy system" },+ { role: "user", content: "hello" },+ ],+ tools: [{ function: { name: "addZoom", description: "legacy description" } }],+ };+ const expected = "b9b440f97c5d361e";++ expect(hashRequest(legacy)).toBe(expected);+ expect(+ hashRequest({ ...legacy, model: "gpt-5-test", stream: true, max_output_tokens: 2048 }),+ ).toBe(expected);+ expect(hashResponsesRequest({ ...legacy, model: "gpt-5-test" })).not.toBe(expected);+ });+});diff --git a/workbench/l0/score.wb.ts b/workbench/l0/score.wb.tsindex f0aaa5db8..30f2ce0f1 100644--- a/workbench/l0/score.wb.ts+++ b/workbench/l0/score.wb.ts@@ -256,6 +256,8 @@ describe("baseline ratchet", () => {now: new Date("2026-07-31T12:00:00Z"),});expect(baseline).toEqual({+ schema: 1,+ binding: "legacy-unbound",scenario: "ratchet",expectedFailures: ["beh.known"],// Écrit même vide : « tout a été tranché » est une affirmation, et sondiff --git a/workbench/l0/stats-report.wb.ts b/workbench/l0/stats-report.wb.tsindex 7453eff95..5e26af0e8 100644--- a/workbench/l0/stats-report.wb.ts+++ b/workbench/l0/stats-report.wb.ts@@ -69,6 +69,7 @@ const FINGERPRINT = {model: "workbench-scripted",gitSha: "deadbee",gitDirty: true,+ effectiveSourceSha256: "c".repeat(64),overlayId: null,reps: 3,};@@ -123,6 +124,8 @@ describe("report rendering", () => {expect(markdown).toContain("8742 car.");expect(markdown).toContain("deadbee");expect(markdown).toContain("(dirty)");+ expect(markdown).toContain("effective source");+ expect(markdown).toContain("cccccccccccc");});it("labels a known failure as such and surfaces its evidence", () => {diff --git a/workbench/l0/transport-policy.wb.ts b/workbench/l0/transport-policy.wb.tsnew file mode 100644index 000000000..ff252ad42--- /dev/null+++ b/workbench/l0/transport-policy.wb.ts@@ -0,0 +1,354 @@+// L0 — transport policy is explicit, finite, and attributable to one env+// contract. These tests use synthetic values and pure helpers only; no provider+// or credential source is contacted.++import { describe, expect, it } from "vitest";+import { ENV_KEYS, hasLiveEnv, requireLiveEnv } from "../lib/env";+import {+ applyRequestPolicy,+ canonicalPublicHeaders,+ createInvocationBudget,+ DEFAULT_TRANSPORT_LIMITS,+ measurementTransportSha256,+ publicHeaderProfile,+ type TransportIdentity,+ type TransportLimits,+ transportIdentity,+ transportSha256,+} from "../lib/transport";++type EnvField = keyof typeof ENV_KEYS;+type EnvFixture = Partial<Record<EnvField, string>>;++const envFields: EnvField[] = ["apiKey", "baseUrl", "model", "wireApi", "userAgent", "originator"];++function withEnv<T>(values: EnvFixture, run: () => T): T {+ const names = Object.values(ENV_KEYS);+ const saved = new Map(names.map((name) => [name, process.env[name]]));+ for (const name of names) delete process.env[name];+ for (const [field, value] of Object.entries(values) as Array<[EnvField, string | undefined]>) {+ if (value !== undefined) process.env[ENV_KEYS[field]] = value;+ }+ try {+ return run();+ } finally {+ for (const name of names) {+ const value = saved.get(name);+ if (value === undefined) delete process.env[name];+ else process.env[name] = value;+ }+ }+}++function responseIdentity(+ publicHeadersSha256: string,+ limits: Partial<TransportLimits> = {},+): TransportIdentity {+ return transportIdentity({+ wireApi: "responses",+ maxOutputTokens: 2048,+ publicHeadersSha256,+ limits,+ });+}++function cloneIdentity(identity: TransportIdentity): TransportIdentity {+ return JSON.parse(JSON.stringify(identity)) as TransportIdentity;+}++describe("workbench environment contract", () => {+ it("uses the declared env fields and defaults to legacy Chat mode", () => {+ expect(Object.keys(ENV_KEYS)).toEqual(envFields);++ withEnv(+ {+ apiKey: "synthetic-l0-key",+ baseUrl: "http://127.0.0.1:4455/v1/",+ model: "gpt-5.6-luna",+ },+ () => {+ expect(hasLiveEnv()).toBe(true);+ expect(requireLiveEnv()).toMatchObject({+ model: "gpt-5.6-luna",+ baseUrl: "http://127.0.0.1:4455/v1",+ wireApi: "chat-completions",+ publicHeaders: { headers: {} },+ });+ },+ );+ });++ it("accepts an explicit Responses mode and trims its public headers", () => {+ withEnv(+ {+ apiKey: "synthetic-l0-key",+ baseUrl: "http://127.0.0.1:4455/v1",+ model: "gpt-5.6-luna",+ wireApi: "responses",+ userAgent: " public-agent/1 ",+ originator: " public-originator ",+ },+ () => {+ const env = requireLiveEnv();+ expect(env.wireApi).toBe("responses");+ expect(env.publicHeaders.headers).toEqual({+ "user-agent": "public-agent/1",+ originator: "public-originator",+ });+ expect(env.publicHeaders.sha256).toHaveLength(64);+ },+ );+ });++ it("fails closed for a missing required field or an unknown explicit mode", () => {+ withEnv({ apiKey: "synthetic-l0-key", baseUrl: "http://127.0.0.1:4455/v1" }, () => {+ expect(hasLiveEnv()).toBe(false);+ expect(() => requireLiveEnv()).toThrow();+ });++ withEnv(+ {+ apiKey: "synthetic-l0-key",+ baseUrl: "http://127.0.0.1:4455/v1",+ model: "gpt-5.6-luna",+ wireApi: "unknown-mode",+ },+ () => expect(() => requireLiveEnv()).toThrow(/chat-completions ou responses/),+ );+ });+});++describe("public header policy", () => {+ it("normalizes values, is key-order stable, and fingerprints the full profile", () => {+ const first = publicHeaderProfile({+ "User-Agent": " public-agent/1 ",+ Originator: "public-originator",+ });+ const second = publicHeaderProfile({+ originator: "public-originator",+ "user-agent": "public-agent/1",+ });++ expect(first.headers).toEqual({+ "user-agent": "public-agent/1",+ originator: "public-originator",+ });+ expect(first.sha256).toBe(second.sha256);+ expect(canonicalPublicHeaders(first.headers)).toBe(canonicalPublicHeaders(second.headers));+ expect(+ publicHeaderProfile({ "user-agent": "public-agent/2", originator: "public-originator" })+ .sha256,+ ).not.toBe(first.sha256);+ });++ it("rejects duplicate, unsupported, empty, oversized, and control-character headers", () => {+ expect(() => publicHeaderProfile({ "User-Agent": "one", "user-agent": "two" })).toThrow(+ /duplicate/,+ );+ expect(() => publicHeaderProfile({ "x-test": "value" })).toThrow(/unsupported/);+ expect(() => publicHeaderProfile({ "user-agent": " " })).toThrow(/invalid public header value/);+ expect(() => publicHeaderProfile({ "user-agent": "a".repeat(257) })).toThrow(+ /invalid public header value/,+ );+ for (const value of ["line\rbreak", "line\nbreak", `line${String.fromCharCode(0)}break`]) {+ expect(() => publicHeaderProfile({ "user-agent": value })).toThrow(+ /invalid public header value/,+ );+ }+ });+});++describe("transport identity and request policy", () => {+ it("records the native Responses path, policy, retries, and all configured limits", () => {+ const headers = publicHeaderProfile({ "user-agent": "public-agent/1" });+ const identity = responseIdentity(headers.sha256, {+ maxRequests: 6,+ maxRequestBytes: 64 * 1024,+ maxResponseBytes: 1024 * 1024,+ requestTimeoutMs: 60_000,+ invocationTimeoutMs: 180_000,+ });++ expect(identity).toMatchObject({+ schema: 1,+ wireApi: "responses",+ inboundPaths: ["/responses", "/v1/responses"],+ upstreamPathSuffix: "/responses",+ requestPolicy: {+ store: false,+ maxOutputField: "max_output_tokens",+ maxOutputTokens: 2048,+ reasoning: { effort: "medium" },+ },+ retryPolicy: { sdkMaxRetries: 0, repetitionRetries: 0 },+ limits: {+ maxRequests: 6,+ maxRequestBytes: 64 * 1024,+ maxResponseBytes: 1024 * 1024,+ requestTimeoutMs: 60_000,+ invocationTimeoutMs: 180_000,+ },+ publicHeadersSha256: headers.sha256,+ });+ });++ it("applies store, output, and reasoning policy without mutating the inbound body", () => {+ const identity = responseIdentity(publicHeaderProfile({}).sha256);+ const inbound: Record<string, unknown> = {+ model: "gpt-5.6-luna",+ input: [{ type: "message", role: "user", content: "Zoom the clip." }],+ reasoning: { effort: "medium" },+ store: true,+ max_output_tokens: 1,+ };++ const effective = applyRequestPolicy(inbound, identity);+ expect(effective).toEqual({ ...inbound, store: false, max_output_tokens: 2048 });+ expect(inbound).toEqual({+ model: "gpt-5.6-luna",+ input: [{ type: "message", role: "user", content: "Zoom the clip." }],+ reasoning: { effort: "medium" },+ store: true,+ max_output_tokens: 1,+ });+ expect(() =>+ applyRequestPolicy({ ...inbound, reasoning: { effort: "low" } }, identity),+ ).toThrow(/reasoning policy mismatch/);+ });++ it("changes the transport fingerprint for every material protocol or policy field", () => {+ const headers = publicHeaderProfile({+ "user-agent": "public-agent/1",+ originator: "public-originator",+ });+ const identity = responseIdentity(headers.sha256, {+ maxRequests: 6,+ maxRequestBytes: 64 * 1024,+ maxResponseBytes: 1024 * 1024,+ requestTimeoutMs: 60_000,+ invocationTimeoutMs: 180_000,+ });+ const baseline = transportSha256(identity);++ const protocol = transportIdentity({+ wireApi: "chat-completions",+ publicHeadersSha256: headers.sha256,+ });+ expect(transportSha256(protocol)).not.toBe(baseline);++ const mutations: Array<[string, (value: TransportIdentity) => void]> = [+ ["inbound path", (value) => (value.inboundPaths[0] = "/responses-v2")],+ ["upstream path", (value) => (value.upstreamPathSuffix = "/responses-v2")],+ ["store policy", (value) => (value.requestPolicy.store = "unchanged")],+ ["output field policy", (value) => (value.requestPolicy.maxOutputField = "unchanged")],+ ["output token policy", (value) => (value.requestPolicy.maxOutputTokens = 1025)],+ ["reasoning policy", (value) => (value.requestPolicy.reasoning = "unchanged")],+ ["SDK retry policy", (value) => (value.retryPolicy.sdkMaxRetries = 1)],+ ["repetition retry policy", (value) => (value.retryPolicy.repetitionRetries = 1)],+ [+ "public header profile",+ (value) =>+ (value.publicHeadersSha256 = publicHeaderProfile({+ "user-agent": "public-agent/2",+ originator: "public-originator",+ }).sha256),+ ],+ ];++ for (const [label, mutate] of mutations) {+ const changed = cloneIdentity(identity);+ mutate(changed);+ expect(transportSha256(changed), label).not.toBe(baseline);+ }++ const budgetFields: Array<keyof TransportLimits> = [+ "maxRequests",+ "maxRequestBytes",+ "maxResponseBytes",+ "requestTimeoutMs",+ "invocationTimeoutMs",+ ];+ for (const field of budgetFields) {+ const changed = cloneIdentity(identity);+ changed.limits[field] += 1;+ expect(transportSha256(changed), field).not.toBe(baseline);+ }++ expect(transportSha256(identity)).toHaveLength(64);+ });++ it("binds agent order and the optional judge profile into the measurement fingerprint", () => {+ const headers = publicHeaderProfile({}).sha256;+ const agent = responseIdentity(headers);+ const secondAgent = responseIdentity(headers, { maxRequests: 7 });+ const judge = transportIdentity({ wireApi: "responses", maxOutputTokens: 512 });++ const noJudge = measurementTransportSha256([agent], "no-judge");+ expect(noJudge).toBe(measurementTransportSha256([cloneIdentity(agent)], "no-judge"));+ expect(measurementTransportSha256([agent], judge)).not.toBe(noJudge);+ expect(measurementTransportSha256([agent, secondAgent], "no-judge")).not.toBe(+ measurementTransportSha256([secondAgent, agent], "no-judge"),+ );+ });+});++describe("transport validation and invocation budget", () => {+ it("rejects every non-positive or non-integer configured limit", () => {+ const invalidValues = [0, -1, 1.5, Number.NaN, Number.POSITIVE_INFINITY];+ const fields: Array<keyof TransportLimits> = [+ "maxRequests",+ "maxRequestBytes",+ "maxResponseBytes",+ "requestTimeoutMs",+ "invocationTimeoutMs",+ ];++ for (const field of fields) {+ for (const value of invalidValues) {+ const limits = { [field]: value } as Partial<TransportLimits>;+ expect(() =>+ transportIdentity({ wireApi: "responses", maxOutputTokens: 1, limits }),+ ).toThrow(field);+ }+ }++ for (const value of [...invalidValues, undefined] as Array<number | undefined>) {+ expect(() => transportIdentity({ wireApi: "responses", maxOutputTokens: value })).toThrow(+ /positive maxOutputTokens/,+ );+ }+ });++ it("shares one request budget and aborts all currently tracked requests", () => {+ const limits: TransportLimits = {+ ...DEFAULT_TRANSPORT_LIMITS,+ maxRequests: 2,+ maxRequestBytes: 4,+ requestTimeoutMs: 10_000,+ invocationTimeoutMs: 30_000,+ };+ const budget = createInvocationBudget(limits);++ expect(budget.reserveRequest(4)).toBe(1);+ expect(() => budget.reserveRequest(5)).toThrow(/exceeds 4/);+ expect(budget.requestCount).toBe(1);+ expect(budget.reserveRequest(1)).toBe(2);+ expect(() => budget.reserveRequest(1)).toThrow(/budget exhausted at 2/);+ expect(budget.requestCount).toBe(2);++ const active = new AbortController();+ const released = new AbortController();+ const releaseActive = budget.track(active);+ const releaseReleased = budget.track(released);+ releaseReleased();+ budget.abort();+ expect(active.signal.aborted).toBe(true);+ expect(released.signal.aborted).toBe(false);+ releaseActive();++ const later = new AbortController();+ budget.track(later);+ budget.abort();+ expect(later.signal.aborted).toBe(true);+ });+});diff --git a/workbench/l0/wire.wb.ts b/workbench/l0/wire.wb.tsindex 34bd9c783..7a4f78955 100644--- a/workbench/l0/wire.wb.ts+++ b/workbench/l0/wire.wb.ts@@ -2,10 +2,11 @@// path, so it is tested against hand-built request logs that reproduce the// shapes the provider actually sees.+import { createHash } from "node:crypto";import { describe, expect, it } from "vitest";import { modelFromSse } from "../lib/cassette";import type { CapturedRequest } from "../lib/model-server";-import { transcriptFromSse, wireFromRequests } from "../lib/wire";+import { systemTextOf, transcriptFromSse, wireFromRequests } from "../lib/wire";function request(round: number, body: unknown): CapturedRequest {return { round, systemChars: 0, toolNames: [], messages: [], raw: body };@@ -39,6 +40,69 @@ describe("wireFromRequests", () => {]);expect(wire.systemBlocks).toEqual(["flat"]);expect(wire.systemChars).toBe(4);+ expect(wire.instructionMessages).toEqual([{ role: "system", blocks: ["flat"] }]);+ expect(systemTextOf(wire)).toBe("flat");+ expect(wire.systemSha256).toBe(createHash("sha256").update("flat").digest("hex"));+ });++ it("fingerprints and persists a developer-only high-priority prompt", () => {+ const prompt = "d".repeat(3_840);+ const wire = wireFromRequests([+ request(0, {+ messages: [+ { role: "developer", content: prompt },+ { role: "user", content: "preview this request" },+ ],+ tools: [],+ }),+ ]);+ expect(wire.systemBlocks).toEqual([prompt]);+ expect(wire.instructionMessages).toEqual([{ role: "developer", blocks: [prompt] }]);+ expect(wire.systemChars).toBe(3_840);+ expect(systemTextOf(wire)).toBe(`[developer]\n${prompt}`);+ expect(wire.systemSha256).toBe(+ createHash("sha256").update(`[developer]\n${prompt}`).digest("hex"),+ );+ expect(wire.systemSha256).not.toBe(createHash("sha256").update("").digest("hex"));+ });++ it("binds mixed system/developer order, roles, blocks, and content changes", () => {+ const mixed = (developerText: string) =>+ wireFromRequests([+ request(0, {+ messages: [+ { role: "system", content: "system root" },+ { role: "user", content: "ignored for this fingerprint" },+ {+ role: "developer",+ content: [+ { type: "text", text: developerText },+ { type: "text", text: "second block" },+ ],+ },+ ],+ tools: [],+ }),+ ]);+ const first = mixed("developer rules");+ const changed = mixed("changed developer rules");+ expect(first.systemBlocks).toEqual([+ "system root",+ { type: "text", text: "developer rules" },+ { type: "text", text: "second block" },+ ]);+ expect(first.systemChars).toBe("system root\ndeveloper rules\nsecond block".length);+ expect(systemTextOf(first)).toBe(+ "[system]\nsystem root\n[developer]\ndeveloper rules\nsecond block",+ );+ expect(changed.systemSha256).not.toBe(first.systemSha256);+ const sameTextAsSystem = wireFromRequests([+ request(0, { messages: [{ role: "system", content: "developer rules" }], tools: [] }),+ ]);+ const sameTextAsDeveloper = wireFromRequests([+ request(0, { messages: [{ role: "developer", content: "developer rules" }], tools: [] }),+ ]);+ expect(sameTextAsDeveloper.systemSha256).not.toBe(sameTextAsSystem.systemSha256);});it("records the whole tool surface verbatim, whatever is on it", () => {diff --git a/workbench/l1/cassette.wb.ts b/workbench/l1/cassette.wb.tsindex 511660f1e..73f5aac70 100644--- a/workbench/l1/cassette.wb.ts+++ b/workbench/l1/cassette.wb.ts@@ -7,10 +7,18 @@// answering a question the app no longer asks.import { mkdtempSync, rmSync } from "node:fs";+import { createServer } from "node:http";import { tmpdir } from "node:os";import { join } from "node:path";import { afterAll, describe, expect, it } from "vitest";-import { readCassette, startRecorder, startReplay, writeCassette } from "../lib/cassette";+import {+ hashRequest,+ readCassette,+ startRecorder,+ startReplay,+ usageFromSse,+ writeCassette,+} from "../lib/cassette";import { ENV_KEYS } from "../lib/env";import { singleClip } from "../lib/fixtures";import { normalizeIds, runScenario } from "../lib/harness";@@ -18,8 +26,34 @@ import { startScriptedModel } from "../lib/model-server";const DIRECTORY = mkdtempSync(join(tmpdir(), "wb-cassette-"));const FILE = join(DIRECTORY, "wizard.json");+const USAGE_FILE = join(DIRECTORY, "usage.json");const PROMPT = "enhance this recording";+async function startRawProvider(options: {+ sse: string;+ onRequest: (body: string) => void;+}): Promise<{ url: string; close: () => void }> {+ const server = createServer((req, res) => {+ let body = "";+ req.on("data", (chunk) => {+ body += chunk;+ });+ req.on("end", () => {+ options.onRequest(body);+ res.writeHead(200, { "content-type": "text/event-stream" });+ res.end(options.sse);+ });+ });++ await new Promise<void>((resolve) => server.listen(0, "127.0.0.1", resolve));+ const address = server.address();+ if (!address || typeof address === "string") throw new Error("raw provider has no address");+ return {+ url: `http://127.0.0.1:${address.port}`,+ close: () => server.close(),+ };+}+afterAll(() => rmSync(DIRECTORY, { recursive: true, force: true }));async function record() {@@ -153,4 +187,306 @@ describe("record then replay", () => {}expect(() => replay.assertFresh()).toThrow(/périmée aux rounds/);});++ it("records final usage while preserving the request and raw SSE", async () => {+ const requestBody = JSON.stringify({+ model: "fake-upstream",+ stream: true,+ messages: [{ role: "user", content: "usage probe" }],+ });+ const firstUsage = {+ prompt_tokens: 4,+ completion_tokens: 2,+ total_tokens: 6,+ prompt_tokens_details: { cached_tokens: 2 },+ prompt_cache_hit_tokens: 2,+ prompt_cache_miss_tokens: 2,+ };+ const finalUsage = {+ prompt_tokens: 12,+ completion_tokens: 7,+ total_tokens: 19,+ prompt_tokens_details: { cached_tokens: 8 },+ completion_tokens_details: { reasoning_tokens: 3 },+ prompt_cache_hit_tokens: 8,+ prompt_cache_miss_tokens: 4,+ provider_detail: { trace: "preserved" },+ };+ const sse = [+ `data: ${JSON.stringify({ id: "usage-null", usage: null })}\n\n`,+ `data: ${JSON.stringify({ id: "usage-first", usage: firstUsage })}\n\n`,+ "data: {malformed\n\n",+ `data: ${JSON.stringify({ id: "usage-array", usage: [] })}\n\n`,+ `data: ${JSON.stringify({ id: "usage-final", usage: finalUsage })}\n\n`,+ "data: [DONE]\n\n",+ `data: ${JSON.stringify({ id: "after-done", usage: { prompt_tokens: 999 } })}\n\n`,+ ].join("");+ let receivedBody = "";+ const upstream = await startRawProvider({+ sse,+ onRequest: (body) => {+ receivedBody = body;+ },+ });+ const recorder = await startRecorder({+ upstream: upstream.url,+ file: USAGE_FILE,+ scenario: "usage-probe",+ provider: "openai-compatible",+ model: "fake-upstream",+ });+ try {+ const response = await fetch(`${recorder.url}/chat/completions`, {+ method: "POST",+ headers: { "content-type": "application/json" },+ body: requestBody,+ });+ expect(response.status).toBe(200);+ expect(await response.text()).toBe(sse);+ } finally {+ recorder.close();+ upstream.close();+ }++ expect(receivedBody).toBe(requestBody);+ const cassette = readCassette(USAGE_FILE);+ expect(cassette.rounds).toHaveLength(1);+ expect(cassette.rounds[0].sse).toBe(sse);+ expect(cassette.rounds[0].usage).toEqual(finalUsage);+ });++ it("records and replays usage across sixty rounds", async () => {+ let upstreamRound = 0;+ const upstream = createServer((_req, res) => {+ const round = upstreamRound;+ upstreamRound += 1;+ const usage = {+ prompt_tokens: round + 1,+ completion_tokens: 2,+ total_tokens: round + 3,+ };+ res.writeHead(200, { "content-type": "text/event-stream" });+ res.end(+ `data: ${JSON.stringify({ id: `usage-${round}`, model: "usage-model", usage })}\n\n` ++ "data: [DONE]\n\n",+ );+ });+ await new Promise<void>((resolve) => upstream.listen(0, "127.0.0.1", resolve));+ const address = upstream.address();+ if (!address || typeof address === "string") throw new Error("usage upstream has no address");+ const file = join(DIRECTORY, "usage-60.json");+ const recorder = await startRecorder({+ upstream: `http://127.0.0.1:${address.port}`,+ file,+ scenario: "usage-60",+ provider: "loopback",+ model: "usage-model",+ });+ const bodies = Array.from({ length: 60 }, (_, round) =>+ JSON.stringify({+ model: "usage-model",+ messages: [{ role: "user", content: `round ${round}` }],+ }),+ );+ try {+ for (const body of bodies) {+ const response = await fetch(`${recorder.url}/chat/completions`, {+ method: "POST",+ headers: { "content-type": "application/json" },+ body,+ });+ expect(response.status).toBe(200);+ await response.text();+ }+ } finally {+ recorder.close();+ upstream.close();+ }+ const cassette = readCassette(file);+ expect(cassette.rounds).toHaveLength(60);+ expect(cassette.rounds[0].usage).toEqual({+ prompt_tokens: 1,+ completion_tokens: 2,+ total_tokens: 3,+ });+ expect(cassette.rounds[59].usage).toEqual({+ prompt_tokens: 60,+ completion_tokens: 2,+ total_tokens: 62,+ });++ const replay = await startReplay({ file, onStale: "throw" });+ try {+ for (const body of bodies) {+ const response = await fetch(`${replay.url}/chat/completions`, {+ method: "POST",+ headers: { "content-type": "application/json" },+ body,+ });+ expect(response.status).toBe(200);+ await response.text();+ }+ } finally {+ replay.close();+ }+ expect(replay.staleRounds).toEqual([]);+ expect(() => replay.assertFresh()).not.toThrow();+ });++ it("records developer prompt length in proxy and upstream request digests", async () => {+ const prompt = "d".repeat(3_840);+ const body = {+ model: "workbench",+ messages: [+ { role: "developer", content: prompt },+ { role: "user", content: "preview" },+ ],+ };+ const upstream = await startScriptedModel([{ kind: "text", text: "done" }]);+ const file = join(DIRECTORY, "developer-prompt.json");+ const recorder = await startRecorder({+ upstream: upstream.url,+ file,+ scenario: "developer-prompt",+ provider: "loopback",+ model: "workbench",+ });+ try {+ const response = await fetch(`${recorder.url}/chat/completions`, {+ method: "POST",+ headers: { "content-type": "application/json" },+ body: JSON.stringify(body),+ });+ expect(response.status).toBe(200);+ await response.text();+ } finally {+ recorder.close();+ upstream.close();+ }+ expect(readCassette(file).rounds[0].digest).toMatchObject({+ systemChars: 3_840,+ roles: ["developer", "user"],+ });+ expect(upstream.requests[0].systemChars).toBe(3_840);+ expect(+ hashRequest({ ...body, messages: [{ role: "developer", content: `${prompt}!` }] }),+ ).not.toBe(hashRequest(body));+ });++ it("keeps an existing system-only cassette request fresh", async () => {+ const body = {+ model: "legacy",+ messages: [+ { role: "system", content: "legacy system prompt" },+ { role: "user", content: "legacy user prompt" },+ ],+ tools: [],+ };+ const file = join(DIRECTORY, "legacy-system-only.json");+ writeCassette(file, {+ scenario: "legacy-system-only",+ provider: "loopback",+ model: "legacy",+ recordedAt: "2026-07-31T00:00:00.000Z",+ rounds: [+ {+ round: 0,+ requestHash: hashRequest(body),+ digest: {+ systemChars: "legacy system prompt".length,+ toolCount: 0,+ roles: ["system", "user"],+ lastUserText: "legacy user prompt",+ },+ sse: "data: [DONE]\n\n",+ },+ ],+ });+ const replay = await startReplay({ file, onStale: "throw" });+ try {+ const response = await fetch(`${replay.url}/chat/completions`, {+ method: "POST",+ headers: { "content-type": "application/json" },+ body: JSON.stringify(body),+ });+ expect(response.status).toBe(200);+ await response.text();+ } finally {+ replay.close();+ }+ expect(replay.staleRounds).toEqual([]);+ expect(() => replay.assertFresh()).not.toThrow();+ });++ it("leaves usage unknown when no valid object appears", () => {+ const sse = [+ `data: ${JSON.stringify({ usage: null })}\n\n`,+ `data: ${JSON.stringify({ usage: [] })}\n\n`,+ "data: {malformed\n\n",+ "data: [DONE]\n\n",+ ].join("");+ expect(usageFromSse(sse)).toBeUndefined();+ });++ it("parses usage from CRLF data lines without a separator space", () => {+ const usage = { prompt_tokens: 3, completion_tokens: 2, total_tokens: 5 };+ const sse = [`data:${JSON.stringify({ usage })}\r\n\r\n`, "data:[DONE]\r\n\r\n"].join("");+ expect(usageFromSse(sse)).toEqual(usage);+ });++ it("refuses an upstream redirect without forwarding the prompt to the new origin", async () => {+ let targetCalls = 0;+ const target = createServer((_req, res) => {+ targetCalls += 1;+ res.writeHead(200, { "content-type": "text/event-stream" });+ res.end("data: [DONE]\n\n");+ });+ await new Promise<void>((resolve) => target.listen(0, "127.0.0.1", resolve));+ const targetAddress = target.address();+ if (!targetAddress || typeof targetAddress === "string")+ throw new Error("target has no address");++ const redirect = createServer((_req, res) => {+ res.writeHead(307, {+ location: `http://127.0.0.1:${targetAddress.port}/v1/chat/completions`,+ });+ res.end();+ });+ await new Promise<void>((resolve) => redirect.listen(0, "127.0.0.1", resolve));+ const redirectAddress = redirect.address();+ if (!redirectAddress || typeof redirectAddress === "string") {+ throw new Error("redirect has no address");+ }+ const redirectFile = join(DIRECTORY, "redirect.json");+ const recorder = await startRecorder({+ upstream: `http://127.0.0.1:${redirectAddress.port}/v1`,+ file: redirectFile,+ scenario: "redirect-probe",+ provider: "loopback",+ model: "loopback",+ });+ try {+ const response = await fetch(`${recorder.url}/chat/completions`, {+ method: "POST",+ headers: {+ "content-type": "application/json",+ authorization: "Bearer test-only-value",+ },+ body: JSON.stringify({+ model: "loopback",+ messages: [{ role: "user", content: "private prompt" }],+ }),+ });+ expect(response.status).toBe(502);+ expect(await response.json()).toEqual({+ error: "workbench proxy: upstream redirect or transport failure",+ });+ expect(targetCalls).toBe(0);+ expect(() => readCassette(redirectFile)).toThrow();+ } finally {+ recorder.close();+ redirect.close();+ target.close();+ }+ });});diff --git a/workbench/l1/measurements.wb.ts b/workbench/l1/measurements.wb.tsnew file mode 100644index 000000000..b80795f1c--- /dev/null+++ b/workbench/l1/measurements.wb.ts@@ -0,0 +1,496 @@+import { mkdtempSync, rmSync, writeFileSync } from "node:fs";+import { tmpdir } from "node:os";+import { join } from "node:path";+import { afterAll, describe, expect, it } from "vitest";+import { readCassette, startRecorder } from "../lib/cassette";+import { offlineStore } from "../lib/harness";+import { askJudge } from "../lib/judge";+import {+ assertComparable,+ boundBaselineFromMeasurement,+ exportMeasurement,+ finalizeJudgedMeasurementCandidate,+ prepareMeasurementCandidate,+ replayMeasurement,+ verifyBoundBaseline,+ verifyMeasurementDirectory,+} from "../lib/measurement";+import { startScriptedModel } from "../lib/model-server";+import {+ captureSourceIdentity,+ type SourceIdentity,+ sourceIdentityFromManifests,+} from "../lib/provenance";+import { buildReport, fingerprintOf, summarizeScenario } from "../lib/report";+import { runRepetition } from "../lib/runner";+import { scoreRun } from "../lib/score";+import { publicHeaderProfile, transportIdentity } from "../lib/transport";+import { getScenario } from "../scenarios/registry";++const DIRECTORY = mkdtempSync(join(tmpdir(), "wb-measurement-l1-"));++function alternateProvenance(source: SourceIdentity): SourceIdentity {+ return sourceIdentityFromManifests({+ commit: source.commit === "b".repeat(40) ? "c".repeat(40) : "b".repeat(40),+ dirtyManifest: [source.effectiveManifest[0]],+ effectiveManifest: source.effectiveManifest,+ });+}++afterAll(() => rmSync(DIRECTORY, { recursive: true, force: true }));++describe("recorded measurement lifecycle", () => {+ it("keeps success-then-rejection usage incomplete and refuses adoption", async () => {+ const scenario = getScenario("target-right-clip");+ const currentSource = captureSourceIdentity();+ const source = alternateProvenance(currentSource);+ const upstream = await startScriptedModel(scenario.demoScript ?? [], {+ wireApi: "responses",+ model: "gpt-5-incomplete",+ });+ const runDir = join(DIRECTORY, "responses-incomplete-run");+ const cassetteFile = join(runDir, "main-cassette-rep-0.json");+ const headers = publicHeaderProfile({});+ const transport = transportIdentity({+ wireApi: "responses",+ maxOutputTokens: 2048,+ publicHeadersSha256: headers.sha256,+ limits: { maxRequests: 1 },+ });+ const recorder = await startRecorder({+ upstream: upstream.url,+ file: cassetteFile,+ scenario: scenario.id,+ provider: "loopback",+ model: "gpt-5-incomplete",+ wireApi: "responses",+ transport,+ publicHeaders: headers,+ });+ let result: Awaited<ReturnType<typeof runRepetition>>;+ try {+ result = await runRepetition({+ scenario,+ rep: 0,+ endpoint: recorder,+ store: offlineStore({+ baseUrl: recorder.url,+ allowAgentEdits: true,+ model: "gpt-5-incomplete",+ }),+ maxRetries: 0,+ });+ } finally {+ recorder.close();+ upstream.close();+ }+ expect(result.run.ok).toBe(false);+ const cassette = readCassette(cassetteFile);+ expect(cassette.rounds).toHaveLength(1);+ expect(cassette.attempts).toHaveLength(2);++ const summary = summarizeScenario({+ scenarioId: scenario.id,+ title: scenario.title,+ tags: scenario.tags,+ gate: scenario.gate,+ results: [result],+ });+ const report = buildReport({+ label: "responses-incomplete-test-only",+ fingerprint: fingerprintOf({+ wire: result.run.wire,+ model: "gpt-5-incomplete",+ reps: 1,+ effectiveSourceSha256: source.effectiveSha256,+ }),+ scenarios: [summary],+ notices: [],+ });+ const candidate = prepareMeasurementCandidate({+ runDir,+ scenario,+ results: [result],+ cassetteFiles: [cassetteFile],+ report,+ requestedModel: "gpt-5-incomplete",+ observedModel: cassette.resolvedModel,+ provider: "loopback",+ endpoint: upstream.url,+ source,+ });+ expect(candidate.manifest.usage?.agent).toMatchObject({+ status: "incomplete",+ attempts: 2,+ rounds: 1,+ withUsage: 1,+ });++ const id = "loopback-responses-incomplete";+ const review = join(DIRECTORY, "responses-incomplete-review.json");+ writeFileSync(+ review,+ `${JSON.stringify({+ schema: 1,+ measurementId: id,+ reviewer: { kind: "independent", label: "test fixture reviewer" },+ disposition: "approved",+ reviewedAt: "2026-09-12T00:35:00.000Z",+ summary: "Test-only incomplete Responses receipt.",+ })}\n`,+ "utf8",+ );+ expect(() =>+ exportMeasurement({+ runDir,+ id,+ reviewFile: review,+ measurementsDir: join(DIRECTORY, "incomplete-measurements"),+ }),+ ).toThrow(expect.objectContaining({ code: "CANDIDATE_INCOMPLETE" }));+ });++ it("binds, adopts, replays, and baselines a native Responses measurement", async () => {+ const scenario = getScenario("target-right-clip");+ const currentSource = captureSourceIdentity();+ const source = alternateProvenance(currentSource);+ const script = (scenario.demoScript ?? []).map((turn, index) =>+ turn.kind === "tools" && index === 0+ ? { ...turn, opaqueReasoning: "synthetic_measurement_opaque" }+ : turn,+ );+ const upstream = await startScriptedModel(script, {+ wireApi: "responses",+ model: "gpt-5-measurement",+ });+ const runDir = join(DIRECTORY, "responses-run");+ const cassetteFile = join(runDir, "main-cassette-rep-0.json");+ const headers = publicHeaderProfile({});+ const transport = transportIdentity({+ wireApi: "responses",+ maxOutputTokens: 2048,+ publicHeadersSha256: headers.sha256,+ });+ const recorder = await startRecorder({+ upstream: upstream.url,+ file: cassetteFile,+ scenario: scenario.id,+ provider: "loopback",+ model: "gpt-5-measurement",+ wireApi: "responses",+ transport,+ publicHeaders: headers,+ });+ let result: Awaited<ReturnType<typeof runRepetition>>;+ try {+ result = await runRepetition({+ scenario,+ rep: 0,+ endpoint: recorder,+ store: offlineStore({+ baseUrl: recorder.url,+ allowAgentEdits: true,+ model: "gpt-5-measurement",+ }),+ maxRetries: 0,+ });+ } finally {+ recorder.close();+ upstream.close();+ }+ const summary = summarizeScenario({+ scenarioId: scenario.id,+ title: scenario.title,+ tags: scenario.tags,+ gate: scenario.gate,+ results: [result],+ });+ const report = buildReport({+ label: "responses-loopback-test-only",+ fingerprint: fingerprintOf({+ wire: result.run.wire,+ model: "gpt-5-measurement",+ reps: 1,+ effectiveSourceSha256: source.effectiveSha256,+ }),+ scenarios: [summary],+ notices: [],+ });+ const candidate = prepareMeasurementCandidate({+ runDir,+ scenario,+ results: [result],+ cassetteFiles: [cassetteFile],+ report,+ requestedModel: "gpt-5-measurement",+ observedModel: "gpt-5-measurement",+ provider: "loopback",+ endpoint: upstream.url,+ source,+ });+ expect(candidate.manifest.fingerprints.transportSha256).toMatch(/^[a-f0-9]{64}$/);+ expect(candidate.manifest.usage?.agent).toMatchObject({+ status: "complete",+ rounds: 3,+ withUsage: 3,+ totals: { input_tokens: 303, output_tokens: 33, total_tokens: 336 },+ });++ const id = "loopback-responses-target-right-clip";+ const review = join(DIRECTORY, "responses-review.json");+ writeFileSync(+ review,+ `${JSON.stringify({+ schema: 1,+ measurementId: id,+ reviewer: { kind: "independent", label: "test fixture reviewer" },+ disposition: "approved",+ reviewedAt: "2026-09-12T00:30:00.000Z",+ summary: "Test-only Responses lifecycle receipt; no model-quality claim.",+ })}\n`,+ "utf8",+ );+ const measurementsDir = join(DIRECTORY, "responses-measurements");+ const adopted = exportMeasurement({ runDir, id, reviewFile: review, measurementsDir });+ const verified = verifyMeasurementDirectory(adopted, { requireApprovedReview: true });+ expect(await replayMeasurement(id, measurementsDir)).toEqual(candidate.manifest.results);+ const baseline = boundBaselineFromMeasurement(verified);+ expect(() => verifyBoundBaseline(baseline, verified)).not.toThrow();+ });++ it("records, adopts, verifies, replays, and binds one public synthetic measurement", async () => {+ const scenario = getScenario("target-right-clip");+ const currentSource = captureSourceIdentity();+ const source = alternateProvenance(currentSource);+ const upstream = await startScriptedModel(scenario.demoScript ?? []);+ const runDir = join(DIRECTORY, "run");+ const cassetteFile = join(runDir, "main-cassette-rep-0.json");+ const recorder = await startRecorder({+ upstream: upstream.url,+ file: cassetteFile,+ scenario: scenario.id,+ provider: "loopback",+ model: "workbench",+ });+ let result: Awaited<ReturnType<typeof runRepetition>>;+ try {+ result = await runRepetition({ scenario, rep: 0, endpoint: recorder });+ } finally {+ recorder.close();+ upstream.close();+ }+ const summary = summarizeScenario({+ scenarioId: scenario.id,+ title: scenario.title,+ tags: scenario.tags,+ gate: scenario.gate,+ results: [result],+ });+ const report = buildReport({+ label: "loopback-test-only",+ fingerprint: fingerprintOf({+ wire: result.run.wire,+ model: "workbench",+ reps: 1,+ effectiveSourceSha256: source.effectiveSha256,+ }),+ scenarios: [summary],+ notices: [],+ });+ const candidate = prepareMeasurementCandidate({+ runDir,+ scenario,+ results: [result],+ cassetteFiles: [cassetteFile],+ report,+ requestedModel: "workbench",+ observedModel: readCassette(cassetteFile).resolvedModel,+ provider: "loopback",+ endpoint: upstream.url,+ source,+ });+ expect(candidate.manifest.complete).toBe(true);+ expect(result.run.wire.systemChars).toBeGreaterThan(0);+ expect(candidate.manifest.fingerprints.systemSha256).toBe(result.run.wire.systemSha256);+ expect(candidate.manifest.source.commit).not.toBe(currentSource.commit);+ expect(candidate.manifest.source.effectiveSha256).toBe(currentSource.effectiveSha256);+ expect(candidate.manifest.source.effectiveManifest.length).toBeGreaterThanOrEqual(14);++ const id = "loopback-target-right-clip";+ const review = join(DIRECTORY, "review.json");+ writeFileSync(+ review,+ `${JSON.stringify(+ {+ schema: 1,+ measurementId: id,+ reviewer: { kind: "independent", label: "test fixture reviewer" },+ disposition: "approved",+ reviewedAt: "2026-09-12T00:10:00.000Z",+ summary: "Test-only review fixture; no product or model-quality claim.",+ },+ null,+ "\t",+ )}\n`,+ "utf8",+ );+ const measurementsDir = join(DIRECTORY, "measurements");+ const adopted = exportMeasurement({+ runDir,+ id,+ reviewFile: review,+ measurementsDir,+ });+ const verified = verifyMeasurementDirectory(adopted, { requireApprovedReview: true });+ expect(verified.manifest.results).toEqual(candidate.manifest.results);+ expect(await replayMeasurement(id, measurementsDir)).toEqual(candidate.manifest.results);+ const baseline = boundBaselineFromMeasurement(verified);+ expect(() => verifyBoundBaseline(baseline, verified)).not.toThrow();+ expect(() => assertComparable(verified.manifest, verified.manifest)).not.toThrow();+ });++ it("keeps a judged candidate incomplete until a recorded judge pass is attached", async () => {+ const scenario = getScenario("consent");+ const judged = scenario.judged ?? [];+ expect(judged).toHaveLength(1);+ const currentSource = captureSourceIdentity();+ const source = alternateProvenance(currentSource);+ const upstream = await startScriptedModel([+ ...(scenario.demoScript ?? []),+ {+ kind: "text",+ text: JSON.stringify({+ verdict: "conforme",+ raison: "La réponse demande clairement l'accord avant toute modification.",+ }),+ },+ ]);+ const runDir = join(DIRECTORY, "judged-run");+ const cassetteFile = join(runDir, "main-cassette-rep-0.json");+ const mainRecorder = await startRecorder({+ upstream: upstream.url,+ file: cassetteFile,+ scenario: scenario.id,+ provider: "loopback",+ model: "workbench",+ });+ let result: Awaited<ReturnType<typeof runRepetition>>;+ try {+ result = await runRepetition({ scenario, rep: 0, endpoint: mainRecorder });+ } finally {+ mainRecorder.close();+ }+ const initialSummary = summarizeScenario({+ scenarioId: scenario.id,+ title: scenario.title,+ tags: scenario.tags,+ gate: scenario.gate,+ results: [result],+ });+ const initialReport = buildReport({+ label: "judged-loopback-test-only",+ fingerprint: fingerprintOf({+ wire: result.run.wire,+ model: "workbench",+ reps: 1,+ effectiveSourceSha256: source.effectiveSha256,+ }),+ scenarios: [initialSummary],+ notices: [],+ });+ const candidate = prepareMeasurementCandidate({+ runDir,+ scenario,+ results: [result],+ cassetteFiles: [cassetteFile],+ report: initialReport,+ requestedModel: "workbench",+ observedModel: readCassette(cassetteFile).resolvedModel,+ provider: "loopback",+ endpoint: upstream.url,+ source,+ });+ expect(candidate.manifest.complete).toBe(false);++ const judgeCassette = join(runDir, "judge-cassette.json");+ const judgeRecorder = await startRecorder({+ upstream: upstream.url,+ file: judgeCassette,+ scenario: `judge-${scenario.id}`,+ provider: "loopback",+ model: "workbench",+ });+ const readings = new Map();+ try {+ for (const check of judged) {+ readings.set(+ check.id,+ await askJudge({+ endpoint: { baseUrl: judgeRecorder.url, model: "workbench" },+ rubric: check.rubric,+ input: {+ prompt: scenario.prompt,+ answer: result.run.answer,+ facts: check.facts(result.context),+ },+ }),+ );+ }+ } finally {+ judgeRecorder.close();+ upstream.close();+ }+ const finalScored = scoreRun(scenario, result.context, readings);+ const finalSummary = summarizeScenario({+ scenarioId: scenario.id,+ title: scenario.title,+ tags: scenario.tags,+ gate: scenario.gate,+ results: [{ scored: finalScored }],+ });+ const finalReport = buildReport({+ label: "judged-loopback-test-only/final",+ fingerprint: fingerprintOf({+ wire: result.run.wire,+ model: "workbench",+ reps: 1,+ effectiveSourceSha256: source.effectiveSha256,+ }),+ scenarios: [finalSummary],+ notices: [],+ });+ const finalized = finalizeJudgedMeasurementCandidate({+ runDir,+ scenario,+ scored: [{ rep: 0, scored: finalScored }],+ judgeCassetteFile: judgeCassette,+ report: finalReport,+ requestedJudgeModel: "workbench",+ observedJudgeModel: readCassette(judgeCassette).resolvedModel,+ provider: "loopback",+ endpoint: upstream.url,+ });+ expect(finalized.manifest.complete).toBe(true);+ expect(finalized.manifest.artifacts.map((artifact) => artifact.role)).toContain(+ "judge-cassette",+ );++ const id = "loopback-consent-judged";+ const review = join(DIRECTORY, "judged-review.json");+ writeFileSync(+ review,+ `${JSON.stringify({+ schema: 1,+ measurementId: id,+ reviewer: { kind: "independent", label: "test fixture reviewer" },+ disposition: "approved",+ reviewedAt: "2026-09-12T00:20:00.000Z",+ summary: "Test-only judged lifecycle receipt; no model-quality claim.",+ })}\n`,+ "utf8",+ );+ const measurementsDir = join(DIRECTORY, "judged-measurements");+ exportMeasurement({ runDir, id, reviewFile: review, measurementsDir });+ expect(await replayMeasurement(id, measurementsDir)).toEqual(finalized.manifest.results);+ });+});diff --git a/workbench/l1/responses-cli.wb.ts b/workbench/l1/responses-cli.wb.tsnew file mode 100644index 000000000..c23fb1f7f--- /dev/null+++ b/workbench/l1/responses-cli.wb.ts@@ -0,0 +1,113 @@+import { spawnSync } from "node:child_process";+import { readFileSync } from "node:fs";+import { buildSync } from "esbuild";+import { describe, expect, it } from "vitest";+import { readCassette, startRecorder } from "../lib/cassette";+import { ENV_KEYS } from "../lib/env";+import { offlineStore } from "../lib/harness";+import { startScriptedModel } from "../lib/model-server";+import { runRepetition } from "../lib/runner";+import { publicHeaderProfile, transportIdentity } from "../lib/transport";+import { getScenario } from "../scenarios/registry";++const CASSETTE = "workbench/.agent-evidence/responses-validation/vitest/cli-replay.json";+const LABEL = "responses-cli-offline";++describe("offline main CLI replay", () => {+ it("runs without live env, asserts freshness, and writes observed replay usage", async () => {+ const upstream = await startScriptedModel(+ [+ {+ kind: "tools",+ opaqueReasoning: "synthetic_cli_opaque",+ calls: [{ name: "getCurrentDocument", args: {} }],+ },+ {+ kind: "tools",+ calls: [{ name: "addZoom", args: { startSec: 43, endSec: 48, depth: 3 } }],+ },+ { kind: "text", text: "Added the zoom to the demo clip." },+ ],+ { wireApi: "responses", model: "gpt-5-cli" },+ );+ const headers = publicHeaderProfile({});+ const transport = transportIdentity({+ wireApi: "responses",+ maxOutputTokens: 2048,+ publicHeadersSha256: headers.sha256,+ });+ const recorder = await startRecorder({+ upstream: upstream.url,+ file: CASSETTE,+ scenario: "target-right-clip",+ provider: "loopback",+ model: "gpt-5-cli",+ wireApi: "responses",+ transport,+ publicHeaders: headers,+ });+ try {+ const result = await runRepetition({+ scenario: getScenario("target-right-clip"),+ endpoint: recorder,+ store: offlineStore({ baseUrl: recorder.url, allowAgentEdits: true, model: "gpt-5-cli" }),+ maxRetries: 0,+ });+ expect(result.run.ok, result.run.error).toBe(true);+ } finally {+ recorder.close();+ upstream.close();+ }++ buildSync({+ entryPoints: ["workbench/cli-entry.ts"],+ bundle: true,+ platform: "node",+ format: "cjs",+ packages: "external",+ outfile: "workbench/.build/cli.cjs",+ logLevel: "silent",+ });+ const envNames = new Set<string>(Object.values(ENV_KEYS));+ const cleanEnv = Object.fromEntries(+ Object.entries(process.env).filter(([name]) => !envNames.has(name)),+ );+ const child = spawnSync(+ process.execPath,+ [+ "workbench/.build/cli.cjs",+ "replay",+ "--scenario",+ "target-right-clip",+ "--cassette",+ CASSETTE,+ "--label",+ LABEL,+ "--timeout",+ "30000",+ ],+ {+ cwd: process.cwd(),+ env: cleanEnv as typeof process.env,+ encoding: "utf8",+ timeout: 60_000,+ },+ );+ expect(child.status, `${child.stdout}\n${child.stderr}`).toBe(0);+ const receipt = JSON.parse(+ readFileSync(`workbench/runs/${LABEL}/target-right-clip/replay-receipt.json`, "utf8"),+ );+ const cassette = readCassette(CASSETTE);+ expect(receipt.upstreamRequests).toBe(0);+ expect(receipt.fresh).toBe(true);+ expect(receipt.localReplayRequests).toBe(3);+ expect(receipt.observedUsage.map((round: { usage: unknown }) => round.usage)).toEqual(+ cassette.rounds.map((round) => round.usage),+ );+ expect(receipt.result.ok).toBe(true);+ expect(receipt.result.toolSequence.map((call: { name: string }) => call.name)).toEqual([+ "getCurrentDocument",+ "addZoom",+ ]);+ });+});diff --git a/workbench/l1/responses-judge.wb.ts b/workbench/l1/responses-judge.wb.tsnew file mode 100644index 000000000..732b94f0c--- /dev/null+++ b/workbench/l1/responses-judge.wb.ts@@ -0,0 +1,68 @@+import { describe, expect, it } from "vitest";+import { readCassette, startRecorder, startReplay } from "../lib/cassette";+import { askJudge, type JudgeRubric } from "../lib/judge";+import { startScriptedModel } from "../lib/model-server";+import { publicHeaderProfile, transportIdentity } from "../lib/transport";++const FILE = "workbench/.agent-evidence/responses-validation/vitest/judge.json";+const RUBRIC: JudgeRubric = {+ id: "judge-responses-test",+ property: "The answer names the completed edit.",+ conforme: ["The answer says the zoom was added."],+ fautif: ["The answer denies the edit."],+ indéterminé: ["The answer is ambiguous."],+};++describe("Responses judge", () => {+ it("records and replays the same verdict and native usage without network", async () => {+ const upstream = await startScriptedModel(+ [{ kind: "text", text: '{"verdict":"conforme","raison":"zoom named"}' }],+ { wireApi: "responses", model: "gpt-5-judge" },+ );+ const headers = publicHeaderProfile({});+ const transport = transportIdentity({+ wireApi: "responses",+ maxOutputTokens: 512,+ publicHeadersSha256: headers.sha256,+ });+ const recorder = await startRecorder({+ upstream: upstream.url,+ file: FILE,+ scenario: "judge-responses",+ provider: "loopback",+ model: "gpt-5-judge",+ wireApi: "responses",+ transport,+ publicHeaders: headers,+ });+ let recorded;+ try {+ recorded = await askJudge({+ endpoint: { baseUrl: recorder.url, model: "gpt-5-judge", wireApi: "responses" },+ rubric: RUBRIC,+ input: { prompt: "Add a zoom", answer: "Added a zoom.", facts: ["one zoom added"] },+ });+ } finally {+ recorder.close();+ upstream.close();+ }+ const cassette = readCassette(FILE);+ expect(cassette.rounds[0].usage).toEqual(expect.objectContaining({ input_tokens: 100 }));++ const replay = await startReplay({ file: FILE, onStale: "throw" });+ let replayed;+ try {+ replayed = await askJudge({+ endpoint: { baseUrl: replay.url, model: "gpt-5-judge", wireApi: "responses" },+ rubric: RUBRIC,+ input: { prompt: "Add a zoom", answer: "Added a zoom.", facts: ["one zoom added"] },+ });+ replay.assertFresh();+ } finally {+ replay.close();+ }+ expect(replayed).toEqual(recorded);+ expect(replay.staleRounds).toEqual([]);+ expect(replay.requests).toHaveLength(1);+ });+});diff --git a/workbench/l1/responses-record-replay.wb.ts b/workbench/l1/responses-record-replay.wb.tsnew file mode 100644index 000000000..70494b49d--- /dev/null+++ b/workbench/l1/responses-record-replay.wb.ts@@ -0,0 +1,386 @@+import { randomUUID } from "node:crypto";+import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";+import { createServer } from "node:http";+import { dirname } from "node:path";+import { describe, expect, it } from "vitest";+import {+ type Cassette,+ readCassette,+ startRecorder,+ startReplay,+ writeCassette,+} from "../lib/cassette";+import { normalizeIds, offlineStore } from "../lib/harness";+import { startScriptedModel } from "../lib/model-server";+import { runRepetition } from "../lib/runner";+import { createInvocationBudget, publicHeaderProfile, transportIdentity } from "../lib/transport";+import { getScenario } from "../scenarios/registry";++const ROOT = "workbench/.agent-evidence/responses-validation/vitest";+const OPAQUE = "synthetic_opaque_reasoning_marker_A9C3";++function profile(maxRequests = 6) {+ const headers = publicHeaderProfile({+ "user-agent": "codex_exec/test-public",+ originator: "codex_exec",+ });+ const transport = transportIdentity({+ wireApi: "responses",+ maxOutputTokens: 2048,+ publicHeadersSha256: headers.sha256,+ limits: { maxRequests, invocationTimeoutMs: 30_000, requestTimeoutMs: 10_000 },+ });+ return { headers, transport };+}++function comparable(result: Awaited<ReturnType<typeof runRepetition>>) {+ return normalizeIds({+ ok: result.run.ok,+ answer: result.run.answer,+ document: result.run.document,+ tools: result.run.wire.calls.map((call) => ({+ name: call.name,+ args: call.args,+ result: call.resultJson,+ })),+ });+}++describe("native Responses record and replay", () => {+ it("runs read -> real addZoom -> final and carries opaque reasoning by call_id", async () => {+ const file = `${ROOT}/native-tool-loop.json`;+ const scripted = await startScriptedModel(+ [+ {+ kind: "tools",+ opaqueReasoning: OPAQUE,+ calls: [{ name: "getCurrentDocument", args: {} }],+ },+ {+ kind: "tools",+ opaqueReasoning: `${OPAQUE}_second`,+ calls: [{ name: "addZoom", args: { startSec: 43, endSec: 48, depth: 3 } }],+ },+ { kind: "text", text: "Added the zoom to the demo clip." },+ ],+ { wireApi: "responses", model: "gpt-5-test" },+ );+ const { headers, transport } = profile();+ const recorder = await startRecorder({+ upstream: scripted.url,+ file,+ scenario: "target-right-clip",+ provider: "loopback",+ model: "gpt-5-test",+ wireApi: "responses",+ transport,+ publicHeaders: headers,+ budget: createInvocationBudget(transport.limits),+ });+ let recorded: Awaited<ReturnType<typeof runRepetition>>;+ try {+ recorded = await runRepetition({+ scenario: getScenario("target-right-clip"),+ endpoint: recorder,+ store: offlineStore({ baseUrl: recorder.url, allowAgentEdits: true, model: "gpt-5-test" }),+ maxRetries: 0,+ });+ } finally {+ recorder.close();+ scripted.close();+ }+ expect(recorded.run.ok, recorded.run.error).toBe(true);+ expect(recorded.context.after.zoomRanges).toHaveLength(1);+ expect(recorded.run.wire.calls.map((call) => call.name)).toEqual([+ "getCurrentDocument",+ "addZoom",+ ]);+ const secondRequest = scripted.requests[1].raw as { input?: unknown[] };+ expect(secondRequest.input).toContainEqual(+ expect.objectContaining({ encrypted_content: OPAQUE }),+ );+ expect(secondRequest.input).toContainEqual(+ expect.objectContaining({ type: "function_call_output", call_id: "call_wb_0_0" }),+ );++ const cassette = readCassette(file);+ expect(cassette.rounds).toHaveLength(3);+ expect(cassette.rounds.every((round) => round.response?.byteCount)).toBe(true);+ expect(cassette.rounds.map((round) => round.usage)).toEqual([+ expect.objectContaining({ input_tokens: 100 }),+ expect.objectContaining({ input_tokens: 101 }),+ expect.objectContaining({ input_tokens: 102 }),+ ]);++ const replay = await startReplay({ file, onStale: "throw" });+ let replayed: Awaited<ReturnType<typeof runRepetition>>;+ try {+ replayed = await runRepetition({+ scenario: getScenario("target-right-clip"),+ endpoint: replay,+ store: offlineStore({ baseUrl: replay.url, allowAgentEdits: true, model: cassette.model }),+ maxRetries: 0,+ });+ replay.assertFresh();+ } finally {+ replay.close();+ }+ expect(replay.staleRounds).toEqual([]);+ expect(comparable(replayed)).toEqual(comparable(recorded));+ });++ it("rejects omitted, unknown, and Chat-disguised Responses discriminators", () => {+ const source = JSON.parse(readFileSync(`${ROOT}/native-tool-loop.json`, "utf8"));+ const writeTamper = (name: string, mutate: (value: typeof source) => void): string => {+ const value = structuredClone(source);+ mutate(value);+ const file = `${ROOT}/discriminator-${name}-${randomUUID()}.json`;+ writeFileSync(file, JSON.stringify(value));+ return file;+ };++ const omitted = writeTamper("omitted", (value) => {+ delete value.wireApi;+ });+ expect(() => readCassette(omitted)).toThrow(/without a wireApi discriminator/);++ const unknown = writeTamper("unknown", (value) => {+ value.wireApi = "unknown-protocol";+ });+ expect(() => readCassette(unknown)).toThrow(/unknown cassette wireApi/);++ const explicitChat = writeTamper("chat", (value) => {+ value.wireApi = "chat-completions";+ value.transport = transportIdentity({ wireApi: "chat-completions" });+ });+ expect(() => readCassette(explicitChat)).toThrow(/Responses-only round evidence/);++ const stripped = writeTamper("stripped", (value) => {+ delete value.wireApi;+ delete value.transport;+ for (const round of value.rounds) {+ delete round.inboundPath;+ delete round.requestBodyBase64;+ delete round.requestByteCount;+ delete round.requestSha256;+ delete round.response;+ delete round.terminalStatus;+ }+ });+ expect(() => readCassette(stripped)).toThrow(/without a wireApi discriminator/);++ const explicitChatFile = `${ROOT}/explicit-chat-${randomUUID()}.json`;+ const chat: Cassette = {+ scenario: "explicit-chat-control",+ provider: "loopback",+ model: "chat-model",+ recordedAt: "2026-09-12T00:00:00.000Z",+ wireApi: "chat-completions",+ transport: transportIdentity({ wireApi: "chat-completions" }),+ rounds: [+ {+ round: 0,+ requestHash: "legacy-chat-hash",+ digest: {+ systemChars: 0,+ toolCount: 0,+ roles: ["user"],+ lastUserText: "Explain Responses",+ },+ sse: 'data: {"object":"chat.completion.chunk","choices":[{"delta":{"content":"The Responses API"}}]}\n\ndata: [DONE]\n\n',+ },+ ],+ };+ writeCassette(explicitChatFile, chat);+ expect(readCassette(explicitChatFile).wireApi).toBe("chat-completions");+ });++ it("preserves fragmented UTF-8 and a non-2xx body/status/type byte for byte", async () => {+ const file = `${ROOT}/non-2xx-bytes.json`;+ const responseText = '{"error":"split 🙂 body"}';+ const bytes = Buffer.from(responseText);+ let upstreamCalls = 0;+ const upstream = createServer((_req, res) => {+ upstreamCalls += 1;+ res.writeHead(429, { "content-type": "application/problem+json; charset=utf-8" });+ const split = bytes.indexOf(Buffer.from("🙂")) + 2;+ res.write(bytes.subarray(0, split));+ res.end(bytes.subarray(split));+ });+ await new Promise<void>((resolve) => upstream.listen(0, "127.0.0.1", resolve));+ const address = upstream.address();+ if (!address || typeof address === "string") throw new Error("no address");+ const { headers, transport } = profile(1);+ const recorder = await startRecorder({+ upstream: `http://127.0.0.1:${address.port}`,+ file,+ scenario: "byte-failure",+ provider: "loopback",+ model: "gpt-5-test",+ wireApi: "responses",+ transport,+ publicHeaders: headers,+ });+ const body = JSON.stringify({+ model: "gpt-5-test",+ input: [],+ reasoning: { effort: "medium" },+ });+ try {+ const response = await fetch(`${recorder.url}/responses`, {+ method: "POST",+ headers: { "content-type": "application/json" },+ body,+ });+ expect(response.status).toBe(429);+ expect(response.headers.get("content-type")).toBe("application/problem+json; charset=utf-8");+ expect(Buffer.from(await response.arrayBuffer())).toEqual(bytes);+ } finally {+ recorder.close();+ upstream.close();+ }+ expect(upstreamCalls).toBe(1);++ const replay = await startReplay({ file, onStale: "throw" });+ try {+ const response = await fetch(`${replay.url}/responses`, {+ method: "POST",+ headers: { "content-type": "application/json" },+ body,+ });+ expect(response.status).toBe(429);+ expect(response.headers.get("content-type")).toBe("application/problem+json; charset=utf-8");+ expect(Buffer.from(await response.arrayBuffer())).toEqual(bytes);+ replay.assertFresh();+ } finally {+ replay.close();+ }+ });++ it("rejects byte-attestation drift and sends one request on provider failure", async () => {+ const file = `${ROOT}/non-2xx-bytes.json`;+ const tampered = `${ROOT}/tampered.json`;+ const value = JSON.parse(readFileSync(file, "utf8"));+ value.rounds[0].response.sha256 = "0".repeat(64);+ mkdirSync(dirname(tampered), { recursive: true });+ writeFileSync(tampered, JSON.stringify(value));+ expect(() => readCassette(tampered)).toThrow(/sha256 mismatch/);++ let calls = 0;+ const upstream = createServer((_req, res) => {+ calls += 1;+ res.writeHead(500, { "content-type": "application/json" });+ res.end('{"error":"synthetic failure"}');+ });+ await new Promise<void>((resolve) => upstream.listen(0, "127.0.0.1", resolve));+ const address = upstream.address();+ if (!address || typeof address === "string") throw new Error("no address");+ const { headers, transport } = profile(1);+ const recorder = await startRecorder({+ upstream: `http://127.0.0.1:${address.port}`,+ scenario: "one-failure",+ provider: "loopback",+ model: "gpt-5-test",+ wireApi: "responses",+ transport,+ publicHeaders: headers,+ });+ try {+ const failed = await runRepetition({+ scenario: getScenario("target-right-clip"),+ endpoint: recorder,+ store: offlineStore({+ baseUrl: recorder.url,+ allowAgentEdits: true,+ model: "gpt-5-test",+ }),+ maxRetries: 0,+ });+ expect(failed.run.ok).toBe(false);+ } finally {+ recorder.close();+ upstream.close();+ }+ expect(calls).toBe(1);+ });++ it("retains safe rejected attempts and never adopts unsafe response bytes", async () => {+ const scripted = await startScriptedModel([{ kind: "text", text: "done" }], {+ wireApi: "responses",+ model: "gpt-5-budget",+ });+ const { headers, transport } = profile(1);+ const file = `${ROOT}/budget-${randomUUID()}.json`;+ const recorder = await startRecorder({+ upstream: scripted.url,+ file,+ scenario: "budget",+ provider: "loopback",+ model: "gpt-5-budget",+ wireApi: "responses",+ transport,+ publicHeaders: headers,+ });+ const body = JSON.stringify({+ model: "gpt-5-budget",+ input: [],+ reasoning: { effort: "medium" },+ });+ try {+ const first = await fetch(`${recorder.url}/responses`, { method: "POST", body });+ expect(first.status).toBe(200);+ await first.text();+ const rejected = await fetch(`${recorder.url}/responses`, { method: "POST", body });+ expect(rejected.status).toBe(429);+ } finally {+ recorder.close();+ scripted.close();+ }+ expect(scripted.requests).toHaveLength(1);+ const attempts = JSON.parse(readFileSync(`${file}.attempts.json`, "utf8"));+ expect(attempts.attempts.map((attempt: { status: string }) => attempt.status)).toEqual([+ "recorded",+ "rejected",+ ]);+ const incompleteCassette = readCassette(file);+ expect(incompleteCassette.rounds).toHaveLength(1);+ expect(incompleteCassette.attempts).toHaveLength(2);+ expect(incompleteCassette.attempts?.map((attempt) => attempt.status)).toEqual([+ "recorded",+ "rejected",+ ]);++ const unsafeFile = `${ROOT}/unsafe-${randomUUID()}.json`;+ const unsafe = createServer((_req, res) => {+ res.writeHead(200, { "content-type": "text/event-stream" });+ res.end("data: Bearer synthetic-response-secret\n\n");+ });+ await new Promise<void>((resolve) => unsafe.listen(0, "127.0.0.1", resolve));+ const address = unsafe.address();+ if (!address || typeof address === "string") throw new Error("no address");+ const unsafeRecorder = await startRecorder({+ upstream: `http://127.0.0.1:${address.port}`,+ file: unsafeFile,+ scenario: "unsafe",+ provider: "loopback",+ model: "gpt-5-budget",+ wireApi: "responses",+ transport,+ publicHeaders: headers,+ });+ try {+ const response = await fetch(`${unsafeRecorder.url}/responses`, { method: "POST", body });+ expect(response.status).toBe(502);+ } finally {+ unsafeRecorder.close();+ unsafe.close();+ }+ expect(existsSync(unsafeFile)).toBe(false);+ const unsafeAttempts = JSON.parse(readFileSync(`${unsafeFile}.attempts.json`, "utf8"));+ expect(unsafeAttempts.attempts[0]).toMatchObject({+ phase: "response",+ status: "failed",+ detail: "unsafe upstream response",+ });+ });+});diff --git a/workbench/lib/baseline.ts b/workbench/lib/baseline.tsindex 370397458..741b88bff 100644--- a/workbench/lib/baseline.ts+++ b/workbench/lib/baseline.ts@@ -12,6 +12,10 @@ import type { Scenario } from "./scenario";import type { CheckResult } from "./score";export interface Baseline {+ /** Absent on the three historical files; absence is read as legacy version 1. */+ schema?: 1;+ /** Numerical fields are archival only. The check-id ratchet remains active. */+ binding?: "legacy-unbound";scenario: string;/** Check ids known to fail when the baseline was recorded. */expectedFailures: string[];@@ -56,6 +60,10 @@ export function readBaseline(file: string): Baseline | null {return JSON.parse(readFileSync(file, "utf8")) as Baseline;}+export function baselineBinding(baseline: Baseline): "legacy-unbound" {+ return baseline.binding ?? "legacy-unbound";+}+export function writeBaseline(file: string, baseline: Baseline): void {mkdirSync(dirname(file), { recursive: true });writeFileSync(file, `${JSON.stringify(baseline, null, "\t")}\n`, "utf8");@@ -164,6 +172,8 @@ export function baselineFromRun(options: {now?: Date;}): Baseline {return {+ schema: 1,+ binding: "legacy-unbound",scenario: options.scenarioId,// ponytail: `!r.ok && !r.indeterminate`. Un indéterminé porte `ok: false` :// sans le second terme, le premier `--update-baseline` graverait « le juge@@ -182,3 +192,13 @@ export function baselineFromRun(options: {recordedAt: (options.now ?? new Date()).toISOString().slice(0, 10),};}++// Bound numerical baselines live beside the measurement mechanism. Re-export+// the API here so callers do not mistake the legacy behaviour/dsl archive above+// for a verified quantitative baseline.+export {+ type BoundBaseline,+ boundBaselineFromMeasurement,+ verifyBoundBaseline,+ writeBoundBaseline,+} from "./measurement";diff --git a/workbench/lib/cassette.ts b/workbench/lib/cassette.tsindex 3f6ecd344..417e7471c 100644--- a/workbench/lib/cassette.ts+++ b/workbench/lib/cassette.ts@@ -1,53 +1,104 @@-// ponytail: record/replay of the provider's raw SSE bytes. The recorder is a-// transparent proxy: it forwards the Authorization header it receives without-// reading it, and never writes it to disk. The cassette holds only the request-// fingerprint and the response body.--import { createHash } from "node:crypto";-import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";-import { createServer, type Server } from "node:http";+// Record/replay for legacy Chat Completions and native Responses. Legacy+// cassettes keep their text-only contract; Responses attests exact decoded+// HTTP entity bytes and binds the full transport policy.++import { createHash, randomUUID } from "node:crypto";+import {+ existsSync,+ mkdirSync,+ readFileSync,+ renameSync,+ unlinkSync,+ writeFileSync,+} from "node:fs";+import { createServer, type IncomingMessage, type Server } from "node:http";import { dirname } from "node:path";import { containsSecret } from "./env";import { normalizeIds } from "./harness";import type { CapturedRequest, ModelServerHandle } from "./model-server";+import {+ applyRequestPolicy,+ createInvocationBudget,+ DEFAULT_TRANSPORT_LIMITS,+ type InvocationBudget,+ type PublicHeaderProfile,+ publicHeaderProfile,+ type TransportIdentity,+ transportIdentity,+ type WireApi,+} from "./transport";+import { instructionContentTextOf } from "./wire";++export interface ResponseByteEvidence {+ bodyBase64: string;+ byteCount: number;+ sha256: string;+ status: number;+ contentType: string | null;+}export interface CassetteRound {round: number;- /** sha256 of the normalized request — stale-cassette detection only. */requestHash: string;- /** Human-readable digest so a cassette diff is reviewable. */digest: { systemChars: number; toolCount: number; roles: string[]; lastUserText: string };- /** Raw `text/event-stream` body, verbatim. */+ /** Legacy Chat payload and decoded compatibility field for Responses. */sse: string;+ usage?: Record<string, unknown>;+ inboundPath?: string;+ requestBodyBase64?: string;+ requestByteCount?: number;+ requestSha256?: string;+ response?: ResponseByteEvidence;+ terminalStatus?: "completed" | "incomplete" | "failed" | "missing";}export interface Cassette {scenario: string;provider: string;- /** Le modèle DEMANDÉ — ce que la config a envoyé. */model: string;- /**- * Le modèle qui a RÉPONDU, lu dans le flux, quand il s'y nomme.- *- * ponytail: deux faits, pas un. Un provider est libre de résoudre un alias- * vers autre chose — `deepseek-chat` a rendu `deepseek-v4-flash` sur toutes- * les cassettes de cette passe — et n'enregistrer que la demande fait qu'une- * mesure ne sait plus dire qui l'a produite. C'est ce qui rend deux baselines- * incomparables sans que rien ne le signale, et c'est la même discipline qu'- * ailleurs ici : « ce que j'ai demandé » et « ce qui a répondu » ne sont pas- * la même phrase. Absent = le flux ne l'a pas dit, jamais « identique à la- * demande ».- */resolvedModel?: string;recordedAt: string;rounds: CassetteRound[];+ /** Absent means the historical Chat Completions text-only schema. */+ wireApi?: WireApi;+ transport?: TransportIdentity;+ attempts?: CassetteAttempt[];+}++export interface CassetteAttempt {+ attempt: number;+ phase: "admission" | "forward" | "response" | "complete";+ status: "rejected" | "failed" | "recorded";+ detail?: string;+}++interface ResponsesTerminal {+ status: CassetteRound["terminalStatus"];+ usage?: Record<string, unknown>;+ model: string | null;+}++function sha256(value: string | Uint8Array): string {+ return createHash("sha256").update(value).digest("hex");}-/** Le `model` que le flux s'attribue, ou null s'il ne s'en attribue aucun. Les- * chunks le répètent ; on prend le premier et on ne suppose pas les suivants- * identiques — un flux qui changerait d'avis en cours de route est justement le- * genre de chose qu'on veut voir, donc on garde le premier ET on le dit. */-export function modelFromSse(sse: string): string | null {+function ssePayloads(sse: string): unknown[] {+ const payloads: unknown[] = [];+ for (const line of sse.split(/\r?\n/)) {+ if (!line.startsWith("data:")) continue;+ const payload = line.slice(5).trim();+ if (!payload || payload === "[DONE]") continue;+ try {+ payloads.push(JSON.parse(payload));+ } catch {+ // A protocol-specific parser decides whether malformed data is fatal.+ }+ }+ return payloads;+}++export function modelFromSse(sse: string, wireApi: WireApi = "chat-completions"): string | null {+ if (wireApi === "responses") return responsesTerminalFromSse(sse).model;for (const line of sse.split("\n")) {if (!line.startsWith("data: ")) continue;const payload = line.slice(6).trim();@@ -56,20 +107,72 @@ export function modelFromSse(sse: string): string | null {const model = (JSON.parse(payload) as { model?: unknown }).model;if (typeof model === "string" && model.length > 0) return model;} catch {- // Un chunk illisible n'est pas une réponse à cette question.+ // Legacy parser ignores malformed chunks.}}return null;}+export function usageFromSse(+ sse: string,+ wireApi: WireApi = "chat-completions",+): Record<string, unknown> | undefined {+ if (wireApi === "responses") return responsesTerminalFromSse(sse).usage;+ let usage: Record<string, unknown> | undefined;+ for (const line of sse.split("\n")) {+ if (!line.startsWith("data:")) continue;+ const payload = line.slice(5).trim();+ if (payload === "[DONE]") break;+ try {+ const candidate = (JSON.parse(payload) as { usage?: unknown }).usage;+ if (candidate !== null && typeof candidate === "object" && !Array.isArray(candidate)) {+ usage = candidate as Record<string, unknown>;+ }+ } catch {+ // Legacy parser ignores malformed chunks.+ }+ }+ return usage;+}++export function responsesTerminalFromSse(sse: string): ResponsesTerminal {+ const terminals = ssePayloads(sse).filter((payload) => {+ const type = (payload as { type?: unknown }).type;+ return (+ type === "response.completed" || type === "response.incomplete" || type === "response.failed"+ );+ }) as Array<{ type: string; response?: unknown }>;+ if (terminals.length === 0) return { status: "missing", model: null };+ if (terminals.length !== 1) throw new Error("Responses stream has duplicate terminal events");+ const terminal = terminals[0];+ const response =+ terminal.response && typeof terminal.response === "object"+ ? (terminal.response as Record<string, unknown>)+ : {};+ const usage =+ response.usage && typeof response.usage === "object" && !Array.isArray(response.usage)+ ? (response.usage as Record<string, unknown>)+ : undefined;+ const model = typeof response.model === "string" && response.model ? response.model : null;+ const responseStatus = response.status;+ if (+ (terminal.type === "response.completed" && responseStatus !== "completed") ||+ (terminal.type === "response.incomplete" && responseStatus !== "incomplete") ||+ (terminal.type === "response.failed" && responseStatus !== "failed")+ ) {+ throw new Error("Responses terminal event/status mismatch");+ }+ const status =+ terminal.type === "response.completed"+ ? "completed"+ : terminal.type === "response.incomplete"+ ? "incomplete"+ : "failed";+ return { status, usage, model };+}++/** Historical Chat hash. Keep byte-for-byte semantics for existing cassettes. */export function hashRequest(body: Record<string, unknown>): string {- // ponytail: hash everything the model actually sees. If the system prompt,- // the tool schemas or the message history change, the hash changes and the- // cassette is flagged stale — that is the signal to re-record.- //- // Ids MUST be normalized first: tool results echo freshly minted- // `trim_<uuid>` / `zoom_<uuid>` ids back into the next request, so a raw- // hash marks every cassette stale on the very first replay.const messages = (body.messages ?? []) as Array<Record<string, unknown>>;const tools = (body.tools ?? []) as Array<{ function?: { name?: string } }>;const canonical = JSON.stringify(@@ -78,151 +181,572 @@ export function hashRequest(body: Record<string, unknown>): string {tools: tools.map((t) => t.function?.name),}),);- return createHash("sha256").update(canonical).digest("hex").slice(0, 16);+ return sha256(canonical).slice(0, 16);}-function digestOf(body: Record<string, unknown>): CassetteRound["digest"] {- const messages = (body.messages ?? []) as Array<Record<string, unknown>>;- const lastUser = [...messages].reverse().find((m) => m.role === "user");+export function hashResponsesRequest(body: Record<string, unknown>): string {+ return sha256(JSON.stringify(normalizeIds(body)));+}++function responseInput(body: Record<string, unknown>): Array<Record<string, unknown>> {+ return Array.isArray(body.input) ? (body.input as Array<Record<string, unknown>>) : [];+}++function digestOf(body: Record<string, unknown>, wireApi: WireApi): CassetteRound["digest"] {+ if (wireApi === "chat-completions") {+ const messages = (body.messages ?? []) as Array<Record<string, unknown>>;+ const lastUser = [...messages].reverse().find((m) => m.role === "user");+ return {+ systemChars: instructionContentTextOf(messages).length,+ toolCount: ((body.tools ?? []) as unknown[]).length,+ roles: messages.map((m) => String(m.role)),+ lastUserText: String(lastUser?.content ?? "").slice(0, 120),+ };+ }+ const input = responseInput(body);+ const instructions = typeof body.instructions === "string" ? body.instructions : "";+ const instructionItems = input.filter(+ (item) => item.role === "system" || item.role === "developer",+ );+ const instructionText = instructionItems+ .map((item) =>+ typeof item.content === "string" ? item.content : JSON.stringify(item.content ?? ""),+ )+ .join("\n");+ const lastUser = [...input].reverse().find((item) => item.role === "user");return {- systemChars: JSON.stringify(messages[0]?.content ?? "").length,+ systemChars: [instructions, instructionText].filter(Boolean).join("\n").length,toolCount: ((body.tools ?? []) as unknown[]).length,- roles: messages.map((m) => String(m.role)),+ roles: input.map((item) => String(item.role ?? item.type ?? "?")),lastUserText: String(lastUser?.content ?? "").slice(0, 120),};}+function captureRequest(+ round: number,+ body: Record<string, unknown>,+ wireApi: WireApi,+): CapturedRequest {+ const digest = digestOf(body, wireApi);+ const tools = (body.tools ?? []) as Array<{ name?: string; function?: { name?: string } }>;+ return {+ round,+ systemChars: digest.systemChars,+ toolNames: tools.map((tool) => tool.name ?? tool.function?.name ?? "?"),+ messages:+ wireApi === "responses"+ ? responseInput(body).map((item) => ({+ role: String(item.role ?? item.type ?? "?"),+ content:+ typeof item.content === "string" ? item.content : JSON.stringify(item.content ?? ""),+ toolCalls: item.type === "function_call" ? [String(item.name ?? "?")] : [],+ }))+ : ((body.messages ?? []) as Array<Record<string, unknown>>).map((message) => ({+ role: String(message.role),+ content:+ typeof message.content === "string"+ ? message.content+ : JSON.stringify(message.content ?? ""),+ toolCalls: ((message.tool_calls ?? []) as Array<{ function?: { name?: string } }>).map(+ (tool) => tool.function?.name ?? "?",+ ),+ })),+ raw: body,+ };+}++function validateResponseEvidence(round: CassetteRound): void {+ if (!round.response) throw new Error(`Responses round ${round.round} has no byte evidence`);+ const bytes = Buffer.from(round.response.bodyBase64, "base64");+ if (bytes.toString("base64") !== round.response.bodyBase64) {+ throw new Error(`Responses round ${round.round} has invalid base64`);+ }+ if (bytes.byteLength !== round.response.byteCount) {+ throw new Error(`Responses round ${round.round} response byte count mismatch`);+ }+ if (sha256(bytes) !== round.response.sha256) {+ throw new Error(`Responses round ${round.round} response sha256 mismatch`);+ }+ const decoded = new TextDecoder("utf-8", { fatal: true }).decode(bytes);+ if (round.sse !== decoded) throw new Error(`Responses round ${round.round} sse/bytes mismatch`);+ if (containsSecret(decoded)) throw new Error(`Responses round ${round.round} contains a secret`);+ if (+ !Number.isInteger(round.response.status) ||+ round.response.status < 100 ||+ round.response.status > 599+ ) {+ throw new Error(`Responses round ${round.round} has invalid HTTP status`);+ }+ if (+ round.response.contentType !== null &&+ (typeof round.response.contentType !== "string" || /[\r\n\0]/.test(round.response.contentType))+ ) {+ throw new Error(`Responses round ${round.round} has invalid content type`);+ }+ if (!round.inboundPath || !round.requestBodyBase64 || !round.requestSha256) {+ throw new Error(`Responses round ${round.round} has incomplete request evidence`);+ }+ const requestBytes = Buffer.from(round.requestBodyBase64, "base64");+ if (requestBytes.toString("base64") !== round.requestBodyBase64) {+ throw new Error(`Responses round ${round.round} request base64 invalid`);+ }+ if (+ requestBytes.byteLength !== round.requestByteCount ||+ sha256(requestBytes) !== round.requestSha256+ ) {+ throw new Error(`Responses round ${round.round} request byte evidence mismatch`);+ }+ const requestText = new TextDecoder("utf-8", { fatal: true }).decode(requestBytes);+ if (containsSecret(requestText))+ throw new Error(`Responses round ${round.round} request contains a secret`);+ const request = JSON.parse(requestText) as Record<string, unknown>;+ if (hashResponsesRequest(request) !== round.requestHash) {+ throw new Error(`Responses round ${round.round} normalized request hash mismatch`);+ }+}++export function validateCassette(cassette: Cassette): void {+ const declaredWireApi = (cassette as { wireApi?: unknown }).wireApi;+ const hasResponsesEvidence = cassette.rounds.some((round) =>+ [+ "inboundPath",+ "requestBodyBase64",+ "requestByteCount",+ "requestSha256",+ "response",+ "terminalStatus",+ ].some((field) => field in round),+ );+ const hasResponsesSseEvents = cassette.rounds.some((round) =>+ ssePayloads(round.sse).some((payload) => {+ const type = (payload as { type?: unknown }).type;+ return typeof type === "string" && type.startsWith("response.");+ }),+ );+ if (declaredWireApi === undefined) {+ if (cassette.transport || hasResponsesEvidence || hasResponsesSseEvents) {+ throw new Error(+ "cassette has transport or Responses evidence without a wireApi discriminator",+ );+ }+ return;+ }+ if (declaredWireApi !== "chat-completions" && declaredWireApi !== "responses") {+ throw new Error(`unknown cassette wireApi: ${String(declaredWireApi)}`);+ }+ if (!cassette.transport || cassette.transport.wireApi !== declaredWireApi) {+ throw new Error("cassette wireApi does not match its transport identity");+ }+ const expected = transportIdentity({+ wireApi: declaredWireApi,+ maxOutputTokens:+ declaredWireApi === "responses"+ ? (cassette.transport.requestPolicy.maxOutputTokens ?? undefined)+ : undefined,+ limits: cassette.transport.limits,+ publicHeadersSha256: cassette.transport.publicHeadersSha256,+ });+ if (JSON.stringify(expected) !== JSON.stringify(cassette.transport)) {+ throw new Error(`${declaredWireApi} cassette transport identity is invalid`);+ }+ if (declaredWireApi === "chat-completions") {+ if (hasResponsesEvidence || hasResponsesSseEvents) {+ throw new Error("Chat cassette contains Responses-only round evidence");+ }+ return;+ }+ for (const round of cassette.rounds) {+ validateResponseEvidence(round);+ if (!cassette.transport.inboundPaths.includes(round.inboundPath as string)) {+ throw new Error(`Responses round ${round.round} inbound path mismatch`);+ }+ const request = JSON.parse(+ new TextDecoder("utf-8", { fatal: true }).decode(+ Buffer.from(round.requestBodyBase64 as string, "base64"),+ ),+ ) as Record<string, unknown>;+ if (+ JSON.stringify(applyRequestPolicy(request, cassette.transport)) !== JSON.stringify(request)+ ) {+ throw new Error(`Responses round ${round.round} request policy mismatch`);+ }+ const terminal = responsesTerminalFromSse(round.sse);+ if (+ terminal.status !== round.terminalStatus ||+ terminal.model !== (cassette.resolvedModel ?? terminal.model)+ ) {+ throw new Error(`Responses round ${round.round} terminal metadata mismatch`);+ }+ if (JSON.stringify(terminal.usage) !== JSON.stringify(round.usage)) {+ throw new Error(`Responses round ${round.round} usage mismatch`);+ }+ }+}+export function readCassette(file: string): Cassette {- return JSON.parse(readFileSync(file, "utf8")) as Cassette;+ const cassette = JSON.parse(readFileSync(file, "utf8")) as Cassette;+ validateCassette(cassette);+ return cassette;}export function writeCassette(file: string, cassette: Cassette): void {+ validateCassette(cassette);const payload = `${JSON.stringify(cassette, null, "\t")}\n`;- // ponytail: the recorder proxies an Authorization header it never parses,- // but a provider that echoed one back into an error body would put it in- // this file, and cassettes are versioned. Refuse the write rather than- // scrub it — a scrubbed cassette hides that the leak path exists.if (containsSecret(payload)) {throw new Error(`refus d'écrire la cassette ${file} : le blob contient une valeur secrète`);}mkdirSync(dirname(file), { recursive: true });- writeFileSync(file, payload, "utf8");+ const temporary = `${file}.tmp-${process.pid}-${randomUUID()}`;+ writeFileSync(temporary, payload, "utf8");+ try {+ renameSync(temporary, file);+ } catch (error) {+ if (existsSync(temporary)) unlinkSync(temporary);+ throw error;+ }}export function cassetteExists(file: string): boolean {return existsSync(file);}-/**- * Transparent proxy in front of the real provider. `upstream` is the provider's- * base URL; the app is pointed at THIS server's url instead.- *- * It is not an optimisation, it is the live layer's evidence path. Point the- * app straight at the provider and `model.requests` stays empty, which means- * `wireFromRequests` sees no tool calls at all — and a DSL check that asks- * "did it call anything mutating?" would then pass for the worst possible- * reason. Every live repetition goes through here.- *- * `file` is optional: omit it to proxy without writing a cassette.- */+async function readIncoming(req: IncomingMessage, maxBytes: number): Promise<Buffer> {+ const chunks: Buffer[] = [];+ let total = 0;+ for await (const chunk of req) {+ const bytes = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);+ total += bytes.byteLength;+ if (total > maxBytes) throw new Error(`request body exceeds ${maxBytes} bytes`);+ chunks.push(bytes);+ }+ return Buffer.concat(chunks);+}++async function readResponseBytes(response: Response, maxBytes: number): Promise<Buffer> {+ if (!response.body) return Buffer.alloc(0);+ const chunks: Uint8Array[] = [];+ let total = 0;+ const reader = response.body.getReader();+ for (;;) {+ const { done, value } = await reader.read();+ if (done) break;+ total += value.byteLength;+ if (total > maxBytes) {+ await reader.cancel();+ throw new Error(`response body exceeds ${maxBytes} bytes`);+ }+ chunks.push(value);+ }+ return Buffer.concat(chunks.map((chunk) => Buffer.from(chunk)));+}++function decodeUtf8(bytes: Uint8Array): string {+ return new TextDecoder("utf-8", { fatal: true }).decode(bytes);+}++function upstreamUrl(base: string, suffix: string): string {+ return `${base.replace(/\/$/, "")}${suffix}`;+}+export async function startRecorder(options: {upstream: string;file?: string;scenario: string;provider: string;model: string;+ wireApi?: WireApi;+ transport?: TransportIdentity;+ publicHeaders?: PublicHeaderProfile;+ budget?: InvocationBudget;}): Promise<ModelServerHandle> {+ const wireApi = options.wireApi ?? "chat-completions";+ const transport =+ options.transport ??+ (wireApi === "responses" ? transportIdentity({ wireApi, maxOutputTokens: 2048 }) : undefined);+ if (wireApi === "responses" && !transport) throw new Error("Responses requires transport policy");+ const effectiveTransport =+ transport ??+ transportIdentity({ wireApi: "chat-completions", limits: DEFAULT_TRANSPORT_LIMITS });+ if (effectiveTransport.wireApi !== wireApi) {+ throw new Error("wireApi does not match transport identity");+ }+ const budget = options.budget ?? createInvocationBudget(effectiveTransport.limits);+ const configuredPublicHeaders = options.publicHeaders ?? publicHeaderProfile({});+ if (configuredPublicHeaders.sha256 !== effectiveTransport.publicHeadersSha256) {+ throw new Error("configured public headers do not match transport identity");+ }const requests: CapturedRequest[] = [];const rounds: CassetteRound[] = [];- // Le premier flux qui se nomme fixe la réponse pour la cassette entière.+ const attempts: CassetteAttempt[] = [];let resolvedModel: string | null = null;let round = 0;-- const server: Server = createServer((req, res) => {- let body = "";- req.on("data", (c) => {- body += c;+ let attemptNumber = 0;+ const recordedAt = new Date().toISOString();+ const writeCurrentCassette = (): void => {+ if (!options.file || rounds.length === 0) return;+ writeCassette(options.file, {+ scenario: options.scenario,+ provider: options.provider,+ model: options.model,+ ...(resolvedModel ? { resolvedModel } : {}),+ recordedAt,+ rounds: [...rounds].sort((left, right) => left.round - right.round),+ ...(wireApi === "responses" || options.wireApi !== undefined || options.transport+ ? { wireApi, transport: effectiveTransport }+ : {}),+ attempts: [...attempts],});- req.on("end", async () => {- let parsed: Record<string, unknown>;- try {- parsed = JSON.parse(body) as Record<string, unknown>;- } catch {- res.writeHead(400, { "content-type": "application/json" });- res.end('{"error":"workbench proxy: request body is not JSON"}');- return;- }- const myRound = round;- round += 1;- requests.push({- round: myRound,- systemChars: digestOf(parsed).systemChars,- toolNames: ((parsed.tools ?? []) as Array<{ function?: { name?: string } }>).map(- (t) => t.function?.name ?? "?",- ),- messages: [],- raw: parsed,- });+ };+ const retainAttempt = (attempt: CassetteAttempt): void => {+ attempts.push(attempt);+ if (!options.file) return;+ const attemptFile = `${options.file}.attempts.json`;+ const payload = `${JSON.stringify({ schema: 1, attempts }, null, "\t")}\n`;+ if (containsSecret(payload)) throw new Error("attempt receipt contains a secret");+ mkdirSync(dirname(attemptFile), { recursive: true });+ writeFileSync(attemptFile, payload, "utf8");+ // A later failure has no raw round to append, but it may still have reached+ // the provider. Refresh only the safe attempt metadata on the last complete+ // cassette so measurement accounting cannot silently lose that attempt.+ writeCurrentCassette();+ };- // ponytail: pass the inbound Authorization header straight through.- // The workbench never parses it, never logs it, never persists it.- const auth = req.headers.authorization;- const upstreamRes = await fetch(`${options.upstream}/chat/completions`, {- method: "POST",- headers: {- "content-type": "application/json",- ...(auth ? { authorization: auth } : {}),+ const server: Server = createServer(async (req, res) => {+ const attempt = attemptNumber++;+ const inboundPath = new URL(req.url ?? "/", "http://127.0.0.1").pathname;+ if (!effectiveTransport.inboundPaths.includes(inboundPath)) {+ retainAttempt({+ attempt,+ phase: "admission",+ status: "rejected",+ detail: "protocol/path mismatch",+ });+ res.writeHead(404, { "content-type": "application/json" });+ res.end('{"error":"workbench proxy: protocol/path mismatch"}');+ return;+ }+ let incoming: Buffer;+ try {+ incoming = await readIncoming(req, effectiveTransport.limits.maxRequestBytes);+ } catch (error) {+ retainAttempt({+ attempt,+ phase: "admission",+ status: "rejected",+ detail: "request body too large",+ });+ res.writeHead(413, { "content-type": "application/json" });+ res.end(JSON.stringify({ error: error instanceof Error ? error.message : String(error) }));+ return;+ }+ let parsed: Record<string, unknown>;+ try {+ parsed = JSON.parse(decodeUtf8(incoming)) as Record<string, unknown>;+ } catch {+ retainAttempt({+ attempt,+ phase: "admission",+ status: "rejected",+ detail: "request is not UTF-8 JSON",+ });+ res.writeHead(400, { "content-type": "application/json" });+ res.end('{"error":"workbench proxy: request body is not UTF-8 JSON"}');+ return;+ }+ let effectiveBody: Record<string, unknown>;+ try {+ effectiveBody = applyRequestPolicy(parsed, effectiveTransport);+ } catch {+ retainAttempt({+ attempt,+ phase: "admission",+ status: "rejected",+ detail: "request policy mismatch",+ });+ res.writeHead(400, { "content-type": "application/json" });+ res.end('{"error":"workbench proxy: request policy mismatch"}');+ return;+ }+ const effectiveBytes =+ wireApi === "responses" ? Buffer.from(JSON.stringify(effectiveBody)) : incoming;+ if (containsSecret(decodeUtf8(effectiveBytes))) {+ retainAttempt({+ attempt,+ phase: "admission",+ status: "rejected",+ detail: "secret in request body",+ });+ res.writeHead(400, { "content-type": "application/json" });+ res.end('{"error":"workbench proxy: secret in request body"}');+ return;+ }+ try {+ budget.reserveRequest(effectiveBytes.byteLength);+ } catch (error) {+ retainAttempt({+ attempt,+ phase: "admission",+ status: "rejected",+ detail: "invocation budget rejected request",+ });+ res.writeHead(429, { "content-type": "application/json" });+ res.end(JSON.stringify({ error: error instanceof Error ? error.message : String(error) }));+ return;+ }+ const myRound = round++;+ requests.push(captureRequest(myRound, effectiveBody, wireApi));+ const auth = req.headers.authorization;+ const controller = new AbortController();+ const untrack = budget.track(controller);+ const timeoutMs = Math.min(effectiveTransport.limits.requestTimeoutMs, budget.remainingMs());+ const timer = setTimeout(() => controller.abort(), timeoutMs);+ let upstreamResponse: Response;+ let responseBytes: Buffer;+ try {+ upstreamResponse = await fetch(+ upstreamUrl(options.upstream, effectiveTransport.upstreamPathSuffix),+ {+ method: "POST",+ redirect: "error",+ headers: {+ "content-type": "application/json",+ accept: "text/event-stream",+ ...(auth ? { authorization: auth } : {}),+ ...configuredPublicHeaders.headers,+ },+ body: new Uint8Array(effectiveBytes),+ signal: controller.signal,},- body,+ );+ responseBytes = await readResponseBytes(+ upstreamResponse,+ effectiveTransport.limits.maxResponseBytes,+ );+ } catch {+ retainAttempt({+ attempt,+ phase: "forward",+ status: "failed",+ detail: "redirect, timeout, transport, or body limit",});- const sse = await upstreamRes.text();- resolvedModel ??= modelFromSse(sse);- rounds.push({- round: myRound,- requestHash: hashRequest(parsed),- digest: digestOf(parsed),- sse,+ res.writeHead(502, { "content-type": "application/json" });+ res.end(+ wireApi === "chat-completions"+ ? '{"error":"workbench proxy: upstream redirect or transport failure"}'+ : '{"error":"workbench proxy: upstream redirect, timeout, or transport failure"}',+ );+ return;+ } finally {+ clearTimeout(timer);+ untrack();+ }+ let decoded: string;+ try {+ decoded = decodeUtf8(responseBytes);+ } catch {+ retainAttempt({+ attempt,+ phase: "response",+ status: "failed",+ detail: "response is not valid UTF-8",});- if (options.file) {- writeCassette(options.file, {- scenario: options.scenario,- provider: options.provider,- model: options.model,- ...(resolvedModel ? { resolvedModel } : {}),- recordedAt: new Date().toISOString(),- rounds: [...rounds].sort((a, b) => a.round - b.round),- });- }- res.writeHead(upstreamRes.status, { "content-type": "text/event-stream" });- res.end(sse);- });+ res.writeHead(502, { "content-type": "application/json" });+ res.end('{"error":"workbench proxy: upstream body is not valid UTF-8"}');+ return;+ }+ if (containsSecret(decoded) || (auth && decoded.includes(auth))) {+ retainAttempt({+ attempt,+ phase: "response",+ status: "failed",+ detail: "unsafe upstream response",+ });+ res.writeHead(502, { "content-type": "application/json" });+ res.end('{"error":"workbench proxy: unsafe upstream response"}');+ return;+ }+ let terminal: ResponsesTerminal | undefined;+ try {+ terminal = wireApi === "responses" ? responsesTerminalFromSse(decoded) : undefined;+ } catch {+ retainAttempt({+ attempt,+ phase: "response",+ status: "failed",+ detail: "invalid Responses terminal sequence",+ });+ res.writeHead(502, { "content-type": "application/json" });+ res.end('{"error":"workbench proxy: invalid Responses terminal sequence"}');+ return;+ }+ resolvedModel ??= terminal?.model ?? modelFromSse(decoded, wireApi);+ const usage = terminal?.usage ?? usageFromSse(decoded, wireApi);+ const responseEvidence: ResponseByteEvidence = {+ bodyBase64: responseBytes.toString("base64"),+ byteCount: responseBytes.byteLength,+ sha256: sha256(responseBytes),+ status: upstreamResponse.status,+ contentType: upstreamResponse.headers.get("content-type"),+ };+ const recordedRound: CassetteRound = {+ round: myRound,+ requestHash:+ wireApi === "responses" ? hashResponsesRequest(effectiveBody) : hashRequest(effectiveBody),+ digest: digestOf(effectiveBody, wireApi),+ sse: decoded,+ ...(usage ? { usage } : {}),+ ...(wireApi === "responses"+ ? {+ inboundPath,+ requestBodyBase64: effectiveBytes.toString("base64"),+ requestByteCount: effectiveBytes.byteLength,+ requestSha256: sha256(effectiveBytes),+ response: responseEvidence,+ terminalStatus: terminal?.status ?? "missing",+ }+ : {}),+ };+ rounds.push(recordedRound);+ retainAttempt({ attempt, phase: "complete", status: "recorded" });+ const headers: Record<string, string> =+ wireApi === "chat-completions" ? { "content-type": "text/event-stream" } : {};+ if (wireApi === "responses" && responseEvidence.contentType) {+ headers["content-type"] = responseEvidence.contentType;+ }+ res.writeHead(responseEvidence.status, headers);+ res.end(responseBytes);});await new Promise<void>((resolve) => server.listen(0, "127.0.0.1", resolve));const addr = server.address();if (!addr || typeof addr === "string") throw new Error("recorder has no address");- // `resolvedModel` est lu APRÈS coup : rien ne le connaît avant la première- // réponse, et le nom affiché au lancement est celui de la config. Un- // getter, donc, pas une valeur figée à zéro round.return {url: `http://127.0.0.1:${addr.port}/v1`,requests,+ attempts,get resolvedModel() {return resolvedModel;},- close: () => server.close(),+ close: () => {+ budget.abort();+ server.close();+ },};}export interface ReplayHandle extends ModelServerHandle {staleRounds: number[];- /** Throws when any round went stale. Called by the runner under WB_STRICT. */+ servedRounds: Array<{+ round: number;+ terminalStatus: CassetteRound["terminalStatus"] | "legacy-or-unknown";+ usage: Record<string, unknown> | null;+ status: number;+ contentType: string | null;+ bodySha256: string;+ }>;assertFresh: () => void;}-/** ponytail: a stale cassette is a silent liar — it answers a question the app- * no longer asks. `staleRounds` alone is a field a caller can forget to read,- * so `WB_STRICT=1` (or `onStale: "throw"`) turns it into a hard failure. */export function strictReplayRequested(): boolean {return process.env.WB_STRICT === "1";}@@ -232,55 +756,91 @@ export async function startReplay(options: {onStale?: "warn" | "throw";}): Promise<ReplayHandle> {const cassette = readCassette(options.file);+ const wireApi = cassette.wireApi ?? "chat-completions";+ const transport =+ cassette.transport ??+ transportIdentity({ wireApi: "chat-completions", limits: DEFAULT_TRANSPORT_LIMITS });const requests: CapturedRequest[] = [];const staleRounds: number[] = [];+ const servedRounds: ReplayHandle["servedRounds"] = [];let round = 0;-- const server: Server = createServer((req, res) => {- let body = "";- req.on("data", (c) => {- body += c;- });- req.on("end", () => {- const parsed = JSON.parse(body) as Record<string, unknown>;- const myRound = round;- round += 1;- const stored = cassette.rounds[myRound];- requests.push({+ const server: Server = createServer(async (req, res) => {+ const inboundPath = new URL(req.url ?? "/", "http://127.0.0.1").pathname;+ if (!transport.inboundPaths.includes(inboundPath)) {+ staleRounds.push(round);+ res.writeHead(404, { "content-type": "application/json" });+ res.end('{"error":"workbench replay: protocol/path mismatch"}');+ return;+ }+ let incoming: Buffer;+ try {+ incoming = await readIncoming(req, transport.limits.maxRequestBytes);+ } catch {+ res.writeHead(413, { "content-type": "application/json" });+ res.end('{"error":"workbench replay: request too large"}');+ return;+ }+ let parsed: Record<string, unknown>;+ try {+ parsed = JSON.parse(decodeUtf8(incoming)) as Record<string, unknown>;+ } catch {+ res.writeHead(400, { "content-type": "application/json" });+ res.end('{"error":"workbench replay: request is not UTF-8 JSON"}');+ return;+ }+ let effectiveBody: Record<string, unknown>;+ try {+ effectiveBody = applyRequestPolicy(parsed, transport);+ } catch {+ staleRounds.push(round);+ res.writeHead(409, { "content-type": "application/json" });+ res.end('{"error":"workbench replay: request policy mismatch"}');+ return;+ }+ const myRound = round++;+ requests.push(captureRequest(myRound, effectiveBody, wireApi));+ const stored = cassette.rounds[myRound];+ if (!stored) {+ staleRounds.push(myRound);+ res.writeHead(409, { "content-type": "application/json" });+ res.end('{"error":"workbench replay: cassette exhausted"}');+ return;+ }+ const requestHash =+ wireApi === "responses" ? hashResponsesRequest(effectiveBody) : hashRequest(effectiveBody);+ if (+ requestHash !== stored.requestHash ||+ (stored.inboundPath && stored.inboundPath !== inboundPath)+ ) {+ staleRounds.push(myRound);+ }+ if (wireApi === "responses" && stored.response) {+ const bytes = Buffer.from(stored.response.bodyBase64, "base64");+ const observed = responsesTerminalFromSse(decodeUtf8(bytes));+ servedRounds.push({round: myRound,- systemChars: digestOf(parsed).systemChars,- toolNames: ((parsed.tools ?? []) as Array<{ function?: { name?: string } }>).map(- (t) => t.function?.name ?? "?",- ),- messages: [],- raw: parsed,+ terminalStatus: observed.status,+ usage: observed.usage ?? null,+ status: stored.response.status,+ contentType: stored.response.contentType,+ bodySha256: sha256(bytes),});- if (!stored) {- // ponytail: the model asked for more rounds than were recorded —- // close the turn with an explicit marker rather than hanging.- res.writeHead(200, { "content-type": "text/event-stream" });- res.end(- `data: ${JSON.stringify({- id: `stale-${myRound}`,- object: "chat.completion.chunk",- created: 0,- model: cassette.model,- choices: [- {- index: 0,- delta: { content: "[workbench: cassette exhausted]" },- finish_reason: "stop",- },- ],- })}\n\ndata: [DONE]\n\n`,- );- staleRounds.push(myRound);- return;- }- if (hashRequest(parsed) !== stored.requestHash) staleRounds.push(myRound);- res.writeHead(200, { "content-type": "text/event-stream" });- res.end(stored.sse);+ const headers: Record<string, string> = {};+ if (stored.response.contentType) headers["content-type"] = stored.response.contentType;+ res.writeHead(stored.response.status, headers);+ res.end(bytes);+ return;+ }+ res.writeHead(200, { "content-type": "text/event-stream" });+ servedRounds.push({+ round: myRound,+ terminalStatus: "legacy-or-unknown",+ usage: usageFromSse(stored.sse) ?? null,+ status: 200,+ contentType: "text/event-stream",+ bodySha256: sha256(Buffer.from(stored.sse)),});+ res.end(stored.sse);});await new Promise<void>((resolve) => server.listen(0, "127.0.0.1", resolve));@@ -291,11 +851,17 @@ export async function startReplay(options: {url: `http://127.0.0.1:${addr.port}/v1`,requests,staleRounds,+ servedRounds,assertFresh: () => {+ if (round < cassette.rounds.length) {+ for (let missing = round; missing < cassette.rounds.length; missing += 1) {+ if (!staleRounds.includes(missing)) staleRounds.push(missing);+ }+ }if (staleRounds.length === 0) return;const message =`cassette ${options.file} périmée aux rounds ${staleRounds.join(", ")} — ` +- "le prompt système, les schémas d'outils ou l'historique ont changé ; ré-enregistrez-la.";+ "les instructions, schémas, historique, protocole ou politique de transport ont changé";if (strict) throw new Error(message);process.stderr.write(`[workbench] ${message}\n`);},diff --git a/workbench/lib/env.ts b/workbench/lib/env.tsindex c6c28a4db..739508f62 100644--- a/workbench/lib/env.ts+++ b/workbench/lib/env.ts@@ -12,17 +12,24 @@// it to every file under `workbench/`; it is deliberately the only place in the// repository that spells those names out.+import { type PublicHeaderProfile, publicHeaderProfile, type WireApi } from "./transport";+/** Env var names, in one place so the ban-list test can quote them. */export const ENV_KEYS = {apiKey: "OPENSCREEN_WORKBENCH_API_KEY",baseUrl: "OPENSCREEN_WORKBENCH_BASE_URL",model: "OPENSCREEN_WORKBENCH_MODEL",+ wireApi: "OPENSCREEN_WORKBENCH_WIRE_API",+ userAgent: "OPENSCREEN_WORKBENCH_USER_AGENT",+ originator: "OPENSCREEN_WORKBENCH_ORIGINATOR",} as const;export interface LiveEnv {model: string;baseUrl: string;apiKey: string;+ wireApi: WireApi;+ publicHeaders: PublicHeaderProfile;}function readVar(name: string): string | null {@@ -60,7 +67,39 @@ export function requireLiveEnv(): LiveEnv {}// The three nulls are excluded by the loop above; the casts keep `strict` happy// without re-reading process.env.- return { apiKey: apiKey as string, baseUrl: baseUrl as string, model: model as string };+ let parsedBase: URL;+ try {+ parsedBase = new URL(baseUrl as string);+ } catch {+ throw new Error(`${ENV_KEYS.baseUrl} doit être une URL absolue http(s)`);+ }+ if (+ !/^https?:$/.test(parsedBase.protocol) ||+ parsedBase.username ||+ parsedBase.password ||+ parsedBase.search ||+ parsedBase.hash+ ) {+ throw new Error(`${ENV_KEYS.baseUrl} doit être une URL http(s) sans identifiants`);+ }+ const rawWireApi = readVar(ENV_KEYS.wireApi) ?? "chat-completions";+ if (rawWireApi !== "chat-completions" && rawWireApi !== "responses") {+ throw new Error(+ `${ENV_KEYS.wireApi} doit valoir chat-completions ou responses, reçu ${rawWireApi}`,+ );+ }+ const headers: Record<string, string> = {};+ const userAgent = readVar(ENV_KEYS.userAgent);+ const originator = readVar(ENV_KEYS.originator);+ if (userAgent) headers["user-agent"] = userAgent;+ if (originator) headers.originator = originator;+ return {+ apiKey: apiKey as string,+ baseUrl: parsedBase.toString().replace(/\/$/, ""),+ model: model as string,+ wireApi: rawWireApi,+ publicHeaders: publicHeaderProfile(headers),+ };}/** True when all three variables are present — lets a suite skip cleanly. */diff --git a/workbench/lib/harness.ts b/workbench/lib/harness.tsindex ab333a0a9..7c0458b2e 100644--- a/workbench/lib/harness.ts+++ b/workbench/lib/harness.ts@@ -121,6 +121,8 @@ export interface RunScenarioOptions {* is itself worth measuring. */cursor?: CursorTelemetryReader;timeoutMs?: number;+ /** Runtime-only LangChain retry override. */+ maxRetries?: number;}/**@@ -214,11 +216,12 @@ export function sidecarCursorReader(export function offlineStore(options: {baseUrl: string;allowAgentEdits: boolean;+ model?: string;}): LlmConfigStore {return {getConfig: () => ({provider: "openai-compatible",- model: "workbench-scripted",+ model: options.model ?? "workbench-scripted",baseUrl: options.baseUrl,allowAgentEdits: options.allowAgentEdits,}),@@ -271,7 +274,7 @@ export async function runScenario(options: RunScenarioOptions): Promise<Scenarioevents.push({ kind: "toolEnd", name, ok, summary }),error: (m: string) => events.push({ kind: "error", text: m }),},- { cursor: options.cursor },+ { cursor: options.cursor, maxRetries: options.maxRetries },),guard.promise,]);diff --git a/workbench/lib/judge.ts b/workbench/lib/judge.tsindex 799c64a96..868b8c6ca 100644--- a/workbench/lib/judge.ts+++ b/workbench/lib/judge.ts@@ -31,6 +31,7 @@// `l0/judge.wb.ts` l'épingle au lieu de le promettre.import { containsSecret } from "./env";+import type { WireApi } from "./transport";import { transcriptFromSse } from "./wire";/** Les trois verdicts. Le troisième n'est pas un échec du juge, c'est un@@ -275,6 +276,7 @@ export interface JudgeEndpoint {model: string;/** Absente contre un serveur scripté ou un replay : ils n'authentifient rien. */apiKey?: string;+ wireApi?: WireApi;}export class JudgeTransportError extends Error {}@@ -299,13 +301,23 @@ export async function askJudge(options: {timeoutMs?: number;}): Promise<JudgeReading> {const messages = buildJudgeMessages(options.rubric, options.input);- const body = JSON.stringify({- model: options.endpoint.model,- messages,- // Un juge est une mesure : il doit rendre le même verdict deux fois.- temperature: 0,- stream: true,- });+ const wireApi = options.endpoint.wireApi ?? "chat-completions";+ const body = JSON.stringify(+ wireApi === "responses"+ ? {+ model: options.endpoint.model,+ input: messages,+ reasoning: { effort: "medium" },+ stream: true,+ }+ : {+ model: options.endpoint.model,+ messages,+ // Un juge est une mesure : il doit rendre le même verdict deux fois.+ temperature: 0,+ stream: true,+ },+ );if (containsSecret(body)) {throw new Error("refus d'envoyer le tour au juge : le payload contient la clé API ou un en-tête " +@@ -316,15 +328,20 @@ export async function askJudge(options: {const timer = setTimeout(() => controller.abort(), options.timeoutMs ?? 60_000);let sse: string;try {- const response = await fetch(`${options.endpoint.baseUrl}/chat/completions`, {- method: "POST",- headers: {- "content-type": "application/json",- ...(options.endpoint.apiKey ? { authorization: `Bearer ${options.endpoint.apiKey}` } : {}),+ const response = await fetch(+ `${options.endpoint.baseUrl}/${wireApi === "responses" ? "responses" : "chat/completions"}`,+ {+ method: "POST",+ headers: {+ "content-type": "application/json",+ ...(options.endpoint.apiKey+ ? { authorization: `Bearer ${options.endpoint.apiKey}` }+ : {}),+ },+ body,+ signal: controller.signal,},- body,- signal: controller.signal,- });+ );if (!response.ok) {// ponytail: une panne de transport n'est PAS un `indéterminé`. Le// troisième verdict dit « la réponse ne tranche pas » ; le confondrediff --git a/workbench/lib/measurement.ts b/workbench/lib/measurement.tsnew file mode 100644index 000000000..f3886707a--- /dev/null+++ b/workbench/lib/measurement.ts@@ -0,0 +1,1483 @@+import { randomUUID } from "node:crypto";+import {+ constants,+ copyFileSync,+ existsSync,+ lstatSync,+ mkdirSync,+ readFileSync,+ realpathSync,+ renameSync,+ rmSync,+ writeFileSync,+} from "node:fs";+import { dirname, isAbsolute, posix, relative, resolve, sep } from "node:path";+import { getScenario } from "../scenarios/registry";+import { readCassette, startReplay } from "./cassette";+import { containsSecret } from "./env";+import { offlineStore } from "./harness";+import { askJudge, type JudgeReading } from "./judge";+import {+ canonicalJson,+ captureSourceIdentity,+ type EndpointIdentity,+ endpointIdentity,+ SHA256_PATTERN,+ type SourceIdentity,+ SourceIdentityError,+ sha256Bytes,+ sha256Canonical,+ validateSourceIdentity,+} from "./provenance";+import type { WorkbenchReport } from "./report";+import { type RepetitionResult, runRepetition } from "./runner";+import type { Scenario } from "./scenario";+import { type ScoredRun, scoreRun } from "./score";+import { measurementTransportSha256, type TransportIdentity } from "./transport";++export const MEASUREMENTS_DIR = "workbench/measurements";+export const CANDIDATE_FILE = "measurement-candidate.json";+export const MANIFEST_FILE = "measurement.json";++export type MeasurementErrorCode =+ | "ARGUMENT_ERROR"+ | "ARTIFACT_HASH_MISMATCH"+ | "ARTIFACT_NOT_REGULAR"+ | "ARTIFACT_PATH_INVALID"+ | "ARTIFACT_ROLE_INVALID"+ | "AXIS_SCORE_MISMATCH"+ | "CANDIDATE_INCOMPLETE"+ | "CHECK_COUNT_MISMATCH"+ | "DUPLICATE_MEASUREMENT"+ | "IDENTITY_UNKNOWN"+ | "INCOMPATIBLE_IDENTITIES"+ | "LEGACY_SOURCE_IDENTITY"+ | "MANIFEST_INVALID"+ | "MEASUREMENT_ID_INVALID"+ | "MEASUREMENT_ID_MISMATCH"+ | "MEASUREMENT_NOT_FOUND"+ | "ORIGINAL_FIXTURE_UNAVAILABLE"+ | "PRIVACY_PRIVATE_PATH"+ | "PRIVACY_RAW_CONFIG"+ | "PRIVACY_SECRET"+ | "PRIVACY_TRANSCRIPT"+ | "REPLAY_MISMATCH"+ | "REVIEW_INVALID"+ | "REVIEW_MISSING"+ | "REVIEW_NOT_APPROVED"+ | "SCENARIO_NOT_PUBLIC_SYNTHETIC"+ | "SOURCE_IDENTITY_MISMATCH"+ | "SYMLINK_TRAVERSAL";++export class MeasurementError extends Error {+ constructor(+ readonly code: MeasurementErrorCode,+ message: string,+ ) {+ super(message);+ this.name = "MeasurementError";+ }+}++const PUBLIC_SYNTHETIC_SOURCES: Record<string, string> = {+ "camera-with-track": "workbench/scenarios/camera-track.scn.ts",+ "camera-without-track": "workbench/scenarios/camera-track.scn.ts",+ consent: "workbench/scenarios/consent.scn.ts",+ "cursor-blind": "workbench/scenarios/cursor-question.scn.ts",+ "cursor-question": "workbench/scenarios/cursor-question.scn.ts",+ "cut-silences-clean": "workbench/scenarios/cut-silences-clean.scn.ts",+ "describe-project": "workbench/scenarios/describe-project.scn.ts",+ "describe-zooms": "workbench/scenarios/describe-zooms.scn.ts",+ "describe-zooms-migrated": "workbench/scenarios/describe-zooms.scn.ts",+ "no-invented-bounds": "workbench/scenarios/no-invented-bounds.scn.ts",+ "out-of-scope-styling": "workbench/scenarios/out-of-scope-styling.scn.ts",+ "remove-one-modifier": "workbench/scenarios/remove-one-modifier.scn.ts",+ "reorder-clips": "workbench/scenarios/reorder-clips.scn.ts",+ "target-right-clip": "workbench/scenarios/target-right-clip.scn.ts",+ "wizard-enhance": "workbench/scenarios/wizard-enhance.scn.ts",+ "wizard-enhance-bare": "workbench/scenarios/wizard-enhance-bare.scn.ts",+};++export const PUBLIC_SYNTHETIC_SCENARIOS = new Set(Object.keys(PUBLIC_SYNTHETIC_SOURCES));++export type ArtifactRole =+ | "input-fixture"+ | "main-cassette"+ | "judge-cassette"+ | "recorded-checks"+ | "report"+ | "review-receipt";++const ARTIFACT_ROLES = new Set<ArtifactRole>([+ "input-fixture",+ "main-cassette",+ "judge-cassette",+ "recorded-checks",+ "report",+ "review-receipt",+]);++export interface ArtifactReference {+ role: ArtifactRole;+ path: string;+ sha256: string;+}++export interface RecordedCheck {+ id: string;+ axis: "behaviour" | "dsl";+ weight: number;+ ok: boolean;+ indeterminate: boolean;+}++export interface RecordedChecks {+ schema: 1;+ scenarioId: string;+ complete: boolean;+ repetitions: Array<{ rep: number; checks: RecordedCheck[] }>;+}++export interface CheckCounts {+ id: string;+ axis: "behaviour" | "dsl";+ weight: number;+ passed: number;+ decided: number;+ indeterminate: number;+ total: number;+}++export interface AxisCounts {+ passed: number;+ decided: number;+ indeterminate: number;+ total: number;+}++export interface MeasurementCounts {+ repetitions: number;+ axes: { behaviour: AxisCounts; dsl: AxisCounts };+ /** Mean of each repetition's weighted axis score, matching report.ts. */+ axisScores: { behaviour: number; dsl: number };+ checks: CheckCounts[];+}++export interface MeasurementIdentity {+ scenario: { id: string; kind: "public-synthetic" | "original-real"; judged: boolean };+ source: SourceIdentity;+ input: {+ fixtureSha256: string;+ documentSha256: string;+ telemetrySha256: string;+ };+ fingerprints: {+ promptSha256: string;+ systemSha256: string;+ toolsSha256: string;+ wireSha256: string;+ rubricSha256: string;+ /** Missing on historical manifests; treated as legacy/unknown. */+ transportSha256?: string;+ };+ models: {+ agent: { requested: string; observed: string };+ judge: { requested: string; observed: string };+ };+ provider: EndpointIdentity;+}++export interface ReviewReceipt {+ schema: 1;+ measurementId: string;+ reviewer: { kind: "human" | "independent"; label: string };+ disposition: "approved" | "rejected";+ reviewedAt: string;+ summary: string;+}++export interface MeasurementManifest extends MeasurementIdentity {+ schema: 1;+ id: string;+ createdAt: string;+ complete: boolean;+ artifacts: ArtifactReference[];+ results: MeasurementCounts;+ review: {+ disposition: ReviewReceipt["disposition"] | "unreviewed";+ reviewerKind: ReviewReceipt["reviewer"]["kind"] | "unknown";+ };+ usage?: {+ agent: ObservedUsageSummary;+ judge: ObservedUsageSummary | { status: "none" | "pending" };+ };+}++export interface ObservedUsageSummary {+ status: "complete" | "incomplete";+ attempts: number;+ rounds: number;+ withUsage: number;+ missingUsageRounds: number[];+ totals: Record<string, number>;+}++export interface PublicSyntheticFixture {+ schema: 1;+ kind: "public-synthetic";+ scenarioId: string;+ generator: string;+ documentSha256: string;+ telemetrySha256: string;+}++function fail(code: MeasurementErrorCode, message: string): never {+ throw new MeasurementError(code, message);+}++function requireSourceSchema(source: unknown): SourceIdentity {+ try {+ return validateSourceIdentity(source);+ } catch (error) {+ const message = error instanceof Error ? error.message : String(error);+ fail(+ error instanceof SourceIdentityError && message.includes("legacy dirty-only")+ ? "LEGACY_SOURCE_IDENTITY"+ : "IDENTITY_UNKNOWN",+ message,+ );+ }+}++/** The exact source half of the replay gate; HEAD and dirty state are provenance only. */+export function assertReplaySourceCompatible(recorded: unknown, current: unknown): void {+ const recordedSource = requireSourceSchema(recorded);+ const currentSource = requireSourceSchema(current);+ if (recordedSource.effectiveSha256 !== currentSource.effectiveSha256) {+ fail("SOURCE_IDENTITY_MISMATCH", "effective source content differs from the measurement");+ }+}++function readJson(file: string): unknown {+ try {+ return JSON.parse(readFileSync(file, "utf8"));+ } catch (error) {+ fail("MANIFEST_INVALID", `${file}: ${error instanceof Error ? error.message : String(error)}`);+ }+}++function writeJson(file: string, value: unknown): void {+ const payload = `${JSON.stringify(value, null, "\t")}\n`;+ if (containsSecret(payload)) fail("PRIVACY_SECRET", `${file}: payload contains a credential`);+ mkdirSync(dirname(file), { recursive: true });+ writeFileSync(file, payload, "utf8");+}++function assertString(value: unknown, label: string): asserts value is string {+ if (typeof value !== "string" || value.length === 0)+ fail("MANIFEST_INVALID", `${label} is required`);+}++function assertSha(value: unknown, label: string): asserts value is string {+ if (typeof value !== "string" || !SHA256_PATTERN.test(value)) {+ fail("MANIFEST_INVALID", `${label} must be a lowercase SHA256`);+ }+}++function validateMeasurementId(+ id: string,+ code: "ARGUMENT_ERROR" | "MEASUREMENT_ID_INVALID" = "ARGUMENT_ERROR",+): void {+ if (!/^[a-z0-9][a-z0-9._-]{0,63}$/.test(id)) {+ fail(code, "measurement id must be 1-64 lowercase letters, digits, dot, dash, or underscore");+ }+}++function validateRelativePath(path: unknown): asserts path is string {+ if (+ typeof path !== "string" ||+ path.length === 0 ||+ isAbsolute(path) ||+ path.includes("\\") ||+ path !== posix.normalize(path) ||+ path.split("/").some((part) => part === "" || part === "." || part === "..")+ ) {+ fail(+ "ARTIFACT_PATH_INVALID",+ `artifact path must be relative POSIX without dot segments: ${path}`,+ );+ }+}++function lowerPath(path: string): string {+ return process.platform === "win32" ? path.toLowerCase() : path;+}++function isWithin(root: string, candidate: string): boolean {+ const rootValue = lowerPath(resolve(root));+ const candidateValue = lowerPath(resolve(candidate));+ return candidateValue === rootValue || candidateValue.startsWith(`${rootValue}${sep}`);+}++function resolveArtifact(root: string, path: string): string {+ validateRelativePath(path);+ if (lstatSync(resolve(root)).isSymbolicLink()) {+ fail("SYMLINK_TRAVERSAL", "measurement package root is a symlink or junction");+ }+ const absolute = resolve(root, ...path.split("/"));+ if (!isWithin(root, absolute)) fail("ARTIFACT_PATH_INVALID", `${path} escapes its package`);+ let cursor = resolve(root);+ for (const segment of path.split("/")) {+ cursor = resolve(cursor, segment);+ let stat: ReturnType<typeof lstatSync>;+ try {+ stat = lstatSync(cursor);+ } catch {+ fail("ARTIFACT_NOT_REGULAR", `${path} does not exist`);+ }+ if (stat.isSymbolicLink()) fail("SYMLINK_TRAVERSAL", `${path} traverses a symlink or junction`);+ }+ const stat = lstatSync(absolute);+ if (!stat.isFile()) fail("ARTIFACT_NOT_REGULAR", `${path} is not a regular file`);+ const realRoot = realpathSync(root);+ const realFile = realpathSync(absolute);+ if (!isWithin(realRoot, realFile))+ fail("SYMLINK_TRAVERSAL", `${path} resolves outside its package`);+ return absolute;+}++function hashFile(file: string): string {+ return sha256Bytes(readFileSync(file));+}++function assertArtifact(root: string, ref: ArtifactReference): string {+ if (!ref || typeof ref !== "object")+ fail("MANIFEST_INVALID", "artifact reference must be an object");+ if (!ARTIFACT_ROLES.has(ref.role))+ fail("ARTIFACT_ROLE_INVALID", `unallowlisted role: ${ref.role}`);+ validateRelativePath(ref.path);+ assertSha(ref.sha256, `${ref.path}.sha256`);+ const file = resolveArtifact(root, ref.path);+ const actual = hashFile(file);+ if (actual !== ref.sha256) {+ fail("ARTIFACT_HASH_MISMATCH", `${ref.path}: expected ${ref.sha256}, got ${actual}`);+ }+ return file;+}++function privacyFailure(payload: string, knownSecrets: string[]): MeasurementError | null {+ for (const secret of knownSecrets) {+ if (secret.length >= 8 && payload.includes(secret)) {+ return new MeasurementError(+ "PRIVACY_SECRET",+ "artifact contains a caller-supplied credential",+ );+ }+ }+ if (+ containsSecret(payload) ||+ /\b(?:authorization\s*:\s*bearer|api[_-]?key\s*[:=]|x-api-key\s*[:=])\s*\S+/i.test(payload) ||+ /"(?:apiKey|authorization)"\s*:/i.test(payload)+ ) {+ return new MeasurementError(+ "PRIVACY_SECRET",+ "artifact contains a credential or authorization field",+ );+ }+ if (/"(?:baseUrl|rawEndpoint|endpoint|configuration)"\s*:/i.test(payload)) {+ return new MeasurementError(+ "PRIVACY_RAW_CONFIG",+ "artifact contains a raw endpoint or configuration field",+ );+ }+ const pathPayload = payload.replace(/\\\\/g, "\\");+ const privatePath = pathPayload.match(+ /(?:[A-Za-z]:\\|\\\\[A-Za-z0-9._-]+\\[A-Za-z0-9$._-]+|\/(?:Users|home|tmp|opt|srv|mnt|Volumes|root|data|private\/var|var\/(?:folders|lib|tmp))\/)/i,+ );+ if (privatePath) {+ return new MeasurementError(+ "PRIVACY_PRIVATE_PATH",+ `artifact contains an OS absolute private path (${privatePath[0]})`,+ );+ }+ if (/"(?:transcripts?|documents?|rawDocument)"\s*:/i.test(payload)) {+ return new MeasurementError(+ "PRIVACY_TRANSCRIPT",+ "artifact contains a forbidden transcript/document field",+ );+ }+ return null;+}++export function assertPublicArtifact(file: string, knownSecrets: string[] = []): void {+ const payload = readFileSync(file, "utf8");+ const issue = privacyFailure(payload, knownSecrets);+ if (issue) throw new MeasurementError(issue.code, `${file}: ${issue.message}`);+}++function artifactRef(root: string, file: string, role: ArtifactRole): ArtifactReference {+ const path = relative(root, file).replace(/\\/g, "/");+ validateRelativePath(path);+ return { role, path, sha256: hashFile(file) };+}++export function recordedChecksFromScored(+ scenarioId: string,+ entries: Array<{ rep: number; scored: ScoredRun }>,+ complete: boolean,+): RecordedChecks {+ return {+ schema: 1,+ scenarioId,+ complete,+ repetitions: entries.map(({ rep, scored }) => ({+ rep,+ checks: [+ ...scored.behaviour.results.map((check) => ({+ id: check.id,+ axis: "behaviour" as const,+ weight: check.weight,+ ok: check.ok,+ indeterminate: check.indeterminate,+ })),+ ...scored.dsl.results.map((check) => ({+ id: check.id,+ axis: "dsl" as const,+ weight: check.weight,+ ok: check.ok,+ indeterminate: check.indeterminate,+ })),+ ],+ })),+ };+}++export function recomputeMeasurementCounts(recorded: RecordedChecks): MeasurementCounts {+ if (+ recorded.schema !== 1 ||+ !recorded.scenarioId ||+ !Array.isArray(recorded.repetitions) ||+ recorded.repetitions.length === 0+ ) {+ fail("MANIFEST_INVALID", "recorded checks are empty or malformed");+ }+ const reps = new Set<number>();+ const byCheck = new Map<string, CheckCounts>();+ let roster: string[] | null = null;+ for (const repetition of recorded.repetitions) {+ if (+ !Number.isInteger(repetition.rep) ||+ reps.has(repetition.rep) ||+ !Array.isArray(repetition.checks)+ ) {+ fail("CHECK_COUNT_MISMATCH", `duplicate or invalid repetition ${repetition.rep}`);+ }+ for (const check of repetition.checks) {+ if (+ typeof check.id !== "string" ||+ check.id.length === 0 ||+ (check.axis !== "behaviour" && check.axis !== "dsl") ||+ typeof check.weight !== "number" ||+ !Number.isFinite(check.weight) ||+ check.weight <= 0 ||+ typeof check.ok !== "boolean" ||+ typeof check.indeterminate !== "boolean"+ ) {+ fail("CHECK_COUNT_MISMATCH", `repetition ${repetition.rep} has a malformed check`);+ }+ }+ reps.add(repetition.rep);+ const keys = repetition.checks+ .map((check) => `${check.axis}:${check.id}:${check.weight}`)+ .sort();+ if (new Set(keys).size !== keys.length) {+ fail("CHECK_COUNT_MISMATCH", `repetition ${repetition.rep} has duplicate checks`);+ }+ if (roster === null) roster = keys;+ else if (canonicalJson(roster) !== canonicalJson(keys)) {+ fail("CHECK_COUNT_MISMATCH", `repetition ${repetition.rep} changed the check denominator`);+ }+ for (const check of repetition.checks) {+ if (check.indeterminate && check.ok) {+ fail("CHECK_COUNT_MISMATCH", `${check.id} is both passing and indeterminate`);+ }+ const key = `${check.axis}:${check.id}`;+ const entry = byCheck.get(key) ?? {+ id: check.id,+ axis: check.axis,+ weight: check.weight,+ passed: 0,+ decided: 0,+ indeterminate: 0,+ total: 0,+ };+ entry.total += 1;+ if (check.indeterminate) entry.indeterminate += 1;+ else {+ entry.decided += 1;+ if (check.ok) entry.passed += 1;+ }+ byCheck.set(key, entry);+ }+ }+ const checks = [...byCheck.values()].sort((left, right) =>+ `${left.axis}:${left.id}`.localeCompare(`${right.axis}:${right.id}`),+ );+ const axis = (name: "behaviour" | "dsl"): AxisCounts =>+ checks+ .filter((check) => check.axis === name)+ .reduce(+ (sum, check) => ({+ passed: sum.passed + check.passed,+ decided: sum.decided + check.decided,+ indeterminate: sum.indeterminate + check.indeterminate,+ total: sum.total + check.total,+ }),+ { passed: 0, decided: 0, indeterminate: 0, total: 0 },+ );+ const scoreFor = (+ repetition: RecordedChecks["repetitions"][number],+ name: "behaviour" | "dsl",+ ): number => {+ const checks = repetition.checks.filter((check) => check.axis === name);+ const decidedWeight = checks.reduce(+ (sum, check) => sum + (check.indeterminate ? 0 : check.weight),+ 0,+ );+ if (decidedWeight === 0) return 1;+ const passedWeight = checks.reduce((sum, check) => sum + (check.ok ? check.weight : 0), 0);+ return passedWeight / decidedWeight;+ };+ const meanScore = (name: "behaviour" | "dsl"): number =>+ recorded.repetitions.reduce((sum, repetition) => sum + scoreFor(repetition, name), 0) /+ recorded.repetitions.length;+ return {+ repetitions: recorded.repetitions.length,+ axes: { behaviour: axis("behaviour"), dsl: axis("dsl") },+ axisScores: { behaviour: meanScore("behaviour"), dsl: meanScore("dsl") },+ checks,+ };+}++function scenarioRubricSha256(scenario: Scenario): string {+ return sha256Canonical({+ behaviour: scenario.behaviour.map((check) => ({+ id: check.id,+ weight: check.weight,+ })),+ judged: (scenario.judged ?? []).map((check) => ({+ id: check.id,+ weight: check.weight,+ rubric: check.rubric,+ })),+ dsl: scenario.dsl.map((check) => ({+ id: check.id,+ weight: check.weight,+ })),+ });+}++function publicFixtureFor(scenario: Scenario): PublicSyntheticFixture {+ if (!PUBLIC_SYNTHETIC_SCENARIOS.has(scenario.id)) {+ fail(+ scenario.id.startsWith("real-")+ ? "ORIGINAL_FIXTURE_UNAVAILABLE"+ : "SCENARIO_NOT_PUBLIC_SYNTHETIC",+ `${scenario.id}: only registered public synthetic scenarios may be exported`,+ );+ }+ const documentSha256 = sha256Canonical(scenario.document());+ const telemetrySha256 = sha256Canonical(scenario.cursorTelemetry?.() ?? null);+ return {+ schema: 1,+ kind: "public-synthetic",+ scenarioId: scenario.id,+ generator: PUBLIC_SYNTHETIC_SOURCES[scenario.id],+ documentSha256,+ telemetrySha256,+ };+}++function unknown(value: string | null | undefined): string {+ return value && value.trim().length > 0 ? value : "unknown";+}++function wireIdentity(results: RepetitionResult[]): MeasurementIdentity["fingerprints"] {+ const first = results[0]?.run.wire;+ return {+ promptSha256: "unknown",+ systemSha256: unknown(first?.systemSha256),+ toolsSha256: unknown(first?.toolsSha256),+ wireSha256: sha256Canonical(+ results.map((result) => ({+ rounds: result.run.wire.rounds,+ systemSha256: result.run.wire.systemSha256,+ toolsSha256: result.run.wire.toolsSha256,+ toolNames: result.run.wire.toolNames,+ })),+ ),+ rubricSha256: "unknown",+ };+}++function cassetteTransportProfiles(files: string[]): TransportIdentity[] | null {+ const profiles = files.map((file) => readCassette(file).transport);+ if (profiles.every((profile) => profile === undefined)) return null;+ if (profiles.some((profile) => profile === undefined)) {+ fail("INCOMPATIBLE_IDENTITIES", "measurement mixes legacy and transport-bound cassettes");+ }+ return profiles as TransportIdentity[];+}++function observedUsage(files: string[]): ObservedUsageSummary {+ const totals: Record<string, number> = {};+ const missingUsageRounds: number[] = [];+ let attempts = 0;+ let rounds = 0;+ let withUsage = 0;+ for (const file of files) {+ const cassette = readCassette(file);+ attempts += cassette.attempts?.length ?? cassette.rounds.length;+ for (const round of cassette.rounds) {+ const index = rounds++;+ if (!round.usage) {+ missingUsageRounds.push(index);+ continue;+ }+ withUsage += 1;+ for (const [name, value] of Object.entries(round.usage)) {+ if (typeof value === "number" && Number.isFinite(value)) {+ totals[name] = (totals[name] ?? 0) + value;+ }+ }+ }+ }+ return {+ status: missingUsageRounds.length === 0 && attempts === rounds ? "complete" : "incomplete",+ attempts,+ rounds,+ withUsage,+ missingUsageRounds,+ totals,+ };+}++export interface PrepareMeasurementCandidateOptions {+ runDir: string;+ scenario: Scenario;+ results: RepetitionResult[];+ cassetteFiles: string[];+ report: WorkbenchReport;+ requestedModel: string;+ observedModel?: string | null;+ provider: string;+ endpoint: string;+ source?: SourceIdentity;+ now?: Date;+}++/** Called by the real recording CLI; its run directory is the export input. */+export function prepareMeasurementCandidate(options: PrepareMeasurementCandidateOptions): {+ file: string;+ manifest: MeasurementManifest;+} {+ if (options.results.length === 0 || options.cassetteFiles.length !== options.results.length) {+ fail("CANDIDATE_INCOMPLETE", "a candidate needs one recorded cassette per repetition");+ }+ const runDir = resolve(options.runDir);+ mkdirSync(runDir, { recursive: true });+ const fixture = publicFixtureFor(options.scenario);+ const fixtureFile = resolve(runDir, "input-fixture.json");+ const checksFile = resolve(runDir, "recorded-checks.json");+ const reportFile = resolve(runDir, "measurement-report.json");+ writeJson(fixtureFile, fixture);+ const complete = (options.scenario.judged ?? []).length === 0;+ const recorded = recordedChecksFromScored(+ options.scenario.id,+ options.results.map((result) => ({ rep: result.rep, scored: result.scored })),+ complete,+ );+ writeJson(checksFile, recorded);+ writeJson(reportFile, options.report);+ const cassetteRefs = options.cassetteFiles.map((file) => {+ const absolute = resolve(file);+ if (!isWithin(runDir, absolute)) {+ fail("ARTIFACT_PATH_INVALID", `cassette must be recorded inside ${runDir}: ${file}`);+ }+ return artifactRef(runDir, absolute, "main-cassette");+ });+ const fingerprints = wireIdentity(options.results);+ fingerprints.promptSha256 = sha256Bytes(options.scenario.prompt.replace(/\r\n?/g, "\n"));+ fingerprints.rubricSha256 = scenarioRubricSha256(options.scenario);+ const agentTransports = cassetteTransportProfiles(options.cassetteFiles);+ if (agentTransports) {+ fingerprints.transportSha256 = measurementTransportSha256(agentTransports, "no-judge");+ }+ const manifest: MeasurementManifest = {+ schema: 1,+ id: "candidate",+ createdAt: (options.now ?? new Date()).toISOString(),+ complete,+ scenario: {+ id: options.scenario.id,+ kind: "public-synthetic",+ judged: (options.scenario.judged ?? []).length > 0,+ },+ source: options.source ?? captureSourceIdentity(),+ input: {+ fixtureSha256: hashFile(fixtureFile),+ documentSha256: fixture.documentSha256,+ telemetrySha256: fixture.telemetrySha256,+ },+ fingerprints,+ models: {+ agent: {+ requested: unknown(options.requestedModel),+ observed: unknown(options.observedModel),+ },+ judge: complete+ ? { requested: "none", observed: "none" }+ : { requested: "unknown", observed: "unknown" },+ },+ provider: endpointIdentity(options.provider, options.endpoint),+ artifacts: [+ artifactRef(runDir, fixtureFile, "input-fixture"),+ ...cassetteRefs,+ artifactRef(runDir, checksFile, "recorded-checks"),+ artifactRef(runDir, reportFile, "report"),+ ],+ results: recomputeMeasurementCounts(recorded),+ review: { disposition: "unreviewed", reviewerKind: "unknown" },+ usage: {+ agent: observedUsage(options.cassetteFiles),+ judge: complete ? { status: "none" } : { status: "pending" },+ },+ };+ const file = resolve(runDir, CANDIDATE_FILE);+ writeJson(file, manifest);+ return { file, manifest };+}++export function finalizeJudgedMeasurementCandidate(options: {+ runDir: string;+ scenario: Scenario;+ scored: Array<{ rep: number; scored: ScoredRun }>;+ judgeCassetteFile: string;+ report: WorkbenchReport;+ requestedJudgeModel: string;+ observedJudgeModel?: string | null;+ provider: string;+ endpoint: string;+}): { file: string; manifest: MeasurementManifest } {+ const runDir = resolve(options.runDir);+ const file = resolve(runDir, CANDIDATE_FILE);+ const candidate = assertManifestShape(readJson(file));+ if (candidate.scenario.id !== options.scenario.id || !candidate.scenario.judged) {+ fail("MANIFEST_INVALID", "judge result does not match a judged measurement candidate");+ }+ const currentSource = captureSourceIdentity();+ assertReplaySourceCompatible(candidate.source, currentSource);+ if (+ canonicalJson(candidate.provider) !==+ canonicalJson(endpointIdentity(options.provider, options.endpoint))+ ) {+ fail("INCOMPATIBLE_IDENTITIES", "judge provider/endpoint differs from the agent measurement");+ }+ if (!isWithin(runDir, resolve(options.judgeCassetteFile))) {+ fail(+ "ARTIFACT_PATH_INVALID",+ "judge cassette must be recorded inside the candidate run directory",+ );+ }+ const recorded = recordedChecksFromScored(options.scenario.id, options.scored, true);+ const checksFile = resolve(runDir, "recorded-checks.json");+ const reportFile = resolve(runDir, "measurement-report.json");+ writeJson(checksFile, recorded);+ writeJson(reportFile, options.report);+ const preserved = candidate.artifacts.filter(+ (ref) =>+ ref.role !== "recorded-checks" && ref.role !== "report" && ref.role !== "judge-cassette",+ );+ const agentCassetteFiles = candidate.artifacts+ .filter((ref) => ref.role === "main-cassette")+ .map((ref) => resolveArtifact(runDir, ref.path));+ const agentTransports = cassetteTransportProfiles(agentCassetteFiles);+ const judgeTransport = readCassette(resolve(options.judgeCassetteFile)).transport;+ if ((agentTransports === null) !== (judgeTransport === undefined)) {+ fail("INCOMPATIBLE_IDENTITIES", "agent and judge transport identity generations differ");+ }+ const manifest: MeasurementManifest = {+ ...candidate,+ complete: true,+ fingerprints: {+ ...candidate.fingerprints,+ ...(agentTransports && judgeTransport+ ? { transportSha256: measurementTransportSha256(agentTransports, judgeTransport) }+ : {}),+ },+ models: {+ ...candidate.models,+ judge: {+ requested: unknown(options.requestedJudgeModel),+ observed: unknown(options.observedJudgeModel),+ },+ },+ artifacts: [+ ...preserved,+ artifactRef(runDir, resolve(options.judgeCassetteFile), "judge-cassette"),+ artifactRef(runDir, checksFile, "recorded-checks"),+ artifactRef(runDir, reportFile, "report"),+ ],+ results: recomputeMeasurementCounts(recorded),+ usage: {+ agent: candidate.usage?.agent ?? observedUsage(agentCassetteFiles),+ judge: observedUsage([resolve(options.judgeCassetteFile)]),+ },+ };+ writeJson(file, manifest);+ return { file, manifest };+}++function validateReview(value: unknown, id: string): ReviewReceipt {+ const receipt = value as Partial<ReviewReceipt>;+ const keys = value !== null && typeof value === "object" ? Object.keys(value).sort() : [];+ const reviewerKeys =+ receipt.reviewer !== null && typeof receipt.reviewer === "object"+ ? Object.keys(receipt.reviewer).sort()+ : [];+ if (+ canonicalJson(keys) !==+ canonicalJson(+ ["disposition", "measurementId", "reviewedAt", "reviewer", "schema", "summary"].sort(),+ ) ||+ canonicalJson(reviewerKeys) !== canonicalJson(["kind", "label"].sort()) ||+ receipt.schema !== 1 ||+ receipt.measurementId !== id ||+ (receipt.reviewer?.kind !== "human" && receipt.reviewer?.kind !== "independent") ||+ typeof receipt.reviewer?.label !== "string" ||+ receipt.reviewer.label.trim().length === 0 ||+ (receipt.disposition !== "approved" && receipt.disposition !== "rejected") ||+ typeof receipt.reviewedAt !== "string" ||+ Number.isNaN(Date.parse(receipt.reviewedAt)) ||+ typeof receipt.summary !== "string" ||+ receipt.summary.trim().length === 0+ ) {+ fail(+ "REVIEW_INVALID",+ "review receipt must identify the measurement, reviewer, disposition, time, and summary",+ );+ }+ return receipt as ReviewReceipt;+}++function assertManifestShape(value: unknown): MeasurementManifest {+ const manifest = value as Partial<MeasurementManifest>;+ if (+ manifest.schema !== 1 ||+ typeof manifest.id !== "string" ||+ typeof manifest.createdAt !== "string" ||+ typeof manifest.complete !== "boolean" ||+ !manifest.scenario ||+ !manifest.source ||+ !manifest.input ||+ !manifest.fingerprints ||+ !manifest.models ||+ !manifest.provider ||+ !Array.isArray(manifest.artifacts) ||+ !manifest.results ||+ !manifest.review+ ) {+ fail("MANIFEST_INVALID", "measurement manifest is missing required version 1 fields");+ }+ validateMeasurementId(manifest.id, "MEASUREMENT_ID_INVALID");+ assertString(manifest.scenario.id, "scenario.id");+ if (!/^[a-z0-9][a-z0-9-]*$/.test(manifest.scenario.id)) {+ fail("MANIFEST_INVALID", "scenario.id must be kebab-case");+ }+ if (manifest.scenario.kind !== "public-synthetic" && manifest.scenario.kind !== "original-real") {+ fail("MANIFEST_INVALID", "scenario.kind is invalid");+ }+ if (typeof manifest.scenario.judged !== "boolean") {+ fail("MANIFEST_INVALID", "scenario.judged must be boolean");+ }+ try {+ validateSourceIdentity(manifest.source);+ } catch (error) {+ const message = error instanceof Error ? error.message : String(error);+ fail(+ error instanceof SourceIdentityError && message.includes("legacy dirty-only")+ ? "LEGACY_SOURCE_IDENTITY"+ : "MANIFEST_INVALID",+ message,+ );+ }+ for (const [key, value] of Object.entries(manifest.input)) assertSha(value, `input.${key}`);+ for (const [key, value] of Object.entries(manifest.fingerprints)) {+ if (value !== "unknown") assertSha(value, `fingerprints.${key}`);+ }+ assertString(manifest.models.agent.requested, "models.agent.requested");+ assertString(manifest.models.agent.observed, "models.agent.observed");+ assertString(manifest.models.judge.requested, "models.judge.requested");+ assertString(manifest.models.judge.observed, "models.judge.observed");+ assertString(manifest.provider.provider, "provider.provider");+ assertSha(manifest.provider.endpointSha256, "provider.endpointSha256");+ return manifest as MeasurementManifest;+}++function roleRefs(manifest: MeasurementManifest, role: ArtifactRole): ArtifactReference[] {+ return manifest.artifacts.filter((ref) => ref.role === role);+}++function assertRequiredRoles(manifest: MeasurementManifest): void {+ for (const ref of manifest.artifacts) {+ if (!ARTIFACT_ROLES.has(ref.role))+ fail("ARTIFACT_ROLE_INVALID", `unallowlisted role: ${ref.role}`);+ }+ for (const role of ["input-fixture", "main-cassette", "recorded-checks", "report"] as const) {+ if (roleRefs(manifest, role).length === 0)+ fail("CANDIDATE_INCOMPLETE", `missing ${role} artifact`);+ }+ if (manifest.complete && manifest.scenario.judged) {+ if (roleRefs(manifest, "judge-cassette").length === 0) {+ fail("CANDIDATE_INCOMPLETE", "judged measurement is missing its judge cassette");+ }+ }+}++function assertCountsAgainstReport(manifest: MeasurementManifest, report: WorkbenchReport): void {+ const scenario = report.scenarios.find((entry) => entry.scenarioId === manifest.scenario.id);+ if (!scenario) fail("CHECK_COUNT_MISMATCH", "report does not contain the measured scenario");+ if (+ report.scenarios.length !== 1 ||+ scenario.reps !== manifest.results.repetitions ||+ scenario.checks.length !== manifest.results.checks.length+ ) {+ fail("CHECK_COUNT_MISMATCH", "report scenario/check denominators do not match the measurement");+ }+ const reportModel = manifest.scenario.judged+ ? manifest.models.judge.requested+ : manifest.models.agent.requested;+ if (+ report.fingerprint.systemSha256 !== manifest.fingerprints.systemSha256 ||+ report.fingerprint.toolsSha256 !== manifest.fingerprints.toolsSha256 ||+ report.fingerprint.model !== reportModel ||+ report.fingerprint.reps !== manifest.results.repetitions ||+ report.fingerprint.effectiveSourceSha256 !== manifest.source.effectiveSha256+ ) {+ fail("INCOMPATIBLE_IDENTITIES", "report fingerprint does not match the measurement identity");+ }+ for (const count of manifest.results.checks) {+ const reported = scenario.checks.find(+ (entry) => entry.id === count.id && entry.axis === count.axis,+ );+ if (+ !reported ||+ reported.weight !== count.weight ||+ reported.passed !== count.passed ||+ reported.total !== count.total ||+ reported.indeterminate !== count.indeterminate+ ) {+ fail("CHECK_COUNT_MISMATCH", `report summary changed ${count.axis}/${count.id}`);+ }+ }+ if (+ Math.abs(scenario.behaviour.rate - manifest.results.axisScores.behaviour) > 1e-12 ||+ Math.abs(scenario.dsl.rate - manifest.results.axisScores.dsl) > 1e-12+ ) {+ fail("AXIS_SCORE_MISMATCH", "report weighted behaviour/DSL scores changed");+ }+}++function assertCassettes(manifest: MeasurementManifest, root: string): void {+ const assertOne = (ref: ArtifactReference, judged: boolean): void => {+ let cassette: ReturnType<typeof readCassette>;+ try {+ cassette = readCassette(resolveArtifact(root, ref.path));+ } catch (error) {+ fail("MANIFEST_INVALID", `${ref.path} is not a readable cassette: ${String(error)}`);+ }+ const expectedScenario = judged ? `judge-${manifest.scenario.id}` : manifest.scenario.id;+ const expectedModel = judged+ ? manifest.models.judge.requested+ : manifest.models.agent.requested;+ const observedModel = judged ? manifest.models.judge.observed : manifest.models.agent.observed;+ if (+ cassette.scenario !== expectedScenario ||+ cassette.provider !== manifest.provider.provider ||+ cassette.model !== expectedModel ||+ !Array.isArray(cassette.rounds) ||+ cassette.rounds.length === 0+ ) {+ fail("MANIFEST_INVALID", `${ref.path} cassette identity is inconsistent with the manifest`);+ }+ if (observedModel !== "unknown" && cassette.resolvedModel !== observedModel) {+ fail("MANIFEST_INVALID", `${ref.path} observed model is inconsistent with the manifest`);+ }+ if (+ cassette.wireApi === "responses" &&+ cassette.rounds.some(+ (round) =>+ round.terminalStatus !== "completed" ||+ !round.response ||+ round.response.status < 200 ||+ round.response.status >= 300,+ )+ ) {+ fail("CANDIDATE_INCOMPLETE", `${ref.path} contains a failed Responses round`);+ }+ if (+ cassette.wireApi === "responses" &&+ (!cassette.attempts ||+ cassette.attempts.length !== cassette.rounds.length ||+ cassette.attempts.some((attempt) => attempt.status !== "recorded"))+ ) {+ fail(+ "CANDIDATE_INCOMPLETE",+ `${ref.path} contains an unmatched rejected or failed Responses attempt`,+ );+ }+ };+ for (const ref of roleRefs(manifest, "main-cassette")) assertOne(ref, false);+ for (const ref of roleRefs(manifest, "judge-cassette")) assertOne(ref, true);+}++function assertTransportFingerprint(manifest: MeasurementManifest, root: string): void {+ const agentFiles = roleRefs(manifest, "main-cassette").map((ref) =>+ resolveArtifact(root, ref.path),+ );+ const agent = cassetteTransportProfiles(agentFiles);+ const judgeRef = roleRefs(manifest, "judge-cassette")[0];+ const judge = judgeRef ? readCassette(resolveArtifact(root, judgeRef.path)).transport : undefined;+ if (agent === null && judge === undefined) {+ if (manifest.fingerprints.transportSha256 !== undefined) {+ fail("INCOMPATIBLE_IDENTITIES", "legacy cassettes cannot claim a transport fingerprint");+ }+ return;+ }+ if (agent === null || (judgeRef && judge === undefined)) {+ fail("INCOMPATIBLE_IDENTITIES", "measurement mixes legacy and transport-bound cassettes");+ }+ const expected = measurementTransportSha256(agent, judge ?? "no-judge");+ if (manifest.fingerprints.transportSha256 !== expected) {+ fail("INCOMPATIBLE_IDENTITIES", "measurement transport fingerprint does not match cassettes");+ }+}++function assertObservedUsage(manifest: MeasurementManifest, root: string): void {+ if (!manifest.usage) return;+ const agent = observedUsage(+ roleRefs(manifest, "main-cassette").map((ref) => resolveArtifact(root, ref.path)),+ );+ if (canonicalJson(agent) !== canonicalJson(manifest.usage.agent)) {+ fail("MANIFEST_INVALID", "agent observed usage summary does not match cassettes");+ }+ const judgeRefs = roleRefs(manifest, "judge-cassette");+ const judge =+ judgeRefs.length === 0+ ? manifest.complete+ ? { status: "none" as const }+ : { status: "pending" as const }+ : observedUsage(judgeRefs.map((ref) => resolveArtifact(root, ref.path)));+ if (canonicalJson(judge) !== canonicalJson(manifest.usage.judge)) {+ fail("MANIFEST_INVALID", "judge observed usage summary does not match cassettes");+ }+}++function assertFixture(manifest: MeasurementManifest, root: string): void {+ const refs = roleRefs(manifest, "input-fixture");+ if (refs.length !== 1) fail("CANDIDATE_INCOMPLETE", "exactly one input fixture is required");+ const fixture = readJson(resolveArtifact(root, refs[0].path)) as Partial<PublicSyntheticFixture>;+ const keys = Object.keys(fixture).sort();+ const expectedKeys = [+ "documentSha256",+ "generator",+ "kind",+ "scenarioId",+ "schema",+ "telemetrySha256",+ ].sort();+ if (canonicalJson(keys) !== canonicalJson(expectedKeys)) {+ fail("MANIFEST_INVALID", "public synthetic fixture has fields outside its exact schema");+ }+ if (+ fixture.schema !== 1 ||+ fixture.kind !== "public-synthetic" ||+ fixture.scenarioId !== manifest.scenario.id ||+ fixture.generator !== PUBLIC_SYNTHETIC_SOURCES[manifest.scenario.id]+ ) {+ fail("MANIFEST_INVALID", "public synthetic fixture identity does not match the manifest");+ }+ assertSha(fixture.documentSha256, "fixture.documentSha256");+ assertSha(fixture.telemetrySha256, "fixture.telemetrySha256");+ if (+ manifest.input.fixtureSha256 !== refs[0].sha256 ||+ manifest.input.documentSha256 !== fixture.documentSha256 ||+ manifest.input.telemetrySha256 !== fixture.telemetrySha256+ ) {+ fail("MANIFEST_INVALID", "fixture/document/telemetry identity does not match the manifest");+ }+}++export interface VerifiedMeasurement {+ directory: string;+ manifest: MeasurementManifest;+ recorded: RecordedChecks;+ review: ReviewReceipt;+}++export function verifyMeasurementDirectory(+ directory: string,+ options: { knownSecrets?: string[]; requireApprovedReview?: boolean } = {},+): VerifiedMeasurement {+ const root = resolve(directory);+ if (!existsSync(root)) fail("MEASUREMENT_NOT_FOUND", `${directory} does not exist`);+ const manifestFile = resolve(root, MANIFEST_FILE);+ assertPublicArtifact(manifestFile, options.knownSecrets);+ const manifest = assertManifestShape(readJson(manifestFile));+ if (!manifest.complete) fail("CANDIDATE_INCOMPLETE", `${manifest.id} is not complete`);+ if (+ manifest.scenario.kind !== "public-synthetic" ||+ !PUBLIC_SYNTHETIC_SCENARIOS.has(manifest.scenario.id)+ ) {+ fail(+ "SCENARIO_NOT_PUBLIC_SYNTHETIC",+ `${manifest.scenario.id} is not registered public synthetic input`,+ );+ }+ assertRequiredRoles(manifest);+ const paths = new Set<string>();+ for (const ref of manifest.artifacts) {+ if (paths.has(ref.path)) fail("MANIFEST_INVALID", `duplicate artifact path ${ref.path}`);+ paths.add(ref.path);+ const file = assertArtifact(root, ref);+ assertPublicArtifact(file, options.knownSecrets);+ }+ assertFixture(manifest, root);+ assertCassettes(manifest, root);+ assertTransportFingerprint(manifest, root);+ assertObservedUsage(manifest, root);+ if (roleRefs(manifest, "main-cassette").length !== manifest.results.repetitions) {+ fail("CANDIDATE_INCOMPLETE", "main cassette count must equal the recorded repetition count");+ }+ const checksRefs = roleRefs(manifest, "recorded-checks");+ if (checksRefs.length !== 1)+ fail("CANDIDATE_INCOMPLETE", "exactly one recorded-checks artifact is required");+ const recorded = readJson(resolveArtifact(root, checksRefs[0].path)) as RecordedChecks;+ if (!recorded.complete) fail("CANDIDATE_INCOMPLETE", "recorded checks are not complete");+ const recomputed = recomputeMeasurementCounts(recorded);+ if (canonicalJson(recomputed) !== canonicalJson(manifest.results)) {+ fail("CHECK_COUNT_MISMATCH", "manifest k/n does not match recorded check outcomes");+ }+ const reportRefs = roleRefs(manifest, "report");+ if (reportRefs.length !== 1)+ fail("CANDIDATE_INCOMPLETE", "exactly one report artifact is required");+ assertCountsAgainstReport(+ manifest,+ readJson(resolveArtifact(root, reportRefs[0].path)) as WorkbenchReport,+ );+ const reviewRefs = roleRefs(manifest, "review-receipt");+ if (reviewRefs.length !== 1)+ fail("REVIEW_MISSING", "exactly one explicit review receipt is required");+ const review = validateReview(readJson(resolveArtifact(root, reviewRefs[0].path)), manifest.id);+ if (+ manifest.review.disposition !== review.disposition ||+ manifest.review.reviewerKind !== review.reviewer.kind+ ) {+ fail("REVIEW_INVALID", "manifest review summary does not match its receipt");+ }+ if (options.requireApprovedReview && review.disposition !== "approved") {+ fail(+ "REVIEW_NOT_APPROVED",+ `${manifest.id} was reviewed with disposition ${review.disposition}`,+ );+ }+ return { directory: root, manifest, recorded, review };+}++export function exportMeasurement(options: {+ runDir: string;+ id: string;+ reviewFile: string;+ measurementsDir?: string;+ knownSecrets?: string[];+}): string {+ validateMeasurementId(options.id);+ const runDir = resolve(options.runDir);+ if (!existsSync(runDir)) fail("MEASUREMENT_NOT_FOUND", `${options.runDir} does not exist`);+ const candidate = assertManifestShape(readJson(resolve(runDir, CANDIDATE_FILE)));+ if (!candidate.complete)+ fail("CANDIDATE_INCOMPLETE", `${candidate.scenario.id} still needs its judge pass`);+ if (+ candidate.scenario.kind !== "public-synthetic" ||+ !PUBLIC_SYNTHETIC_SCENARIOS.has(candidate.scenario.id)+ ) {+ fail("SCENARIO_NOT_PUBLIC_SYNTHETIC", `${candidate.scenario.id} cannot be exported`);+ }+ assertRequiredRoles(candidate);+ const reviewPath = resolve(options.reviewFile);+ if (!existsSync(reviewPath)) fail("REVIEW_MISSING", `${options.reviewFile} does not exist`);+ assertPublicArtifact(reviewPath, options.knownSecrets);+ const review = validateReview(readJson(reviewPath), options.id);+ const sourceFiles = candidate.artifacts.map((ref) => ({+ ref,+ file: assertArtifact(runDir, ref),+ }));+ for (const entry of sourceFiles) assertPublicArtifact(entry.file, options.knownSecrets);+ const root = resolve(options.measurementsDir ?? MEASUREMENTS_DIR);+ const destination = resolve(root, options.id);+ if (!isWithin(root, destination))+ fail("ARTIFACT_PATH_INVALID", "measurement id escapes destination");+ if (existsSync(destination)) fail("DUPLICATE_MEASUREMENT", `${options.id} already exists`);+ const temporary = resolve(root, `.tmp-${options.id}-${randomUUID()}`);+ mkdirSync(temporary, { recursive: true });+ try {+ const refs: ArtifactReference[] = [];+ for (const entry of sourceFiles) {+ const target = resolve(temporary, ...entry.ref.path.split("/"));+ mkdirSync(dirname(target), { recursive: true });+ copyFileSync(entry.file, target, constants.COPYFILE_EXCL);+ const copiedHash = hashFile(target);+ if (copiedHash !== entry.ref.sha256) {+ fail("ARTIFACT_HASH_MISMATCH", `${entry.ref.path} changed during adoption`);+ }+ refs.push(entry.ref);+ }+ const reviewName = "review.json";+ const reviewTarget = resolve(temporary, reviewName);+ copyFileSync(reviewPath, reviewTarget, constants.COPYFILE_EXCL);+ refs.push(artifactRef(temporary, reviewTarget, "review-receipt"));+ const manifest: MeasurementManifest = {+ ...candidate,+ id: options.id,+ artifacts: refs,+ review: { disposition: review.disposition, reviewerKind: review.reviewer.kind },+ };+ writeJson(resolve(temporary, MANIFEST_FILE), manifest);+ verifyMeasurementDirectory(temporary, { knownSecrets: options.knownSecrets });+ mkdirSync(root, { recursive: true });+ renameSync(temporary, destination);+ } catch (error) {+ rmSync(temporary, { recursive: true, force: true });+ throw error;+ }+ return destination;+}++const IDENTITY_FIELDS: Array<[string, (identity: MeasurementIdentity) => string]> = [+ ["scenario", (x) => `${x.scenario.kind}:${x.scenario.id}:${x.scenario.judged}`],+ ["source.effectiveSha256", (x) => x.source.effectiveSha256],+ ["fixture", (x) => x.input.fixtureSha256],+ ["document", (x) => x.input.documentSha256],+ ["telemetry", (x) => x.input.telemetrySha256],+ ["prompt", (x) => x.fingerprints.promptSha256],+ ["system", (x) => x.fingerprints.systemSha256],+ ["tools", (x) => x.fingerprints.toolsSha256],+ ["wire", (x) => x.fingerprints.wireSha256],+ ["rubric", (x) => x.fingerprints.rubricSha256],+ ["transport", (x) => x.fingerprints.transportSha256 ?? "unknown"],+ ["provider", (x) => x.provider.provider],+ ["endpoint", (x) => x.provider.endpointSha256],+ ["agent.requested", (x) => x.models.agent.requested],+ ["agent.observed", (x) => x.models.agent.observed],+ ["judge.requested", (x) => x.models.judge.requested],+ ["judge.observed", (x) => x.models.judge.observed],+];++export function identityDifferences(+ left: MeasurementIdentity,+ right: MeasurementIdentity,+): string[] {+ return IDENTITY_FIELDS.filter(([, read]) => read(left) !== read(right)).map(([name]) => name);+}++export function assertComparable(left: MeasurementIdentity, right: MeasurementIdentity): void {+ requireSourceSchema(left.source);+ requireSourceSchema(right.source);+ for (const [name, read] of IDENTITY_FIELDS) {+ if (+ name === "transport" &&+ left.fingerprints.transportSha256 === undefined &&+ right.fingerprints.transportSha256 === undefined+ ) {+ continue;+ }+ if (read(left) === "unknown" || read(right) === "unknown") {+ fail("IDENTITY_UNKNOWN", `${name} is unknown and cannot establish comparability`);+ }+ }+ const differences = identityDifferences(left, right);+ if (differences.length > 0) {+ fail(+ "INCOMPATIBLE_IDENTITIES",+ `non-comparable measurement identities: ${differences.join(", ")}`,+ );+ }+}++function manifestPath(id: string, measurementsDir = MEASUREMENTS_DIR): string {+ validateMeasurementId(id);+ return resolve(measurementsDir, id);+}++export function verifyMeasurementId(+ id: string,+ measurementsDir = MEASUREMENTS_DIR,+): VerifiedMeasurement {+ const verified = verifyMeasurementDirectory(manifestPath(id, measurementsDir));+ if (verified.manifest.id !== id) {+ fail(+ "MEASUREMENT_ID_MISMATCH",+ `requested measurement ${id} contains manifest id ${verified.manifest.id}`,+ );+ }+ return verified;+}++export async function replayMeasurement(+ id: string,+ measurementsDir = MEASUREMENTS_DIR,+): Promise<MeasurementCounts> {+ const verified = verifyMeasurementId(id, measurementsDir);+ const current = captureSourceIdentity();+ assertReplaySourceCompatible(verified.manifest.source, current);+ const scenario = getScenario(verified.manifest.scenario.id);+ if ((scenario.judged ?? []).length > 0 !== verified.manifest.scenario.judged) {+ fail(+ "SOURCE_IDENTITY_MISMATCH",+ "current scenario judging contract differs from the measurement",+ );+ }+ const mainRefs = roleRefs(verified.manifest, "main-cassette");+ const results: RepetitionResult[] = [];+ for (const [rep, ref] of mainRefs.entries()) {+ const cassetteFile = resolveArtifact(verified.directory, ref.path);+ const cassette = readCassette(cassetteFile);+ const replay = await startReplay({+ file: cassetteFile,+ onStale: "throw",+ });+ try {+ results.push(+ await runRepetition({+ scenario,+ rep,+ endpoint: replay,+ store: offlineStore({+ baseUrl: replay.url,+ allowAgentEdits: scenario.allowAgentEdits ?? true,+ model: cassette.model,+ }),+ maxRetries: cassette.wireApi === "responses" ? 0 : undefined,+ }),+ );+ } finally {+ replay.close();+ }+ replay.assertFresh();+ }+ const judged = scenario.judged ?? [];+ let scored = results.map((result) => ({ rep: result.rep, scored: result.scored }));+ if (judged.length > 0) {+ const refs = roleRefs(verified.manifest, "judge-cassette");+ if (refs.length !== 1)+ fail("CANDIDATE_INCOMPLETE", "judged replay needs exactly one judge cassette");+ const judgeCassette = readCassette(resolveArtifact(verified.directory, refs[0].path));+ const replay = await startReplay({+ file: resolveArtifact(verified.directory, refs[0].path),+ onStale: "throw",+ });+ try {+ scored = [];+ for (const result of results) {+ const readings = new Map<string, JudgeReading>();+ for (const check of judged) {+ const reading = await askJudge({+ endpoint: {+ baseUrl: replay.url,+ model: judgeCassette.model,+ wireApi: judgeCassette.wireApi ?? "chat-completions",+ },+ rubric: check.rubric,+ input: {+ prompt: scenario.prompt,+ answer: result.run.answer,+ facts: check.facts(result.context),+ },+ });+ readings.set(check.id, reading);+ }+ scored.push({ rep: result.rep, scored: scoreRun(scenario, result.context, readings) });+ }+ } finally {+ replay.close();+ }+ replay.assertFresh();+ }+ const actual = recomputeMeasurementCounts(recordedChecksFromScored(scenario.id, scored, true));+ if (canonicalJson(actual) !== canonicalJson(verified.manifest.results)) {+ fail("REPLAY_MISMATCH", "offline cassette replay did not reproduce recorded check outcomes");+ }+ return actual;+}++export interface BoundBaseline {+ schema: 2;+ binding: "measurement-v1";+ measurementId: string;+ recordedAt: string;+ effectiveSourceSha256: string;+ identity: MeasurementIdentity;+ counts: MeasurementCounts;+ expectedFailures: string[];+}++export function boundBaselineFromMeasurement(verified: VerifiedMeasurement): BoundBaseline {+ if (verified.review.disposition !== "approved") {+ fail("REVIEW_NOT_APPROVED", `${verified.manifest.id} is not approved for a baseline claim`);+ }+ assertComparable(verified.manifest, verified.manifest);+ return {+ schema: 2,+ binding: "measurement-v1",+ measurementId: verified.manifest.id,+ recordedAt: verified.manifest.createdAt,+ effectiveSourceSha256: verified.manifest.source.effectiveSha256,+ identity: {+ scenario: verified.manifest.scenario,+ source: verified.manifest.source,+ input: verified.manifest.input,+ fingerprints: verified.manifest.fingerprints,+ models: verified.manifest.models,+ provider: verified.manifest.provider,+ },+ counts: verified.manifest.results,+ expectedFailures: verified.manifest.results.checks+ .filter((check) => check.decided > check.passed)+ .map((check) => check.id)+ .sort(),+ };+}++export function writeBoundBaseline(file: string, baseline: BoundBaseline): void {+ if (existsSync(file)) fail("DUPLICATE_MEASUREMENT", `${file} already exists`);+ writeJson(file, baseline);+}++export function verifyBoundBaseline(baseline: BoundBaseline, verified: VerifiedMeasurement): void {+ if (baseline.schema !== 2 || baseline.binding !== "measurement-v1") {+ fail("MANIFEST_INVALID", "baseline is legacy/unbound, so its numbers cannot be verified");+ }+ if (baseline.measurementId !== verified.manifest.id) {+ fail("INCOMPATIBLE_IDENTITIES", "baseline names a different measurement");+ }+ if (+ baseline.effectiveSourceSha256 !== baseline.identity.source.effectiveSha256 ||+ baseline.effectiveSourceSha256 !== verified.manifest.source.effectiveSha256+ ) {+ fail("SOURCE_IDENTITY_MISMATCH", "baseline effective source does not match its measurement");+ }+ assertComparable(baseline.identity, verified.manifest);+ if (canonicalJson(baseline.counts) !== canonicalJson(verified.manifest.results)) {+ fail("CHECK_COUNT_MISMATCH", "baseline k/n does not match its bound measurement");+ }+}diff --git a/workbench/lib/model-server.ts b/workbench/lib/model-server.tsindex 0e6fef79e..47bc3614d 100644--- a/workbench/lib/model-server.ts+++ b/workbench/lib/model-server.ts@@ -12,13 +12,15 @@// workbench measures amnesia that production does not have.import { createServer, type Server } from "node:http";+import type { WireApi } from "./transport";+import { instructionContentTextOf } from "./wire";export interface ScriptedToolCall {name: string;args: unknown;}export type ScriptedTurn =- | { kind: "tools"; calls: ScriptedToolCall[] }+ | { kind: "tools"; calls: ScriptedToolCall[]; opaqueReasoning?: string }| { kind: "text"; text: string }| { kind: "thinking"; reasoning: string; text: string };@@ -36,6 +38,8 @@ export interface ModelServerHandle {/** Le modèle que le flux s'est attribué, quand un enregistreur l'a lu. Null* tant qu'aucune réponse n'est passée, et absent des serveurs scriptés. */resolvedModel?: string | null;+ /** Safe recorder lifecycle metadata; never contains request/response content. */+ attempts?: Array<{ attempt: number; phase: string; status: string; detail?: string }>;close: () => void;}@@ -52,11 +56,24 @@ function chunk(responseId: string, delta: unknown, finish: string | null) {}function capture(round: number, body: Record<string, unknown>): CapturedRequest {+ if (Array.isArray(body.input)) {+ const input = body.input as Array<Record<string, unknown>>;+ return {+ round,+ systemChars:+ (typeof body.instructions === "string" ? body.instructions.length : 0) ++ input+ .filter((item) => item.role === "system" || item.role === "developer")+ .reduce((total, item) => total + JSON.stringify(item.content ?? "").length, 0),+ toolNames: ((body.tools ?? []) as Array<{ name?: string }>).map((tool) => tool.name ?? "?"),+ messages: [],+ raw: body,+ };+ }const messages = (body.messages ?? []) as Array<Record<string, unknown>>;- const system = messages[0];return {round,- systemChars: JSON.stringify(system?.content ?? "").length,+ systemChars: instructionContentTextOf(messages).length,toolNames: ((body.tools ?? []) as Array<{ function?: { name?: string } }>).map((t) => t.function?.name ?? "?",),@@ -71,7 +88,176 @@ function capture(round: number, body: Record<string, unknown>): CapturedRequest};}-export async function startScriptedModel(script: ScriptedTurn[]): Promise<ModelServerHandle> {+function responsesEvent(payload: unknown): string {+ return `event: ${(payload as { type?: string }).type ?? "message"}\ndata: ${JSON.stringify(payload)}\n\n`;+}++function baseResponse(+ id: string,+ model: string,+ output: unknown[],+ usage: Record<string, unknown>,+) {+ return {+ id,+ object: "response",+ created_at: 0,+ status: "completed",+ error: null,+ incomplete_details: null,+ instructions: null,+ max_output_tokens: 2048,+ model,+ output,+ parallel_tool_calls: true,+ previous_response_id: null,+ reasoning: { effort: "medium", summary: null },+ store: false,+ temperature: null,+ text: { format: { type: "text" } },+ tool_choice: "auto",+ tools: [],+ top_p: null,+ truncation: "disabled",+ usage,+ };+}++function responsesBody(turn: ScriptedTurn, round: number, model: string): string {+ const responseId = `resp_wb_${round}`;+ const usage = {+ input_tokens: 100 + round,+ input_tokens_details: { cached_tokens: 0 },+ output_tokens: 10 + round,+ output_tokens_details: { reasoning_tokens: turn.kind === "tools" ? 3 : 0 },+ total_tokens: 110 + round * 2,+ };+ const events: unknown[] = [];+ events.push({+ type: "response.created",+ sequence_number: 0,+ response: { ...baseResponse(responseId, model, [], usage), status: "in_progress", usage: null },+ });+ const output: unknown[] = [];+ let sequence = 1;+ if (turn.kind === "tools") {+ if (turn.opaqueReasoning) {+ const reasoning = {+ id: `rs_wb_${round}`,+ type: "reasoning",+ status: "completed",+ summary: [],+ encrypted_content: turn.opaqueReasoning,+ };+ output.push(reasoning);+ events.push({+ type: "response.output_item.added",+ sequence_number: sequence++,+ output_index: 0,+ item: reasoning,+ });+ events.push({+ type: "response.output_item.done",+ sequence_number: sequence++,+ output_index: 0,+ item: reasoning,+ });+ }+ turn.calls.forEach((call, index) => {+ const outputIndex = output.length;+ const item = {+ id: `fc_wb_${round}_${index}`,+ type: "function_call",+ status: "completed",+ call_id: `call_wb_${round}_${index}`,+ name: call.name,+ arguments: typeof call.args === "string" ? call.args : JSON.stringify(call.args),+ };+ output.push(item);+ events.push({+ type: "response.output_item.added",+ sequence_number: sequence++,+ output_index: outputIndex,+ item,+ });+ events.push({+ type: "response.output_item.done",+ sequence_number: sequence++,+ output_index: outputIndex,+ item,+ });+ });+ } else {+ const text = turn.text;+ const item = {+ id: `msg_wb_${round}`,+ type: "message",+ status: "completed",+ role: "assistant",+ content: [{ type: "output_text", text, annotations: [], logprobs: [] }],+ };+ output.push(item);+ events.push({+ type: "response.output_item.added",+ sequence_number: sequence++,+ output_index: 0,+ item: { ...item, status: "in_progress", content: [] },+ });+ events.push({+ type: "response.content_part.added",+ sequence_number: sequence++,+ output_index: 0,+ content_index: 0,+ item_id: item.id,+ part: { type: "output_text", text: "", annotations: [], logprobs: [] },+ });+ for (const piece of text.match(/.{1,24}/g) ?? [text]) {+ events.push({+ type: "response.output_text.delta",+ sequence_number: sequence++,+ output_index: 0,+ content_index: 0,+ item_id: item.id,+ delta: piece,+ logprobs: [],+ });+ }+ events.push({+ type: "response.output_text.done",+ sequence_number: sequence++,+ output_index: 0,+ content_index: 0,+ item_id: item.id,+ text,+ logprobs: [],+ });+ events.push({+ type: "response.content_part.done",+ sequence_number: sequence++,+ output_index: 0,+ content_index: 0,+ item_id: item.id,+ part: item.content[0],+ });+ events.push({+ type: "response.output_item.done",+ sequence_number: sequence++,+ output_index: 0,+ item,+ });+ }+ events.push({+ type: "response.completed",+ sequence_number: sequence,+ response: baseResponse(responseId, model, output, usage),+ });+ return events.map(responsesEvent).join("");+}++export async function startScriptedModel(+ script: ScriptedTurn[],+ options: { wireApi?: WireApi; model?: string } = {},+): Promise<ModelServerHandle> {const requests: CapturedRequest[] = [];let round = 0;@@ -83,6 +269,24 @@ export async function startScriptedModel(script: ScriptedTurn[]): Promise<ModelSreq.on("end", () => {requests.push(capture(round, JSON.parse(body)));const turn = script[Math.min(round, script.length - 1)];+ if (!turn) {+ res.writeHead(409, { "content-type": "application/json" });+ res.end('{"error":"script exhausted"}');+ return;+ }+ if (options.wireApi === "responses") {+ const expected = req.url === "/responses" || req.url === "/v1/responses";+ if (!expected) {+ res.writeHead(404, { "content-type": "application/json" });+ res.end('{"error":"responses path required"}');+ return;+ }+ const response = responsesBody(turn, round, options.model ?? "workbench-responses");+ round += 1;+ res.writeHead(200, { "content-type": "text/event-stream; charset=utf-8" });+ res.end(response);+ return;+ }const responseId = `wb-${round}`;round += 1;diff --git a/workbench/lib/persist.ts b/workbench/lib/persist.tsindex a67b6f03f..ae67d6523 100644--- a/workbench/lib/persist.ts+++ b/workbench/lib/persist.ts@@ -23,9 +23,10 @@// 900-segment fixture is six figures of characters). Long fields are cut// at `MAX_FIELD_CHARS` and every cut is NAMED in `truncated[]`, so a// reader is never silently looking at a fragment.-// 3. The system message goes beside the file, not in it — ~8.5 kB identical-// across every repetition of every scenario. It is written once per sha-// and referenced by name; the sha is the report's own fingerprint field,+// 3. High-priority system/developer instructions go beside the file — often+// identical across every repetition — with roles retained when needed.+// The file is written once per sha and referenced by name; the sha is the+// report's own fingerprint field,// so the reference is verifiable rather than decorative.import { existsSync, readdirSync, readFileSync } from "node:fs";@@ -91,7 +92,9 @@ export interface PersistedTurn {rounds: number;systemSha256: string;systemChars: number;- /** Sibling file holding the system message in full. */+ /** High-priority message roles in request order. Absent on legacy turns. */+ instructionRoles?: Array<"system" | "developer">;+ /** Sibling file holding high-priority instructions in full. */systemFile: string;toolsSha256: string;toolNames: string[];@@ -193,6 +196,9 @@ export function buildPersistedTurn(options: BuildPersistedTurnOptions): Persisterounds: wire.rounds,systemSha256: wire.systemSha256,systemChars: wire.systemChars,+ ...(wire.instructionMessages+ ? { instructionRoles: wire.instructionMessages.map((message) => message.role) }+ : {}),systemFile: systemFileName(wire.systemSha256),toolsSha256: wire.toolsSha256,toolNames: wire.toolNames,@@ -327,7 +333,7 @@ export function listPersistedTurns(options: {** ponytail: UNE chose ne survit pas au fichier, et la taire la rendrait* mesurable par erreur. `systemBlocks` et `toolsSent` ne sont pas persistés —- * seuls leurs sha, leurs noms et le message système voisin le sont — donc un+ * seuls leurs sha, leurs noms et le fichier d'instructions voisin le sont — donc un* check qui les lirait verrait des tableaux vides, ce qui ressemble à « rien* n'a été envoyé » et n'en est pas. Aucun check jugé ne les touche ; ce* commentaire est ce qui doit être lu avant qu'un futur check le fasse.diff --git a/workbench/lib/provenance.ts b/workbench/lib/provenance.tsnew file mode 100644index 000000000..eac0dfe6e--- /dev/null+++ b/workbench/lib/provenance.ts@@ -0,0 +1,479 @@+import { isUtf8 } from "node:buffer";+import { execFileSync } from "node:child_process";+import { createHash } from "node:crypto";+import { lstatSync, readFileSync, realpathSync } from "node:fs";+import { isAbsolute, resolve, sep } from "node:path";++export const SHA256_PATTERN = /^[a-f0-9]{64}$/;++export interface SourceContentEntry {+ path: string;+ kind: "text" | "binary" | "deleted";+ sha256: string;+}++export interface SourceIdentity {+ schema: 2;+ /** Git HEAD when the measurement was captured. Provenance, not compatibility. */+ commit: string;+ /** Current bytes for relevant paths changed from HEAD, plus deleted markers. */+ dirtyManifest: SourceContentEntry[];+ dirtySha256: string;+ /** Current effective relevant tree. Deleted paths are absent. */+ effectiveManifest: SourceContentEntry[];+ effectiveSha256: string;+}++export interface EndpointIdentity {+ provider: string;+ endpointSha256: string;+}++export const MANDATORY_SOURCE_ANCHORS = [+ "package.json",+ "package-lock.json",+ "tsconfig.workbench.json",+ "workbench/cli-entry.ts",+ "workbench/cli.ts",+ "workbench/lib/harness.ts",+ "workbench/lib/runner.ts",+ "workbench/lib/score.ts",+ "workbench/lib/measurement.ts",+ "workbench/lib/provenance.ts",+ "workbench/scenarios/registry.ts",+ "src/lib/ai-edition/schema/index.ts",+ "electron/ai-edition/agent-tools.ts",+ "electron/ai-edition/deep-agent/service.ts",+] as const;++export const MINIMUM_SOURCE_ANCHORS = 14;++const ROOT_SOURCE_FILES = new Set([+ "package.json",+ "package-lock.json",+ "tsconfig.json",+ "tsconfig.node.json",+ "tsconfig.workbench.json",+ "vitest.workbench.config.ts",+]);++const SOURCE_SUFFIXES = [+ ".ts",+ ".tsx",+ ".js",+ ".jsx",+ ".mjs",+ ".cjs",+ ".mts",+ ".cts",+ ".json",+ ".wasm",+] as const;++const EXCLUDED_SOURCE_PREFIXES = [+ "workbench/.build/",+ "workbench/baselines/",+ "workbench/cassettes/",+ "workbench/docs/",+ "workbench/fixtures/",+ "workbench/l0/",+ "workbench/l1/",+ "workbench/measurements/",+ "workbench/reports/",+ "workbench/runs/",+] as const;++const EXCLUDED_SOURCE_SEGMENTS = new Set([+ ".agent-evidence",+ "build",+ "dist",+ "dist-electron",+ "goal-runs",+ "node_modules",+ "target",+ "__snapshots__",+]);++export class SourceIdentityError extends Error {+ constructor(message: string) {+ super(message);+ this.name = "SourceIdentityError";+ }+}++export function sha256Bytes(value: string | Buffer): string {+ return createHash("sha256").update(value).digest("hex");+}++/** JSON whose hashes must survive platforms: sorted keys, LF-only strings. */+export function canonicalJson(value: unknown): string {+ const normalize = (input: unknown): unknown => {+ if (typeof input === "string") return input.replace(/\r\n?/g, "\n");+ if (Array.isArray(input)) return input.map(normalize);+ if (input !== null && typeof input === "object") {+ const out: Record<string, unknown> = {};+ for (const key of Object.keys(input as Record<string, unknown>).sort()) {+ out[key] = normalize((input as Record<string, unknown>)[key]);+ }+ return out;+ }+ return input;+ };+ return JSON.stringify(normalize(value));+}++export function sha256Canonical(value: unknown): string {+ return sha256Bytes(canonicalJson(value));+}++function codePointOrder(left: string, right: string): number {+ return left < right ? -1 : left > right ? 1 : 0;+}++function sortEntries(entries: SourceContentEntry[]): SourceContentEntry[] {+ return [...entries].sort((left, right) => codePointOrder(left.path, right.path));+}++function splitNullList(value: string): string[] {+ return value.split("\0").filter(Boolean);+}++function portable(path: string): string {+ return path.replace(/\\/g, "/");+}++function validatePortablePath(path: unknown): asserts path is string {+ if (+ typeof path !== "string" ||+ path.length === 0 ||+ isAbsolute(path) ||+ path.includes("\\") ||+ path.split("/").some((segment) => segment === "" || segment === "." || segment === "..")+ ) {+ throw new SourceIdentityError(`source path is not portable: ${String(path)}`);+ }+}++/** Closed, shared capture/validation predicate from the issue #459 amendment. */+export function isRelevantSourcePath(path: string): boolean {+ const normalized = portable(path);+ if (ROOT_SOURCE_FILES.has(normalized)) return true;+ if (EXCLUDED_SOURCE_PREFIXES.some((prefix) => normalized.startsWith(prefix))) return false;+ if (+ normalized.endsWith(".test.ts") ||+ normalized.endsWith(".test.tsx") ||+ normalized.endsWith(".wb.ts")+ ) {+ return false;+ }+ const segments = normalized.split("/");+ if (segments.some((segment) => EXCLUDED_SOURCE_SEGMENTS.has(segment))) return false;+ if (+ !(["workbench", "src", "electron"] as const).some((root) => normalized.startsWith(`${root}/`))+ ) {+ return false;+ }+ return SOURCE_SUFFIXES.some((suffix) => normalized.endsWith(suffix));+}++function pathExists(path: string): boolean {+ try {+ lstatSync(path);+ return true;+ } catch {+ return false;+ }+}++function excludedTree(path: string): boolean {+ const normalized = portable(path);+ const asDirectory = `${normalized.replace(/\/$/, "")}/`;+ if (+ EXCLUDED_SOURCE_PREFIXES.some(+ (prefix) => asDirectory === prefix || asDirectory.startsWith(prefix),+ )+ ) {+ return true;+ }+ return normalized.split("/").some((segment) => EXCLUDED_SOURCE_SEGMENTS.has(segment));+}++function assertNoRelevantSubmodules(root: string): void {+ const records = splitNullList(+ execFileSync("git", ["ls-files", "--stage", "-z"], { cwd: root, encoding: "utf8" }),+ );+ for (const record of records) {+ const separator = record.indexOf("\t");+ if (separator < 0) continue;+ const [mode] = record.slice(0, separator).split(" ");+ if (mode !== "160000") continue;+ const path = portable(record.slice(separator + 1));+ if (+ !excludedTree(path) &&+ (["workbench", "src", "electron"] as const).some(+ (includedRoot) => path === includedRoot || path.startsWith(`${includedRoot}/`),+ )+ ) {+ throw new SourceIdentityError(`relevant Git submodule is not supported: ${path}`);+ }+ }+}++function lowerPath(path: string): string {+ return process.platform === "win32" ? path.toLowerCase() : path;+}++function isWithin(root: string, candidate: string): boolean {+ const rootValue = lowerPath(resolve(root));+ const candidateValue = lowerPath(resolve(candidate));+ return candidateValue === rootValue || candidateValue.startsWith(`${rootValue}${sep}`);+}++type SourceReader = (file: string) => Buffer;++function currentEntry(+ root: string,+ path: string,+ read: SourceReader = (file) => readFileSync(file),+): SourceContentEntry {+ validatePortablePath(path);+ const absolute = resolve(root, ...path.split("/"));+ if (!isWithin(root, absolute)) throw new SourceIdentityError(`${path} escapes the source root`);+ let cursor = resolve(root);+ for (const segment of path.split("/")) {+ cursor = resolve(cursor, segment);+ const stat = lstatSync(cursor);+ if (stat.isSymbolicLink()) {+ throw new SourceIdentityError(`${path} traverses a symlink or reparse point`);+ }+ }+ const stat = lstatSync(absolute);+ if (!stat.isFile()) throw new SourceIdentityError(`${path} is not a regular source file`);+ if (!isWithin(realpathSync(root), realpathSync(absolute))) {+ throw new SourceIdentityError(`${path} resolves outside the source root`);+ }+ let bytes: Buffer;+ try {+ bytes = read(absolute);+ } catch (error) {+ throw new SourceIdentityError(+ `${path} is unreadable: ${error instanceof Error ? error.message : String(error)}`,+ );+ }+ const text = isUtf8(bytes) && !bytes.includes(0);+ const canonical = text ? bytes.toString("utf8").replace(/\r\n?/g, "\n") : bytes;+ return {+ path,+ kind: text ? "text" : "binary",+ sha256: sha256Bytes(canonical),+ };+}++function validateEntries(+ entries: unknown,+ options: { allowDeleted: boolean; requireAnchors: boolean },+): SourceContentEntry[] {+ if (!Array.isArray(entries)) throw new SourceIdentityError("source manifest must be an array");+ const typed = entries as SourceContentEntry[];+ const paths = new Set<string>();+ const caseFolded = new Set<string>();+ let previous: string | null = null;+ for (const entry of typed) {+ if (!entry || typeof entry !== "object") {+ throw new SourceIdentityError("source manifest entry must be an object");+ }+ if (canonicalJson(Object.keys(entry).sort()) !== canonicalJson(["kind", "path", "sha256"])) {+ throw new SourceIdentityError(+ "source manifest entry must contain only path, kind, and sha256",+ );+ }+ validatePortablePath(entry.path);+ if (!isRelevantSourcePath(entry.path)) {+ throw new SourceIdentityError(`source manifest contains an irrelevant path: ${entry.path}`);+ }+ if (+ entry.kind !== "text" &&+ entry.kind !== "binary" &&+ !(options.allowDeleted && entry.kind === "deleted")+ ) {+ throw new SourceIdentityError(`${entry.path} has invalid source kind ${String(entry.kind)}`);+ }+ if (typeof entry.sha256 !== "string" || !SHA256_PATTERN.test(entry.sha256)) {+ throw new SourceIdentityError(`${entry.path} has an invalid SHA256`);+ }+ const folded = entry.path.toLowerCase();+ if (paths.has(entry.path) || caseFolded.has(folded)) {+ throw new SourceIdentityError(`source manifest path is duplicated: ${entry.path}`);+ }+ if (previous !== null && codePointOrder(previous, entry.path) >= 0) {+ throw new SourceIdentityError("source manifest is not in deterministic code-point order");+ }+ paths.add(entry.path);+ caseFolded.add(folded);+ previous = entry.path;+ }+ if (options.requireAnchors) {+ if (MANDATORY_SOURCE_ANCHORS.length < MINIMUM_SOURCE_ANCHORS) {+ throw new SourceIdentityError("source anchor policy dropped below its 14-anchor floor");+ }+ for (const anchor of MANDATORY_SOURCE_ANCHORS) {+ if (!paths.has(anchor))+ throw new SourceIdentityError(`effective source is missing anchor ${anchor}`);+ }+ }+ return typed;+}++export function validateSourceIdentity(value: unknown): SourceIdentity {+ const source = value as Partial<SourceIdentity> & {+ contentManifest?: unknown;+ contentSha256?: unknown;+ };+ if (source.schema !== 2) {+ if (source.contentManifest !== undefined || source.contentSha256 !== undefined) {+ throw new SourceIdentityError(+ "legacy dirty-only source identity is non-comparable; source.schema 2 is required",+ );+ }+ throw new SourceIdentityError("source.schema 2 is required");+ }+ const keys = value !== null && typeof value === "object" ? Object.keys(value).sort() : [];+ if (+ canonicalJson(keys) !==+ canonicalJson(+ [+ "commit",+ "dirtyManifest",+ "dirtySha256",+ "effectiveManifest",+ "effectiveSha256",+ "schema",+ ].sort(),+ )+ ) {+ if (source.contentManifest !== undefined || source.contentSha256 !== undefined) {+ throw new SourceIdentityError(+ "legacy dirty-only source identity fields are non-comparable and forbidden in schema 2",+ );+ }+ throw new SourceIdentityError("source.schema 2 contains unknown or missing fields");+ }+ if (typeof source.commit !== "string" || !/^[a-f0-9]{40}$/.test(source.commit)) {+ throw new SourceIdentityError("source.commit must be a full lowercase Git SHA");+ }+ const dirty = validateEntries(source.dirtyManifest, {+ allowDeleted: true,+ requireAnchors: false,+ });+ const effective = validateEntries(source.effectiveManifest, {+ allowDeleted: false,+ requireAnchors: true,+ });+ if (+ typeof source.dirtySha256 !== "string" ||+ !SHA256_PATTERN.test(source.dirtySha256) ||+ sha256Canonical(dirty) !== source.dirtySha256+ ) {+ throw new SourceIdentityError("source.dirtySha256 does not match dirtyManifest");+ }+ if (+ typeof source.effectiveSha256 !== "string" ||+ !SHA256_PATTERN.test(source.effectiveSha256) ||+ sha256Canonical(effective) !== source.effectiveSha256+ ) {+ throw new SourceIdentityError("source.effectiveSha256 does not match effectiveManifest");+ }+ return source as SourceIdentity;+}++export function sourceIdentityFromManifests(options: {+ commit: string;+ dirtyManifest: SourceContentEntry[];+ effectiveManifest: SourceContentEntry[];+}): SourceIdentity {+ const dirtyManifest = sortEntries(options.dirtyManifest);+ const effectiveManifest = sortEntries(options.effectiveManifest);+ return validateSourceIdentity({+ schema: 2,+ commit: options.commit,+ dirtyManifest,+ dirtySha256: sha256Canonical(dirtyManifest),+ effectiveManifest,+ effectiveSha256: sha256Canonical(effectiveManifest),+ });+}++/**+ * Capture both provenance (HEAD plus dirty overlay) and the effective current+ * source tree. Compatibility uses only the latter; committing identical bytes+ * or committing excluded evidence changes provenance without changing code.+ */+export function captureSourceIdentity(+ cwd = process.cwd(),+ options: { readFile?: SourceReader } = {},+): SourceIdentity {+ const root = execFileSync("git", ["rev-parse", "--show-toplevel"], {+ cwd,+ encoding: "utf8",+ }).trim();+ const commit = execFileSync("git", ["rev-parse", "HEAD"], { cwd, encoding: "utf8" }).trim();+ const tracked = splitNullList(+ execFileSync("git", ["ls-files", "--cached", "-z"], { cwd: root, encoding: "utf8" }),+ );+ const untracked = splitNullList(+ execFileSync("git", ["ls-files", "--others", "--exclude-standard", "-z"], {+ cwd: root,+ encoding: "utf8",+ }),+ );+ const changed = splitNullList(+ execFileSync("git", ["diff", "--name-only", "--no-renames", "-z", "HEAD"], {+ cwd: root,+ encoding: "utf8",+ }),+ );+ assertNoRelevantSubmodules(root);+ const normalizePaths = (paths: string[]) =>+ [...new Set(paths.map(portable))].filter(isRelevantSourcePath).sort(codePointOrder);+ const untrackedRelevant = normalizePaths(untracked);+ const effectivePaths = normalizePaths([...tracked, ...untrackedRelevant]).filter((path) =>+ pathExists(resolve(root, ...path.split("/"))),+ );+ const dirtyPaths = normalizePaths([...changed, ...untrackedRelevant]);+ const dirtyManifest = dirtyPaths.map((path) =>+ pathExists(resolve(root, ...path.split("/")))+ ? currentEntry(root, path, options.readFile)+ : { path, kind: "deleted" as const, sha256: sha256Bytes("<deleted>\n") },+ );+ const effectiveManifest = effectivePaths.map((path) =>+ currentEntry(root, path, options.readFile),+ );+ return sourceIdentityFromManifests({ commit, dirtyManifest, effectiveManifest });+}++export function normalizeEndpoint(raw: string): string {+ let parsed: URL;+ try {+ parsed = new URL(raw);+ } catch {+ throw new Error("endpoint must be an absolute URL");+ }+ if (parsed.protocol !== "https:" && parsed.protocol !== "http:") {+ throw new Error("endpoint must use http or https");+ }+ if (parsed.username || parsed.password) throw new Error("endpoint must not contain credentials");+ if (parsed.search) throw new Error("endpoint must not contain a query string");+ if (parsed.hash) throw new Error("endpoint must not contain a fragment");+ const path = parsed.pathname.replace(/\/{2,}/g, "/").replace(/\/$/, "") || "/";+ return `${parsed.origin.toLowerCase()}${path}`;+}++export function endpointIdentity(provider: string, rawEndpoint: string): EndpointIdentity {+ if (!/^[a-z0-9][a-z0-9._-]{0,63}$/i.test(provider)) {+ throw new Error("provider label must contain only letters, digits, dot, underscore, or dash");+ }+ return {+ provider,+ endpointSha256: sha256Bytes(normalizeEndpoint(rawEndpoint)),+ };+}diff --git a/workbench/lib/real-fixture.ts b/workbench/lib/real-fixture.tsindex 17dae60b3..b38bf4b02 100644--- a/workbench/lib/real-fixture.ts+++ b/workbench/lib/real-fixture.ts@@ -20,7 +20,7 @@// belongs to the assertions; a scenario that let it reach the model would be// grading a dictation.-import { readFileSync } from "node:fs";+import { existsSync, readFileSync } from "node:fs";import { resolve } from "node:path";import type { CursorTelemetryReader } from "../../electron/ai-edition/deep-agent/service";import {@@ -49,6 +49,32 @@ const PROJECT_FILE = resolve(FIXTURES_DIR, "real-screencast.openscreen");*/export const REAL_SCREENCAST_VIDEO_PATH = resolve(FIXTURES_DIR, "real-screencast.mp4");+export const ORIGINAL_FIXTURE_REQUIRED_FILES = [+ "workbench/fixtures/real-screencast.openscreen",+ "workbench/fixtures/real-screencast.mp4.cursor.json",+] as const;++export class OriginalFixtureUnavailableError extends Error {+ readonly code = "ORIGINAL_FIXTURE_UNAVAILABLE";++ constructor(cause?: unknown) {+ super(+ "ORIGINAL_FIXTURE_UNAVAILABLE: the original 66.154-second French take is unavailable; " ++ `required files: ${ORIGINAL_FIXTURE_REQUIRED_FILES.join(", ")}. ` ++ "It cannot be reconstructed from the 129-word/1521-sample summary or replaced under the original scenario ids." ++ (cause === undefined+ ? ""+ : ` Cause: ${cause instanceof Error ? cause.message : String(cause)}`),+ );+ this.name = "OriginalFixtureUnavailableError";+ }+}++export function assertOriginalFixtureAvailable(): void {+ const required = [PROJECT_FILE, `${REAL_SCREENCAST_VIDEO_PATH}.cursor.json`];+ if (required.some((file) => !existsSync(file))) throw new OriginalFixtureUnavailableError();+}+/*** What the fixture is, stated once so scenarios and tests can assert against it* instead of each re-deriving it from the file.@@ -71,16 +97,11 @@ export const REAL_SCREENCAST = {} as const;function readProjectFile(): unknown {+ assertOriginalFixtureAvailable();try {return JSON.parse(readFileSync(PROJECT_FILE, "utf8"));} catch (error) {- // Named, because the two ways this fails — run from the wrong directory,- // or the fixture never landed — look identical in a stack trace.- throw new Error(- `Fixture réelle introuvable ou illisible : ${PROJECT_FILE}\n` +- "Le banc se lance depuis la racine du dépôt (`npm run wb`).\n" +- `Cause : ${error instanceof Error ? error.message : String(error)}`,- );+ throw new OriginalFixtureUnavailableError(error);}}@@ -102,5 +123,6 @@ export function realScreencastDocument(): AxcutDocument {/** A reader wired to the fixture's own sidecar — `getCursorTrack` answers* `available: true` with the real trajectory. */export function realScreencastCursorReader(): CursorTelemetryReader {+ assertOriginalFixtureAvailable();return sidecarCursorReader({ [REAL_SCREENCAST.assetId]: REAL_SCREENCAST_VIDEO_PATH });}diff --git a/workbench/lib/report.ts b/workbench/lib/report.tsindex 26ecda12e..263fd53f7 100644--- a/workbench/lib/report.ts+++ b/workbench/lib/report.ts@@ -3,7 +3,9 @@//// Two things a report must carry or it is worse than useless:// • the RUN FINGERPRINT — the sha of the system message the model actually-// received, the sha of the tool surface, the model id, the git sha. Both+// received, the sha of the tool surface, the model id, and the effective+// source sha. Git HEAD/dirty state remain visible provenance but do not by+// themselves make identical program bytes incomparable. Both prompt/tool// shas moved the day `createAgent` replaced `createDeepAgent` (system// 8742 → 2968 chars, tools 25 → 17), which is exactly the kind of change// that would otherwise get blamed on whatever prompt edit happened that@@ -34,6 +36,8 @@ export interface RunFingerprint {model: string;gitSha: string;gitDirty: boolean;+ /** Canonical effective source-tree digest. Absent on legacy reports. */+ effectiveSourceSha256?: string;overlayId: string | null;reps: number;}@@ -115,6 +119,7 @@ export function fingerprintOf(options: {model: string;overlayId?: string | null;reps: number;+ effectiveSourceSha256?: string;}): RunFingerprint {const wire = options.wire;const git = gitInfo();@@ -126,6 +131,9 @@ export function fingerprintOf(options: {model: options.model,gitSha: git.sha,gitDirty: git.dirty,+ ...(options.effectiveSourceSha256+ ? { effectiveSourceSha256: options.effectiveSourceSha256 }+ : {}),overlayId: options.overlayId ?? null,reps: options.reps,};@@ -237,7 +245,7 @@ export function renderMarkdown(report: WorkbenchReport): string {lines.push("| --- | --- |");lines.push(`| modèle | \`${report.fingerprint.model}\` |`);lines.push(- `| message système | ${report.fingerprint.systemChars} car., sha ` ++ `| instructions système/developer | ${report.fingerprint.systemChars} car., sha ` +`\`${report.fingerprint.systemSha256.slice(0, 12)}\` |`,);lines.push(@@ -247,6 +255,11 @@ export function renderMarkdown(report: WorkbenchReport): string {lines.push(`| git | \`${report.fingerprint.gitSha}\`${report.fingerprint.gitDirty ? " (dirty)" : ""} |`,);+ if (report.fingerprint.effectiveSourceSha256) {+ lines.push(+ `| effective source | \`${report.fingerprint.effectiveSourceSha256.slice(0, 12)}\` |`,+ );+ }lines.push(`| overlay | ${report.fingerprint.overlayId ?? "aucun"} |`);lines.push("");diff --git a/workbench/lib/runner.ts b/workbench/lib/runner.tsindex 8f35498e8..12ac8c9b2 100644--- a/workbench/lib/runner.ts+++ b/workbench/lib/runner.ts@@ -12,6 +12,7 @@// observed, not because nothing happened. That false green cost one live run to// find; the proxy is now the only live path.+import { getReasoningCapability } from "../../electron/ai-edition/deep-agent/chat-model";import type { LlmConfigStore } from "../../electron/ai-edition/llm-config-store";import type { AxcutDocument } from "../../src/lib/ai-edition/schema";import { startRecorder } from "./cassette";@@ -26,6 +27,12 @@ import type { ModelServerHandle } from "./model-server";import { buildEvalContext } from "./oracles";import type { EvalContext, Scenario } from "./scenario";import { type ScoredRun, scoreRun } from "./score";+import {+ createInvocationBudget,+ type InvocationBudget,+ type TransportIdentity,+ transportIdentity,+} from "./transport";export interface RepetitionResult {scenarioId: string;@@ -43,6 +50,7 @@ export interface RunRepetitionOptions {endpoint?: ModelServerHandle;store?: LlmConfigStore;timeoutMs?: number;+ maxRetries?: number;}/**@@ -56,6 +64,13 @@ export interface RunRepetitionOptions {*/export function liveStore(options: { baseUrl: string; allowAgentEdits: boolean }): LlmConfigStore {const env = requireLiveEnv();+ const nativeResponses =+ getReasoningCapability("openai-compatible", env.model).strategy === "openai-responses";+ if ((env.wireApi === "responses") !== nativeResponses) {+ throw new Error(+ `workbench wire ${env.wireApi} does not match native SDK mode for ${env.model}`,+ );+ }return {getConfig: () => ({provider: "openai-compatible",@@ -74,6 +89,8 @@ export function liveStore(options: { baseUrl: string; allowAgentEdits: boolean }export async function startLiveEndpoint(options: {scenario: string;cassetteFile?: string;+ transport?: TransportIdentity;+ budget?: InvocationBudget;}): Promise<ModelServerHandle> {const env = requireLiveEnv();return startRecorder({@@ -82,6 +99,10 @@ export async function startLiveEndpoint(options: {scenario: options.scenario,provider: "openai-compatible",model: env.model,+ wireApi: env.wireApi,+ transport: options.transport,+ publicHeaders: env.publicHeaders,+ budget: options.budget,});}@@ -103,6 +124,7 @@ export async function runRepetition(options: RunRepetitionOptions): Promise<Repeendpoint: options.endpoint,store: options.store,timeoutMs: options.timeoutMs ?? DEFAULT_TURN_TIMEOUT_MS,+ maxRetries: options.maxRetries,});// `runChat` only returns a document when a tool mutated one// (chat-service.ts:386) — absence therefore means "nothing changed", which@@ -131,7 +153,13 @@ export interface ScenarioRepsOptions {scenario: Scenario;reps: number;/** Live mode: open a proxy per repetition and source the key from env. */- live?: { record?: (rep: number) => string | undefined };+ live?: {+ record?: (rep: number) => string | undefined;+ maxRequests?: number;+ maxOutputTokens?: number;+ transport?: TransportIdentity;+ budget?: InvocationBudget;+ };timeoutMs?: number;maxRetries?: number;onRepetition?: (result: RepetitionResult) => void;@@ -152,6 +180,22 @@ export async function runScenarioReps(const discarded: RepetitionResult[] = [];const maxRetries = options.maxRetries ?? 2;const allowAgentEdits = options.scenario.allowAgentEdits ?? true;+ const env = options.live ? requireLiveEnv() : undefined;+ const transport =+ options.live?.transport ??+ (env+ ? transportIdentity({+ wireApi: env.wireApi,+ maxOutputTokens: options.live?.maxOutputTokens,+ publicHeadersSha256: env.publicHeaders.sha256,+ limits: {+ ...(options.live?.maxRequests ? { maxRequests: options.live.maxRequests } : {}),+ invocationTimeoutMs: options.timeoutMs ?? DEFAULT_TURN_TIMEOUT_MS,+ },+ })+ : undefined);+ const budget =+ options.live?.budget ?? (transport ? createInvocationBudget(transport.limits) : undefined);for (let rep = 0; rep < options.reps; rep += 1) {let attempt = 0;@@ -160,6 +204,8 @@ export async function runScenarioReps(? await startLiveEndpoint({scenario: options.scenario.id,cassetteFile: options.live.record?.(rep),+ transport,+ budget,}): undefined;let result: RepetitionResult;@@ -170,6 +216,7 @@ export async function runScenarioReps(endpoint,store: endpoint ? liveStore({ baseUrl: endpoint.url, allowAgentEdits }) : undefined,timeoutMs: options.timeoutMs,+ maxRetries: env?.wireApi === "responses" ? 0 : undefined,});} finally {endpoint?.close();diff --git a/workbench/lib/transport.ts b/workbench/lib/transport.tsnew file mode 100644index 000000000..deaf47a4b--- /dev/null+++ b/workbench/lib/transport.ts@@ -0,0 +1,193 @@+import { createHash } from "node:crypto";++export type WireApi = "chat-completions" | "responses";++export interface PublicHeaderProfile {+ headers: Record<string, string>;+ sha256: string;+}++export interface TransportLimits {+ maxRequests: number;+ maxRequestBytes: number;+ maxResponseBytes: number;+ requestTimeoutMs: number;+ invocationTimeoutMs: number;+}++export interface TransportIdentity {+ schema: 1;+ wireApi: WireApi;+ inboundPaths: string[];+ upstreamPathSuffix: string;+ requestPolicy: {+ store: false | "unchanged";+ maxOutputField: "max_output_tokens" | "unchanged";+ maxOutputTokens: number | null;+ reasoning: { effort: "medium" } | "unchanged";+ };+ retryPolicy: { sdkMaxRetries: number | "default"; repetitionRetries: number };+ limits: TransportLimits;+ publicHeadersSha256: string;+}++export const DEFAULT_TRANSPORT_LIMITS: TransportLimits = {+ maxRequests: 100,+ maxRequestBytes: 64 * 1024,+ maxResponseBytes: 1024 * 1024,+ requestTimeoutMs: 60_000,+ invocationTimeoutMs: 300_000,+};++function sha256Bytes(value: string | Uint8Array): string {+ return createHash("sha256").update(value).digest("hex");+}++export function canonicalPublicHeaders(headers: Record<string, string>): string {+ return JSON.stringify(+ Object.entries(headers)+ .map(([name, value]) => [name.toLowerCase(), value.trim()] as const)+ .sort(([left], [right]) => left.localeCompare(right)),+ );+}++export function publicHeaderProfile(headers: Record<string, string>): PublicHeaderProfile {+ const normalized: Record<string, string> = {};+ for (const [rawName, rawValue] of Object.entries(headers)) {+ const name = rawName.toLowerCase();+ const value = rawValue.trim();+ if (/[^a-z0-9-]/.test(name) || name in normalized) {+ throw new Error(`invalid or duplicate public header: ${rawName}`);+ }+ if (name !== "user-agent" && name !== "originator") {+ throw new Error(`unsupported public header: ${rawName}`);+ }+ if (!value || value.length > 256 || /[\r\n\0]/.test(value)) {+ throw new Error(`invalid public header value: ${rawName}`);+ }+ normalized[name] = value;+ }+ return { headers: normalized, sha256: sha256Bytes(canonicalPublicHeaders(normalized)) };+}++export function transportIdentity(options: {+ wireApi: WireApi;+ maxOutputTokens?: number;+ limits?: Partial<TransportLimits>;+ publicHeadersSha256?: string;+}): TransportIdentity {+ const limits = { ...DEFAULT_TRANSPORT_LIMITS, ...options.limits };+ if (options.publicHeadersSha256 && !/^[a-f0-9]{64}$/.test(options.publicHeadersSha256)) {+ throw new Error("publicHeadersSha256 must be a lowercase SHA256");+ }+ for (const [name, value] of Object.entries(limits)) {+ if (!Number.isInteger(value) || value <= 0)+ throw new Error(`${name} must be a positive integer`);+ }+ if (options.wireApi === "responses") {+ if (!Number.isInteger(options.maxOutputTokens) || (options.maxOutputTokens ?? 0) <= 0) {+ throw new Error("Responses requires a positive maxOutputTokens policy");+ }+ return {+ schema: 1,+ wireApi: "responses",+ inboundPaths: ["/responses", "/v1/responses"],+ upstreamPathSuffix: "/responses",+ requestPolicy: {+ store: false,+ maxOutputField: "max_output_tokens",+ maxOutputTokens: options.maxOutputTokens as number,+ reasoning: { effort: "medium" },+ },+ retryPolicy: { sdkMaxRetries: 0, repetitionRetries: 0 },+ limits,+ publicHeadersSha256: options.publicHeadersSha256 ?? sha256Bytes("[]"),+ };+ }+ return {+ schema: 1,+ wireApi: "chat-completions",+ inboundPaths: ["/chat/completions", "/v1/chat/completions"],+ upstreamPathSuffix: "/chat/completions",+ requestPolicy: {+ store: "unchanged",+ maxOutputField: "unchanged",+ maxOutputTokens: null,+ reasoning: "unchanged",+ },+ retryPolicy: { sdkMaxRetries: "default", repetitionRetries: 2 },+ limits,+ publicHeadersSha256: options.publicHeadersSha256 ?? sha256Bytes("[]"),+ };+}++export function transportSha256(identity: TransportIdentity): string {+ return sha256Bytes(JSON.stringify(identity));+}++export function measurementTransportSha256(+ agent: TransportIdentity[],+ judge: TransportIdentity | "no-judge",+): string {+ return sha256Bytes(JSON.stringify({ schema: 1, agent, judge }));+}++export function applyRequestPolicy(+ body: Record<string, unknown>,+ identity: TransportIdentity,+): Record<string, unknown> {+ if (identity.wireApi === "chat-completions") return body;+ if (JSON.stringify(body.reasoning) !== JSON.stringify(identity.requestPolicy.reasoning)) {+ throw new Error("Responses reasoning policy mismatch");+ }+ return {+ ...body,+ store: false,+ max_output_tokens: identity.requestPolicy.maxOutputTokens,+ };+}++export interface InvocationBudget {+ readonly limits: TransportLimits;+ readonly startedAt: number;+ readonly requestCount: number;+ reserveRequest: (bodyBytes: number) => number;+ remainingMs: () => number;+ track: (controller: AbortController) => () => void;+ abort: () => void;+}++export function createInvocationBudget(limits: TransportLimits): InvocationBudget {+ const startedAt = Date.now();+ let requestCount = 0;+ const controllers = new Set<AbortController>();+ return {+ limits,+ startedAt,+ get requestCount() {+ return requestCount;+ },+ reserveRequest(bodyBytes) {+ if (bodyBytes > limits.maxRequestBytes) {+ throw new Error(`request body exceeds ${limits.maxRequestBytes} bytes`);+ }+ if (Date.now() - startedAt >= limits.invocationTimeoutMs) {+ throw new Error("invocation deadline exceeded");+ }+ if (requestCount >= limits.maxRequests) {+ throw new Error(`request budget exhausted at ${limits.maxRequests}`);+ }+ requestCount += 1;+ return requestCount;+ },+ remainingMs: () => Math.max(0, limits.invocationTimeoutMs - (Date.now() - startedAt)),+ track(controller) {+ controllers.add(controller);+ return () => controllers.delete(controller);+ },+ abort() {+ for (const controller of controllers) controller.abort();+ controllers.clear();+ },+ };+}diff --git a/workbench/lib/wire.ts b/workbench/lib/wire.tsindex cd31a4ba0..b267e2696 100644--- a/workbench/lib/wire.ts+++ b/workbench/lib/wire.ts@@ -15,7 +15,7 @@// pairing a start with an end by tool NAME is ambiguous the moment a tool is// called twice in one round. And a `resultJson` is still the TOOL's word about// itself. The requests the app actually sent to the provider carry, verbatim:-// the system message the model received, the full tool surface, each+// the system/developer instructions the model received, the full tool surface, each// `tool_calls[].function.arguments` string, and each `role:"tool"` result keyed// by `tool_call_id`. That is the whole evidence base.@@ -46,11 +46,17 @@ export interface WireTool {parameters: unknown;}+export interface WireInstructionMessage {+ role: "system" | "developer";+ blocks: unknown[];+}+export interface WireTranscript {- /** System content exactly as sent: a string, or the array of blocks. */+ /** High-priority system/developer content, flattened in request order. */systemBlocks: unknown[];- /** Our SYSTEM_PROMPT and nothing else since `createAgent` replaced- * `createDeepAgent` — it was ~8742 for a 2968-character constant. */+ /** Role-preserving instructions. Absent on legacy/manual wire fixtures. */+ instructionMessages?: WireInstructionMessage[];+ /** Text characters in all high-priority instruction messages. */systemChars: number;systemSha256: string;toolsSent: WireTool[];@@ -74,7 +80,23 @@ interface RawMessage {interface RawBody {messages?: RawMessage[];- tools?: Array<{ function?: { name?: unknown; description?: unknown; parameters?: unknown } }>;+ instructions?: unknown;+ input?: Array<+ RawMessage & {+ type?: unknown;+ call_id?: unknown;+ name?: unknown;+ arguments?: unknown;+ output?: unknown;+ }+ >;+ tools?: Array<{+ type?: unknown;+ name?: unknown;+ description?: unknown;+ parameters?: unknown;+ function?: { name?: unknown; description?: unknown; parameters?: unknown };+ }>;}function sha256(value: string): string {@@ -106,6 +128,35 @@ function textOfBlocks(blocks: unknown[]): string {.join("\n");}+export function instructionMessagesOf(+ messages: Array<{ role?: unknown; content?: unknown }>,+): WireInstructionMessage[] {+ return messages+ .filter(+ (message): message is { role: "system" | "developer"; content?: unknown } =>+ message.role === "system" || message.role === "developer",+ )+ .map((message) => ({ role: message.role, blocks: systemBlocksOf(message.content) }));+}++function instructionContentText(messages: WireInstructionMessage[]): string {+ return messages.map((message) => textOfBlocks(message.blocks)).join("\n");+}++export function instructionContentTextOf(+ messages: Array<{ role?: unknown; content?: unknown }>,+): string {+ return instructionContentText(instructionMessagesOf(messages));+}++function persistedInstructionText(messages: WireInstructionMessage[]): string {+ // Preserve the exact historical system-only fingerprint and prompt file.+ if (messages.length === 1 && messages[0].role === "system") {+ return textOfBlocks(messages[0].blocks);+ }+ return messages.map((message) => `[${message.role}]\n${textOfBlocks(message.blocks)}`).join("\n");+}+/*** A tool result is an error when it parses to an object carrying `error`, or* when it is one of LangChain's plain-text tool failures.@@ -170,24 +221,35 @@ export function callsWithData(calls: WireCall[], name: string): WireCall[] {});}-/** The system message as ONE string, joined exactly the way `systemSha256` was- * computed over it — so a persisted `system-<sha>.txt` can be verified against- * the fingerprint a report carries instead of being taken on trust. */+/** High-priority instructions as one role-preserving string, exactly as hashed. */export function systemTextOf(wire: WireTranscript): string {+ if (wire.instructionMessages && wire.instructionMessages.length > 0) {+ return persistedInstructionText(wire.instructionMessages);+ }+ // Legacy/manual wires predate role preservation and carried system blocks.return textOfBlocks(wire.systemBlocks);}export function wireFromRequests(requests: CapturedRequest[]): WireTranscript {const first = requests[0];const firstBody = first ? bodyOf(first) : {};- const systemMessage = (firstBody.messages ?? []).find((m) => m.role === "system");- const systemBlocks = systemBlocksOf(systemMessage?.content);- const systemText = textOfBlocks(systemBlocks);+ const responses = Array.isArray(firstBody.input);+ const responseInstructions: WireInstructionMessage[] =+ responses && firstBody.instructions != null+ ? [{ role: "developer", blocks: systemBlocksOf(firstBody.instructions) }]+ : [];+ const instructionMessages = [+ ...responseInstructions,+ ...instructionMessagesOf(responses ? (firstBody.input ?? []) : (firstBody.messages ?? [])),+ ];+ const systemBlocks = instructionMessages.flatMap((message) => message.blocks);+ const systemContentText = instructionContentText(instructionMessages);+ const systemText = persistedInstructionText(instructionMessages);const toolsSent: WireTool[] = (firstBody.tools ?? []).map((tool) => ({- name: String(tool.function?.name ?? "?"),- description: String(tool.function?.description ?? ""),- parameters: tool.function?.parameters,+ name: String(responses ? (tool.name ?? "?") : (tool.function?.name ?? "?")),+ description: String(responses ? (tool.description ?? "") : (tool.function?.description ?? "")),+ parameters: responses ? tool.parameters : tool.function?.parameters,}));// Results are keyed by tool_call_id and can appear in ANY later request; the@@ -195,6 +257,18 @@ export function wireFromRequests(requests: CapturedRequest[]): WireTranscript {// `task` sub-agent, and a future middleware could split it again).const resultsById = new Map<string, string>();for (const request of requests) {+ if (responses) {+ for (const item of bodyOf(request).input ?? []) {+ if (item.type !== "function_call_output") continue;+ const id = typeof item.call_id === "string" ? item.call_id : null;+ if (!id || resultsById.has(id)) continue;+ resultsById.set(+ id,+ typeof item.output === "string" ? item.output : JSON.stringify(item.output),+ );+ }+ continue;+ }for (const message of bodyOf(request).messages ?? []) {if (message.role !== "tool") continue;const id = typeof message.tool_call_id === "string" ? message.tool_call_id : null;@@ -209,6 +283,38 @@ export function wireFromRequests(requests: CapturedRequest[]): WireTranscript {const calls: WireCall[] = [];const seen = new Set<string>();requests.forEach((request, requestIndex) => {+ if (responses) {+ for (const item of bodyOf(request).input ?? []) {+ if (item.type !== "function_call") continue;+ const id = typeof item.call_id === "string" && item.call_id ? item.call_id : null;+ const key = id ?? `anon:${requestIndex}:${calls.length}`;+ if (seen.has(key)) continue;+ seen.add(key);+ const name = String(item.name ?? "?");+ const argsJson =+ typeof item.arguments === "string"+ ? item.arguments+ : JSON.stringify(item.arguments ?? {});+ let args: unknown;+ try {+ args = argsJson.trim() ? JSON.parse(argsJson) : {};+ } catch {+ args = undefined;+ }+ const resultJson = id ? resultsById.get(id) : undefined;+ calls.push({+ round: Math.max(0, requestIndex - 1),+ id: key,+ name,+ argsJson,+ args,+ mutating: isMutatingTool(name),+ resultJson,+ resultOk: !resultIsError(resultJson),+ });+ }+ return;+ }for (const message of bodyOf(request).messages ?? []) {for (const call of message.tool_calls ?? []) {const id = typeof call.id === "string" && call.id ? call.id : null;@@ -247,7 +353,8 @@ export function wireFromRequests(requests: CapturedRequest[]): WireTranscript {return {systemBlocks,- systemChars: systemText.length,+ instructionMessages,+ systemChars: systemContentText.length,systemSha256: sha256(systemText),toolsSent,toolNames: toolsSent.map((t) => t.name),@@ -280,6 +387,15 @@ export function transcriptFromSse(sse: string): SseTranscript {const payload = trimmed.slice(5).trim();if (!payload || payload === "[DONE]") continue;let event: {+ type?: unknown;+ output_index?: unknown;+ delta?: unknown;+ item?: {+ type?: unknown;+ call_id?: unknown;+ name?: unknown;+ arguments?: unknown;+ };choices?: Array<{delta?: {content?: unknown;@@ -296,6 +412,19 @@ export function transcriptFromSse(sse: string): SseTranscript {} catch {continue;}+ if (event.type === "response.output_text.delta" && typeof event.delta === "string") {+ finalText += event.delta;+ continue;+ }+ if (event.type === "response.output_item.done" && event.item?.type === "function_call") {+ const index = typeof event.output_index === "number" ? event.output_index : byIndex.size;+ byIndex.set(index, {+ id: typeof event.item.call_id === "string" ? event.item.call_id : `sse_${index}`,+ name: typeof event.item.name === "string" ? event.item.name : "",+ arguments: typeof event.item.arguments === "string" ? event.item.arguments : "",+ });+ continue;+ }const delta = event.choices?.[0]?.delta;if (!delta) continue;if (typeof delta.content === "string") finalText += delta.content;diff --git a/workbench/measurement-cli.ts b/workbench/measurement-cli.tsnew file mode 100644index 000000000..43e701384--- /dev/null+++ b/workbench/measurement-cli.ts@@ -0,0 +1,181 @@+import {+ assertComparable,+ boundBaselineFromMeasurement,+ exportMeasurement,+ MeasurementError,+ replayMeasurement,+ verifyMeasurementId,+ writeBoundBaseline,+} from "./lib/measurement";+import { newcombeDelta } from "./lib/stats";++type Command = "export" | "verify" | "replay" | "baseline" | "compare" | "help";++interface ParsedArgs {+ command: Command;+ values: Map<string, string>;+}++const CONTRACT: Record<Exclude<Command, "help">, string[]> = {+ export: ["--run", "--id", "--review"],+ verify: ["--id"],+ replay: ["--id"],+ baseline: ["--id", "--out"],+ compare: ["--left", "--right"],+};++function parseArgs(argv: string[]): ParsedArgs {+ const rawCommand = argv[0];+ if (!rawCommand || rawCommand === "help" || rawCommand === "--help") {+ return { command: "help", values: new Map() };+ }+ if (!(rawCommand in CONTRACT)) {+ throw new MeasurementError("ARGUMENT_ERROR", `unknown command: ${rawCommand}`);+ }+ const command = rawCommand as Exclude<Command, "help">;+ const expected = new Set(CONTRACT[command as Exclude<Command, "help">]);+ const values = new Map<string, string>();+ for (let index = 1; index < argv.length; index += 2) {+ const flag = argv[index];+ const value = argv[index + 1];+ if (!expected.has(flag) || value === undefined || value.startsWith("--")) {+ throw new MeasurementError(+ "ARGUMENT_ERROR",+ `invalid or missing value for ${flag ?? "argument"}`,+ );+ }+ if (values.has(flag)) throw new MeasurementError("ARGUMENT_ERROR", `duplicate flag: ${flag}`);+ values.set(flag, value);+ }+ for (const flag of expected) {+ if (!values.has(flag)) throw new MeasurementError("ARGUMENT_ERROR", `${flag} is required`);+ }+ return { command: command as Command, values };+}++function value(args: ParsedArgs, flag: string): string {+ const found = args.values.get(flag);+ if (!found) throw new MeasurementError("ARGUMENT_ERROR", `${flag} is required`);+ return found;+}++function printHelp(): void {+ process.stdout.write(+ [+ "workbench measurement evidence",+ "",+ " export --run <run-dir> --id <id> --review <review-json>",+ " verify --id <id>",+ " replay --id <id>",+ " baseline --id <id> --out <candidate-json>",+ " compare --left <id> --right <id>",+ "",+ "Commands are offline and do not read provider credentials or call remote services.",+ ].join("\n") + "\n",+ );+}++function logJson(value: unknown): void {+ process.stdout.write(`${JSON.stringify(value, null, 2)}\n`);+}++export async function runMeasurementCli(argv: string[]): Promise<number> {+ try {+ const args = parseArgs(argv);+ switch (args.command) {+ case "export": {+ const directory = exportMeasurement({+ runDir: value(args, "--run"),+ id: value(args, "--id"),+ reviewFile: value(args, "--review"),+ });+ logJson({ ok: true, command: "export", directory });+ return 0;+ }+ case "verify": {+ const verified = verifyMeasurementId(value(args, "--id"));+ logJson({+ ok: true,+ command: "verify",+ id: verified.manifest.id,+ disposition: verified.review.disposition,+ results: verified.manifest.results,+ });+ return 0;+ }+ case "replay": {+ const counts = await replayMeasurement(value(args, "--id"));+ logJson({ ok: true, command: "replay", counts });+ return 0;+ }+ case "baseline": {+ const verified = verifyMeasurementId(value(args, "--id"));+ const baseline = boundBaselineFromMeasurement(verified);+ const out = value(args, "--out");+ writeBoundBaseline(out, baseline);+ logJson({ ok: true, command: "baseline", out, measurementId: baseline.measurementId });+ return 0;+ }+ case "compare": {+ const left = verifyMeasurementId(value(args, "--left"));+ const right = verifyMeasurementId(value(args, "--right"));+ try {+ assertComparable(left.manifest, right.manifest);+ } catch (error) {+ if (error instanceof MeasurementError) {+ logJson({+ ok: false,+ comparable: false,+ code: error.code,+ left: {+ counts: left.manifest.results.axes,+ scores: left.manifest.results.axisScores,+ },+ right: {+ counts: right.manifest.results.axes,+ scores: right.manifest.results.axisScores,+ },+ });+ }+ throw error;+ }+ logJson({+ ok: true,+ command: "compare",+ comparable: true,+ leftScores: left.manifest.results.axisScores,+ rightScores: right.manifest.results.axisScores,+ behaviour: newcombeDelta(+ {+ k: left.manifest.results.axes.behaviour.passed,+ n: left.manifest.results.axes.behaviour.decided,+ },+ {+ k: right.manifest.results.axes.behaviour.passed,+ n: right.manifest.results.axes.behaviour.decided,+ },+ ),+ dsl: newcombeDelta(+ {+ k: left.manifest.results.axes.dsl.passed,+ n: left.manifest.results.axes.dsl.decided,+ },+ {+ k: right.manifest.results.axes.dsl.passed,+ n: right.manifest.results.axes.dsl.decided,+ },+ ),+ });+ return 0;+ }+ default:+ printHelp();+ return 0;+ }+ } catch (error) {+ const code = error instanceof MeasurementError ? error.code : "MANIFEST_INVALID";+ const message = error instanceof Error ? error.message : String(error);+ process.stderr.write(`${code}: ${message}\n`);+ return 1;+ }+}diff --git a/workbench/measurement-entry.ts b/workbench/measurement-entry.tsnew file mode 100644index 000000000..9079f39d0--- /dev/null+++ b/workbench/measurement-entry.ts@@ -0,0 +1,5 @@+import { runMeasurementCli } from "./measurement-cli";++void runMeasurementCli(process.argv.slice(2)).then((code) => {+ process.exitCode = code;+});diff --git a/workbench/measurements/local-integrated-control-20260912-v4/input-fixture.json b/workbench/measurements/local-integrated-control-20260912-v4/input-fixture.jsonnew file mode 100644index 000000000..da7a8ca35--- /dev/null+++ b/workbench/measurements/local-integrated-control-20260912-v4/input-fixture.json@@ -0,0 +1,8 @@+{+ "schema": 1,+ "kind": "public-synthetic",+ "scenarioId": "target-right-clip",+ "generator": "workbench/scenarios/target-right-clip.scn.ts",+ "documentSha256": "346ce20607134919f2f18318a7ee5b95c68a0130cce8b3bde101aed1db835fa8",+ "telemetrySha256": "74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b"+}diff --git a/workbench/measurements/local-integrated-control-20260912-v4/main-cassette-rep-0.json b/workbench/measurements/local-integrated-control-20260912-v4/main-cassette-rep-0.jsonnew file mode 100644index 000000000..aac42ecc6--- /dev/null+++ b/workbench/measurements/local-integrated-control-20260912-v4/main-cassette-rep-0.json@@ -0,0 +1,60 @@+{+ "scenario": "target-right-clip",+ "provider": "openai-compatible",+ "model": "workbench-loopback-fixture",+ "resolvedModel": "workbench",+ "recordedAt": "2026-09-12T10:53:18.310Z",+ "rounds": [+ {+ "round": 0,+ "requestHash": "a9f5459b3417be21",+ "digest": {+ "systemChars": 3840,+ "toolCount": 25,+ "roles": [+ "system",+ "user",+ "user"+ ],+ "lastUserText": "Add a zoom in the middle of the second clip, the demo one."+ },+ "sse": "data: {\"id\":\"wb-0\",\"object\":\"chat.completion.chunk\",\"created\":0,\"model\":\"workbench\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":\"\"},\"finish_reason\":null}]}\n\ndata: {\"id\":\"wb-0\",\"object\":\"chat.completion.chunk\",\"created\":0,\"model\":\"workbench\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"id\":\"call_wb-0_0\",\"type\":\"function\",\"function\":{\"name\":\"getCurrentDocument\",\"arguments\":\"{}\"}}]},\"finish_reason\":null}]}\n\ndata: {\"id\":\"wb-0\",\"object\":\"chat.completion.chunk\",\"created\":0,\"model\":\"workbench\",\"choices\":[{\"index\":0,\"delta\":{},\"finish_reason\":\"tool_calls\"}]}\n\ndata: [DONE]\n\n"+ },+ {+ "round": 1,+ "requestHash": "072c05ee6c47e869",+ "digest": {+ "systemChars": 3840,+ "toolCount": 25,+ "roles": [+ "system",+ "user",+ "user",+ "assistant",+ "tool"+ ],+ "lastUserText": "Add a zoom in the middle of the second clip, the demo one."+ },+ "sse": "data: {\"id\":\"wb-1\",\"object\":\"chat.completion.chunk\",\"created\":0,\"model\":\"workbench\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":\"\"},\"finish_reason\":null}]}\n\ndata: {\"id\":\"wb-1\",\"object\":\"chat.completion.chunk\",\"created\":0,\"model\":\"workbench\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"id\":\"call_wb-1_0\",\"type\":\"function\",\"function\":{\"name\":\"addZoom\",\"arguments\":\"{\\\"startSec\\\":43,\\\"endSec\\\":48,\\\"depth\\\":3}\"}}]},\"finish_reason\":null}]}\n\ndata: {\"id\":\"wb-1\",\"object\":\"chat.completion.chunk\",\"created\":0,\"model\":\"workbench\",\"choices\":[{\"index\":0,\"delta\":{},\"finish_reason\":\"tool_calls\"}]}\n\ndata: [DONE]\n\n"+ },+ {+ "round": 2,+ "requestHash": "c8a3ae35aafb58de",+ "digest": {+ "systemChars": 3840,+ "toolCount": 25,+ "roles": [+ "system",+ "user",+ "user",+ "assistant",+ "tool",+ "assistant",+ "tool"+ ],+ "lastUserText": "Add a zoom in the middle of the second clip, the demo one."+ },+ "sse": "data: {\"id\":\"wb-2\",\"object\":\"chat.completion.chunk\",\"created\":0,\"model\":\"workbench\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":\"\"},\"finish_reason\":null}]}\n\ndata: {\"id\":\"wb-2\",\"object\":\"chat.completion.chunk\",\"created\":0,\"model\":\"workbench\",\"choices\":[{\"index\":0,\"delta\":{\"content\":\"Added one zoom from 0:43\"},\"finish_reason\":null}]}\n\ndata: {\"id\":\"wb-2\",\"object\":\"chat.completion.chunk\",\"created\":0,\"model\":\"workbench\",\"choices\":[{\"index\":0,\"delta\":{\"content\":\" to 0:48, in the middle \"},\"finish_reason\":null}]}\n\ndata: {\"id\":\"wb-2\",\"object\":\"chat.completion.chunk\",\"created\":0,\"model\":\"workbench\",\"choices\":[{\"index\":0,\"delta\":{\"content\":\"of the demo clip.\"},\"finish_reason\":null}]}\n\ndata: {\"id\":\"wb-2\",\"object\":\"chat.completion.chunk\",\"created\":0,\"model\":\"workbench\",\"choices\":[{\"index\":0,\"delta\":{},\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n"+ }+ ]+}diff --git a/workbench/measurements/local-integrated-control-20260912-v4/measurement-report.json b/workbench/measurements/local-integrated-control-20260912-v4/measurement-report.jsonnew file mode 100644index 000000000..1f3109217--- /dev/null+++ b/workbench/measurements/local-integrated-control-20260912-v4/measurement-report.json@@ -0,0 +1,272 @@+{+ "label": "full459-integration-v4/target-right-clip",+ "createdAt": "2026-09-12T10:53:18.732Z",+ "fingerprint": {+ "systemSha256": "796759e35e0d75b547ad4c6318e995bf543e88dfa68e5571c7b43d914a90b93a",+ "systemChars": 3840,+ "toolsSha256": "314045e9f558c1cb8ff33550e3677a3849bf3335f761fc4a09a3bf6ef7a12475",+ "toolNames": [+ "getCurrentDocument",+ "getTranscript",+ "getTranscriptWords",+ "getCursorTrack",+ "setWordText",+ "addTrim",+ "addTrims",+ "setTrim",+ "setClipRange",+ "moveClip",+ "replaceTimeline",+ "addZoom",+ "addZooms",+ "setZoom",+ "addSpeed",+ "setSpeed",+ "addAnnotation",+ "setAnnotation",+ "addCameraFullscreen",+ "setCameraFullscreen",+ "addAudio",+ "setAudio",+ "removeTrim",+ "removeModifier",+ "removeClip"+ ],+ "model": "workbench-loopback-fixture",+ "gitSha": "fbe461e9",+ "gitDirty": true,+ "effectiveSourceSha256": "0c7b1a208ccde2a36caabd507864a38acfc7ecae6c44043e613d409d7607b060",+ "overlayId": null,+ "reps": 1+ },+ "minDetectableEffect": 1,+ "scenarios": [+ {+ "scenarioId": "target-right-clip",+ "title": "Ciblage — un zoom sur le SECOND clip parmi deux",+ "tags": [+ "targeting",+ "dsl"+ ],+ "gate": 0.6,+ "reps": 1,+ "behaviour": {+ "k": 1,+ "n": 1,+ "rate": 1,+ "low": 0.20654931179180275,+ "high": 1+ },+ "dsl": {+ "k": 1,+ "n": 1,+ "rate": 1,+ "low": 0.20654931179180275,+ "high": 1+ },+ "gateScoreMean": 1,+ "passRate": {+ "k": 1,+ "n": 1,+ "rate": 1,+ "low": 0.20654931179180275,+ "high": 1+ },+ "failureClasses": {+ "NONE": 1+ },+ "checks": [+ {+ "id": "beh.grounding",+ "axis": "behaviour",+ "weight": 3,+ "passed": 1,+ "total": 1,+ "indeterminate": 0,+ "wilson": {+ "k": 1,+ "n": 1,+ "rate": 1,+ "low": 0.20654931179180275,+ "high": 1+ },+ "expected": false,+ "evidence": []+ },+ {+ "id": "beh.no-fabrication",+ "axis": "behaviour",+ "weight": 2,+ "passed": 1,+ "total": 1,+ "indeterminate": 0,+ "wilson": {+ "k": 1,+ "n": 1,+ "rate": 1,+ "low": 0.20654931179180275,+ "high": 1+ },+ "expected": false,+ "evidence": []+ },+ {+ "id": "dsl.bounds.in-clip",+ "axis": "dsl",+ "weight": 3,+ "passed": 1,+ "total": 1,+ "indeterminate": 0,+ "wilson": {+ "k": 1,+ "n": 1,+ "rate": 1,+ "low": 0.20654931179180275,+ "high": 1+ },+ "expected": false,+ "evidence": []+ },+ {+ "id": "dsl.bounds.playable",+ "axis": "dsl",+ "weight": 2,+ "passed": 1,+ "total": 1,+ "indeterminate": 0,+ "wilson": {+ "k": 1,+ "n": 1,+ "rate": 1,+ "low": 0.20654931179180275,+ "high": 1+ },+ "expected": false,+ "evidence": []+ },+ {+ "id": "dsl.effect.honest",+ "axis": "dsl",+ "weight": 2,+ "passed": 1,+ "total": 1,+ "indeterminate": 0,+ "wilson": {+ "k": 1,+ "n": 1,+ "rate": 1,+ "low": 0.20654931179180275,+ "high": 1+ },+ "expected": false,+ "evidence": []+ },+ {+ "id": "dsl.single-zoom",+ "axis": "dsl",+ "weight": 2,+ "passed": 1,+ "total": 1,+ "indeterminate": 0,+ "wilson": {+ "k": 1,+ "n": 1,+ "rate": 1,+ "low": 0.20654931179180275,+ "high": 1+ },+ "expected": false,+ "evidence": []+ },+ {+ "id": "dsl.target.correct-clip",+ "axis": "dsl",+ "weight": 4,+ "passed": 1,+ "total": 1,+ "indeterminate": 0,+ "wilson": {+ "k": 1,+ "n": 1,+ "rate": 1,+ "low": 0.20654931179180275,+ "high": 1+ },+ "expected": false,+ "evidence": []+ },+ {+ "id": "dsl.timeline.untouched",+ "axis": "dsl",+ "weight": 2,+ "passed": 1,+ "total": 1,+ "indeterminate": 0,+ "wilson": {+ "k": 1,+ "n": 1,+ "rate": 1,+ "low": 0.20654931179180275,+ "high": 1+ },+ "expected": false,+ "evidence": []+ },+ {+ "id": "dsl.turn.completed",+ "axis": "dsl",+ "weight": 2,+ "passed": 1,+ "total": 1,+ "indeterminate": 0,+ "wilson": {+ "k": 1,+ "n": 1,+ "rate": 1,+ "low": 0.20654931179180275,+ "high": 1+ },+ "expected": false,+ "evidence": []+ },+ {+ "id": "struct.invariants",+ "axis": "dsl",+ "weight": 3,+ "passed": 1,+ "total": 1,+ "indeterminate": 0,+ "wilson": {+ "k": 1,+ "n": 1,+ "rate": 1,+ "low": 0.20654931179180275,+ "high": 1+ },+ "expected": false,+ "evidence": []+ },+ {+ "id": "struct.schema-valid",+ "axis": "dsl",+ "weight": 3,+ "passed": 1,+ "total": 1,+ "indeterminate": 0,+ "wilson": {+ "k": 1,+ "n": 1,+ "rate": 1,+ "low": 0.20654931179180275,+ "high": 1+ },+ "expected": false,+ "evidence": []+ }+ ],+ "unmeasuredAxes": [],+ "msMean": 3083.5562+ }+ ],+ "notices": []+}diff --git a/workbench/measurements/local-integrated-control-20260912-v4/measurement.json b/workbench/measurements/local-integrated-control-20260912-v4/measurement.jsonnew file mode 100644index 000000000..d0a4f7d05--- /dev/null+++ b/workbench/measurements/local-integrated-control-20260912-v4/measurement.json@@ -0,0 +1,2665 @@+{+ "schema": 1,+ "id": "local-integrated-control-20260912-v4",+ "createdAt": "2026-09-12T10:53:18.736Z",+ "complete": true,+ "scenario": {+ "id": "target-right-clip",+ "kind": "public-synthetic",+ "judged": false+ },+ "source": {+ "schema": 2,+ "commit": "fbe461e9d4f875b02b041f8a56fa60099228b66b",+ "dirtyManifest": [+ {+ "path": "electron/ai-edition/document-service.ts",+ "kind": "text",+ "sha256": "23a7dd3412020d818d6088bc9d4b0214daad68f9dbfb564a64466a38533ce3ea"+ },+ {+ "path": "electron/app-settings.ts",+ "kind": "text",+ "sha256": "a13afdfc9a918dfe13e2b4c1b60f7463971debc08567f3ae10a5df8cfd053a9e"+ },+ {+ "path": "electron/electron-env.d.ts",+ "kind": "text",+ "sha256": "34a74fe9ffd248753ab89e4b16b675121f2c217270b1f30c4bedbfef53d4e6e8"+ },+ {+ "path": "electron/ipc/gifExportJobs.ts",+ "kind": "text",+ "sha256": "07a9ad11884318206af3bb82f977b72ea2114f5b3748a72b9fc2a59c83c850f8"+ },+ {+ "path": "electron/ipc/handlers.ts",+ "kind": "text",+ "sha256": "640641fc51bafb3c8780d5cb9b3fadeb22e8f15cb44ae6b68dc06e2b7500e9b0"+ },+ {+ "path": "electron/ipc/nativeBridge.ts",+ "kind": "text",+ "sha256": "58b7b92e402de31f612ac383aee83211a09623f2351cf86cddbe98eb1b79f704"+ },+ {+ "path": "electron/ipc/recordingPrefs.ts",+ "kind": "text",+ "sha256": "8b43bc69ae9820fd5e0700c1808032da70ce3fc6bd06acdf1c7986be625d6e52"+ },+ {+ "path": "electron/native-bridge/services/compositorViewService.ts",+ "kind": "text",+ "sha256": "d2b89e210ac376005de2a120917f691f9fa7a9109ad4cbdc8853762380660117"+ },+ {+ "path": "electron/native/compositor-view/addon.d.ts",+ "kind": "text",+ "sha256": "137c4ff63c52fc06e4cd4efbeff13af4fe5ecb68ded3dbd7aaac74623bce0ade"+ },+ {+ "path": "electron/preload.ts",+ "kind": "text",+ "sha256": "88bcd46dcd2e28ac8c2364a121a5d027f9068732d339c3cbfdaabc640e02b401"+ },+ {+ "path": "electron/recording-settings.ts",+ "kind": "text",+ "sha256": "7ce874313af4fda48bcc082c4d997f4b7d19c154fee81adad1d4268f922edae1"+ },+ {+ "path": "electron/recording-source-settings.ts",+ "kind": "text",+ "sha256": "c52536945bbe50e6aceec47b659816527daefcb80e196c096e6a92631a700993"+ },+ {+ "path": "package.json",+ "kind": "text",+ "sha256": "cf6f7288ff5df8d7cf24ac765d15314fdb0bbd6b87e53b4c29475166cc327f42"+ },+ {+ "path": "src/App.tsx",+ "kind": "text",+ "sha256": "ad7b7be7144cdfaa420b6c708d1679fc65042e81f706c5a33dc38a11a32b44bf"+ },+ {+ "path": "src/components/ai-edition/AppSettings.tsx",+ "kind": "text",+ "sha256": "c944ebf51205e87764878124547d4c0b3cfac239d2c5b5064b4b15db565c2d1e"+ },+ {+ "path": "src/components/ai-edition/ExportDialog.tsx",+ "kind": "text",+ "sha256": "c8c6ae872d66bec086da33f0f615a4d6f4e3034f87777d4337c3476bb9ac343e"+ },+ {+ "path": "src/components/ai-edition/NewEditorShell.tsx",+ "kind": "text",+ "sha256": "7f6e39838e6e8365fab806bcf798961100f3170f84672607083fea890d17987c"+ },+ {+ "path": "src/components/ai-edition/v4/EditorTopBar.tsx",+ "kind": "text",+ "sha256": "1c33ccd593f990ec91755bf9e0b4132edd74bed8de8de79949d4bb4c68dcb695"+ },+ {+ "path": "src/components/ai-edition/v4/RecStage.tsx",+ "kind": "text",+ "sha256": "8fbaabc716a15f67db5da7c6a4ad00b7c630e67e6115da4227d7623040d68b2d"+ },+ {+ "path": "src/components/launch/HudDeviceSettings.tsx",+ "kind": "text",+ "sha256": "87fd0b43b60920d8bbadfaaafc96c4b7b2b2fddec24ac159895d05b05dd10e62"+ },+ {+ "path": "src/components/launch/LaunchWindow.tsx",+ "kind": "text",+ "sha256": "760f4ffeef2f78ac940628dff4999b0887d5effcae5731f76fb8855cb4cb65e6"+ },+ {+ "path": "src/contexts/EditorDialogsContext.tsx",+ "kind": "text",+ "sha256": "e49b5a97e6d1c764a1b8c6dc508726cf8f6f1d1434eaae7f59b753bea57ac6ea"+ },+ {+ "path": "src/hooks/useCameraDevices.ts",+ "kind": "text",+ "sha256": "458143d1e0486b2193e271ff7bc13920bda0883a49d858524c9dc7fe0c45870b"+ },+ {+ "path": "src/hooks/useMicrophoneDevices.ts",+ "kind": "text",+ "sha256": "b855650f173aec2b2dcae9eccca38cac887956ba1e941d1b6d8a809dc515623e"+ },+ {+ "path": "src/hooks/useScreenRecorder.ts",+ "kind": "text",+ "sha256": "9e4857a736a50101d204fdad45d6211e703354d71bee3b60665cb8751cf4a5dd"+ },+ {+ "path": "src/i18n/locales/ar/editor.json",+ "kind": "text",+ "sha256": "1ff00d91ebfa02445856e77f07b75bdc577be7646a883449017c1127dfb697c4"+ },+ {+ "path": "src/i18n/locales/en/editor.json",+ "kind": "text",+ "sha256": "9189474677b48623f3d6e58f3fb0c2cd30fae8423e0c785ca28e8bbf88bfefa9"+ },+ {+ "path": "src/i18n/locales/es/editor.json",+ "kind": "text",+ "sha256": "8ee0a42eebd99863bbd6fd6638c60c660be68aef0b2f4e2eeec2ec7b950ae660"+ },+ {+ "path": "src/i18n/locales/fr/editor.json",+ "kind": "text",+ "sha256": "6e3659076d17d373d34012debaf010d22640574409ee943cb45f6a337ea5bc40"+ },+ {+ "path": "src/i18n/locales/it/editor.json",+ "kind": "text",+ "sha256": "60b2c7e6462ee2f85742cea0aec01ffeeef5404630cdc8baa009694d228852d6"+ },+ {+ "path": "src/i18n/locales/ja-JP/editor.json",+ "kind": "text",+ "sha256": "8aca71b1a7ffe54c769b8268c1e19c28041acfc33897d6dc70e132de5f27df74"+ },+ {+ "path": "src/i18n/locales/ko-KR/editor.json",+ "kind": "text",+ "sha256": "a2a849598755b21d1d62cac28a80deba69730ac4c09122f922ec4d4eef2361eb"+ },+ {+ "path": "src/i18n/locales/pt-BR/editor.json",+ "kind": "text",+ "sha256": "8af229d962b07519e6f77ea9c8674d0ced0a638f8a75827cad4821bb441450b4"+ },+ {+ "path": "src/i18n/locales/ru/editor.json",+ "kind": "text",+ "sha256": "1910e259e78b2a5f6d16faac1babdad051791ec867f2bc0b51e48af847734a07"+ },+ {+ "path": "src/i18n/locales/tr/editor.json",+ "kind": "text",+ "sha256": "a23e26b9ed69249966704678c9bb7066b194cefad9a85188e8865056eeffa6c2"+ },+ {+ "path": "src/i18n/locales/vi/editor.json",+ "kind": "text",+ "sha256": "723cae5524fe6c4e8ae00a7390c4d99b092e326766f1b87700fb6b0d116e2c77"+ },+ {+ "path": "src/i18n/locales/zh-CN/editor.json",+ "kind": "text",+ "sha256": "a04c9925dc02499eb5753075222e935eafae976e75b1b804d3fa9fbfe0d3b468"+ },+ {+ "path": "src/i18n/locales/zh-TW/editor.json",+ "kind": "text",+ "sha256": "2b19904ce3bb26029325a93222551ad1469b5ccfc2ca778183b0f75ae54fb93f"+ },+ {+ "path": "src/lib/ai-edition/store/editorSettings.ts",+ "kind": "text",+ "sha256": "cc23de2284b264934f4aa2956a18c4b959db20a77ebd360170e811f0f768b231"+ },+ {+ "path": "src/lib/projectDefaults.ts",+ "kind": "text",+ "sha256": "066d58ab53266f5805b9bb90df23eea2b6f2951d60099483fd1aca0727c0d299"+ },+ {+ "path": "src/lib/userPreferences.ts",+ "kind": "text",+ "sha256": "a7898ff8217e6f6f97518c3c0cd7c649c2775f5c79a40a1ee82b7550aa99f20d"+ },+ {+ "path": "src/native/browserShim.ts",+ "kind": "text",+ "sha256": "f48a3defdd84feee313834ceb79783563a359e49cb555a46485c407823853e46"+ },+ {+ "path": "src/native/client.ts",+ "kind": "text",+ "sha256": "4afe59b68ee91bbb914e8cd13b7bee703023409b4300db94e3a527233017fda3"+ },+ {+ "path": "src/native/compositorViewClient.ts",+ "kind": "text",+ "sha256": "e7cbb8012f6bdea907f59356f16efc247d9e2d338a480df74ff7f94ee8e0d91f"+ },+ {+ "path": "src/native/contracts.ts",+ "kind": "text",+ "sha256": "69ae495064f73a6a98bbcde29d32462aef7bad46ae3570cf895cef55a1488264"+ },+ {+ "path": "workbench/cli.ts",+ "kind": "text",+ "sha256": "bd20b353a0eb93dc2d27eedffd61e4bc7213c698dc3e72c3eae170c702f6c4c6"+ },+ {+ "path": "workbench/lib/baseline.ts",+ "kind": "text",+ "sha256": "74dde9dc8d0306c3e03d12845aebbd35290f218c4266693537aaea8251dd4bed"+ },+ {+ "path": "workbench/lib/cassette.ts",+ "kind": "text",+ "sha256": "b409eb78e747365ccc799751754db257038fd8d583c6ed8b22df123d1de5e1e6"+ },+ {+ "path": "workbench/lib/measurement.ts",+ "kind": "text",+ "sha256": "fd76f40bbd7895ffbc5f7412b35ba1ddbb1c5836aad7f8e05677be8d5d605fe3"+ },+ {+ "path": "workbench/lib/model-server.ts",+ "kind": "text",+ "sha256": "f2fa8895684b8ca4d8020b1d603a846daf19eba3c9ffc89ac17d89ee5d6b2e56"+ },+ {+ "path": "workbench/lib/persist.ts",+ "kind": "text",+ "sha256": "e3225c859c737aac9d53bc36864bf3fd137de720b175bb5ccaa43515e9a9749d"+ },+ {+ "path": "workbench/lib/provenance.ts",+ "kind": "text",+ "sha256": "1d11f683024c233757758875a51593a04dd1c9dc6043e9c14b33927e663e888d"+ },+ {+ "path": "workbench/lib/real-fixture.ts",+ "kind": "text",+ "sha256": "e9e2187d84d8a1efc0ab3a6389247c4e64c98709be0a106952adc92ecddd9998"+ },+ {+ "path": "workbench/lib/report.ts",+ "kind": "text",+ "sha256": "f6134749ccdb7401675d863e88c2f1fde695b8d5756f2e0e432906c30e8e472c"+ },+ {+ "path": "workbench/lib/wire.ts",+ "kind": "text",+ "sha256": "9043d74e87f61cf173096758f7627db2167787c6f38184436222b8a3d28e350d"+ },+ {+ "path": "workbench/measurement-cli.ts",+ "kind": "text",+ "sha256": "96807c2029dc7b4ac8f5273181f5db7200140790aa337ba9564fa82168c44593"+ },+ {+ "path": "workbench/measurement-entry.ts",+ "kind": "text",+ "sha256": "ab5cde9dbea0d908ac69f6dfcee7c7e83e7728eda7e865b9e1e1b9f1bef3b29a"+ }+ ],+ "dirtySha256": "cfc27af8cc4f4e58332e62b573c7abbd29e4314e50e9e6425d71657dd9814878",+ "effectiveManifest": [+ {+ "path": "electron/about.ts",+ "kind": "text",+ "sha256": "73faacbd5b8c9086e165a1ceb23fdfbf870cd1cb01b73fbf63a00413dec070ac"+ },+ {+ "path": "electron/ai-edition/agent-tools.ts",+ "kind": "text",+ "sha256": "d529c28c816412e08d985ed4ef078c5202ae14bd4a8542f47586d358727d4570"+ },+ {+ "path": "electron/ai-edition/caption-translate.ts",+ "kind": "text",+ "sha256": "3a3d4a31fa3e106f46e89174ea28ed27db4cc9cef265dcc68a2780f042a66196"+ },+ {+ "path": "electron/ai-edition/chat-compaction.ts",+ "kind": "text",+ "sha256": "0506a820f718ce7acb18f54c179b55463c938819a7de80388aa466e200c584da"+ },+ {+ "path": "electron/ai-edition/chat-service.ts",+ "kind": "text",+ "sha256": "520ec4009e071fc01c839ada9ec00a592dfeced1a3259d6da47b8dba77b80f6e"+ },+ {+ "path": "electron/ai-edition/deep-agent/chat-model.ts",+ "kind": "text",+ "sha256": "7ec9e220c80f815301a625eb8aa2d77b6228685cc2e7495e6e45b7ba1e02523e"+ },+ {+ "path": "electron/ai-edition/deep-agent/service.ts",+ "kind": "text",+ "sha256": "3e708d15ce37af8e279d27847dbeb1a86e4a3011aaf5fc6cf8277fdc01615552"+ },+ {+ "path": "electron/ai-edition/document-service.ts",+ "kind": "text",+ "sha256": "23a7dd3412020d818d6088bc9d4b0214daad68f9dbfb564a64466a38533ce3ea"+ },+ {+ "path": "electron/ai-edition/llm-config-store.ts",+ "kind": "text",+ "sha256": "ffaae440f35e86e52b69a9f2d2dc482b2d933cc3496a19d8ad10dfcd56bc0778"+ },+ {+ "path": "electron/ai-edition/llm-provider-auth.ts",+ "kind": "text",+ "sha256": "ed63a8ace30ac20fd1cc0ef172941b43e491a12295849b060d2c5c8f2a9699df"+ },+ {+ "path": "electron/ai-edition/provider-registry.ts",+ "kind": "text",+ "sha256": "c4213d3ed76c15bf2f487341e00089e9795e45fa3ba138f9f7fbeb5027c2dbff"+ },+ {+ "path": "electron/app-settings.ts",+ "kind": "text",+ "sha256": "a13afdfc9a918dfe13e2b4c1b60f7463971debc08567f3ae10a5df8cfd053a9e"+ },+ {+ "path": "electron/auto-updater.ts",+ "kind": "text",+ "sha256": "830d3b97a0ae5e44c36e1bddcb8b1fd0eb6d61bf8fa6cd654468a94dc12c84f3"+ },+ {+ "path": "electron/background-update.ts",+ "kind": "text",+ "sha256": "676709edb139bee6e32896c795a945fce61461b38027112be2ead10c21895c1d"+ },+ {+ "path": "electron/cli/args.ts",+ "kind": "text",+ "sha256": "766affd60e332943ca99aaf0fd96de7d7d8849030e6850e92d163429faea3338"+ },+ {+ "path": "electron/cli/cliMain.ts",+ "kind": "text",+ "sha256": "33c1faabe87872116ca6f528c320c69f00b9839de2b7288e836c9c40eb035759"+ },+ {+ "path": "electron/cli/projectCommands.ts",+ "kind": "text",+ "sha256": "e52c58bb7b3a9bf248d8d4ef82e0c4cbb80e676c5d7d5e7bb2cca47f9c0a6b5c"+ },+ {+ "path": "electron/diagnostics/main-log-buffer.ts",+ "kind": "text",+ "sha256": "7b8353e553bb5eb92cf92cd9568e0f3ad84665ed3ffc625f772af4b5b8c6123c"+ },+ {+ "path": "electron/edit-menu.ts",+ "kind": "text",+ "sha256": "b5bf5273a9129a1aabf6800edb2c354353dda5ea5e12cff28286eb02c618da00"+ },+ {+ "path": "electron/editorWindowState.ts",+ "kind": "text",+ "sha256": "5ae85f5ec45f0c24a7a1637779758deeca7225c55401b53b5f55c4a66e9d2f78"+ },+ {+ "path": "electron/electron-env.d.ts",+ "kind": "text",+ "sha256": "34a74fe9ffd248753ab89e4b16b675121f2c217270b1f30c4bedbfef53d4e6e8"+ },+ {+ "path": "electron/globalShortcut.ts",+ "kind": "text",+ "sha256": "8b0e53dac0299100052a9f0a4c4aee8343e0445f0969c09b8c49d83cde2ec9dd"+ },+ {+ "path": "electron/i18n.ts",+ "kind": "text",+ "sha256": "9561a2c074a41e6f6523cd9a314941ca81c07ca5154f2c3b43c9d730788febc6"+ },+ {+ "path": "electron/install-channel.ts",+ "kind": "text",+ "sha256": "d647d5579c85a95d8a0f0394d01449ba69185346cd464e27080464a9332fce87"+ },+ {+ "path": "electron/ipc/gifExportJobs.ts",+ "kind": "text",+ "sha256": "07a9ad11884318206af3bb82f977b72ea2114f5b3748a72b9fc2a59c83c850f8"+ },+ {+ "path": "electron/ipc/handlers.ts",+ "kind": "text",+ "sha256": "640641fc51bafb3c8780d5cb9b3fadeb22e8f15cb44ae6b68dc06e2b7500e9b0"+ },+ {+ "path": "electron/ipc/nativeBridge.ts",+ "kind": "text",+ "sha256": "58b7b92e402de31f612ac383aee83211a09623f2351cf86cddbe98eb1b79f704"+ },+ {+ "path": "electron/ipc/recordingPrefs.ts",+ "kind": "text",+ "sha256": "8b43bc69ae9820fd5e0700c1808032da70ce3fc6bd06acdf1c7986be625d6e52"+ },+ {+ "path": "electron/ipc/recordingStream.ts",+ "kind": "text",+ "sha256": "19f7cf4f023716be74b9907aa8a55b4512663dce457284e14a043c6451c3719b"+ },+ {+ "path": "electron/main-process-errors.ts",+ "kind": "text",+ "sha256": "d57f13b52f1f885ce47c4b7621497dcbca0deff981086e80598cd117cf369887"+ },+ {+ "path": "electron/main.ts",+ "kind": "text",+ "sha256": "5c43140a6ddb33324e2d48ba6cb177d418aa2fe904dd013120014a4e770f25ee"+ },+ {+ "path": "electron/media/audioPeaks.ts",+ "kind": "text",+ "sha256": "80d1bd0c7142bde59b56bc4dcf4411182d0c2106f5069d50acae8441a226a8b2"+ },+ {+ "path": "electron/media/cursorSidecar.ts",+ "kind": "text",+ "sha256": "5410a21b46243cd20d6c03f3a0c3acb0ca5aea4fdbd6889363947c0e44f2bee2"+ },+ {+ "path": "electron/media/extensionClip.ts",+ "kind": "text",+ "sha256": "65ca35e92b46b4ef0ccd098c144ec232691b3bafaefc889e996e4894b2724d90"+ },+ {+ "path": "electron/media/mediaLinksRegistry.ts",+ "kind": "text",+ "sha256": "9bb094940cd539dbaf9d0f88dc5f391e31f19d70b27b66246fdf342d2d6017a0"+ },+ {+ "path": "electron/media/projectMediaRelinker.ts",+ "kind": "text",+ "sha256": "e8763b73abc73a4f8fb5bc803afabf8d91adb2107d833856c3cda0ed44c4fe95"+ },+ {+ "path": "electron/native-bridge/capture/linuxNativeCaptureSession.ts",+ "kind": "text",+ "sha256": "2672a0ca8236c2b461b07ddce75fdfc812105eb1d69a156b718868cf11580dd9"+ },+ {+ "path": "electron/native-bridge/cursor/recording/factory.ts",+ "kind": "text",+ "sha256": "b67c99189e512badb91f39ad4f1d152a7ba9bc0acd5bb6a4ef5e92f95da4d157"+ },+ {+ "path": "electron/native-bridge/cursor/recording/macNativeCursorRecordingSession.ts",+ "kind": "text",+ "sha256": "d88ae66bdd215efc0df1502b8ebfc22266e57d5049aff0eca7f4bda3351efd04"+ },+ {+ "path": "electron/native-bridge/cursor/recording/pipeWireCursorAccumulator.ts",+ "kind": "text",+ "sha256": "8d5fe3e75fe0e2bfb9431c182b1434800cd526a0db8f3f215f7db1cf197ac87b"+ },+ {+ "path": "electron/native-bridge/cursor/recording/pipeWireCursorRecordingSession.ts",+ "kind": "text",+ "sha256": "2a0f9fda89b038e2e49df6b4e6b5772d2aff64e86af37765af0c13fdd5946b3a"+ },+ {+ "path": "electron/native-bridge/cursor/recording/session.ts",+ "kind": "text",+ "sha256": "29232fb540d917ce55e1b74a3460fc89692b28199f5765e68f05bc851842f20a"+ },+ {+ "path": "electron/native-bridge/cursor/recording/telemetryRecordingSession.ts",+ "kind": "text",+ "sha256": "53813a5f3bd5a13a364991b2d5f34abdb7b87443760dd7918bbd1f4483988449"+ },+ {+ "path": "electron/native-bridge/cursor/recording/windowsNativeRecordingSession.ts",+ "kind": "text",+ "sha256": "38cff7b3e9a79bc98305ae2c411ced611826410fc038b08666ce706c52b89c98"+ },+ {+ "path": "electron/native-bridge/cursor/recording/windowsNativeRecordingSession.types.ts",+ "kind": "text",+ "sha256": "21642ff36ab05a640025278226cd45fc5340178ae77f3ba3c9b2680213443a30"+ },+ {+ "path": "electron/native-bridge/cursor/telemetryCursorAdapter.ts",+ "kind": "text",+ "sha256": "69fa181a10aae0350b2940df8ae9447579309cbd7443a623f2edc533a4885435"+ },+ {+ "path": "electron/native-bridge/helperCoordinates.ts",+ "kind": "text",+ "sha256": "85b6a4129467c884bdf59e53d4a27543b41cd0616e08d24cded9a60e71563086"+ },+ {+ "path": "electron/native-bridge/services/aiEditionService.ts",+ "kind": "text",+ "sha256": "d04ee6ff94cac3e7209b0dd48cf7b9c3155364ecd7caec324c1e5bb67b9dbd7c"+ },+ {+ "path": "electron/native-bridge/services/compositorViewService.ts",+ "kind": "text",+ "sha256": "d2b89e210ac376005de2a120917f691f9fa7a9109ad4cbdc8853762380660117"+ },+ {+ "path": "electron/native-bridge/services/cursorService.ts",+ "kind": "text",+ "sha256": "502671efb349331be009a8c1e37d699f44aa8664babff529163b5b8c6f6c1c7a"+ },+ {+ "path": "electron/native-bridge/services/projectService.ts",+ "kind": "text",+ "sha256": "617c8597d0426ddfef2ee4954dbdf4a612a0cf6893be405f04e7b1e7d8421323"+ },+ {+ "path": "electron/native-bridge/services/systemService.ts",+ "kind": "text",+ "sha256": "8512d93cb01d00ac332cd7f4a09869d1cda220975f6e9b1f2f891005c07d6fa3"+ },+ {+ "path": "electron/native-bridge/store.ts",+ "kind": "text",+ "sha256": "5b17b3c72580a9c6400f46f731be8ba9a24802384cc98e0f67bd6812c54ef06d"+ },+ {+ "path": "electron/native/compositor-view/addon.d.ts",+ "kind": "text",+ "sha256": "137c4ff63c52fc06e4cd4efbeff13af4fe5ecb68ded3dbd7aaac74623bce0ade"+ },+ {+ "path": "electron/preload.ts",+ "kind": "text",+ "sha256": "88bcd46dcd2e28ac8c2364a121a5d027f9068732d339c3cbfdaabc640e02b401"+ },+ {+ "path": "electron/recording-settings.ts",+ "kind": "text",+ "sha256": "7ce874313af4fda48bcc082c4d997f4b7d19c154fee81adad1d4268f922edae1"+ },+ {+ "path": "electron/recording-source-settings.ts",+ "kind": "text",+ "sha256": "c52536945bbe50e6aceec47b659816527daefcb80e196c096e6a92631a700993"+ },+ {+ "path": "electron/recording/deviceNameMatching.ts",+ "kind": "text",+ "sha256": "3a56170629e6ef0ab47c5d11437b8311b2132d87c650db211546782d7b378513"+ },+ {+ "path": "electron/recording/nativeWindowsCaptureStop.ts",+ "kind": "text",+ "sha256": "989b2ac9d296de2b3a45ca47da5833bd93054ac37cb5bb33bc87eeb065eba684"+ },+ {+ "path": "electron/recording/webm-duration.ts",+ "kind": "text",+ "sha256": "74abc34721c9106eaa97375ebaad0a7a0186d628eab73520b40b7f83b3a26fa6"+ },+ {+ "path": "electron/recording/webm-seek-index.ts",+ "kind": "text",+ "sha256": "9adde4c2746166032772d4a82decfc3e741ca15a0a09d5ddae7cccc622287519"+ },+ {+ "path": "electron/stt/chunking.ts",+ "kind": "text",+ "sha256": "3e7eeac3e5a6a17ac9a9f7d0d7c0fa5c627856ba602cfac6113e0e9ef517f893"+ },+ {+ "path": "electron/stt/extractAudio.ts",+ "kind": "text",+ "sha256": "3ba0ef709c95f07b852abbcb6a698831bd48caf0330e830ac50e6a90ff090e93"+ },+ {+ "path": "electron/stt/gpuDetector.ts",+ "kind": "text",+ "sha256": "e6d8d261700f06f532a3d43ec770f4c0be11cbce0a0d23136c6f4006dac56b1e"+ },+ {+ "path": "electron/stt/index.ts",+ "kind": "text",+ "sha256": "7579fb5faefaeee478b233be68eae7108adb186cd1cb633da55e87c7ff6bdd58"+ },+ {+ "path": "electron/stt/modelManager.ts",+ "kind": "text",+ "sha256": "2c62dc974ed652ab364b8b97c4fd361dab2e03d00484454e720184f83c7f6e37"+ },+ {+ "path": "electron/stt/snapWordBoundaries.ts",+ "kind": "text",+ "sha256": "edf29277011a4066539775d76977b4aa616e3469105464b6d1af7cfed0a16f26"+ },+ {+ "path": "electron/stt/transcriptionContract.ts",+ "kind": "text",+ "sha256": "79f1ee8560db4b4cf7e767c8a690eaca059d29b7ae4fb217bad650ae2e2de34e"+ },+ {+ "path": "electron/stt/wav.ts",+ "kind": "text",+ "sha256": "dddeaea5292c7e55cbf23a0f66d112ac2bcddbeafda676a0276cea61fe5374e6"+ },+ {+ "path": "electron/stt/whisperServer.ts",+ "kind": "text",+ "sha256": "b036df3a5f5e226c22584bbb96b9d6dcdb05ad2ab7856d3d1ac0de3571d60cfa"+ },+ {+ "path": "electron/update-checker.ts",+ "kind": "text",+ "sha256": "014f8f7508619e7de5ac51dab68b879279194fa9630e329d4dcd9a1d6e968319"+ },+ {+ "path": "electron/update-settings.ts",+ "kind": "text",+ "sha256": "fc868d0bee858a17f6d4de7b25d437caab312b387bba624a3714fbb3d370c3bd"+ },+ {+ "path": "electron/windows.ts",+ "kind": "text",+ "sha256": "6470bf45b3fd0a79b0c1213cd8f86e86ec077426713e3a10a74df4159f6f9bf0"+ },+ {+ "path": "package-lock.json",+ "kind": "text",+ "sha256": "db54e267a3ea2d3ed80517d701bf5c00c07e342152d67ebdf8ae151477f2163b"+ },+ {+ "path": "package.json",+ "kind": "text",+ "sha256": "cf6f7288ff5df8d7cf24ac765d15314fdb0bbd6b87e53b4c29475166cc327f42"+ },+ {+ "path": "src/App.tsx",+ "kind": "text",+ "sha256": "ad7b7be7144cdfaa420b6c708d1679fc65042e81f706c5a33dc38a11a32b44bf"+ },+ {+ "path": "src/cli/CliCaptionsRunner.tsx",+ "kind": "text",+ "sha256": "eda7ed1c3db858f8a5e497622c636730466e86389caa3b47569d240c87856c89"+ },+ {+ "path": "src/cli/CliExportRunner.tsx",+ "kind": "text",+ "sha256": "5f8fa339c9efc7ecb9aab91e5c828ef7bb3a76009cc03526d09bc139af70a33a"+ },+ {+ "path": "src/cli/CliRecordRunner.tsx",+ "kind": "text",+ "sha256": "55f22db4182befeccc7b9d1cc9646206075b189476f7c5081c82036a8cff2218"+ },+ {+ "path": "src/cli/CliSourcesRunner.tsx",+ "kind": "text",+ "sha256": "b79f3ff781765eabd8d861811669752e842d65ed1e67ff7ad7aa21febcc1e16a"+ },+ {+ "path": "src/cli/captionAnnotations.ts",+ "kind": "text",+ "sha256": "39ba50daed8780f225a358c1dd6f43456802a01f193282ebe36e40ca2513ea10"+ },+ {+ "path": "src/cli/vendor/leadingSilence.ts",+ "kind": "text",+ "sha256": "726d0a24c9fb3a217f5c6b026adee535ec9c799131493c2a82617da260e2beeb"+ },+ {+ "path": "src/cli/vendor/zoomHelpers.ts",+ "kind": "text",+ "sha256": "e15faf57d6f1c5c8ae302c25dc091075568e4251b612cbfab88682ba527e21c9"+ },+ {+ "path": "src/components/ai-edition/AiEditionShell.tsx",+ "kind": "text",+ "sha256": "a09bef45ee3bc0a61c3edfbdfce6624bb732e7967bcc979c566bc19e24ae36b2"+ },+ {+ "path": "src/components/ai-edition/AnnotationLayer.tsx",+ "kind": "text",+ "sha256": "da9e6b498f4790a84744b9f86db28eb56f8e98c6927bf7760d58ef5bd80d835c"+ },+ {+ "path": "src/components/ai-edition/AnnotationOverlay.tsx",+ "kind": "text",+ "sha256": "17f7e06b2a4bb46da6bb9477bad47c002ed0e04839d288de9c8ae5e8466c2711"+ },+ {+ "path": "src/components/ai-edition/AppSettings.tsx",+ "kind": "text",+ "sha256": "c944ebf51205e87764878124547d4c0b3cfac239d2c5b5064b4b15db565c2d1e"+ },+ {+ "path": "src/components/ai-edition/CaptionsPane.tsx",+ "kind": "text",+ "sha256": "4cc39db465ba38ebb8612744e7459a3f3a0b8219df2e818c31b9c1935988ff3e"+ },+ {+ "path": "src/components/ai-edition/ChatWelcome.tsx",+ "kind": "text",+ "sha256": "1cd83dfc745354dfff209ad4b0ddd149f9883bdf44259111bd647c444b8bd810"+ },+ {+ "path": "src/components/ai-edition/ColorField.tsx",+ "kind": "text",+ "sha256": "e6e4782d8c192d54e7add4cac377576aa4c503c434b6ef26eb4e1898886d5895"+ },+ {+ "path": "src/components/ai-edition/EditorEmptyState.tsx",+ "kind": "text",+ "sha256": "ed4046845ed7f66ba7a1843cea05f05b6b8510539f148035bb22dbe6a10ec553"+ },+ {+ "path": "src/components/ai-edition/ExportDialog.tsx",+ "kind": "text",+ "sha256": "c8c6ae872d66bec086da33f0f615a4d6f4e3034f87777d4337c3476bb9ac343e"+ },+ {+ "path": "src/components/ai-edition/LeftPanel.tsx",+ "kind": "text",+ "sha256": "7ea930563fe04cd5e0f7747c3719aa15d8687b976ffc4a65d03faf0a8e8580ae"+ },+ {+ "path": "src/components/ai-edition/Modals.tsx",+ "kind": "text",+ "sha256": "084ea8219ed4a728fa5f8de21d46baf3c8c0671d05d6e1cc32222984b5b52a08"+ },+ {+ "path": "src/components/ai-edition/NativeCompositorOverlay.tsx",+ "kind": "text",+ "sha256": "cebcca91656094b290ae700ba2ebe0e3d78391bf7612f04cfab3829522b92ad5"+ },+ {+ "path": "src/components/ai-edition/NewEditorShell.tsx",+ "kind": "text",+ "sha256": "7f6e39838e6e8365fab806bcf798961100f3170f84672607083fea890d17987c"+ },+ {+ "path": "src/components/ai-edition/Preview.tsx",+ "kind": "text",+ "sha256": "10e2ce326beec70fe42115fe52c15782e14148430ca25453ce87f2cb34596a78"+ },+ {+ "path": "src/components/ai-edition/PreviewCanvas.tsx",+ "kind": "text",+ "sha256": "f5043c4e289c03eda8da3aba908299bd072cf554e2c40c0b8c4444990f053abd"+ },+ {+ "path": "src/components/ai-edition/PreviewErrorCard.tsx",+ "kind": "text",+ "sha256": "eb53599ab187bde04e776790becf558bd3e0ec8bb9edee036de8834836c17b45"+ },+ {+ "path": "src/components/ai-edition/ProviderSettings.tsx",+ "kind": "text",+ "sha256": "100abbe799a70273d4f35edbc7430d8159bc780e83c5ae2e3092586d16e9cf54"+ },+ {+ "path": "src/components/ai-edition/RightPanes.tsx",+ "kind": "text",+ "sha256": "b83c515102b82de1d35e5362d3fb871b461fdbd68e6c0c6a09d9aa779e144c1b"+ },+ {+ "path": "src/components/ai-edition/TranscriptionStatus.tsx",+ "kind": "text",+ "sha256": "7bb88385f042c2a5a9a9b4c4545fb4f4bcc8816ef4e66a10aea5c6a51191782f"+ },+ {+ "path": "src/components/ai-edition/TransportBar.tsx",+ "kind": "text",+ "sha256": "656098d31409cefed78203930e5dc6f92146122de9306a656676cca725c337cd"+ },+ {+ "path": "src/components/ai-edition/VirtualPreview.tsx",+ "kind": "text",+ "sha256": "3428f88ee23f6eda89336b6dc3191541ddd89224ff361e61ebe6541479e9590b"+ },+ {+ "path": "src/components/ai-edition/WebcamOverlay.tsx",+ "kind": "text",+ "sha256": "d6396423da10b2e699242754cfba9e762111ed383e289817e02513ac93d8f3c1"+ },+ {+ "path": "src/components/ai-edition/ZoomFocusOverlay.tsx",+ "kind": "text",+ "sha256": "15bc1649bde869a50a2a818aab47c7c967f8ec8b8905395f4ae2e371cb040042"+ },+ {+ "path": "src/components/ai-edition/chatAvailability.ts",+ "kind": "text",+ "sha256": "f281f09fd26583cfd0bf744877395e8e9f15cc7e6af5ff89c4dbea5dfbb424cc"+ },+ {+ "path": "src/components/ai-edition/chatBudget.ts",+ "kind": "text",+ "sha256": "f0c464272a66244f734a012fe9a777e148616a0567ef84c10af90ff9d752cd70"+ },+ {+ "path": "src/components/ai-edition/cropDraft.ts",+ "kind": "text",+ "sha256": "3efd5c1bd7bff0a79f3b0cda596a63f5cd14cd6181721b56814d3da916ae0823"+ },+ {+ "path": "src/components/ai-edition/insertionsEnabled.ts",+ "kind": "text",+ "sha256": "17a92d6cf2798bd22efa08dc5f2e99ca17b600fa7f9d829d13617d9571062f5f"+ },+ {+ "path": "src/components/ai-edition/mediaError.ts",+ "kind": "text",+ "sha256": "0ac9db96d61a63840051717469eb726ca84a8d0b201771e94233aea10105984a"+ },+ {+ "path": "src/components/ai-edition/recordingImport.ts",+ "kind": "text",+ "sha256": "bf0273d019a540c33d0d15e8cb5e777d8c894148db95855147a233e3576ec83d"+ },+ {+ "path": "src/components/ai-edition/transcriptionBusyLabel.ts",+ "kind": "text",+ "sha256": "451e3422427b14c710215e0e4373728238056adf8d0bd27d608c6fbb59ab2e80"+ },+ {+ "path": "src/components/ai-edition/useChatBudget.ts",+ "kind": "binary",+ "sha256": "70bce4c565810d5a041bf98705a9a86260880b296d77f7cdfcd34c09c3503582"+ },+ {+ "path": "src/components/ai-edition/v4/AddAudioLayerDialog.tsx",+ "kind": "text",+ "sha256": "31f926d95556a557b21e064467bbb7eecf69c6aadafa20a425c9e670599f0f21"+ },+ {+ "path": "src/components/ai-edition/v4/EditorTopBar.tsx",+ "kind": "text",+ "sha256": "1c33ccd593f990ec91755bf9e0b4132edd74bed8de8de79949d4bb4c68dcb695"+ },+ {+ "path": "src/components/ai-edition/v4/FloatingInspector.tsx",+ "kind": "text",+ "sha256": "a2495b4d4d1061d223216daaa25930abb507f077f5cb89c47eea9340dd5792d1"+ },+ {+ "path": "src/components/ai-edition/v4/MediaStage.tsx",+ "kind": "text",+ "sha256": "07f1ad3f86cbe73bed5532363aa3565ab4756a8933f91e14d60bbd351ef02d69"+ },+ {+ "path": "src/components/ai-edition/v4/RecStage.tsx",+ "kind": "text",+ "sha256": "8fbaabc716a15f67db5da7c6a4ad00b7c630e67e6115da4227d7623040d68b2d"+ },+ {+ "path": "src/components/ai-edition/v4/V4Timeline.tsx",+ "kind": "text",+ "sha256": "4248ca3697d9947623a7f5a41771afd7308805228da917714b819a5c97f19c03"+ },+ {+ "path": "src/components/launch/CountdownOverlay.tsx",+ "kind": "text",+ "sha256": "f73ee34f0abc26bb375b74bdda272002f400e7ca49e86b8daa1d587533fab43b"+ },+ {+ "path": "src/components/launch/HudControls.tsx",+ "kind": "text",+ "sha256": "4008f24cee2f323c422b70a992f8a3fe69bde4bfca08166b21c701f16541f842"+ },+ {+ "path": "src/components/launch/HudDeviceSettings.tsx",+ "kind": "text",+ "sha256": "87fd0b43b60920d8bbadfaaafc96c4b7b2b2fddec24ac159895d05b05dd10e62"+ },+ {+ "path": "src/components/launch/HudIcons.tsx",+ "kind": "text",+ "sha256": "d5f6d6016fb96447d4befe8753fb774a8a200ad9069a8b365e51e46c2aa891e4"+ },+ {+ "path": "src/components/launch/LaunchWindow.tsx",+ "kind": "text",+ "sha256": "760f4ffeef2f78ac940628dff4999b0887d5effcae5731f76fb8855cb4cb65e6"+ },+ {+ "path": "src/components/launch/NotesToolbar.tsx",+ "kind": "text",+ "sha256": "43aa12ebd82801b6950ad1564d7aa0a337de0c3cee56b584521bda9b2c95f191"+ },+ {+ "path": "src/components/launch/NotesWindow.tsx",+ "kind": "text",+ "sha256": "5b2a12d055732134ff8934268e54946da2e5d0d9ee3ff35e67f917b594f99cc0"+ },+ {+ "path": "src/components/launch/SourceSelector.tsx",+ "kind": "text",+ "sha256": "06bfe5b349f8170903f095b1471c9fcd7bef939cc62cfc990819c30d09eaa563"+ },+ {+ "path": "src/components/launch/hudGeometry.ts",+ "kind": "text",+ "sha256": "ed57aeea63cb114682c50d9f2a65fd0ed6717ff64f672caaf05abe9365747a58"+ },+ {+ "path": "src/components/launch/notesTeleprompter.ts",+ "kind": "text",+ "sha256": "79bd67bb00621350404a088b04d4895b796b12322cf356b0a1c64a1482364318"+ },+ {+ "path": "src/components/launch/openSourceSelectorFlow.ts",+ "kind": "text",+ "sha256": "766fcda692e4bbe8832d9d4c0d6c2e9f2758d3be9d4c8b4988feea77a300e752"+ },+ {+ "path": "src/components/ui/audio-level-meter.tsx",+ "kind": "text",+ "sha256": "ff0b8417cbd55b786039eb997d83aacf4e2eb171edba7071636c25d6b031dc89"+ },+ {+ "path": "src/components/ui/button.tsx",+ "kind": "text",+ "sha256": "03ce6d12ea63eeeb44e1780136cf78a58f5a831b9115e7ddfb5dfaa2756cfdda"+ },+ {+ "path": "src/components/ui/dialog.tsx",+ "kind": "text",+ "sha256": "6db7c88105fbb67ce80eaf9c40d4896f9d816d916ebe87a2db69171acebf44b2"+ },+ {+ "path": "src/components/ui/gradient-editor.tsx",+ "kind": "text",+ "sha256": "d4a2a23d1f2232e36fbf576117c2f2815372392cdffea3455e4a596978e58cb5"+ },+ {+ "path": "src/components/ui/popover.tsx",+ "kind": "text",+ "sha256": "594f978fecc400a29173bae2df0f3a4a4d828d9f52f15847abd4381021544bec"+ },+ {+ "path": "src/components/ui/sonner.tsx",+ "kind": "text",+ "sha256": "98b531847cf6ef8628c12b06943bc34af7262a9e017ba251e5b88e466bfd25f3"+ },+ {+ "path": "src/components/ui/tabs.tsx",+ "kind": "text",+ "sha256": "583eb5d9abd39313b3ba3e516ddd965825a65a95ffb91dde8dd4aabed21c0da8"+ },+ {+ "path": "src/components/ui/tooltip.tsx",+ "kind": "text",+ "sha256": "b18ddd4c4fbb3676dfb5c76fdea48f03c9f503fc7a80f98f5e248cc3f79f241d"+ },+ {+ "path": "src/components/video-editor/ShortcutsConfigDialog.tsx",+ "kind": "text",+ "sha256": "ea1f14639817f180e94198f4667038e12fe6e418373a9ae5b356ca54ef004825"+ },+ {+ "path": "src/components/video-editor/customPlaybackSpeed.ts",+ "kind": "text",+ "sha256": "4942b2790e6caf0e409f4a8dfe0d1cdd66b9290f57d75f8e2afbeb7e80b62e26"+ },+ {+ "path": "src/components/video-editor/editorDefaults.ts",+ "kind": "text",+ "sha256": "c7001d1c42f31d8bf31c997b5ac2c347a79a4e9af92bec6bb50828c9b00d3f08"+ },+ {+ "path": "src/components/video-editor/projectPersistence.ts",+ "kind": "text",+ "sha256": "48f9e321bc3f31cb830f2ee70306c241ee45357d39403ecd5f72295bfda24b8b"+ },+ {+ "path": "src/components/video-editor/types.ts",+ "kind": "text",+ "sha256": "b0c541decbb9f982dd82ecc06333eba019e376821d4a30af047474fccbe425e5"+ },+ {+ "path": "src/contexts/EditorDialogsContext.tsx",+ "kind": "text",+ "sha256": "e49b5a97e6d1c764a1b8c6dc508726cf8f6f1d1434eaae7f59b753bea57ac6ea"+ },+ {+ "path": "src/contexts/I18nContext.tsx",+ "kind": "text",+ "sha256": "99e00ebaf4bf472e4af8abdf5561b7e29ff934f242ac080792b42a9b3f922464"+ },+ {+ "path": "src/contexts/ShortcutsContext.tsx",+ "kind": "text",+ "sha256": "979a1a97b18b146b9b2ec8aca46d40f30b8d2a29aacb190f3d39d97459a0705a"+ },+ {+ "path": "src/hooks/audioPeaksWorker.ts",+ "kind": "text",+ "sha256": "6edf3eca2105c08f2636e922cdae355d11cb7006d079f86a141eac903235ac5c"+ },+ {+ "path": "src/hooks/recorderHandle.ts",+ "kind": "text",+ "sha256": "27e70b16e859331eb8a2ee5dc17defdac8a4a5a4e28fa7d4c33aad62695d0dc3"+ },+ {+ "path": "src/hooks/rendererConsoleForwarder.ts",+ "kind": "text",+ "sha256": "5ed77d78995c51f32cb44f9e14a41f5d8800cf0503ff12e6577b22f5eab43538"+ },+ {+ "path": "src/hooks/streamingAudioPeaks.ts",+ "kind": "text",+ "sha256": "e632b1a385fe714a78c3a89dd3a2c8fc19094301562fe1cc86cb13d6a1efc47f"+ },+ {+ "path": "src/hooks/useAudioLevelMeter.ts",+ "kind": "text",+ "sha256": "b3cb3232aeef9aeeeb7fc1af713180441316c6a6f4d353b86b5d99365482ac7b"+ },+ {+ "path": "src/hooks/useAudioPeaks.ts",+ "kind": "text",+ "sha256": "2d1f2cd761477e3da89c05748e073ee19a11802857ca391658de27357c364b9f"+ },+ {+ "path": "src/hooks/useCameraDevices.ts",+ "kind": "text",+ "sha256": "458143d1e0486b2193e271ff7bc13920bda0883a49d858524c9dc7fe0c45870b"+ },+ {+ "path": "src/hooks/useCameraPreviewStream.ts",+ "kind": "text",+ "sha256": "a0646b3031038fabaf0cbcd399554d32ab969c4704ac77d0ba2b9b6136763e97"+ },+ {+ "path": "src/hooks/useEditorHistory.ts",+ "kind": "text",+ "sha256": "688e89e704613de846dbd598088dbab2ac6d9397395f87b46d5c5370681cd037"+ },+ {+ "path": "src/hooks/useMicrophoneDevices.ts",+ "kind": "text",+ "sha256": "b855650f173aec2b2dcae9eccca38cac887956ba1e941d1b6d8a809dc515623e"+ },+ {+ "path": "src/hooks/usePortalOwnsSource.ts",+ "kind": "text",+ "sha256": "e1de500c5f6b46cd1481b7d134278098f33fef956a51d1b4a9728aa3d9ad5de2"+ },+ {+ "path": "src/hooks/useScreenRecorder.ts",+ "kind": "text",+ "sha256": "9e4857a736a50101d204fdad45d6211e703354d71bee3b60665cb8751cf4a5dd"+ },+ {+ "path": "src/hooks/useTheme.ts",+ "kind": "text",+ "sha256": "489211bb7d2526fe61edea7a0cda6eb64e6d71083ce5336f4ad9c9de3e53c98d"+ },+ {+ "path": "src/hooks/webcamDeviceIdentity.ts",+ "kind": "text",+ "sha256": "7b55033a545a7faa29a23abb9920881e38b021009c9cf8d6f9edbb2ba93c0f33"+ },+ {+ "path": "src/i18n/config.ts",+ "kind": "text",+ "sha256": "d5879cd60cdcb62561eb54bcc5d2f54f8597d407d1b5834d80524b3f52a32eab"+ },+ {+ "path": "src/i18n/loader.ts",+ "kind": "text",+ "sha256": "ffa9ae5714ad33a8414d3afd151712abb87068b1f102b489586448a377ab8d10"+ },+ {+ "path": "src/i18n/locales/ar/common.json",+ "kind": "text",+ "sha256": "10669c768419209d037922150a8fd526dc0e65f78d037edd9cc9109f7c27a805"+ },+ {+ "path": "src/i18n/locales/ar/dialogs.json",+ "kind": "text",+ "sha256": "cd0735b358ea52021cd7b74d162ec78d78062fcc17b2328735cc6d79134f94fe"+ },+ {+ "path": "src/i18n/locales/ar/editor.json",+ "kind": "text",+ "sha256": "1ff00d91ebfa02445856e77f07b75bdc577be7646a883449017c1127dfb697c4"+ },+ {+ "path": "src/i18n/locales/ar/launch.json",+ "kind": "text",+ "sha256": "2a1aedf4173db0301cfa34af26e2299e3f8c5984383ff3cdf01dc62d9694a45d"+ },+ {+ "path": "src/i18n/locales/ar/settings.json",+ "kind": "text",+ "sha256": "0c66e3b5c179787ee7e6a516cf5f933441db1613ae34942b057ca348713f4cd0"+ },+ {+ "path": "src/i18n/locales/ar/shortcuts.json",+ "kind": "text",+ "sha256": "59682b50dcfafb825c1c7eea3558298e533fa27ce35e0049fa97acf56f044a50"+ },+ {+ "path": "src/i18n/locales/ar/timeline.json",+ "kind": "text",+ "sha256": "067f465bfa89b993af228717ee2c7c5609d7f6a908ed892dfa1258f0c16765d6"+ },+ {+ "path": "src/i18n/locales/en/common.json",+ "kind": "text",+ "sha256": "543efa3b21fa2f90f03e5eaea9164290161d9dac5ae9f55e0a60a99522c58105"+ },+ {+ "path": "src/i18n/locales/en/dialogs.json",+ "kind": "text",+ "sha256": "b45e1a1621cc087f0bc97301a34db898ddc48e0e86ca0bf7825f879c596fbe27"+ },+ {+ "path": "src/i18n/locales/en/editor.json",+ "kind": "text",+ "sha256": "9189474677b48623f3d6e58f3fb0c2cd30fae8423e0c785ca28e8bbf88bfefa9"+ },+ {+ "path": "src/i18n/locales/en/launch.json",+ "kind": "text",+ "sha256": "8060062005428753c7d545decb5f2a64e6c76d5309f92a9ac2a5dddea9c21fa6"+ },+ {+ "path": "src/i18n/locales/en/settings.json",+ "kind": "text",+ "sha256": "0741d935160f222f7c0c8a43581d58439488850cd7a44dc9bf831f5ca9c15e4b"+ },+ {+ "path": "src/i18n/locales/en/shortcuts.json",+ "kind": "text",+ "sha256": "aa97642b7ff557ade8c97417b5c170a9d4b8c29858f8d148928101d8cc26d811"+ },+ {+ "path": "src/i18n/locales/en/timeline.json",+ "kind": "text",+ "sha256": "98be53a960eac3842fc05b806730cf92bdf1c54249bc423f2a07189aac42a6cf"+ },+ {+ "path": "src/i18n/locales/es/common.json",+ "kind": "text",+ "sha256": "7588e64e5bc66260242252f7df3dbd10b070fce70639e80782892ae8d9ebc540"+ },+ {+ "path": "src/i18n/locales/es/dialogs.json",+ "kind": "text",+ "sha256": "71d232bd9d73201749dea89349fc8975c05538843201aeaa5faf998f46daaca6"+ },+ {+ "path": "src/i18n/locales/es/editor.json",+ "kind": "text",+ "sha256": "8ee0a42eebd99863bbd6fd6638c60c660be68aef0b2f4e2eeec2ec7b950ae660"+ },+ {+ "path": "src/i18n/locales/es/launch.json",+ "kind": "text",+ "sha256": "06f299e5547e388c6d37ed78b8ad8698a00bb6c8f21f57ef27a7b0066ee0169a"+ },+ {+ "path": "src/i18n/locales/es/settings.json",+ "kind": "text",+ "sha256": "ed6ef669ad4164335643ce74fc05c3c3c81d263a2808d79e29216f095d871faf"+ },+ {+ "path": "src/i18n/locales/es/shortcuts.json",+ "kind": "text",+ "sha256": "eeac609009f939af14162d7ac4f59f9c92a73c3ef2a014358762942eb06bad48"+ },+ {+ "path": "src/i18n/locales/es/timeline.json",+ "kind": "text",+ "sha256": "d755157619091d4ed89f6a871423dee455b5e1291123882167869ef906427adb"+ },+ {+ "path": "src/i18n/locales/fr/common.json",+ "kind": "text",+ "sha256": "bde8d9f59e7982fb283523384ea7328bd2d8da199b2659ea8c00d3006b89def8"+ },+ {+ "path": "src/i18n/locales/fr/dialogs.json",+ "kind": "text",+ "sha256": "a6db958b57ef13a84facda7ba63e61feb582ad3a655485a7ef37f67914d1764c"+ },+ {+ "path": "src/i18n/locales/fr/editor.json",+ "kind": "text",+ "sha256": "6e3659076d17d373d34012debaf010d22640574409ee943cb45f6a337ea5bc40"+ },+ {+ "path": "src/i18n/locales/fr/launch.json",+ "kind": "text",+ "sha256": "049d30e6fe1ccd2f9a60ef274eb622ee500ada1c5ef2f6fb98071ae98bd35a3a"+ },+ {+ "path": "src/i18n/locales/fr/settings.json",+ "kind": "text",+ "sha256": "7548fb6caaec48ed595dfa2fce4f7cce173f0c5accd72d2f1be82b639618b43b"+ },+ {+ "path": "src/i18n/locales/fr/shortcuts.json",+ "kind": "text",+ "sha256": "ab8be98e3ca5cf306928098d88629b3ce80f77646a89eeaafd1ec24596c05441"+ },+ {+ "path": "src/i18n/locales/fr/timeline.json",+ "kind": "text",+ "sha256": "96c55f3ba7681210f1a773ae9f0e7883b8eab5b65c8289498fd769713735297b"+ },+ {+ "path": "src/i18n/locales/it/common.json",+ "kind": "text",+ "sha256": "4e86709f4041ac491f99117cbe4996623d58fda483e8c56523e1ef20c10ef3e6"+ },+ {+ "path": "src/i18n/locales/it/dialogs.json",+ "kind": "text",+ "sha256": "ad2cebde1f104272ef4e18e7249ceed5f1efafab4038ba0b9793b8c4b6e141e2"+ },+ {+ "path": "src/i18n/locales/it/editor.json",+ "kind": "text",+ "sha256": "60b2c7e6462ee2f85742cea0aec01ffeeef5404630cdc8baa009694d228852d6"+ },+ {+ "path": "src/i18n/locales/it/launch.json",+ "kind": "text",+ "sha256": "d3cf72d5b3e1150e6d61200842ec892d08665c186297eb11367c0d72b4f570a0"+ },+ {+ "path": "src/i18n/locales/it/settings.json",+ "kind": "text",+ "sha256": "548d1ed4f208ca4cb93d0f2a2a158b8bab6abf1062c9f30a156b87159e01015c"+ },+ {+ "path": "src/i18n/locales/it/shortcuts.json",+ "kind": "text",+ "sha256": "927bfc834d200041789656199bb524d7d5d7ac51aaf00876efc80785e98e9a17"+ },+ {+ "path": "src/i18n/locales/it/timeline.json",+ "kind": "text",+ "sha256": "7f006e6ade1c2e22bb585e11233c684331e33166dad903452ffd06544fbd3a60"+ },+ {+ "path": "src/i18n/locales/ja-JP/common.json",+ "kind": "text",+ "sha256": "cc2925f27cf7c549ebf153f1711add0a140e813b3e8f897bfb17ee7ac701bf82"+ },+ {+ "path": "src/i18n/locales/ja-JP/dialogs.json",+ "kind": "text",+ "sha256": "062e35c11ddb3cba94c2d7857016dd8fe11f6241db2ffe0382401965837b8fdf"+ },+ {+ "path": "src/i18n/locales/ja-JP/editor.json",+ "kind": "text",+ "sha256": "8aca71b1a7ffe54c769b8268c1e19c28041acfc33897d6dc70e132de5f27df74"+ },+ {+ "path": "src/i18n/locales/ja-JP/launch.json",+ "kind": "text",+ "sha256": "5d9fb31a4e29d72f688fbde1f648f1266c09b0455e5021ee95318eb912cf07df"+ },+ {+ "path": "src/i18n/locales/ja-JP/settings.json",+ "kind": "text",+ "sha256": "6a7d82d121dd7bd8c39c08a19a1cd37ea3fdad126d8582859381d5341256a4d5"+ },+ {+ "path": "src/i18n/locales/ja-JP/shortcuts.json",+ "kind": "text",+ "sha256": "13789a992c1cd1d137bf2cd1d185274559679147ebc3ec559cb09c43067c38b1"+ },+ {+ "path": "src/i18n/locales/ja-JP/timeline.json",+ "kind": "text",+ "sha256": "95798aef827d7c48b8a17ad41f7f14166424ab8e7ea62db4be93ab55ff097199"+ },+ {+ "path": "src/i18n/locales/ko-KR/common.json",+ "kind": "text",+ "sha256": "1989362f01b9f04003b2a633846bef59b9d6d15b680998fcb9ca3f61105970eb"+ },+ {+ "path": "src/i18n/locales/ko-KR/dialogs.json",+ "kind": "text",+ "sha256": "aa909fd26a78bfc5554da97ae2c5f6005b1d84d50ff859f324f1bbc3337c7dfc"+ },+ {+ "path": "src/i18n/locales/ko-KR/editor.json",+ "kind": "text",+ "sha256": "a2a849598755b21d1d62cac28a80deba69730ac4c09122f922ec4d4eef2361eb"+ },+ {+ "path": "src/i18n/locales/ko-KR/launch.json",+ "kind": "text",+ "sha256": "0fbd193dba26d24157a029a9691e2a74952f45fbd4519955438a630be634d8fe"+ },+ {+ "path": "src/i18n/locales/ko-KR/settings.json",+ "kind": "text",+ "sha256": "22f2e5ca0d62deb467386b15b304785d6d72e7f0384218e2451dee1149bccdbc"+ },+ {+ "path": "src/i18n/locales/ko-KR/shortcuts.json",+ "kind": "text",+ "sha256": "c270e38cd34b01120e17b2daa6c725e133b6177024bcd5740de34737b731cc87"+ },+ {+ "path": "src/i18n/locales/ko-KR/timeline.json",+ "kind": "text",+ "sha256": "5f640119d9d9ecc7ae899df5deb778a06b4028d01ece48eebc782ea33f4b6714"+ },+ {+ "path": "src/i18n/locales/pt-BR/common.json",+ "kind": "text",+ "sha256": "1ca81ead242acdf104349543f8988e43ef020cab2eab7988cd8025ba76de8382"+ },+ {+ "path": "src/i18n/locales/pt-BR/dialogs.json",+ "kind": "text",+ "sha256": "87780ea6994779700f88fb9e76a8b362deb1008839fc33a76c7b38e564d6e131"+ },+ {+ "path": "src/i18n/locales/pt-BR/editor.json",+ "kind": "text",+ "sha256": "8af229d962b07519e6f77ea9c8674d0ced0a638f8a75827cad4821bb441450b4"+ },+ {+ "path": "src/i18n/locales/pt-BR/launch.json",+ "kind": "text",+ "sha256": "4b2e28c764bd7aaaddc2f8168976bc40bd1b601842e765d77dc2f4799ad1f19c"+ },+ {+ "path": "src/i18n/locales/pt-BR/settings.json",+ "kind": "text",+ "sha256": "86db2561d6b9b9c9cbcff23a12380d34dd961a804931f1cde43762e5ac33869b"+ },+ {+ "path": "src/i18n/locales/pt-BR/shortcuts.json",+ "kind": "text",+ "sha256": "e1882dd93f5da8732bb4da74fc0212df88d18775ea22f57a54f3072e460216d3"+ },+ {+ "path": "src/i18n/locales/pt-BR/timeline.json",+ "kind": "text",+ "sha256": "8e466a95a0bc5d8a65aa7cf30d6ca6111ce0f158ffe39a73b24f5a070acae67f"+ },+ {+ "path": "src/i18n/locales/ru/common.json",+ "kind": "text",+ "sha256": "127a76328a7a69554db87d9222dfe2eb8728659e183795496cc9f03724c948fa"+ },+ {+ "path": "src/i18n/locales/ru/dialogs.json",+ "kind": "text",+ "sha256": "1ec6e26e3fd8fb7be2501533c7ec5afddb17d15ef8906ab2f5d2657fa28a1887"+ },+ {+ "path": "src/i18n/locales/ru/editor.json",+ "kind": "text",+ "sha256": "1910e259e78b2a5f6d16faac1babdad051791ec867f2bc0b51e48af847734a07"+ },+ {+ "path": "src/i18n/locales/ru/launch.json",+ "kind": "text",+ "sha256": "807a1761ac2ba85a47ab7ce67f6f43c8ce778ffbb55d810e2e009bd1898e85b2"+ },+ {+ "path": "src/i18n/locales/ru/settings.json",+ "kind": "text",+ "sha256": "4b03f5b400afbda4bc0d782d96917ae77cfd3eb9f3dd58da1253a3541202a379"+ },+ {+ "path": "src/i18n/locales/ru/shortcuts.json",+ "kind": "text",+ "sha256": "161423ba18247639491d69521bf3720e89f97e6a79600eb7b5d6a065ce0952a9"+ },+ {+ "path": "src/i18n/locales/ru/timeline.json",+ "kind": "text",+ "sha256": "9e24b713f6c7db9310fb83030fa82c927648eb0457deb20250836bb84ae79b0b"+ },+ {+ "path": "src/i18n/locales/tr/common.json",+ "kind": "text",+ "sha256": "ce6838d4f9b0815fc357828de94916747941cfc7ff286f1215f650faa344e5a8"+ },+ {+ "path": "src/i18n/locales/tr/dialogs.json",+ "kind": "text",+ "sha256": "8b3975c2bba5b7b40840ae1a1e44b1c54d1c6de353fbc01bd24f07949201b465"+ },+ {+ "path": "src/i18n/locales/tr/editor.json",+ "kind": "text",+ "sha256": "a23e26b9ed69249966704678c9bb7066b194cefad9a85188e8865056eeffa6c2"+ },+ {+ "path": "src/i18n/locales/tr/launch.json",+ "kind": "text",+ "sha256": "e5eb8bd7a8d1bca4f00b34ebf97966f15d1cce9766c7f4d140eff38955a76c66"+ },+ {+ "path": "src/i18n/locales/tr/settings.json",+ "kind": "text",+ "sha256": "8942d3ba091aceec9dd0012540fb4311e84f56c0c3213b69dd7e5c77416b722b"+ },+ {+ "path": "src/i18n/locales/tr/shortcuts.json",+ "kind": "text",+ "sha256": "ff1eea40ec511b29508d72f0f16d2b5a403c57748afa3f4ef8061c34342771f1"+ },+ {+ "path": "src/i18n/locales/tr/timeline.json",+ "kind": "text",+ "sha256": "810a770e22cf42c0954f9955e4a55044cb5f0205c9647b10e5809281b6605547"+ },+ {+ "path": "src/i18n/locales/vi/common.json",+ "kind": "text",+ "sha256": "dc5e1ce6962cfc761aa7c80e31c7c262793e4d48b684aa21f8e46269913a4177"+ },+ {+ "path": "src/i18n/locales/vi/dialogs.json",+ "kind": "text",+ "sha256": "2a979782f8b777edb1f730352cdfe4a05d96b767d2488e70e5d3797b790e9466"+ },+ {+ "path": "src/i18n/locales/vi/editor.json",+ "kind": "text",+ "sha256": "723cae5524fe6c4e8ae00a7390c4d99b092e326766f1b87700fb6b0d116e2c77"+ },+ {+ "path": "src/i18n/locales/vi/launch.json",+ "kind": "text",+ "sha256": "2b5fb947f79ddda909173f5cf36b6dc3782a9990ade73d9189276a142589fd77"+ },+ {+ "path": "src/i18n/locales/vi/settings.json",+ "kind": "text",+ "sha256": "11a3b0e87414fa261c67f07ef12b4ff1fece04a0986c2f3ef896876d35a16419"+ },+ {+ "path": "src/i18n/locales/vi/shortcuts.json",+ "kind": "text",+ "sha256": "ab12344febb45bf79f02f4543a347081f0909b3dda9341f426cb76c515802300"+ },+ {+ "path": "src/i18n/locales/vi/timeline.json",+ "kind": "text",+ "sha256": "d2e2397689ab0d0f3ea19f304ce3fc3788c8b639c51f1c13755a577820928cfd"+ },+ {+ "path": "src/i18n/locales/zh-CN/common.json",+ "kind": "text",+ "sha256": "872ed8cfbdee79323734fbf5485134f3d13af74b3feb86644b80b3e31decc8d6"+ },+ {+ "path": "src/i18n/locales/zh-CN/dialogs.json",+ "kind": "text",+ "sha256": "b1ce75b930ccff0c4d7d07b26793852491753b74787cb7d335f64cca39a11f34"+ },+ {+ "path": "src/i18n/locales/zh-CN/editor.json",+ "kind": "text",+ "sha256": "a04c9925dc02499eb5753075222e935eafae976e75b1b804d3fa9fbfe0d3b468"+ },+ {+ "path": "src/i18n/locales/zh-CN/launch.json",+ "kind": "text",+ "sha256": "70d9196dc9c517b0e4d655d37edb3a48d8d1af6d8e0b2fa8504bd14ce5a8f6e0"+ },+ {+ "path": "src/i18n/locales/zh-CN/settings.json",+ "kind": "text",+ "sha256": "ab4c2882fd545a70c1be3a56d327fbfcb9d88dfed55b0260732ea928f28e5fea"+ },+ {+ "path": "src/i18n/locales/zh-CN/shortcuts.json",+ "kind": "text",+ "sha256": "20141cccadab1ea02c7c4e6e404496410096e05117b62a2d985892bbb47812b8"+ },+ {+ "path": "src/i18n/locales/zh-CN/timeline.json",+ "kind": "text",+ "sha256": "af9b682843b61771e23430447205451c345830ba97b1978bed21cac74fea01dd"+ },+ {+ "path": "src/i18n/locales/zh-TW/common.json",+ "kind": "text",+ "sha256": "1068ceeea0fe8a784eded79e3ef552df90ad17b9892f06480d272c1f5e57bad3"+ },+ {+ "path": "src/i18n/locales/zh-TW/dialogs.json",+ "kind": "text",+ "sha256": "bd8434542d35ebbb11a5d303fb6a6df11f70a1e74a0e6f4fa19f1939e0046274"+ },+ {+ "path": "src/i18n/locales/zh-TW/editor.json",+ "kind": "text",+ "sha256": "2b19904ce3bb26029325a93222551ad1469b5ccfc2ca778183b0f75ae54fb93f"+ },+ {+ "path": "src/i18n/locales/zh-TW/launch.json",+ "kind": "text",+ "sha256": "fa514fbfe0a52e24fd2b4a526a47d66d377ff6c2672fdeb342d236be6dd3ceb1"+ },+ {+ "path": "src/i18n/locales/zh-TW/settings.json",+ "kind": "text",+ "sha256": "0dbebf142c7e374eaa34b459a6194e361bd0d25823bf122c1f3a9adbf18b4f41"+ },+ {+ "path": "src/i18n/locales/zh-TW/shortcuts.json",+ "kind": "text",+ "sha256": "10cd89bebd8a5088491f3cf38fda40b5af10733e7963c534e22b0eeb07e3ae71"+ },+ {+ "path": "src/i18n/locales/zh-TW/timeline.json",+ "kind": "text",+ "sha256": "d7bf482f2e0510e4e632518a75609170a246246c7ae48dc47affaf1cb80c3a2e"+ },+ {+ "path": "src/i18n/toastText.ts",+ "kind": "text",+ "sha256": "35b70ff518c6fd7a20e8184417ad8ce71b94292994ad9485629fa3cf03e7d17b"+ },+ {+ "path": "src/lib/ai-edition/annotationScale.ts",+ "kind": "text",+ "sha256": "36b6536951baa8a936ce606b1498026580d91752be8158823b0fe5a04a136fad"+ },+ {+ "path": "src/lib/ai-edition/annotations/background.ts",+ "kind": "text",+ "sha256": "3b19b5ec03accfe4078a03fbe051255ed01a3af4ea56793fea6201d88516f267"+ },+ {+ "path": "src/lib/ai-edition/annotations/textAnimation.ts",+ "kind": "text",+ "sha256": "8d15b21a5f05ebd78d7716a5d0e818719c47254f3eec2fb99f2269c677ec6692"+ },+ {+ "path": "src/lib/ai-edition/captions/cues.ts",+ "kind": "text",+ "sha256": "6a1046fb46c0df4a9ebeac2f550ec597bce5406ee8c78e8b9f1195ccbdb51b41"+ },+ {+ "path": "src/lib/ai-edition/captions/index.ts",+ "kind": "text",+ "sha256": "4972de7d6fa21a54ee144eb6a1d5e06d1424b670211ca8ae85e6730e588f5a74"+ },+ {+ "path": "src/lib/ai-edition/captions/settings.ts",+ "kind": "text",+ "sha256": "48213d9c82c00a251f06846306e13ebe780af66e960e055e10f45c580a7a2996"+ },+ {+ "path": "src/lib/ai-edition/captions/translations.ts",+ "kind": "text",+ "sha256": "9bf6473346d6d163e59eac48f87b14078bc371019c53cd66b8fae3c12ce69d8a"+ },+ {+ "path": "src/lib/ai-edition/document/audioTracks.ts",+ "kind": "text",+ "sha256": "ea206dde2aa538b068b87a6adcdb95a35f27dc24c6825d4f52b8f829bbe3f51e"+ },+ {+ "path": "src/lib/ai-edition/document/ids.ts",+ "kind": "text",+ "sha256": "d2d169fe312d131566fe5b43256c261f4518bb0ebb92033cf10abab756e6bfaf"+ },+ {+ "path": "src/lib/ai-edition/document/insertion.ts",+ "kind": "text",+ "sha256": "6e4cd0bd90a9e1f3eae94599925e698d441342a3cf0db93e511397b8c5b48d17"+ },+ {+ "path": "src/lib/ai-edition/document/insertionTrack.ts",+ "kind": "text",+ "sha256": "7105a95c3b810920bbfbbdb949f102e447fe80b218c8046c2837dfaddb3d7319"+ },+ {+ "path": "src/lib/ai-edition/document/migrate.ts",+ "kind": "text",+ "sha256": "5a43979c278f617d80858ba15649a5c15d6e24d7e7969656e52425650a4c4b90"+ },+ {+ "path": "src/lib/ai-edition/document/operations.ts",+ "kind": "text",+ "sha256": "3b6dc8baf7e44dcabc3f20acead0710b3c4c8802a4f811952ea83dcf68ebb415"+ },+ {+ "path": "src/lib/ai-edition/document/outputFormat.ts",+ "kind": "text",+ "sha256": "befa1509e635a01fe3e980dc6d9bb3fa97f3d82d351718d4b14fc29004c3f26b"+ },+ {+ "path": "src/lib/ai-edition/document/timeline.ts",+ "kind": "text",+ "sha256": "9c38797af014841ec3ee5bc2420e258b6317d40d1854de6657cb4a25ac1be531"+ },+ {+ "path": "src/lib/ai-edition/document/transcribe.ts",+ "kind": "text",+ "sha256": "d5db050911227b7c58c22a38c8d8e5b52382e9553f52372a9e25c04ef82cf13e"+ },+ {+ "path": "src/lib/ai-edition/document/transcript.ts",+ "kind": "text",+ "sha256": "77ba1e03bb148a8572e700f26e840ea9dadc916eeb317b1c19155b5c21a78445"+ },+ {+ "path": "src/lib/ai-edition/modalGuard.ts",+ "kind": "text",+ "sha256": "d3a774a9bacddd4f818419d65c0176056dfbe2a8a56dcd22f1c4355bb317090c"+ },+ {+ "path": "src/lib/ai-edition/perf/uiFrameProbe.ts",+ "kind": "text",+ "sha256": "e3f3cc5866b231fed52be18a51b480ea23ff677812850f01099784f0a4c9cfcf"+ },+ {+ "path": "src/lib/ai-edition/schema/index.ts",+ "kind": "text",+ "sha256": "f27292d4f243cc0980839fde63744064c6c60b09b1755483bc17b9070f43e8b6"+ },+ {+ "path": "src/lib/ai-edition/store/agentDocumentApply.ts",+ "kind": "text",+ "sha256": "c0445b1c4aae86b3252f54ca0eaf677571967b65b10a6f8cb194d4ceea9860f6"+ },+ {+ "path": "src/lib/ai-edition/store/editorSettings.ts",+ "kind": "text",+ "sha256": "cc23de2284b264934f4aa2956a18c4b959db20a77ebd360170e811f0f768b231"+ },+ {+ "path": "src/lib/ai-edition/store/projectStore.ts",+ "kind": "text",+ "sha256": "7b130b6fdd01907a6fe571818dcbe36b979174d3249caaf9902d704ad450bd58"+ },+ {+ "path": "src/lib/ai-edition/store/rafCoalesce.ts",+ "kind": "text",+ "sha256": "6b4329ef4e1aadbe4f02f6638c840a86e395b7f0f0cb391921ca7486c33e554a"+ },+ {+ "path": "src/lib/ai-edition/store/regionClipboard.ts",+ "kind": "text",+ "sha256": "a16e050e0cf1cfa7da9069375ece32d24d4e51a52f2bc543320508b46e0f4350"+ },+ {+ "path": "src/lib/ai-edition/store/transcriptionStore.ts",+ "kind": "text",+ "sha256": "c2681ac70f08c542cfce5b1cfa471de9f6c0e0b927e3c0d75e95271fb735e53e"+ },+ {+ "path": "src/lib/ai-edition/store/undo.ts",+ "kind": "text",+ "sha256": "e370484d829b1644bbe9d5ebd49cfc8dffbc40b9d41240d81763b025d70e27ae"+ },+ {+ "path": "src/lib/ai-edition/store/undoStack.ts",+ "kind": "text",+ "sha256": "e47b11920d844eda3d28f03f28e24a7bec182a3a0269d932fff84bcfecacf86a"+ },+ {+ "path": "src/lib/ai-edition/store/useCaptions.ts",+ "kind": "text",+ "sha256": "fcaeeb21298092c77d8453a0696498d4f64491c38be3c773e3d052030aaf1065"+ },+ {+ "path": "src/lib/ai-edition/store/useChatPromptBus.ts",+ "kind": "text",+ "sha256": "50cd7a7a17169e69c3b994d58dec75ce5c1d3bcac5721857c736e9eaf1c901ad"+ },+ {+ "path": "src/lib/ai-edition/store/useEditorSettings.ts",+ "kind": "text",+ "sha256": "94a2fc39fbcb8f577f0a26cea4a3a7558e1f48e2d94fdddf6e7c1a4763c2d3d4"+ },+ {+ "path": "src/lib/ai-edition/store/useSequentialTimelineOps.ts",+ "kind": "text",+ "sha256": "791caa0a1d8774890a584e00de393b8ab5093dafb651404921a183aeed8a04d3"+ },+ {+ "path": "src/lib/ai-edition/store/useTimeline.ts",+ "kind": "text",+ "sha256": "836cfdd9d6ae1a30aaaf06c57498cbc02a1fe1e0267363d5ce3c6856a1cf8468"+ },+ {+ "path": "src/lib/ai-edition/timeline/aggregated-transcript.ts",+ "kind": "text",+ "sha256": "814bb9e45f7cb7f149b0d8e510908499008e12035ba98328a0cba0dfeebd9314"+ },+ {+ "path": "src/lib/ai-edition/timeline/apply-auto-zooms.ts",+ "kind": "text",+ "sha256": "8edc49b457083f15828e0b49ba3d551490bc01d70830418602894ef127d54070"+ },+ {+ "path": "src/lib/ai-edition/timeline/camera.ts",+ "kind": "text",+ "sha256": "975320c48d098fea493bc56a25771f688b8fca7012f2477b59e217ed8fcfb2e2"+ },+ {+ "path": "src/lib/ai-edition/timeline/clip-parts.ts",+ "kind": "text",+ "sha256": "994b9b5576ecad29e6aa4e93a8c3193f8811ac38587e8ede4b929680f6cd48d6"+ },+ {+ "path": "src/lib/ai-edition/timeline/clipDuration.ts",+ "kind": "text",+ "sha256": "350960df80563bf81f12f492755fb1ce665e21d1aafe9c2bf23e6bf90a39dddd"+ },+ {+ "path": "src/lib/ai-edition/timeline/cursor-track.ts",+ "kind": "text",+ "sha256": "ce60967a780177c215b368a13233724541b46c71d6bd398314937f4a038b48e7"+ },+ {+ "path": "src/lib/ai-edition/timeline/duration.ts",+ "kind": "text",+ "sha256": "cba71febd77086c870a338140b1de9b7ff85cc2d4309045e6bd5f7f2369d5e66"+ },+ {+ "path": "src/lib/ai-edition/timeline/format.ts",+ "kind": "text",+ "sha256": "753b8b7784dc50877fdcbc1fcc824850f8f76146d0ab809b3e995d1f53ec80f1"+ },+ {+ "path": "src/lib/ai-edition/timeline/intervals.ts",+ "kind": "text",+ "sha256": "d63911e36874f8fe456c029b86a1c811714ff3320f26499c3fd3d0d82ba2e046"+ },+ {+ "path": "src/lib/ai-edition/timeline/newRegionDuration.ts",+ "kind": "text",+ "sha256": "28257f8ec009af02fb6543c12fed5db4f829627f0f753a5cbf6157c7cec3813e"+ },+ {+ "path": "src/lib/ai-edition/timeline/playback-clock.ts",+ "kind": "text",+ "sha256": "9ecfd33b35b9b7759ab3cc984b495589faeb87ee7b83addcd5b35ddecb5b604b"+ },+ {+ "path": "src/lib/ai-edition/timeline/pointer-drag.ts",+ "kind": "text",+ "sha256": "63c111dad56c4ef49a27f8fcba08139ec2c70a112e1a3ece28d4cb9dd5457b3d"+ },+ {+ "path": "src/lib/ai-edition/timeline/programme-time.ts",+ "kind": "text",+ "sha256": "02ae40b769f991997fda4015ad224429ced0e293ee0dee3b738b989b60243b48"+ },+ {+ "path": "src/lib/ai-edition/timeline/region-ventilation.ts",+ "kind": "text",+ "sha256": "06faa383f3fec4a9945100ca66ee7b264299653c76e90c4203a3decf4865ce1e"+ },+ {+ "path": "src/lib/ai-edition/timeline/speed.ts",+ "kind": "text",+ "sha256": "d50aaad0b51d7fecac113026d7b80d4a2e7727202fd883d5322ab99495e49c0b"+ },+ {+ "path": "src/lib/ai-edition/timeline/take-programme.ts",+ "kind": "text",+ "sha256": "84ab6513609d6f20566dc0decd6559e83a3e31d2ec1ba1c277c1881f40cc73c6"+ },+ {+ "path": "src/lib/ai-edition/timeline/timelineMap.ts",+ "kind": "text",+ "sha256": "e3f3c25d0a8a7e48e097258370bd933b6a2312d69d226c1edd3effd2c7d0504e"+ },+ {+ "path": "src/lib/ai-edition/timeline/trim-mapping.ts",+ "kind": "text",+ "sha256": "6b3538e4af506e264ddc0b652dc55248faa98b33a003bae93c21d25ac61309a5"+ },+ {+ "path": "src/lib/ai-edition/timeline/virtual-preview.ts",+ "kind": "text",+ "sha256": "b324c728cd6fe82a97a8103a3c3f8257bc2f6a57dd0bf32ac1b3081ce189a66b"+ },+ {+ "path": "src/lib/ai-edition/timeline/zoom-preview.ts",+ "kind": "text",+ "sha256": "597ab92d2f9dab12812adcdc0f34a01cca9bce604660b9e629a74f5c18393b4a"+ },+ {+ "path": "src/lib/ai-edition/timeline/zoom-scale.ts",+ "kind": "text",+ "sha256": "fd2d720c64519af0153eda00f699b60fada520b7d483ebb0aac8e034fa89efd4"+ },+ {+ "path": "src/lib/ai-edition/timeline/zoom-suggestions.ts",+ "kind": "text",+ "sha256": "ec83d18349aeb68d36d78b684c70666801eead348e791d537d26bc8d1a6c34dd"+ },+ {+ "path": "src/lib/ai-edition/transcription/languageLabels.ts",+ "kind": "text",+ "sha256": "c05d3647001fd5d36dd520695ecc3e5407c5216ff6e695a8d00d0c79cf92dc70"+ },+ {+ "path": "src/lib/ai-edition/transcription/status.ts",+ "kind": "text",+ "sha256": "dd50e086a9779395357a8a8a5d5c57777e3b40c51b1831ada4cb81f53dca0ac9"+ },+ {+ "path": "src/lib/annotationTextAnimation.ts",+ "kind": "text",+ "sha256": "ac429ab31fc88022f1b463d8c0567c77486ca7f66a00afbca441136f0583e714"+ },+ {+ "path": "src/lib/assetPath.ts",+ "kind": "text",+ "sha256": "1be849cdba590f622fe3e048d9f572f9e055ec1ac23f9b381b9192e90130db54"+ },+ {+ "path": "src/lib/audioMix.ts",+ "kind": "text",+ "sha256": "39e9f51f7491527e44e3287c041025c2fb12f5dc386a36485664df92fae24f96"+ },+ {+ "path": "src/lib/blurEffects.ts",+ "kind": "text",+ "sha256": "e3b6b9afab9a498a99f2644df9eb8a723b17745f337b71e3c62051698d1830e1"+ },+ {+ "path": "src/lib/captioning/annotationsFromCaptions.ts",+ "kind": "text",+ "sha256": "5bf04d26c991541171ea77ac5d22df80cf64e5f423d1e8bc7b64396acc8a27dd"+ },+ {+ "path": "src/lib/captioning/captionConstants.ts",+ "kind": "text",+ "sha256": "180f1433841b9e2a9920e0e073ae494f4f7e5f5d51ef48bbb6cbb0a6a5da4272"+ },+ {+ "path": "src/lib/captioning/extractMono16k.ts",+ "kind": "text",+ "sha256": "f9a27b191af59908129e67d3de04923f8914c99dd0adbc0218ea016912b0d011"+ },+ {+ "path": "src/lib/captioning/extractMono16kWebDemuxer.ts",+ "kind": "text",+ "sha256": "17ac07416afd4c9b717362e9b70e85ba1168bb05367487c5ec77c24971fbeb67"+ },+ {+ "path": "src/lib/captioning/index.ts",+ "kind": "text",+ "sha256": "1907094922d87673f2f252e9de61f0b0961ba1ddebf9d08059693b58b84cf6fa"+ },+ {+ "path": "src/lib/captioning/transcribe.ts",+ "kind": "text",+ "sha256": "0dfab3424d121b33453901fd7ee83e79adbd2fef6efa78eb346c9e1a93d2dd4d"+ },+ {+ "path": "src/lib/cliContracts.ts",+ "kind": "text",+ "sha256": "c4925b8fb5638506f57970dea3aef7d3bee76e9b484ed0a57b4d7b5989ed801a"+ },+ {+ "path": "src/lib/compositeLayout.ts",+ "kind": "text",+ "sha256": "433b297b4d3ced9d5888f7dcdfc56cd86059f5e02cd827f933c4f7c7ddf42627"+ },+ {+ "path": "src/lib/cursor/cursorCapabilities.ts",+ "kind": "text",+ "sha256": "262601abfd567705b2d634f2a12dc32bfd9cc8b861d1527fcd1734129a11232a"+ },+ {+ "path": "src/lib/cursor/cursorPathSmoothing.ts",+ "kind": "text",+ "sha256": "f9e5ca84f544113e47c5fbc4c2b5627de5ecc362b09a4d70fe725c5b56a547a8"+ },+ {+ "path": "src/lib/cursor/cursorThemes.ts",+ "kind": "text",+ "sha256": "d87486025706a11f9773bdc07fe858c04a54e1f2e7815d01323f31a377425d3b"+ },+ {+ "path": "src/lib/cursor/uploadedCursorAssets.ts",+ "kind": "text",+ "sha256": "aa2127e23df8fd9f112356fbedbf76718f5b59be5b469996ab24c7a8262fd434"+ },+ {+ "path": "src/lib/cursorTelemetryBuffer.ts",+ "kind": "text",+ "sha256": "6c6aa442ba473bc4a6ad2467bb8fbe150a19d7ffa77adfd198b81ca9ab4050a1"+ },+ {+ "path": "src/lib/customFonts.ts",+ "kind": "text",+ "sha256": "d11d7d40dfd89ab79c4a2323bfd759ffd01a53f76233d5ffec593ea792ceb1ba"+ },+ {+ "path": "src/lib/exporter/annotationRenderer.ts",+ "kind": "text",+ "sha256": "e23d47e929212e94fa18019558228066a9ec3c8436dd98b294331137d6e56901"+ },+ {+ "path": "src/lib/exporter/audioTimeStretch.ts",+ "kind": "text",+ "sha256": "23167fd3fbaac0738c2b19b65708d9deabd0a60ae68b75519b5b353e8cf522f0"+ },+ {+ "path": "src/lib/exporter/gradientParser.ts",+ "kind": "text",+ "sha256": "e9910a53cd4f5309604f6c31c4776080d28e12bfc691cb71f6fc93b58eedf4c2"+ },+ {+ "path": "src/lib/exporter/index.ts",+ "kind": "text",+ "sha256": "6783bdfd4caed992a514aad8db520d3e207653f36088a853ae9ed6bee0bfe120"+ },+ {+ "path": "src/lib/exporter/localSourceFile.ts",+ "kind": "text",+ "sha256": "29c051b78d0b64f2b0b631a0d42ef46a20cd623d36fa55c8b286aa3d1d39de86"+ },+ {+ "path": "src/lib/exporter/mp4ExportSettings.ts",+ "kind": "text",+ "sha256": "1ba57f6f71a237c7304542839d97d9e73012fc6e6a53d75b25d2dd903c7674ed"+ },+ {+ "path": "src/lib/exporter/outputFrameCount.ts",+ "kind": "text",+ "sha256": "ab5c74199a2a538765d63f179ddc46d2b73459ba694b0a1b26a005daf3b329b8"+ },+ {+ "path": "src/lib/exporter/sourceFileLimits.ts",+ "kind": "text",+ "sha256": "591be97e323d1eda2350ee9e3aff423db45e6da1f454d7518909241b924ed89a"+ },+ {+ "path": "src/lib/exporter/streamingDecoder.ts",+ "kind": "text",+ "sha256": "0e36f43cd67a8e937dfa1d337f178c7d6e6b34726859101cfd9c3ed55b5ffaba"+ },+ {+ "path": "src/lib/exporter/timelineSegments.ts",+ "kind": "text",+ "sha256": "017f332485ab6017058b1679348b0191c09134a3819f27a2403f92e8a08dbb81"+ },+ {+ "path": "src/lib/exporter/types.ts",+ "kind": "text",+ "sha256": "919aa1ec0776aa5f886f7d5b4a40578c41d04131e5f7812c8b51dc158cba248e"+ },+ {+ "path": "src/lib/exporter/voiceoverMix.ts",+ "kind": "text",+ "sha256": "4559ddaf219de2c3cb1f850ac5519489c178c3102e4f8f2d922cd723f345549e"+ },+ {+ "path": "src/lib/exporter/webcamFrameDrawing.ts",+ "kind": "text",+ "sha256": "45a2676cec7959d85d7b6f684ca14220603fec19863827d61a1c1ce50d5cd3b5"+ },+ {+ "path": "src/lib/frameStep.ts",+ "kind": "text",+ "sha256": "443e5459301625cb5c31b19afadc1740ac1cf16e138d8c829e4c5b0bd5accafd"+ },+ {+ "path": "src/lib/gradientBuilder.ts",+ "kind": "text",+ "sha256": "8e2a40a522648ee0081de0e38dd1a9e2f647a2126cff353c056743620112b9e2"+ },+ {+ "path": "src/lib/nativeLinuxRecording.ts",+ "kind": "text",+ "sha256": "cec186fb04189c9e03dc82ed5e9e0870bd46632112c77ac424ba003f1f7dda6f"+ },+ {+ "path": "src/lib/nativeMacRecording.ts",+ "kind": "text",+ "sha256": "7c6b7affaa7879a617a7dacf4639c2fc44ee009cf20415c542cd819dd3252e46"+ },+ {+ "path": "src/lib/nativeWindowsRecording.ts",+ "kind": "text",+ "sha256": "1e3b5c4a2f83b687511b3d398068af29d60e851b99043e063dd5ab552341d3bb"+ },+ {+ "path": "src/lib/projectDefaults.ts",+ "kind": "text",+ "sha256": "066d58ab53266f5805b9bb90df23eea2b6f2951d60099483fd1aca0727c0d299"+ },+ {+ "path": "src/lib/recordingSession.ts",+ "kind": "text",+ "sha256": "4f5c8ee0f1cf1b424d004e0842a153fad579c4ce826189e8a87872d08c3a443a"+ },+ {+ "path": "src/lib/requestCameraAccess.ts",+ "kind": "text",+ "sha256": "faa6a327345cad511a1b2e9d6c1902af86a5a70f2568c5d299c156daa79d204f"+ },+ {+ "path": "src/lib/shortcuts.ts",+ "kind": "text",+ "sha256": "77b845fdf9fb3e63c04ff7c3c7fa201a6467fdd73b85eb821c74373a86580c3b"+ },+ {+ "path": "src/lib/userPreferences.ts",+ "kind": "text",+ "sha256": "a7898ff8217e6f6f97518c3c0cd7c649c2775f5c79a40a1ee82b7550aa99f20d"+ },+ {+ "path": "src/lib/utils.ts",+ "kind": "text",+ "sha256": "0fca478853f3fc4310e40ebff727a53da7ec677938f4e3e0d5ecaa62e936a199"+ },+ {+ "path": "src/lib/wallpaper.ts",+ "kind": "text",+ "sha256": "83323fe74d661b4782853dcb05037a69575a43adb020da0ca6efa03e3cc9d5a5"+ },+ {+ "path": "src/lib/webcamMaskShapes.ts",+ "kind": "text",+ "sha256": "cd36904ef4396a2879b0cad46ad33b6f445edc8ea56f4f03bd71482b54dae002"+ },+ {+ "path": "src/lib/zoomMath/cameraFullscreenUtils.ts",+ "kind": "text",+ "sha256": "29b811471123ef9cc3ce3b732b1d54ac5afa3e55852345d43eecea6b568b398c"+ },+ {+ "path": "src/lib/zoomMath/constants.ts",+ "kind": "text",+ "sha256": "3ebf7d39f5a596f6c97653db86f3b837d3e4d17e29acd96fbad4a3056e93ddfa"+ },+ {+ "path": "src/lib/zoomMath/cursorFollowUtils.ts",+ "kind": "text",+ "sha256": "ef7f910a4097c835c95aa6c80138ffe4219c6fbb033d53fbd9cbaa02ac79ac9f"+ },+ {+ "path": "src/lib/zoomMath/focusUtils.ts",+ "kind": "text",+ "sha256": "dce842ba0d5edfe586b1a7892d5bf99e73d029b8d59f7366aed0c313531975ed"+ },+ {+ "path": "src/lib/zoomMath/mathUtils.ts",+ "kind": "text",+ "sha256": "5dace5bbe22b054d994569f80cf70a5b1a704a0c40c22f5aae3cfa995ff1ba2f"+ },+ {+ "path": "src/lib/zoomMath/motionSmoothing.ts",+ "kind": "text",+ "sha256": "fa09bf834bad27f2d8d2d8d348d0ace74c453bd1b78d226111b68a57ef233364"+ },+ {+ "path": "src/lib/zoomMath/zoomRegionUtils.ts",+ "kind": "text",+ "sha256": "5b070e4102ce8497ad9b8adc3bfa538518218937a2b1c86263858096048e3ec8"+ },+ {+ "path": "src/lib/zoomMath/zoomSpring.ts",+ "kind": "text",+ "sha256": "c757cb7416ebfb4b3659e2b1c802a7092e8d7bb050eac35659520ba0772daf39"+ },+ {+ "path": "src/lib/zoomMath/zoomTransform.ts",+ "kind": "text",+ "sha256": "071b2e4c5405817499bbbfc1384add398c9a944a9188de19accd9afdbe09a6fd"+ },+ {+ "path": "src/main.tsx",+ "kind": "text",+ "sha256": "b0f6e49f840046e21869123745ebec82816dd6e9407789f459e42305c97b4e77"+ },+ {+ "path": "src/native/browserShim.ts",+ "kind": "text",+ "sha256": "f48a3defdd84feee313834ceb79783563a359e49cb555a46485c407823853e46"+ },+ {+ "path": "src/native/client.ts",+ "kind": "text",+ "sha256": "4afe59b68ee91bbb914e8cd13b7bee703023409b4300db94e3a527233017fda3"+ },+ {+ "path": "src/native/compositorViewClient.ts",+ "kind": "text",+ "sha256": "e7cbb8012f6bdea907f59356f16efc247d9e2d338a480df74ff7f94ee8e0d91f"+ },+ {+ "path": "src/native/contracts.ts",+ "kind": "text",+ "sha256": "69ae495064f73a6a98bbcde29d32462aef7bad46ae3570cf895cef55a1488264"+ },+ {+ "path": "src/native/hooks/useCompositorBackend.ts",+ "kind": "text",+ "sha256": "9e15e1da41459f511875f9d0dc2fade1d838722f6d76267baf4f968eb840da79"+ },+ {+ "path": "src/native/hooks/useCursorRecordingData.ts",+ "kind": "text",+ "sha256": "1f3b070b4f8f1d64deace585499fd12477ef8731d74a4d988da69b5f1195e942"+ },+ {+ "path": "src/native/hooks/useCursorTelemetry.ts",+ "kind": "text",+ "sha256": "82ea0afed9c1a21ae21f043113e25b239db107d4798004a38469f6b3495a1daa"+ },+ {+ "path": "src/native/hooks/useNativeCompositorView.ts",+ "kind": "text",+ "sha256": "fbc90df9ee8680f1377657eca4a6a1cd2f034f994175c20d6428c9d8b711c32e"+ },+ {+ "path": "src/native/hooks/useSegmentationSupport.ts",+ "kind": "text",+ "sha256": "90fee811017622ddf5f29855065553f5bc7de55b60d08835a2b0c6417a64930c"+ },+ {+ "path": "src/native/index.ts",+ "kind": "text",+ "sha256": "62c372784f3ee6a9a1559cf2dc8077933276d75d026b1e57fb3f7454f75f47cd"+ },+ {+ "path": "src/native/nativeCompositorStore.ts",+ "kind": "text",+ "sha256": "67ac8a0989b6f63326e4d28c1799a4e148190f9bcdba4d2cb6b93478a9f6c370"+ },+ {+ "path": "src/native/nativeViewRect.ts",+ "kind": "text",+ "sha256": "47e133f73f1a7023a20f60386f013f648bd5b0eeccca1d40f9c60b7fb78288c0"+ },+ {+ "path": "src/native/paramUnits.ts",+ "kind": "text",+ "sha256": "a50c60dd2f977c81a0b9f57d486a961ef17f27c305362010e20a938da9768de6"+ },+ {+ "path": "src/native/sceneDescription.ts",+ "kind": "text",+ "sha256": "f77a0ecf4ea17cbe645592adc0eaaa40b093a3081b9d0b66acdbff471dc6a525"+ },+ {+ "path": "src/native/useNativePlaybackSync.ts",+ "kind": "text",+ "sha256": "fb54c487b9ecfcbc95d7594c371066b9468f41e34b6ee908270301f4b4b44ca9"+ },+ {+ "path": "src/native/webcamSizeCache.ts",+ "kind": "text",+ "sha256": "400b156ee836ef134dddd4b3fe4404d1d983e618dc57f0fda9290cc8d7a99783"+ },+ {+ "path": "src/utils/aspectRatioUtils.ts",+ "kind": "text",+ "sha256": "e8a4d930af86ada7f6809bb3f2506bb50b48832dd1aa15c311bdfa97bfabfca3"+ },+ {+ "path": "src/utils/formatBytes.ts",+ "kind": "text",+ "sha256": "423ed7a893380dd8a85c1783c19b8e98a3f4275d688de16dd507cef25b924849"+ },+ {+ "path": "src/utils/math.ts",+ "kind": "text",+ "sha256": "ba7ef6c9baec6739d10ccf947b03e1b5ef58864d4168105aed0029fb8b6d12bc"+ },+ {+ "path": "src/utils/platformUtils.ts",+ "kind": "text",+ "sha256": "8c7dc6249c5fa9a011c2d7f3d1a7174314602f30ad2bd32352b5c2be29f9dfa9"+ },+ {+ "path": "src/utils/timeUtils.ts",+ "kind": "text",+ "sha256": "83b353c3a23ccf301390eecfa59228731995cf40f41287906844877a7bbcd463"+ },+ {+ "path": "src/vite-env.d.ts",+ "kind": "text",+ "sha256": "e3454c001bff025a643b4fac69e3dfb794335d8afadb8b49bc41c8b01430c01e"+ },+ {+ "path": "tsconfig.json",+ "kind": "text",+ "sha256": "0f17f79f9cb5738749847e89b6e908b8029406336b9920e5f2466d0d4a2a7704"+ },+ {+ "path": "tsconfig.node.json",+ "kind": "text",+ "sha256": "86a900da1d23b0bcbffcdd8c385f299138e2c68a892078fcba6e772961170ded"+ },+ {+ "path": "tsconfig.workbench.json",+ "kind": "text",+ "sha256": "585cb72d9e6adea062104c1f20b0106cfc0b6f0a61f52203ba52aab3640ae127"+ },+ {+ "path": "vitest.workbench.config.ts",+ "kind": "text",+ "sha256": "d8a3bc3172b4eda97ce08d99f55bf78babdbfc27dc31a4ab1ff6d8c06314c880"+ },+ {+ "path": "workbench/cli-entry.ts",+ "kind": "text",+ "sha256": "0f75f9f07a34f68647fc246e294a319c12d23b820756f819a42fbfbcae249902"+ },+ {+ "path": "workbench/cli.ts",+ "kind": "text",+ "sha256": "bd20b353a0eb93dc2d27eedffd61e4bc7213c698dc3e72c3eae170c702f6c4c6"+ },+ {+ "path": "workbench/lib/baseline.ts",+ "kind": "text",+ "sha256": "74dde9dc8d0306c3e03d12845aebbd35290f218c4266693537aaea8251dd4bed"+ },+ {+ "path": "workbench/lib/cassette.ts",+ "kind": "text",+ "sha256": "b409eb78e747365ccc799751754db257038fd8d583c6ed8b22df123d1de5e1e6"+ },+ {+ "path": "workbench/lib/editorial.ts",+ "kind": "text",+ "sha256": "f4931690bc4f063c8094c9d20acdfceec36320704f2bf97cf45e560a9d3a25d2"+ },+ {+ "path": "workbench/lib/env.ts",+ "kind": "text",+ "sha256": "4b38b9a46bacbcde394dfd8aa0e05b5fa67df55358d740489e664ed850082358"+ },+ {+ "path": "workbench/lib/fixtures.ts",+ "kind": "text",+ "sha256": "01521fc56c944ffc28a9f506f5e2cd8ced3fe1645215cd53c38eb6b292fd3cd6"+ },+ {+ "path": "workbench/lib/harness.ts",+ "kind": "text",+ "sha256": "bc5a185e16ca58534131372fa0a42fa5b9d2c33b1c06e925adc279b7373e8533"+ },+ {+ "path": "workbench/lib/judge.ts",+ "kind": "text",+ "sha256": "0d63db3dc2611803ce37ecad4ace86a5ee17ee5807ffd6a31fb07542ae545acd"+ },+ {+ "path": "workbench/lib/language.ts",+ "kind": "text",+ "sha256": "1985d7a63b7956cdee597551268e0f3a01131933da6432f5a2a5a701885d80ea"+ },+ {+ "path": "workbench/lib/measurement.ts",+ "kind": "text",+ "sha256": "fd76f40bbd7895ffbc5f7412b35ba1ddbb1c5836aad7f8e05677be8d5d605fe3"+ },+ {+ "path": "workbench/lib/model-server.ts",+ "kind": "text",+ "sha256": "f2fa8895684b8ca4d8020b1d603a846daf19eba3c9ffc89ac17d89ee5d6b2e56"+ },+ {+ "path": "workbench/lib/oracles.ts",+ "kind": "text",+ "sha256": "3a639d472b3646f94a99fa5d0e8bc232dbbac18857721b786e604de9af392605"+ },+ {+ "path": "workbench/lib/persist.ts",+ "kind": "text",+ "sha256": "e3225c859c737aac9d53bc36864bf3fd137de720b175bb5ccaa43515e9a9749d"+ },+ {+ "path": "workbench/lib/prompts.ts",+ "kind": "text",+ "sha256": "cca0be7c01b9d708ec7c0835cd40bdd4b363f0d5e7d183552926c27bff63647a"+ },+ {+ "path": "workbench/lib/provenance.ts",+ "kind": "text",+ "sha256": "1d11f683024c233757758875a51593a04dd1c9dc6043e9c14b33927e663e888d"+ },+ {+ "path": "workbench/lib/quality.ts",+ "kind": "text",+ "sha256": "5418d6deb230e4e3a12475b991356e21d5b3835f30f9d684598f19f45d5da2a1"+ },+ {+ "path": "workbench/lib/real-fixture.ts",+ "kind": "text",+ "sha256": "e9e2187d84d8a1efc0ab3a6389247c4e64c98709be0a106952adc92ecddd9998"+ },+ {+ "path": "workbench/lib/report.ts",+ "kind": "text",+ "sha256": "f6134749ccdb7401675d863e88c2f1fde695b8d5756f2e0e432906c30e8e472c"+ },+ {+ "path": "workbench/lib/rubrics.ts",+ "kind": "text",+ "sha256": "12cc58b5bc4efae8efe85cf635b53028f91582c2976b8deb210cc6c36783c7fc"+ },+ {+ "path": "workbench/lib/runner.ts",+ "kind": "text",+ "sha256": "13905649f16625b528191f5958a88b19921957df3c92fc90576dbbdd0bc901d1"+ },+ {+ "path": "workbench/lib/scenario.ts",+ "kind": "text",+ "sha256": "dc11f4bdf1fda4067b86da7f6ace07722193bce51ab5b8eff28dfda49d2eed35"+ },+ {+ "path": "workbench/lib/score.ts",+ "kind": "text",+ "sha256": "660f1d12a4f50947fb9f3adf7b3b8a598a07094b5405b573ce3c1d09138db4a1"+ },+ {+ "path": "workbench/lib/spans.ts",+ "kind": "text",+ "sha256": "a171117d78bd535b2674d82780664c1ff3771b8351e7b2f38947dc3b2c62a872"+ },+ {+ "path": "workbench/lib/stats.ts",+ "kind": "text",+ "sha256": "bb52933d464894c763ddb99c27ebe2fa6e6e0a2e19831302a2fa6448b0932ade"+ },+ {+ "path": "workbench/lib/transcript.ts",+ "kind": "text",+ "sha256": "43f40845bec30301dac5d877ab8c9d7d42832aa6a059c05f364aeed8ca1851fe"+ },+ {+ "path": "workbench/lib/wire.ts",+ "kind": "text",+ "sha256": "9043d74e87f61cf173096758f7627db2167787c6f38184436222b8a3d28e350d"+ },+ {+ "path": "workbench/measurement-cli.ts",+ "kind": "text",+ "sha256": "96807c2029dc7b4ac8f5273181f5db7200140790aa337ba9564fa82168c44593"+ },+ {+ "path": "workbench/measurement-entry.ts",+ "kind": "text",+ "sha256": "ab5cde9dbea0d908ac69f6dfcee7c7e83e7728eda7e865b9e1e1b9f1bef3b29a"+ },+ {+ "path": "workbench/scenarios/camera-track.scn.ts",+ "kind": "text",+ "sha256": "cac2a1a7c5ef0dfd3f1a3deee31922dfdfccd5a1b361e3cd79ea11f51dd52b59"+ },+ {+ "path": "workbench/scenarios/consent.scn.ts",+ "kind": "text",+ "sha256": "140c1672a3b18c3724b68855a61b26644f378dbc1110446b8486ce697e547c11"+ },+ {+ "path": "workbench/scenarios/cursor-question.scn.ts",+ "kind": "text",+ "sha256": "6ed1f9f2a9cb96b8480ed2c7f381590d5c22fff7244ce6427f838958b15e452a"+ },+ {+ "path": "workbench/scenarios/cut-silences-clean.scn.ts",+ "kind": "text",+ "sha256": "37e966d25fa1eff8de366314f58988532ee2cb551c36ad812a67f8fe3cd9ff84"+ },+ {+ "path": "workbench/scenarios/describe-project.scn.ts",+ "kind": "text",+ "sha256": "72b0bfd4fd15f8e0b58cbef1d70a7223f0706e51cacc52c1de702d8d1b4d3aa1"+ },+ {+ "path": "workbench/scenarios/describe-zooms.scn.ts",+ "kind": "text",+ "sha256": "806cf7c9084433278897b1278546c77a60b681f3ca29794220f89f8a92ee6558"+ },+ {+ "path": "workbench/scenarios/no-invented-bounds.scn.ts",+ "kind": "text",+ "sha256": "41a8296a270192d61e93c01ec25f065b2411b12100349f49e14d73a1d1f58b3b"+ },+ {+ "path": "workbench/scenarios/out-of-scope-styling.scn.ts",+ "kind": "text",+ "sha256": "7a192cbddfebbe96dc82a2524930c3c25e4d0b26fe66e72369fee7ab9cd5fa87"+ },+ {+ "path": "workbench/scenarios/real-screencast.scn.ts",+ "kind": "text",+ "sha256": "18a099304cbdb9352512b0bc67b317231472b69755b97f236d09b6b4a25a7569"+ },+ {+ "path": "workbench/scenarios/registry.ts",+ "kind": "text",+ "sha256": "3a5f7d012929dc27f515d53f3fd6ee2e96764d6d696b62f67f50f57cbe959087"+ },+ {+ "path": "workbench/scenarios/remove-one-modifier.scn.ts",+ "kind": "text",+ "sha256": "e682f6041bc0cbfeca5f3e377dfd632ef8072bb5045c1b8cad5e25616fed63cd"+ },+ {+ "path": "workbench/scenarios/reorder-clips.scn.ts",+ "kind": "text",+ "sha256": "1312e2e92e68f5dae36ef09c5f29bc7c99956b65f48dff85aada096e3448af8b"+ },+ {+ "path": "workbench/scenarios/target-right-clip.scn.ts",+ "kind": "text",+ "sha256": "312c44e434f6fce56a6f25398aa3cdce6101e58317de991feb11678e2d461f7b"+ },+ {+ "path": "workbench/scenarios/wizard-enhance-bare.scn.ts",+ "kind": "text",+ "sha256": "cfb6a93b3134a55bd8bd6495761a0681fb454a6536cafd8aeab2c0db2c5ab803"+ },+ {+ "path": "workbench/scenarios/wizard-enhance.scn.ts",+ "kind": "text",+ "sha256": "ee33a1a636e830cf7d1c7293e4455709929692cd2b367001d92f8d7b84872225"+ }+ ],+ "effectiveSha256": "0c7b1a208ccde2a36caabd507864a38acfc7ecae6c44043e613d409d7607b060"+ },+ "input": {+ "fixtureSha256": "bfe5c60e22e280cbba6874dc8039cb91166b3684eeac6bd5b33485c279d91cbc",+ "documentSha256": "346ce20607134919f2f18318a7ee5b95c68a0130cce8b3bde101aed1db835fa8",+ "telemetrySha256": "74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b"+ },+ "fingerprints": {+ "promptSha256": "a4bb84c05a8ee6e9b2552984000eea6085a7290fce248eb3f12015943a797013",+ "systemSha256": "796759e35e0d75b547ad4c6318e995bf543e88dfa68e5571c7b43d914a90b93a",+ "toolsSha256": "314045e9f558c1cb8ff33550e3677a3849bf3335f761fc4a09a3bf6ef7a12475",+ "wireSha256": "5e3ed1fa675a3d76c252a4c529636a3dd5909877af2b24ff5870e0651775c167",+ "rubricSha256": "e537991d30f2f37617318b1347ede5571ec6ae7d2f5cbfe511a87ad0e845982c"+ },+ "models": {+ "agent": {+ "requested": "workbench-loopback-fixture",+ "observed": "workbench"+ },+ "judge": {+ "requested": "none",+ "observed": "none"+ }+ },+ "provider": {+ "provider": "openai-compatible",+ "endpointSha256": "bc39482d446399731f211518dff0b53a8db2bcffbd9d43943d1b9d3de068d50d"+ },+ "artifacts": [+ {+ "role": "input-fixture",+ "path": "input-fixture.json",+ "sha256": "bfe5c60e22e280cbba6874dc8039cb91166b3684eeac6bd5b33485c279d91cbc"+ },+ {+ "role": "main-cassette",+ "path": "main-cassette-rep-0.json",+ "sha256": "d7140529f68cbcc91a5aa1217f884da2a780c8fa5e1c0e72e2ed3d8a1291ff8d"+ },+ {+ "role": "recorded-checks",+ "path": "recorded-checks.json",+ "sha256": "c3301cf1446ec985d52a4ab9c9f6cf1ac9e1b020c3d50317ce9abdfc658326d2"+ },+ {+ "role": "report",+ "path": "measurement-report.json",+ "sha256": "6ac6d6e660862e10f11a53d66f090f7cd3b83d4a98b44b3b1ab1ec0f0aa8073b"+ },+ {+ "role": "review-receipt",+ "path": "review.json",+ "sha256": "11a8b547ec55f6a56b770263145e281f701644fd1ad9d2fb42f145d9305be906"+ }+ ],+ "results": {+ "repetitions": 1,+ "axes": {+ "behaviour": {+ "passed": 2,+ "decided": 2,+ "indeterminate": 0,+ "total": 2+ },+ "dsl": {+ "passed": 9,+ "decided": 9,+ "indeterminate": 0,+ "total": 9+ }+ },+ "axisScores": {+ "behaviour": 1,+ "dsl": 1+ },+ "checks": [+ {+ "id": "beh.grounding",+ "axis": "behaviour",+ "weight": 3,+ "passed": 1,+ "decided": 1,+ "indeterminate": 0,+ "total": 1+ },+ {+ "id": "beh.no-fabrication",+ "axis": "behaviour",+ "weight": 2,+ "passed": 1,+ "decided": 1,+ "indeterminate": 0,+ "total": 1+ },+ {+ "id": "dsl.bounds.in-clip",+ "axis": "dsl",+ "weight": 3,+ "passed": 1,+ "decided": 1,+ "indeterminate": 0,+ "total": 1+ },+ {+ "id": "dsl.bounds.playable",+ "axis": "dsl",+ "weight": 2,+ "passed": 1,+ "decided": 1,+ "indeterminate": 0,+ "total": 1+ },+ {+ "id": "dsl.effect.honest",+ "axis": "dsl",+ "weight": 2,+ "passed": 1,+ "decided": 1,+ "indeterminate": 0,+ "total": 1+ },+ {+ "id": "dsl.single-zoom",+ "axis": "dsl",+ "weight": 2,+ "passed": 1,+ "decided": 1,+ "indeterminate": 0,+ "total": 1+ },+ {+ "id": "dsl.target.correct-clip",+ "axis": "dsl",+ "weight": 4,+ "passed": 1,+ "decided": 1,+ "indeterminate": 0,+ "total": 1+ },+ {+ "id": "dsl.timeline.untouched",+ "axis": "dsl",+ "weight": 2,+ "passed": 1,+ "decided": 1,+ "indeterminate": 0,+ "total": 1+ },+ {+ "id": "dsl.turn.completed",+ "axis": "dsl",+ "weight": 2,+ "passed": 1,+ "decided": 1,+ "indeterminate": 0,+ "total": 1+ },+ {+ "id": "struct.invariants",+ "axis": "dsl",+ "weight": 3,+ "passed": 1,+ "decided": 1,+ "indeterminate": 0,+ "total": 1+ },+ {+ "id": "struct.schema-valid",+ "axis": "dsl",+ "weight": 3,+ "passed": 1,+ "decided": 1,+ "indeterminate": 0,+ "total": 1+ }+ ]+ },+ "review": {+ "disposition": "approved",+ "reviewerKind": "independent"+ }+}diff --git a/workbench/measurements/local-integrated-control-20260912-v4/recorded-checks.json b/workbench/measurements/local-integrated-control-20260912-v4/recorded-checks.jsonnew file mode 100644index 000000000..f3100230a--- /dev/null+++ b/workbench/measurements/local-integrated-control-20260912-v4/recorded-checks.json@@ -0,0 +1,89 @@+{+ "schema": 1,+ "scenarioId": "target-right-clip",+ "complete": true,+ "repetitions": [+ {+ "rep": 0,+ "checks": [+ {+ "id": "beh.grounding",+ "axis": "behaviour",+ "weight": 3,+ "ok": true,+ "indeterminate": false+ },+ {+ "id": "beh.no-fabrication",+ "axis": "behaviour",+ "weight": 2,+ "ok": true,+ "indeterminate": false+ },+ {+ "id": "dsl.target.correct-clip",+ "axis": "dsl",+ "weight": 4,+ "ok": true,+ "indeterminate": false+ },+ {+ "id": "dsl.bounds.in-clip",+ "axis": "dsl",+ "weight": 3,+ "ok": true,+ "indeterminate": false+ },+ {+ "id": "dsl.single-zoom",+ "axis": "dsl",+ "weight": 2,+ "ok": true,+ "indeterminate": false+ },+ {+ "id": "dsl.bounds.playable",+ "axis": "dsl",+ "weight": 2,+ "ok": true,+ "indeterminate": false+ },+ {+ "id": "dsl.effect.honest",+ "axis": "dsl",+ "weight": 2,+ "ok": true,+ "indeterminate": false+ },+ {+ "id": "dsl.timeline.untouched",+ "axis": "dsl",+ "weight": 2,+ "ok": true,+ "indeterminate": false+ },+ {+ "id": "dsl.turn.completed",+ "axis": "dsl",+ "weight": 2,+ "ok": true,+ "indeterminate": false+ },+ {+ "id": "struct.schema-valid",+ "axis": "dsl",+ "weight": 3,+ "ok": true,+ "indeterminate": false+ },+ {+ "id": "struct.invariants",+ "axis": "dsl",+ "weight": 3,+ "ok": true,+ "indeterminate": false+ }+ ]+ }+ ]+}diff --git a/workbench/measurements/local-integrated-control-20260912-v4/review.json b/workbench/measurements/local-integrated-control-20260912-v4/review.jsonnew file mode 100644index 000000000..ef7c36776--- /dev/null+++ b/workbench/measurements/local-integrated-control-20260912-v4/review.json@@ -0,0 +1,8 @@+{+ "schema": 1,+ "measurementId": "local-integrated-control-20260912-v4",+ "reviewer": { "kind": "independent", "label": "measurement_artifact_review" },+ "disposition": "approved",+ "reviewedAt": "2026-09-12T10:57:38.9279290Z",+ "summary": "Approved candidate SHA256 AE1B24E86E3B181E8BB803567980DCD4C1BAB1E78443CDD7B2F9488CD1191296 for adoption as local-integrated-control-20260912-v4 solely as an offline local scripted workflow control for the combined integration source. This approval does not establish provider or model quality, reproduce the unavailable original fixture, approve an original-real baseline, establish full issue acceptance, or authorize publication or paid calls."+}