omk-adaptorch-wpl 0.98.2 → 0.98.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +95 -0
- package/README.md +18 -0
- package/dist/b2c-mapper.d.ts.map +1 -1
- package/dist/b2c-mapper.js +1 -1
- package/dist/b2c-mapper.js.map +1 -1
- package/dist/deep-wall.d.ts.map +1 -1
- package/dist/deep-wall.js +8 -7
- package/dist/deep-wall.js.map +1 -1
- package/dist/evaluate-correctness-wall.d.ts.map +1 -1
- package/dist/evaluate-correctness-wall.js +2 -1
- package/dist/evaluate-correctness-wall.js.map +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/proof-projection.d.ts +69 -0
- package/dist/proof-projection.d.ts.map +1 -0
- package/dist/proof-projection.js +90 -0
- package/dist/proof-projection.js.map +1 -0
- package/dist/service-links.d.ts +11 -0
- package/dist/service-links.d.ts.map +1 -0
- package/dist/service-links.js +25 -0
- package/dist/service-links.js.map +1 -0
- package/dist/vera-vocabulary.d.ts +35 -0
- package/dist/vera-vocabulary.d.ts.map +1 -0
- package/dist/vera-vocabulary.js +54 -0
- package/dist/vera-vocabulary.js.map +1 -0
- package/package.json +4 -3
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [Unreleased]
|
|
4
|
+
|
|
5
|
+
## [0.98.4] - 2026-09-10
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Added side-effect-free service-link helpers for explicit onboarding surfaces.
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- Submission now requires apply eligibility, a non-preview run, run IDs and confirmed adjudication. Deep-wall evidence requires nonempty digest/command and exit code zero; deep checks cannot clear a pre-existing human-review requirement.
|
|
14
|
+
|
|
15
|
+
## [0.98.3] - 2026-09-06
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
|
|
19
|
+
- Added readonly VERA vocabulary guards and pure `projectProofClosure()`, `projectProofEvaluationFailure()` and `admitVeraOutcome()` projections. Candidate failure, environment uncertainty, missing evidence and open effects stay distinct. A projected `SHIP` is not release authorization; no remote service is called automatically.
|
|
20
|
+
|
|
21
|
+
## [0.98.2] - 2026-09-02
|
|
22
|
+
|
|
23
|
+
## [0.98.1] - 2026-08-30
|
|
24
|
+
|
|
25
|
+
## [0.98.0] - 2026-08-28
|
|
26
|
+
|
|
27
|
+
## [0.97.0] - 2026-08-24
|
|
28
|
+
|
|
29
|
+
## [0.96.2] - 2026-08-21
|
|
30
|
+
|
|
31
|
+
### Fixed
|
|
32
|
+
|
|
33
|
+
- Updated the topology client to read and validate AdaptOrch's current `topology` response field and six supported topology values. Malformed or obsolete responses now fail closed before approval comparisons.
|
|
34
|
+
|
|
35
|
+
## [0.96.1] - 2026-08-20
|
|
36
|
+
|
|
37
|
+
### Notes
|
|
38
|
+
|
|
39
|
+
- Version lockstep with `open-multi-agent-kit@0.96.1`; no functional changes in this package.
|
|
40
|
+
|
|
41
|
+
## [0.96.0] - 2026-08-16
|
|
42
|
+
|
|
43
|
+
## [0.95.2] - 2026-08-15
|
|
44
|
+
|
|
45
|
+
## [0.95.1] - 2026-08-01
|
|
46
|
+
|
|
47
|
+
## [0.95.0] - 2026-07-31
|
|
48
|
+
|
|
49
|
+
## [0.94.1] - 2026-07-27
|
|
50
|
+
|
|
51
|
+
## [0.94.0] - 2026-07-27
|
|
52
|
+
|
|
53
|
+
## [0.93.0] - 2026-07-26
|
|
54
|
+
|
|
55
|
+
## [0.92.0] - 2026-07-23
|
|
56
|
+
|
|
57
|
+
## [0.91.0] - 2026-07-21
|
|
58
|
+
|
|
59
|
+
### Changed
|
|
60
|
+
|
|
61
|
+
- Promoted from experimental design-stage to stable and wired as a runtime dependency of `open-multi-agent-kit` (lockstep `0.91.0`). The package now ships the Work Packet Loop state machine, outcome adjudicator, B2C correctness-wall mapping, deep verification wall, and receipt signing as part of the CLI distribution.
|
|
62
|
+
|
|
63
|
+
## [0.90.8] - 2026-07-13
|
|
64
|
+
|
|
65
|
+
## [0.90.7] - 2026-07-11
|
|
66
|
+
|
|
67
|
+
### Fixed
|
|
68
|
+
|
|
69
|
+
- Fixed package repository metadata after the GitHub repository rename by aligning it with `dmae97/omk`.
|
|
70
|
+
|
|
71
|
+
## [0.90.6] - 2026-07-09
|
|
72
|
+
|
|
73
|
+
### Added
|
|
74
|
+
|
|
75
|
+
- Added B2C Correctness Wall orchestration APIs (`evaluateCorrectnessWall`, policy wall, deep-wall evidence gate, live/fixture OA transports, repair hints/budget, signed receipts) with unit coverage; advisory evidence-gated verdicts only (not formal correctness proof).
|
|
76
|
+
|
|
77
|
+
## [0.90.5] - 2026-07-07
|
|
78
|
+
|
|
79
|
+
## [0.90.4] - 2026-07-04
|
|
80
|
+
|
|
81
|
+
### Added
|
|
82
|
+
|
|
83
|
+
- Added deterministic retry-backoff groundwork for AdaptOrch packets: `backoffDelayMs` combines exponential delay caps with stable per-packet jitter so the same packet id and retry count always produce the same delay.
|
|
84
|
+
|
|
85
|
+
### Changed
|
|
86
|
+
|
|
87
|
+
- Adjudication reasons are now structured: `AdjudicationResult` and `PerRunVerdict` carry a machine-readable `reason_code` from the closed `ADJUDICATION_REASON_CODES` set alongside the human-readable `reason` string, and `projectVerdictToDisposition` branches on `reason_code` through a compile-time-total disposition table instead of substring-matching the reason text (which could falsely escalate on incidental wording like "scoped variable" or miss reroutes when drift reasons lacked the word "schema"). `CheckResult` gains an optional `code` field so `content_check`/`trace_check` hooks can classify failures (e.g. `SCOPE_VIOLATION`, `SCHEMA_DRIFT`) explicitly.
|
|
88
|
+
|
|
89
|
+
## [0.90.3] - 2026-07-02
|
|
90
|
+
|
|
91
|
+
## [0.90.2] - 2026-07-02
|
|
92
|
+
|
|
93
|
+
### Added
|
|
94
|
+
|
|
95
|
+
- Added the experimental AdaptOrch-native Work Packet Loop as the private `omk-adaptorch-wpl` workspace package (adaptorch client, work-packet state machine, adjudicator registry, and loop runner). Not published to npm.
|
package/README.md
CHANGED
|
@@ -46,6 +46,24 @@ The default coding-agent source has no production importer that turns this packa
|
|
|
46
46
|
- Loop-level budgets (`max_dispatch_attempts`, `max_loop_duration`, dispatch-call budget) are
|
|
47
47
|
immutable for a loop instance's lifetime; raising them requires a new instance under the same review.
|
|
48
48
|
|
|
49
|
+
## Optional service links
|
|
50
|
+
|
|
51
|
+
For a user-requested product/help screen, use the public offline helper:
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
import { getAdaptOrchLinks } from "omk-adaptorch-wpl";
|
|
55
|
+
|
|
56
|
+
const links = getAdaptOrchLinks();
|
|
57
|
+
console.log(links.plans, links.signup, links.contact, links.claimBoundary);
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
These fixed `https://adaptorch.com` URLs distinguish WPL and CLI arrivals using
|
|
61
|
+
bounded UTM tags. No project, session, prompt, run ID, or credential enters a link.
|
|
62
|
+
The helper performs no I/O and does not alter verdicts, receipts, or execution gates.
|
|
63
|
+
In OMK, `omk doctor adaptorch --links` prints the same destinations with CLI
|
|
64
|
+
attribution, without an API key or network call. The user chooses whether to visit.
|
|
65
|
+
See [onboarding and CRM boundaries](https://github.com/dmae97/omk/blob/main/packages/coding-agent/docs/adaptorch-onboarding.md).
|
|
66
|
+
|
|
49
67
|
## AdaptOrch, the service
|
|
50
68
|
|
|
51
69
|
This package is open source and MIT-licensed, like the rest of OMK. AdaptOrch
|
package/dist/b2c-mapper.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"b2c-mapper.d.ts","sourceRoot":"","sources":["../src/b2c-mapper.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAE3D,OAAO,EAIN,KAAK,WAAW,EAGhB,KAAK,mBAAmB,EACxB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAe,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAkFhE,MAAM,WAAW,aAAa;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,UAAU,EAAE,CAAC;IAC1B,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,YAAY,CAAC,EAAE,kBAAkB,CAAC;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,MAAM,WAAW,cAAc;IAC9B,WAAW,EAAE,WAAW,CAAC;IACzB,OAAO,EAAE,mBAAmB,CAAC;CAC7B;AAED,eAAO,MAAM,uBAAuB,2BAAqC,CAAC;AA8B1E,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,cAAc,CA0F7D","sourcesContent":["/**\n * Maps OA adjudication + policy flags to B2C {@link VerdictCard} and apply/submit gates.\n */\n\nimport type { AdjudicationResult } from \"./adjudicator.ts\";\nimport type { AdjudicationReasonCode, VerdictState } from \"./adjudicator-registry.ts\";\nimport {\n\tB2C_VERDICT_SCHEMA_VERSION,\n\ttype UserRiskLevel,\n\ttype UserVerdict,\n\ttype VerdictCard,\n\ttype VerdictLimits,\n\ttype VerdictNextAction,\n\ttype VerificationReceipt,\n} from \"./b2c-verdict.ts\";\nimport { POLICY_FLAG, type PolicyFlag } from \"./policy-wall.ts\";\n\nconst USER_VERDICT_SEVERITY: UserVerdict[] = [\"BLOCKED\", \"INCONCLUSIVE\", \"ADVISORY\", \"PASS\"];\n\nfunction worstUserVerdict(current: UserVerdict, next: UserVerdict): UserVerdict {\n\tconst cur = USER_VERDICT_SEVERITY.indexOf(current);\n\tconst nxt = USER_VERDICT_SEVERITY.indexOf(next);\n\treturn cur <= nxt ? current : next;\n}\n\nfunction verdictFromOa(verdict: VerdictState): UserVerdict {\n\tswitch (verdict) {\n\t\tcase \"CONFIRMED\":\n\t\t\treturn \"PASS\";\n\t\tcase \"CORROBORATED-FAILURE\":\n\t\t\treturn \"ADVISORY\";\n\t\tcase \"CONTRADICTED\":\n\t\t\treturn \"BLOCKED\";\n\t\tcase \"INDETERMINATE\":\n\t\t\treturn \"INCONCLUSIVE\";\n\t\tcase \"VERIFIER-ERROR\":\n\t\t\treturn \"INCONCLUSIVE\";\n\t}\n}\n\nfunction riskFromUserVerdict(verdict: UserVerdict, flags: PolicyFlag[]): UserRiskLevel {\n\tif (verdict === \"BLOCKED\" || flags.includes(POLICY_FLAG.NON_NEGOTIABLE_BLOCKING)) {\n\t\treturn \"critical\";\n\t}\n\tif (verdict === \"INCONCLUSIVE\") return \"high\";\n\tif (verdict === \"ADVISORY\") return \"medium\";\n\treturn \"low\";\n}\n\nconst REASON_CODE_USER: Record<AdjudicationReasonCode, { passed?: string; blocked?: string }> = {\n\tSCOPE_VIOLATION: { blocked: \"Write scope violation detected by outcome adjudication.\" },\n\tSCHEMA_DRIFT: { blocked: \"Output schema does not match the expected contract.\" },\n\tCONTENT_CHECK_FAILED: { blocked: \"Content verification failed for one or more artifacts.\" },\n\tNO_EVIDENCE_ON_SUCCESS: { blocked: \"Run reported success but left no usable evidence.\" },\n\tEMPTY_ARTIFACT_CONTENT: { blocked: \"An artifact was present but contained no substantive content.\" },\n\tTRACE_CHECK_FAILED: { blocked: \"Trace verification failed for this run.\" },\n\tTRACE_ERROR_SPAN: { blocked: \"Error-level spans were found under a reported success.\" },\n\tMIN_ACTIONS_UNMET: { blocked: \"Fewer actions were recorded than required for this kind.\" },\n\tRUN_STATUS_UNPARSEABLE: { blocked: \"Run status could not be interpreted.\" },\n\tRUN_FETCH_FAILED: { blocked: \"Evidence could not be fetched for this run.\" },\n\tMALFORMED_REQUEST: { blocked: \"Adjudication request was malformed.\" },\n\tRUN_NOT_TERMINAL: { blocked: \"Run has not reached a terminal status yet.\" },\n\tEVIDENCE_EMPTY: { blocked: \"Evidence was too thin to reach a confident verdict.\" },\n\tFAILURE_REPORTED: { blocked: \"The run reported failure and evidence agrees.\" },\n\tALL_CHECKS_PASSED: { passed: \"All outcome adjudication checks passed.\" },\n};\n\nfunction userStringsForReasonCode(code: AdjudicationReasonCode): { passed: string[]; blocked: string[] } {\n\tconst entry = REASON_CODE_USER[code];\n\tconst passed: string[] = [];\n\tconst blocked: string[] = [];\n\tif (entry.passed) passed.push(entry.passed);\n\tif (entry.blocked) blocked.push(entry.blocked);\n\treturn { passed, blocked };\n}\n\nfunction userVerdictFromPolicyFlags(flags: PolicyFlag[], previewOnly: boolean): UserVerdict | null {\n\tlet v: UserVerdict = \"PASS\";\n\tif (\n\t\tflags.includes(POLICY_FLAG.NON_NEGOTIABLE_BLOCKING) ||\n\t\tflags.includes(POLICY_FLAG.CANDIDATE_LEAK_SUSPECT) ||\n\t\tflags.includes(POLICY_FLAG.SECRET_SUSPECT)\n\t) {\n\t\tv = worstUserVerdict(v, \"BLOCKED\");\n\t}\n\tif (flags.includes(POLICY_FLAG.EVIDENCE_DAG_INCOMPLETE)) {\n\t\tv = worstUserVerdict(v, \"INCONCLUSIVE\");\n\t}\n\tif (\n\t\tpreviewOnly &&\n\t\t(flags.includes(POLICY_FLAG.REPRO_OVERFIT_SUSPECT) || flags.includes(POLICY_FLAG.LOW_DISCRIMINATION))\n\t) {\n\t\tv = worstUserVerdict(v, \"ADVISORY\");\n\t}\n\treturn v === \"PASS\" && flags.length === 0 ? null : v;\n}\n\nexport interface MapToB2CInput {\n\tkind: string;\n\tpacketId?: string;\n\tdispatchRecordId?: string;\n\trunIds: string[];\n\tpreviewOnly: boolean;\n\tpolicyFlags: PolicyFlag[];\n\tdiffPaths: string[];\n\tadjudication?: AdjudicationResult;\n\tevaluatedAt?: string;\n\trepairHints?: string[];\n}\n\nexport interface MapToB2COutput {\n\tverdictCard: VerdictCard;\n\treceipt: VerificationReceipt;\n}\n\nexport const BATCH1_NO_DOCKER_RUNNER = \"BATCH1_NO_DOCKER_RUNNER\" as const;\n\nfunction buildNextActions(verdict: UserVerdict, previewOnly: boolean, canApply: boolean): VerdictNextAction[] {\n\tif (verdict === \"BLOCKED\") {\n\t\treturn [\"Regenerate\"];\n\t}\n\tif (verdict === \"INCONCLUSIVE\") {\n\t\treturn previewOnly ? [\"Deep Check\", \"Regenerate\"] : [\"Deep Check\"];\n\t}\n\tif (verdict === \"ADVISORY\") {\n\t\treturn previewOnly ? [\"Deep Check\", \"Apply\"] : [\"Apply\"];\n\t}\n\tif (canApply) {\n\t\treturn [\"Apply\"];\n\t}\n\treturn [\"Deep Check\"];\n}\n\nfunction buildLimitsCode(previewOnly: boolean): string | undefined {\n\treturn previewOnly ? BATCH1_NO_DOCKER_RUNNER : undefined;\n}\n\nfunction buildDisclaimer(previewOnly: boolean, limitsCode: string | undefined): string | undefined {\n\tif (!previewOnly) {\n\t\treturn undefined;\n\t}\n\tconst code = limitsCode ?? BATCH1_NO_DOCKER_RUNNER;\n\treturn `Preview-only evaluation (${code}): no docker runner; apply and submit gates are conservative.`;\n}\n\nexport function mapToB2C(input: MapToB2CInput): MapToB2COutput {\n\tconst evaluatedAt = input.evaluatedAt ?? new Date().toISOString();\n\tlet userVerdict: UserVerdict = \"INCONCLUSIVE\";\n\tconst passed_checks: string[] = [];\n\tconst blocked_reasons: string[] = [];\n\n\tif (input.diffPaths.length === 0 && input.adjudication === undefined) {\n\t\tuserVerdict = \"INCONCLUSIVE\";\n\t\tblocked_reasons.push(\"No changed paths were found in the diff; cannot assess write scope.\");\n\t} else {\n\t\tuserVerdict = \"PASS\";\n\t}\n\n\tconst policyVerdict = userVerdictFromPolicyFlags(input.policyFlags, input.previewOnly);\n\tif (policyVerdict !== null) {\n\t\tuserVerdict = worstUserVerdict(userVerdict, policyVerdict);\n\t}\n\n\tif (input.policyFlags.includes(POLICY_FLAG.SECRET_SUSPECT)) {\n\t\tblocked_reasons.push(\"Diff lines may contain secrets or credentials; remove before proceeding.\");\n\t}\n\tif (input.policyFlags.includes(POLICY_FLAG.CANDIDATE_LEAK_SUSPECT)) {\n\t\tblocked_reasons.push(\"One or more changed paths fall outside the approved write scope.\");\n\t}\n\tif (input.policyFlags.includes(POLICY_FLAG.EVIDENCE_DAG_INCOMPLETE)) {\n\t\tblocked_reasons.push(\"Run evidence is required but was not evaluated in this receipt.\");\n\t}\n\tif (input.previewOnly && input.policyFlags.includes(POLICY_FLAG.LOW_DISCRIMINATION)) {\n\t\tblocked_reasons.push(\"Preview-only mode: discrimination against production evidence is limited.\");\n\t}\n\n\tif (input.adjudication !== undefined) {\n\t\tconst fromOa = verdictFromOa(input.adjudication.verdict);\n\t\tuserVerdict = worstUserVerdict(userVerdict, fromOa);\n\t\tconst strings = userStringsForReasonCode(input.adjudication.reason_code);\n\t\tpassed_checks.push(...strings.passed);\n\t\tblocked_reasons.push(...strings.blocked);\n\t} else if (userVerdict === \"PASS\" && input.diffPaths.length > 0) {\n\t\tpassed_checks.push(\"Changed paths are within approved write scope (fast wall).\");\n\t}\n\n\tconst limitsCode = buildLimitsCode(input.previewOnly);\n\tconst limits: VerdictLimits = {\n\t\trequiresHumanReview: userVerdict === \"BLOCKED\" || userVerdict === \"INCONCLUSIVE\",\n\t\tpreviewOnly: input.previewOnly,\n\t\tcode: limitsCode,\n\t};\n\n\tconst canApply =\n\t\tuserVerdict === \"PASS\" &&\n\t\t!input.policyFlags.includes(POLICY_FLAG.NON_NEGOTIABLE_BLOCKING) &&\n\t\t!input.policyFlags.includes(POLICY_FLAG.CANDIDATE_LEAK_SUSPECT) &&\n\t\t!input.policyFlags.includes(POLICY_FLAG.SECRET_SUSPECT) &&\n\t\t(input.adjudication === undefined || input.adjudication.verdict === \"CONFIRMED\");\n\n\tconst shouldSubmit = userVerdict !== \"BLOCKED\" && !input.policyFlags.includes(POLICY_FLAG.NON_NEGOTIABLE_BLOCKING);\n\n\tconst disclaimer = buildDisclaimer(input.previewOnly, limitsCode);\n\n\tconst verdictCard: VerdictCard = {\n\t\tschemaVersion: B2C_VERDICT_SCHEMA_VERSION,\n\t\tverdict: userVerdict,\n\t\trisk: riskFromUserVerdict(userVerdict, input.policyFlags),\n\t\tlimits,\n\t\tpassed_checks,\n\t\tblocked_reasons: [...new Set(blocked_reasons)],\n\t\tnext_actions: buildNextActions(userVerdict, input.previewOnly, canApply),\n\t\trepairHints: input.repairHints !== undefined && input.repairHints.length > 0 ? input.repairHints : undefined,\n\t\tpacketId: input.packetId,\n\t\tkind: input.kind,\n\t};\n\n\tconst receipt: VerificationReceipt = {\n\t\tschemaVersion: B2C_VERDICT_SCHEMA_VERSION,\n\t\tevaluatedAt,\n\t\tkind: input.kind,\n\t\tpacketId: input.packetId,\n\t\tdispatchRecordId: input.dispatchRecordId,\n\t\trunIds: input.runIds,\n\t\tpreviewOnly: input.previewOnly,\n\t\tcanApply,\n\t\tshouldSubmit,\n\t\tpolicyFlags: [...input.policyFlags],\n\t\tadjudicationVerdict: input.adjudication?.verdict,\n\t\tadjudicationReasonCode: input.adjudication?.reason_code,\n\t\tdiffPaths: input.diffPaths,\n\t\tdisclaimer,\n\t};\n\n\treturn { verdictCard, receipt };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"b2c-mapper.d.ts","sourceRoot":"","sources":["../src/b2c-mapper.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAE3D,OAAO,EAIN,KAAK,WAAW,EAGhB,KAAK,mBAAmB,EACxB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAe,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAkFhE,MAAM,WAAW,aAAa;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,UAAU,EAAE,CAAC;IAC1B,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,YAAY,CAAC,EAAE,kBAAkB,CAAC;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,MAAM,WAAW,cAAc;IAC9B,WAAW,EAAE,WAAW,CAAC;IACzB,OAAO,EAAE,mBAAmB,CAAC;CAC7B;AAED,eAAO,MAAM,uBAAuB,2BAAqC,CAAC;AA8B1E,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,cAAc,CA2F7D","sourcesContent":["/**\n * Maps OA adjudication + policy flags to B2C {@link VerdictCard} and apply/submit gates.\n */\n\nimport type { AdjudicationResult } from \"./adjudicator.ts\";\nimport type { AdjudicationReasonCode, VerdictState } from \"./adjudicator-registry.ts\";\nimport {\n\tB2C_VERDICT_SCHEMA_VERSION,\n\ttype UserRiskLevel,\n\ttype UserVerdict,\n\ttype VerdictCard,\n\ttype VerdictLimits,\n\ttype VerdictNextAction,\n\ttype VerificationReceipt,\n} from \"./b2c-verdict.ts\";\nimport { POLICY_FLAG, type PolicyFlag } from \"./policy-wall.ts\";\n\nconst USER_VERDICT_SEVERITY: UserVerdict[] = [\"BLOCKED\", \"INCONCLUSIVE\", \"ADVISORY\", \"PASS\"];\n\nfunction worstUserVerdict(current: UserVerdict, next: UserVerdict): UserVerdict {\n\tconst cur = USER_VERDICT_SEVERITY.indexOf(current);\n\tconst nxt = USER_VERDICT_SEVERITY.indexOf(next);\n\treturn cur <= nxt ? current : next;\n}\n\nfunction verdictFromOa(verdict: VerdictState): UserVerdict {\n\tswitch (verdict) {\n\t\tcase \"CONFIRMED\":\n\t\t\treturn \"PASS\";\n\t\tcase \"CORROBORATED-FAILURE\":\n\t\t\treturn \"ADVISORY\";\n\t\tcase \"CONTRADICTED\":\n\t\t\treturn \"BLOCKED\";\n\t\tcase \"INDETERMINATE\":\n\t\t\treturn \"INCONCLUSIVE\";\n\t\tcase \"VERIFIER-ERROR\":\n\t\t\treturn \"INCONCLUSIVE\";\n\t}\n}\n\nfunction riskFromUserVerdict(verdict: UserVerdict, flags: PolicyFlag[]): UserRiskLevel {\n\tif (verdict === \"BLOCKED\" || flags.includes(POLICY_FLAG.NON_NEGOTIABLE_BLOCKING)) {\n\t\treturn \"critical\";\n\t}\n\tif (verdict === \"INCONCLUSIVE\") return \"high\";\n\tif (verdict === \"ADVISORY\") return \"medium\";\n\treturn \"low\";\n}\n\nconst REASON_CODE_USER: Record<AdjudicationReasonCode, { passed?: string; blocked?: string }> = {\n\tSCOPE_VIOLATION: { blocked: \"Write scope violation detected by outcome adjudication.\" },\n\tSCHEMA_DRIFT: { blocked: \"Output schema does not match the expected contract.\" },\n\tCONTENT_CHECK_FAILED: { blocked: \"Content verification failed for one or more artifacts.\" },\n\tNO_EVIDENCE_ON_SUCCESS: { blocked: \"Run reported success but left no usable evidence.\" },\n\tEMPTY_ARTIFACT_CONTENT: { blocked: \"An artifact was present but contained no substantive content.\" },\n\tTRACE_CHECK_FAILED: { blocked: \"Trace verification failed for this run.\" },\n\tTRACE_ERROR_SPAN: { blocked: \"Error-level spans were found under a reported success.\" },\n\tMIN_ACTIONS_UNMET: { blocked: \"Fewer actions were recorded than required for this kind.\" },\n\tRUN_STATUS_UNPARSEABLE: { blocked: \"Run status could not be interpreted.\" },\n\tRUN_FETCH_FAILED: { blocked: \"Evidence could not be fetched for this run.\" },\n\tMALFORMED_REQUEST: { blocked: \"Adjudication request was malformed.\" },\n\tRUN_NOT_TERMINAL: { blocked: \"Run has not reached a terminal status yet.\" },\n\tEVIDENCE_EMPTY: { blocked: \"Evidence was too thin to reach a confident verdict.\" },\n\tFAILURE_REPORTED: { blocked: \"The run reported failure and evidence agrees.\" },\n\tALL_CHECKS_PASSED: { passed: \"All outcome adjudication checks passed.\" },\n};\n\nfunction userStringsForReasonCode(code: AdjudicationReasonCode): { passed: string[]; blocked: string[] } {\n\tconst entry = REASON_CODE_USER[code];\n\tconst passed: string[] = [];\n\tconst blocked: string[] = [];\n\tif (entry.passed) passed.push(entry.passed);\n\tif (entry.blocked) blocked.push(entry.blocked);\n\treturn { passed, blocked };\n}\n\nfunction userVerdictFromPolicyFlags(flags: PolicyFlag[], previewOnly: boolean): UserVerdict | null {\n\tlet v: UserVerdict = \"PASS\";\n\tif (\n\t\tflags.includes(POLICY_FLAG.NON_NEGOTIABLE_BLOCKING) ||\n\t\tflags.includes(POLICY_FLAG.CANDIDATE_LEAK_SUSPECT) ||\n\t\tflags.includes(POLICY_FLAG.SECRET_SUSPECT)\n\t) {\n\t\tv = worstUserVerdict(v, \"BLOCKED\");\n\t}\n\tif (flags.includes(POLICY_FLAG.EVIDENCE_DAG_INCOMPLETE)) {\n\t\tv = worstUserVerdict(v, \"INCONCLUSIVE\");\n\t}\n\tif (\n\t\tpreviewOnly &&\n\t\t(flags.includes(POLICY_FLAG.REPRO_OVERFIT_SUSPECT) || flags.includes(POLICY_FLAG.LOW_DISCRIMINATION))\n\t) {\n\t\tv = worstUserVerdict(v, \"ADVISORY\");\n\t}\n\treturn v === \"PASS\" && flags.length === 0 ? null : v;\n}\n\nexport interface MapToB2CInput {\n\tkind: string;\n\tpacketId?: string;\n\tdispatchRecordId?: string;\n\trunIds: string[];\n\tpreviewOnly: boolean;\n\tpolicyFlags: PolicyFlag[];\n\tdiffPaths: string[];\n\tadjudication?: AdjudicationResult;\n\tevaluatedAt?: string;\n\trepairHints?: string[];\n}\n\nexport interface MapToB2COutput {\n\tverdictCard: VerdictCard;\n\treceipt: VerificationReceipt;\n}\n\nexport const BATCH1_NO_DOCKER_RUNNER = \"BATCH1_NO_DOCKER_RUNNER\" as const;\n\nfunction buildNextActions(verdict: UserVerdict, previewOnly: boolean, canApply: boolean): VerdictNextAction[] {\n\tif (verdict === \"BLOCKED\") {\n\t\treturn [\"Regenerate\"];\n\t}\n\tif (verdict === \"INCONCLUSIVE\") {\n\t\treturn previewOnly ? [\"Deep Check\", \"Regenerate\"] : [\"Deep Check\"];\n\t}\n\tif (verdict === \"ADVISORY\") {\n\t\treturn previewOnly ? [\"Deep Check\", \"Apply\"] : [\"Apply\"];\n\t}\n\tif (canApply) {\n\t\treturn [\"Apply\"];\n\t}\n\treturn [\"Deep Check\"];\n}\n\nfunction buildLimitsCode(previewOnly: boolean): string | undefined {\n\treturn previewOnly ? BATCH1_NO_DOCKER_RUNNER : undefined;\n}\n\nfunction buildDisclaimer(previewOnly: boolean, limitsCode: string | undefined): string | undefined {\n\tif (!previewOnly) {\n\t\treturn undefined;\n\t}\n\tconst code = limitsCode ?? BATCH1_NO_DOCKER_RUNNER;\n\treturn `Preview-only evaluation (${code}): no docker runner; apply and submit gates are conservative.`;\n}\n\nexport function mapToB2C(input: MapToB2CInput): MapToB2COutput {\n\tconst evaluatedAt = input.evaluatedAt ?? new Date().toISOString();\n\tlet userVerdict: UserVerdict = \"INCONCLUSIVE\";\n\tconst passed_checks: string[] = [];\n\tconst blocked_reasons: string[] = [];\n\n\tif (input.diffPaths.length === 0 && input.adjudication === undefined) {\n\t\tuserVerdict = \"INCONCLUSIVE\";\n\t\tblocked_reasons.push(\"No changed paths were found in the diff; cannot assess write scope.\");\n\t} else {\n\t\tuserVerdict = \"PASS\";\n\t}\n\n\tconst policyVerdict = userVerdictFromPolicyFlags(input.policyFlags, input.previewOnly);\n\tif (policyVerdict !== null) {\n\t\tuserVerdict = worstUserVerdict(userVerdict, policyVerdict);\n\t}\n\n\tif (input.policyFlags.includes(POLICY_FLAG.SECRET_SUSPECT)) {\n\t\tblocked_reasons.push(\"Diff lines may contain secrets or credentials; remove before proceeding.\");\n\t}\n\tif (input.policyFlags.includes(POLICY_FLAG.CANDIDATE_LEAK_SUSPECT)) {\n\t\tblocked_reasons.push(\"One or more changed paths fall outside the approved write scope.\");\n\t}\n\tif (input.policyFlags.includes(POLICY_FLAG.EVIDENCE_DAG_INCOMPLETE)) {\n\t\tblocked_reasons.push(\"Run evidence is required but was not evaluated in this receipt.\");\n\t}\n\tif (input.previewOnly && input.policyFlags.includes(POLICY_FLAG.LOW_DISCRIMINATION)) {\n\t\tblocked_reasons.push(\"Preview-only mode: discrimination against production evidence is limited.\");\n\t}\n\n\tif (input.adjudication !== undefined) {\n\t\tconst fromOa = verdictFromOa(input.adjudication.verdict);\n\t\tuserVerdict = worstUserVerdict(userVerdict, fromOa);\n\t\tconst strings = userStringsForReasonCode(input.adjudication.reason_code);\n\t\tpassed_checks.push(...strings.passed);\n\t\tblocked_reasons.push(...strings.blocked);\n\t} else if (userVerdict === \"PASS\" && input.diffPaths.length > 0) {\n\t\tpassed_checks.push(\"Changed paths are within approved write scope (fast wall).\");\n\t}\n\n\tconst limitsCode = buildLimitsCode(input.previewOnly);\n\tconst limits: VerdictLimits = {\n\t\trequiresHumanReview: userVerdict === \"BLOCKED\" || userVerdict === \"INCONCLUSIVE\",\n\t\tpreviewOnly: input.previewOnly,\n\t\tcode: limitsCode,\n\t};\n\n\tconst canApply =\n\t\tuserVerdict === \"PASS\" &&\n\t\t!input.policyFlags.includes(POLICY_FLAG.NON_NEGOTIABLE_BLOCKING) &&\n\t\t!input.policyFlags.includes(POLICY_FLAG.CANDIDATE_LEAK_SUSPECT) &&\n\t\t!input.policyFlags.includes(POLICY_FLAG.SECRET_SUSPECT) &&\n\t\t(input.adjudication === undefined || input.adjudication.verdict === \"CONFIRMED\");\n\n\tconst shouldSubmit =\n\t\tcanApply && !input.previewOnly && input.runIds.length > 0 && input.adjudication?.verdict === \"CONFIRMED\";\n\n\tconst disclaimer = buildDisclaimer(input.previewOnly, limitsCode);\n\n\tconst verdictCard: VerdictCard = {\n\t\tschemaVersion: B2C_VERDICT_SCHEMA_VERSION,\n\t\tverdict: userVerdict,\n\t\trisk: riskFromUserVerdict(userVerdict, input.policyFlags),\n\t\tlimits,\n\t\tpassed_checks,\n\t\tblocked_reasons: [...new Set(blocked_reasons)],\n\t\tnext_actions: buildNextActions(userVerdict, input.previewOnly, canApply),\n\t\trepairHints: input.repairHints !== undefined && input.repairHints.length > 0 ? input.repairHints : undefined,\n\t\tpacketId: input.packetId,\n\t\tkind: input.kind,\n\t};\n\n\tconst receipt: VerificationReceipt = {\n\t\tschemaVersion: B2C_VERDICT_SCHEMA_VERSION,\n\t\tevaluatedAt,\n\t\tkind: input.kind,\n\t\tpacketId: input.packetId,\n\t\tdispatchRecordId: input.dispatchRecordId,\n\t\trunIds: input.runIds,\n\t\tpreviewOnly: input.previewOnly,\n\t\tcanApply,\n\t\tshouldSubmit,\n\t\tpolicyFlags: [...input.policyFlags],\n\t\tadjudicationVerdict: input.adjudication?.verdict,\n\t\tadjudicationReasonCode: input.adjudication?.reason_code,\n\t\tdiffPaths: input.diffPaths,\n\t\tdisclaimer,\n\t};\n\n\treturn { verdictCard, receipt };\n}\n"]}
|
package/dist/b2c-mapper.js
CHANGED
|
@@ -151,7 +151,7 @@ export function mapToB2C(input) {
|
|
|
151
151
|
!input.policyFlags.includes(POLICY_FLAG.CANDIDATE_LEAK_SUSPECT) &&
|
|
152
152
|
!input.policyFlags.includes(POLICY_FLAG.SECRET_SUSPECT) &&
|
|
153
153
|
(input.adjudication === undefined || input.adjudication.verdict === "CONFIRMED");
|
|
154
|
-
const shouldSubmit =
|
|
154
|
+
const shouldSubmit = canApply && !input.previewOnly && input.runIds.length > 0 && input.adjudication?.verdict === "CONFIRMED";
|
|
155
155
|
const disclaimer = buildDisclaimer(input.previewOnly, limitsCode);
|
|
156
156
|
const verdictCard = {
|
|
157
157
|
schemaVersion: B2C_VERDICT_SCHEMA_VERSION,
|
package/dist/b2c-mapper.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"b2c-mapper.js","sourceRoot":"","sources":["../src/b2c-mapper.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EACN,0BAA0B,GA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S;QAC5G,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,IAAI,EAAE,KAAK,CAAC,IAAI;KAChB,CAAC;IAEF,MAAM,OAAO,GAAwB;QACpC,aAAa,EAAE,0BAA0B;QACzC,WAAW;QACX,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,gBAAgB,EAAE,KAAK,CAAC,gBAAgB;QACxC,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,QAAQ;QACR,YAAY;QACZ,WAAW,EAAE,CAAC,GAAG,KAAK,CAAC,WAAW,CAAC;QACnC,mBAAmB,EAAE,KAAK,CAAC,YAAY,EAAE,OAAO;QAChD,sBAAsB,EAAE,KAAK,CAAC,YAAY,EAAE,WAAW;QACvD,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,UAAU;KACV,CAAC;IAEF,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC;AAAA,CAChC","sourcesContent":["/**\n * Maps OA adjudication + policy flags to B2C {@link VerdictCard} and apply/submit gates.\n */\n\nimport type { AdjudicationResult } from \"./adjudicator.ts\";\nimport type { AdjudicationReasonCode, VerdictState } from \"./adjudicator-registry.ts\";\nimport {\n\tB2C_VERDICT_SCHEMA_VERSION,\n\ttype UserRiskLevel,\n\ttype UserVerdict,\n\ttype VerdictCard,\n\ttype VerdictLimits,\n\ttype VerdictNextAction,\n\ttype VerificationReceipt,\n} from \"./b2c-verdict.ts\";\nimport { POLICY_FLAG, type PolicyFlag } from \"./policy-wall.ts\";\n\nconst USER_VERDICT_SEVERITY: UserVerdict[] = [\"BLOCKED\", \"INCONCLUSIVE\", \"ADVISORY\", \"PASS\"];\n\nfunction worstUserVerdict(current: UserVerdict, next: UserVerdict): UserVerdict {\n\tconst cur = USER_VERDICT_SEVERITY.indexOf(current);\n\tconst nxt = USER_VERDICT_SEVERITY.indexOf(next);\n\treturn cur <= nxt ? current : next;\n}\n\nfunction verdictFromOa(verdict: VerdictState): UserVerdict {\n\tswitch (verdict) {\n\t\tcase \"CONFIRMED\":\n\t\t\treturn \"PASS\";\n\t\tcase \"CORROBORATED-FAILURE\":\n\t\t\treturn \"ADVISORY\";\n\t\tcase \"CONTRADICTED\":\n\t\t\treturn \"BLOCKED\";\n\t\tcase \"INDETERMINATE\":\n\t\t\treturn \"INCONCLUSIVE\";\n\t\tcase \"VERIFIER-ERROR\":\n\t\t\treturn \"INCONCLUSIVE\";\n\t}\n}\n\nfunction riskFromUserVerdict(verdict: UserVerdict, flags: PolicyFlag[]): UserRiskLevel {\n\tif (verdict === \"BLOCKED\" || flags.includes(POLICY_FLAG.NON_NEGOTIABLE_BLOCKING)) {\n\t\treturn \"critical\";\n\t}\n\tif (verdict === \"INCONCLUSIVE\") return \"high\";\n\tif (verdict === \"ADVISORY\") return \"medium\";\n\treturn \"low\";\n}\n\nconst REASON_CODE_USER: Record<AdjudicationReasonCode, { passed?: string; blocked?: string }> = {\n\tSCOPE_VIOLATION: { blocked: \"Write scope violation detected by outcome adjudication.\" },\n\tSCHEMA_DRIFT: { blocked: \"Output schema does not match the expected contract.\" },\n\tCONTENT_CHECK_FAILED: { blocked: \"Content verification failed for one or more artifacts.\" },\n\tNO_EVIDENCE_ON_SUCCESS: { blocked: \"Run reported success but left no usable evidence.\" },\n\tEMPTY_ARTIFACT_CONTENT: { blocked: \"An artifact was present but contained no substantive content.\" },\n\tTRACE_CHECK_FAILED: { blocked: \"Trace verification failed for this run.\" },\n\tTRACE_ERROR_SPAN: { blocked: \"Error-level spans were found under a reported success.\" },\n\tMIN_ACTIONS_UNMET: { blocked: \"Fewer actions were recorded than required for this kind.\" },\n\tRUN_STATUS_UNPARSEABLE: { blocked: \"Run status could not be interpreted.\" },\n\tRUN_FETCH_FAILED: { blocked: \"Evidence could not be fetched for this run.\" },\n\tMALFORMED_REQUEST: { blocked: \"Adjudication request was malformed.\" },\n\tRUN_NOT_TERMINAL: { blocked: \"Run has not reached a terminal status yet.\" },\n\tEVIDENCE_EMPTY: { blocked: \"Evidence was too thin to reach a confident verdict.\" },\n\tFAILURE_REPORTED: { blocked: \"The run reported failure and evidence agrees.\" },\n\tALL_CHECKS_PASSED: { passed: \"All outcome adjudication checks passed.\" },\n};\n\nfunction userStringsForReasonCode(code: AdjudicationReasonCode): { passed: string[]; blocked: string[] } {\n\tconst entry = REASON_CODE_USER[code];\n\tconst passed: string[] = [];\n\tconst blocked: string[] = [];\n\tif (entry.passed) passed.push(entry.passed);\n\tif (entry.blocked) blocked.push(entry.blocked);\n\treturn { passed, blocked };\n}\n\nfunction userVerdictFromPolicyFlags(flags: PolicyFlag[], previewOnly: boolean): UserVerdict | null {\n\tlet v: UserVerdict = \"PASS\";\n\tif (\n\t\tflags.includes(POLICY_FLAG.NON_NEGOTIABLE_BLOCKING) ||\n\t\tflags.includes(POLICY_FLAG.CANDIDATE_LEAK_SUSPECT) ||\n\t\tflags.includes(POLICY_FLAG.SECRET_SUSPECT)\n\t) {\n\t\tv = worstUserVerdict(v, \"BLOCKED\");\n\t}\n\tif (flags.includes(POLICY_FLAG.EVIDENCE_DAG_INCOMPLETE)) {\n\t\tv = worstUserVerdict(v, \"INCONCLUSIVE\");\n\t}\n\tif (\n\t\tpreviewOnly &&\n\t\t(flags.includes(POLICY_FLAG.REPRO_OVERFIT_SUSPECT) || flags.includes(POLICY_FLAG.LOW_DISCRIMINATION))\n\t) {\n\t\tv = worstUserVerdict(v, \"ADVISORY\");\n\t}\n\treturn v === \"PASS\" && flags.length === 0 ? null : v;\n}\n\nexport interface MapToB2CInput {\n\tkind: string;\n\tpacketId?: string;\n\tdispatchRecordId?: string;\n\trunIds: string[];\n\tpreviewOnly: boolean;\n\tpolicyFlags: PolicyFlag[];\n\tdiffPaths: string[];\n\tadjudication?: AdjudicationResult;\n\tevaluatedAt?: string;\n\trepairHints?: string[];\n}\n\nexport interface MapToB2COutput {\n\tverdictCard: VerdictCard;\n\treceipt: VerificationReceipt;\n}\n\nexport const BATCH1_NO_DOCKER_RUNNER = \"BATCH1_NO_DOCKER_RUNNER\" as const;\n\nfunction buildNextActions(verdict: UserVerdict, previewOnly: boolean, canApply: boolean): VerdictNextAction[] {\n\tif (verdict === \"BLOCKED\") {\n\t\treturn [\"Regenerate\"];\n\t}\n\tif (verdict === \"INCONCLUSIVE\") {\n\t\treturn previewOnly ? [\"Deep Check\", \"Regenerate\"] : [\"Deep Check\"];\n\t}\n\tif (verdict === \"ADVISORY\") {\n\t\treturn previewOnly ? [\"Deep Check\", \"Apply\"] : [\"Apply\"];\n\t}\n\tif (canApply) {\n\t\treturn [\"Apply\"];\n\t}\n\treturn [\"Deep Check\"];\n}\n\nfunction buildLimitsCode(previewOnly: boolean): string | undefined {\n\treturn previewOnly ? BATCH1_NO_DOCKER_RUNNER : undefined;\n}\n\nfunction buildDisclaimer(previewOnly: boolean, limitsCode: string | undefined): string | undefined {\n\tif (!previewOnly) {\n\t\treturn undefined;\n\t}\n\tconst code = limitsCode ?? BATCH1_NO_DOCKER_RUNNER;\n\treturn `Preview-only evaluation (${code}): no docker runner; apply and submit gates are conservative.`;\n}\n\nexport function mapToB2C(input: MapToB2CInput): MapToB2COutput {\n\tconst evaluatedAt = input.evaluatedAt ?? new Date().toISOString();\n\tlet userVerdict: UserVerdict = \"INCONCLUSIVE\";\n\tconst passed_checks: string[] = [];\n\tconst blocked_reasons: string[] = [];\n\n\tif (input.diffPaths.length === 0 && input.adjudication === undefined) {\n\t\tuserVerdict = \"INCONCLUSIVE\";\n\t\tblocked_reasons.push(\"No changed paths were found in the diff; cannot assess write scope.\");\n\t} else {\n\t\tuserVerdict = \"PASS\";\n\t}\n\n\tconst policyVerdict = userVerdictFromPolicyFlags(input.policyFlags, input.previewOnly);\n\tif (policyVerdict !== null) {\n\t\tuserVerdict = worstUserVerdict(userVerdict, policyVerdict);\n\t}\n\n\tif (input.policyFlags.includes(POLICY_FLAG.SECRET_SUSPECT)) {\n\t\tblocked_reasons.push(\"Diff lines may contain secrets or credentials; remove before proceeding.\");\n\t}\n\tif (input.policyFlags.includes(POLICY_FLAG.CANDIDATE_LEAK_SUSPECT)) {\n\t\tblocked_reasons.push(\"One or more changed paths fall outside the approved write scope.\");\n\t}\n\tif (input.policyFlags.includes(POLICY_FLAG.EVIDENCE_DAG_INCOMPLETE)) {\n\t\tblocked_reasons.push(\"Run evidence is required but was not evaluated in this receipt.\");\n\t}\n\tif (input.previewOnly && input.policyFlags.includes(POLICY_FLAG.LOW_DISCRIMINATION)) {\n\t\tblocked_reasons.push(\"Preview-only mode: discrimination against production evidence is limited.\");\n\t}\n\n\tif (input.adjudication !== undefined) {\n\t\tconst fromOa = verdictFromOa(input.adjudication.verdict);\n\t\tuserVerdict = worstUserVerdict(userVerdict, fromOa);\n\t\tconst strings = userStringsForReasonCode(input.adjudication.reason_code);\n\t\tpassed_checks.push(...strings.passed);\n\t\tblocked_reasons.push(...strings.blocked);\n\t} else if (userVerdict === \"PASS\" && input.diffPaths.length > 0) {\n\t\tpassed_checks.push(\"Changed paths are within approved write scope (fast wall).\");\n\t}\n\n\tconst limitsCode = buildLimitsCode(input.previewOnly);\n\tconst limits: VerdictLimits = {\n\t\trequiresHumanReview: userVerdict === \"BLOCKED\" || userVerdict === \"INCONCLUSIVE\",\n\t\tpreviewOnly: input.previewOnly,\n\t\tcode: limitsCode,\n\t};\n\n\tconst canApply =\n\t\tuserVerdict === \"PASS\" &&\n\t\t!input.policyFlags.includes(POLICY_FLAG.NON_NEGOTIABLE_BLOCKING) &&\n\t\t!input.policyFlags.includes(POLICY_FLAG.CANDIDATE_LEAK_SUSPECT) &&\n\t\t!input.policyFlags.includes(POLICY_FLAG.SECRET_SUSPECT) &&\n\t\t(input.adjudication === undefined || input.adjudication.verdict === \"CONFIRMED\");\n\n\tconst shouldSubmit = userVerdict !== \"BLOCKED\" && !input.policyFlags.includes(POLICY_FLAG.NON_NEGOTIABLE_BLOCKING);\n\n\tconst disclaimer = buildDisclaimer(input.previewOnly, limitsCode);\n\n\tconst verdictCard: VerdictCard = {\n\t\tschemaVersion: B2C_VERDICT_SCHEMA_VERSION,\n\t\tverdict: userVerdict,\n\t\trisk: riskFromUserVerdict(userVerdict, input.policyFlags),\n\t\tlimits,\n\t\tpassed_checks,\n\t\tblocked_reasons: [...new Set(blocked_reasons)],\n\t\tnext_actions: buildNextActions(userVerdict, input.previewOnly, canApply),\n\t\trepairHints: input.repairHints !== undefined && input.repairHints.length > 0 ? input.repairHints : undefined,\n\t\tpacketId: input.packetId,\n\t\tkind: input.kind,\n\t};\n\n\tconst receipt: VerificationReceipt = {\n\t\tschemaVersion: B2C_VERDICT_SCHEMA_VERSION,\n\t\tevaluatedAt,\n\t\tkind: input.kind,\n\t\tpacketId: input.packetId,\n\t\tdispatchRecordId: input.dispatchRecordId,\n\t\trunIds: input.runIds,\n\t\tpreviewOnly: input.previewOnly,\n\t\tcanApply,\n\t\tshouldSubmit,\n\t\tpolicyFlags: [...input.policyFlags],\n\t\tadjudicationVerdict: input.adjudication?.verdict,\n\t\tadjudicationReasonCode: input.adjudication?.reason_code,\n\t\tdiffPaths: input.diffPaths,\n\t\tdisclaimer,\n\t};\n\n\treturn { verdictCard, receipt };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"b2c-mapper.js","sourceRoot":"","sources":["../src/b2c-mapper.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EACN,0BAA0B,GAO1B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAmB,MAAM,kBAAkB,CAAC;AAEhE,MAAM,qBAAqB,GAAkB,CAAC,SAAS,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;AAE7F,SAAS,gBAAgB,CAAC,OAAoB,EAAE,IAAiB,EAAe;IAC/E,MAAM,GAAG,GAAG,qBAAqB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACnD,MAAM,GAAG,GAAG,qBAAqB,CAAC,OAAO,CAAC,IAAI,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B,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,QAAQ;QACR,YAAY;QACZ,WAAW,EAAE,CAAC,GAAG,KAAK,CAAC,WAAW,CAAC;QACnC,mBAAmB,EAAE,KAAK,CAAC,YAAY,EAAE,OAAO;QAChD,sBAAsB,EAAE,KAAK,CAAC,YAAY,EAAE,WAAW;QACvD,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,UAAU;KACV,CAAC;IAEF,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC;AAAA,CAChC","sourcesContent":["/**\n * Maps OA adjudication + policy flags to B2C {@link VerdictCard} and apply/submit gates.\n */\n\nimport type { AdjudicationResult } from \"./adjudicator.ts\";\nimport type { AdjudicationReasonCode, VerdictState } from \"./adjudicator-registry.ts\";\nimport {\n\tB2C_VERDICT_SCHEMA_VERSION,\n\ttype UserRiskLevel,\n\ttype UserVerdict,\n\ttype VerdictCard,\n\ttype VerdictLimits,\n\ttype VerdictNextAction,\n\ttype VerificationReceipt,\n} from \"./b2c-verdict.ts\";\nimport { POLICY_FLAG, type PolicyFlag } from \"./policy-wall.ts\";\n\nconst USER_VERDICT_SEVERITY: UserVerdict[] = [\"BLOCKED\", \"INCONCLUSIVE\", \"ADVISORY\", \"PASS\"];\n\nfunction worstUserVerdict(current: UserVerdict, next: UserVerdict): UserVerdict {\n\tconst cur = USER_VERDICT_SEVERITY.indexOf(current);\n\tconst nxt = USER_VERDICT_SEVERITY.indexOf(next);\n\treturn cur <= nxt ? current : next;\n}\n\nfunction verdictFromOa(verdict: VerdictState): UserVerdict {\n\tswitch (verdict) {\n\t\tcase \"CONFIRMED\":\n\t\t\treturn \"PASS\";\n\t\tcase \"CORROBORATED-FAILURE\":\n\t\t\treturn \"ADVISORY\";\n\t\tcase \"CONTRADICTED\":\n\t\t\treturn \"BLOCKED\";\n\t\tcase \"INDETERMINATE\":\n\t\t\treturn \"INCONCLUSIVE\";\n\t\tcase \"VERIFIER-ERROR\":\n\t\t\treturn \"INCONCLUSIVE\";\n\t}\n}\n\nfunction riskFromUserVerdict(verdict: UserVerdict, flags: PolicyFlag[]): UserRiskLevel {\n\tif (verdict === \"BLOCKED\" || flags.includes(POLICY_FLAG.NON_NEGOTIABLE_BLOCKING)) {\n\t\treturn \"critical\";\n\t}\n\tif (verdict === \"INCONCLUSIVE\") return \"high\";\n\tif (verdict === \"ADVISORY\") return \"medium\";\n\treturn \"low\";\n}\n\nconst REASON_CODE_USER: Record<AdjudicationReasonCode, { passed?: string; blocked?: string }> = {\n\tSCOPE_VIOLATION: { blocked: \"Write scope violation detected by outcome adjudication.\" },\n\tSCHEMA_DRIFT: { blocked: \"Output schema does not match the expected contract.\" },\n\tCONTENT_CHECK_FAILED: { blocked: \"Content verification failed for one or more artifacts.\" },\n\tNO_EVIDENCE_ON_SUCCESS: { blocked: \"Run reported success but left no usable evidence.\" },\n\tEMPTY_ARTIFACT_CONTENT: { blocked: \"An artifact was present but contained no substantive content.\" },\n\tTRACE_CHECK_FAILED: { blocked: \"Trace verification failed for this run.\" },\n\tTRACE_ERROR_SPAN: { blocked: \"Error-level spans were found under a reported success.\" },\n\tMIN_ACTIONS_UNMET: { blocked: \"Fewer actions were recorded than required for this kind.\" },\n\tRUN_STATUS_UNPARSEABLE: { blocked: \"Run status could not be interpreted.\" },\n\tRUN_FETCH_FAILED: { blocked: \"Evidence could not be fetched for this run.\" },\n\tMALFORMED_REQUEST: { blocked: \"Adjudication request was malformed.\" },\n\tRUN_NOT_TERMINAL: { blocked: \"Run has not reached a terminal status yet.\" },\n\tEVIDENCE_EMPTY: { blocked: \"Evidence was too thin to reach a confident verdict.\" },\n\tFAILURE_REPORTED: { blocked: \"The run reported failure and evidence agrees.\" },\n\tALL_CHECKS_PASSED: { passed: \"All outcome adjudication checks passed.\" },\n};\n\nfunction userStringsForReasonCode(code: AdjudicationReasonCode): { passed: string[]; blocked: string[] } {\n\tconst entry = REASON_CODE_USER[code];\n\tconst passed: string[] = [];\n\tconst blocked: string[] = [];\n\tif (entry.passed) passed.push(entry.passed);\n\tif (entry.blocked) blocked.push(entry.blocked);\n\treturn { passed, blocked };\n}\n\nfunction userVerdictFromPolicyFlags(flags: PolicyFlag[], previewOnly: boolean): UserVerdict | null {\n\tlet v: UserVerdict = \"PASS\";\n\tif (\n\t\tflags.includes(POLICY_FLAG.NON_NEGOTIABLE_BLOCKING) ||\n\t\tflags.includes(POLICY_FLAG.CANDIDATE_LEAK_SUSPECT) ||\n\t\tflags.includes(POLICY_FLAG.SECRET_SUSPECT)\n\t) {\n\t\tv = worstUserVerdict(v, \"BLOCKED\");\n\t}\n\tif (flags.includes(POLICY_FLAG.EVIDENCE_DAG_INCOMPLETE)) {\n\t\tv = worstUserVerdict(v, \"INCONCLUSIVE\");\n\t}\n\tif (\n\t\tpreviewOnly &&\n\t\t(flags.includes(POLICY_FLAG.REPRO_OVERFIT_SUSPECT) || flags.includes(POLICY_FLAG.LOW_DISCRIMINATION))\n\t) {\n\t\tv = worstUserVerdict(v, \"ADVISORY\");\n\t}\n\treturn v === \"PASS\" && flags.length === 0 ? null : v;\n}\n\nexport interface MapToB2CInput {\n\tkind: string;\n\tpacketId?: string;\n\tdispatchRecordId?: string;\n\trunIds: string[];\n\tpreviewOnly: boolean;\n\tpolicyFlags: PolicyFlag[];\n\tdiffPaths: string[];\n\tadjudication?: AdjudicationResult;\n\tevaluatedAt?: string;\n\trepairHints?: string[];\n}\n\nexport interface MapToB2COutput {\n\tverdictCard: VerdictCard;\n\treceipt: VerificationReceipt;\n}\n\nexport const BATCH1_NO_DOCKER_RUNNER = \"BATCH1_NO_DOCKER_RUNNER\" as const;\n\nfunction buildNextActions(verdict: UserVerdict, previewOnly: boolean, canApply: boolean): VerdictNextAction[] {\n\tif (verdict === \"BLOCKED\") {\n\t\treturn [\"Regenerate\"];\n\t}\n\tif (verdict === \"INCONCLUSIVE\") {\n\t\treturn previewOnly ? [\"Deep Check\", \"Regenerate\"] : [\"Deep Check\"];\n\t}\n\tif (verdict === \"ADVISORY\") {\n\t\treturn previewOnly ? [\"Deep Check\", \"Apply\"] : [\"Apply\"];\n\t}\n\tif (canApply) {\n\t\treturn [\"Apply\"];\n\t}\n\treturn [\"Deep Check\"];\n}\n\nfunction buildLimitsCode(previewOnly: boolean): string | undefined {\n\treturn previewOnly ? BATCH1_NO_DOCKER_RUNNER : undefined;\n}\n\nfunction buildDisclaimer(previewOnly: boolean, limitsCode: string | undefined): string | undefined {\n\tif (!previewOnly) {\n\t\treturn undefined;\n\t}\n\tconst code = limitsCode ?? BATCH1_NO_DOCKER_RUNNER;\n\treturn `Preview-only evaluation (${code}): no docker runner; apply and submit gates are conservative.`;\n}\n\nexport function mapToB2C(input: MapToB2CInput): MapToB2COutput {\n\tconst evaluatedAt = input.evaluatedAt ?? new Date().toISOString();\n\tlet userVerdict: UserVerdict = \"INCONCLUSIVE\";\n\tconst passed_checks: string[] = [];\n\tconst blocked_reasons: string[] = [];\n\n\tif (input.diffPaths.length === 0 && input.adjudication === undefined) {\n\t\tuserVerdict = \"INCONCLUSIVE\";\n\t\tblocked_reasons.push(\"No changed paths were found in the diff; cannot assess write scope.\");\n\t} else {\n\t\tuserVerdict = \"PASS\";\n\t}\n\n\tconst policyVerdict = userVerdictFromPolicyFlags(input.policyFlags, input.previewOnly);\n\tif (policyVerdict !== null) {\n\t\tuserVerdict = worstUserVerdict(userVerdict, policyVerdict);\n\t}\n\n\tif (input.policyFlags.includes(POLICY_FLAG.SECRET_SUSPECT)) {\n\t\tblocked_reasons.push(\"Diff lines may contain secrets or credentials; remove before proceeding.\");\n\t}\n\tif (input.policyFlags.includes(POLICY_FLAG.CANDIDATE_LEAK_SUSPECT)) {\n\t\tblocked_reasons.push(\"One or more changed paths fall outside the approved write scope.\");\n\t}\n\tif (input.policyFlags.includes(POLICY_FLAG.EVIDENCE_DAG_INCOMPLETE)) {\n\t\tblocked_reasons.push(\"Run evidence is required but was not evaluated in this receipt.\");\n\t}\n\tif (input.previewOnly && input.policyFlags.includes(POLICY_FLAG.LOW_DISCRIMINATION)) {\n\t\tblocked_reasons.push(\"Preview-only mode: discrimination against production evidence is limited.\");\n\t}\n\n\tif (input.adjudication !== undefined) {\n\t\tconst fromOa = verdictFromOa(input.adjudication.verdict);\n\t\tuserVerdict = worstUserVerdict(userVerdict, fromOa);\n\t\tconst strings = userStringsForReasonCode(input.adjudication.reason_code);\n\t\tpassed_checks.push(...strings.passed);\n\t\tblocked_reasons.push(...strings.blocked);\n\t} else if (userVerdict === \"PASS\" && input.diffPaths.length > 0) {\n\t\tpassed_checks.push(\"Changed paths are within approved write scope (fast wall).\");\n\t}\n\n\tconst limitsCode = buildLimitsCode(input.previewOnly);\n\tconst limits: VerdictLimits = {\n\t\trequiresHumanReview: userVerdict === \"BLOCKED\" || userVerdict === \"INCONCLUSIVE\",\n\t\tpreviewOnly: input.previewOnly,\n\t\tcode: limitsCode,\n\t};\n\n\tconst canApply =\n\t\tuserVerdict === \"PASS\" &&\n\t\t!input.policyFlags.includes(POLICY_FLAG.NON_NEGOTIABLE_BLOCKING) &&\n\t\t!input.policyFlags.includes(POLICY_FLAG.CANDIDATE_LEAK_SUSPECT) &&\n\t\t!input.policyFlags.includes(POLICY_FLAG.SECRET_SUSPECT) &&\n\t\t(input.adjudication === undefined || input.adjudication.verdict === \"CONFIRMED\");\n\n\tconst shouldSubmit =\n\t\tcanApply && !input.previewOnly && input.runIds.length > 0 && input.adjudication?.verdict === \"CONFIRMED\";\n\n\tconst disclaimer = buildDisclaimer(input.previewOnly, limitsCode);\n\n\tconst verdictCard: VerdictCard = {\n\t\tschemaVersion: B2C_VERDICT_SCHEMA_VERSION,\n\t\tverdict: userVerdict,\n\t\trisk: riskFromUserVerdict(userVerdict, input.policyFlags),\n\t\tlimits,\n\t\tpassed_checks,\n\t\tblocked_reasons: [...new Set(blocked_reasons)],\n\t\tnext_actions: buildNextActions(userVerdict, input.previewOnly, canApply),\n\t\trepairHints: input.repairHints !== undefined && input.repairHints.length > 0 ? input.repairHints : undefined,\n\t\tpacketId: input.packetId,\n\t\tkind: input.kind,\n\t};\n\n\tconst receipt: VerificationReceipt = {\n\t\tschemaVersion: B2C_VERDICT_SCHEMA_VERSION,\n\t\tevaluatedAt,\n\t\tkind: input.kind,\n\t\tpacketId: input.packetId,\n\t\tdispatchRecordId: input.dispatchRecordId,\n\t\trunIds: input.runIds,\n\t\tpreviewOnly: input.previewOnly,\n\t\tcanApply,\n\t\tshouldSubmit,\n\t\tpolicyFlags: [...input.policyFlags],\n\t\tadjudicationVerdict: input.adjudication?.verdict,\n\t\tadjudicationReasonCode: input.adjudication?.reason_code,\n\t\tdiffPaths: input.diffPaths,\n\t\tdisclaimer,\n\t};\n\n\treturn { verdictCard, receipt };\n}\n"]}
|
package/dist/deep-wall.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deep-wall.d.ts","sourceRoot":"","sources":["../src/deep-wall.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAE1D,MAAM,MAAM,cAAc,GAAG,eAAe,GAAG,aAAa,GAAG,WAAW,CAAC;AAE3E,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE9C,eAAO,MAAM,qBAAqB,yBAAmC,CAAC;AAEtE,8FAA8F;AAC9F,eAAO,MAAM,qBAAqB,yBAAmC,CAAC;AAEtE,oGAAoG;AACpG,eAAO,MAAM,4BAA4B,gCAA0C,CAAC;AAEpF,kFAAkF;AAClF,eAAO,MAAM,iBAAiB,qBAA+B,CAAC;AAE9D,wEAAwE;AACxE,MAAM,WAAW,sBAAsB;IACtC,iFAAiF;IACjF,MAAM,EAAE,MAAM,CAAC;IACf,wDAAwD;IACxD,OAAO,EAAE,MAAM,CAAC;IAChB,qEAAqE;IACrE,QAAQ,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,oBAAoB;IACpC,MAAM,EAAE,WAAW,GAAG,aAAa,C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C3B,iGAAiG;IACjG,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAChC;AAsBD,8EAA8E;AAC9E,wBAAgB,2BAA2B,IAAI,aAAa,CAI3D;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,IAAI,OAAO,CAEvD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,qBAAqB,GAAG,kBAAkB,CAQjF;AAED;;;;;;;;;GASG;AACH,wBAAsB,WAAW,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,cAAc,CAAC,CA6BxF","sourcesContent":["/**\n * Deep Correctness Wall — stub default, plus evidence-gated runner injection (Wave 4-C3b).\n *\n * `completed` is NEVER emitted unless a caller injects a `runner`, sets\n * `allowCompletion`, AND the runner returns structured evidence. Without all\n * three, the result is downgraded to `unavailable`. This is a candidate-patch-leak\n * guard: deep completion must be evidence-backed, never asserted.\n */\n\nimport { BATCH1_NO_DOCKER_RUNNER } from \"./b2c-mapper.ts\";\n\nexport type DeepWallStatus = \"not_requested\" | \"unavailable\" | \"completed\";\n\nexport type DeepWallPhase = \"stub\" | \"docker\";\n\nexport const DEEP_WALL_UNAVAILABLE = \"DEEP_WALL_UNAVAILABLE\" as const;\n\n/** Policy flag when deep wall would report completed without a wired runner (Wave 4 gate). */\nexport const DEEP_RUNNER_NOT_WIRED = \"DEEP_RUNNER_NOT_WIRED\" as const;\n\n/** Policy flag when an injected runner returned `completed` without valid evidence (downgraded). */\nexport const DEEP_RUNNER_EVIDENCE_MISSING = \"DEEP_RUNNER_EVIDENCE_MISSING\" as const;\n\n/** Policy flag when an injected runner threw (caught, treated as unavailable). */\nexport const DEEP_RUNNER_ERROR = \"DEEP_RUNNER_ERROR\" as const;\n\n/** Structured evidence a runner MUST attach to a `completed` result. */\nexport interface DeepWallRunnerEvidence {\n\t/** Content digest of what was checked (e.g. sha256 of replayed patch + base). */\n\tdigest: string;\n\t/** The exact command/provenance the runner executed. */\n\tcommand: string;\n\t/** Runner exit code; `completed` requires `0` by runner contract. */\n\texitCode: number;\n}\n\nexport interface DeepWallRunnerResult {\n\tstatus: \"completed\" | \"unavailable\";\n\tevidence?: DeepWallRunnerEvidence;\n\tmessage: string;\n}\n\nexport type DeepWallRunnerFn = (params: RunDeepWallStubParams) => Promise<DeepWallRunnerResult>;\n\nexport interface RunDeepWallStubParams {\n\tkind: string;\n\trunIds?: string[];\n\tpacketId?: string;\n\t/** Wave 3: `docker` records intent; runner still unavailable until hermetic exec ships. */\n\tphase?: DeepWallPhase;\n\t/** Wave 4-C3b: injected hermetic runner. Completion is gated by `allowCompletion` + evidence. */\n\trunner?: DeepWallRunnerFn;\n\t/** Must be `true` for a runner to report `completed`; default `false` (stub path). */\n\tallowCompletion?: boolean;\n}\n\nexport interface DeepWallStubResult {\n\tstatus: Extract<DeepWallStatus, \"unavailable\">;\n\tlimits: readonly [typeof BATCH1_NO_DOCKER_RUNNER];\n\tmessage: string;\n}\n\nexport interface DeepWallResult {\n\tstatus: DeepWallStatus;\n\tmessage: string;\n\tevidence?: DeepWallRunnerEvidence;\n\tlimits?: readonly string[];\n\t/** Additional policy flags surfaced by the runner path (e.g. evidence-missing, runner-error). */\n\trunnerFlags?: readonly string[];\n}\n\nconst DEFAULT_DEEP_WALL_MESSAGE =\n\t\"Deep correctness check is not available in this environment (no docker runner). Use preview fast wall or run checks locally.\";\n\nconst DOCKER_PHASE_MESSAGE =\n\t\"Deep wall docker phase requested but hermetic runner is not wired yet; fast wall and local CI remain authoritative.\";\n\nfunction hasValidEvidence(e: unknown): e is DeepWallRunnerEvidence {\n\tif (typeof e !== \"object\" || e === null) return false;\n\treturn (\n\t\t\"digest\" in e &&\n\t\ttypeof e.digest === \"string\" &&\n\t\te.digest.trim().length > 0 &&\n\t\t\"command\" in e &&\n\t\ttypeof e.command === \"string\" &&\n\t\te.command.trim().length > 0 &&\n\t\t\"exitCode\" in e &&\n\t\te.exitCode === 0\n\t);\n}\n\n/** Resolve deep-wall phase from env `OMK_WALL_DEEP_PHASE` (stub | docker). */\nexport function resolveDeepWallPhaseFromEnv(): DeepWallPhase {\n\tconst raw = process.env.OMK_WALL_DEEP_PHASE?.trim().toLowerCase();\n\tif (raw === \"docker\") return \"docker\";\n\treturn \"stub\";\n}\n\n/**\n * Hermetic deep runner is not shipped by default; `completed` is only reachable\n * via an injected runner through {@link runDeepWall}, and even then requires evidence.\n */\nexport function isDeepRunnerCompletionAllowed(): boolean {\n\treturn false;\n}\n\n/**\n * Stub deep wall: always reports unavailable with batch-1 limit code (no docker exec).\n */\nexport function runDeepWallStub(params: RunDeepWallStubParams): DeepWallStubResult {\n\tconst phase = params.phase ?? resolveDeepWallPhaseFromEnv();\n\tconst message = phase === \"docker\" ? DOCKER_PHASE_MESSAGE : DEFAULT_DEEP_WALL_MESSAGE;\n\treturn {\n\t\tstatus: \"unavailable\",\n\t\tlimits: [BATCH1_NO_DOCKER_RUNNER],\n\t\tmessage,\n\t};\n}\n\n/**\n * Evidence-gated deep wall entry point.\n *\n * - No runner, or `allowCompletion !== true` → stub unavailable path.\n * - Runner present + `allowCompletion` → runner is called in a try/catch.\n * - `completed` + valid evidence → `completed` (evidence attached).\n * - `completed` without valid evidence → downgraded to `unavailable`\n * with `DEEP_RUNNER_EVIDENCE_MISSING` (candidate-patch-leak guard).\n * - runner throws → `unavailable` with `DEEP_RUNNER_ERROR`.\n */\nexport async function runDeepWall(params: RunDeepWallStubParams): Promise<DeepWallResult> {\n\tif (params.runner !== undefined && params.allowCompletion === true) {\n\t\ttry {\n\t\t\tconst result = await params.runner(params);\n\t\t\tif (result.status === \"completed\") {\n\t\t\t\tif (hasValidEvidence(result.evidence)) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tstatus: \"completed\",\n\t\t\t\t\t\tevidence: result.evidence,\n\t\t\t\t\t\tmessage: result.message,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tstatus: \"unavailable\",\n\t\t\t\t\tmessage: \"Deep runner reported completed without valid evidence; downgraded to unavailable.\",\n\t\t\t\t\trunnerFlags: [DEEP_RUNNER_EVIDENCE_MISSING],\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn { status: \"unavailable\", message: result.message };\n\t\t} catch (err) {\n\t\t\treturn {\n\t\t\t\tstatus: \"unavailable\",\n\t\t\t\tmessage: `Deep runner threw: ${err instanceof Error ? err.message : String(err)}`,\n\t\t\t\trunnerFlags: [DEEP_RUNNER_ERROR],\n\t\t\t};\n\t\t}\n\t}\n\tconst stub = runDeepWallStub(params);\n\treturn { status: stub.status, message: stub.message, limits: stub.limits };\n}\n"]}
|
package/dist/deep-wall.js
CHANGED
|
@@ -19,13 +19,14 @@ const DOCKER_PHASE_MESSAGE = "Deep wall docker phase requested but hermetic runn
|
|
|
19
19
|
function hasValidEvidence(e) {
|
|
20
20
|
if (typeof e !== "object" || e === null)
|
|
21
21
|
return false;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
return ("digest" in e &&
|
|
23
|
+
typeof e.digest === "string" &&
|
|
24
|
+
e.digest.trim().length > 0 &&
|
|
25
|
+
"command" in e &&
|
|
26
|
+
typeof e.command === "string" &&
|
|
27
|
+
e.command.trim().length > 0 &&
|
|
28
|
+
"exitCode" in e &&
|
|
29
|
+
e.exitCode === 0);
|
|
29
30
|
}
|
|
30
31
|
/** Resolve deep-wall phase from env `OMK_WALL_DEEP_PHASE` (stub | docker). */
|
|
31
32
|
export function resolveDeepWallPhaseFromEnv() {
|
package/dist/deep-wall.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deep-wall.js","sourceRoot":"","sources":["../src/deep-wall.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAM1D,MAAM,CAAC,MAAM,qBAAqB,GAAG,uBAAgC,CAAC;AAEtE,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AAE,WAAW;wBACnB,QAAQ,EAAE,MAAM,CAAC,QAAQ;wBACzB,OAAO,EAAE,MAAM,CAAC,OAAO;qBACvB,CAAC;gBACH,CAAC;gBACD,OAAO;oBACN,MAAM,EAAE,aAAa;oBACrB,OAAO,EAAE,mFAAmF;oBAC5F,WAAW,EAAE,CAAC,4BAA4B,CAAC;iBAC3C,CAAC;YACH,CAAC;YACD,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC;QAC3D,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACd,OAAO;gBACN,MAAM,EAAE,aAAa;gBACrB,OAAO,EAAE,sBAAsB,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE;gBACjF,WAAW,EAAE,CAAC,iBAAiB,CAAC;aAChC,CAAC;QACH,CAAC;IACF,CAAC;IACD,MAAM,IAAI,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;IACrC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;AAAA,CAC3E","sourcesContent":["/**\n * Deep Correctness Wall — stub default, plus evidence-gated runner injection (Wave 4-C3b).\n *\n * `completed` is NEVER emitted unless a caller injects a `runner`, sets\n * `allowCompletion`, AND the runner returns structured evidence. Without all\n * three, the result is downgraded to `unavailable`. This is a candidate-patch-leak\n * guard: deep completion must be evidence-backed, never asserted.\n */\n\nimport { BATCH1_NO_DOCKER_RUNNER } from \"./b2c-mapper.ts\";\n\nexport type DeepWallStatus = \"not_requested\" | \"unavailable\" | \"completed\";\n\nexport type DeepWallPhase = \"stub\" | \"docker\";\n\nexport const DEEP_WALL_UNAVAILABLE = \"DEEP_WALL_UNAVAILABLE\" as const;\n\n/** Policy flag when deep wall would report completed without a wired runner (Wave 4 gate). */\nexport const DEEP_RUNNER_NOT_WIRED = \"DEEP_RUNNER_NOT_WIRED\" as const;\n\n/** Policy flag when an injected runner returned `completed` without valid evidence (downgraded). */\nexport const DEEP_RUNNER_EVIDENCE_MISSING = \"DEEP_RUNNER_EVIDENCE_MISSING\" as const;\n\n/** Policy flag when an injected runner threw (caught, treated as unavailable). */\nexport const DEEP_RUNNER_ERROR = \"DEEP_RUNNER_ERROR\" as const;\n\n/** Structured evidence a runner MUST attach to a `completed` result. */\nexport interface DeepWallRunnerEvidence {\n\t/** Content digest of what was checked (e.g. sha256 of replayed patch + base). */\n\tdigest: string;\n\t/** The exact command/provenance the runner executed. */\n\tcommand: string;\n\t/** Runner exit code; `completed` requires `0` by runner contract. */\n\texitCode: number;\n}\n\nexport interface DeepWallRunnerResult {\n\tstatus: \"completed\" | \"unavailable\";\n\tevidence?: DeepWallRunnerEvidence;\n\tmessage: string;\n}\n\nexport type DeepWallRunnerFn = (params: RunDeepWallStubParams) => Promise<DeepWallRunnerResult>;\n\nexport interface RunDeepWallStubParams {\n\tkind: string;\n\trunIds?: string[];\n\tpacketId?: string;\n\t/** Wave 3: `docker` records intent; runner still unavailable until hermetic exec ships. */\n\tphase?: DeepWallPhase;\n\t/** Wave 4-C3b: injected hermetic runner. Completion is gated by `allowCompletion` + evidence. */\n\trunner?: DeepWallRunnerFn;\n\t/** Must be `true` for a runner to report `completed`; default `false` (stub path). */\n\tallowCompletion?: boolean;\n}\n\nexport interface DeepWallStubResult {\n\tstatus: Extract<DeepWallStatus, \"unavailable\">;\n\tlimits: readonly [typeof BATCH1_NO_DOCKER_RUNNER];\n\tmessage: string;\n}\n\nexport interface DeepWallResult {\n\tstatus: DeepWallStatus;\n\tmessage: string;\n\tevidence?: DeepWallRunnerEvidence;\n\tlimits?: readonly string[];\n\t/** Additional policy flags surfaced by the runner path (e.g. evidence-missing, runner-error). */\n\trunnerFlags?: readonly string[];\n}\n\nconst DEFAULT_DEEP_WALL_MESSAGE =\n\t\"Deep correctness check is not available in this environment (no docker runner). Use preview fast wall or run checks locally.\";\n\nconst DOCKER_PHASE_MESSAGE =\n\t\"Deep wall docker phase requested but hermetic runner is not wired yet; fast wall and local CI remain authoritative.\";\n\nfunction hasValidEvidence(e: unknown): e is DeepWallRunnerEvidence {\n\tif (typeof e !== \"object\" || e === null) return false;\n\treturn (\n\t\t\"digest\" in e &&\n\t\ttypeof e.digest === \"string\" &&\n\t\te.digest.trim().length > 0 &&\n\t\t\"command\" in e &&\n\t\ttypeof e.command === \"string\" &&\n\t\te.command.trim().length > 0 &&\n\t\t\"exitCode\" in e &&\n\t\te.exitCode === 0\n\t);\n}\n\n/** Resolve deep-wall phase from env `OMK_WALL_DEEP_PHASE` (stub | docker). */\nexport function resolveDeepWallPhaseFromEnv(): DeepWallPhase {\n\tconst raw = process.env.OMK_WALL_DEEP_PHASE?.trim().toLowerCase();\n\tif (raw === \"docker\") return \"docker\";\n\treturn \"stub\";\n}\n\n/**\n * Hermetic deep runner is not shipped by default; `completed` is only reachable\n * via an injected runner through {@link runDeepWall}, and even then requires evidence.\n */\nexport function isDeepRunnerCompletionAllowed(): boolean {\n\treturn false;\n}\n\n/**\n * Stub deep wall: always reports unavailable with batch-1 limit code (no docker exec).\n */\nexport function runDeepWallStub(params: RunDeepWallStubParams): DeepWallStubResult {\n\tconst phase = params.phase ?? resolveDeepWallPhaseFromEnv();\n\tconst message = phase === \"docker\" ? DOCKER_PHASE_MESSAGE : DEFAULT_DEEP_WALL_MESSAGE;\n\treturn {\n\t\tstatus: \"unavailable\",\n\t\tlimits: [BATCH1_NO_DOCKER_RUNNER],\n\t\tmessage,\n\t};\n}\n\n/**\n * Evidence-gated deep wall entry point.\n *\n * - No runner, or `allowCompletion !== true` → stub unavailable path.\n * - Runner present + `allowCompletion` → runner is called in a try/catch.\n * - `completed` + valid evidence → `completed` (evidence attached).\n * - `completed` without valid evidence → downgraded to `unavailable`\n * with `DEEP_RUNNER_EVIDENCE_MISSING` (candidate-patch-leak guard).\n * - runner throws → `unavailable` with `DEEP_RUNNER_ERROR`.\n */\nexport async function runDeepWall(params: RunDeepWallStubParams): Promise<DeepWallResult> {\n\tif (params.runner !== undefined && params.allowCompletion === true) {\n\t\ttry {\n\t\t\tconst result = await params.runner(params);\n\t\t\tif (result.status === \"completed\") {\n\t\t\t\tif (hasValidEvidence(result.evidence)) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tstatus: \"completed\",\n\t\t\t\t\t\tevidence: result.evidence,\n\t\t\t\t\t\tmessage: result.message,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tstatus: \"unavailable\",\n\t\t\t\t\tmessage: \"Deep runner reported completed without valid evidence; downgraded to unavailable.\",\n\t\t\t\t\trunnerFlags: [DEEP_RUNNER_EVIDENCE_MISSING],\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn { status: \"unavailable\", message: result.message };\n\t\t} catch (err) {\n\t\t\treturn {\n\t\t\t\tstatus: \"unavailable\",\n\t\t\t\tmessage: `Deep runner threw: ${err instanceof Error ? err.message : String(err)}`,\n\t\t\t\trunnerFlags: [DEEP_RUNNER_ERROR],\n\t\t\t};\n\t\t}\n\t}\n\tconst stub = runDeepWallStub(params);\n\treturn { status: stub.status, message: stub.message, limits: stub.limits };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evaluate-correctness-wall.d.ts","sourceRoot":"","sources":["../src/evaluate-correctness-wall.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,OAAO,EAA0B,KAAK,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAE/F,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAGN,KAAK,gBAAgB,EAIrB,MAAM,gBAAgB,CAAC;AAOxB,MAAM,WAAW,6BAA6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IACb,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,wFAAwF;IACxF,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,QAAQ,CAAC,EAAE;QAAE,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,qBAAqB,CAAA;KAAE,CAAC;IACxD,oEAAoE;IACpE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sGAAsG;IACtG,cAAc,CAAC,EAAE,gBAAgB,CAAC;IAClC,qDAAqD;IACrD,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,2EAA2E;IAC3E,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,6BAA6B;IAC7C,WAAW,EAAE,WAAW,CAAC;IACzB,OAAO,EAAE,mBAAmB,CAAC;CAC7B;AAED,wBAAsB,uBAAuB,CAC5C,MAAM,EAAE,6BAA6B,GACnC,OAAO,CAAC,6BAA6B,CAAC,CA6HxC","sourcesContent":["/**\n * B2C Correctness Wall orchestration — fast wall + optional OA adjudication.\n */\n\nimport type { AdaptOrchClient } from \"./adaptorch-client.ts\";\nimport { type AdjudicationRequest, adjudicate } from \"./adjudicator.ts\";\nimport { createVerifierRegistry, type VerifierRegistryEntry } from \"./adjudicator-registry.ts\";\nimport { mapToB2C } from \"./b2c-mapper.ts\";\nimport type { VerdictCard, VerificationReceipt } from \"./b2c-verdict.ts\";\nimport {\n\tDEEP_RUNNER_NOT_WIRED,\n\tDEEP_WALL_UNAVAILABLE,\n\ttype DeepWallRunnerFn,\n\tisDeepRunnerCompletionAllowed,\n\tresolveDeepWallPhaseFromEnv,\n\trunDeepWall,\n} from \"./deep-wall.ts\";\nimport { runFastWall } from \"./policy-wall.ts\";\nimport { signWallReceipt } from \"./receipt-signature.ts\";\nimport { deriveRepairHints } from \"./repair-loop.ts\";\nimport { buildVerificationDigest } from \"./signed-receipt.ts\";\nimport { CORRECTNESS_WALL_VERSION } from \"./wall-meta.ts\";\n\nexport interface EvaluateCorrectnessWallParams {\n\tkind: string;\n\trunIds?: string[];\n\tdispatchRecordId?: string;\n\tapprovedWriteScope?: string[];\n\tpreviewOnly?: boolean;\n\tdiffText?: string;\n\tpacketId?: string;\n\t/** When set with non-empty runIds and previewOnly false, OA adjudication is invoked. */\n\tclient?: AdaptOrchClient;\n\tregistry?: { get(kind: string): VerifierRegistryEntry };\n\t/** When true, merge deep-wall result into limits / policy flags. */\n\tdeepWall?: boolean;\n\t/** Wave 4-C3b: injected hermetic runner. Completion gated by `deepWallAllowCompletion` + evidence. */\n\tdeepWallRunner?: DeepWallRunnerFn;\n\t/** Must be true for a runner to emit `completed`. */\n\tdeepWallAllowCompletion?: boolean;\n\t/** When set, attach HMAC signed receipt attestation (never log secret). */\n\treceiptSigningSecret?: string;\n}\n\nexport interface EvaluateCorrectnessWallResult {\n\tverdictCard: VerdictCard;\n\treceipt: VerificationReceipt;\n}\n\nexport async function evaluateCorrectnessWall(\n\tparams: EvaluateCorrectnessWallParams,\n): Promise<EvaluateCorrectnessWallResult> {\n\tconst runIds = params.runIds ?? [];\n\tconst previewOnly = params.previewOnly === true;\n\tconst registry = params.registry ?? createVerifierRegistry([]);\n\n\tconst wall = runFastWall({\n\t\tdiffText: params.diffText,\n\t\tapprovedWriteScope: params.approvedWriteScope,\n\t\trunIds,\n\t\tpreviewOnly,\n\t});\n\n\tlet adjudication: Awaited<ReturnType<typeof adjudicate>> | undefined;\n\tconst useOa = runIds.length > 0 && !previewOnly && params.client !== undefined;\n\tif (useOa && params.client !== undefined) {\n\t\tconst request: AdjudicationRequest = {\n\t\t\tdispatch_record_id: params.dispatchRecordId ?? \"b2c-wall\",\n\t\t\tkind: params.kind,\n\t\t\trun_ids: runIds,\n\t\t};\n\t\tadjudication = await adjudicate(request, params.client, registry);\n\t}\n\n\tlet policyFlags = wall.flags;\n\tif (adjudication !== undefined) {\n\t\tpolicyFlags = wall.flags.filter((f) => f !== \"EVIDENCE_DAG_INCOMPLETE\");\n\t}\n\n\tconst provisional = mapToB2C({\n\t\tkind: params.kind,\n\t\tpacketId: params.packetId,\n\t\tdispatchRecordId: params.dispatchRecordId,\n\t\trunIds,\n\t\tpreviewOnly,\n\t\tpolicyFlags,\n\t\tdiffPaths: wall.diffPaths,\n\t\tadjudication,\n\t});\n\n\tconst repairHints = deriveRepairHints({\n\t\tuserVerdict: provisional.verdictCard.verdict,\n\t\tpolicyFlags,\n\t\tadjudicationReasonCode: adjudication?.reason_code,\n\t\tpreviewOnly,\n\t\tdiffPaths: wall.diffPaths,\n\t});\n\n\tconst mapped = mapToB2C({\n\t\tkind: params.kind,\n\t\tpacketId: params.packetId,\n\t\tdispatchRecordId: params.dispatchRecordId,\n\t\trunIds,\n\t\tpreviewOnly,\n\t\tpolicyFlags,\n\t\tdiffPaths: wall.diffPaths,\n\t\tadjudication,\n\t\trepairHints,\n\t});\n\n\tconst verificationDigest = buildVerificationDigest({\n\t\tpatchText: params.diffText,\n\t\tevidenceChunks: runIds.length > 0 ? runIds : undefined,\n\t\twallVersion: CORRECTNESS_WALL_VERSION,\n\t});\n\n\tlet verdictCard = mapped.verdictCard;\n\tlet receipt: VerificationReceipt = {\n\t\t...mapped.receipt,\n\t\tverificationDigest,\n\t\twallVersion: CORRECTNESS_WALL_VERSION,\n\t};\n\n\tconst signingSecret = params.receiptSigningSecret?.trim();\n\tif (signingSecret !== undefined && signingSecret.length > 0 && verificationDigest !== undefined) {\n\t\treceipt = {\n\t\t\t...receipt,\n\t\t\tsignedReceipt: signWallReceipt({\n\t\t\t\tdigest: verificationDigest,\n\t\t\t\twallVersion: CORRECTNESS_WALL_VERSION,\n\t\t\t\tsecret: signingSecret,\n\t\t\t}),\n\t\t};\n\t}\n\n\tif (params.deepWall === true) {\n\t\tconst deep = await runDeepWall({\n\t\t\tkind: params.kind,\n\t\t\trunIds,\n\t\t\tpacketId: params.packetId,\n\t\t\tphase: resolveDeepWallPhaseFromEnv(),\n\t\t\trunner: params.deepWallRunner,\n\t\t\tallowCompletion: params.deepWallAllowCompletion,\n\t\t});\n\t\tconst policyFlags = [...receipt.policyFlags];\n\t\tif (deep.status !== \"completed\") {\n\t\t\tif (!policyFlags.includes(DEEP_WALL_UNAVAILABLE)) {\n\t\t\t\tpolicyFlags.push(DEEP_WALL_UNAVAILABLE);\n\t\t\t}\n\t\t\tif (!isDeepRunnerCompletionAllowed() && !policyFlags.includes(DEEP_RUNNER_NOT_WIRED)) {\n\t\t\t\tpolicyFlags.push(DEEP_RUNNER_NOT_WIRED);\n\t\t\t}\n\t\t}\n\t\tfor (const f of deep.runnerFlags ?? []) {\n\t\t\tif (!policyFlags.includes(f as never)) policyFlags.push(f as never);\n\t\t}\n\t\tconst limitsCode = deep.limits?.[0] ?? verdictCard.limits.code;\n\t\tverdictCard = {\n\t\t\t...verdictCard,\n\t\t\tlimits: {\n\t\t\t\t...verdictCard.limits,\n\t\t\t\trequiresHumanReview: verdictCard.limits.requiresHumanReview || deep.status !== \"completed\",\n\t\t\t\tcode: limitsCode ?? verdictCard.limits.code,\n\t\t\t},\n\t\t\tblocked_reasons: [...new Set([...verdictCard.blocked_reasons, deep.message])],\n\t\t};\n\t\treceipt = {\n\t\t\t...receipt,\n\t\t\tpolicyFlags,\n\t\t\tshouldSubmit: receipt.shouldSubmit && deep.status === \"completed\",\n\t\t\tdeepWallStatus: deep.status,\n\t\t\tdeepWallEvidence: deep.evidence,\n\t\t};\n\t}\n\n\treturn { verdictCard, receipt };\n}\n"]}
|
|
@@ -111,7 +111,7 @@ export async function evaluateCorrectnessWall(params) {
|
|
|
111
111
|
...verdictCard,
|
|
112
112
|
limits: {
|
|
113
113
|
...verdictCard.limits,
|
|
114
|
-
requiresHumanReview: deep.status !== "completed",
|
|
114
|
+
requiresHumanReview: verdictCard.limits.requiresHumanReview || deep.status !== "completed",
|
|
115
115
|
code: limitsCode ?? verdictCard.limits.code,
|
|
116
116
|
},
|
|
117
117
|
blocked_reasons: [...new Set([...verdictCard.blocked_reasons, deep.message])],
|
|
@@ -119,6 +119,7 @@ export async function evaluateCorrectnessWall(params) {
|
|
|
119
119
|
receipt = {
|
|
120
120
|
...receipt,
|
|
121
121
|
policyFlags,
|
|
122
|
+
shouldSubmit: receipt.shouldSubmit && deep.status === "completed",
|
|
122
123
|
deepWallStatus: deep.status,
|
|
123
124
|
deepWallEvidence: deep.evidence,
|
|
124
125
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evaluate-correctness-wall.js","sourceRoot":"","sources":["../src/evaluate-correctness-wall.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAA4B,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAA8B,MAAM,2BAA2B,CAAC;AAC/F,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C,OAAO,EACN,qBAAqB,EACrB,qBAAqB,EAErB,6BAA6B,EAC7B,2BAA2B,EAC3B,WAAW,GACX,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AA4B1D,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC5C,MAAqC,EACI;IACzC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC;IACnC,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,KAAK,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AAI,CAAC,OAAO,CAAC,CAAC,CAAC;SAC7E,CAAC;QACF,OAAO,GAAG;YACT,GAAG,OAAO;YACV,WAAW;YACX,cAAc,EAAE,IAAI,CAAC,MAAM;YAC3B,gBAAgB,EAAE,IAAI,CAAC,QAAQ;SAC/B,CAAC;IACH,CAAC;IAED,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC;AAAA,CAChC","sourcesContent":["/**\n * B2C Correctness Wall orchestration — fast wall + optional OA adjudication.\n */\n\nimport type { AdaptOrchClient } from \"./adaptorch-client.ts\";\nimport { type AdjudicationRequest, adjudicate } from \"./adjudicator.ts\";\nimport { createVerifierRegistry, type VerifierRegistryEntry } from \"./adjudicator-registry.ts\";\nimport { mapToB2C } from \"./b2c-mapper.ts\";\nimport type { VerdictCard, VerificationReceipt } from \"./b2c-verdict.ts\";\nimport {\n\tDEEP_RUNNER_NOT_WIRED,\n\tDEEP_WALL_UNAVAILABLE,\n\ttype DeepWallRunnerFn,\n\tisDeepRunnerCompletionAllowed,\n\tresolveDeepWallPhaseFromEnv,\n\trunDeepWall,\n} from \"./deep-wall.ts\";\nimport { runFastWall } from \"./policy-wall.ts\";\nimport { signWallReceipt } from \"./receipt-signature.ts\";\nimport { deriveRepairHints } from \"./repair-loop.ts\";\nimport { buildVerificationDigest } from \"./signed-receipt.ts\";\nimport { CORRECTNESS_WALL_VERSION } from \"./wall-meta.ts\";\n\nexport interface EvaluateCorrectnessWallParams {\n\tkind: string;\n\trunIds?: string[];\n\tdispatchRecordId?: string;\n\tapprovedWriteScope?: string[];\n\tpreviewOnly?: boolean;\n\tdiffText?: string;\n\tpacketId?: string;\n\t/** When set with non-empty runIds and previewOnly false, OA adjudication is invoked. */\n\tclient?: AdaptOrchClient;\n\tregistry?: { get(kind: string): VerifierRegistryEntry };\n\t/** When true, merge deep-wall result into limits / policy flags. */\n\tdeepWall?: boolean;\n\t/** Wave 4-C3b: injected hermetic runner. Completion gated by `deepWallAllowCompletion` + evidence. */\n\tdeepWallRunner?: DeepWallRunnerFn;\n\t/** Must be true for a runner to emit `completed`. */\n\tdeepWallAllowCompletion?: boolean;\n\t/** When set, attach HMAC signed receipt attestation (never log secret). */\n\treceiptSigningSecret?: string;\n}\n\nexport interface EvaluateCorrectnessWallResult {\n\tverdictCard: VerdictCard;\n\treceipt: VerificationReceipt;\n}\n\nexport async function evaluateCorrectnessWall(\n\tparams: EvaluateCorrectnessWallParams,\n): Promise<EvaluateCorrectnessWallResult> {\n\tconst runIds = params.runIds ?? [];\n\tconst previewOnly = params.previewOnly === true;\n\tconst registry = params.registry ?? createVerifierRegistry([]);\n\n\tconst wall = runFastWall({\n\t\tdiffText: params.diffText,\n\t\tapprovedWriteScope: params.approvedWriteScope,\n\t\trunIds,\n\t\tpreviewOnly,\n\t});\n\n\tlet adjudication: Awaited<ReturnType<typeof adjudicate>> | undefined;\n\tconst useOa = runIds.length > 0 && !previewOnly && params.client !== undefined;\n\tif (useOa && params.client !== undefined) {\n\t\tconst request: AdjudicationRequest = {\n\t\t\tdispatch_record_id: params.dispatchRecordId ?? \"b2c-wall\",\n\t\t\tkind: params.kind,\n\t\t\trun_ids: runIds,\n\t\t};\n\t\tadjudication = await adjudicate(request, params.client, registry);\n\t}\n\n\tlet policyFlags = wall.flags;\n\tif (adjudication !== undefined) {\n\t\tpolicyFlags = wall.flags.filter((f) => f !== \"EVIDENCE_DAG_INCOMPLETE\");\n\t}\n\n\tconst provisional = mapToB2C({\n\t\tkind: params.kind,\n\t\tpacketId: params.packetId,\n\t\tdispatchRecordId: params.dispatchRecordId,\n\t\trunIds,\n\t\tpreviewOnly,\n\t\tpolicyFlags,\n\t\tdiffPaths: wall.diffPaths,\n\t\tadjudication,\n\t});\n\n\tconst repairHints = deriveRepairHints({\n\t\tuserVerdict: provisional.verdictCard.verdict,\n\t\tpolicyFlags,\n\t\tadjudicationReasonCode: adjudication?.reason_code,\n\t\tpreviewOnly,\n\t\tdiffPaths: wall.diffPaths,\n\t});\n\n\tconst mapped = mapToB2C({\n\t\tkind: params.kind,\n\t\tpacketId: params.packetId,\n\t\tdispatchRecordId: params.dispatchRecordId,\n\t\trunIds,\n\t\tpreviewOnly,\n\t\tpolicyFlags,\n\t\tdiffPaths: wall.diffPaths,\n\t\tadjudication,\n\t\trepairHints,\n\t});\n\n\tconst verificationDigest = buildVerificationDigest({\n\t\tpatchText: params.diffText,\n\t\tevidenceChunks: runIds.length > 0 ? runIds : undefined,\n\t\twallVersion: CORRECTNESS_WALL_VERSION,\n\t});\n\n\tlet verdictCard = mapped.verdictCard;\n\tlet receipt: VerificationReceipt = {\n\t\t...mapped.receipt,\n\t\tverificationDigest,\n\t\twallVersion: CORRECTNESS_WALL_VERSION,\n\t};\n\n\tconst signingSecret = params.receiptSigningSecret?.trim();\n\tif (signingSecret !== undefined && signingSecret.length > 0 && verificationDigest !== undefined) {\n\t\treceipt = {\n\t\t\t...receipt,\n\t\t\tsignedReceipt: signWallReceipt({\n\t\t\t\tdigest: verificationDigest,\n\t\t\t\twallVersion: CORRECTNESS_WALL_VERSION,\n\t\t\t\tsecret: signingSecret,\n\t\t\t}),\n\t\t};\n\t}\n\n\tif (params.deepWall === true) {\n\t\tconst deep = await runDeepWall({\n\t\t\tkind: params.kind,\n\t\t\trunIds,\n\t\t\tpacketId: params.packetId,\n\t\t\tphase: resolveDeepWallPhaseFromEnv(),\n\t\t\trunner: params.deepWallRunner,\n\t\t\tallowCompletion: params.deepWallAllowCompletion,\n\t\t});\n\t\tconst policyFlags = [...receipt.policyFlags];\n\t\tif (deep.status !== \"completed\") {\n\t\t\tif (!policyFlags.includes(DEEP_WALL_UNAVAILABLE)) {\n\t\t\t\tpolicyFlags.push(DEEP_WALL_UNAVAILABLE);\n\t\t\t}\n\t\t\tif (!isDeepRunnerCompletionAllowed() && !policyFlags.includes(DEEP_RUNNER_NOT_WIRED)) {\n\t\t\t\tpolicyFlags.push(DEEP_RUNNER_NOT_WIRED);\n\t\t\t}\n\t\t}\n\t\tfor (const f of deep.runnerFlags ?? []) {\n\t\t\tif (!policyFlags.includes(f as never)) policyFlags.push(f as never);\n\t\t}\n\t\tconst limitsCode = deep.limits?.[0] ?? verdictCard.limits.code;\n\t\tverdictCard = {\n\t\t\t...verdictCard,\n\t\t\tlimits: {\n\t\t\t\t...verdictCard.limits,\n\t\t\t\trequiresHumanReview: deep.status !== \"completed\",\n\t\t\t\tcode: limitsCode ?? verdictCard.limits.code,\n\t\t\t},\n\t\t\tblocked_reasons: [...new Set([...verdictCard.blocked_reasons, deep.message])],\n\t\t};\n\t\treceipt = {\n\t\t\t...receipt,\n\t\t\tpolicyFlags,\n\t\t\tdeepWallStatus: deep.status,\n\t\t\tdeepWallEvidence: deep.evidence,\n\t\t};\n\t}\n\n\treturn { verdictCard, receipt };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"evaluate-correctness-wall.js","sourceRoot":"","sources":["../src/evaluate-correctness-wall.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAA4B,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAA8B,MAAM,2BAA2B,CAAC;AAC/F,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C,OAAO,EACN,qBAAqB,EACrB,qBAAqB,EAErB,6BAA6B,EAC7B,2BAA2B,EAC3B,WAAW,GACX,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AA4B1D,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC5C,MAAqC,EACI;IACzC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,EAAE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AI;aAC3C;YACD,eAAe,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,WAAW,CAAC,eAAe,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;SAC7E,CAAC;QACF,OAAO,GAAG;YACT,GAAG,OAAO;YACV,WAAW;YACX,YAAY,EAAE,OAAO,CAAC,YAAY,IAAI,IAAI,CAAC,MAAM,KAAK,WAAW;YACjE,cAAc,EAAE,IAAI,CAAC,MAAM;YAC3B,gBAAgB,EAAE,IAAI,CAAC,QAAQ;SAC/B,CAAC;IACH,CAAC;IAED,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC;AAAA,CAChC","sourcesContent":["/**\n * B2C Correctness Wall orchestration — fast wall + optional OA adjudication.\n */\n\nimport type { AdaptOrchClient } from \"./adaptorch-client.ts\";\nimport { type AdjudicationRequest, adjudicate } from \"./adjudicator.ts\";\nimport { createVerifierRegistry, type VerifierRegistryEntry } from \"./adjudicator-registry.ts\";\nimport { mapToB2C } from \"./b2c-mapper.ts\";\nimport type { VerdictCard, VerificationReceipt } from \"./b2c-verdict.ts\";\nimport {\n\tDEEP_RUNNER_NOT_WIRED,\n\tDEEP_WALL_UNAVAILABLE,\n\ttype DeepWallRunnerFn,\n\tisDeepRunnerCompletionAllowed,\n\tresolveDeepWallPhaseFromEnv,\n\trunDeepWall,\n} from \"./deep-wall.ts\";\nimport { runFastWall } from \"./policy-wall.ts\";\nimport { signWallReceipt } from \"./receipt-signature.ts\";\nimport { deriveRepairHints } from \"./repair-loop.ts\";\nimport { buildVerificationDigest } from \"./signed-receipt.ts\";\nimport { CORRECTNESS_WALL_VERSION } from \"./wall-meta.ts\";\n\nexport interface EvaluateCorrectnessWallParams {\n\tkind: string;\n\trunIds?: string[];\n\tdispatchRecordId?: string;\n\tapprovedWriteScope?: string[];\n\tpreviewOnly?: boolean;\n\tdiffText?: string;\n\tpacketId?: string;\n\t/** When set with non-empty runIds and previewOnly false, OA adjudication is invoked. */\n\tclient?: AdaptOrchClient;\n\tregistry?: { get(kind: string): VerifierRegistryEntry };\n\t/** When true, merge deep-wall result into limits / policy flags. */\n\tdeepWall?: boolean;\n\t/** Wave 4-C3b: injected hermetic runner. Completion gated by `deepWallAllowCompletion` + evidence. */\n\tdeepWallRunner?: DeepWallRunnerFn;\n\t/** Must be true for a runner to emit `completed`. */\n\tdeepWallAllowCompletion?: boolean;\n\t/** When set, attach HMAC signed receipt attestation (never log secret). */\n\treceiptSigningSecret?: string;\n}\n\nexport interface EvaluateCorrectnessWallResult {\n\tverdictCard: VerdictCard;\n\treceipt: VerificationReceipt;\n}\n\nexport async function evaluateCorrectnessWall(\n\tparams: EvaluateCorrectnessWallParams,\n): Promise<EvaluateCorrectnessWallResult> {\n\tconst runIds = params.runIds ?? [];\n\tconst previewOnly = params.previewOnly === true;\n\tconst registry = params.registry ?? createVerifierRegistry([]);\n\n\tconst wall = runFastWall({\n\t\tdiffText: params.diffText,\n\t\tapprovedWriteScope: params.approvedWriteScope,\n\t\trunIds,\n\t\tpreviewOnly,\n\t});\n\n\tlet adjudication: Awaited<ReturnType<typeof adjudicate>> | undefined;\n\tconst useOa = runIds.length > 0 && !previewOnly && params.client !== undefined;\n\tif (useOa && params.client !== undefined) {\n\t\tconst request: AdjudicationRequest = {\n\t\t\tdispatch_record_id: params.dispatchRecordId ?? \"b2c-wall\",\n\t\t\tkind: params.kind,\n\t\t\trun_ids: runIds,\n\t\t};\n\t\tadjudication = await adjudicate(request, params.client, registry);\n\t}\n\n\tlet policyFlags = wall.flags;\n\tif (adjudication !== undefined) {\n\t\tpolicyFlags = wall.flags.filter((f) => f !== \"EVIDENCE_DAG_INCOMPLETE\");\n\t}\n\n\tconst provisional = mapToB2C({\n\t\tkind: params.kind,\n\t\tpacketId: params.packetId,\n\t\tdispatchRecordId: params.dispatchRecordId,\n\t\trunIds,\n\t\tpreviewOnly,\n\t\tpolicyFlags,\n\t\tdiffPaths: wall.diffPaths,\n\t\tadjudication,\n\t});\n\n\tconst repairHints = deriveRepairHints({\n\t\tuserVerdict: provisional.verdictCard.verdict,\n\t\tpolicyFlags,\n\t\tadjudicationReasonCode: adjudication?.reason_code,\n\t\tpreviewOnly,\n\t\tdiffPaths: wall.diffPaths,\n\t});\n\n\tconst mapped = mapToB2C({\n\t\tkind: params.kind,\n\t\tpacketId: params.packetId,\n\t\tdispatchRecordId: params.dispatchRecordId,\n\t\trunIds,\n\t\tpreviewOnly,\n\t\tpolicyFlags,\n\t\tdiffPaths: wall.diffPaths,\n\t\tadjudication,\n\t\trepairHints,\n\t});\n\n\tconst verificationDigest = buildVerificationDigest({\n\t\tpatchText: params.diffText,\n\t\tevidenceChunks: runIds.length > 0 ? runIds : undefined,\n\t\twallVersion: CORRECTNESS_WALL_VERSION,\n\t});\n\n\tlet verdictCard = mapped.verdictCard;\n\tlet receipt: VerificationReceipt = {\n\t\t...mapped.receipt,\n\t\tverificationDigest,\n\t\twallVersion: CORRECTNESS_WALL_VERSION,\n\t};\n\n\tconst signingSecret = params.receiptSigningSecret?.trim();\n\tif (signingSecret !== undefined && signingSecret.length > 0 && verificationDigest !== undefined) {\n\t\treceipt = {\n\t\t\t...receipt,\n\t\t\tsignedReceipt: signWallReceipt({\n\t\t\t\tdigest: verificationDigest,\n\t\t\t\twallVersion: CORRECTNESS_WALL_VERSION,\n\t\t\t\tsecret: signingSecret,\n\t\t\t}),\n\t\t};\n\t}\n\n\tif (params.deepWall === true) {\n\t\tconst deep = await runDeepWall({\n\t\t\tkind: params.kind,\n\t\t\trunIds,\n\t\t\tpacketId: params.packetId,\n\t\t\tphase: resolveDeepWallPhaseFromEnv(),\n\t\t\trunner: params.deepWallRunner,\n\t\t\tallowCompletion: params.deepWallAllowCompletion,\n\t\t});\n\t\tconst policyFlags = [...receipt.policyFlags];\n\t\tif (deep.status !== \"completed\") {\n\t\t\tif (!policyFlags.includes(DEEP_WALL_UNAVAILABLE)) {\n\t\t\t\tpolicyFlags.push(DEEP_WALL_UNAVAILABLE);\n\t\t\t}\n\t\t\tif (!isDeepRunnerCompletionAllowed() && !policyFlags.includes(DEEP_RUNNER_NOT_WIRED)) {\n\t\t\t\tpolicyFlags.push(DEEP_RUNNER_NOT_WIRED);\n\t\t\t}\n\t\t}\n\t\tfor (const f of deep.runnerFlags ?? []) {\n\t\t\tif (!policyFlags.includes(f as never)) policyFlags.push(f as never);\n\t\t}\n\t\tconst limitsCode = deep.limits?.[0] ?? verdictCard.limits.code;\n\t\tverdictCard = {\n\t\t\t...verdictCard,\n\t\t\tlimits: {\n\t\t\t\t...verdictCard.limits,\n\t\t\t\trequiresHumanReview: verdictCard.limits.requiresHumanReview || deep.status !== \"completed\",\n\t\t\t\tcode: limitsCode ?? verdictCard.limits.code,\n\t\t\t},\n\t\t\tblocked_reasons: [...new Set([...verdictCard.blocked_reasons, deep.message])],\n\t\t};\n\t\treceipt = {\n\t\t\t...receipt,\n\t\t\tpolicyFlags,\n\t\t\tshouldSubmit: receipt.shouldSubmit && deep.status === \"completed\",\n\t\t\tdeepWallStatus: deep.status,\n\t\t\tdeepWallEvidence: deep.evidence,\n\t\t};\n\t}\n\n\treturn { verdictCard, receipt };\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -31,6 +31,8 @@ export type { CreateMcpIntrospectionTransportOptions, McpIntrospectionMode, } fr
|
|
|
31
31
|
export { createMcpIntrospectionClient } from "./mcp-introspection-transport.ts";
|
|
32
32
|
export type { PolicyFlag } from "./policy-wall.ts";
|
|
33
33
|
export { POLICY_FLAG, parseDiffPaths, pathMatchesApprovedScope, runFastWall, scanDiffLinesForSecrets, } from "./policy-wall.ts";
|
|
34
|
+
export type { ProofClosureSummary, ProofProjection, ProofProjectionReasonCode, VeraOutcomeAdmission, } from "./proof-projection.ts";
|
|
35
|
+
export { admitVeraOutcome, PROOF_PROJECTION_REASON_CODES, projectProofClosure, projectProofEvaluationFailure, } from "./proof-projection.ts";
|
|
34
36
|
export type { SignedWallReceipt, SignWallReceiptInput, VerifyWallReceiptInput } from "./receipt-signature.ts";
|
|
35
37
|
export { signWallReceipt, verifyWallReceipt } from "./receipt-signature.ts";
|
|
36
38
|
export type { BuildRegeneratePacketInput, RegeneratePacket } from "./regenerate-packet.ts";
|
|
@@ -39,10 +41,14 @@ export type { RepairBudgetState } from "./repair-budget.ts";
|
|
|
39
41
|
export { capRepairHints, parseRepairBudget, shouldOfferRepair } from "./repair-budget.ts";
|
|
40
42
|
export type { RepairHintInput } from "./repair-loop.ts";
|
|
41
43
|
export { deriveRepairHints } from "./repair-loop.ts";
|
|
44
|
+
export type { AdaptOrchLinkSurface, AdaptOrchLinks } from "./service-links.ts";
|
|
45
|
+
export { getAdaptOrchLinks } from "./service-links.ts";
|
|
42
46
|
export type { VerificationDigest, VerificationDigestInput, WallReceiptMeta, } from "./signed-receipt.ts";
|
|
43
47
|
export { buildVerificationDigest } from "./signed-receipt.ts";
|
|
44
48
|
export { applyTransition, canTransition, isTerminalState, requiresHumanApproval } from "./state-machine.ts";
|
|
45
49
|
export type { CardinalityMode, DispatchRecord, LoopConfig, LoopTerminationCondition, TopologyClassification, TransitionLogEntry, WorkPacket, WorkPacketState, } from "./types.ts";
|
|
46
50
|
export { ADJUDICATIONS_DIR, LOOP_STATE_FILE, PACKET_INDEX_FILE, PACKETS_DIR, RUN_MAP_FILE } from "./types.ts";
|
|
51
|
+
export type { VeraDriftStatus, VeraEvidenceCausality, VeraEvidenceSeverity, VeraVerificationDecision, VeraVerificationOutcomeKind, } from "./vera-vocabulary.ts";
|
|
52
|
+
export { isVeraDriftStatus, isVeraEvidenceCausality, isVeraEvidenceSeverity, isVeraVerificationDecision, isVeraVerificationOutcomeKind, VERA_DRIFT_STATUSES, VERA_EVIDENCE_CAUSALITIES, VERA_EVIDENCE_SEVERITIES, VERA_VERIFICATION_DECISIONS, VERA_VERIFICATION_OUTCOME_KINDS, } from "./vera-vocabulary.ts";
|
|
47
53
|
export { CORRECTNESS_WALL_VERSION } from "./wall-meta.ts";
|
|
48
54
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,YAAY,EACX,kBAAkB,EAClB,cAAc,EACd,qBAAqB,EACrB,oBAAoB,EACpB,QAAQ,EACR,oBAAoB,EACpB,aAAa,EACb,aAAa,EACb,cAAc,EACd,aAAa,EACb,SAAS,EACT,GAAG,EACH,eAAe,EACf,SAAS,EACT,aAAa,GACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,yBAAyB,EACzB,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,+BAA+B,EAC/B,kBAAkB,GAClB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EACN,yBAAyB,EACzB,sBAAsB,EACtB,eAAe,EACf,eAAe,GACf,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC/F,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,YAAY,EACX,sBAAsB,EACtB,WAAW,EACX,YAAY,EACZ,qBAAqB,GACrB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACN,yBAAyB,EACzB,sBAAsB,EACtB,gBAAgB,EAChB,iBAAiB,GACjB,MAAM,2BAA2B,CAAC;AACnC,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAAE,uBAAuB,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACpE,YAAY,EACX,aAAa,EACb,WAAW,EACX,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,mBAAmB,GACnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,0BAA0B,EAAE,MAAM,kB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wB,CAAC;AAC5E,YAAY,EAAE,0BAA0B,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC3F,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,YAAY,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC1F,YAAY,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,YAAY,EACX,kBAAkB,EAClB,uBAAuB,EACvB,eAAe,GACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC5G,YAAY,EACX,eAAe,EACf,cAAc,EACd,UAAU,EACV,wBAAwB,EACxB,sBAAsB,EACtB,kBAAkB,EAClB,UAAU,EACV,eAAe,GACf,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,iBAAiB,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC9G,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC","sourcesContent":["/**\n * Public entry point for `omk-adaptorch-wpl` (stable since 0.91.0).\n *\n * See README.md and `.omk/runs/adaptorch-native-loop-algorithm-20260701/final-part{1,2,3}-*.md`\n * for the design this package implements. Ships as a runtime dependency of the\n * `open-multi-agent-kit` CLI.\n */\n\nexport type {\n\tAdaptOrchApiConfig,\n\tAdaptOrchFetch,\n\tAdaptOrchHttpResponse,\n\tAdaptOrchRequestInit,\n\tArtifact,\n\tArtifactListResponse,\n\tCapabilitySet,\n\tEvidenceCheck,\n\tEvidenceReport,\n\tListRunsQuery,\n\tPrincipal,\n\tRun,\n\tRunListResponse,\n\tRunStatus,\n\tRunSubmission,\n} from \"./adaptorch-api.ts\";\nexport {\n\tADAPTORCH_DEFAULT_API_URL,\n\tAdaptOrchApiClient,\n\tAdaptOrchApiError,\n\tassertSafeApiUrl,\n\tcreateAdaptOrchApiClientFromEnv,\n\tresolveAuthHeaders,\n} from \"./adaptorch-api.ts\";\nexport type { AdaptOrchTransport } from \"./adaptorch-client.ts\";\nexport {\n\tADAPTORCH_FULL_ONLY_TOOLS,\n\tADAPTORCH_REMOTE_TOOLS,\n\tADAPTORCH_TOOLS,\n\tAdaptOrchClient,\n} from \"./adaptorch-client.ts\";\nexport type { AdjudicationRequest, AdjudicationResult, PerRunVerdict } from \"./adjudicator.ts\";\nexport { adjudicate } from \"./adjudicator.ts\";\nexport type {\n\tAdjudicationReasonCode,\n\tCheckResult,\n\tVerdictState,\n\tVerifierRegistryEntry,\n} from \"./adjudicator-registry.ts\";\nexport {\n\tADJUDICATION_REASON_CODES,\n\tcreateVerifierRegistry,\n\tDEFAULT_VERIFIER,\n\treduceReasonCodes,\n} from \"./adjudicator-registry.ts\";\nexport type { MapToB2CInput, MapToB2COutput } from \"./b2c-mapper.ts\";\nexport { BATCH1_NO_DOCKER_RUNNER, mapToB2C } from \"./b2c-mapper.ts\";\nexport type {\n\tUserRiskLevel,\n\tUserVerdict,\n\tVerdictCard,\n\tVerdictLimits,\n\tVerdictNextAction,\n\tVerificationReceipt,\n} from \"./b2c-verdict.ts\";\nexport { B2C_VERDICT_SCHEMA_VERSION } from \"./b2c-verdict.ts\";\nexport type {\n\tDeepWallPhase,\n\tDeepWallResult,\n\tDeepWallRunnerEvidence,\n\tDeepWallRunnerFn,\n\tDeepWallRunnerResult,\n\tDeepWallStatus,\n\tDeepWallStubResult,\n\tRunDeepWallStubParams,\n} from \"./deep-wall.ts\";\nexport {\n\tDEEP_RUNNER_ERROR,\n\tDEEP_RUNNER_EVIDENCE_MISSING,\n\tDEEP_RUNNER_NOT_WIRED,\n\tDEEP_WALL_UNAVAILABLE,\n\tisDeepRunnerCompletionAllowed,\n\tresolveDeepWallPhaseFromEnv,\n\trunDeepWall,\n\trunDeepWallStub,\n} from \"./deep-wall.ts\";\nexport type {\n\tEvaluateCorrectnessWallParams,\n\tEvaluateCorrectnessWallResult,\n} from \"./evaluate-correctness-wall.ts\";\nexport { evaluateCorrectnessWall } from \"./evaluate-correctness-wall.ts\";\nexport type { InMemoryAdaptOrchFixture } from \"./in-memory-adaptorch.ts\";\nexport { createInMemoryAdaptOrchClient } from \"./in-memory-adaptorch.ts\";\nexport type { AdaptOrchCallToolFn, OaTransportMode } from \"./live-adaptorch-transport.ts\";\nexport { createLiveAdaptOrchClient, parseOaTransportModeFromEnv } from \"./live-adaptorch-transport.ts\";\nexport type { NextActionKind, VerdictDisposition } from \"./loop.ts\";\nexport {\n\tdecideNextTransition,\n\thandleAdjudicationFailure,\n\tprojectVerdictToDisposition,\n\trunAdjudicationWithTimeout,\n} from \"./loop.ts\";\nexport type {\n\tCreateMcpIntrospectionTransportOptions,\n\tMcpIntrospectionMode,\n} from \"./mcp-introspection-transport.ts\";\nexport { createMcpIntrospectionClient } from \"./mcp-introspection-transport.ts\";\nexport type { PolicyFlag } from \"./policy-wall.ts\";\nexport {\n\tPOLICY_FLAG,\n\tparseDiffPaths,\n\tpathMatchesApprovedScope,\n\trunFastWall,\n\tscanDiffLinesForSecrets,\n} from \"./policy-wall.ts\";\nexport type { SignedWallReceipt, SignWallReceiptInput, VerifyWallReceiptInput } from \"./receipt-signature.ts\";\nexport { signWallReceipt, verifyWallReceipt } from \"./receipt-signature.ts\";\nexport type { BuildRegeneratePacketInput, RegeneratePacket } from \"./regenerate-packet.ts\";\nexport { buildRegeneratePacket } from \"./regenerate-packet.ts\";\nexport type { RepairBudgetState } from \"./repair-budget.ts\";\nexport { capRepairHints, parseRepairBudget, shouldOfferRepair } from \"./repair-budget.ts\";\nexport type { RepairHintInput } from \"./repair-loop.ts\";\nexport { deriveRepairHints } from \"./repair-loop.ts\";\nexport type {\n\tVerificationDigest,\n\tVerificationDigestInput,\n\tWallReceiptMeta,\n} from \"./signed-receipt.ts\";\nexport { buildVerificationDigest } from \"./signed-receipt.ts\";\nexport { applyTransition, canTransition, isTerminalState, requiresHumanApproval } from \"./state-machine.ts\";\nexport type {\n\tCardinalityMode,\n\tDispatchRecord,\n\tLoopConfig,\n\tLoopTerminationCondition,\n\tTopologyClassification,\n\tTransitionLogEntry,\n\tWorkPacket,\n\tWorkPacketState,\n} from \"./types.ts\";\nexport { ADJUDICATIONS_DIR, LOOP_STATE_FILE, PACKET_INDEX_FILE, PACKETS_DIR, RUN_MAP_FILE } from \"./types.ts\";\nexport { CORRECTNESS_WALL_VERSION } from \"./wall-meta.ts\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,YAAY,EACX,kBAAkB,EAClB,cAAc,EACd,qBAAqB,EACrB,oBAAoB,EACpB,QAAQ,EACR,oBAAoB,EACpB,aAAa,EACb,aAAa,EACb,cAAc,EACd,aAAa,EACb,SAAS,EACT,GAAG,EACH,eAAe,EACf,SAAS,EACT,aAAa,GACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,yBAAyB,EACzB,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,+BAA+B,EAC/B,kBAAkB,GAClB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EACN,yBAAyB,EACzB,sBAAsB,EACtB,eAAe,EACf,eAAe,GACf,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC/F,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,YAAY,EACX,sBAAsB,EACtB,WAAW,EACX,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AC;AAC9D,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC5G,YAAY,EACX,eAAe,EACf,cAAc,EACd,UAAU,EACV,wBAAwB,EACxB,sBAAsB,EACtB,kBAAkB,EAClB,UAAU,EACV,eAAe,GACf,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,iBAAiB,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC9G,YAAY,EACX,eAAe,EACf,qBAAqB,EACrB,oBAAoB,EACpB,wBAAwB,EACxB,2BAA2B,GAC3B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACN,iBAAiB,EACjB,uBAAuB,EACvB,sBAAsB,EACtB,0BAA0B,EAC1B,6BAA6B,EAC7B,mBAAmB,EACnB,yBAAyB,EACzB,wBAAwB,EACxB,2BAA2B,EAC3B,+BAA+B,GAC/B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC","sourcesContent":["/**\n * Public entry point for `omk-adaptorch-wpl` (stable since 0.91.0).\n *\n * See README.md and `.omk/runs/adaptorch-native-loop-algorithm-20260701/final-part{1,2,3}-*.md`\n * for the design this package implements. Ships as a runtime dependency of the\n * `open-multi-agent-kit` CLI.\n */\n\nexport type {\n\tAdaptOrchApiConfig,\n\tAdaptOrchFetch,\n\tAdaptOrchHttpResponse,\n\tAdaptOrchRequestInit,\n\tArtifact,\n\tArtifactListResponse,\n\tCapabilitySet,\n\tEvidenceCheck,\n\tEvidenceReport,\n\tListRunsQuery,\n\tPrincipal,\n\tRun,\n\tRunListResponse,\n\tRunStatus,\n\tRunSubmission,\n} from \"./adaptorch-api.ts\";\nexport {\n\tADAPTORCH_DEFAULT_API_URL,\n\tAdaptOrchApiClient,\n\tAdaptOrchApiError,\n\tassertSafeApiUrl,\n\tcreateAdaptOrchApiClientFromEnv,\n\tresolveAuthHeaders,\n} from \"./adaptorch-api.ts\";\nexport type { AdaptOrchTransport } from \"./adaptorch-client.ts\";\nexport {\n\tADAPTORCH_FULL_ONLY_TOOLS,\n\tADAPTORCH_REMOTE_TOOLS,\n\tADAPTORCH_TOOLS,\n\tAdaptOrchClient,\n} from \"./adaptorch-client.ts\";\nexport type { AdjudicationRequest, AdjudicationResult, PerRunVerdict } from \"./adjudicator.ts\";\nexport { adjudicate } from \"./adjudicator.ts\";\nexport type {\n\tAdjudicationReasonCode,\n\tCheckResult,\n\tVerdictState,\n\tVerifierRegistryEntry,\n} from \"./adjudicator-registry.ts\";\nexport {\n\tADJUDICATION_REASON_CODES,\n\tcreateVerifierRegistry,\n\tDEFAULT_VERIFIER,\n\treduceReasonCodes,\n} from \"./adjudicator-registry.ts\";\nexport type { MapToB2CInput, MapToB2COutput } from \"./b2c-mapper.ts\";\nexport { BATCH1_NO_DOCKER_RUNNER, mapToB2C } from \"./b2c-mapper.ts\";\nexport type {\n\tUserRiskLevel,\n\tUserVerdict,\n\tVerdictCard,\n\tVerdictLimits,\n\tVerdictNextAction,\n\tVerificationReceipt,\n} from \"./b2c-verdict.ts\";\nexport { B2C_VERDICT_SCHEMA_VERSION } from \"./b2c-verdict.ts\";\nexport type {\n\tDeepWallPhase,\n\tDeepWallResult,\n\tDeepWallRunnerEvidence,\n\tDeepWallRunnerFn,\n\tDeepWallRunnerResult,\n\tDeepWallStatus,\n\tDeepWallStubResult,\n\tRunDeepWallStubParams,\n} from \"./deep-wall.ts\";\nexport {\n\tDEEP_RUNNER_ERROR,\n\tDEEP_RUNNER_EVIDENCE_MISSING,\n\tDEEP_RUNNER_NOT_WIRED,\n\tDEEP_WALL_UNAVAILABLE,\n\tisDeepRunnerCompletionAllowed,\n\tresolveDeepWallPhaseFromEnv,\n\trunDeepWall,\n\trunDeepWallStub,\n} from \"./deep-wall.ts\";\nexport type {\n\tEvaluateCorrectnessWallParams,\n\tEvaluateCorrectnessWallResult,\n} from \"./evaluate-correctness-wall.ts\";\nexport { evaluateCorrectnessWall } from \"./evaluate-correctness-wall.ts\";\nexport type { InMemoryAdaptOrchFixture } from \"./in-memory-adaptorch.ts\";\nexport { createInMemoryAdaptOrchClient } from \"./in-memory-adaptorch.ts\";\nexport type { AdaptOrchCallToolFn, OaTransportMode } from \"./live-adaptorch-transport.ts\";\nexport { createLiveAdaptOrchClient, parseOaTransportModeFromEnv } from \"./live-adaptorch-transport.ts\";\nexport type { NextActionKind, VerdictDisposition } from \"./loop.ts\";\nexport {\n\tdecideNextTransition,\n\thandleAdjudicationFailure,\n\tprojectVerdictToDisposition,\n\trunAdjudicationWithTimeout,\n} from \"./loop.ts\";\nexport type {\n\tCreateMcpIntrospectionTransportOptions,\n\tMcpIntrospectionMode,\n} from \"./mcp-introspection-transport.ts\";\nexport { createMcpIntrospectionClient } from \"./mcp-introspection-transport.ts\";\nexport type { PolicyFlag } from \"./policy-wall.ts\";\nexport {\n\tPOLICY_FLAG,\n\tparseDiffPaths,\n\tpathMatchesApprovedScope,\n\trunFastWall,\n\tscanDiffLinesForSecrets,\n} from \"./policy-wall.ts\";\nexport type {\n\tProofClosureSummary,\n\tProofProjection,\n\tProofProjectionReasonCode,\n\tVeraOutcomeAdmission,\n} from \"./proof-projection.ts\";\nexport {\n\tadmitVeraOutcome,\n\tPROOF_PROJECTION_REASON_CODES,\n\tprojectProofClosure,\n\tprojectProofEvaluationFailure,\n} from \"./proof-projection.ts\";\nexport type { SignedWallReceipt, SignWallReceiptInput, VerifyWallReceiptInput } from \"./receipt-signature.ts\";\nexport { signWallReceipt, verifyWallReceipt } from \"./receipt-signature.ts\";\nexport type { BuildRegeneratePacketInput, RegeneratePacket } from \"./regenerate-packet.ts\";\nexport { buildRegeneratePacket } from \"./regenerate-packet.ts\";\nexport type { RepairBudgetState } from \"./repair-budget.ts\";\nexport { capRepairHints, parseRepairBudget, shouldOfferRepair } from \"./repair-budget.ts\";\nexport type { RepairHintInput } from \"./repair-loop.ts\";\nexport { deriveRepairHints } from \"./repair-loop.ts\";\nexport type { AdaptOrchLinkSurface, AdaptOrchLinks } from \"./service-links.ts\";\nexport { getAdaptOrchLinks } from \"./service-links.ts\";\nexport type {\n\tVerificationDigest,\n\tVerificationDigestInput,\n\tWallReceiptMeta,\n} from \"./signed-receipt.ts\";\nexport { buildVerificationDigest } from \"./signed-receipt.ts\";\nexport { applyTransition, canTransition, isTerminalState, requiresHumanApproval } from \"./state-machine.ts\";\nexport type {\n\tCardinalityMode,\n\tDispatchRecord,\n\tLoopConfig,\n\tLoopTerminationCondition,\n\tTopologyClassification,\n\tTransitionLogEntry,\n\tWorkPacket,\n\tWorkPacketState,\n} from \"./types.ts\";\nexport { ADJUDICATIONS_DIR, LOOP_STATE_FILE, PACKET_INDEX_FILE, PACKETS_DIR, RUN_MAP_FILE } from \"./types.ts\";\nexport type {\n\tVeraDriftStatus,\n\tVeraEvidenceCausality,\n\tVeraEvidenceSeverity,\n\tVeraVerificationDecision,\n\tVeraVerificationOutcomeKind,\n} from \"./vera-vocabulary.ts\";\nexport {\n\tisVeraDriftStatus,\n\tisVeraEvidenceCausality,\n\tisVeraEvidenceSeverity,\n\tisVeraVerificationDecision,\n\tisVeraVerificationOutcomeKind,\n\tVERA_DRIFT_STATUSES,\n\tVERA_EVIDENCE_CAUSALITIES,\n\tVERA_EVIDENCE_SEVERITIES,\n\tVERA_VERIFICATION_DECISIONS,\n\tVERA_VERIFICATION_OUTCOME_KINDS,\n} from \"./vera-vocabulary.ts\";\nexport { CORRECTNESS_WALL_VERSION } from \"./wall-meta.ts\";\n"]}
|
package/dist/index.js
CHANGED
|
@@ -18,12 +18,15 @@ export { createLiveAdaptOrchClient, parseOaTransportModeFromEnv } from "./live-a
|
|
|
18
18
|
export { decideNextTransition, handleAdjudicationFailure, projectVerdictToDisposition, runAdjudicationWithTimeout, } from "./loop.js";
|
|
19
19
|
export { createMcpIntrospectionClient } from "./mcp-introspection-transport.js";
|
|
20
20
|
export { POLICY_FLAG, parseDiffPaths, pathMatchesApprovedScope, runFastWall, scanDiffLinesForSecrets, } from "./policy-wall.js";
|
|
21
|
+
export { admitVeraOutcome, PROOF_PROJECTION_REASON_CODES, projectProofClosure, projectProofEvaluationFailure, } from "./proof-projection.js";
|
|
21
22
|
export { signWallReceipt, verifyWallReceipt } from "./receipt-signature.js";
|
|
22
23
|
export { buildRegeneratePacket } from "./regenerate-packet.js";
|
|
23
24
|
export { capRepairHints, parseRepairBudget, shouldOfferRepair } from "./repair-budget.js";
|
|
24
25
|
export { deriveRepairHints } from "./repair-loop.js";
|
|
26
|
+
export { getAdaptOrchLinks } from "./service-links.js";
|
|
25
27
|
export { buildVerificationDigest } from "./signed-receipt.js";
|
|
26
28
|
export { applyTransition, canTransition, isTerminalState, requiresHumanApproval } from "./state-machine.js";
|
|
27
29
|
export { ADJUDICATIONS_DIR, LOOP_STATE_FILE, PACKET_INDEX_FILE, PACKETS_DIR, RUN_MAP_FILE } from "./types.js";
|
|
30
|
+
export { isVeraDriftStatus, isVeraEvidenceCausality, isVeraEvidenceSeverity, isVeraVerificationDecision, isVeraVerificationOutcomeKind, VERA_DRIFT_STATUSES, VERA_EVIDENCE_CAUSALITIES, VERA_EVIDENCE_SEVERITIES, VERA_VERIFICATION_DECISIONS, VERA_VERIFICATION_OUTCOME_KINDS, } from "./vera-vocabulary.js";
|
|
28
31
|
export { CORRECTNESS_WALL_VERSION } from "./wall-meta.js";
|
|
29
32
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAmBH,OAAO,EACN,yBAAyB,EACzB,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,+BAA+B,EAC/B,kBAAkB,GAClB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACN,yBAAyB,EACzB,sBAAsB,EACtB,eAAe,EACf,eAAe,GAC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qBAAqB,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAW5G,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,iBAAiB,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAQ9G,OAAO,EACN,iBAAiB,EACjB,uBAAuB,EACvB,sBAAsB,EACtB,0BAA0B,EAC1B,6BAA6B,EAC7B,mBAAmB,EACnB,yBAAyB,EACzB,wBAAwB,EACxB,2BAA2B,EAC3B,+BAA+B,GAC/B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC","sourcesContent":["/**\n * Public entry point for `omk-adaptorch-wpl` (stable since 0.91.0).\n *\n * See README.md and `.omk/runs/adaptorch-native-loop-algorithm-20260701/final-part{1,2,3}-*.md`\n * for the design this package implements. Ships as a runtime dependency of the\n * `open-multi-agent-kit` CLI.\n */\n\nexport type {\n\tAdaptOrchApiConfig,\n\tAdaptOrchFetch,\n\tAdaptOrchHttpResponse,\n\tAdaptOrchRequestInit,\n\tArtifact,\n\tArtifactListResponse,\n\tCapabilitySet,\n\tEvidenceCheck,\n\tEvidenceReport,\n\tListRunsQuery,\n\tPrincipal,\n\tRun,\n\tRunListResponse,\n\tRunStatus,\n\tRunSubmission,\n} from \"./adaptorch-api.ts\";\nexport {\n\tADAPTORCH_DEFAULT_API_URL,\n\tAdaptOrchApiClient,\n\tAdaptOrchApiError,\n\tassertSafeApiUrl,\n\tcreateAdaptOrchApiClientFromEnv,\n\tresolveAuthHeaders,\n} from \"./adaptorch-api.ts\";\nexport type { AdaptOrchTransport } from \"./adaptorch-client.ts\";\nexport {\n\tADAPTORCH_FULL_ONLY_TOOLS,\n\tADAPTORCH_REMOTE_TOOLS,\n\tADAPTORCH_TOOLS,\n\tAdaptOrchClient,\n} from \"./adaptorch-client.ts\";\nexport type { AdjudicationRequest, AdjudicationResult, PerRunVerdict } from \"./adjudicator.ts\";\nexport { adjudicate } from \"./adjudicator.ts\";\nexport type {\n\tAdjudicationReasonCode,\n\tCheckResult,\n\tVerdictState,\n\tVerifierRegistryEntry,\n} from \"./adjudicator-registry.ts\";\nexport {\n\tADJUDICATION_REASON_CODES,\n\tcreateVerifierRegistry,\n\tDEFAULT_VERIFIER,\n\treduceReasonCodes,\n} from \"./adjudicator-registry.ts\";\nexport type { MapToB2CInput, MapToB2COutput } from \"./b2c-mapper.ts\";\nexport { BATCH1_NO_DOCKER_RUNNER, mapToB2C } from \"./b2c-mapper.ts\";\nexport type {\n\tUserRiskLevel,\n\tUserVerdict,\n\tVerdictCard,\n\tVerdictLimits,\n\tVerdictNextAction,\n\tVerificationReceipt,\n} from \"./b2c-verdict.ts\";\nexport { B2C_VERDICT_SCHEMA_VERSION } from \"./b2c-verdict.ts\";\nexport type {\n\tDeepWallPhase,\n\tDeepWallResult,\n\tDeepWallRunnerEvidence,\n\tDeepWallRunnerFn,\n\tDeepWallRunnerResult,\n\tDeepWallStatus,\n\tDeepWallStubResult,\n\tRunDeepWallStubParams,\n} from \"./deep-wall.ts\";\nexport {\n\tDEEP_RUNNER_ERROR,\n\tDEEP_RUNNER_EVIDENCE_MISSING,\n\tDEEP_RUNNER_NOT_WIRED,\n\tDEEP_WALL_UNAVAILABLE,\n\tisDeepRunnerCompletionAllowed,\n\tresolveDeepWallPhaseFromEnv,\n\trunDeepWall,\n\trunDeepWallStub,\n} from \"./deep-wall.ts\";\nexport type {\n\tEvaluateCorrectnessWallParams,\n\tEvaluateCorrectnessWallResult,\n} from \"./evaluate-correctness-wall.ts\";\nexport { evaluateCorrectnessWall } from \"./evaluate-correctness-wall.ts\";\nexport type { InMemoryAdaptOrchFixture } from \"./in-memory-adaptorch.ts\";\nexport { createInMemoryAdaptOrchClient } from \"./in-memory-adaptorch.ts\";\nexport type { AdaptOrchCallToolFn, OaTransportMode } from \"./live-adaptorch-transport.ts\";\nexport { createLiveAdaptOrchClient, parseOaTransportModeFromEnv } from \"./live-adaptorch-transport.ts\";\nexport type { NextActionKind, VerdictDisposition } from \"./loop.ts\";\nexport {\n\tdecideNextTransition,\n\thandleAdjudicationFailure,\n\tprojectVerdictToDisposition,\n\trunAdjudicationWithTimeout,\n} from \"./loop.ts\";\nexport type {\n\tCreateMcpIntrospectionTransportOptions,\n\tMcpIntrospectionMode,\n} from \"./mcp-introspection-transport.ts\";\nexport { createMcpIntrospectionClient } from \"./mcp-introspection-transport.ts\";\nexport type { PolicyFlag } from \"./policy-wall.ts\";\nexport {\n\tPOLICY_FLAG,\n\tparseDiffPaths,\n\tpathMatchesApprovedScope,\n\trunFastWall,\n\tscanDiffLinesForSecrets,\n} from \"./policy-wall.ts\";\nexport type {\n\tProofClosureSummary,\n\tProofProjection,\n\tProofProjectionReasonCode,\n\tVeraOutcomeAdmission,\n} from \"./proof-projection.ts\";\nexport {\n\tadmitVeraOutcome,\n\tPROOF_PROJECTION_REASON_CODES,\n\tprojectProofClosure,\n\tprojectProofEvaluationFailure,\n} from \"./proof-projection.ts\";\nexport type { SignedWallReceipt, SignWallReceiptInput, VerifyWallReceiptInput } from \"./receipt-signature.ts\";\nexport { signWallReceipt, verifyWallReceipt } from \"./receipt-signature.ts\";\nexport type { BuildRegeneratePacketInput, RegeneratePacket } from \"./regenerate-packet.ts\";\nexport { buildRegeneratePacket } from \"./regenerate-packet.ts\";\nexport type { RepairBudgetState } from \"./repair-budget.ts\";\nexport { capRepairHints, parseRepairBudget, shouldOfferRepair } from \"./repair-budget.ts\";\nexport type { RepairHintInput } from \"./repair-loop.ts\";\nexport { deriveRepairHints } from \"./repair-loop.ts\";\nexport type { AdaptOrchLinkSurface, AdaptOrchLinks } from \"./service-links.ts\";\nexport { getAdaptOrchLinks } from \"./service-links.ts\";\nexport type {\n\tVerificationDigest,\n\tVerificationDigestInput,\n\tWallReceiptMeta,\n} from \"./signed-receipt.ts\";\nexport { buildVerificationDigest } from \"./signed-receipt.ts\";\nexport { applyTransition, canTransition, isTerminalState, requiresHumanApproval } from \"./state-machine.ts\";\nexport type {\n\tCardinalityMode,\n\tDispatchRecord,\n\tLoopConfig,\n\tLoopTerminationCondition,\n\tTopologyClassification,\n\tTransitionLogEntry,\n\tWorkPacket,\n\tWorkPacketState,\n} from \"./types.ts\";\nexport { ADJUDICATIONS_DIR, LOOP_STATE_FILE, PACKET_INDEX_FILE, PACKETS_DIR, RUN_MAP_FILE } from \"./types.ts\";\nexport type {\n\tVeraDriftStatus,\n\tVeraEvidenceCausality,\n\tVeraEvidenceSeverity,\n\tVeraVerificationDecision,\n\tVeraVerificationOutcomeKind,\n} from \"./vera-vocabulary.ts\";\nexport {\n\tisVeraDriftStatus,\n\tisVeraEvidenceCausality,\n\tisVeraEvidenceSeverity,\n\tisVeraVerificationDecision,\n\tisVeraVerificationOutcomeKind,\n\tVERA_DRIFT_STATUSES,\n\tVERA_EVIDENCE_CAUSALITIES,\n\tVERA_EVIDENCE_SEVERITIES,\n\tVERA_VERIFICATION_DECISIONS,\n\tVERA_VERIFICATION_OUTCOME_KINDS,\n} from \"./vera-vocabulary.ts\";\nexport { CORRECTNESS_WALL_VERSION } from \"./wall-meta.ts\";\n"]}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Projects an OMK proof-closure result onto the two verdict vocabularies the
|
|
3
|
+
* AdaptOrch integration already speaks: the Work Packet adjudicator's
|
|
4
|
+
* five-state `VerdictState` and AdaptOrch VERA's `VerificationDecision`.
|
|
5
|
+
*
|
|
6
|
+
* The input is structural on purpose. `omk-adaptorch-wpl` has no
|
|
7
|
+
* dependencies, so it cannot import `omk-protocol`; `ProofClosureSummary`
|
|
8
|
+
* names only the fields the projection reads, and `omk-protocol`'s
|
|
9
|
+
* `ProofClosureResult` satisfies it by shape (pinned by a parity test in the
|
|
10
|
+
* `open-multi-agent-kit` package, which depends on both).
|
|
11
|
+
*
|
|
12
|
+
* Mapping, worst first, in the same order `reduceVerdicts` ranks verdicts:
|
|
13
|
+
*
|
|
14
|
+
* | proof result | VerdictState | VERA decision | causality |
|
|
15
|
+
* | ---------------------------------- | ---------------- | -------------------------- | ------------------- |
|
|
16
|
+
* | evaluation itself failed | `VERIFIER-ERROR` | `INCONCLUSIVE_ENVIRONMENT` | `EnvironmentCaused` |
|
|
17
|
+
* | `violated` | `CONTRADICTED` | `REJECT` | `CandidateCaused` |
|
|
18
|
+
* | `inconclusive`, effects unresolved | `INDETERMINATE` | `ESCALATE` | `Ambiguous` |
|
|
19
|
+
* | `inconclusive`, workspace partial | `INDETERMINATE` | `INCONCLUSIVE_ENVIRONMENT` | `EnvironmentCaused` |
|
|
20
|
+
* | `inconclusive`, evidence missing | `INDETERMINATE` | `ABSTAIN` | `Ambiguous` |
|
|
21
|
+
* | `unverified` (no required claims) | `INDETERMINATE` | `ABSTAIN` | `NotApplicable` |
|
|
22
|
+
* | `verified` | `CONFIRMED` | `SHIP` | `NotApplicable` |
|
|
23
|
+
*
|
|
24
|
+
* An unresolved effect escalates rather than abstains because nothing short of
|
|
25
|
+
* an operator or a recovery run can close it; a partial workspace is an
|
|
26
|
+
* environment limit of the measurement, not a fact about the candidate.
|
|
27
|
+
* `SHIP` here means the proof closed — it is not a release authorization.
|
|
28
|
+
*/
|
|
29
|
+
import type { VerdictState } from "./adjudicator-registry.ts";
|
|
30
|
+
import type { VeraEvidenceCausality, VeraVerificationDecision, VeraVerificationOutcomeKind } from "./vera-vocabulary.ts";
|
|
31
|
+
/** Structural view of `omk-protocol` `ProofClosureResult`; only what the projection reads. */
|
|
32
|
+
export interface ProofClosureSummary {
|
|
33
|
+
readonly verdict: "verified" | "unverified" | "inconclusive" | "violated";
|
|
34
|
+
readonly unresolvedEffectIds: readonly string[];
|
|
35
|
+
readonly workspaceCompleteness: "complete" | "partial_excluded" | "partial_truncated" | "unknown";
|
|
36
|
+
readonly blockingClaimIds: readonly string[];
|
|
37
|
+
}
|
|
38
|
+
export declare const PROOF_PROJECTION_REASON_CODES: readonly ["proof.evaluation_error", "proof.violated", "proof.effect_frontier_open", "proof.workspace_incomplete", "proof.evidence_missing", "proof.no_required_claims", "proof.verified"];
|
|
39
|
+
export type ProofProjectionReasonCode = (typeof PROOF_PROJECTION_REASON_CODES)[number];
|
|
40
|
+
export interface ProofProjection {
|
|
41
|
+
readonly verdictState: VerdictState;
|
|
42
|
+
readonly decision: VeraVerificationDecision;
|
|
43
|
+
readonly causality: VeraEvidenceCausality;
|
|
44
|
+
readonly reasonCode: ProofProjectionReasonCode;
|
|
45
|
+
}
|
|
46
|
+
/** The projection for a proof evaluation that threw instead of producing a result. */
|
|
47
|
+
export declare function projectProofEvaluationFailure(): ProofProjection;
|
|
48
|
+
/** Pure, total projection of a closed proof evaluation. */
|
|
49
|
+
export declare function projectProofClosure(summary: ProofClosureSummary): ProofProjection;
|
|
50
|
+
/**
|
|
51
|
+
* How one VERA verifier outcome enters the OMK claim graph as a witness.
|
|
52
|
+
*
|
|
53
|
+
* `PASS` supports. `FAIL`, `CANDIDATE_ERROR`, and `FLAKY` violate: an observed
|
|
54
|
+
* assertion failure is never erased by a later pass (plan §10.9). Environment
|
|
55
|
+
* outcomes are inadmissible — they neither support nor violate, so the claim
|
|
56
|
+
* stays `missing` and the closure abstains or reports an environment limit
|
|
57
|
+
* instead of laundering an outage into either verdict.
|
|
58
|
+
*/
|
|
59
|
+
export type VeraOutcomeAdmission = {
|
|
60
|
+
readonly admissible: true;
|
|
61
|
+
readonly polarity: "supports" | "violates";
|
|
62
|
+
readonly causality: VeraEvidenceCausality;
|
|
63
|
+
} | {
|
|
64
|
+
readonly admissible: false;
|
|
65
|
+
readonly reason: "environment" | "timeout" | "ambiguous" | "skipped";
|
|
66
|
+
readonly causality: VeraEvidenceCausality;
|
|
67
|
+
};
|
|
68
|
+
export declare function admitVeraOutcome(kind: VeraVerificationOutcomeKind): VeraOutcomeAdmission;
|
|
69
|
+
//# sourceMappingURL=proof-projection.d.ts.map
|
|
@@ -0,0 +1 @@
|
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AAC;IAC3C,QAAQ,CAAC,SAAS,EAAE,qBAAqB,CAAC;CACzC,GACD;IACA,QAAQ,CAAC,UAAU,EAAE,KAAK,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,CAAC;IACrE,QAAQ,CAAC,SAAS,EAAE,qBAAqB,CAAC;CACzC,CAAC;AAEL,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,2BAA2B,GAAG,oBAAoB,CAqBxF","sourcesContent":["/**\n * Projects an OMK proof-closure result onto the two verdict vocabularies the\n * AdaptOrch integration already speaks: the Work Packet adjudicator's\n * five-state `VerdictState` and AdaptOrch VERA's `VerificationDecision`.\n *\n * The input is structural on purpose. `omk-adaptorch-wpl` has no\n * dependencies, so it cannot import `omk-protocol`; `ProofClosureSummary`\n * names only the fields the projection reads, and `omk-protocol`'s\n * `ProofClosureResult` satisfies it by shape (pinned by a parity test in the\n * `open-multi-agent-kit` package, which depends on both).\n *\n * Mapping, worst first, in the same order `reduceVerdicts` ranks verdicts:\n *\n * | proof result | VerdictState | VERA decision | causality |\n * | ---------------------------------- | ---------------- | -------------------------- | ------------------- |\n * | evaluation itself failed | `VERIFIER-ERROR` | `INCONCLUSIVE_ENVIRONMENT` | `EnvironmentCaused` |\n * | `violated` | `CONTRADICTED` | `REJECT` | `CandidateCaused` |\n * | `inconclusive`, effects unresolved | `INDETERMINATE` | `ESCALATE` | `Ambiguous` |\n * | `inconclusive`, workspace partial | `INDETERMINATE` | `INCONCLUSIVE_ENVIRONMENT` | `EnvironmentCaused` |\n * | `inconclusive`, evidence missing | `INDETERMINATE` | `ABSTAIN` | `Ambiguous` |\n * | `unverified` (no required claims) | `INDETERMINATE` | `ABSTAIN` | `NotApplicable` |\n * | `verified` | `CONFIRMED` | `SHIP` | `NotApplicable` |\n *\n * An unresolved effect escalates rather than abstains because nothing short of\n * an operator or a recovery run can close it; a partial workspace is an\n * environment limit of the measurement, not a fact about the candidate.\n * `SHIP` here means the proof closed — it is not a release authorization.\n */\n\nimport type { VerdictState } from \"./adjudicator-registry.ts\";\nimport type {\n\tVeraEvidenceCausality,\n\tVeraVerificationDecision,\n\tVeraVerificationOutcomeKind,\n} from \"./vera-vocabulary.ts\";\n\n/** Structural view of `omk-protocol` `ProofClosureResult`; only what the projection reads. */\nexport interface ProofClosureSummary {\n\treadonly verdict: \"verified\" | \"unverified\" | \"inconclusive\" | \"violated\";\n\treadonly unresolvedEffectIds: readonly string[];\n\treadonly workspaceCompleteness: \"complete\" | \"partial_excluded\" | \"partial_truncated\" | \"unknown\";\n\treadonly blockingClaimIds: readonly string[];\n}\n\nexport const PROOF_PROJECTION_REASON_CODES = [\n\t\"proof.evaluation_error\",\n\t\"proof.violated\",\n\t\"proof.effect_frontier_open\",\n\t\"proof.workspace_incomplete\",\n\t\"proof.evidence_missing\",\n\t\"proof.no_required_claims\",\n\t\"proof.verified\",\n] as const;\nexport type ProofProjectionReasonCode = (typeof PROOF_PROJECTION_REASON_CODES)[number];\n\nexport interface ProofProjection {\n\treadonly verdictState: VerdictState;\n\treadonly decision: VeraVerificationDecision;\n\treadonly causality: VeraEvidenceCausality;\n\treadonly reasonCode: ProofProjectionReasonCode;\n}\n\nfunction projection(\n\tverdictState: VerdictState,\n\tdecision: VeraVerificationDecision,\n\tcausality: VeraEvidenceCausality,\n\treasonCode: ProofProjectionReasonCode,\n): ProofProjection {\n\treturn Object.freeze({ verdictState, decision, causality, reasonCode });\n}\n\n/** The projection for a proof evaluation that threw instead of producing a result. */\nexport function projectProofEvaluationFailure(): ProofProjection {\n\treturn projection(\"VERIFIER-ERROR\", \"INCONCLUSIVE_ENVIRONMENT\", \"EnvironmentCaused\", \"proof.evaluation_error\");\n}\n\n/** Pure, total projection of a closed proof evaluation. */\nexport function projectProofClosure(summary: ProofClosureSummary): ProofProjection {\n\tswitch (summary.verdict) {\n\t\tcase \"verified\":\n\t\t\treturn projection(\"CONFIRMED\", \"SHIP\", \"NotApplicable\", \"proof.verified\");\n\t\tcase \"violated\":\n\t\t\treturn projection(\"CONTRADICTED\", \"REJECT\", \"CandidateCaused\", \"proof.violated\");\n\t\tcase \"unverified\":\n\t\t\treturn projection(\"INDETERMINATE\", \"ABSTAIN\", \"NotApplicable\", \"proof.no_required_claims\");\n\t\tcase \"inconclusive\":\n\t\t\tif (summary.unresolvedEffectIds.length > 0) {\n\t\t\t\treturn projection(\"INDETERMINATE\", \"ESCALATE\", \"Ambiguous\", \"proof.effect_frontier_open\");\n\t\t\t}\n\t\t\tif (summary.workspaceCompleteness !== \"complete\") {\n\t\t\t\treturn projection(\n\t\t\t\t\t\"INDETERMINATE\",\n\t\t\t\t\t\"INCONCLUSIVE_ENVIRONMENT\",\n\t\t\t\t\t\"EnvironmentCaused\",\n\t\t\t\t\t\"proof.workspace_incomplete\",\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn projection(\"INDETERMINATE\", \"ABSTAIN\", \"Ambiguous\", \"proof.evidence_missing\");\n\t\tdefault: {\n\t\t\tconst unknownVerdict: never = summary.verdict;\n\t\t\tthrow new TypeError(`Unknown proof verdict ${String(unknownVerdict)}`);\n\t\t}\n\t}\n}\n\n/**\n * How one VERA verifier outcome enters the OMK claim graph as a witness.\n *\n * `PASS` supports. `FAIL`, `CANDIDATE_ERROR`, and `FLAKY` violate: an observed\n * assertion failure is never erased by a later pass (plan §10.9). Environment\n * outcomes are inadmissible — they neither support nor violate, so the claim\n * stays `missing` and the closure abstains or reports an environment limit\n * instead of laundering an outage into either verdict.\n */\nexport type VeraOutcomeAdmission =\n\t| {\n\t\t\treadonly admissible: true;\n\t\t\treadonly polarity: \"supports\" | \"violates\";\n\t\t\treadonly causality: VeraEvidenceCausality;\n\t }\n\t| {\n\t\t\treadonly admissible: false;\n\t\t\treadonly reason: \"environment\" | \"timeout\" | \"ambiguous\" | \"skipped\";\n\t\t\treadonly causality: VeraEvidenceCausality;\n\t };\n\nexport function admitVeraOutcome(kind: VeraVerificationOutcomeKind): VeraOutcomeAdmission {\n\tswitch (kind) {\n\t\tcase \"PASS\":\n\t\t\treturn { admissible: true, polarity: \"supports\", causality: \"NotApplicable\" };\n\t\tcase \"FAIL\":\n\t\tcase \"CANDIDATE_ERROR\":\n\t\tcase \"FLAKY\":\n\t\t\treturn { admissible: true, polarity: \"violates\", causality: \"CandidateCaused\" };\n\t\tcase \"ENV_ERROR\":\n\t\t\treturn { admissible: false, reason: \"environment\", causality: \"EnvironmentCaused\" };\n\t\tcase \"TIMEOUT\":\n\t\t\treturn { admissible: false, reason: \"timeout\", causality: \"Ambiguous\" };\n\t\tcase \"AMBIGUOUS\":\n\t\t\treturn { admissible: false, reason: \"ambiguous\", causality: \"Ambiguous\" };\n\t\tcase \"SKIPPED\":\n\t\t\treturn { admissible: false, reason: \"skipped\", causality: \"EnvironmentCaused\" };\n\t\tdefault: {\n\t\t\tconst unknownKind: never = kind;\n\t\t\tthrow new TypeError(`Unknown VERA outcome kind ${String(unknownKind)}`);\n\t\t}\n\t}\n}\n"]}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Projects an OMK proof-closure result onto the two verdict vocabularies the
|
|
3
|
+
* AdaptOrch integration already speaks: the Work Packet adjudicator's
|
|
4
|
+
* five-state `VerdictState` and AdaptOrch VERA's `VerificationDecision`.
|
|
5
|
+
*
|
|
6
|
+
* The input is structural on purpose. `omk-adaptorch-wpl` has no
|
|
7
|
+
* dependencies, so it cannot import `omk-protocol`; `ProofClosureSummary`
|
|
8
|
+
* names only the fields the projection reads, and `omk-protocol`'s
|
|
9
|
+
* `ProofClosureResult` satisfies it by shape (pinned by a parity test in the
|
|
10
|
+
* `open-multi-agent-kit` package, which depends on both).
|
|
11
|
+
*
|
|
12
|
+
* Mapping, worst first, in the same order `reduceVerdicts` ranks verdicts:
|
|
13
|
+
*
|
|
14
|
+
* | proof result | VerdictState | VERA decision | causality |
|
|
15
|
+
* | ---------------------------------- | ---------------- | -------------------------- | ------------------- |
|
|
16
|
+
* | evaluation itself failed | `VERIFIER-ERROR` | `INCONCLUSIVE_ENVIRONMENT` | `EnvironmentCaused` |
|
|
17
|
+
* | `violated` | `CONTRADICTED` | `REJECT` | `CandidateCaused` |
|
|
18
|
+
* | `inconclusive`, effects unresolved | `INDETERMINATE` | `ESCALATE` | `Ambiguous` |
|
|
19
|
+
* | `inconclusive`, workspace partial | `INDETERMINATE` | `INCONCLUSIVE_ENVIRONMENT` | `EnvironmentCaused` |
|
|
20
|
+
* | `inconclusive`, evidence missing | `INDETERMINATE` | `ABSTAIN` | `Ambiguous` |
|
|
21
|
+
* | `unverified` (no required claims) | `INDETERMINATE` | `ABSTAIN` | `NotApplicable` |
|
|
22
|
+
* | `verified` | `CONFIRMED` | `SHIP` | `NotApplicable` |
|
|
23
|
+
*
|
|
24
|
+
* An unresolved effect escalates rather than abstains because nothing short of
|
|
25
|
+
* an operator or a recovery run can close it; a partial workspace is an
|
|
26
|
+
* environment limit of the measurement, not a fact about the candidate.
|
|
27
|
+
* `SHIP` here means the proof closed — it is not a release authorization.
|
|
28
|
+
*/
|
|
29
|
+
export const PROOF_PROJECTION_REASON_CODES = [
|
|
30
|
+
"proof.evaluation_error",
|
|
31
|
+
"proof.violated",
|
|
32
|
+
"proof.effect_frontier_open",
|
|
33
|
+
"proof.workspace_incomplete",
|
|
34
|
+
"proof.evidence_missing",
|
|
35
|
+
"proof.no_required_claims",
|
|
36
|
+
"proof.verified",
|
|
37
|
+
];
|
|
38
|
+
function projection(verdictState, decision, causality, reasonCode) {
|
|
39
|
+
return Object.freeze({ verdictState, decision, causality, reasonCode });
|
|
40
|
+
}
|
|
41
|
+
/** The projection for a proof evaluation that threw instead of producing a result. */
|
|
42
|
+
export function projectProofEvaluationFailure() {
|
|
43
|
+
return projection("VERIFIER-ERROR", "INCONCLUSIVE_ENVIRONMENT", "EnvironmentCaused", "proof.evaluation_error");
|
|
44
|
+
}
|
|
45
|
+
/** Pure, total projection of a closed proof evaluation. */
|
|
46
|
+
export function projectProofClosure(summary) {
|
|
47
|
+
switch (summary.verdict) {
|
|
48
|
+
case "verified":
|
|
49
|
+
return projection("CONFIRMED", "SHIP", "NotApplicable", "proof.verified");
|
|
50
|
+
case "violated":
|
|
51
|
+
return projection("CONTRADICTED", "REJECT", "CandidateCaused", "proof.violated");
|
|
52
|
+
case "unverified":
|
|
53
|
+
return projection("INDETERMINATE", "ABSTAIN", "NotApplicable", "proof.no_required_claims");
|
|
54
|
+
case "inconclusive":
|
|
55
|
+
if (summary.unresolvedEffectIds.length > 0) {
|
|
56
|
+
return projection("INDETERMINATE", "ESCALATE", "Ambiguous", "proof.effect_frontier_open");
|
|
57
|
+
}
|
|
58
|
+
if (summary.workspaceCompleteness !== "complete") {
|
|
59
|
+
return projection("INDETERMINATE", "INCONCLUSIVE_ENVIRONMENT", "EnvironmentCaused", "proof.workspace_incomplete");
|
|
60
|
+
}
|
|
61
|
+
return projection("INDETERMINATE", "ABSTAIN", "Ambiguous", "proof.evidence_missing");
|
|
62
|
+
default: {
|
|
63
|
+
const unknownVerdict = summary.verdict;
|
|
64
|
+
throw new TypeError(`Unknown proof verdict ${String(unknownVerdict)}`);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
export function admitVeraOutcome(kind) {
|
|
69
|
+
switch (kind) {
|
|
70
|
+
case "PASS":
|
|
71
|
+
return { admissible: true, polarity: "supports", causality: "NotApplicable" };
|
|
72
|
+
case "FAIL":
|
|
73
|
+
case "CANDIDATE_ERROR":
|
|
74
|
+
case "FLAKY":
|
|
75
|
+
return { admissible: true, polarity: "violates", causality: "CandidateCaused" };
|
|
76
|
+
case "ENV_ERROR":
|
|
77
|
+
return { admissible: false, reason: "environment", causality: "EnvironmentCaused" };
|
|
78
|
+
case "TIMEOUT":
|
|
79
|
+
return { admissible: false, reason: "timeout", causality: "Ambiguous" };
|
|
80
|
+
case "AMBIGUOUS":
|
|
81
|
+
return { admissible: false, reason: "ambiguous", causality: "Ambiguous" };
|
|
82
|
+
case "SKIPPED":
|
|
83
|
+
return { admissible: false, reason: "skipped", causality: "EnvironmentCaused" };
|
|
84
|
+
default: {
|
|
85
|
+
const unknownKind = kind;
|
|
86
|
+
throw new TypeError(`Unknown VERA outcome kind ${String(unknownKind)}`);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=proof-projection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proof-projection.js","sourceRoot":"","sources":["../src/proof-projection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAiBH,MAAM,CAAC,MAAM,6BAA6B,GAAG;IAC5C,wBAAwB;IACxB,gBAAgB;IAChB,4BAA4B;IAC5B,4BAA4B;IAC5B,wBAAwB;IACxB,0BAA0B;IAC1B,gBAAgB;CACP,CAAC;AAUX,SAAS,UAAU,CAClB,YAA0B,EAC1B,QAAkC,EAClC,SAAgC,EAChC,UAAqC,EACnB;IAClB,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC,CAAC;AAAA,CACxE;AAED,sFAAsF;AACtF,MAAM,UAAU,6BAA6B,GAAoB;IAChE,OAAO,UAAU,CAAC,gBAAgB,EAAE,0BAA0B,EAAE,mBAAmB,EAAE,wBAAwB,CAAC,CAAC;AAAA,CAC/G;AAED,2DAA2D;AAC3D,MAAM,UAAU,mBAAmB,CAAC,OAA4B,EAAmB;IAClF,QAAQ,OAAO,CAAC,OAAO,EAAE,CAAC;QACzB,KAAK,UAAU;YACd,OAAO,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,eAAe,EAAE,gBAAgB,CAAC,CAAC;QAC3E,KAAK,UAAU;YACd,OAAO,UAAU,CAAC,cAAc,EAAE,QAAQ,EAAE,iBAAiB,EAAE,gBAAgB,CAAC,CAAC;QAClF,KAAK,YAAY;YAChB,OAAO,UAAU,CA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AW,EAAE,CAAC;QACzE,KAAK,WAAW;YACf,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;QAC3E,KAAK,SAAS;YACb,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,mBAAmB,EAAE,CAAC;QACjF,SAAS,CAAC;YACT,MAAM,WAAW,GAAU,IAAI,CAAC;YAChC,MAAM,IAAI,SAAS,CAAC,6BAA6B,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;QACzE,CAAC;IACF,CAAC;AAAA,CACD","sourcesContent":["/**\n * Projects an OMK proof-closure result onto the two verdict vocabularies the\n * AdaptOrch integration already speaks: the Work Packet adjudicator's\n * five-state `VerdictState` and AdaptOrch VERA's `VerificationDecision`.\n *\n * The input is structural on purpose. `omk-adaptorch-wpl` has no\n * dependencies, so it cannot import `omk-protocol`; `ProofClosureSummary`\n * names only the fields the projection reads, and `omk-protocol`'s\n * `ProofClosureResult` satisfies it by shape (pinned by a parity test in the\n * `open-multi-agent-kit` package, which depends on both).\n *\n * Mapping, worst first, in the same order `reduceVerdicts` ranks verdicts:\n *\n * | proof result | VerdictState | VERA decision | causality |\n * | ---------------------------------- | ---------------- | -------------------------- | ------------------- |\n * | evaluation itself failed | `VERIFIER-ERROR` | `INCONCLUSIVE_ENVIRONMENT` | `EnvironmentCaused` |\n * | `violated` | `CONTRADICTED` | `REJECT` | `CandidateCaused` |\n * | `inconclusive`, effects unresolved | `INDETERMINATE` | `ESCALATE` | `Ambiguous` |\n * | `inconclusive`, workspace partial | `INDETERMINATE` | `INCONCLUSIVE_ENVIRONMENT` | `EnvironmentCaused` |\n * | `inconclusive`, evidence missing | `INDETERMINATE` | `ABSTAIN` | `Ambiguous` |\n * | `unverified` (no required claims) | `INDETERMINATE` | `ABSTAIN` | `NotApplicable` |\n * | `verified` | `CONFIRMED` | `SHIP` | `NotApplicable` |\n *\n * An unresolved effect escalates rather than abstains because nothing short of\n * an operator or a recovery run can close it; a partial workspace is an\n * environment limit of the measurement, not a fact about the candidate.\n * `SHIP` here means the proof closed — it is not a release authorization.\n */\n\nimport type { VerdictState } from \"./adjudicator-registry.ts\";\nimport type {\n\tVeraEvidenceCausality,\n\tVeraVerificationDecision,\n\tVeraVerificationOutcomeKind,\n} from \"./vera-vocabulary.ts\";\n\n/** Structural view of `omk-protocol` `ProofClosureResult`; only what the projection reads. */\nexport interface ProofClosureSummary {\n\treadonly verdict: \"verified\" | \"unverified\" | \"inconclusive\" | \"violated\";\n\treadonly unresolvedEffectIds: readonly string[];\n\treadonly workspaceCompleteness: \"complete\" | \"partial_excluded\" | \"partial_truncated\" | \"unknown\";\n\treadonly blockingClaimIds: readonly string[];\n}\n\nexport const PROOF_PROJECTION_REASON_CODES = [\n\t\"proof.evaluation_error\",\n\t\"proof.violated\",\n\t\"proof.effect_frontier_open\",\n\t\"proof.workspace_incomplete\",\n\t\"proof.evidence_missing\",\n\t\"proof.no_required_claims\",\n\t\"proof.verified\",\n] as const;\nexport type ProofProjectionReasonCode = (typeof PROOF_PROJECTION_REASON_CODES)[number];\n\nexport interface ProofProjection {\n\treadonly verdictState: VerdictState;\n\treadonly decision: VeraVerificationDecision;\n\treadonly causality: VeraEvidenceCausality;\n\treadonly reasonCode: ProofProjectionReasonCode;\n}\n\nfunction projection(\n\tverdictState: VerdictState,\n\tdecision: VeraVerificationDecision,\n\tcausality: VeraEvidenceCausality,\n\treasonCode: ProofProjectionReasonCode,\n): ProofProjection {\n\treturn Object.freeze({ verdictState, decision, causality, reasonCode });\n}\n\n/** The projection for a proof evaluation that threw instead of producing a result. */\nexport function projectProofEvaluationFailure(): ProofProjection {\n\treturn projection(\"VERIFIER-ERROR\", \"INCONCLUSIVE_ENVIRONMENT\", \"EnvironmentCaused\", \"proof.evaluation_error\");\n}\n\n/** Pure, total projection of a closed proof evaluation. */\nexport function projectProofClosure(summary: ProofClosureSummary): ProofProjection {\n\tswitch (summary.verdict) {\n\t\tcase \"verified\":\n\t\t\treturn projection(\"CONFIRMED\", \"SHIP\", \"NotApplicable\", \"proof.verified\");\n\t\tcase \"violated\":\n\t\t\treturn projection(\"CONTRADICTED\", \"REJECT\", \"CandidateCaused\", \"proof.violated\");\n\t\tcase \"unverified\":\n\t\t\treturn projection(\"INDETERMINATE\", \"ABSTAIN\", \"NotApplicable\", \"proof.no_required_claims\");\n\t\tcase \"inconclusive\":\n\t\t\tif (summary.unresolvedEffectIds.length > 0) {\n\t\t\t\treturn projection(\"INDETERMINATE\", \"ESCALATE\", \"Ambiguous\", \"proof.effect_frontier_open\");\n\t\t\t}\n\t\t\tif (summary.workspaceCompleteness !== \"complete\") {\n\t\t\t\treturn projection(\n\t\t\t\t\t\"INDETERMINATE\",\n\t\t\t\t\t\"INCONCLUSIVE_ENVIRONMENT\",\n\t\t\t\t\t\"EnvironmentCaused\",\n\t\t\t\t\t\"proof.workspace_incomplete\",\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn projection(\"INDETERMINATE\", \"ABSTAIN\", \"Ambiguous\", \"proof.evidence_missing\");\n\t\tdefault: {\n\t\t\tconst unknownVerdict: never = summary.verdict;\n\t\t\tthrow new TypeError(`Unknown proof verdict ${String(unknownVerdict)}`);\n\t\t}\n\t}\n}\n\n/**\n * How one VERA verifier outcome enters the OMK claim graph as a witness.\n *\n * `PASS` supports. `FAIL`, `CANDIDATE_ERROR`, and `FLAKY` violate: an observed\n * assertion failure is never erased by a later pass (plan §10.9). Environment\n * outcomes are inadmissible — they neither support nor violate, so the claim\n * stays `missing` and the closure abstains or reports an environment limit\n * instead of laundering an outage into either verdict.\n */\nexport type VeraOutcomeAdmission =\n\t| {\n\t\t\treadonly admissible: true;\n\t\t\treadonly polarity: \"supports\" | \"violates\";\n\t\t\treadonly causality: VeraEvidenceCausality;\n\t }\n\t| {\n\t\t\treadonly admissible: false;\n\t\t\treadonly reason: \"environment\" | \"timeout\" | \"ambiguous\" | \"skipped\";\n\t\t\treadonly causality: VeraEvidenceCausality;\n\t };\n\nexport function admitVeraOutcome(kind: VeraVerificationOutcomeKind): VeraOutcomeAdmission {\n\tswitch (kind) {\n\t\tcase \"PASS\":\n\t\t\treturn { admissible: true, polarity: \"supports\", causality: \"NotApplicable\" };\n\t\tcase \"FAIL\":\n\t\tcase \"CANDIDATE_ERROR\":\n\t\tcase \"FLAKY\":\n\t\t\treturn { admissible: true, polarity: \"violates\", causality: \"CandidateCaused\" };\n\t\tcase \"ENV_ERROR\":\n\t\t\treturn { admissible: false, reason: \"environment\", causality: \"EnvironmentCaused\" };\n\t\tcase \"TIMEOUT\":\n\t\t\treturn { admissible: false, reason: \"timeout\", causality: \"Ambiguous\" };\n\t\tcase \"AMBIGUOUS\":\n\t\t\treturn { admissible: false, reason: \"ambiguous\", causality: \"Ambiguous\" };\n\t\tcase \"SKIPPED\":\n\t\t\treturn { admissible: false, reason: \"skipped\", causality: \"EnvironmentCaused\" };\n\t\tdefault: {\n\t\t\tconst unknownKind: never = kind;\n\t\t\tthrow new TypeError(`Unknown VERA outcome kind ${String(unknownKind)}`);\n\t\t}\n\t}\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Optional product navigation, separate from verdicts, receipts, and execution authority. */
|
|
2
|
+
export type AdaptOrchLinkSurface = "doctor" | "wpl";
|
|
3
|
+
export interface AdaptOrchLinks {
|
|
4
|
+
readonly plans: string;
|
|
5
|
+
readonly signup: string;
|
|
6
|
+
readonly contact: string;
|
|
7
|
+
readonly claimBoundary: string;
|
|
8
|
+
}
|
|
9
|
+
/** Pure offline handoff. Accepts no project, prompt, session, credential, or arbitrary URL. */
|
|
10
|
+
export declare function getAdaptOrchLinks(surface?: AdaptOrchLinkSurface): AdaptOrchLinks;
|
|
11
|
+
//# sourceMappingURL=service-links.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-links.d.ts","sourceRoot":"","sources":["../src/service-links.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,MAAM,MAAM,oBAAoB,GAAG,QAAQ,GAAG,KAAK,CAAC;AAEpD,MAAM,WAAW,cAAc;IAC9B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAC/B;AAED,+FAA+F;AAC/F,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,oBAA4B,GAAG,cAAc,CAwBvF","sourcesContent":["/** Optional product navigation, separate from verdicts, receipts, and execution authority. */\nexport type AdaptOrchLinkSurface = \"doctor\" | \"wpl\";\n\nexport interface AdaptOrchLinks {\n\treadonly plans: string;\n\treadonly signup: string;\n\treadonly contact: string;\n\treadonly claimBoundary: string;\n}\n\n/** Pure offline handoff. Accepts no project, prompt, session, credential, or arbitrary URL. */\nexport function getAdaptOrchLinks(surface: AdaptOrchLinkSurface = \"wpl\"): AdaptOrchLinks {\n\tswitch (surface) {\n\t\tcase \"doctor\":\n\t\tcase \"wpl\":\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tthrow new TypeError(\"Unknown AdaptOrch link surface\");\n\t}\n\n\tfunction link(path: string, action: string): string {\n\t\tconst url = new URL(path, \"https://adaptorch.com\");\n\t\turl.searchParams.set(\"utm_source\", \"omk\");\n\t\turl.searchParams.set(\"utm_medium\", surface === \"doctor\" ? \"cli\" : \"library\");\n\t\turl.searchParams.set(\"utm_campaign\", \"omk-adaptorch-wpl\");\n\t\turl.searchParams.set(\"utm_content\", `${surface}-${action}`);\n\t\treturn url.href;\n\t}\n\n\treturn {\n\t\tplans: link(\"/#pricing\", \"plans\"),\n\t\tsignup: link(\"/app/signup\", \"signup\"),\n\t\tcontact: link(\"/#bookDemo\", \"contact\"),\n\t\tclaimBoundary: link(\"/claim-boundary\", \"claim-boundary\"),\n\t};\n}\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** Pure offline handoff. Accepts no project, prompt, session, credential, or arbitrary URL. */
|
|
2
|
+
export function getAdaptOrchLinks(surface = "wpl") {
|
|
3
|
+
switch (surface) {
|
|
4
|
+
case "doctor":
|
|
5
|
+
case "wpl":
|
|
6
|
+
break;
|
|
7
|
+
default:
|
|
8
|
+
throw new TypeError("Unknown AdaptOrch link surface");
|
|
9
|
+
}
|
|
10
|
+
function link(path, action) {
|
|
11
|
+
const url = new URL(path, "https://adaptorch.com");
|
|
12
|
+
url.searchParams.set("utm_source", "omk");
|
|
13
|
+
url.searchParams.set("utm_medium", surface === "doctor" ? "cli" : "library");
|
|
14
|
+
url.searchParams.set("utm_campaign", "omk-adaptorch-wpl");
|
|
15
|
+
url.searchParams.set("utm_content", `${surface}-${action}`);
|
|
16
|
+
return url.href;
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
plans: link("/#pricing", "plans"),
|
|
20
|
+
signup: link("/app/signup", "signup"),
|
|
21
|
+
contact: link("/#bookDemo", "contact"),
|
|
22
|
+
claimBoundary: link("/claim-boundary", "claim-boundary"),
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=service-links.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-links.js","sourceRoot":"","sources":["../src/service-links.ts"],"names":[],"mappings":"AAUA,+FAA+F;AAC/F,MAAM,UAAU,iBAAiB,CAAC,OAAO,GAAyB,KAAK,EAAkB;IACxF,QAAQ,OAAO,EAAE,CAAC;QACjB,KAAK,QAAQ,CAAC;QACd,KAAK,KAAK;YACT,MAAM;QACP;YACC,MAAM,IAAI,SAAS,CAAC,gCAAgC,CAAC,CAAC;IACxD,CAAC;IAED,SAAS,IAAI,CAAC,IAAY,EAAE,MAAc,EAAU;QACnD,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,IAAI,EAAE,uBAAuB,CAAC,CAAC;QACnD,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;QAC1C,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,YAAY,EAAE,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;QAC7E,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,cAAc,EAAE,mBAAmB,CAAC,CAAC;QAC1D,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,aAAa,EAAE,GAAG,OAAO,IAAI,MAAM,EAAE,CAAC,CAAC;QAC5D,OAAO,GAAG,CAAC,IAAI,CAAC;IAAA,CAChB;IAED,OAAO;QACN,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC;QACjC,MAAM,EAAE,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC;QACrC,OAAO,EAAE,IAAI,CAAC,YAAY,EAAE,SAAS,CAAC;QACtC,aAAa,EAAE,IAAI,CAAC,iBAAiB,EAAE,gBAAgB,CAAC;KACxD,CAAC;AAAA,CACF","sourcesContent":["/** Optional product navigation, separate from verdicts, receipts, and execution authority. */\nexport type AdaptOrchLinkSurface = \"doctor\" | \"wpl\";\n\nexport interface AdaptOrchLinks {\n\treadonly plans: string;\n\treadonly signup: string;\n\treadonly contact: string;\n\treadonly claimBoundary: string;\n}\n\n/** Pure offline handoff. Accepts no project, prompt, session, credential, or arbitrary URL. */\nexport function getAdaptOrchLinks(surface: AdaptOrchLinkSurface = \"wpl\"): AdaptOrchLinks {\n\tswitch (surface) {\n\t\tcase \"doctor\":\n\t\tcase \"wpl\":\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tthrow new TypeError(\"Unknown AdaptOrch link surface\");\n\t}\n\n\tfunction link(path: string, action: string): string {\n\t\tconst url = new URL(path, \"https://adaptorch.com\");\n\t\turl.searchParams.set(\"utm_source\", \"omk\");\n\t\turl.searchParams.set(\"utm_medium\", surface === \"doctor\" ? \"cli\" : \"library\");\n\t\turl.searchParams.set(\"utm_campaign\", \"omk-adaptorch-wpl\");\n\t\turl.searchParams.set(\"utm_content\", `${surface}-${action}`);\n\t\treturn url.href;\n\t}\n\n\treturn {\n\t\tplans: link(\"/#pricing\", \"plans\"),\n\t\tsignup: link(\"/app/signup\", \"signup\"),\n\t\tcontact: link(\"/#bookDemo\", \"contact\"),\n\t\tclaimBoundary: link(\"/claim-boundary\", \"claim-boundary\"),\n\t};\n}\n"]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AdaptOrch VERA vocabulary, mirrored from the engine's exported enums.
|
|
3
|
+
*
|
|
4
|
+
* Source of truth: the `StrEnum` classes in `adaptorch.vera_types`
|
|
5
|
+
* (`VerificationOutcomeKind`, `EvidenceCausality`, `EvidenceSeverity`,
|
|
6
|
+
* `VerificationDecision`, `DriftStatus`), read at engine revision
|
|
7
|
+
* `81b5fb2fe` on 2026-09-04. `test/vera-vocabulary-parity.test.ts` re-reads
|
|
8
|
+
* the engine source whenever a checkout is available (`ADAPTORCH_SOURCE`,
|
|
9
|
+
* default `/home/yu/projects/adaptorch`), so a value added or renamed on the
|
|
10
|
+
* engine side fails here instead of drifting silently. These arrays are the
|
|
11
|
+
* only place the values are written down on the OMK side; every guard and
|
|
12
|
+
* projection in this package derives from them.
|
|
13
|
+
*
|
|
14
|
+
* What a VERA decision is not: `SHIP` is a provenance-bearing classification
|
|
15
|
+
* of verifier evidence, never a release authorization or a correctness proof.
|
|
16
|
+
*/
|
|
17
|
+
/** Per-verifier outcome classification; candidate failures stay separate from environment failures. */
|
|
18
|
+
export declare const VERA_VERIFICATION_OUTCOME_KINDS: readonly ["PASS", "FAIL", "ENV_ERROR", "CANDIDATE_ERROR", "TIMEOUT", "FLAKY", "AMBIGUOUS", "SKIPPED"];
|
|
19
|
+
export type VeraVerificationOutcomeKind = (typeof VERA_VERIFICATION_OUTCOME_KINDS)[number];
|
|
20
|
+
/** Who is responsible for a piece of evidence. */
|
|
21
|
+
export declare const VERA_EVIDENCE_CAUSALITIES: readonly ["CandidateCaused", "EnvironmentCaused", "Ambiguous", "NotApplicable"];
|
|
22
|
+
export type VeraEvidenceCausality = (typeof VERA_EVIDENCE_CAUSALITIES)[number];
|
|
23
|
+
export declare const VERA_EVIDENCE_SEVERITIES: readonly ["critical", "major", "minor", "informational"];
|
|
24
|
+
export type VeraEvidenceSeverity = (typeof VERA_EVIDENCE_SEVERITIES)[number];
|
|
25
|
+
/** Final decision; `ABSTAIN` and `ESCALATE` are first-class results and never fold into `REJECT`. */
|
|
26
|
+
export declare const VERA_VERIFICATION_DECISIONS: readonly ["SHIP", "REJECT", "ABSTAIN", "ESCALATE", "INCONCLUSIVE_ENVIRONMENT"];
|
|
27
|
+
export type VeraVerificationDecision = (typeof VERA_VERIFICATION_DECISIONS)[number];
|
|
28
|
+
export declare const VERA_DRIFT_STATUSES: readonly ["VALID", "DEGRADED", "STALE", "INVALID"];
|
|
29
|
+
export type VeraDriftStatus = (typeof VERA_DRIFT_STATUSES)[number];
|
|
30
|
+
export declare const isVeraVerificationOutcomeKind: (value: unknown) => value is "AMBIGUOUS" | "CANDIDATE_ERROR" | "ENV_ERROR" | "FAIL" | "FLAKY" | "PASS" | "SKIPPED" | "TIMEOUT";
|
|
31
|
+
export declare const isVeraEvidenceCausality: (value: unknown) => value is "Ambiguous" | "CandidateCaused" | "EnvironmentCaused" | "NotApplicable";
|
|
32
|
+
export declare const isVeraEvidenceSeverity: (value: unknown) => value is "critical" | "informational" | "major" | "minor";
|
|
33
|
+
export declare const isVeraVerificationDecision: (value: unknown) => value is "ABSTAIN" | "ESCALATE" | "INCONCLUSIVE_ENVIRONMENT" | "REJECT" | "SHIP";
|
|
34
|
+
export declare const isVeraDriftStatus: (value: unknown) => value is "DEGRADED" | "INVALID" | "STALE" | "VALID";
|
|
35
|
+
//# sourceMappingURL=vera-vocabulary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vera-vocabulary.d.ts","sourceRoot":"","sources":["../src/vera-vocabulary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,uGAAuG;AACvG,eAAO,MAAM,+BAA+B,uGASlC,CAAC;AACX,MAAM,MAAM,2BAA2B,GAAG,CAAC,OAAO,+BAA+B,CAAC,CAAC,MAAM,CAAC,CAAC;AAE3F,kDAAkD;AAClD,eAAO,MAAM,yBAAyB,iFAK5B,CAAC;AACX,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,yBAAyB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE/E,eAAO,MAAM,wBAAwB,0DAA2D,CAAC;AACjG,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7E,qGAAqG;AACrG,eAAO,MAAM,2BAA2B,gFAM9B,CAAC;AACX,MAAM,MAAM,wBAAwB,GAAG,CAAC,OAAO,2BAA2B,CAAC,CAAC,MAAM,CAAC,CAAC;AAEpF,eAAO,MAAM,mBAAmB,oDAAqD,CAAC;AACtF,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAOnE,eAAO,MAAM,6BAA6B,gIAA4C,CAAC;AACvF,eAAO,MAAM,uBAAuB,sGAAsC,CAAC;AAC3E,eAAO,MAAM,sBAAsB,+EAAqC,CAAC;AACzE,eAAO,MAAM,0BAA0B,sGAAwC,CAAC;AAChF,eAAO,MAAM,iBAAiB,yEAAgC,CAAC","sourcesContent":["/**\n * AdaptOrch VERA vocabulary, mirrored from the engine's exported enums.\n *\n * Source of truth: the `StrEnum` classes in `adaptorch.vera_types`\n * (`VerificationOutcomeKind`, `EvidenceCausality`, `EvidenceSeverity`,\n * `VerificationDecision`, `DriftStatus`), read at engine revision\n * `81b5fb2fe` on 2026-09-04. `test/vera-vocabulary-parity.test.ts` re-reads\n * the engine source whenever a checkout is available (`ADAPTORCH_SOURCE`,\n * default `/home/yu/projects/adaptorch`), so a value added or renamed on the\n * engine side fails here instead of drifting silently. These arrays are the\n * only place the values are written down on the OMK side; every guard and\n * projection in this package derives from them.\n *\n * What a VERA decision is not: `SHIP` is a provenance-bearing classification\n * of verifier evidence, never a release authorization or a correctness proof.\n */\n\n/** Per-verifier outcome classification; candidate failures stay separate from environment failures. */\nexport const VERA_VERIFICATION_OUTCOME_KINDS = [\n\t\"PASS\",\n\t\"FAIL\",\n\t\"ENV_ERROR\",\n\t\"CANDIDATE_ERROR\",\n\t\"TIMEOUT\",\n\t\"FLAKY\",\n\t\"AMBIGUOUS\",\n\t\"SKIPPED\",\n] as const;\nexport type VeraVerificationOutcomeKind = (typeof VERA_VERIFICATION_OUTCOME_KINDS)[number];\n\n/** Who is responsible for a piece of evidence. */\nexport const VERA_EVIDENCE_CAUSALITIES = [\n\t\"CandidateCaused\",\n\t\"EnvironmentCaused\",\n\t\"Ambiguous\",\n\t\"NotApplicable\",\n] as const;\nexport type VeraEvidenceCausality = (typeof VERA_EVIDENCE_CAUSALITIES)[number];\n\nexport const VERA_EVIDENCE_SEVERITIES = [\"critical\", \"major\", \"minor\", \"informational\"] as const;\nexport type VeraEvidenceSeverity = (typeof VERA_EVIDENCE_SEVERITIES)[number];\n\n/** Final decision; `ABSTAIN` and `ESCALATE` are first-class results and never fold into `REJECT`. */\nexport const VERA_VERIFICATION_DECISIONS = [\n\t\"SHIP\",\n\t\"REJECT\",\n\t\"ABSTAIN\",\n\t\"ESCALATE\",\n\t\"INCONCLUSIVE_ENVIRONMENT\",\n] as const;\nexport type VeraVerificationDecision = (typeof VERA_VERIFICATION_DECISIONS)[number];\n\nexport const VERA_DRIFT_STATUSES = [\"VALID\", \"DEGRADED\", \"STALE\", \"INVALID\"] as const;\nexport type VeraDriftStatus = (typeof VERA_DRIFT_STATUSES)[number];\n\nfunction memberOf<const T extends readonly string[]>(values: T): (value: unknown) => value is T[number] {\n\tconst set: ReadonlySet<string> = new Set(values);\n\treturn (value: unknown): value is T[number] => typeof value === \"string\" && set.has(value);\n}\n\nexport const isVeraVerificationOutcomeKind = memberOf(VERA_VERIFICATION_OUTCOME_KINDS);\nexport const isVeraEvidenceCausality = memberOf(VERA_EVIDENCE_CAUSALITIES);\nexport const isVeraEvidenceSeverity = memberOf(VERA_EVIDENCE_SEVERITIES);\nexport const isVeraVerificationDecision = memberOf(VERA_VERIFICATION_DECISIONS);\nexport const isVeraDriftStatus = memberOf(VERA_DRIFT_STATUSES);\n"]}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AdaptOrch VERA vocabulary, mirrored from the engine's exported enums.
|
|
3
|
+
*
|
|
4
|
+
* Source of truth: the `StrEnum` classes in `adaptorch.vera_types`
|
|
5
|
+
* (`VerificationOutcomeKind`, `EvidenceCausality`, `EvidenceSeverity`,
|
|
6
|
+
* `VerificationDecision`, `DriftStatus`), read at engine revision
|
|
7
|
+
* `81b5fb2fe` on 2026-09-04. `test/vera-vocabulary-parity.test.ts` re-reads
|
|
8
|
+
* the engine source whenever a checkout is available (`ADAPTORCH_SOURCE`,
|
|
9
|
+
* default `/home/yu/projects/adaptorch`), so a value added or renamed on the
|
|
10
|
+
* engine side fails here instead of drifting silently. These arrays are the
|
|
11
|
+
* only place the values are written down on the OMK side; every guard and
|
|
12
|
+
* projection in this package derives from them.
|
|
13
|
+
*
|
|
14
|
+
* What a VERA decision is not: `SHIP` is a provenance-bearing classification
|
|
15
|
+
* of verifier evidence, never a release authorization or a correctness proof.
|
|
16
|
+
*/
|
|
17
|
+
/** Per-verifier outcome classification; candidate failures stay separate from environment failures. */
|
|
18
|
+
export const VERA_VERIFICATION_OUTCOME_KINDS = [
|
|
19
|
+
"PASS",
|
|
20
|
+
"FAIL",
|
|
21
|
+
"ENV_ERROR",
|
|
22
|
+
"CANDIDATE_ERROR",
|
|
23
|
+
"TIMEOUT",
|
|
24
|
+
"FLAKY",
|
|
25
|
+
"AMBIGUOUS",
|
|
26
|
+
"SKIPPED",
|
|
27
|
+
];
|
|
28
|
+
/** Who is responsible for a piece of evidence. */
|
|
29
|
+
export const VERA_EVIDENCE_CAUSALITIES = [
|
|
30
|
+
"CandidateCaused",
|
|
31
|
+
"EnvironmentCaused",
|
|
32
|
+
"Ambiguous",
|
|
33
|
+
"NotApplicable",
|
|
34
|
+
];
|
|
35
|
+
export const VERA_EVIDENCE_SEVERITIES = ["critical", "major", "minor", "informational"];
|
|
36
|
+
/** Final decision; `ABSTAIN` and `ESCALATE` are first-class results and never fold into `REJECT`. */
|
|
37
|
+
export const VERA_VERIFICATION_DECISIONS = [
|
|
38
|
+
"SHIP",
|
|
39
|
+
"REJECT",
|
|
40
|
+
"ABSTAIN",
|
|
41
|
+
"ESCALATE",
|
|
42
|
+
"INCONCLUSIVE_ENVIRONMENT",
|
|
43
|
+
];
|
|
44
|
+
export const VERA_DRIFT_STATUSES = ["VALID", "DEGRADED", "STALE", "INVALID"];
|
|
45
|
+
function memberOf(values) {
|
|
46
|
+
const set = new Set(values);
|
|
47
|
+
return (value) => typeof value === "string" && set.has(value);
|
|
48
|
+
}
|
|
49
|
+
export const isVeraVerificationOutcomeKind = memberOf(VERA_VERIFICATION_OUTCOME_KINDS);
|
|
50
|
+
export const isVeraEvidenceCausality = memberOf(VERA_EVIDENCE_CAUSALITIES);
|
|
51
|
+
export const isVeraEvidenceSeverity = memberOf(VERA_EVIDENCE_SEVERITIES);
|
|
52
|
+
export const isVeraVerificationDecision = memberOf(VERA_VERIFICATION_DECISIONS);
|
|
53
|
+
export const isVeraDriftStatus = memberOf(VERA_DRIFT_STATUSES);
|
|
54
|
+
//# sourceMappingURL=vera-vocabulary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vera-vocabulary.js","sourceRoot":"","sources":["../src/vera-vocabulary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,uGAAuG;AACvG,MAAM,CAAC,MAAM,+BAA+B,GAAG;IAC9C,MAAM;IACN,MAAM;IACN,WAAW;IACX,iBAAiB;IACjB,SAAS;IACT,OAAO;IACP,WAAW;IACX,SAAS;CACA,CAAC;AAGX,kDAAkD;AAClD,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACxC,iBAAiB;IACjB,mBAAmB;IACnB,WAAW;IACX,eAAe;CACN,CAAC;AAGX,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,eAAe,CAAU,CAAC;AAGjG,qGAAqG;AACrG,MAAM,CAAC,MAAM,2BAA2B,GAAG;IAC1C,MAAM;IACN,QAAQ;IACR,SAAS;IACT,UAAU;IACV,0BAA0B;CACjB,CAAC;AAGX,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,CAAU,CAAC;AAGtF,SAAS,QAAQ,CAAoC,MAAS,EAA0C;IACvG,MAAM,GAAG,GAAwB,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;IACjD,OAAO,CAAC,KAAc,EAAsB,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AAAA,CAC3F;AAED,MAAM,CAAC,MAAM,6BAA6B,GAAG,QAAQ,CAAC,+BAA+B,CAAC,CAAC;AACvF,MAAM,CAAC,MAAM,uBAAuB,GAAG,QAAQ,CAAC,yBAAyB,CAAC,CAAC;AAC3E,MAAM,CAAC,MAAM,sBAAsB,GAAG,QAAQ,CAAC,wBAAwB,CAAC,CAAC;AACzE,MAAM,CAAC,MAAM,0BAA0B,GAAG,QAAQ,CAAC,2BAA2B,CAAC,CAAC;AAChF,MAAM,CAAC,MAAM,iBAAiB,GAAG,QAAQ,CAAC,mBAAmB,CAAC,CAAC","sourcesContent":["/**\n * AdaptOrch VERA vocabulary, mirrored from the engine's exported enums.\n *\n * Source of truth: the `StrEnum` classes in `adaptorch.vera_types`\n * (`VerificationOutcomeKind`, `EvidenceCausality`, `EvidenceSeverity`,\n * `VerificationDecision`, `DriftStatus`), read at engine revision\n * `81b5fb2fe` on 2026-09-04. `test/vera-vocabulary-parity.test.ts` re-reads\n * the engine source whenever a checkout is available (`ADAPTORCH_SOURCE`,\n * default `/home/yu/projects/adaptorch`), so a value added or renamed on the\n * engine side fails here instead of drifting silently. These arrays are the\n * only place the values are written down on the OMK side; every guard and\n * projection in this package derives from them.\n *\n * What a VERA decision is not: `SHIP` is a provenance-bearing classification\n * of verifier evidence, never a release authorization or a correctness proof.\n */\n\n/** Per-verifier outcome classification; candidate failures stay separate from environment failures. */\nexport const VERA_VERIFICATION_OUTCOME_KINDS = [\n\t\"PASS\",\n\t\"FAIL\",\n\t\"ENV_ERROR\",\n\t\"CANDIDATE_ERROR\",\n\t\"TIMEOUT\",\n\t\"FLAKY\",\n\t\"AMBIGUOUS\",\n\t\"SKIPPED\",\n] as const;\nexport type VeraVerificationOutcomeKind = (typeof VERA_VERIFICATION_OUTCOME_KINDS)[number];\n\n/** Who is responsible for a piece of evidence. */\nexport const VERA_EVIDENCE_CAUSALITIES = [\n\t\"CandidateCaused\",\n\t\"EnvironmentCaused\",\n\t\"Ambiguous\",\n\t\"NotApplicable\",\n] as const;\nexport type VeraEvidenceCausality = (typeof VERA_EVIDENCE_CAUSALITIES)[number];\n\nexport const VERA_EVIDENCE_SEVERITIES = [\"critical\", \"major\", \"minor\", \"informational\"] as const;\nexport type VeraEvidenceSeverity = (typeof VERA_EVIDENCE_SEVERITIES)[number];\n\n/** Final decision; `ABSTAIN` and `ESCALATE` are first-class results and never fold into `REJECT`. */\nexport const VERA_VERIFICATION_DECISIONS = [\n\t\"SHIP\",\n\t\"REJECT\",\n\t\"ABSTAIN\",\n\t\"ESCALATE\",\n\t\"INCONCLUSIVE_ENVIRONMENT\",\n] as const;\nexport type VeraVerificationDecision = (typeof VERA_VERIFICATION_DECISIONS)[number];\n\nexport const VERA_DRIFT_STATUSES = [\"VALID\", \"DEGRADED\", \"STALE\", \"INVALID\"] as const;\nexport type VeraDriftStatus = (typeof VERA_DRIFT_STATUSES)[number];\n\nfunction memberOf<const T extends readonly string[]>(values: T): (value: unknown) => value is T[number] {\n\tconst set: ReadonlySet<string> = new Set(values);\n\treturn (value: unknown): value is T[number] => typeof value === \"string\" && set.has(value);\n}\n\nexport const isVeraVerificationOutcomeKind = memberOf(VERA_VERIFICATION_OUTCOME_KINDS);\nexport const isVeraEvidenceCausality = memberOf(VERA_EVIDENCE_CAUSALITIES);\nexport const isVeraEvidenceSeverity = memberOf(VERA_EVIDENCE_SEVERITIES);\nexport const isVeraVerificationDecision = memberOf(VERA_VERIFICATION_DECISIONS);\nexport const isVeraDriftStatus = memberOf(VERA_DRIFT_STATUSES);\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omk-adaptorch-wpl",
|
|
3
|
-
"version": "0.98.
|
|
3
|
+
"version": "0.98.4",
|
|
4
4
|
"description": "AdaptOrch-native Work Packet Loop (WPL) — state machine, verification layer, and integration bridge for OMK orchestration.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
},
|
|
15
15
|
"files": [
|
|
16
16
|
"dist",
|
|
17
|
-
"README.md"
|
|
17
|
+
"README.md",
|
|
18
|
+
"CHANGELOG.md"
|
|
18
19
|
],
|
|
19
20
|
"scripts": {
|
|
20
21
|
"clean": "shx rm -rf dist",
|
|
@@ -26,7 +27,7 @@
|
|
|
26
27
|
"orchestration",
|
|
27
28
|
"experimental"
|
|
28
29
|
],
|
|
29
|
-
"author": "
|
|
30
|
+
"author": "ClassicMate",
|
|
30
31
|
"license": "MIT",
|
|
31
32
|
"repository": {
|
|
32
33
|
"type": "git",
|