eval-quality 0.2.0 → 0.5.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.
Files changed (137) hide show
  1. package/README.md +17 -12
  2. package/corpus/dev/README.md +3 -2
  3. package/corpus/dev/compile-seal-example/brief.json +1 -1
  4. package/corpus/dev/compile-seal-example/contract.json +1 -1
  5. package/corpus/dev/contracts/absent-collection-locations.json +1 -1
  6. package/corpus/dev/contracts/absent-sibling-groups.json +1 -1
  7. package/corpus/dev/contracts/absent-success-indicator.json +1 -1
  8. package/corpus/dev/contracts/empty-channel-roles.json +1 -1
  9. package/corpus/dev/contracts/empty-collection-locations.json +1 -1
  10. package/corpus/dev/contracts/empty-request-shapes.json +1 -1
  11. package/corpus/dev/contracts/empty-sibling-groups.json +1 -1
  12. package/corpus/dev/contracts/fragment-selection.json +1 -0
  13. package/corpus/dev/contracts/no-collection-quantifier.json +1 -1
  14. package/corpus/dev/contracts/no-operation-inventory.json +1 -1
  15. package/corpus/dev/contracts/no-read-back-relation.json +1 -1
  16. package/corpus/dev/contracts/no-state-change-marker.json +1 -1
  17. package/corpus/dev/contracts/no-type-violating-step.json +1 -1
  18. package/corpus/dev/contracts/per-key-split-oracles.json +1 -1
  19. package/corpus/dev/contracts/review-corpus.json +1 -0
  20. package/corpus/dev/contracts/satisfied-declarations.json +1 -1
  21. package/corpus/dev/contracts/single-required-response-key.json +1 -1
  22. package/corpus/dev/contracts/split-indicator-oracle.json +1 -1
  23. package/corpus/dev/contracts/unaddressed-parameter-sibling.json +1 -1
  24. package/corpus/dev/contracts/unnamed-reference-set.json +1 -1
  25. package/corpus/dev/contracts/wrong-cardinality-form.json +1 -1
  26. package/corpus/dev/index.json +1 -1
  27. package/dist/adapters/command-line-adapter.d.ts +44 -0
  28. package/dist/adapters/command-line-adapter.js +284 -0
  29. package/dist/adapters/command-target-policy.d.ts +36 -0
  30. package/dist/adapters/command-target-policy.js +33 -0
  31. package/dist/adapters/index.d.ts +2 -0
  32. package/dist/adapters/index.js +1 -0
  33. package/dist/cli/render.d.ts +2 -5
  34. package/dist/cli/render.js +51 -1
  35. package/dist/core/compile/bindings.d.ts +26 -7
  36. package/dist/core/compile/bindings.js +49 -32
  37. package/dist/core/compile/compile.d.ts +12 -0
  38. package/dist/core/compile/compile.js +28 -1
  39. package/dist/core/compile/excluded-content.d.ts +11 -0
  40. package/dist/core/compile/excluded-content.js +42 -0
  41. package/dist/core/compile/expression-legality.d.ts +2 -2
  42. package/dist/core/compile/expression-legality.js +58 -12
  43. package/dist/core/compile/interface-inventory.d.ts +34 -1
  44. package/dist/core/compile/interface-inventory.js +88 -11
  45. package/dist/core/compile/reachability.d.ts +12 -2
  46. package/dist/core/compile/reachability.js +123 -36
  47. package/dist/core/compile/schema-version.d.ts +2 -0
  48. package/dist/core/compile/schema-version.js +25 -0
  49. package/dist/core/compile/sensitivity-witness.d.ts +31 -12
  50. package/dist/core/compile/sensitivity-witness.js +110 -23
  51. package/dist/core/compile/step-reference.d.ts +2 -0
  52. package/dist/core/compile/step-reference.js +49 -0
  53. package/dist/core/coverage/operations.d.ts +62 -0
  54. package/dist/core/coverage/operations.js +57 -0
  55. package/dist/core/coverage/relevance.d.ts +4 -2
  56. package/dist/core/coverage/relevance.js +22 -23
  57. package/dist/core/coverage/satisfaction.d.ts +2 -2
  58. package/dist/core/coverage/satisfaction.js +73 -48
  59. package/dist/core/declared-inputs.d.ts +83 -4
  60. package/dist/core/declared-inputs.js +105 -8
  61. package/dist/core/evaluate/evidence-resolution.d.ts +9 -12
  62. package/dist/core/evaluate/evidence-resolution.js +70 -10
  63. package/dist/core/evaluate/operators.d.ts +22 -0
  64. package/dist/core/evaluate/operators.js +17 -1
  65. package/dist/core/evaluate/resolution.d.ts +14 -3
  66. package/dist/core/evaluate/resolution.js +63 -3
  67. package/dist/core/excluded-content.d.ts +65 -0
  68. package/dist/core/excluded-content.js +113 -0
  69. package/dist/core/failure-codes.d.ts +2 -2
  70. package/dist/core/failure-codes.js +5 -2
  71. package/dist/core/ingest/conditions.d.ts +1 -1
  72. package/dist/core/ingest/ingest.js +8 -0
  73. package/dist/core/preflight/plan.d.ts +7 -5
  74. package/dist/core/preflight/plan.js +75 -32
  75. package/dist/core/preflight/projection.d.ts +6 -3
  76. package/dist/core/preflight/projection.js +22 -2
  77. package/dist/core/preflight/reduce.js +47 -7
  78. package/dist/core/preflight/witness-evidence.d.ts +5 -5
  79. package/dist/core/preflight/witness-evidence.js +63 -20
  80. package/dist/core/schemas/artifact.d.ts +683 -35
  81. package/dist/core/schemas/constraint-ledger.js +11 -0
  82. package/dist/core/schemas/defect-signature.d.ts +438 -16
  83. package/dist/core/schemas/defect-signature.js +58 -10
  84. package/dist/core/schemas/eval-contract.d.ts +517 -12
  85. package/dist/core/schemas/eval-contract.js +18 -2
  86. package/dist/core/schemas/evidence-artifact.d.ts +14 -4
  87. package/dist/core/schemas/evidence-artifact.js +1 -1
  88. package/dist/core/schemas/interface.d.ts +741 -13
  89. package/dist/core/schemas/interface.js +120 -7
  90. package/dist/core/schemas/isolation-manifest.js +16 -9
  91. package/dist/core/schemas/plan.d.ts +217 -3
  92. package/dist/core/schemas/plan.js +22 -1
  93. package/dist/core/schemas/pointer.d.ts +47 -1
  94. package/dist/core/schemas/pointer.js +89 -8
  95. package/dist/core/schemas/port-messages.d.ts +194 -10
  96. package/dist/core/schemas/port-messages.js +73 -6
  97. package/dist/core/schemas/probe-body.d.ts +18 -0
  98. package/dist/core/schemas/probe-body.js +13 -0
  99. package/dist/core/schemas/probe-policy.d.ts +36 -0
  100. package/dist/core/schemas/probe-policy.js +44 -0
  101. package/dist/core/schemas/probe.d.ts +122 -3
  102. package/dist/core/schemas/probe.js +1 -1
  103. package/dist/core/schemas/sealed-run-record.d.ts +131 -9
  104. package/dist/core/schemas/sealed-run-record.js +56 -11
  105. package/dist/core/schemas/sensitivity-witness.d.ts +108 -6
  106. package/dist/core/schemas/sensitivity-witness.js +61 -5
  107. package/dist/core/score/bindings.d.ts +2 -2
  108. package/dist/core/score/bindings.js +25 -13
  109. package/dist/core/score/qualification.d.ts +5 -5
  110. package/dist/core/score/qualification.js +67 -37
  111. package/dist/core/score/quotation.d.ts +1 -24
  112. package/dist/core/score/quotation.js +29 -4
  113. package/dist/core/score/score.js +28 -2
  114. package/dist/core/score/strength.d.ts +9 -0
  115. package/dist/core/score/strength.js +35 -1
  116. package/dist/core/score/witness.d.ts +21 -0
  117. package/dist/core/score/witness.js +9 -4
  118. package/dist/core/seal/derived-reference.d.ts +2 -9
  119. package/dist/core/seal/derived-reference.js +62 -23
  120. package/dist/core/seal/plan-index.d.ts +18 -3
  121. package/dist/core/seal/plan-index.js +44 -8
  122. package/dist/index.d.ts +1 -1
  123. package/dist/index.js +1 -1
  124. package/dist/ports/environment-probe-port.d.ts +60 -4
  125. package/dist/testing/conformance.d.ts +2 -1
  126. package/dist/testing/conformance.js +1 -0
  127. package/dist/testing/index.d.ts +3 -3
  128. package/dist/testing/index.js +1 -1
  129. package/dist/testing/probe-conformance.d.ts +56 -5
  130. package/dist/testing/probe-conformance.js +196 -5
  131. package/package.json +1 -1
  132. package/schemas/eval-contract.schema.json +1356 -464
  133. package/schemas/evidence-artifact.schema.json +59 -29
  134. package/schemas/isolation-manifest.schema.json +17 -10
  135. package/schemas/probe.schema.json +197 -71
  136. package/schemas/rubric.schema.json +1 -1
  137. package/schemas/sealed-run-record.schema.json +296 -39
