eval-quality 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +190 -0
- package/README.md +355 -0
- package/corpus/dev/README.md +36 -0
- package/corpus/dev/compile-seal-example/brief.json +1 -0
- package/corpus/dev/compile-seal-example/contract.json +1 -0
- package/corpus/dev/contracts/absent-collection-locations.json +1 -0
- package/corpus/dev/contracts/absent-sibling-groups.json +1 -0
- package/corpus/dev/contracts/absent-success-indicator.json +1 -0
- package/corpus/dev/contracts/empty-channel-roles.json +1 -0
- package/corpus/dev/contracts/empty-collection-locations.json +1 -0
- package/corpus/dev/contracts/empty-request-shapes.json +1 -0
- package/corpus/dev/contracts/empty-sibling-groups.json +1 -0
- package/corpus/dev/contracts/no-collection-quantifier.json +1 -0
- package/corpus/dev/contracts/no-operation-inventory.json +1 -0
- package/corpus/dev/contracts/no-read-back-relation.json +1 -0
- package/corpus/dev/contracts/no-state-change-marker.json +1 -0
- package/corpus/dev/contracts/no-type-violating-step.json +1 -0
- package/corpus/dev/contracts/per-key-split-oracles.json +1 -0
- package/corpus/dev/contracts/satisfied-declarations.json +1 -0
- package/corpus/dev/contracts/single-required-response-key.json +1 -0
- package/corpus/dev/contracts/split-indicator-oracle.json +1 -0
- package/corpus/dev/contracts/unaddressed-parameter-sibling.json +1 -0
- package/corpus/dev/contracts/unnamed-reference-set.json +1 -0
- package/corpus/dev/contracts/wrong-cardinality-form.json +1 -0
- package/corpus/dev/index.json +1 -0
- package/dist/adapters/index.d.ts +12 -0
- package/dist/adapters/index.js +3 -0
- package/dist/adapters/local-corpus-adapter.d.ts +7 -0
- package/dist/adapters/local-corpus-adapter.js +78 -0
- package/dist/adapters/node-file-system-adapter.d.ts +7 -0
- package/dist/adapters/node-file-system-adapter.js +39 -0
- package/dist/adapters/port-boundary.d.ts +18 -0
- package/dist/adapters/port-boundary.js +83 -0
- package/dist/adapters/system-clock-adapter.d.ts +10 -0
- package/dist/adapters/system-clock-adapter.js +18 -0
- package/dist/application/compile.d.ts +4 -0
- package/dist/application/compile.js +24 -0
- package/dist/application/diagnostics.d.ts +22 -0
- package/dist/application/diagnostics.js +18 -0
- package/dist/application/index.d.ts +23 -0
- package/dist/application/index.js +17 -0
- package/dist/application/invoke-port.d.ts +2 -0
- package/dist/application/invoke-port.js +45 -0
- package/dist/application/preflight.d.ts +27 -0
- package/dist/application/preflight.js +131 -0
- package/dist/application/seal.d.ts +4 -0
- package/dist/application/seal.js +28 -0
- package/dist/application/serialize.d.ts +6 -0
- package/dist/application/serialize.js +9 -0
- package/dist/cli/arguments.d.ts +28 -0
- package/dist/cli/arguments.js +167 -0
- package/dist/cli/exit-codes.d.ts +36 -0
- package/dist/cli/exit-codes.js +39 -0
- package/dist/cli/main.d.ts +2 -0
- package/dist/cli/main.js +143 -0
- package/dist/cli/render.d.ts +26 -0
- package/dist/cli/render.js +53 -0
- package/dist/cli/run.d.ts +41 -0
- package/dist/cli/run.js +203 -0
- package/dist/core/canonical/canonicalize.d.ts +1 -0
- package/dist/core/canonical/canonicalize.js +113 -0
- package/dist/core/canonical/digest.d.ts +7 -0
- package/dist/core/canonical/digest.js +81 -0
- package/dist/core/canonical/scan-json.d.ts +1 -0
- package/dist/core/canonical/scan-json.js +298 -0
- package/dist/core/canonical/value-domain.d.ts +4 -0
- package/dist/core/canonical/value-domain.js +113 -0
- package/dist/core/compile/compile.d.ts +24 -0
- package/dist/core/compile/compile.js +67 -0
- package/dist/core/compile/declarations.d.ts +5 -0
- package/dist/core/compile/declarations.js +22 -0
- package/dist/core/compile/expression-legality.d.ts +14 -0
- package/dist/core/compile/expression-legality.js +346 -0
- package/dist/core/compile/forbidden-inputs.d.ts +5 -0
- package/dist/core/compile/forbidden-inputs.js +19 -0
- package/dist/core/compile/interface-inventory.d.ts +10 -0
- package/dist/core/compile/interface-inventory.js +55 -0
- package/dist/core/compile/oracle-alignment.d.ts +14 -0
- package/dist/core/compile/oracle-alignment.js +93 -0
- package/dist/core/compile/reachability.d.ts +17 -0
- package/dist/core/compile/reachability.js +177 -0
- package/dist/core/compile/rubrics.d.ts +55 -0
- package/dist/core/compile/rubrics.js +198 -0
- package/dist/core/compile/scripting-bound.d.ts +5 -0
- package/dist/core/compile/scripting-bound.js +151 -0
- package/dist/core/compile/sensitivity-witness.d.ts +73 -0
- package/dist/core/compile/sensitivity-witness.js +232 -0
- package/dist/core/compile/waivers.d.ts +3 -0
- package/dist/core/compile/waivers.js +21 -0
- package/dist/core/coverage/coverage.d.ts +18 -0
- package/dist/core/coverage/coverage.js +47 -0
- package/dist/core/coverage/relevance.d.ts +75 -0
- package/dist/core/coverage/relevance.js +186 -0
- package/dist/core/coverage/rules.d.ts +7 -0
- package/dist/core/coverage/rules.js +18 -0
- package/dist/core/coverage/satisfaction.d.ts +107 -0
- package/dist/core/coverage/satisfaction.js +415 -0
- package/dist/core/coverage/table.d.ts +26 -0
- package/dist/core/coverage/table.js +222 -0
- package/dist/core/declared-inputs.d.ts +16 -0
- package/dist/core/declared-inputs.js +18 -0
- package/dist/core/evaluate/evidence-resolution.d.ts +54 -0
- package/dist/core/evaluate/evidence-resolution.js +153 -0
- package/dist/core/evaluate/operators.d.ts +87 -0
- package/dist/core/evaluate/operators.js +350 -0
- package/dist/core/evaluate/resolution.d.ts +40 -0
- package/dist/core/evaluate/resolution.js +336 -0
- package/dist/core/evaluate/resolved-value.d.ts +9 -0
- package/dist/core/evaluate/resolved-value.js +6 -0
- package/dist/core/failure-codes.d.ts +18 -0
- package/dist/core/failure-codes.js +50 -0
- package/dist/core/lineage/chain.d.ts +49 -0
- package/dist/core/lineage/chain.js +210 -0
- package/dist/core/lineage/freeze.d.ts +12 -0
- package/dist/core/lineage/freeze.js +35 -0
- package/dist/core/lineage/stage-table.d.ts +43 -0
- package/dist/core/lineage/stage-table.js +106 -0
- package/dist/core/preflight/plan.d.ts +67 -0
- package/dist/core/preflight/plan.js +313 -0
- package/dist/core/preflight/projection.d.ts +40 -0
- package/dist/core/preflight/projection.js +96 -0
- package/dist/core/preflight/reduce.d.ts +8 -0
- package/dist/core/preflight/reduce.js +180 -0
- package/dist/core/preflight/witness-evidence.d.ts +42 -0
- package/dist/core/preflight/witness-evidence.js +88 -0
- package/dist/core/probe/target-policy.d.ts +63 -0
- package/dist/core/probe/target-policy.js +328 -0
- package/dist/core/schemas/artifact-reference.d.ts +19 -0
- package/dist/core/schemas/artifact-reference.js +30 -0
- package/dist/core/schemas/artifact.d.ts +1153 -0
- package/dist/core/schemas/artifact.js +84 -0
- package/dist/core/schemas/constraint-ledger.d.ts +57 -0
- package/dist/core/schemas/constraint-ledger.js +143 -0
- package/dist/core/schemas/eval-contract.d.ts +402 -0
- package/dist/core/schemas/eval-contract.js +147 -0
- package/dist/core/schemas/evaluator-configuration.d.ts +37 -0
- package/dist/core/schemas/evaluator-configuration.js +43 -0
- package/dist/core/schemas/evidence-artifact.d.ts +471 -0
- package/dist/core/schemas/evidence-artifact.js +232 -0
- package/dist/core/schemas/expression.d.ts +197 -0
- package/dist/core/schemas/expression.js +284 -0
- package/dist/core/schemas/faults.d.ts +9 -0
- package/dist/core/schemas/faults.js +32 -0
- package/dist/core/schemas/interface.d.ts +417 -0
- package/dist/core/schemas/interface.js +115 -0
- package/dist/core/schemas/isolation-manifest.d.ts +136 -0
- package/dist/core/schemas/isolation-manifest.js +92 -0
- package/dist/core/schemas/lineage.d.ts +21 -0
- package/dist/core/schemas/lineage.js +28 -0
- package/dist/core/schemas/oracle.d.ts +72 -0
- package/dist/core/schemas/oracle.js +35 -0
- package/dist/core/schemas/plan.d.ts +115 -0
- package/dist/core/schemas/plan.js +58 -0
- package/dist/core/schemas/pointer.d.ts +63 -0
- package/dist/core/schemas/pointer.js +94 -0
- package/dist/core/schemas/port-messages.d.ts +103 -0
- package/dist/core/schemas/port-messages.js +90 -0
- package/dist/core/schemas/preflight-verdict.d.ts +60 -0
- package/dist/core/schemas/preflight-verdict.js +38 -0
- package/dist/core/schemas/primitives.d.ts +78 -0
- package/dist/core/schemas/primitives.js +121 -0
- package/dist/core/schemas/private-artifact-manifest.d.ts +56 -0
- package/dist/core/schemas/private-artifact-manifest.js +46 -0
- package/dist/core/schemas/probe-body.d.ts +25 -0
- package/dist/core/schemas/probe-body.js +23 -0
- package/dist/core/schemas/probe-policy.d.ts +76 -0
- package/dist/core/schemas/probe-policy.js +33 -0
- package/dist/core/schemas/probe.d.ts +189 -0
- package/dist/core/schemas/probe.js +82 -0
- package/dist/core/schemas/publish.d.ts +30 -0
- package/dist/core/schemas/publish.js +135 -0
- package/dist/core/schemas/reference-set.d.ts +18 -0
- package/dist/core/schemas/reference-set.js +27 -0
- package/dist/core/schemas/rubric.d.ts +62 -0
- package/dist/core/schemas/rubric.js +68 -0
- package/dist/core/schemas/scoring-policy.d.ts +28 -0
- package/dist/core/schemas/scoring-policy.js +51 -0
- package/dist/core/schemas/sealed-evaluator-brief.d.ts +80 -0
- package/dist/core/schemas/sealed-evaluator-brief.js +59 -0
- package/dist/core/schemas/sealed-run-record.d.ts +382 -0
- package/dist/core/schemas/sealed-run-record.js +215 -0
- package/dist/core/schemas/sensitivity-witness.d.ts +138 -0
- package/dist/core/schemas/sensitivity-witness.js +86 -0
- package/dist/core/schemas/verdict.d.ts +25 -0
- package/dist/core/schemas/verdict.js +20 -0
- package/dist/core/schemas/waiver.d.ts +17 -0
- package/dist/core/schemas/waiver.js +24 -0
- package/dist/core/seal/derived-reference.d.ts +36 -0
- package/dist/core/seal/derived-reference.js +383 -0
- package/dist/core/seal/direction-prose.d.ts +13 -0
- package/dist/core/seal/direction-prose.js +120 -0
- package/dist/core/seal/plan-index.d.ts +63 -0
- package/dist/core/seal/plan-index.js +155 -0
- package/dist/core/seal/scripting-audit.d.ts +15 -0
- package/dist/core/seal/scripting-audit.js +51 -0
- package/dist/core/seal/seal.d.ts +18 -0
- package/dist/core/seal/seal.js +155 -0
- package/dist/core/stage-contracts.d.ts +30 -0
- package/dist/core/stage-contracts.js +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +22 -0
- package/dist/ports/clock-port.d.ts +13 -0
- package/dist/ports/clock-port.js +7 -0
- package/dist/ports/corpus-port.d.ts +16 -0
- package/dist/ports/corpus-port.js +7 -0
- package/dist/ports/environment-probe-port.d.ts +76 -0
- package/dist/ports/environment-probe-port.js +32 -0
- package/dist/ports/file-system-port.d.ts +27 -0
- package/dist/ports/file-system-port.js +11 -0
- package/dist/ports/port.d.ts +33 -0
- package/dist/ports/port.js +14 -0
- package/dist/testing/conformance.d.ts +88 -0
- package/dist/testing/conformance.js +281 -0
- package/dist/testing/index.d.ts +26 -0
- package/dist/testing/index.js +18 -0
- package/dist/testing/probe-conformance.d.ts +45 -0
- package/dist/testing/probe-conformance.js +186 -0
- package/package.json +130 -0
- package/schemas/artifact-reference.schema.json +64 -0
- package/schemas/eval-contract.schema.json +2145 -0
- package/schemas/evaluator-configuration.schema.json +199 -0
- package/schemas/evidence-artifact.schema.json +1229 -0
- package/schemas/isolation-manifest.schema.json +394 -0
- package/schemas/preflight-verdict.schema.json +114 -0
- package/schemas/private-artifact-manifest.schema.json +103 -0
- package/schemas/probe.schema.json +1151 -0
- package/schemas/rubric.schema.json +148 -0
- package/schemas/scoring-policy.schema.json +90 -0
- package/schemas/sealed-evaluator-brief.schema.json +268 -0
- package/schemas/sealed-run-record.schema.json +875 -0
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
/** the caller's inbound record of one sealed evaluator trial. */
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { ArtifactReference } from './artifact-reference.js';
|
|
4
|
+
import { Severity } from './eval-contract.js';
|
|
5
|
+
import { lineageFields } from './lineage.js';
|
|
6
|
+
import { EvidenceChannel } from './pointer.js';
|
|
7
|
+
import { BehaviorId, Digest, FindingId, Identifier, JsonObjectValue, JsonValue, OracleId, ProbeId, RubricCriterionId, RubricId, UnsignedDecimalString, } from './primitives.js';
|
|
8
|
+
import { EvaluatorRecommendation } from './verdict.js';
|
|
9
|
+
/**
|
|
10
|
+
* AD-23's verbatim quotation, paired with the channel it came from: a
|
|
11
|
+
* quotation with no channel cannot be audited against its source observation
|
|
12
|
+
* (ADR-009 Decision 2).
|
|
13
|
+
*/
|
|
14
|
+
export const QuotedEvidence = z.strictObject({
|
|
15
|
+
quote: z
|
|
16
|
+
.string()
|
|
17
|
+
.min(1)
|
|
18
|
+
.describe("The evaluator's verbatim quotation, per AD-23. Non-empty: an empty quotation quotes nothing, no AD-5 code names the condition, and under the admit-rule's second clause the schema is therefore the enforcement point. That this text appears in at least one of the finding's cited observations is NOT checked here; it is an AD-32 declared-versus-observed inconsistency that invalidates at ingest, and ADR-009 Decision 2 settles the precedence: \"cited identifiers govern the witness match; quotation audits it.\""),
|
|
19
|
+
channel: EvidenceChannel,
|
|
20
|
+
});
|
|
21
|
+
// Spread into each finding branch rather than shared as a base object: a
|
|
22
|
+
// spread adds no `$defs` entry, so each branch exports as a complete shape a
|
|
23
|
+
// non-TypeScript consumer can read without following a reference (AD-13).
|
|
24
|
+
const findingCommonFields = {
|
|
25
|
+
findingId: FindingId,
|
|
26
|
+
oracleId: OracleId.nullable().describe('The oracle this finding answers. Nullable because AD-23 is explicit that "a finding citing no oracle is retained as an uncited finding rather than discarded", and it is often the evaluator-chosen detection the AD exists to preserve. The carve-out is oracle-only and is deliberately not extended to `probeId`.'),
|
|
27
|
+
probeId: ProbeId.describe("Required, unlike `oracleId`. AD-23 carves out the no-oracle case and nothing else; a finding arises during some probe's run, so citing the probe is always possible, and AD-7's per-class vector cannot attribute a finding that names no probe."),
|
|
28
|
+
behaviorId: BehaviorId.nullable().describe('The behaviour at issue, where the finding names one. `null` for a finding that answers no declared behaviour, which is the same case `oracleId: null` records.'),
|
|
29
|
+
severity: Severity,
|
|
30
|
+
summary: z.string().min(1),
|
|
31
|
+
confidence: z
|
|
32
|
+
.number()
|
|
33
|
+
.min(0)
|
|
34
|
+
.max(1)
|
|
35
|
+
.describe('AD-24 requires per-finding confidence "on a declared scale" and declares no scale, so the closed unit interval is declared here: 0 through 1 inclusive. It exports `minimum` and `maximum` natively, and it is the same scale the scoring policy\'s `confidenceThreshold` uses, or AD-21\'s "a finding whose confidence falls below the policy threshold" would compare two different scales.'),
|
|
36
|
+
observationIds: z
|
|
37
|
+
.array(Identifier)
|
|
38
|
+
.describe("The observations this finding relies on. Declared on every branch, not only on `defect`: AD-23's word is *additionally*, which is a floor on `defect` rather than a prohibition on the other two, and the architecture's own worked record carries observation identifiers on a `confirmation` and on an `observation` finding. A defect-only field would turn those into `unrecognized_keys` failures for no AD reason. That a cited identifier matches a declared observation is a cross-artifact rule with no AD-5 code and is left to ingest."),
|
|
39
|
+
evidenceArtifacts: z
|
|
40
|
+
.array(ArtifactReference)
|
|
41
|
+
.describe("References to the evidence this finding rests on. Nothing to do with this package's `EvidenceArtifact`, which is the scored output `emit` owns: two unrelated things one word apart, named here so a reader does not reach for the wrong type."),
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* `defect` findings additionally require observation identifiers and quoted
|
|
45
|
+
* evidence (AD-23). A nullable field can't express "required on this branch
|
|
46
|
+
* only", so this is a discriminated union, the house treatment for a
|
|
47
|
+
* conditional (AD-13).
|
|
48
|
+
*/
|
|
49
|
+
export const Finding = z
|
|
50
|
+
.discriminatedUnion('findingType', [
|
|
51
|
+
z
|
|
52
|
+
.strictObject({
|
|
53
|
+
findingType: z.literal('defect'),
|
|
54
|
+
...findingCommonFields,
|
|
55
|
+
observationIds: z
|
|
56
|
+
.array(Identifier)
|
|
57
|
+
.min(1)
|
|
58
|
+
.describe('Tightened to at least one on this branch, which is AD-23\'s "additionally" expressed structurally: a defect claim citing no witness is what AD-40 calls an invalidating declared-versus-observed inconsistency, and the minimum is the half of that rule a schema can carry.'),
|
|
59
|
+
quotedEvidence: z
|
|
60
|
+
.array(QuotedEvidence)
|
|
61
|
+
.min(1)
|
|
62
|
+
.describe('Required and non-empty on this branch alone, per AD-23. Only `defect` findings enter a detection measure, and a detection claim with no quotation is the shape AD-40 records revision 4 having no way to match.'),
|
|
63
|
+
})
|
|
64
|
+
.describe('A claimed defect. The only finding type that enters a detection measure under AD-23, and the only one carrying required quoted evidence.'),
|
|
65
|
+
z
|
|
66
|
+
.strictObject({
|
|
67
|
+
findingType: z.literal('observation'),
|
|
68
|
+
...findingCommonFields,
|
|
69
|
+
})
|
|
70
|
+
.describe('A non-defect note about the interface or the evidence. Carries no quoted evidence requirement and never enters a detection measure.'),
|
|
71
|
+
z
|
|
72
|
+
.strictObject({
|
|
73
|
+
findingType: z.literal('confirmation'),
|
|
74
|
+
...findingCommonFields,
|
|
75
|
+
})
|
|
76
|
+
.describe('A record that a behaviour held. AD-6 resolves it to `confirmed`, the state revision 3 added after `passed-clean-control` was being misused for it.'),
|
|
77
|
+
])
|
|
78
|
+
.meta({ id: 'Finding' });
|
|
79
|
+
/**
|
|
80
|
+
* AD-23 requires one disposition per required oracle: held, violated, or
|
|
81
|
+
* not-attempted. The three words are AD-23's own vocabulary.
|
|
82
|
+
*/
|
|
83
|
+
export const ORACLE_DISPOSITIONS = [
|
|
84
|
+
'held',
|
|
85
|
+
'violated',
|
|
86
|
+
'not-attempted',
|
|
87
|
+
];
|
|
88
|
+
export const OracleDispositionValue = z.enum(ORACLE_DISPOSITIONS);
|
|
89
|
+
export const OracleDisposition = z.strictObject({
|
|
90
|
+
oracleId: OracleId,
|
|
91
|
+
disposition: OracleDispositionValue,
|
|
92
|
+
observationIds: z
|
|
93
|
+
.array(Identifier)
|
|
94
|
+
.describe('Required and permitted to be empty. AD-33 requires "every disposition citing supporting observations, and an unsupported disposition invalidating cross-artifact agreement rather than being believed", so an unsupported disposition has to stay representable for the scorer to invalidate it. That one disposition exists per required oracle is likewise not refined: AD-23 makes a missing disposition an AD-21 invalidating condition, so the schema admits the shape and ingest fires the rung.'),
|
|
95
|
+
note: z.string().nullable(),
|
|
96
|
+
});
|
|
97
|
+
/**
|
|
98
|
+
* A flat map would break pointer addressing: AD-26 keys `call-inputs` by
|
|
99
|
+
* transport channel, so a pointer like
|
|
100
|
+
* `/interactions/write/call-inputs/body/title` needs that segment to resolve
|
|
101
|
+
* against. A four-key strict object rather than a record over the transport
|
|
102
|
+
* enum, for the same reason as `RequestShape` and `InputBinding`: a record
|
|
103
|
+
* demands every enum member at parse time, but a real observation binds only
|
|
104
|
+
* a subset.
|
|
105
|
+
*/
|
|
106
|
+
export const ObservedCallInputs = z.strictObject({
|
|
107
|
+
path: JsonObjectValue.nullable(),
|
|
108
|
+
query: JsonObjectValue.nullable(),
|
|
109
|
+
header: JsonObjectValue.nullable(),
|
|
110
|
+
body: JsonObjectValue.nullable(),
|
|
111
|
+
});
|
|
112
|
+
/**
|
|
113
|
+
* One ingested observation, carrying AD-26's closed channel set so every
|
|
114
|
+
* pointer in the addressing grammar has something to resolve against.
|
|
115
|
+
*
|
|
116
|
+
* Observation ordering is deliberately absent (Owed item 2): ADR-006 forbids
|
|
117
|
+
* using array position as ordering, and the fix, a monotonic sequence, arrives
|
|
118
|
+
* as an additive `schemaVersion` bump under AD-11.
|
|
119
|
+
*/
|
|
120
|
+
export const Observation = z.strictObject({
|
|
121
|
+
observationId: Identifier,
|
|
122
|
+
operationId: Identifier.describe('The operation this observation exercised. `Operation.operationId` is scoped to a `PermittedInterface`, so two interfaces may declare the same one; that collision is a cross-artifact rule with no AD-5 code, since `duplicate-operation-signature` covers method plus path template only, and it is left to ingest.'),
|
|
123
|
+
provenance: z
|
|
124
|
+
.enum(['baseline', 'evaluator-chosen'])
|
|
125
|
+
.describe("AD-23: `baseline` for a pre-canned or deterministic test, `evaluator-chosen` for an action the evaluator selected. The distinction is the one the product's central finding rests on: what a sealed evaluator detects beyond the pre-canned baseline. It lives on the observation, never on the finding."),
|
|
126
|
+
callInputs: ObservedCallInputs,
|
|
127
|
+
responseBody: JsonValue.nullable().describe('AD-26\'s `response-body` channel. The null branch is redundant against the value container, which already admits `null`; it is kept so all ten observation fields read the same way, and it means "no body observed" and "a body that was JSON null" are indistinguishable here, which is an accepted cost of one uniform spelling.'),
|
|
128
|
+
responseHeaders: JsonObjectValue.nullable().describe('A name-to-value map, not the open value container. AD-26 gives `response-headers` a tail, so a pointer resolves INTO this channel; a scalar here would leave `/interactions/x/response-headers/Content-Type` addressing nothing. That is the difference from `responseBody`, where a scalar or an array is a legitimate body and the open container is correct.'),
|
|
129
|
+
responseStatus: z
|
|
130
|
+
.int()
|
|
131
|
+
.min(0)
|
|
132
|
+
.nullable()
|
|
133
|
+
.describe('Deliberately not bounded to a protocol range. A negative status is meaningless and excluded, but the upper end is left open: AD-19 declares four interface kinds and v0 rejects three of them at compile time under `unsupported-interface-kind`, so bounding this to HTTP would encode a protocol assumption the artifact outlives. `null` where the channel does not apply.'),
|
|
134
|
+
stdout: z.string().nullable(),
|
|
135
|
+
stderr: z.string().nullable(),
|
|
136
|
+
exitCode: z
|
|
137
|
+
.int()
|
|
138
|
+
.nullable()
|
|
139
|
+
.describe('Signed on purpose, unlike `responseStatus`: a process terminated by a signal is conventionally reported as a negative code, and this field records what was observed rather than what is tidy.'),
|
|
140
|
+
});
|
|
141
|
+
/**
|
|
142
|
+
* AD-17: judge results arrive inside the sealed run record and the package
|
|
143
|
+
* never calls a judge.
|
|
144
|
+
*/
|
|
145
|
+
export const JudgeResult = z.strictObject({
|
|
146
|
+
rubricId: RubricId,
|
|
147
|
+
criterionId: RubricCriterionId,
|
|
148
|
+
score: z
|
|
149
|
+
.int()
|
|
150
|
+
.nullable()
|
|
151
|
+
.describe("An integer, because AD-22 puts the scale on the rubric's own anchored levels and `ScaleLevel.level` is already `z.int()`; no second scale is minted here. `null` is the shape AD-6's `judge-error` fires on, so it must parse. That the criterion is one the cited rubric declares, and that a conforming record shows one judge call scoring all named criteria, are AD-17 cross-artifact rules a schema over one artifact cannot see."),
|
|
152
|
+
note: z.string().nullable(),
|
|
153
|
+
});
|
|
154
|
+
/** the prior art's five members, with money as a string per AD-36. */
|
|
155
|
+
export const ResourceUse = z.strictObject({
|
|
156
|
+
toolCalls: z.int().min(0),
|
|
157
|
+
inputTokens: z.int().min(0),
|
|
158
|
+
outputTokens: z.int().min(0),
|
|
159
|
+
wallClockSeconds: z
|
|
160
|
+
.number()
|
|
161
|
+
.min(0)
|
|
162
|
+
.describe("Stays a number where money becomes a string: a measured duration is not currency, and the worked example's 62.5 is an exact binary64 inside AD-36's value domain."),
|
|
163
|
+
costUsd: UnsignedDecimalString.describe("Money, so AD-36 carries it as a string in a declared format. The prior art's number does not survive; an AD-24 divergence."),
|
|
164
|
+
});
|
|
165
|
+
/**
|
|
166
|
+
* AD-21's FAIL rung reads on evidence that is incomplete, over-truncated,
|
|
167
|
+
* unavailable, or internally inconsistent (AD-17), but no artifact declares
|
|
168
|
+
* those fields. Two of the four are caller statements and land here; the other
|
|
169
|
+
* two are derived and declared nowhere.
|
|
170
|
+
*/
|
|
171
|
+
export const EvidenceDisclosure = z.strictObject({
|
|
172
|
+
truncationBound: z
|
|
173
|
+
.int()
|
|
174
|
+
.min(0)
|
|
175
|
+
.nullable()
|
|
176
|
+
.describe('AD-17 requires truncation to be "deterministic, disclosed with its bound". `null` is untruncated. The unit is left to the caller and stated rather than encoded, following the `RubricBody.maxLength` precedent for AD-22\'s equally unitless "bounded length". The over-truncated condition compares this bound against the evidence carried in this same artifact, which is why the disclosure and the evidence travel together.'),
|
|
177
|
+
reportedIncomplete: z
|
|
178
|
+
.boolean()
|
|
179
|
+
.describe('AD-17: "a case that cannot be bounded without discarding disconfirming material is reported incomplete". This is the operand AD-21\'s incomplete condition reads. The remaining two conditions read no field here: unavailable is an `ArtifactReference` that does not resolve through the corpus port, and internally inconsistent is AD-32\'s cross-artifact agreement check. AD-17\'s "must retain evidence contradicting the leading verdict" is decidable by none of them and is recorded as unenforced in v0.'),
|
|
180
|
+
});
|
|
181
|
+
export const SealedRunRecord = z
|
|
182
|
+
.strictObject({
|
|
183
|
+
...lineageFields,
|
|
184
|
+
runId: z
|
|
185
|
+
.string()
|
|
186
|
+
.min(1)
|
|
187
|
+
.describe('An opaque caller label. Carried over from the prior art unchanged.'),
|
|
188
|
+
conditionArm: z
|
|
189
|
+
.string()
|
|
190
|
+
.min(1)
|
|
191
|
+
.describe("An opaque caller label with no product semantics, per AD-24. The prior art's five-member enum does not survive, and its own extension history is the reason: an enum a local amendment had to widen once for `self-review` will be widened again."),
|
|
192
|
+
trialIndex: z
|
|
193
|
+
.int()
|
|
194
|
+
.min(1)
|
|
195
|
+
.describe("Which trial this record is. AD-24 excludes the trial index from the Evaluator Configuration \"so trials pool into one scoring version\", which requires it somewhere else, and a Sealed Run Record is the only artifact carrying exactly one trial. One-based, matching the only instance that exists. AD-6's aggregate of trial count, invalidated attempts, and each attempt's reason is the Evidence Artifact's; asking one run to report its siblings is what no stage signature can do."),
|
|
196
|
+
contractDigest: Digest,
|
|
197
|
+
sealedBriefDigest: Digest,
|
|
198
|
+
evaluatorConfigurationDigest: Digest.describe('A bare digest rather than an `ArtifactReference`, and required on both this record and the isolation manifest. AD-32 requires the two to *agree*, and an `ArtifactReference` on one side against a bare digest on the other makes the comparison lopsided; AD-2 already has ingest receiving the Evaluator Configuration as its own input, so nothing needs resolving through a reference. The agreement itself is a cross-artifact rule no schema can see.'),
|
|
199
|
+
evaluatorRecommendation: EvaluatorRecommendation,
|
|
200
|
+
oracleDispositions: z.array(OracleDisposition),
|
|
201
|
+
findings: z.array(Finding),
|
|
202
|
+
observations: z.array(Observation),
|
|
203
|
+
judgeResults: z
|
|
204
|
+
.array(JudgeResult)
|
|
205
|
+
.describe('Empty is legal: a contract with no rubric produces no judge call.'),
|
|
206
|
+
actionsArtifact: ArtifactReference,
|
|
207
|
+
isolationManifestArtifact: ArtifactReference,
|
|
208
|
+
resourceUse: ResourceUse,
|
|
209
|
+
evidenceDisclosure: EvidenceDisclosure,
|
|
210
|
+
invalidReason: z.string().nullable(),
|
|
211
|
+
})
|
|
212
|
+
.meta({
|
|
213
|
+
id: 'SealedRunRecord',
|
|
214
|
+
description: "One sealed evaluator trial, as the caller presents it. Succeeds the prior-art `h0-run-result` schema per AD-24, keeping its run identifier, condition arm, findings, action-log reference, resource use, invalidation reason, evaluator recommendation as a closed enum, and per-finding confidence on a declared scale. Divergences: `condition` is demoted to the opaque `conditionArm`, `verdict` becomes `evaluatorRecommendation` without `NOT_APPLICABLE`, money is a decimal string, and `taskId`, `note`, and per-finding `actionIds` do not survive: the contract is pinned by `contractDigest`, an unstructured orchestrator annotation is the free-prose channel the Conventions close everywhere else, and two citation vocabularies on one finding is the ambiguity ADR-009 removed. Two constructions are deliberately absent and each is owed to an open item: the run MODE, which AD-21 requires to be fixed before ingest and to enter AD-11's identity inputs rather than appearing first in the evidence artifact (Owed item 4), and observation ORDERING, which ADR-006 forbids reading off array position (Owed item 2). Both arrive as additive `schemaVersion` bumps under AD-11.",
|
|
215
|
+
});
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/** AD-10's typed witnesses and the fixture-reset declaration. */
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { Expression } from './expression.ts';
|
|
4
|
+
/**
|
|
5
|
+
* The four transport channels one probe leg supplies, as values. `RequestShape`
|
|
6
|
+
* declares what an operation accepts; this declares what one leg sends. AD-18
|
|
7
|
+
* applies here too, so a header value carries no credential.
|
|
8
|
+
*
|
|
9
|
+
* `header` and `body` use the port's own spelling: a header value is a string
|
|
10
|
+
* at the boundary, and a body has to tell an absent body from a JSON null. A
|
|
11
|
+
* leg the plan could not map onto a `ProbeRequest` would declare work nothing
|
|
12
|
+
* runs.
|
|
13
|
+
*/
|
|
14
|
+
export declare const WitnessInputs: z.ZodObject<{
|
|
15
|
+
path: z.ZodType<import("./primitives.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonObject, unknown>>;
|
|
16
|
+
query: z.ZodType<import("./primitives.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonObject, unknown>>;
|
|
17
|
+
header: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
18
|
+
body: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
19
|
+
kind: z.ZodLiteral<"json">;
|
|
20
|
+
value: z.ZodType<import("./primitives.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonValue, unknown>>;
|
|
21
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
22
|
+
kind: z.ZodLiteral<"absent">;
|
|
23
|
+
}, z.core.$strict>], "kind">;
|
|
24
|
+
}, z.core.$strict>;
|
|
25
|
+
export type WitnessInputs = z.infer<typeof WitnessInputs>;
|
|
26
|
+
/**
|
|
27
|
+
* Half a witness pair. `legId` roots the relation's pointers, which address this
|
|
28
|
+
* leg's response as `/interactions/{legId}/response-body/...`, so it shares one
|
|
29
|
+
* namespace with interaction-plan step ids.
|
|
30
|
+
*/
|
|
31
|
+
export declare const SensitivityWitnessLeg: z.ZodObject<{
|
|
32
|
+
legId: z.ZodString;
|
|
33
|
+
inputs: z.ZodObject<{
|
|
34
|
+
path: z.ZodType<import("./primitives.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonObject, unknown>>;
|
|
35
|
+
query: z.ZodType<import("./primitives.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonObject, unknown>>;
|
|
36
|
+
header: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
37
|
+
body: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
38
|
+
kind: z.ZodLiteral<"json">;
|
|
39
|
+
value: z.ZodType<import("./primitives.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonValue, unknown>>;
|
|
40
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
41
|
+
kind: z.ZodLiteral<"absent">;
|
|
42
|
+
}, z.core.$strict>], "kind">;
|
|
43
|
+
}, z.core.$strict>;
|
|
44
|
+
}, z.core.$strict>;
|
|
45
|
+
export type SensitivityWitnessLeg = z.infer<typeof SensitivityWitnessLeg>;
|
|
46
|
+
export declare const WITNESS_CHANNELS: readonly ['path', 'query', 'body'];
|
|
47
|
+
export declare const WitnessChannel: z.ZodEnum<{
|
|
48
|
+
body: "body";
|
|
49
|
+
path: "path";
|
|
50
|
+
query: "query";
|
|
51
|
+
}>;
|
|
52
|
+
export type WitnessChannel = z.infer<typeof WitnessChannel>;
|
|
53
|
+
/**
|
|
54
|
+
* AD-10's typed sensitivity witness: a pair of inputs and the AD-4 relation
|
|
55
|
+
* their responses must satisfy. Per operation, because an interface-scoped
|
|
56
|
+
* check let an identifier-blind read pass on a body-sensitive sibling, and
|
|
57
|
+
* cannot be performed at all on a read-only interface.
|
|
58
|
+
*
|
|
59
|
+
* The relation is declared because inequality decides nothing on its own: two
|
|
60
|
+
* distinct nonexistent identifiers both return the same 404, and an input-blind
|
|
61
|
+
* response carrying a request identifier differs every time.
|
|
62
|
+
*
|
|
63
|
+
* `legs` is a length-pinned array. `z.tuple` exports `prefixItems` with no
|
|
64
|
+
* length keyword, so `.length(2)` is what puts `minItems` and `maxItems` in the
|
|
65
|
+
* published schema.
|
|
66
|
+
*/
|
|
67
|
+
export declare const SensitivityWitness: z.ZodObject<{
|
|
68
|
+
witnessId: z.ZodString;
|
|
69
|
+
channel: z.ZodEnum<{
|
|
70
|
+
body: "body";
|
|
71
|
+
path: "path";
|
|
72
|
+
query: "query";
|
|
73
|
+
}>;
|
|
74
|
+
legs: z.ZodArray<z.ZodObject<{
|
|
75
|
+
legId: z.ZodString;
|
|
76
|
+
inputs: z.ZodObject<{
|
|
77
|
+
path: z.ZodType<import("./primitives.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonObject, unknown>>;
|
|
78
|
+
query: z.ZodType<import("./primitives.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonObject, unknown>>;
|
|
79
|
+
header: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
80
|
+
body: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
81
|
+
kind: z.ZodLiteral<"json">;
|
|
82
|
+
value: z.ZodType<import("./primitives.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonValue, unknown>>;
|
|
83
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
84
|
+
kind: z.ZodLiteral<"absent">;
|
|
85
|
+
}, z.core.$strict>], "kind">;
|
|
86
|
+
}, z.core.$strict>;
|
|
87
|
+
}, z.core.$strict>>;
|
|
88
|
+
relation: z.ZodType<Expression, unknown, z.core.$ZodTypeInternals<Expression, unknown>>;
|
|
89
|
+
}, z.core.$strict>;
|
|
90
|
+
export type SensitivityWitness = z.infer<typeof SensitivityWitness>;
|
|
91
|
+
/**
|
|
92
|
+
* AD-10's manifestation witness: which operation to probe, with what inputs, and
|
|
93
|
+
* the AD-4 relation that is true exactly when the seeded fault has fired.
|
|
94
|
+
*
|
|
95
|
+
* A different mechanism from AD-40's DEFECT SIGNATURE, which matches a
|
|
96
|
+
* scoring-side finding against an observation. This one never enters a score; it
|
|
97
|
+
* makes "every declared seeded fault observed to fire" decidable at pre-flight.
|
|
98
|
+
*/
|
|
99
|
+
export declare const ManifestationWitness: z.ZodObject<{
|
|
100
|
+
legId: z.ZodString;
|
|
101
|
+
interfaceId: z.ZodString;
|
|
102
|
+
operationId: z.ZodString;
|
|
103
|
+
inputs: z.ZodObject<{
|
|
104
|
+
path: z.ZodType<import("./primitives.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonObject, unknown>>;
|
|
105
|
+
query: z.ZodType<import("./primitives.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonObject, unknown>>;
|
|
106
|
+
header: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
107
|
+
body: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
108
|
+
kind: z.ZodLiteral<"json">;
|
|
109
|
+
value: z.ZodType<import("./primitives.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonValue, unknown>>;
|
|
110
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
111
|
+
kind: z.ZodLiteral<"absent">;
|
|
112
|
+
}, z.core.$strict>], "kind">;
|
|
113
|
+
}, z.core.$strict>;
|
|
114
|
+
relation: z.ZodType<Expression, unknown, z.core.$ZodTypeInternals<Expression, unknown>>;
|
|
115
|
+
}, z.core.$strict>;
|
|
116
|
+
export type ManifestationWitness = z.infer<typeof ManifestationWitness>;
|
|
117
|
+
/**
|
|
118
|
+
* The operation that returns the fixture to its clean state. AD-10 verifies the
|
|
119
|
+
* per-run reset differentially, and the reset is an ordinary declared operation,
|
|
120
|
+
* so it goes through the same port as every other leg.
|
|
121
|
+
*/
|
|
122
|
+
export declare const FixtureReset: z.ZodObject<{
|
|
123
|
+
legId: z.ZodString;
|
|
124
|
+
interfaceId: z.ZodString;
|
|
125
|
+
operationId: z.ZodString;
|
|
126
|
+
inputs: z.ZodObject<{
|
|
127
|
+
path: z.ZodType<import("./primitives.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonObject, unknown>>;
|
|
128
|
+
query: z.ZodType<import("./primitives.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonObject, unknown>>;
|
|
129
|
+
header: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
130
|
+
body: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
131
|
+
kind: z.ZodLiteral<"json">;
|
|
132
|
+
value: z.ZodType<import("./primitives.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonValue, unknown>>;
|
|
133
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
134
|
+
kind: z.ZodLiteral<"absent">;
|
|
135
|
+
}, z.core.$strict>], "kind">;
|
|
136
|
+
}, z.core.$strict>;
|
|
137
|
+
}, z.core.$strict>;
|
|
138
|
+
export type FixtureReset = z.infer<typeof FixtureReset>;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/** AD-10's typed witnesses and the fixture-reset declaration. */
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { Expression } from './expression.js';
|
|
4
|
+
import { Identifier, JsonObjectValue, KeyName } from './primitives.js';
|
|
5
|
+
import { ProbeRequestBody } from './probe-body.js';
|
|
6
|
+
/**
|
|
7
|
+
* The four transport channels one probe leg supplies, as values. `RequestShape`
|
|
8
|
+
* declares what an operation accepts; this declares what one leg sends. AD-18
|
|
9
|
+
* applies here too, so a header value carries no credential.
|
|
10
|
+
*
|
|
11
|
+
* `header` and `body` use the port's own spelling: a header value is a string
|
|
12
|
+
* at the boundary, and a body has to tell an absent body from a JSON null. A
|
|
13
|
+
* leg the plan could not map onto a `ProbeRequest` would declare work nothing
|
|
14
|
+
* runs.
|
|
15
|
+
*/
|
|
16
|
+
export const WitnessInputs = z
|
|
17
|
+
.strictObject({
|
|
18
|
+
path: JsonObjectValue,
|
|
19
|
+
query: JsonObjectValue,
|
|
20
|
+
header: z.record(KeyName, z.string()),
|
|
21
|
+
body: ProbeRequestBody,
|
|
22
|
+
})
|
|
23
|
+
.meta({
|
|
24
|
+
id: 'WitnessInputs',
|
|
25
|
+
description: "One probe leg's supplied inputs, keyed by AD-19 transport channel, in the spelling the environment-probe port accepts. Shared by both witness kinds and by the fixture reset, so the export carries it once.",
|
|
26
|
+
});
|
|
27
|
+
/**
|
|
28
|
+
* Half a witness pair. `legId` roots the relation's pointers, which address this
|
|
29
|
+
* leg's response as `/interactions/{legId}/response-body/...`, so it shares one
|
|
30
|
+
* namespace with interaction-plan step ids.
|
|
31
|
+
*/
|
|
32
|
+
export const SensitivityWitnessLeg = z.strictObject({
|
|
33
|
+
legId: Identifier,
|
|
34
|
+
inputs: WitnessInputs,
|
|
35
|
+
});
|
|
36
|
+
// AD-10 selects the differential channel by the operation's state-change
|
|
37
|
+
// marker: `path` or `query` where the marker is false, `body` where it is true.
|
|
38
|
+
// `header` is absent on purpose; no AD names a header differential.
|
|
39
|
+
export const WITNESS_CHANNELS = ['path', 'query', 'body'];
|
|
40
|
+
export const WitnessChannel = z.enum(WITNESS_CHANNELS);
|
|
41
|
+
/**
|
|
42
|
+
* AD-10's typed sensitivity witness: a pair of inputs and the AD-4 relation
|
|
43
|
+
* their responses must satisfy. Per operation, because an interface-scoped
|
|
44
|
+
* check let an identifier-blind read pass on a body-sensitive sibling, and
|
|
45
|
+
* cannot be performed at all on a read-only interface.
|
|
46
|
+
*
|
|
47
|
+
* The relation is declared because inequality decides nothing on its own: two
|
|
48
|
+
* distinct nonexistent identifiers both return the same 404, and an input-blind
|
|
49
|
+
* response carrying a request identifier differs every time.
|
|
50
|
+
*
|
|
51
|
+
* `legs` is a length-pinned array. `z.tuple` exports `prefixItems` with no
|
|
52
|
+
* length keyword, so `.length(2)` is what puts `minItems` and `maxItems` in the
|
|
53
|
+
* published schema.
|
|
54
|
+
*/
|
|
55
|
+
export const SensitivityWitness = z.strictObject({
|
|
56
|
+
witnessId: Identifier,
|
|
57
|
+
channel: WitnessChannel,
|
|
58
|
+
legs: z.array(SensitivityWitnessLeg).length(2),
|
|
59
|
+
relation: Expression,
|
|
60
|
+
});
|
|
61
|
+
/**
|
|
62
|
+
* AD-10's manifestation witness: which operation to probe, with what inputs, and
|
|
63
|
+
* the AD-4 relation that is true exactly when the seeded fault has fired.
|
|
64
|
+
*
|
|
65
|
+
* A different mechanism from AD-40's DEFECT SIGNATURE, which matches a
|
|
66
|
+
* scoring-side finding against an observation. This one never enters a score; it
|
|
67
|
+
* makes "every declared seeded fault observed to fire" decidable at pre-flight.
|
|
68
|
+
*/
|
|
69
|
+
export const ManifestationWitness = z.strictObject({
|
|
70
|
+
legId: Identifier,
|
|
71
|
+
interfaceId: Identifier,
|
|
72
|
+
operationId: Identifier,
|
|
73
|
+
inputs: WitnessInputs,
|
|
74
|
+
relation: Expression,
|
|
75
|
+
});
|
|
76
|
+
/**
|
|
77
|
+
* The operation that returns the fixture to its clean state. AD-10 verifies the
|
|
78
|
+
* per-run reset differentially, and the reset is an ordinary declared operation,
|
|
79
|
+
* so it goes through the same port as every other leg.
|
|
80
|
+
*/
|
|
81
|
+
export const FixtureReset = z.strictObject({
|
|
82
|
+
legId: Identifier,
|
|
83
|
+
interfaceId: Identifier,
|
|
84
|
+
operationId: Identifier,
|
|
85
|
+
inputs: WitnessInputs,
|
|
86
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** AD-21's four verdicts and AD-24's closed evaluator recommendation. */
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
/**
|
|
4
|
+
* The other named exception to this package's lowercase kebab-case enum
|
|
5
|
+
* convention is the HTTP method.
|
|
6
|
+
*/
|
|
7
|
+
export declare const VERDICTS: readonly ['PASS', 'WAIVED', 'CONCERNS', 'FAIL'];
|
|
8
|
+
export declare const Verdict: z.ZodEnum<{
|
|
9
|
+
CONCERNS: "CONCERNS";
|
|
10
|
+
FAIL: "FAIL";
|
|
11
|
+
PASS: "PASS";
|
|
12
|
+
WAIVED: "WAIVED";
|
|
13
|
+
}>;
|
|
14
|
+
/**
|
|
15
|
+
* The verdict vocabulary minus `WAIVED`, reusing the uppercase exception
|
|
16
|
+
* rather than adding a third one.
|
|
17
|
+
*/
|
|
18
|
+
export declare const EVALUATOR_RECOMMENDATIONS: readonly ['PASS', 'CONCERNS', 'FAIL'];
|
|
19
|
+
export declare const EvaluatorRecommendation: z.ZodEnum<{
|
|
20
|
+
CONCERNS: "CONCERNS";
|
|
21
|
+
FAIL: "FAIL";
|
|
22
|
+
PASS: "PASS";
|
|
23
|
+
}>;
|
|
24
|
+
export type Verdict = z.infer<typeof Verdict>;
|
|
25
|
+
export type EvaluatorRecommendation = z.infer<typeof EvaluatorRecommendation>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** AD-21's four verdicts and AD-24's closed evaluator recommendation. */
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
/**
|
|
4
|
+
* The other named exception to this package's lowercase kebab-case enum
|
|
5
|
+
* convention is the HTTP method.
|
|
6
|
+
*/
|
|
7
|
+
export const VERDICTS = ['PASS', 'WAIVED', 'CONCERNS', 'FAIL'];
|
|
8
|
+
export const Verdict = z.enum(VERDICTS).meta({
|
|
9
|
+
id: 'Verdict',
|
|
10
|
+
description: "AD-21's four verdicts. Uppercase is one of the two named exceptions to the lowercase kebab-case enum convention. Exit codes are AD-21's and belong to the CLI rather than to this value: PASS, WAIVED, and CONCERNS exit zero and FAIL exits two.",
|
|
11
|
+
});
|
|
12
|
+
/**
|
|
13
|
+
* The verdict vocabulary minus `WAIVED`, reusing the uppercase exception
|
|
14
|
+
* rather than adding a third one.
|
|
15
|
+
*/
|
|
16
|
+
export const EVALUATOR_RECOMMENDATIONS = ['PASS', 'CONCERNS', 'FAIL'];
|
|
17
|
+
export const EvaluatorRecommendation = z.enum(EVALUATOR_RECOMMENDATIONS).meta({
|
|
18
|
+
id: 'EvaluatorRecommendation',
|
|
19
|
+
description: "The evaluator's own recommendation, ingested and never promoted to a verdict in contract-scoring mode. AD-24 requires a closed enum; the prior art's `NOT_APPLICABLE` is dropped with the `scripted` arm it belonged to. Consequence recorded here because it closes a rung: AD-21's Invalid condition for \"an unrecognised evaluator recommendation value\" is unreachable for a schema-valid artifact, since an unrecognised value fails to parse and becomes an AD-28 `schema-parse-failure` fault, and a fault never becomes a verdict. An ingesting reader either validates this field leniently and maps an unrecognised value to that rung, or accepts that the rung fires only as a fault.",
|
|
20
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** a contract-carried waiver. */
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
/**
|
|
4
|
+
* AD-5: a validated waiver requires the named rule, an explicit rationale, a
|
|
5
|
+
* machine-checkable context condition where one exists, the recorded
|
|
6
|
+
* approval, and an RFC 3339 expiry. Every part except the identifier is a
|
|
7
|
+
* required key with a nullable value, so an incomplete waiver stays
|
|
8
|
+
* representable and `waiver-incomplete` keeps a shape to fire on.
|
|
9
|
+
*/
|
|
10
|
+
export declare const Waiver: z.ZodObject<{
|
|
11
|
+
id: z.ZodString;
|
|
12
|
+
rule: z.ZodNullable<z.ZodString>;
|
|
13
|
+
rationale: z.ZodNullable<z.ZodString>;
|
|
14
|
+
condition: z.ZodNullable<z.ZodString>;
|
|
15
|
+
approval: z.ZodNullable<z.ZodString>;
|
|
16
|
+
expiresAt: z.ZodNullable<z.ZodISODateTime>;
|
|
17
|
+
}, z.core.$strict>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** a contract-carried waiver. */
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { Rfc3339Utc, WaiverId } from './primitives.js';
|
|
4
|
+
/**
|
|
5
|
+
* AD-5: a validated waiver requires the named rule, an explicit rationale, a
|
|
6
|
+
* machine-checkable context condition where one exists, the recorded
|
|
7
|
+
* approval, and an RFC 3339 expiry. Every part except the identifier is a
|
|
8
|
+
* required key with a nullable value, so an incomplete waiver stays
|
|
9
|
+
* representable and `waiver-incomplete` keeps a shape to fire on.
|
|
10
|
+
*/
|
|
11
|
+
export const Waiver = z.strictObject({
|
|
12
|
+
id: WaiverId,
|
|
13
|
+
rule: z
|
|
14
|
+
.string()
|
|
15
|
+
.nullable()
|
|
16
|
+
.describe('The AD-20 discipline rule this waiver names. An opaque string rather than an enum: AD-20 enumerates seven rules in prose and assigns them no identifiers, and minting them here would invent a vocabulary that AD-20 enforcement would then have to match.'),
|
|
17
|
+
rationale: z.string().nullable(),
|
|
18
|
+
condition: z
|
|
19
|
+
.string()
|
|
20
|
+
.nullable()
|
|
21
|
+
.describe('A machine-checkable context condition. AD-5 requires one "where one exists", so `null` here is a complete waiver rather than an incomplete one.'),
|
|
22
|
+
approval: z.string().nullable(),
|
|
23
|
+
expiresAt: Rfc3339Utc.nullable(),
|
|
24
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The derived-reference vocabulary (AD-16). Renders an evidence-target
|
|
3
|
+
* pointer, or a temporally-paired pair, as a description of the step's
|
|
4
|
+
* operation and selection predicate; the step's own identifier never appears.
|
|
5
|
+
* Resolves pointers through a `PlanIndex` into a phrase, kept apart from
|
|
6
|
+
* `plan-index.ts`'s resolving and `direction-prose.ts`'s relation templates.
|
|
7
|
+
*/
|
|
8
|
+
import type { Operation } from '../schemas/interface.ts';
|
|
9
|
+
import type { InteractionStep } from '../schemas/plan.ts';
|
|
10
|
+
import { type PlanIndex } from './plan-index.ts';
|
|
11
|
+
/**
|
|
12
|
+
* Escalates through `ESCALATION_LEVELS` in order until every step in
|
|
13
|
+
* `siblings` renders distinctly.
|
|
14
|
+
*
|
|
15
|
+
* `siblings` is direction-scoped: the caller passes only the steps the
|
|
16
|
+
* current direction's own resolved evidence targets share this operation
|
|
17
|
+
* with, not every step in the plan (AD-16), so an unrelated collision
|
|
18
|
+
* elsewhere never blocks an otherwise renderable direction.
|
|
19
|
+
*
|
|
20
|
+
* Throws the same precondition-violation `TypeError` as `buildPlanIndex`'s
|
|
21
|
+
* duplicate `stepId` check if two siblings still collide after full
|
|
22
|
+
* escalation.
|
|
23
|
+
*/
|
|
24
|
+
export declare function renderStepReference(step: InteractionStep, operation: Operation, siblings: readonly InteractionStep[]): string;
|
|
25
|
+
/**
|
|
26
|
+
* Renders every evidence target a direction declares as one canonically
|
|
27
|
+
* ordered, order-independent clause: byte-identical under any permutation of
|
|
28
|
+
* `evidenceTargets`, `interactionPlan`, or `permittedInterfaces`, since every
|
|
29
|
+
* phrase comes from Map-keyed lookups and structural properties, never array
|
|
30
|
+
* position.
|
|
31
|
+
*
|
|
32
|
+
* A repeated pointer is deduplicated first: left in place it would push its
|
|
33
|
+
* step out of the "exactly one target" shape temporal pairing requires,
|
|
34
|
+
* silently disabling the relational phrase for an otherwise-valid pair.
|
|
35
|
+
*/
|
|
36
|
+
export declare function renderEvidenceReferences(pointers: readonly string[], index: PlanIndex): string;
|