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,103 @@
|
|
|
1
|
+
/** the request and response shape of every AD-28 port method. */
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { JsonValue } from './primitives.ts';
|
|
4
|
+
export { ProbeObservedBody, ProbeRequestBody } from './probe-body.ts';
|
|
5
|
+
export declare const CorpusResolveRequest: z.ZodObject<{
|
|
6
|
+
privateRef: z.ZodString;
|
|
7
|
+
}, z.core.$strict>;
|
|
8
|
+
export declare const CorpusResolveResponse: z.ZodObject<{
|
|
9
|
+
privateRef: z.ZodString;
|
|
10
|
+
bytes: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
|
|
11
|
+
}, z.core.$strict>;
|
|
12
|
+
export declare const ClockReadRequest: z.ZodObject<{}, z.core.$strict>;
|
|
13
|
+
export declare const ClockReadResponse: z.ZodObject<{
|
|
14
|
+
now: z.ZodISODateTime;
|
|
15
|
+
}, z.core.$strict>;
|
|
16
|
+
export declare const FileReadRequest: z.ZodObject<{
|
|
17
|
+
path: z.ZodString;
|
|
18
|
+
}, z.core.$strict>;
|
|
19
|
+
export declare const FileReadResponse: z.ZodObject<{
|
|
20
|
+
path: z.ZodString;
|
|
21
|
+
bytes: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
|
|
22
|
+
}, z.core.$strict>;
|
|
23
|
+
export declare const FileWriteRequest: z.ZodObject<{
|
|
24
|
+
path: z.ZodString;
|
|
25
|
+
bytes: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
|
|
26
|
+
}, z.core.$strict>;
|
|
27
|
+
export declare const FileWriteResponse: z.ZodObject<{
|
|
28
|
+
path: z.ZodString;
|
|
29
|
+
byteLength: z.ZodInt;
|
|
30
|
+
}, z.core.$strict>;
|
|
31
|
+
/**
|
|
32
|
+
* AD-35: the request names a logical interface identifier and never a URL,
|
|
33
|
+
* host, or port. Mapping the identifier to an authorized target is the
|
|
34
|
+
* adapter's, from configuration outside the contract.
|
|
35
|
+
*
|
|
36
|
+
* No credential appears here. AD-18 forbids a credential value in a
|
|
37
|
+
* declaration, and the values that reach this shape come from a declaration;
|
|
38
|
+
* authorization material is the adapter's, supplied by the same mapping that
|
|
39
|
+
* authorizes the target.
|
|
40
|
+
*/
|
|
41
|
+
export declare const ProbeRequest: z.ZodObject<{
|
|
42
|
+
probeId: z.ZodString;
|
|
43
|
+
interfaceId: z.ZodString;
|
|
44
|
+
operationId: z.ZodString;
|
|
45
|
+
method: z.ZodEnum<{
|
|
46
|
+
DELETE: "DELETE";
|
|
47
|
+
GET: "GET";
|
|
48
|
+
HEAD: "HEAD";
|
|
49
|
+
OPTIONS: "OPTIONS";
|
|
50
|
+
PATCH: "PATCH";
|
|
51
|
+
POST: "POST";
|
|
52
|
+
PUT: "PUT";
|
|
53
|
+
}>;
|
|
54
|
+
pathTemplate: z.ZodString;
|
|
55
|
+
channels: z.ZodObject<{
|
|
56
|
+
path: z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
|
|
57
|
+
query: z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
|
|
58
|
+
header: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
59
|
+
body: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
60
|
+
kind: z.ZodLiteral<"json">;
|
|
61
|
+
value: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
|
|
62
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
63
|
+
kind: z.ZodLiteral<"absent">;
|
|
64
|
+
}, z.core.$strict>], "kind">;
|
|
65
|
+
}, z.core.$strict>;
|
|
66
|
+
}, z.core.$strict>;
|
|
67
|
+
/**
|
|
68
|
+
* What the adapter observed. Deliberately response content only: no elapsed
|
|
69
|
+
* time, no redirect count, no retry count. AD-35's caps are safety limits, so
|
|
70
|
+
* exceeding one throws a `budget-exhausted` fault and never lands as a field
|
|
71
|
+
* on a successful observation. AD-10's verdict stays a function of what the
|
|
72
|
+
* system returned, with no input from how long the network took.
|
|
73
|
+
*
|
|
74
|
+
* Every response the system returns is an observation, at any status. Only a
|
|
75
|
+
* policy denial, a cap, an abort, or a transport failure throws; a 500 is the
|
|
76
|
+
* payload AD-10's seeded-fault check reads, never an error.
|
|
77
|
+
*/
|
|
78
|
+
export declare const ProbeObservation: z.ZodObject<{
|
|
79
|
+
probeId: z.ZodString;
|
|
80
|
+
interfaceId: z.ZodString;
|
|
81
|
+
operationId: z.ZodString;
|
|
82
|
+
status: z.ZodInt;
|
|
83
|
+
headers: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
84
|
+
body: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
85
|
+
kind: z.ZodLiteral<"json">;
|
|
86
|
+
value: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
|
|
87
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
88
|
+
kind: z.ZodLiteral<"text">;
|
|
89
|
+
value: z.ZodString;
|
|
90
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
91
|
+
kind: z.ZodLiteral<"absent">;
|
|
92
|
+
}, z.core.$strict>], "kind">;
|
|
93
|
+
}, z.core.$strict>;
|
|
94
|
+
export type CorpusResolveRequest = z.infer<typeof CorpusResolveRequest>;
|
|
95
|
+
export type CorpusResolveResponse = z.infer<typeof CorpusResolveResponse>;
|
|
96
|
+
export type ClockReadRequest = z.infer<typeof ClockReadRequest>;
|
|
97
|
+
export type ClockReadResponse = z.infer<typeof ClockReadResponse>;
|
|
98
|
+
export type FileReadRequest = z.infer<typeof FileReadRequest>;
|
|
99
|
+
export type FileReadResponse = z.infer<typeof FileReadResponse>;
|
|
100
|
+
export type FileWriteRequest = z.infer<typeof FileWriteRequest>;
|
|
101
|
+
export type FileWriteResponse = z.infer<typeof FileWriteResponse>;
|
|
102
|
+
export type ProbeRequest = z.infer<typeof ProbeRequest>;
|
|
103
|
+
export type ProbeObservation = z.infer<typeof ProbeObservation>;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/** the request and response shape of every AD-28 port method. */
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { HttpMethod, PathTemplate } from './interface.js';
|
|
4
|
+
import { Identifier, JsonValue, KeyName, Rfc3339Utc } from './primitives.js';
|
|
5
|
+
import { ProbeObservedBody, ProbeRequestBody } from './probe-body.js';
|
|
6
|
+
export { ProbeObservedBody, ProbeRequestBody } from './probe-body.js';
|
|
7
|
+
// AD-8: the corpus port resolves an opaque reference to bytes from a
|
|
8
|
+
// caller-owned location. It does not check the digest: AD-8 puts digest
|
|
9
|
+
// recomputation in the core ("the core recomputes every per-artifact digest
|
|
10
|
+
// from the resolved bytes"), and an adapter that checked it would be trusting
|
|
11
|
+
// the manifest label AD-8 says is never trusted.
|
|
12
|
+
export const CorpusResolveRequest = z.strictObject({
|
|
13
|
+
privateRef: z.string().min(1),
|
|
14
|
+
});
|
|
15
|
+
export const CorpusResolveResponse = z.strictObject({
|
|
16
|
+
privateRef: z
|
|
17
|
+
.string()
|
|
18
|
+
.min(1)
|
|
19
|
+
.describe('Echoed back so a response cannot be silently bound to a different request. Nothing else in the response identifies what was resolved, and bytes carry no self-identity.'),
|
|
20
|
+
bytes: z.instanceof(Uint8Array),
|
|
21
|
+
});
|
|
22
|
+
// AD-1 forbids a clock read under `core/`, so a timestamp arrives through a
|
|
23
|
+
// port. The request is an empty strict object: every `PortMethod` takes a
|
|
24
|
+
// request and `invokePort` parses it, so a port with nothing to ask still
|
|
25
|
+
// needs a shape that parses.
|
|
26
|
+
export const ClockReadRequest = z.strictObject({});
|
|
27
|
+
export const ClockReadResponse = z.strictObject({
|
|
28
|
+
now: Rfc3339Utc,
|
|
29
|
+
});
|
|
30
|
+
export const FileReadRequest = z.strictObject({
|
|
31
|
+
path: z.string().min(1),
|
|
32
|
+
});
|
|
33
|
+
export const FileReadResponse = z.strictObject({
|
|
34
|
+
path: z.string().min(1),
|
|
35
|
+
bytes: z.instanceof(Uint8Array),
|
|
36
|
+
});
|
|
37
|
+
export const FileWriteRequest = z.strictObject({
|
|
38
|
+
path: z.string().min(1),
|
|
39
|
+
bytes: z.instanceof(Uint8Array),
|
|
40
|
+
});
|
|
41
|
+
export const FileWriteResponse = z.strictObject({
|
|
42
|
+
path: z.string().min(1),
|
|
43
|
+
byteLength: z.int().min(0),
|
|
44
|
+
});
|
|
45
|
+
/**
|
|
46
|
+
* AD-35: the request names a logical interface identifier and never a URL,
|
|
47
|
+
* host, or port. Mapping the identifier to an authorized target is the
|
|
48
|
+
* adapter's, from configuration outside the contract.
|
|
49
|
+
*
|
|
50
|
+
* No credential appears here. AD-18 forbids a credential value in a
|
|
51
|
+
* declaration, and the values that reach this shape come from a declaration;
|
|
52
|
+
* authorization material is the adapter's, supplied by the same mapping that
|
|
53
|
+
* authorizes the target.
|
|
54
|
+
*/
|
|
55
|
+
export const ProbeRequest = z.strictObject({
|
|
56
|
+
probeId: Identifier.describe('An opaque correlation label minted by the pre-flight plan and echoed unchanged on the observation. Two witnesses of one operation, and the three observations a state-reset differential needs, are otherwise distinguishable only by array position, which NFR9 forbids any stage from reading.'),
|
|
57
|
+
interfaceId: Identifier,
|
|
58
|
+
operationId: Identifier,
|
|
59
|
+
method: HttpMethod,
|
|
60
|
+
pathTemplate: PathTemplate,
|
|
61
|
+
channels: z.strictObject({
|
|
62
|
+
path: z.record(KeyName, JsonValue),
|
|
63
|
+
query: z.record(KeyName, JsonValue),
|
|
64
|
+
header: z
|
|
65
|
+
.record(KeyName, z.string())
|
|
66
|
+
.describe('String-valued because a header value is a string on the wire; the other channels carry the declared JSON value.'),
|
|
67
|
+
body: ProbeRequestBody,
|
|
68
|
+
}),
|
|
69
|
+
});
|
|
70
|
+
/**
|
|
71
|
+
* What the adapter observed. Deliberately response content only: no elapsed
|
|
72
|
+
* time, no redirect count, no retry count. AD-35's caps are safety limits, so
|
|
73
|
+
* exceeding one throws a `budget-exhausted` fault and never lands as a field
|
|
74
|
+
* on a successful observation. AD-10's verdict stays a function of what the
|
|
75
|
+
* system returned, with no input from how long the network took.
|
|
76
|
+
*
|
|
77
|
+
* Every response the system returns is an observation, at any status. Only a
|
|
78
|
+
* policy denial, a cap, an abort, or a transport failure throws; a 500 is the
|
|
79
|
+
* payload AD-10's seeded-fault check reads, never an error.
|
|
80
|
+
*/
|
|
81
|
+
export const ProbeObservation = z.strictObject({
|
|
82
|
+
probeId: Identifier,
|
|
83
|
+
interfaceId: Identifier,
|
|
84
|
+
operationId: Identifier,
|
|
85
|
+
status: z.int().min(100).max(599),
|
|
86
|
+
headers: z
|
|
87
|
+
.record(KeyName, z.string())
|
|
88
|
+
.describe('Repeated headers are joined with ", " per RFC 9110 before they reach this shape. `set-cookie` is the one header that rule is wrong for, and it is dropped rather than mangled: nothing in AD-10 reads it, and a joined `set-cookie` is a value no consumer can split back.'),
|
|
89
|
+
body: ProbeObservedBody,
|
|
90
|
+
});
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/** the pure verdict AD-10 computes over probed environment observations. */
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
/**
|
|
4
|
+
* Transcribed from AD-10's own prose, which bounds the verdict to a closed,
|
|
5
|
+
* named list of checks; a member it does not name would be this schema
|
|
6
|
+
* minting pre-flight semantics it has no authority over.
|
|
7
|
+
*/
|
|
8
|
+
export declare const PREFLIGHT_CHECK_KINDS: readonly ['interface-present', 'input-sensitivity', 'state-reset', 'clean-control', 'seeded-faults-scoped', 'seeded-fault-fired'];
|
|
9
|
+
export declare const PreflightCheckKind: z.ZodEnum<{
|
|
10
|
+
"clean-control": "clean-control";
|
|
11
|
+
"input-sensitivity": "input-sensitivity";
|
|
12
|
+
"interface-present": "interface-present";
|
|
13
|
+
"seeded-fault-fired": "seeded-fault-fired";
|
|
14
|
+
"seeded-faults-scoped": "seeded-faults-scoped";
|
|
15
|
+
"state-reset": "state-reset";
|
|
16
|
+
}>;
|
|
17
|
+
export declare const PreflightCheck: z.ZodObject<{
|
|
18
|
+
kind: z.ZodEnum<{
|
|
19
|
+
"clean-control": "clean-control";
|
|
20
|
+
"input-sensitivity": "input-sensitivity";
|
|
21
|
+
"interface-present": "interface-present";
|
|
22
|
+
"seeded-fault-fired": "seeded-fault-fired";
|
|
23
|
+
"seeded-faults-scoped": "seeded-faults-scoped";
|
|
24
|
+
"state-reset": "state-reset";
|
|
25
|
+
}>;
|
|
26
|
+
operationId: z.ZodNullable<z.ZodString>;
|
|
27
|
+
outcome: z.ZodEnum<{
|
|
28
|
+
exempt: "exempt";
|
|
29
|
+
failed: "failed";
|
|
30
|
+
satisfied: "satisfied";
|
|
31
|
+
}>;
|
|
32
|
+
note: z.ZodNullable<z.ZodString>;
|
|
33
|
+
}, z.core.$strict>;
|
|
34
|
+
export type PreflightCheck = z.infer<typeof PreflightCheck>;
|
|
35
|
+
export declare const PreflightVerdict: z.ZodObject<{
|
|
36
|
+
schemaVersion: z.ZodInt;
|
|
37
|
+
parentDigest: z.ZodNullable<z.ZodString>;
|
|
38
|
+
revisionCount: z.ZodInt;
|
|
39
|
+
runId: z.ZodString;
|
|
40
|
+
fixtureDigest: z.ZodString;
|
|
41
|
+
passed: z.ZodBoolean;
|
|
42
|
+
checks: z.ZodArray<z.ZodObject<{
|
|
43
|
+
kind: z.ZodEnum<{
|
|
44
|
+
"clean-control": "clean-control";
|
|
45
|
+
"input-sensitivity": "input-sensitivity";
|
|
46
|
+
"interface-present": "interface-present";
|
|
47
|
+
"seeded-fault-fired": "seeded-fault-fired";
|
|
48
|
+
"seeded-faults-scoped": "seeded-faults-scoped";
|
|
49
|
+
"state-reset": "state-reset";
|
|
50
|
+
}>;
|
|
51
|
+
operationId: z.ZodNullable<z.ZodString>;
|
|
52
|
+
outcome: z.ZodEnum<{
|
|
53
|
+
exempt: "exempt";
|
|
54
|
+
failed: "failed";
|
|
55
|
+
satisfied: "satisfied";
|
|
56
|
+
}>;
|
|
57
|
+
note: z.ZodNullable<z.ZodString>;
|
|
58
|
+
}, z.core.$strict>>;
|
|
59
|
+
}, z.core.$strict>;
|
|
60
|
+
export type PreflightVerdict = z.infer<typeof PreflightVerdict>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/** the pure verdict AD-10 computes over probed environment observations. */
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { lineageFields } from './lineage.js';
|
|
4
|
+
import { Digest, Identifier } from './primitives.js';
|
|
5
|
+
/**
|
|
6
|
+
* Transcribed from AD-10's own prose, which bounds the verdict to a closed,
|
|
7
|
+
* named list of checks; a member it does not name would be this schema
|
|
8
|
+
* minting pre-flight semantics it has no authority over.
|
|
9
|
+
*/
|
|
10
|
+
export const PREFLIGHT_CHECK_KINDS = [
|
|
11
|
+
'interface-present',
|
|
12
|
+
'input-sensitivity',
|
|
13
|
+
'state-reset',
|
|
14
|
+
'clean-control',
|
|
15
|
+
'seeded-faults-scoped',
|
|
16
|
+
'seeded-fault-fired',
|
|
17
|
+
];
|
|
18
|
+
export const PreflightCheckKind = z.enum(PREFLIGHT_CHECK_KINDS);
|
|
19
|
+
export const PreflightCheck = z.strictObject({
|
|
20
|
+
kind: PreflightCheckKind,
|
|
21
|
+
operationId: Identifier.nullable().describe('Nullable because AD-10 scopes input sensitivity and state reset per operation and interface presence per interface, so a check that is not per-operation has nothing to name here.'),
|
|
22
|
+
outcome: z
|
|
23
|
+
.enum(['satisfied', 'failed', 'exempt'])
|
|
24
|
+
.describe('`exempt` exists because AD-10 says "an operation declaring no inputs in any channel is exempt and records the exemption", and an exemption with no spelling is an exemption nobody records. That a failed pre-flight invalidates the run, and that a sensitivity witness resolving `insufficient-evidence` fails rather than passes, are AD-10 semantics for `core/preflight`; the schema carries the outcome and refines nothing.'),
|
|
25
|
+
note: z.string().nullable(),
|
|
26
|
+
});
|
|
27
|
+
export const PreflightVerdict = z
|
|
28
|
+
.strictObject({
|
|
29
|
+
...lineageFields,
|
|
30
|
+
runId: z.string().min(1).describe('An opaque caller label.'),
|
|
31
|
+
fixtureDigest: Digest.describe("Required, not nullable. AD-10 makes the fixture digest a required field of the verdict, and AD-11 names it as one of the scoring version's five inputs, so an absent one leaves the scoring version uncomputable."),
|
|
32
|
+
passed: z.boolean(),
|
|
33
|
+
checks: z.array(PreflightCheck),
|
|
34
|
+
})
|
|
35
|
+
.meta({
|
|
36
|
+
id: 'PreflightVerdict',
|
|
37
|
+
description: "The pre-flight verdict: a pure function of the observations the environment-probe port returned, with no prior art. AD-10 bounds it to a closed list of check kinds, all six transcribed from that AD's own prose, and requires the fixture digest as a required field. Probing a fixture is not executing the system under test, and a failed pre-flight invalidates the run rather than becoming a contract verdict.",
|
|
38
|
+
});
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/** shared primitive shapes: identifiers, digests, dates, and the value container. */
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
export declare const IDENTIFIER_PATTERN: RegExp;
|
|
4
|
+
/** the charset spelling 1 embeds; exported so pointer.ts never re-spells it. */
|
|
5
|
+
export declare const IDENTIFIER_CHARSET_SOURCE = "[a-z0-9]+(?:-[a-z0-9]+)*";
|
|
6
|
+
export declare const Identifier: z.ZodString;
|
|
7
|
+
export declare const BEHAVIOR_ID_PATTERN: RegExp;
|
|
8
|
+
export declare const ORACLE_ID_PATTERN: RegExp;
|
|
9
|
+
export declare const PROBE_ID_PATTERN: RegExp;
|
|
10
|
+
export declare const WAIVER_ID_PATTERN: RegExp;
|
|
11
|
+
export declare const DEFECT_ID_PATTERN: RegExp;
|
|
12
|
+
export declare const FINDING_ID_PATTERN: RegExp;
|
|
13
|
+
export declare const RUBRIC_ID_PATTERN: RegExp;
|
|
14
|
+
export declare const RUBRIC_CRITERION_ID_PATTERN: RegExp;
|
|
15
|
+
export declare const BehaviorId: z.ZodString;
|
|
16
|
+
export declare const OracleId: z.ZodString;
|
|
17
|
+
export declare const ProbeId: z.ZodString;
|
|
18
|
+
export declare const WaiverId: z.ZodString;
|
|
19
|
+
export declare const DefectId: z.ZodString;
|
|
20
|
+
export declare const FindingId: z.ZodString;
|
|
21
|
+
export declare const RubricId: z.ZodString;
|
|
22
|
+
export declare const RubricCriterionId: z.ZodString;
|
|
23
|
+
export declare const DIGEST_FORM: RegExp;
|
|
24
|
+
export declare const Digest: z.ZodString;
|
|
25
|
+
export declare const DECIMAL_STRING_PATTERN: RegExp;
|
|
26
|
+
export declare const UNSIGNED_DECIMAL_STRING_PATTERN: RegExp;
|
|
27
|
+
export declare const DecimalString: z.ZodString;
|
|
28
|
+
export declare const UnsignedDecimalString: z.ZodString;
|
|
29
|
+
export declare const POSITIVE_DECIMAL_STRING_PATTERN: RegExp;
|
|
30
|
+
export declare const PositiveDecimalString: z.ZodString;
|
|
31
|
+
export declare const Rfc3339Utc: z.ZodISODateTime;
|
|
32
|
+
/** the six JSON type names a declaration may name a key's type as. */
|
|
33
|
+
export declare const JsonTypeName: z.ZodEnum<{
|
|
34
|
+
array: "array";
|
|
35
|
+
boolean: "boolean";
|
|
36
|
+
null: "null";
|
|
37
|
+
number: "number";
|
|
38
|
+
object: "object";
|
|
39
|
+
string: "string";
|
|
40
|
+
}>;
|
|
41
|
+
export declare const KeyName: z.ZodString;
|
|
42
|
+
export type JsonValue = string | number | boolean | null | JsonValue[] | {
|
|
43
|
+
[key: string]: JsonValue;
|
|
44
|
+
};
|
|
45
|
+
export declare const JsonValue: z.ZodType<JsonValue>;
|
|
46
|
+
/**
|
|
47
|
+
* AD-4's `shape` descriptor and AD-19's request channel both need "required
|
|
48
|
+
* keys, permitted keys, and per-key JSON type, never an embedded JSON
|
|
49
|
+
* Schema"; spelled once here so two copies of one triple don't drift apart.
|
|
50
|
+
* `.describe()` returns a new schema rather than mutating this one, so each
|
|
51
|
+
* use site can add its own description.
|
|
52
|
+
*/
|
|
53
|
+
export declare const KeyTypeMap: z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodEnum<{
|
|
54
|
+
array: "array";
|
|
55
|
+
boolean: "boolean";
|
|
56
|
+
null: "null";
|
|
57
|
+
number: "number";
|
|
58
|
+
object: "object";
|
|
59
|
+
string: "string";
|
|
60
|
+
}>>>;
|
|
61
|
+
export declare const KeyedShapeDescriptor: z.ZodObject<{
|
|
62
|
+
requiredKeys: z.ZodArray<z.ZodString>;
|
|
63
|
+
permittedKeys: z.ZodArray<z.ZodString>;
|
|
64
|
+
types: z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodEnum<{
|
|
65
|
+
array: "array";
|
|
66
|
+
boolean: "boolean";
|
|
67
|
+
null: "null";
|
|
68
|
+
number: "number";
|
|
69
|
+
object: "object";
|
|
70
|
+
string: "string";
|
|
71
|
+
}>>>;
|
|
72
|
+
}, z.core.$strict>;
|
|
73
|
+
export type KeyedShapeDescriptor = z.infer<typeof KeyedShapeDescriptor>;
|
|
74
|
+
export type JsonObject = {
|
|
75
|
+
[key: string]: JsonValue;
|
|
76
|
+
};
|
|
77
|
+
/** a caller-keyed object inside the value container; not a control object. */
|
|
78
|
+
export declare const JsonObjectValue: z.ZodType<JsonObject>;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/** shared primitive shapes: identifiers, digests, dates, and the value container. */
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
// Fixed here rather than per field: pointer spelling 1 depends on this exact
|
|
4
|
+
// charset, and a second copy per field is a drift risk. The kebab-slug shape
|
|
5
|
+
// matches both hand-authored contracts though no AD requires it, so it is
|
|
6
|
+
// ratified rather than invented.
|
|
7
|
+
const IDENTIFIER_SOURCE = '[a-z0-9]+(?:-[a-z0-9]+)*';
|
|
8
|
+
export const IDENTIFIER_PATTERN = new RegExp(`^${IDENTIFIER_SOURCE}$`);
|
|
9
|
+
/** the charset spelling 1 embeds; exported so pointer.ts never re-spells it. */
|
|
10
|
+
export const IDENTIFIER_CHARSET_SOURCE = IDENTIFIER_SOURCE;
|
|
11
|
+
export const Identifier = z
|
|
12
|
+
.string()
|
|
13
|
+
.regex(IDENTIFIER_PATTERN)
|
|
14
|
+
.describe('A kebab-case slug. Excludes "/" and "~" so an identifier can be embedded in an interaction-rooted pointer without escaping.');
|
|
15
|
+
// All eight Consistency-Conventions prefixes are defined here even though this
|
|
16
|
+
// artifact uses five: the Probe, Evidence Artifact, and finding shapes import
|
|
17
|
+
// P-, D-, and F- rather than re-spelling the quantifier, and a second spelling
|
|
18
|
+
// of `{3,}` is exactly the drift the convention names.
|
|
19
|
+
const prefixedIdentifier = (prefix) => new RegExp(`^${prefix}-[0-9]{3,}$`);
|
|
20
|
+
export const BEHAVIOR_ID_PATTERN = prefixedIdentifier('B');
|
|
21
|
+
export const ORACLE_ID_PATTERN = prefixedIdentifier('O');
|
|
22
|
+
export const PROBE_ID_PATTERN = prefixedIdentifier('P');
|
|
23
|
+
export const WAIVER_ID_PATTERN = prefixedIdentifier('W');
|
|
24
|
+
export const DEFECT_ID_PATTERN = prefixedIdentifier('D');
|
|
25
|
+
export const FINDING_ID_PATTERN = prefixedIdentifier('F');
|
|
26
|
+
export const RUBRIC_ID_PATTERN = prefixedIdentifier('R');
|
|
27
|
+
export const RUBRIC_CRITERION_ID_PATTERN = prefixedIdentifier('RC');
|
|
28
|
+
export const BehaviorId = z.string().regex(BEHAVIOR_ID_PATTERN);
|
|
29
|
+
export const OracleId = z.string().regex(ORACLE_ID_PATTERN);
|
|
30
|
+
export const ProbeId = z.string().regex(PROBE_ID_PATTERN);
|
|
31
|
+
export const WaiverId = z.string().regex(WAIVER_ID_PATTERN);
|
|
32
|
+
export const DefectId = z.string().regex(DEFECT_ID_PATTERN);
|
|
33
|
+
export const FindingId = z.string().regex(FINDING_ID_PATTERN);
|
|
34
|
+
export const RubricId = z.string().regex(RUBRIC_ID_PATTERN);
|
|
35
|
+
export const RubricCriterionId = z.string().regex(RUBRIC_CRITERION_ID_PATTERN);
|
|
36
|
+
// AD-27's rendered digest form. It lives here rather than privately in
|
|
37
|
+
// core/canonical/digest.ts so the schema and the digest functions share one
|
|
38
|
+
// spelling, and core/ imports core/schemas rather than the reverse.
|
|
39
|
+
export const DIGEST_FORM = /^sha256:[0-9a-f]{64}$/;
|
|
40
|
+
export const Digest = z
|
|
41
|
+
.string()
|
|
42
|
+
.regex(DIGEST_FORM)
|
|
43
|
+
.describe('AD-27 digest: "sha256:" plus 64 lowercase hexadecimal characters.');
|
|
44
|
+
// AD-36's declared format lives here rather than on the field: an undeclared
|
|
45
|
+
// "declared format" is the same unshaped-declaration defect AD-19's value
|
|
46
|
+
// spaces were added to close.
|
|
47
|
+
export const DECIMAL_STRING_PATTERN = /^-?(0|[1-9][0-9]*)(\.[0-9]+)?$/;
|
|
48
|
+
export const UNSIGNED_DECIMAL_STRING_PATTERN = /^(0|[1-9][0-9]*)(\.[0-9]+)?$/;
|
|
49
|
+
export const DecimalString = z
|
|
50
|
+
.string()
|
|
51
|
+
.regex(DECIMAL_STRING_PATTERN)
|
|
52
|
+
.describe('AD-36 decimal-string format: an optionally signed decimal with no exponent and no leading zeros, carried as a string so exact decimal semantics survive canonicalization.');
|
|
53
|
+
export const UnsignedDecimalString = z
|
|
54
|
+
.string()
|
|
55
|
+
.regex(UNSIGNED_DECIMAL_STRING_PATTERN)
|
|
56
|
+
.describe('The decimal-string format restricted to non-negative values, for quantities where a negative has no meaning.');
|
|
57
|
+
// Spelled as an alternation rather than a negative lookahead on purpose: JSON
|
|
58
|
+
// Schema's `pattern` is ECMA-262 and would accept a lookahead, but several of
|
|
59
|
+
// the non-JavaScript validators AD-13 also publishes this schema for compile
|
|
60
|
+
// patterns with no lookahead support at all.
|
|
61
|
+
export const POSITIVE_DECIMAL_STRING_PATTERN = /^([1-9][0-9]*(\.[0-9]+)?|0\.[0-9]*[1-9][0-9]*)$/;
|
|
62
|
+
export const PositiveDecimalString = z
|
|
63
|
+
.string()
|
|
64
|
+
.regex(POSITIVE_DECIMAL_STRING_PATTERN)
|
|
65
|
+
.describe("The decimal-string format restricted to values greater than zero, for a ceiling where zero is not a ceiling. This is what carries the prior art's `exclusiveMinimum: 0` across AD-36's move of money from a JSON number to a string; without it that bound would be silently dropped by the retyping.");
|
|
66
|
+
// Consistency Conventions: dates are RFC 3339 in UTC. z.iso.datetime() with no
|
|
67
|
+
// options accepts a trailing "Z" and rejects a numeric offset, which is exactly
|
|
68
|
+
// the convention; { offset: true } would accept both.
|
|
69
|
+
export const Rfc3339Utc = z.iso
|
|
70
|
+
.datetime()
|
|
71
|
+
.describe('RFC 3339 timestamp in UTC. A numeric offset is not accepted.');
|
|
72
|
+
/** the six JSON type names a declaration may name a key's type as. */
|
|
73
|
+
export const JsonTypeName = z.enum([
|
|
74
|
+
'string',
|
|
75
|
+
'number',
|
|
76
|
+
'boolean',
|
|
77
|
+
'object',
|
|
78
|
+
'array',
|
|
79
|
+
'null',
|
|
80
|
+
]);
|
|
81
|
+
// A declared key name: used in a request shape, a response descriptor, or a
|
|
82
|
+
// reference-set key list. Plain caller-supplied text.
|
|
83
|
+
export const KeyName = z.string().min(1);
|
|
84
|
+
// The one shape whose keys belong to the caller, so `additionalProperties` is
|
|
85
|
+
// schema-valued rather than false here alone. Hand-rolled with z.lazy rather
|
|
86
|
+
// than z.json(): the latter exports a generated `$defs` ref name that the
|
|
87
|
+
// published-schema drift check would pin and that separates the description
|
|
88
|
+
// from the shared definition, and AD-36 needs the numeric restriction on the
|
|
89
|
+
// definition itself.
|
|
90
|
+
export const JsonValue = z
|
|
91
|
+
.lazy(() => z.union([
|
|
92
|
+
z.string(),
|
|
93
|
+
z.number(),
|
|
94
|
+
z.boolean(),
|
|
95
|
+
z.null(),
|
|
96
|
+
z.array(JsonValue),
|
|
97
|
+
z.record(z.string(), JsonValue),
|
|
98
|
+
]))
|
|
99
|
+
.meta({
|
|
100
|
+
id: 'JsonValue',
|
|
101
|
+
description: 'AD-36 value domain. Every number is a finite IEEE 754 double-precision value, and every integer lies in the safe-integer range; a larger integer, and any value needing exact decimal semantics such as money, is carried as a string in its own declared format. JSON Schema cannot express finiteness, so this restriction is stated rather than encoded: producers are told the rule here instead of discovering it through a digest mismatch, and the canonical scanner rejects a violating value before any parse.',
|
|
102
|
+
});
|
|
103
|
+
/**
|
|
104
|
+
* AD-4's `shape` descriptor and AD-19's request channel both need "required
|
|
105
|
+
* keys, permitted keys, and per-key JSON type, never an embedded JSON
|
|
106
|
+
* Schema"; spelled once here so two copies of one triple don't drift apart.
|
|
107
|
+
* `.describe()` returns a new schema rather than mutating this one, so each
|
|
108
|
+
* use site can add its own description.
|
|
109
|
+
*/
|
|
110
|
+
export const KeyTypeMap = z
|
|
111
|
+
.record(KeyName, JsonTypeName.nullable())
|
|
112
|
+
.describe('Caller-keyed by plain key name, never by pointer: the descriptor-relative pointer spelling does not apply to these keys and must not be extended to them by analogy. A missing key means "not declared"; an explicit `null` value means "declared, type not stated".');
|
|
113
|
+
export const KeyedShapeDescriptor = z.strictObject({
|
|
114
|
+
requiredKeys: z.array(KeyName),
|
|
115
|
+
permittedKeys: z
|
|
116
|
+
.array(KeyName)
|
|
117
|
+
.describe('The closed set of keys the shape admits. Deliberately not refined to be a superset of `requiredKeys`: no AD-5 code names that contradiction, so it joins the cross-field rules left to the compiler in v0. There is no spelling for "these keys are required and extras are unconstrained" — AD-4 calls the descriptor closed, so an open mode would be a different grammar.'),
|
|
118
|
+
types: KeyTypeMap,
|
|
119
|
+
});
|
|
120
|
+
/** a caller-keyed object inside the value container; not a control object. */
|
|
121
|
+
export const JsonObjectValue = z.record(z.string(), JsonValue);
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/** the public-safe index of every private artifact this repository references. */
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
/**
|
|
4
|
+
* The prior art's eight `artifactType` members, ratified unchanged as
|
|
5
|
+
* `artifactKind` (AD-24 rename only). An existing entry re-keys without
|
|
6
|
+
* re-classifying.
|
|
7
|
+
*/
|
|
8
|
+
export declare const PRIVATE_ARTIFACT_KINDS: readonly ['private-input-record', 'raw-trace', 'raw-result', 'human-label', 'implementation-patch', 'isolation-manifest', 'scripted-baseline-output', 'other'];
|
|
9
|
+
export declare const PrivateArtifactKind: z.ZodEnum<{
|
|
10
|
+
"human-label": "human-label";
|
|
11
|
+
"implementation-patch": "implementation-patch";
|
|
12
|
+
"isolation-manifest": "isolation-manifest";
|
|
13
|
+
other: "other";
|
|
14
|
+
"private-input-record": "private-input-record";
|
|
15
|
+
"raw-result": "raw-result";
|
|
16
|
+
"raw-trace": "raw-trace";
|
|
17
|
+
"scripted-baseline-output": "scripted-baseline-output";
|
|
18
|
+
}>;
|
|
19
|
+
export declare const PrivateArtifactEntry: z.ZodObject<{
|
|
20
|
+
privateRef: z.ZodString;
|
|
21
|
+
digest: z.ZodString;
|
|
22
|
+
artifactKind: z.ZodEnum<{
|
|
23
|
+
"human-label": "human-label";
|
|
24
|
+
"implementation-patch": "implementation-patch";
|
|
25
|
+
"isolation-manifest": "isolation-manifest";
|
|
26
|
+
other: "other";
|
|
27
|
+
"private-input-record": "private-input-record";
|
|
28
|
+
"raw-result": "raw-result";
|
|
29
|
+
"raw-trace": "raw-trace";
|
|
30
|
+
"scripted-baseline-output": "scripted-baseline-output";
|
|
31
|
+
}>;
|
|
32
|
+
publicSafeRunId: z.ZodNullable<z.ZodString>;
|
|
33
|
+
sanitizationPolicy: z.ZodNullable<z.ZodString>;
|
|
34
|
+
}, z.core.$strict>;
|
|
35
|
+
export declare const PrivateArtifactManifest: z.ZodObject<{
|
|
36
|
+
schemaVersion: z.ZodInt;
|
|
37
|
+
parentDigest: z.ZodNullable<z.ZodString>;
|
|
38
|
+
revisionCount: z.ZodInt;
|
|
39
|
+
entries: z.ZodArray<z.ZodObject<{
|
|
40
|
+
privateRef: z.ZodString;
|
|
41
|
+
digest: z.ZodString;
|
|
42
|
+
artifactKind: z.ZodEnum<{
|
|
43
|
+
"human-label": "human-label";
|
|
44
|
+
"implementation-patch": "implementation-patch";
|
|
45
|
+
"isolation-manifest": "isolation-manifest";
|
|
46
|
+
other: "other";
|
|
47
|
+
"private-input-record": "private-input-record";
|
|
48
|
+
"raw-result": "raw-result";
|
|
49
|
+
"raw-trace": "raw-trace";
|
|
50
|
+
"scripted-baseline-output": "scripted-baseline-output";
|
|
51
|
+
}>;
|
|
52
|
+
publicSafeRunId: z.ZodNullable<z.ZodString>;
|
|
53
|
+
sanitizationPolicy: z.ZodNullable<z.ZodString>;
|
|
54
|
+
}, z.core.$strict>>;
|
|
55
|
+
}, z.core.$strict>;
|
|
56
|
+
export type PrivateArtifactManifest = z.infer<typeof PrivateArtifactManifest>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/** the public-safe index of every private artifact this repository references. */
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { lineageFields } from './lineage.js';
|
|
4
|
+
import { Digest } from './primitives.js';
|
|
5
|
+
/**
|
|
6
|
+
* The prior art's eight `artifactType` members, ratified unchanged as
|
|
7
|
+
* `artifactKind` (AD-24 rename only). An existing entry re-keys without
|
|
8
|
+
* re-classifying.
|
|
9
|
+
*/
|
|
10
|
+
export const PRIVATE_ARTIFACT_KINDS = [
|
|
11
|
+
'private-input-record',
|
|
12
|
+
'raw-trace',
|
|
13
|
+
'raw-result',
|
|
14
|
+
'human-label',
|
|
15
|
+
'implementation-patch',
|
|
16
|
+
'isolation-manifest',
|
|
17
|
+
'scripted-baseline-output',
|
|
18
|
+
'other',
|
|
19
|
+
];
|
|
20
|
+
export const PrivateArtifactKind = z.enum(PRIVATE_ARTIFACT_KINDS);
|
|
21
|
+
export const PrivateArtifactEntry = z.strictObject({
|
|
22
|
+
privateRef: z
|
|
23
|
+
.string()
|
|
24
|
+
.min(1)
|
|
25
|
+
.describe('The opaque handle the corpus port resolves under AD-8. Only emptiness is excluded: an opaque reference with a shape this package understands would stop being opaque.'),
|
|
26
|
+
digest: Digest.describe('The prior art\'s `sha256`, renamed against the shared AD-27 primitive; the value form is byte-identical. AD-8 is explicit that "a manifest digest is never a trusted label": the core recomputes the digest from the resolved bytes and a mismatch is an AD-28 `digest-mismatch` fault at ingest. That is a rule about resolved bytes, which a schema over a string cannot see, so it is recorded here and enforced nowhere in this file.'),
|
|
27
|
+
artifactKind: PrivateArtifactKind.describe("The prior art's `artifactType`, renamed and ratified with its eight members unchanged."),
|
|
28
|
+
publicSafeRunId: z
|
|
29
|
+
.string()
|
|
30
|
+
.nullable()
|
|
31
|
+
.describe('The run this artifact belongs to, in the public-safe vocabulary. `null` for an artifact belonging to no single run.'),
|
|
32
|
+
sanitizationPolicy: z
|
|
33
|
+
.string()
|
|
34
|
+
.min(1)
|
|
35
|
+
.nullable()
|
|
36
|
+
.describe('AD-8 carries "the sanitization policy applied to it", and the nearest antecedent is the entry rather than the manifest: a manifest holding a raw trace beside a human label gives the two different treatment, so per-entry is the only reading that survives. Opaque rather than an enum for the reason `ScopedResource.kind` is opaque: no AD supplies a value space, and inventing one is the unshaped-declaration defect in reverse. `null` spells "none applied", which must stay representable.'),
|
|
37
|
+
});
|
|
38
|
+
export const PrivateArtifactManifest = z
|
|
39
|
+
.strictObject({
|
|
40
|
+
...lineageFields,
|
|
41
|
+
entries: z.array(PrivateArtifactEntry),
|
|
42
|
+
})
|
|
43
|
+
.meta({
|
|
44
|
+
id: 'PrivateArtifactManifest',
|
|
45
|
+
description: "The public-safe index of every private artifact this repository references. Succeeds the prior-art `private-evidence-manifest` schema per AD-24, with three divergences: the prior art's `manifestVersion: const 1` becomes AD-11's `schemaVersion` alongside AD-29's lineage, `artifactType` becomes `artifactKind` with its eight members ratified unchanged, and each entry gains AD-8's `sanitizationPolicy`. AD-18 binds this artifact hardest: it \"never contains a private path, credential, or domain value\". That prohibition is not expressible over opaque strings, so it is stated here, recorded in the constraint ledger as not expressible, and enforced by review and by the publication guard rather than by this schema.",
|
|
46
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** the two tagged body shapes the probe boundary and AD-10's witnesses share. */
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { JsonValue } from './primitives.ts';
|
|
4
|
+
/**
|
|
5
|
+
* Both bodies are tagged. An untagged `JsonValue` cannot tell a JSON string
|
|
6
|
+
* response from a `text/html` one, since `JsonValue` accepts a bare string, and
|
|
7
|
+
* `absent` needs its own branch because `null` is a legal JSON body.
|
|
8
|
+
*/
|
|
9
|
+
export declare const ProbeRequestBody: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
10
|
+
kind: z.ZodLiteral<"json">;
|
|
11
|
+
value: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
|
|
12
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
13
|
+
kind: z.ZodLiteral<"absent">;
|
|
14
|
+
}, z.core.$strict>], "kind">;
|
|
15
|
+
export declare const ProbeObservedBody: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
16
|
+
kind: z.ZodLiteral<"json">;
|
|
17
|
+
value: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
|
|
18
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
19
|
+
kind: z.ZodLiteral<"text">;
|
|
20
|
+
value: z.ZodString;
|
|
21
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
22
|
+
kind: z.ZodLiteral<"absent">;
|
|
23
|
+
}, z.core.$strict>], "kind">;
|
|
24
|
+
export type ProbeRequestBody = z.infer<typeof ProbeRequestBody>;
|
|
25
|
+
export type ProbeObservedBody = z.infer<typeof ProbeObservedBody>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** the two tagged body shapes the probe boundary and AD-10's witnesses share. */
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { JsonValue } from './primitives.js';
|
|
4
|
+
// Split out of `port-messages.ts` so `sensitivity-witness.ts` can carry the
|
|
5
|
+
// request body without importing that module: `port-messages.ts` reads
|
|
6
|
+
// `HttpMethod` from `interface.ts`, and `interface.ts` reads the witness, so
|
|
7
|
+
// the direct import closes a cycle that fails at module evaluation. Nothing
|
|
8
|
+
// here carries `.meta({ id })`, so both unions still inline at each use site
|
|
9
|
+
// and no published byte moves.
|
|
10
|
+
/**
|
|
11
|
+
* Both bodies are tagged. An untagged `JsonValue` cannot tell a JSON string
|
|
12
|
+
* response from a `text/html` one, since `JsonValue` accepts a bare string, and
|
|
13
|
+
* `absent` needs its own branch because `null` is a legal JSON body.
|
|
14
|
+
*/
|
|
15
|
+
export const ProbeRequestBody = z.discriminatedUnion('kind', [
|
|
16
|
+
z.strictObject({ kind: z.literal('json'), value: JsonValue }),
|
|
17
|
+
z.strictObject({ kind: z.literal('absent') }),
|
|
18
|
+
]);
|
|
19
|
+
export const ProbeObservedBody = z.discriminatedUnion('kind', [
|
|
20
|
+
z.strictObject({ kind: z.literal('json'), value: JsonValue }),
|
|
21
|
+
z.strictObject({ kind: z.literal('text'), value: z.string() }),
|
|
22
|
+
z.strictObject({ kind: z.literal('absent') }),
|
|
23
|
+
]);
|