@@ -152,6 +152,17 @@ export const CONSTRAINT_LEDGER = [
152
152
  reason: "Uniqueness of a nested field across sibling array items has no draft-2020-12 keyword: `uniqueItems` compares whole items structurally and nothing in the dialect can name one property path and require distinctness on it alone. Unlike the lineage biconditional above, this constraint IS enforced by Zod (a `.refine()` on `observations`), because owed item 2 requires it schema-enforced and the AD-13 differential corpus never manufactures two observations sharing a `sequence`: the generated mutant walk is keyword-driven (it perturbs one occurrence at a time) and never clones or duplicates an `observations` array item, since that field carries no `maxItems` for the generator's clone-to-exceed step to fire against. The gap is therefore real but inert against the corpus this repository generates, and is stated in `Observation.sequence`'s own description for a non-Zod consumer to reimplement. This safety argument holds only while `observations` carries no `maxItems`: adding one later starts the clone-to-exceed step firing against this field, and this entry must be re-verified then.",
153
153
  },
154
154
  },
155
+ {
156
+ id: 'evidence-mode-caller-attested',
157
+ location: { kind: 'root', artifact: 'evidence-artifact' },
158
+ branch: null,
159
+ field: 'callerAttestedInputs',
160
+ statement: '`mode` appears in `callerAttestedInputs`. The other five scoring-version inputs may each legitimately be attested or computed, so the list admits any subset of them; `mode` cannot be, since `ScoringVersionInputs.mode` is read from the sealed run record and never re-derived, which makes omitting it a misdeclaration under AD-32 rather than a stricter integration.',
161
+ disposition: {
162
+ kind: 'not-expressible',
163
+ reason: 'A one-member `contains` would express it, and injecting one would fail the same way the observation-sequence entry describes in reverse: the mutant generator manufactures the witness trivially by dropping one array element, so a Zod refinement and an uninjected export would disagree on a corpus member this repository generates. The rule is enforced where the artifact is produced instead: `core/emit` names `mode` in `CALLER_ATTESTED_INPUTS` unconditionally, and the field description states the rule for a caller who authors the artifact by hand. This argument holds only while `emit` is the sole producer in this package.',
164
+ },
165
+ },
155
166
  {
156
167
  id: 'defect-signature-required',
157
168
  location: { kind: 'root', artifact: 'probe' },
@@ -53,10 +53,17 @@ export declare const ProbeBindingChannel: z.ZodNullable<z.ZodRecord<z.ZodString,
53
53
  }>;
