eval-quality 0.2.0 → 0.3.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/README.md +3 -3
- package/corpus/dev/README.md +3 -2
- package/corpus/dev/compile-seal-example/brief.json +1 -1
- package/corpus/dev/compile-seal-example/contract.json +1 -1
- package/corpus/dev/contracts/absent-collection-locations.json +1 -1
- package/corpus/dev/contracts/absent-sibling-groups.json +1 -1
- package/corpus/dev/contracts/absent-success-indicator.json +1 -1
- package/corpus/dev/contracts/empty-channel-roles.json +1 -1
- package/corpus/dev/contracts/empty-collection-locations.json +1 -1
- package/corpus/dev/contracts/empty-request-shapes.json +1 -1
- package/corpus/dev/contracts/empty-sibling-groups.json +1 -1
- package/corpus/dev/contracts/fragment-selection.json +1 -0
- package/corpus/dev/contracts/no-collection-quantifier.json +1 -1
- package/corpus/dev/contracts/no-operation-inventory.json +1 -1
- package/corpus/dev/contracts/no-read-back-relation.json +1 -1
- package/corpus/dev/contracts/no-state-change-marker.json +1 -1
- package/corpus/dev/contracts/no-type-violating-step.json +1 -1
- package/corpus/dev/contracts/per-key-split-oracles.json +1 -1
- package/corpus/dev/contracts/review-corpus.json +1 -0
- package/corpus/dev/contracts/satisfied-declarations.json +1 -1
- package/corpus/dev/contracts/single-required-response-key.json +1 -1
- package/corpus/dev/contracts/split-indicator-oracle.json +1 -1
- package/corpus/dev/contracts/unaddressed-parameter-sibling.json +1 -1
- package/corpus/dev/contracts/unnamed-reference-set.json +1 -1
- package/corpus/dev/contracts/wrong-cardinality-form.json +1 -1
- package/corpus/dev/index.json +1 -1
- package/dist/cli/render.d.ts +2 -5
- package/dist/cli/render.js +51 -1
- package/dist/core/compile/bindings.d.ts +26 -7
- package/dist/core/compile/bindings.js +49 -32
- package/dist/core/compile/compile.d.ts +12 -0
- package/dist/core/compile/compile.js +28 -1
- package/dist/core/compile/excluded-content.d.ts +11 -0
- package/dist/core/compile/excluded-content.js +42 -0
- package/dist/core/compile/expression-legality.d.ts +2 -2
- package/dist/core/compile/expression-legality.js +58 -12
- package/dist/core/compile/interface-inventory.d.ts +34 -1
- package/dist/core/compile/interface-inventory.js +88 -11
- package/dist/core/compile/reachability.d.ts +12 -2
- package/dist/core/compile/reachability.js +123 -36
- package/dist/core/compile/schema-version.d.ts +2 -0
- package/dist/core/compile/schema-version.js +25 -0
- package/dist/core/compile/sensitivity-witness.d.ts +31 -12
- package/dist/core/compile/sensitivity-witness.js +110 -23
- package/dist/core/compile/step-reference.d.ts +2 -0
- package/dist/core/compile/step-reference.js +49 -0
- package/dist/core/coverage/operations.d.ts +62 -0
- package/dist/core/coverage/operations.js +57 -0
- package/dist/core/coverage/relevance.d.ts +4 -2
- package/dist/core/coverage/relevance.js +22 -23
- package/dist/core/coverage/satisfaction.d.ts +2 -2
- package/dist/core/coverage/satisfaction.js +73 -48
- package/dist/core/declared-inputs.d.ts +83 -4
- package/dist/core/declared-inputs.js +105 -8
- package/dist/core/evaluate/evidence-resolution.d.ts +9 -12
- package/dist/core/evaluate/evidence-resolution.js +70 -10
- package/dist/core/evaluate/operators.d.ts +22 -0
- package/dist/core/evaluate/operators.js +17 -1
- package/dist/core/evaluate/resolution.d.ts +14 -3
- package/dist/core/evaluate/resolution.js +63 -3
- package/dist/core/excluded-content.d.ts +65 -0
- package/dist/core/excluded-content.js +113 -0
- package/dist/core/failure-codes.d.ts +2 -2
- package/dist/core/failure-codes.js +5 -2
- package/dist/core/ingest/conditions.d.ts +1 -1
- package/dist/core/ingest/ingest.js +8 -0
- package/dist/core/preflight/plan.d.ts +7 -5
- package/dist/core/preflight/plan.js +75 -32
- package/dist/core/preflight/projection.d.ts +6 -3
- package/dist/core/preflight/projection.js +22 -2
- package/dist/core/preflight/reduce.js +47 -7
- package/dist/core/preflight/witness-evidence.d.ts +5 -5
- package/dist/core/preflight/witness-evidence.js +63 -20
- package/dist/core/schemas/artifact.d.ts +683 -35
- package/dist/core/schemas/constraint-ledger.js +11 -0
- package/dist/core/schemas/defect-signature.d.ts +438 -16
- package/dist/core/schemas/defect-signature.js +58 -10
- package/dist/core/schemas/eval-contract.d.ts +517 -12
- package/dist/core/schemas/eval-contract.js +18 -2
- package/dist/core/schemas/evidence-artifact.d.ts +14 -4
- package/dist/core/schemas/evidence-artifact.js +1 -1
- package/dist/core/schemas/interface.d.ts +741 -13
- package/dist/core/schemas/interface.js +120 -7
- package/dist/core/schemas/isolation-manifest.js +16 -9
- package/dist/core/schemas/plan.d.ts +217 -3
- package/dist/core/schemas/plan.js +22 -1
- package/dist/core/schemas/pointer.d.ts +47 -1
- package/dist/core/schemas/pointer.js +89 -8
- package/dist/core/schemas/port-messages.d.ts +194 -10
- package/dist/core/schemas/port-messages.js +73 -6
- package/dist/core/schemas/probe-body.d.ts +18 -0
- package/dist/core/schemas/probe-body.js +13 -0
- package/dist/core/schemas/probe.d.ts +122 -3
- package/dist/core/schemas/probe.js +1 -1
- package/dist/core/schemas/sealed-run-record.d.ts +131 -9
- package/dist/core/schemas/sealed-run-record.js +56 -11
- package/dist/core/schemas/sensitivity-witness.d.ts +108 -6
- package/dist/core/schemas/sensitivity-witness.js +61 -5
- package/dist/core/score/bindings.d.ts +2 -2
- package/dist/core/score/bindings.js +25 -13
- package/dist/core/score/qualification.d.ts +5 -5
- package/dist/core/score/qualification.js +67 -37
- package/dist/core/score/quotation.d.ts +1 -24
- package/dist/core/score/quotation.js +29 -4
- package/dist/core/score/score.js +28 -2
- package/dist/core/score/strength.d.ts +9 -0
- package/dist/core/score/strength.js +35 -1
- package/dist/core/score/witness.d.ts +21 -0
- package/dist/core/score/witness.js +9 -4
- package/dist/core/seal/derived-reference.d.ts +2 -9
- package/dist/core/seal/derived-reference.js +62 -23
- package/dist/core/seal/plan-index.d.ts +18 -3
- package/dist/core/seal/plan-index.js +44 -8
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/ports/environment-probe-port.d.ts +60 -4
- package/dist/testing/probe-conformance.d.ts +29 -0
- package/dist/testing/probe-conformance.js +34 -5
- package/package.json +1 -1
- package/schemas/eval-contract.schema.json +1356 -464
- package/schemas/evidence-artifact.schema.json +59 -29
- package/schemas/isolation-manifest.schema.json +17 -10
- package/schemas/probe.schema.json +197 -71
- package/schemas/rubric.schema.json +1 -1
- package/schemas/sealed-run-record.schema.json +296 -39
|
@@ -16,10 +16,11 @@ export const EVIDENCE_CHANNELS = [
|
|
|
16
16
|
'stdout',
|
|
17
17
|
'stderr',
|
|
18
18
|
'exit-code',
|
|
19
|
+
'artifact',
|
|
19
20
|
];
|
|
20
21
|
export const EvidenceChannel = z.enum(EVIDENCE_CHANNELS).meta({
|
|
21
22
|
id: 'EvidenceChannel',
|
|
22
|
-
description: "AD-26's closed evidence channel vocabulary. The same
|
|
23
|
+
description: "AD-26's closed evidence channel vocabulary. The same eight the interaction-rooted pointer addresses; a channel outside this set is a syntax error rather than an unreachable-evidence finding.",
|
|
23
24
|
});
|
|
24
25
|
/**
|
|
25
26
|
* AD-19's four transport channels. `call-inputs` alone has no declared
|
|
@@ -31,11 +32,37 @@ export const TransportChannel = z.enum(TRANSPORT_CHANNELS).meta({
|
|
|
31
32
|
id: 'TransportChannel',
|
|
32
33
|
description: "AD-19's four transport channels. They are the segment `call-inputs` takes before its tail, and the four keys an observation's recorded call inputs are keyed by.",
|
|
33
34
|
});
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
/**
|
|
36
|
+
* The four channels a command-kind operation accepts input on. They sit beside
|
|
37
|
+
* the transport channels because this module owns channel vocabulary, and the
|
|
38
|
+
* request shape that declares them has to name them without forward-declaring
|
|
39
|
+
* a tuple it does not own.
|
|
40
|
+
*
|
|
41
|
+
* `stdin` is the command analogue of `body` and inherits its asymmetry: a
|
|
42
|
+
* request shape declares it as a key map, while one witness leg supplies it as
|
|
43
|
+
* a tagged body value.
|
|
44
|
+
*/
|
|
45
|
+
export const COMMAND_CHANNELS = [
|
|
46
|
+
'argument',
|
|
47
|
+
'option',
|
|
48
|
+
'environment',
|
|
49
|
+
'stdin',
|
|
50
|
+
];
|
|
51
|
+
/**
|
|
52
|
+
* Every channel `call-inputs` may take as its next segment, both kinds
|
|
53
|
+
* together. A pointer is parsed with no contract in hand, so the grammar
|
|
54
|
+
* admits all eight and the question of which four a given operation may use is
|
|
55
|
+
* answered by reachability, which has the operation.
|
|
56
|
+
*/
|
|
57
|
+
export const INPUT_CHANNELS = [
|
|
58
|
+
...TRANSPORT_CHANNELS,
|
|
59
|
+
...COMMAND_CHANNELS,
|
|
60
|
+
];
|
|
61
|
+
// The four-way partition (tail-bearing, scalar, transport-rooted,
|
|
62
|
+
// identifier-rooted) is spelled out and typed against the enum rather than
|
|
63
|
+
// rebuilt from it, so a typo fails the typecheck; a test asserts it stays
|
|
64
|
+
// disjoint and exhaustive. A status or exit code is scalar, so a pointer into
|
|
65
|
+
// one is a syntax error rather than an unreachable-evidence finding.
|
|
39
66
|
export const TAIL_BEARING_CHANNELS = [
|
|
40
67
|
'response-body',
|
|
41
68
|
'response-headers',
|
|
@@ -47,13 +74,67 @@ export const SCALAR_CHANNELS = [
|
|
|
47
74
|
'exit-code',
|
|
48
75
|
];
|
|
49
76
|
export const TRANSPORT_ROOTED_CHANNEL = 'call-inputs';
|
|
77
|
+
// A fourth class rather than a fourth rule. AD-26's repair for `call-inputs`
|
|
78
|
+
// is that "a channel that names one of several things needs a declared segment
|
|
79
|
+
// to resolve against", and a written file is the same situation: an operation
|
|
80
|
+
// may write several, so the pointer names which one before its tail. The only
|
|
81
|
+
// difference from `call-inputs` is that the segment is an open identifier
|
|
82
|
+
// rather than a closed enum, because the artifact names are the contract
|
|
83
|
+
// author's own. What the segment resolves against is the operation's declared
|
|
84
|
+
// `artifacts` list, and a name absent from it is `unresolved-artifact-reference`
|
|
85
|
+
// rather than evidence that resolves absent.
|
|
86
|
+
export const IDENTIFIER_ROOTED_CHANNEL = 'artifact';
|
|
87
|
+
/**
|
|
88
|
+
* The response-side channels each kind produces, and neither produces the
|
|
89
|
+
* other's. Declared here rather than rebuilt from a description, so a channel
|
|
90
|
+
* added to the vocabulary has to be assigned to a side and a test can assert
|
|
91
|
+
* the two partition the response side exactly.
|
|
92
|
+
*
|
|
93
|
+
* `call-inputs` belongs to neither: it carries what was sent rather than what
|
|
94
|
+
* came back, and both kinds have it.
|
|
95
|
+
*/
|
|
96
|
+
export const API_RESPONSE_CHANNELS = [
|
|
97
|
+
'response-body',
|
|
98
|
+
'response-headers',
|
|
99
|
+
'response-status',
|
|
100
|
+
];
|
|
101
|
+
export const COMMAND_RESPONSE_CHANNELS = [
|
|
102
|
+
'stdout',
|
|
103
|
+
'stderr',
|
|
104
|
+
'exit-code',
|
|
105
|
+
'artifact',
|
|
106
|
+
];
|
|
107
|
+
/**
|
|
108
|
+
* Every channel but the identifier-rooted one, in the vocabulary's own order.
|
|
109
|
+
*
|
|
110
|
+
* Spelled out and typed against the enum rather than filtered from it: a filter
|
|
111
|
+
* widens to `EvidenceChannelName[]` and `z.enum` needs a tuple, and the whole
|
|
112
|
+
* point of the list is that adding a ninth channel has to be a decision about
|
|
113
|
+
* which side of this line it falls on rather than something a filter absorbs.
|
|
114
|
+
* `tests/schemas/pointer.test.ts` asserts it partitions the vocabulary with
|
|
115
|
+
* `IDENTIFIER_ROOTED_CHANNEL` exactly.
|
|
116
|
+
*/
|
|
117
|
+
export const NON_IDENTIFIER_ROOTED_CHANNELS = [
|
|
118
|
+
'response-body',
|
|
119
|
+
'response-headers',
|
|
120
|
+
'response-status',
|
|
121
|
+
'call-inputs',
|
|
122
|
+
'stdout',
|
|
123
|
+
'stderr',
|
|
124
|
+
'exit-code',
|
|
125
|
+
];
|
|
126
|
+
/** Every channel that carries what came back, whichever kind produced it. */
|
|
127
|
+
export const RESPONSE_SIDE_CHANNELS = [
|
|
128
|
+
...API_RESPONSE_CHANNELS,
|
|
129
|
+
...COMMAND_RESPONSE_CHANNELS,
|
|
130
|
+
];
|
|
50
131
|
// An RFC 6901 reference token: any character but "/" and "~", plus the two
|
|
51
132
|
// escapes. A token may be empty, which is RFC 6901's spelling for a key that is
|
|
52
133
|
// the empty string.
|
|
53
134
|
const TOKEN = '(?:[^/~]|~[01])*';
|
|
54
135
|
const TAIL = `(?:/${TOKEN})*`;
|
|
55
136
|
const alternation = (members) => members.join('|');
|
|
56
|
-
export const INTERACTION_POINTER_PATTERN = new RegExp(`^/interactions/${IDENTIFIER_CHARSET_SOURCE}/(?:(?:${alternation(TAIL_BEARING_CHANNELS)})${TAIL}|(?:${alternation(SCALAR_CHANNELS)})|${TRANSPORT_ROOTED_CHANNEL}/(?:${alternation(
|
|
137
|
+
export const INTERACTION_POINTER_PATTERN = new RegExp(`^/interactions/${IDENTIFIER_CHARSET_SOURCE}/(?:(?:${alternation(TAIL_BEARING_CHANNELS)})${TAIL}|(?:${alternation(SCALAR_CHANNELS)})|${TRANSPORT_ROOTED_CHANNEL}/(?:${alternation(INPUT_CHANNELS)})${TAIL}|${IDENTIFIER_ROOTED_CHANNEL}/${IDENTIFIER_CHARSET_SOURCE}${TAIL})$`);
|
|
57
138
|
export const BOUND_ELEMENT_POINTER_PATTERN = new RegExp(`^@(?:/${TOKEN})+$`);
|
|
58
139
|
export const DESCRIPTOR_POINTER_PATTERN = new RegExp(`^(?:/${TOKEN})*$`);
|
|
59
140
|
/**
|
|
@@ -63,7 +144,7 @@ export const DESCRIPTOR_POINTER_PATTERN = new RegExp(`^(?:/${TOKEN})*$`);
|
|
|
63
144
|
export const InteractionPointer = z
|
|
64
145
|
.string()
|
|
65
146
|
.regex(INTERACTION_POINTER_PATTERN)
|
|
66
|
-
.describe('AD-26 interaction-rooted pointer: "/interactions/{stepId}/" followed by one channel of the closed vocabulary. `call-inputs` takes one of the four transport channels
|
|
147
|
+
.describe('AD-26 interaction-rooted pointer: "/interactions/{stepId}/" followed by one channel of the closed vocabulary. `call-inputs` takes one input channel as its next segment, one of the four transport channels or one of the four command channels; `artifact` takes the identifier of a file the operation declares it writes; `response-status` and `exit-code` take no tail. Syntax only: whether the step exists and whether the evidence is reachable are compile-time checks, not schema checks.');
|
|
67
148
|
/**
|
|
68
149
|
* Spelling 2, bound-element relative. Consumer: a `{ pointer }` operand inside
|
|
69
150
|
* a quantifier predicate. Never an evidence target, because AD-3 computes
|
|
@@ -29,19 +29,16 @@ export declare const FileWriteResponse: z.ZodObject<{
|
|
|
29
29
|
byteLength: z.ZodInt;
|
|
30
30
|
}, z.core.$strict>;
|
|
31
31
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
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.
|
|
32
|
+
* A request to an interface that speaks HTTP. Tagged on `kind` so an adapter
|
|
33
|
+
* knows what it is being asked to do before it reads anything else, and so the
|
|
34
|
+
* two shapes cannot be confused for one another by a field that happens to be
|
|
35
|
+
* absent.
|
|
40
36
|
*/
|
|
41
|
-
export declare const
|
|
37
|
+
export declare const ApiProbeRequest: z.ZodObject<{
|
|
42
38
|
probeId: z.ZodString;
|
|
43
39
|
interfaceId: z.ZodString;
|
|
44
40
|
operationId: z.ZodString;
|
|
41
|
+
kind: z.ZodLiteral<"api">;
|
|
45
42
|
method: z.ZodEnum<{
|
|
46
43
|
DELETE: "DELETE";
|
|
47
44
|
GET: "GET";
|
|
@@ -64,6 +61,90 @@ export declare const ProbeRequest: z.ZodObject<{
|
|
|
64
61
|
}, z.core.$strict>], "kind">;
|
|
65
62
|
}, z.core.$strict>;
|
|
66
63
|
}, z.core.$strict>;
|
|
64
|
+
/**
|
|
65
|
+
* A request to run a command.
|
|
66
|
+
*
|
|
67
|
+
* AD-35's rule is that a contract names a logical identifier and the caller
|
|
68
|
+
* maps it, and the analogue for a command is exactly the same shape: the
|
|
69
|
+
* `executable` is the logical name the contract declared, and the adapter maps
|
|
70
|
+
* it to something runnable from configuration outside the contract. No
|
|
71
|
+
* filesystem path, no interpreter, no shell string. The adapter builds the
|
|
72
|
+
* argument vector; it is never handed one to execute.
|
|
73
|
+
*
|
|
74
|
+
* `environment` is string-valued for the reason `header` is, and carries no
|
|
75
|
+
* credential for the reason AD-18 gives: authorization material is the
|
|
76
|
+
* adapter's, supplied by the same mapping that authorizes the target.
|
|
77
|
+
*/
|
|
78
|
+
export declare const CommandProbeRequest: z.ZodObject<{
|
|
79
|
+
probeId: z.ZodString;
|
|
80
|
+
interfaceId: z.ZodString;
|
|
81
|
+
operationId: z.ZodString;
|
|
82
|
+
kind: z.ZodLiteral<"cli">;
|
|
83
|
+
executable: z.ZodString;
|
|
84
|
+
subcommandPath: z.ZodArray<z.ZodString>;
|
|
85
|
+
channels: z.ZodObject<{
|
|
86
|
+
argument: z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
|
|
87
|
+
option: z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
|
|
88
|
+
environment: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
89
|
+
stdin: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
90
|
+
kind: z.ZodLiteral<"json">;
|
|
91
|
+
value: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
|
|
92
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
93
|
+
kind: z.ZodLiteral<"text">;
|
|
94
|
+
value: z.ZodString;
|
|
95
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
96
|
+
kind: z.ZodLiteral<"absent">;
|
|
97
|
+
}, z.core.$strict>], "kind">;
|
|
98
|
+
}, z.core.$strict>;
|
|
99
|
+
}, z.core.$strict>;
|
|
100
|
+
export declare const ProbeRequest: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
101
|
+
probeId: z.ZodString;
|
|
102
|
+
interfaceId: z.ZodString;
|
|
103
|
+
operationId: z.ZodString;
|
|
104
|
+
kind: z.ZodLiteral<"api">;
|
|
105
|
+
method: z.ZodEnum<{
|
|
106
|
+
DELETE: "DELETE";
|
|
107
|
+
GET: "GET";
|
|
108
|
+
HEAD: "HEAD";
|
|
109
|
+
OPTIONS: "OPTIONS";
|
|
110
|
+
PATCH: "PATCH";
|
|
111
|
+
POST: "POST";
|
|
112
|
+
PUT: "PUT";
|
|
113
|
+
}>;
|
|
114
|
+
pathTemplate: z.ZodString;
|
|
115
|
+
channels: z.ZodObject<{
|
|
116
|
+
path: z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
|
|
117
|
+
query: z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
|
|
118
|
+
header: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
119
|
+
body: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
120
|
+
kind: z.ZodLiteral<"json">;
|
|
121
|
+
value: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
|
|
122
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
123
|
+
kind: z.ZodLiteral<"absent">;
|
|
124
|
+
}, z.core.$strict>], "kind">;
|
|
125
|
+
}, z.core.$strict>;
|
|
126
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
127
|
+
probeId: z.ZodString;
|
|
128
|
+
interfaceId: z.ZodString;
|
|
129
|
+
operationId: z.ZodString;
|
|
130
|
+
kind: z.ZodLiteral<"cli">;
|
|
131
|
+
executable: z.ZodString;
|
|
132
|
+
subcommandPath: z.ZodArray<z.ZodString>;
|
|
133
|
+
channels: z.ZodObject<{
|
|
134
|
+
argument: z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
|
|
135
|
+
option: z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
|
|
136
|
+
environment: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
137
|
+
stdin: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
138
|
+
kind: z.ZodLiteral<"json">;
|
|
139
|
+
value: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
|
|
140
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
141
|
+
kind: z.ZodLiteral<"text">;
|
|
142
|
+
value: z.ZodString;
|
|
143
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
144
|
+
kind: z.ZodLiteral<"absent">;
|
|
145
|
+
}, z.core.$strict>], "kind">;
|
|
146
|
+
}, z.core.$strict>;
|
|
147
|
+
}, z.core.$strict>], "kind">;
|
|
67
148
|
/**
|
|
68
149
|
* What the adapter observed. Deliberately response content only: no elapsed
|
|
69
150
|
* time, no redirect count, no retry count. AD-35's caps are safety limits, so
|
|
@@ -75,10 +156,11 @@ export declare const ProbeRequest: z.ZodObject<{
|
|
|
75
156
|
* policy denial, a cap, an abort, or a transport failure throws; a 500 is the
|
|
76
157
|
* payload AD-10's seeded-fault check reads, never an error.
|
|
77
158
|
*/
|
|
78
|
-
export declare const
|
|
159
|
+
export declare const ApiProbeObservation: z.ZodObject<{
|
|
79
160
|
probeId: z.ZodString;
|
|
80
161
|
interfaceId: z.ZodString;
|
|
81
162
|
operationId: z.ZodString;
|
|
163
|
+
kind: z.ZodLiteral<"api">;
|
|
82
164
|
status: z.ZodInt;
|
|
83
165
|
headers: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
84
166
|
body: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -91,6 +173,104 @@ export declare const ProbeObservation: z.ZodObject<{
|
|
|
91
173
|
kind: z.ZodLiteral<"absent">;
|
|
92
174
|
}, z.core.$strict>], "kind">;
|
|
93
175
|
}, z.core.$strict>;
|
|
176
|
+
/**
|
|
177
|
+
* What the adapter observed of a command run: its two streams, its exit code,
|
|
178
|
+
* and the files it wrote.
|
|
179
|
+
*
|
|
180
|
+
* `exitCode` is signed, unlike an HTTP status, because a process terminated by
|
|
181
|
+
* a signal is conventionally reported as a negative code and this field records
|
|
182
|
+
* what happened rather than what is tidy. A non-zero exit is an observation
|
|
183
|
+
* exactly as a 500 is: only a policy denial, a cap, an abort, or a failure to
|
|
184
|
+
* start the process throws.
|
|
185
|
+
*
|
|
186
|
+
* `artifacts` is keyed by the identifier the operation declared, not by a
|
|
187
|
+
* filesystem path. Which path each identifier names is the adapter's mapping,
|
|
188
|
+
* the same disclosure boundary AD-35 draws around the executable itself.
|
|
189
|
+
*/
|
|
190
|
+
export declare const CommandProbeObservation: z.ZodObject<{
|
|
191
|
+
probeId: z.ZodString;
|
|
192
|
+
interfaceId: z.ZodString;
|
|
193
|
+
operationId: z.ZodString;
|
|
194
|
+
kind: z.ZodLiteral<"cli">;
|
|
195
|
+
exitCode: z.ZodInt;
|
|
196
|
+
stdout: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
197
|
+
kind: z.ZodLiteral<"json">;
|
|
198
|
+
value: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
|
|
199
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
200
|
+
kind: z.ZodLiteral<"text">;
|
|
201
|
+
value: z.ZodString;
|
|
202
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
203
|
+
kind: z.ZodLiteral<"absent">;
|
|
204
|
+
}, z.core.$strict>], "kind">;
|
|
205
|
+
stderr: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
206
|
+
kind: z.ZodLiteral<"json">;
|
|
207
|
+
value: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
|
|
208
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
209
|
+
kind: z.ZodLiteral<"text">;
|
|
210
|
+
value: z.ZodString;
|
|
211
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
212
|
+
kind: z.ZodLiteral<"absent">;
|
|
213
|
+
}, z.core.$strict>], "kind">;
|
|
214
|
+
artifacts: z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
215
|
+
kind: z.ZodLiteral<"json">;
|
|
216
|
+
value: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
|
|
217
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
218
|
+
kind: z.ZodLiteral<"text">;
|
|
219
|
+
value: z.ZodString;
|
|
220
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
221
|
+
kind: z.ZodLiteral<"absent">;
|
|
222
|
+
}, z.core.$strict>], "kind">>;
|
|
223
|
+
}, z.core.$strict>;
|
|
224
|
+
export declare const ProbeObservation: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
225
|
+
probeId: z.ZodString;
|
|
226
|
+
interfaceId: z.ZodString;
|
|
227
|
+
operationId: z.ZodString;
|
|
228
|
+
kind: z.ZodLiteral<"api">;
|
|
229
|
+
status: z.ZodInt;
|
|
230
|
+
headers: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
231
|
+
body: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
232
|
+
kind: z.ZodLiteral<"json">;
|
|
233
|
+
value: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
|
|
234
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
235
|
+
kind: z.ZodLiteral<"text">;
|
|
236
|
+
value: z.ZodString;
|
|
237
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
238
|
+
kind: z.ZodLiteral<"absent">;
|
|
239
|
+
}, z.core.$strict>], "kind">;
|
|
240
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
241
|
+
probeId: z.ZodString;
|
|
242
|
+
interfaceId: z.ZodString;
|
|
243
|
+
operationId: z.ZodString;
|
|
244
|
+
kind: z.ZodLiteral<"cli">;
|
|
245
|
+
exitCode: z.ZodInt;
|
|
246
|
+
stdout: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
247
|
+
kind: z.ZodLiteral<"json">;
|
|
248
|
+
value: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
|
|
249
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
250
|
+
kind: z.ZodLiteral<"text">;
|
|
251
|
+
value: z.ZodString;
|
|
252
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
253
|
+
kind: z.ZodLiteral<"absent">;
|
|
254
|
+
}, z.core.$strict>], "kind">;
|
|
255
|
+
stderr: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
256
|
+
kind: z.ZodLiteral<"json">;
|
|
257
|
+
value: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
|
|
258
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
259
|
+
kind: z.ZodLiteral<"text">;
|
|
260
|
+
value: z.ZodString;
|
|
261
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
262
|
+
kind: z.ZodLiteral<"absent">;
|
|
263
|
+
}, z.core.$strict>], "kind">;
|
|
264
|
+
artifacts: z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
265
|
+
kind: z.ZodLiteral<"json">;
|
|
266
|
+
value: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
|
|
267
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
268
|
+
kind: z.ZodLiteral<"text">;
|
|
269
|
+
value: z.ZodString;
|
|
270
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
271
|
+
kind: z.ZodLiteral<"absent">;
|
|
272
|
+
}, z.core.$strict>], "kind">>;
|
|
273
|
+
}, z.core.$strict>], "kind">;
|
|
94
274
|
export type CorpusResolveRequest = z.infer<typeof CorpusResolveRequest>;
|
|
95
275
|
export type CorpusResolveResponse = z.infer<typeof CorpusResolveResponse>;
|
|
96
276
|
export type ClockReadRequest = z.infer<typeof ClockReadRequest>;
|
|
@@ -99,5 +279,9 @@ export type FileReadRequest = z.infer<typeof FileReadRequest>;
|
|
|
99
279
|
export type FileReadResponse = z.infer<typeof FileReadResponse>;
|
|
100
280
|
export type FileWriteRequest = z.infer<typeof FileWriteRequest>;
|
|
101
281
|
export type FileWriteResponse = z.infer<typeof FileWriteResponse>;
|
|
282
|
+
export type ApiProbeRequest = z.infer<typeof ApiProbeRequest>;
|
|
283
|
+
export type CommandProbeRequest = z.infer<typeof CommandProbeRequest>;
|
|
102
284
|
export type ProbeRequest = z.infer<typeof ProbeRequest>;
|
|
285
|
+
export type ApiProbeObservation = z.infer<typeof ApiProbeObservation>;
|
|
286
|
+
export type CommandProbeObservation = z.infer<typeof CommandProbeObservation>;
|
|
103
287
|
export type ProbeObservation = z.infer<typeof ProbeObservation>;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { HttpMethod, PathTemplate } from './interface.js';
|
|
4
4
|
import { Identifier, JsonValue, KeyName, Rfc3339Utc } from './primitives.js';
|
|
5
|
-
import { ProbeObservedBody, ProbeRequestBody } from './probe-body.js';
|
|
5
|
+
import { ProbeObservedBody, ProbeRequestBody, ProbeRequestStdin, } from './probe-body.js';
|
|
6
6
|
export { ProbeObservedBody, ProbeRequestBody } from './probe-body.js';
|
|
7
7
|
// AD-8: the corpus port resolves an opaque reference to bytes from a
|
|
8
8
|
// caller-owned location. It does not check the digest: AD-8 puts digest
|
|
@@ -52,10 +52,20 @@ export const FileWriteResponse = z.strictObject({
|
|
|
52
52
|
* authorization material is the adapter's, supplied by the same mapping that
|
|
53
53
|
* authorizes the target.
|
|
54
54
|
*/
|
|
55
|
-
|
|
55
|
+
const probeCorrelation = {
|
|
56
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
57
|
interfaceId: Identifier,
|
|
58
58
|
operationId: Identifier,
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* A request to an interface that speaks HTTP. Tagged on `kind` so an adapter
|
|
62
|
+
* knows what it is being asked to do before it reads anything else, and so the
|
|
63
|
+
* two shapes cannot be confused for one another by a field that happens to be
|
|
64
|
+
* absent.
|
|
65
|
+
*/
|
|
66
|
+
export const ApiProbeRequest = z.strictObject({
|
|
67
|
+
...probeCorrelation,
|
|
68
|
+
kind: z.literal('api'),
|
|
59
69
|
method: HttpMethod,
|
|
60
70
|
pathTemplate: PathTemplate,
|
|
61
71
|
channels: z.strictObject({
|
|
@@ -67,6 +77,38 @@ export const ProbeRequest = z.strictObject({
|
|
|
67
77
|
body: ProbeRequestBody,
|
|
68
78
|
}),
|
|
69
79
|
});
|
|
80
|
+
/**
|
|
81
|
+
* A request to run a command.
|
|
82
|
+
*
|
|
83
|
+
* AD-35's rule is that a contract names a logical identifier and the caller
|
|
84
|
+
* maps it, and the analogue for a command is exactly the same shape: the
|
|
85
|
+
* `executable` is the logical name the contract declared, and the adapter maps
|
|
86
|
+
* it to something runnable from configuration outside the contract. No
|
|
87
|
+
* filesystem path, no interpreter, no shell string. The adapter builds the
|
|
88
|
+
* argument vector; it is never handed one to execute.
|
|
89
|
+
*
|
|
90
|
+
* `environment` is string-valued for the reason `header` is, and carries no
|
|
91
|
+
* credential for the reason AD-18 gives: authorization material is the
|
|
92
|
+
* adapter's, supplied by the same mapping that authorizes the target.
|
|
93
|
+
*/
|
|
94
|
+
export const CommandProbeRequest = z.strictObject({
|
|
95
|
+
...probeCorrelation,
|
|
96
|
+
kind: z.literal('cli'),
|
|
97
|
+
executable: Identifier.describe('A logical executable name, never a filesystem path, a URL, a host, or a port (AD-35). The adapter maps it to an authorized target through configuration outside the contract.'),
|
|
98
|
+
subcommandPath: z.array(Identifier),
|
|
99
|
+
channels: z.strictObject({
|
|
100
|
+
argument: z.record(KeyName, JsonValue),
|
|
101
|
+
option: z.record(KeyName, JsonValue),
|
|
102
|
+
environment: z
|
|
103
|
+
.record(KeyName, z.string())
|
|
104
|
+
.describe('String-valued because an environment variable is a string to the process; the other channels carry the declared JSON value.'),
|
|
105
|
+
stdin: ProbeRequestStdin,
|
|
106
|
+
}),
|
|
107
|
+
});
|
|
108
|
+
export const ProbeRequest = z.discriminatedUnion('kind', [
|
|
109
|
+
ApiProbeRequest,
|
|
110
|
+
CommandProbeRequest,
|
|
111
|
+
]);
|
|
70
112
|
/**
|
|
71
113
|
* What the adapter observed. Deliberately response content only: no elapsed
|
|
72
114
|
* time, no redirect count, no retry count. AD-35's caps are safety limits, so
|
|
@@ -78,13 +120,38 @@ export const ProbeRequest = z.strictObject({
|
|
|
78
120
|
* policy denial, a cap, an abort, or a transport failure throws; a 500 is the
|
|
79
121
|
* payload AD-10's seeded-fault check reads, never an error.
|
|
80
122
|
*/
|
|
81
|
-
export const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
operationId: Identifier,
|
|
123
|
+
export const ApiProbeObservation = z.strictObject({
|
|
124
|
+
...probeCorrelation,
|
|
125
|
+
kind: z.literal('api'),
|
|
85
126
|
status: z.int().min(100).max(599),
|
|
86
127
|
headers: z
|
|
87
128
|
.record(KeyName, z.string())
|
|
88
129
|
.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
130
|
body: ProbeObservedBody,
|
|
90
131
|
});
|
|
132
|
+
/**
|
|
133
|
+
* What the adapter observed of a command run: its two streams, its exit code,
|
|
134
|
+
* and the files it wrote.
|
|
135
|
+
*
|
|
136
|
+
* `exitCode` is signed, unlike an HTTP status, because a process terminated by
|
|
137
|
+
* a signal is conventionally reported as a negative code and this field records
|
|
138
|
+
* what happened rather than what is tidy. A non-zero exit is an observation
|
|
139
|
+
* exactly as a 500 is: only a policy denial, a cap, an abort, or a failure to
|
|
140
|
+
* start the process throws.
|
|
141
|
+
*
|
|
142
|
+
* `artifacts` is keyed by the identifier the operation declared, not by a
|
|
143
|
+
* filesystem path. Which path each identifier names is the adapter's mapping,
|
|
144
|
+
* the same disclosure boundary AD-35 draws around the executable itself.
|
|
145
|
+
*/
|
|
146
|
+
export const CommandProbeObservation = z.strictObject({
|
|
147
|
+
...probeCorrelation,
|
|
148
|
+
kind: z.literal('cli'),
|
|
149
|
+
exitCode: z.int(),
|
|
150
|
+
stdout: ProbeObservedBody,
|
|
151
|
+
stderr: ProbeObservedBody,
|
|
152
|
+
artifacts: z.record(Identifier, ProbeObservedBody),
|
|
153
|
+
});
|
|
154
|
+
export const ProbeObservation = z.discriminatedUnion('kind', [
|
|
155
|
+
ApiProbeObservation,
|
|
156
|
+
CommandProbeObservation,
|
|
157
|
+
]);
|
|
@@ -21,5 +21,23 @@ export declare const ProbeObservedBody: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
21
21
|
}, z.core.$strict>, z.ZodObject<{
|
|
22
22
|
kind: z.ZodLiteral<"absent">;
|
|
23
23
|
}, z.core.$strict>], "kind">;
|
|
24
|
+
/**
|
|
25
|
+
* What one leg writes to a command's standard input. Three arms, like the
|
|
26
|
+
* observed body rather than the request body: standard input is a byte stream,
|
|
27
|
+
* so a command that reads a prompt receives text that was never JSON, and
|
|
28
|
+
* routing it through the `json` arm as a JSON string would make the leg claim
|
|
29
|
+
* a serialisation the command never sees. `absent` is the leg that writes
|
|
30
|
+
* nothing and closes the stream.
|
|
31
|
+
*/
|
|
32
|
+
export declare const ProbeRequestStdin: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
33
|
+
kind: z.ZodLiteral<"json">;
|
|
34
|
+
value: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
|
|
35
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
36
|
+
kind: z.ZodLiteral<"text">;
|
|
37
|
+
value: z.ZodString;
|
|
38
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
39
|
+
kind: z.ZodLiteral<"absent">;
|
|
40
|
+
}, z.core.$strict>], "kind">;
|
|
24
41
|
export type ProbeRequestBody = z.infer<typeof ProbeRequestBody>;
|
|
25
42
|
export type ProbeObservedBody = z.infer<typeof ProbeObservedBody>;
|
|
43
|
+
export type ProbeRequestStdin = z.infer<typeof ProbeRequestStdin>;
|
|
@@ -21,3 +21,16 @@ export const ProbeObservedBody = z.discriminatedUnion('kind', [
|
|
|
21
21
|
z.strictObject({ kind: z.literal('text'), value: z.string() }),
|
|
22
22
|
z.strictObject({ kind: z.literal('absent') }),
|
|
23
23
|
]);
|
|
24
|
+
/**
|
|
25
|
+
* What one leg writes to a command's standard input. Three arms, like the
|
|
26
|
+
* observed body rather than the request body: standard input is a byte stream,
|
|
27
|
+
* so a command that reads a prompt receives text that was never JSON, and
|
|
28
|
+
* routing it through the `json` arm as a JSON string would make the leg claim
|
|
29
|
+
* a serialisation the command never sees. `absent` is the leg that writes
|
|
30
|
+
* nothing and closes the stream.
|
|
31
|
+
*/
|
|
32
|
+
export const ProbeRequestStdin = z.discriminatedUnion('kind', [
|
|
33
|
+
z.strictObject({ kind: z.literal('json'), value: JsonValue }),
|
|
34
|
+
z.strictObject({ kind: z.literal('text'), value: z.string() }),
|
|
35
|
+
z.strictObject({ kind: z.literal('absent') }),
|
|
36
|
+
]);
|