{"version":3,"file":"worker-verification.d.ts","sourceRoot":"","sources":["../../../src/core/worker-daemon/worker-verification.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,KAAK,EAA8B,sBAAsB,EAAE,MAAM,+CAA+C,CAAC;AAKxH;;;;GAIG;AACH,wBAAgB,+BAA+B,CAC9C,OAAO,EAAE,cAAc,EACvB,OAAO,GAAE;IAAE,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAAO,GACzC,sBAAsB,GAAG,SAAS,CAwCpC","sourcesContent":["/**\n * Worker Verification Bridge (2.13.0).\n *\n * Maps a durable mission's declared acceptance criteria (each optionally\n * carrying a deterministic `VerificationSpec`) into a `ProcessMissionVerifier`\n * that the Worker can hand to the existing execution path. A clean exit-0 child\n * is only promoted from PARTIAL (unverified) to SUCCEEDED when every declared\n * verification spec passes deterministically; a model's self-reported success is\n * never the authority.\n *\n * This is deliberately a thin bridge: the Reliability Kernel's\n * `verify()` + `createWorkspaceVerificationExecutor()` remain the verification\n * authority; `ProcessMissionExecutor` remains the promotion authority. The\n * worker only composes them.\n */\n\nimport type { MissionRequest } from \"../mission-domain/mission-request.js\";\nimport type { ProcessMissionVerification, ProcessMissionVerifier } from \"../mission-domain/process-mission-executor.js\";\nimport type { VerificationSpec } from \"../reliability/types.js\";\nimport { verify } from \"../reliability/verifier.js\";\nimport { createWorkspaceVerificationExecutor } from \"../reliability/workspace-verification.js\";\n\n/**\n * Build a verifier for a mission whose acceptance criteria carry deterministic\n * verification specs. Returns `undefined` when the mission declares no\n * verifiable criteria (so a bare exit-0 remains PARTIAL, never SUCCEEDED).\n */\nexport function buildAcceptanceCriteriaVerifier(\n\trequest: MissionRequest,\n\toptions: { commandTimeoutMs?: number } = {},\n): ProcessMissionVerifier | undefined {\n\tconst specs: { criterionId: string; spec: VerificationSpec }[] = [];\n\tfor (const criterion of request.acceptanceCriteria) {\n\t\tif (criterion.verification) {\n\t\t\tspecs.push({ criterionId: criterion.id, spec: criterion.verification });\n\t\t}\n\t}\n\tif (specs.length === 0) return undefined;\n\n\tconst cwd = request.workspaceScope?.cwd ?? process.cwd();\n\tconst executor = createWorkspaceVerificationExecutor({\n\t\tcwd,\n\t\tcommandTimeoutMs: options.commandTimeoutMs,\n\t});\n\n\treturn async (input): Promise<ProcessMissionVerification> => {\n\t\t// Only a clean, normal exit-0 execution can be promoted. Verification of a\n\t\t// crashed/failed execution is not attempted (nothing to verify).\n\t\tif (input.outcome.exitCode !== 0 || input.outcome.launchError || input.outcome.timedOut) {\n\t\t\treturn { verified: false, summary: \"execution did not complete normally\" };\n\t\t}\n\n\t\tconst results = [];\n\t\tfor (const { criterionId, spec } of specs) {\n\t\t\tconst result = await verify(spec, executor, { criterionId, cwd });\n\t\t\tresults.push(result);\n\t\t}\n\n\t\tconst failed = results.filter((result) => !result.passed);\n\t\tconst verified = failed.length === 0;\n\t\treturn {\n\t\t\tverified,\n\t\t\tcriterionIds: results.map((result) => result.criterionId ?? result.kind),\n\t\t\tsummary: verified\n\t\t\t\t? `${results.length} verification spec(s) passed`\n\t\t\t\t: `${failed.length} verification spec(s) failed: ${failed\n\t\t\t\t\t\t.map((result) => result.evidence.summary)\n\t\t\t\t\t\t.join(\"; \")}`,\n\t\t};\n\t};\n}\n"]}