54
54
  }, z.core.$strict>]>>>;
55
55
  /**
56
- * The four transport channels, spelled exactly as `InputBinding` and
57
- * `ObservedCallInputs` spell them. The three shapes agree on channel names, on
58
- * the four-key strict form, and on flatness, so the selector filters recorded
59
- * call inputs with no shape to bridge.
56
+ * Every input channel of either kind, spelled exactly as `ObservedCallInputs`
57
+ * spells them. The two shapes agree on channel names, on the eight-key strict
58
+ * form, and on flatness, so the selector filters recorded call inputs with no
59
+ * shape to bridge.
60
+ *
61
+ * One object over both kinds rather than a union, on `ObservedCallInputs`'s own
62
+ * reasoning: `null` already means "binds nothing here", so a selector that
63
+ * binds only command channels writes `null` in the transport four and nothing
64
+ * is ambiguous. `InputBinding` on the contract side is a union instead, because
65
+ * a request-shape channel's "declared, no keys" state is not the same as
66
+ * unused and the two spellings had to stay apart.
60
67
  */
61
68
  export declare const ProbeInputBinding: z.ZodObject<{
62
69
  path: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
@@ -91,6 +98,38 @@ export declare const ProbeInputBinding: z.ZodObject<{
91
98
  "type-violating": "type-violating";
92
99
  }>;
93
100
  }, z.core.$strict>]>>>;
101
+ argument: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
102
+ literal: z.ZodType<import("./primitives.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonValue, unknown>>;
103
+ }, z.core.$strict>, z.ZodObject<{
104
+ matcher: z.ZodEnum<{
105
+ any: "any";
106
+ "type-violating": "type-violating";
107
+ }>;
108
+ }, z.core.$strict>]>>>;
109
+ option: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
110
+ literal: z.ZodType<import("./primitives.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonValue, unknown>>;
111
+ }, z.core.$strict>, z.ZodObject<{
112
+ matcher: z.ZodEnum<{
113
+ any: "any";
114
+ "type-violating": "type-violating";
115
+ }>;
116
+ }, z.core.$strict>]>>>;
117
+ environment: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
118
+ literal: z.ZodType<import("./primitives.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonValue, unknown>>;
119
+ }, z.core.$strict>, z.ZodObject<{
120
+ matcher: z.ZodEnum<{
121
+ any: "any";
122
+ "type-violating": "type-violating";
123
+ }>;
124
+ }, z.core.$strict>]>>>;
125
+ stdin: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
126
+ literal: z.ZodType<import("./primitives.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonValue, unknown>>;
127
+ }, z.core.$strict>, z.ZodObject<{
128
+ matcher: z.ZodEnum<{
129
+ any: "any";
130
+ "type-violating": "type-violating";
131
+ }>;
132
+ }, z.core.$strict>]>>>;
94
133
  }, z.core.$strict>;
95
134
  /**
96
135
  * AD-39's selector grammar, duplicated on the corpus side, minus the two
@@ -137,6 +176,38 @@ export declare const ProbeStepSelector: z.ZodObject<{
137
176
  "type-violating": "type-violating";
138
177
  }>;
139
178
  }, z.core.$strict>]>>>;
179
+ argument: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
180
+ literal: z.ZodType<import("./primitives.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonValue, unknown>>;
181
+ }, z.core.$strict>, z.ZodObject<{
182
+ matcher: z.ZodEnum<{
183
+ any: "any";
184
+ "type-violating": "type-violating";
185
+ }>;
186
+ }, z.core.$strict>]>>>;
187
+ option: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
188
+ literal: z.ZodType<import("./primitives.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonValue, unknown>>;
189
+ }, z.core.$strict>, z.ZodObject<{
190
+ matcher: z.ZodEnum<{
191
+ any: "any";
192
+ "type-violating": "type-violating";
193
+ }>;
194
+ }, z.core.$strict>]>>>;
195
+ environment: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
196
+ literal: z.ZodType<import("./primitives.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonValue, unknown>>;
197
+ }, z.core.$strict>, z.ZodObject<{
198
+ matcher: z.ZodEnum<{
199
+ any: "any";
200
+ "type-violating": "type-violating";
201
+ }>;
202
+ }, z.core.$strict>]>>>;
203
+ stdin: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
204
+ literal: z.ZodType<import("./primitives.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonValue, unknown>>;
205
+ }, z.core.$strict>, z.ZodObject<{
206
+ matcher: z.ZodEnum<{
207
+ any: "any";
208
+ "type-violating": "type-violating";
209
+ }>;
210
+ }, z.core.$strict>]>>>;
140
211
  }, z.core.$strict>;
141
212
  }, z.core.$strict>;
142
213
  /**
@@ -186,27 +257,138 @@ export declare const DiscriminatingCondition: z.ZodObject<{
186
257
  "type-violating": "type-violating";
187
258
  }>;
188
259
  }, z.core.$strict>]>>>;
260
+ argument: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
261
+ literal: z.ZodType<import("./primitives.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonValue, unknown>>;
262
+ }, z.core.$strict>, z.ZodObject<{
263
+ matcher: z.ZodEnum<{
264
+ any: "any";
265
+ "type-violating": "type-violating";
266
+ }>;
267
+ }, z.core.$strict>]>>>;
268
+ option: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
269
+ literal: z.ZodType<import("./primitives.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonValue, unknown>>;
270
+ }, z.core.$strict>, z.ZodObject<{
271
+ matcher: z.ZodEnum<{
272
+ any: "any";
273
+ "type-violating": "type-violating";
274
+ }>;
275
+ }, z.core.$strict>]>>>;
276
+ environment: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
277
+ literal: z.ZodType<import("./primitives.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonValue, unknown>>;
278
+ }, z.core.$strict>, z.ZodObject<{
279
+ matcher: z.ZodEnum<{
280
+ any: "any";
281
+ "type-violating": "type-violating";
282
+ }>;
283
+ }, z.core.$strict>]>>>;
284
+ stdin: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
285
+ literal: z.ZodType<import("./primitives.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonValue, unknown>>;
286
+ }, z.core.$strict>, z.ZodObject<{
287
+ matcher: z.ZodEnum<{
288
+ any: "any";
289
+ "type-violating": "type-violating";
290
+ }>;
291
+ }, z.core.$strict>]>>>;
189
292
  }, z.core.$strict>;
190
293
  }, z.core.$strict>;
191
294
  predicate: z.ZodType<Expression, unknown, z.core.$ZodTypeInternals<Expression, unknown>>;
192
295
  }, z.core.$strict>;
193
296
  /**
194
- * AD-40's four declarations: the interface kind, the defect's home operation as
195
- * a method and a path template, the observable channel it manifests in, and the
196
- * discriminating condition that separates it from correct behaviour.
297
+ * A signature against an interface that speaks HTTP. `web` and `mcp` share the
298
+ * shape and are still rejected by the qualification gate, which is what keeps
299
+ * `signature-interface-kind-unsupported` fireable on the kinds whose probe
300
+ * semantics are undeclared.
197
301
  *
198
- * Method and path template rather than an operation identifier, because AD-19
199
- * declares both per operation and both are contract-independent: an identifier
200
- * is contract-local and would bind nothing against a second contract.
201
- * Resolution erases parameter names before comparing, so a signature on
202
- * `/notes/{id}` binds a contract declaring `/notes/{noteId}`; a post-erasure
203
- * collision inside one contract has already failed compilation under
204
- * `duplicate-operation-signature`.
302
+ * One branch over the three kinds rather than three identical branches. Three
303
+ * would publish three byte-identical subschemas, and AD-13's mutation sweep
304
+ * cannot attribute a keyword deletion to one of several identical branches:
305
+ * deleting `pathTemplate`'s pattern from the second still leaves the first
306
+ * accepting everything the corpus carries, so nothing flips.
205
307
  */
206
- export declare const DefectSignature: z.ZodObject<{
308
+ export declare const ApiDefectSignature: z.ZodObject<{
309
+ observableChannel: z.ZodEnum<{
310
+ artifact: "artifact";
311
+ "call-inputs": "call-inputs";
312
+ "exit-code": "exit-code";
313
+ "response-body": "response-body";
314
+ "response-headers": "response-headers";
315
+ "response-status": "response-status";
316
+ stderr: "stderr";
317
+ stdout: "stdout";
318
+ }>;
319
+ condition: z.ZodObject<{
320
+ selector: z.ZodObject<{
321
+ inputBinding: z.ZodObject<{
322
+ path: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
323
+ literal: z.ZodType<import("./primitives.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonValue, unknown>>;
324
+ }, z.core.$strict>, z.ZodObject<{
325
+ matcher: z.ZodEnum<{
326
+ any: "any";
327
+ "type-violating": "type-violating";
328
+ }>;
329
+ }, z.core.$strict>]>>>;
330
+ query: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
331
+ literal: z.ZodType<import("./primitives.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonValue, unknown>>;
332
+ }, z.core.$strict>, z.ZodObject<{
333
+ matcher: z.ZodEnum<{
334
+ any: "any";
335
+ "type-violating": "type-violating";
336
+ }>;
337
+ }, z.core.$strict>]>>>;
338
+ header: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
339
+ literal: z.ZodType<import("./primitives.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonValue, unknown>>;
340
+ }, z.core.$strict>, z.ZodObject<{
341
+ matcher: z.ZodEnum<{
342
+ any: "any";
343
+ "type-violating": "type-violating";
344
+ }>;
345
+ }, z.core.$strict>]>>>;
346
+ body: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
347
+ literal: z.ZodType<import("./primitives.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonValue, unknown>>;
348
+ }, z.core.$strict>, z.ZodObject<{
349
+ matcher: z.ZodEnum<{
350
+ any: "any";
351
+ "type-violating": "type-violating";
352
+ }>;
353
+ }, z.core.$strict>]>>>;
354
+ argument: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
355
+ literal: z.ZodType<import("./primitives.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonValue, unknown>>;
356
+ }, z.core.$strict>, z.ZodObject<{
357
+ matcher: z.ZodEnum<{
358
+ any: "any";
359
+ "type-violating": "type-violating";
360
+ }>;
361
+ }, z.core.$strict>]>>>;
362
+ option: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
363
+ literal: z.ZodType<import("./primitives.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonValue, unknown>>;
364
+ }, z.core.$strict>, z.ZodObject<{
365
+ matcher: z.ZodEnum<{
366
+ any: "any";
367
+ "type-violating": "type-violating";
368
+ }>;
369
+ }, z.core.$strict>]>>>;
370
+ environment: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
371
+ literal: z.ZodType<import("./primitives.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonValue, unknown>>;
372
+ }, z.core.$strict>, z.ZodObject<{
373
+ matcher: z.ZodEnum<{
374
+ any: "any";
375
+ "type-violating": "type-violating";
376
+ }>;
377
+ }, z.core.$strict>]>>>;
378
+ stdin: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
379
+ literal: z.ZodType<import("./primitives.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonValue, unknown>>;
380
+ }, z.core.$strict>, z.ZodObject<{
381
+ matcher: z.ZodEnum<{
382
+ any: "any";
383
+ "type-violating": "type-violating";
384
+ }>;
385
+ }, z.core.$strict>]>>>;
386
+ }, z.core.$strict>;
387
+ }, z.core.$strict>;
388
+ predicate: z.ZodType<Expression, unknown, z.core.$ZodTypeInternals<Expression, unknown>>;
389
+ }, z.core.$strict>;
207
390
  interfaceKind: z.ZodEnum<{
208
391
  api: "api";
209
- cli: "cli";
210
392
  mcp: "mcp";
211
393
  web: "web";
212
394
  }>;
@@ -220,7 +402,17 @@ export declare const DefectSignature: z.ZodObject<{
220
402
  PUT: "PUT";
221
403
  }>;
222
404
  pathTemplate: z.ZodString;
405
+ }, z.core.$strict>;
406
+ /**
407
+ * A signature against an interface that runs behind a command. It declares the
408
+ * transport identity a command operation declares, for the reason AD-40 gives
409
+ * for method and path template: the identity has to be contract-independent so
410
+ * a signature authored against a corpus binds a second contract's operation.
411
+ * An operation identifier is contract-local and would bind nothing.
412
+ */
413
+ export declare const CommandDefectSignature: z.ZodObject<{
223
414
  observableChannel: z.ZodEnum<{
415
+ artifact: "artifact";
224
416
  "call-inputs": "call-inputs";
225
417
  "exit-code": "exit-code";
226
418
  "response-body": "response-body";
@@ -264,10 +456,240 @@ export declare const DefectSignature: z.ZodObject<{
264
456
  "type-violating": "type-violating";
265
457
  }>;
266
458
  }, z.core.$strict>]>>>;
459
+ argument: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
460
+ literal: z.ZodType<import("./primitives.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonValue, unknown>>;
461
+ }, z.core.$strict>, z.ZodObject<{
462
+ matcher: z.ZodEnum<{
463
+ any: "any";
464
+ "type-violating": "type-violating";
465
+ }>;
466
+ }, z.core.$strict>]>>>;
467
+ option: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
468
+ literal: z.ZodType<import("./primitives.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonValue, unknown>>;
469
+ }, z.core.$strict>, z.ZodObject<{
470
+ matcher: z.ZodEnum<{
471
+ any: "any";
472
+ "type-violating": "type-violating";
473
+ }>;
474
+ }, z.core.$strict>]>>>;
475
+ environment: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
476
+ literal: z.ZodType<import("./primitives.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonValue, unknown>>;
477
+ }, z.core.$strict>, z.ZodObject<{
478
+ matcher: z.ZodEnum<{
479
+ any: "any";
480
+ "type-violating": "type-violating";
481
+ }>;
482
+ }, z.core.$strict>]>>>;
483
+ stdin: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
484
+ literal: z.ZodType<import("./primitives.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonValue, unknown>>;
485
+ }, z.core.$strict>, z.ZodObject<{
486
+ matcher: z.ZodEnum<{
487
+ any: "any";
488
+ "type-violating": "type-violating";
489
+ }>;
490
+ }, z.core.$strict>]>>>;
267
491
  }, z.core.$strict>;
268
492
  }, z.core.$strict>;
269
493
  predicate: z.ZodType<Expression, unknown, z.core.$ZodTypeInternals<Expression, unknown>>;
270
494
  }, z.core.$strict>;
495
+ interfaceKind: z.ZodLiteral<"cli">;
496
+ invocation: z.ZodObject<{
497
+ executable: z.ZodString;
498
+ subcommandPath: z.ZodArray<z.ZodString>;
499
+ }, z.core.$strict>;
271
500
  }, z.core.$strict>;
501
+ /**
502
+ * A plain union rather than a discriminated one: the discriminator would have
503
+ * to be `interfaceKind`, and the api-shaped branch carries three values for it.
504
+ * The two branches are told apart by the identity they declare, exactly as
505
+ * `InputBinding`'s two are told apart by the channels they name.
506
+ */
507
+ export declare const DefectSignature: z.ZodUnion<readonly [z.ZodObject<{
508
+ observableChannel: z.ZodEnum<{
509
+ artifact: "artifact";
510
+ "call-inputs": "call-inputs";
511
+ "exit-code": "exit-code";
512
+ "response-body": "response-body";
513
+ "response-headers": "response-headers";
514
+ "response-status": "response-status";
515
+ stderr: "stderr";
516
+ stdout: "stdout";
517
+ }>;
518
+ condition: z.ZodObject<{
519
+ selector: z.ZodObject<{
520
+ inputBinding: z.ZodObject<{
521
+ path: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
522
+ literal: z.ZodType<import("./primitives.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonValue, unknown>>;
523
+ }, z.core.$strict>, z.ZodObject<{
524
+ matcher: z.ZodEnum<{
525
+ any: "any";
526
+ "type-violating": "type-violating";
527
+ }>;
528
+ }, z.core.$strict>]>>>;
529
+ query: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
530
+ literal: z.ZodType<import("./primitives.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonValue, unknown>>;
531
+ }, z.core.$strict>, z.ZodObject<{
532
+ matcher: z.ZodEnum<{
533
+ any: "any";
534
+ "type-violating": "type-violating";
535
+ }>;
536
+ }, z.core.$strict>]>>>;
537
+ header: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
538
+ literal: z.ZodType<import("./primitives.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonValue, unknown>>;
539
+ }, z.core.$strict>, z.ZodObject<{
540
+ matcher: z.ZodEnum<{
541
+ any: "any";
542
+ "type-violating": "type-violating";
543
+ }>;
544
+ }, z.core.$strict>]>>>;
545
+ body: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
546
+ literal: z.ZodType<import("./primitives.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonValue, unknown>>;
547
+ }, z.core.$strict>, z.ZodObject<{
548
+ matcher: z.ZodEnum<{
549
+ any: "any";
550
+ "type-violating": "type-violating";
551
+ }>;
552
+ }, z.core.$strict>]>>>;
553
+ argument: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
554
+ literal: z.ZodType<import("./primitives.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonValue, unknown>>;
555
+ }, z.core.$strict>, z.ZodObject<{
556
+ matcher: z.ZodEnum<{
557
+ any: "any";
558
+ "type-violating": "type-violating";
559
+ }>;
560
+ }, z.core.$strict>]>>>;
561
+ option: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
562
+ literal: z.ZodType<import("./primitives.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonValue, unknown>>;
563
+ }, z.core.$strict>, z.ZodObject<{
564
+ matcher: z.ZodEnum<{
565
+ any: "any";
566
+ "type-violating": "type-violating";
567
+ }>;
568
+ }, z.core.$strict>]>>>;
569
+ environment: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
570
+ literal: z.ZodType<import("./primitives.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonValue, unknown>>;
571
+ }, z.core.$strict>, z.ZodObject<{
572
+ matcher: z.ZodEnum<{
573
+ any: "any";
574
+ "type-violating": "type-violating";
575
+ }>;
576
+ }, z.core.$strict>]>>>;
577
+ stdin: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
578
+ literal: z.ZodType<import("./primitives.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonValue, unknown>>;
579
+ }, z.core.$strict>, z.ZodObject<{
580
+ matcher: z.ZodEnum<{
581
+ any: "any";
582
+ "type-violating": "type-violating";
583
+ }>;
584
+ }, z.core.$strict>]>>>;
585
+ }, z.core.$strict>;
586
+ }, z.core.$strict>;
587
+ predicate: z.ZodType<Expression, unknown, z.core.$ZodTypeInternals<Expression, unknown>>;
588
+ }, z.core.$strict>;
589
+ interfaceKind: z.ZodEnum<{
590
+ api: "api";
591
+ mcp: "mcp";
592
+ web: "web";
593
+ }>;
594
+ method: z.ZodEnum<{
595
+ DELETE: "DELETE";
596
+ GET: "GET";
597
+ HEAD: "HEAD";
598
+ OPTIONS: "OPTIONS";
599
+ PATCH: "PATCH";
600
+ POST: "POST";
601
+ PUT: "PUT";
602
+ }>;
603
+ pathTemplate: z.ZodString;
604
+ }, z.core.$strict>, z.ZodObject<{
605
+ observableChannel: z.ZodEnum<{
606
+ artifact: "artifact";
607
+ "call-inputs": "call-inputs";
608
+ "exit-code": "exit-code";
609
+ "response-body": "response-body";
610
+ "response-headers": "response-headers";
611
+ "response-status": "response-status";
612
+ stderr: "stderr";
613
+ stdout: "stdout";
614
+ }>;
615
+ condition: z.ZodObject<{
616
+ selector: z.ZodObject<{
617
+ inputBinding: z.ZodObject<{
618
+ path: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
619
+ literal: z.ZodType<import("./primitives.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonValue, unknown>>;
620
+ }, z.core.$strict>, z.ZodObject<{
621
+ matcher: z.ZodEnum<{
622
+ any: "any";
623
+ "type-violating": "type-violating";
624
+ }>;
625
+ }, z.core.$strict>]>>>;
626
+ query: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
627
+ literal: z.ZodType<import("./primitives.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonValue, unknown>>;
628
+ }, z.core.$strict>, z.ZodObject<{
629
+ matcher: z.ZodEnum<{
630
+ any: "any";
631
+ "type-violating": "type-violating";
632
+ }>;
633
+ }, z.core.$strict>]>>>;
634
+ header: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
635
+ literal: z.ZodType<import("./primitives.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonValue, unknown>>;
636
+ }, z.core.$strict>, z.ZodObject<{
637
+ matcher: z.ZodEnum<{
638
+ any: "any";
639
+ "type-violating": "type-violating";
640
+ }>;
641
+ }, z.core.$strict>]>>>;
642
+ body: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
643
+ literal: z.ZodType<import("./primitives.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonValue, unknown>>;
644
+ }, z.core.$strict>, z.ZodObject<{
645
+ matcher: z.ZodEnum<{
646
+ any: "any";
647
+ "type-violating": "type-violating";
648
+ }>;
649
+ }, z.core.$strict>]>>>;
650
+ argument: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
651
+ literal: z.ZodType<import("./primitives.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonValue, unknown>>;
652
+ }, z.core.$strict>, z.ZodObject<{
653
+ matcher: z.ZodEnum<{
654
+ any: "any";
655
+ "type-violating": "type-violating";
656
+ }>;
657
+ }, z.core.$strict>]>>>;
658
+ option: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
659
+ literal: z.ZodType<import("./primitives.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonValue, unknown>>;
660
+ }, z.core.$strict>, z.ZodObject<{
661
+ matcher: z.ZodEnum<{
662
+ any: "any";
663
+ "type-violating": "type-violating";
664
+ }>;
665
+ }, z.core.$strict>]>>>;
666
+ environment: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
667
+ literal: z.ZodType<import("./primitives.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonValue, unknown>>;
668
+ }, z.core.$strict>, z.ZodObject<{
669
+ matcher: z.ZodEnum<{
670
+ any: "any";
671
+ "type-violating": "type-violating";
672
+ }>;
673
+ }, z.core.$strict>]>>>;
674
+ stdin: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
675
+ literal: z.ZodType<import("./primitives.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonValue, unknown>>;
676
+ }, z.core.$strict>, z.ZodObject<{
677
+ matcher: z.ZodEnum<{
678
+ any: "any";
679
+ "type-violating": "type-violating";
680
+ }>;
681
+ }, z.core.$strict>]>>>;
682
+ }, z.core.$strict>;
683
+ }, z.core.$strict>;
684
+ predicate: z.ZodType<Expression, unknown, z.core.$ZodTypeInternals<Expression, unknown>>;
685
+ }, z.core.$strict>;
686
+ interfaceKind: z.ZodLiteral<"cli">;
687
+ invocation: z.ZodObject<{
688
+ executable: z.ZodString;
689
+ subcommandPath: z.ZodArray<z.ZodString>;
690
+ }, z.core.$strict>;
691
+ }, z.core.$strict>]>;
692
+ export type ApiDefectSignature = z.infer<typeof ApiDefectSignature>;
693
+ export type CommandDefectSignature = z.infer<typeof CommandDefectSignature>;
272
694
  export type DefectSignature = z.infer<typeof DefectSignature>;
273
695
  export type ProbeInputBinding = z.infer<typeof ProbeInputBinding>;
@@ -1,7 +1,7 @@
1
1
  /** AD-40's machine-readable defect signature and its probe-side selector. */
2
2
  import { z } from 'zod';
3
3
  import { Expression } from './expression.js';
4
- import { HttpMethod, InterfaceKind, PathTemplate } from './interface.js';
4
+ import { CommandInvocation, HttpMethod, PathTemplate } from './interface.js';
5
5
  import { LiteralBindingValue, MatcherBindingValue } from './plan.js';
6
6
  import { EvidenceChannel } from './pointer.js';
7
7
  import { KeyName } from './primitives.js';
@@ -61,19 +61,30 @@ export const ProbeBindingChannel = z
61
61
  .nullable()
62
62
  .meta({
63
63
  id: 'ProbeInputBindingChannel',
64
- description: "A parameter-name-to-binding-value map for one transport channel of a defect signature's selector, or `null` for a channel the selector binds nothing in. An empty map is rejected: `null` is the only spelling for unbound. Admits `{ literal }` and `{ matcher }` only; `{ captured }` and `{ principal }` are contract-local vocabulary and a corpus signature cannot carry either.",
64
+ description: "A parameter-name-to-binding-value map for one input channel of a defect signature's selector, or `null` for a channel the selector binds nothing in. An empty map is rejected: `null` is the only spelling for unbound. Admits `{ literal }` and `{ matcher }` only; `{ captured }` and `{ principal }` are contract-local vocabulary and a corpus signature cannot carry either.",
65
65
  });
66
66
  /**
67
- * The four transport channels, spelled exactly as `InputBinding` and
68
- * `ObservedCallInputs` spell them. The three shapes agree on channel names, on
69
- * the four-key strict form, and on flatness, so the selector filters recorded
70
- * call inputs with no shape to bridge.
67
+ * Every input channel of either kind, spelled exactly as `ObservedCallInputs`
68
+ * spells them. The two shapes agree on channel names, on the eight-key strict
69
+ * form, and on flatness, so the selector filters recorded call inputs with no
70
+ * shape to bridge.
71
+ *
72
+ * One object over both kinds rather than a union, on `ObservedCallInputs`'s own
73
+ * reasoning: `null` already means "binds nothing here", so a selector that
74
+ * binds only command channels writes `null` in the transport four and nothing
75
+ * is ambiguous. `InputBinding` on the contract side is a union instead, because
76
+ * a request-shape channel's "declared, no keys" state is not the same as
77
+ * unused and the two spellings had to stay apart.
71
78
  */
72
79
  export const ProbeInputBinding = z.strictObject({
73
80
  path: ProbeBindingChannel,
74
81
  query: ProbeBindingChannel,
75
82
  header: ProbeBindingChannel,
76
83
  body: ProbeBindingChannel,
84
+ argument: ProbeBindingChannel,
85
+ option: ProbeBindingChannel,
86
+ environment: ProbeBindingChannel,
87
+ stdin: ProbeBindingChannel,
77
88
  });
78
89
  /**
79
90
  * AD-39's selector grammar, duplicated on the corpus side, minus the two
@@ -118,10 +129,47 @@ export const DiscriminatingCondition = z.strictObject({
118
129
  * collision inside one contract has already failed compilation under
119
130
  * `duplicate-operation-signature`.
120
131
  */
121
- export const DefectSignature = z.strictObject({
122
- interfaceKind: InterfaceKind.describe('The interface the seeded defect lives behind. All four kinds parse so `unsupported-interface-kind` stays fireable contract-side, and the qualification gate rejects every kind but `api`: `Operation` carries no interface kind and requires a method and a path template with no per-kind variation, so a `cli` or `mcp` signature would declare a meaningless `POST /path`.'),
132
+ const signatureCommon = {
133
+ observableChannel: EvidenceChannel.describe('AD-26\'s channel the seeded defect manifests in. The qualification gate reads it: a condition passes only if its pointers name this channel, or name two channels with at least one response-side member. That rule exists to reject a condition collapsing to "the evidence contains the string I sent", which is satisfied by a finding that merely echoes its own input. It must also be a channel the declared kind produces: an api interface writes nothing to standard output and a command returns no HTTP status.'),
134
+ condition: DiscriminatingCondition,
135
+ };
136
+ /**
137
+ * A signature against an interface that speaks HTTP. `web` and `mcp` share the
138
+ * shape and are still rejected by the qualification gate, which is what keeps
139
+ * `signature-interface-kind-unsupported` fireable on the kinds whose probe
140
+ * semantics are undeclared.
141
+ *
142
+ * One branch over the three kinds rather than three identical branches. Three
143
+ * would publish three byte-identical subschemas, and AD-13's mutation sweep
144
+ * cannot attribute a keyword deletion to one of several identical branches:
145
+ * deleting `pathTemplate`'s pattern from the second still leaves the first
146
+ * accepting everything the corpus carries, so nothing flips.
147
+ */
148
+ export const ApiDefectSignature = z.strictObject({
149
+ interfaceKind: z.enum(['api', 'web', 'mcp']),
123
150
  method: HttpMethod,
124
151
  pathTemplate: PathTemplate,
125
- observableChannel: EvidenceChannel.describe('AD-26\'s channel the seeded defect manifests in. The qualification gate reads it: a condition passes only if its pointers name this channel, or name two channels with at least one response-side member. That rule exists to reject a condition collapsing to "the evidence contains the string I sent", which is satisfied by a finding that merely echoes its own input.'),
126
- condition: DiscriminatingCondition,
152
+ ...signatureCommon,
127
153
  });
154
+ /**
155
+ * A signature against an interface that runs behind a command. It declares the
156
+ * transport identity a command operation declares, for the reason AD-40 gives
157
+ * for method and path template: the identity has to be contract-independent so
158
+ * a signature authored against a corpus binds a second contract's operation.
159
+ * An operation identifier is contract-local and would bind nothing.
160
+ */
161
+ export const CommandDefectSignature = z.strictObject({
162
+ interfaceKind: z.literal('cli'),
163
+ invocation: CommandInvocation,
164
+ ...signatureCommon,
165
+ });
166
+ /**
167
+ * A plain union rather than a discriminated one: the discriminator would have
168
+ * to be `interfaceKind`, and the api-shaped branch carries three values for it.
169
+ * The two branches are told apart by the identity they declare, exactly as
170
+ * `InputBinding`'s two are told apart by the channels they name.
171
+ */
172
+ export const DefectSignature = z.union([
173
+ ApiDefectSignature,
174
+ CommandDefectSignature,
175
+ ]);