eval-quality 1.4.2 → 2.0.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 (106) hide show
  1. package/README.md +5 -5
  2. package/corpus/dev/README.md +24 -13
  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/captured-read-back.json +1 -0
  9. package/corpus/dev/contracts/checklist-selection.json +1 -0
  10. package/corpus/dev/contracts/empty-channel-roles.json +1 -1
  11. package/corpus/dev/contracts/empty-collection-locations.json +1 -1
  12. package/corpus/dev/contracts/empty-request-shapes.json +1 -1
  13. package/corpus/dev/contracts/empty-sibling-groups.json +1 -1
  14. package/corpus/dev/contracts/fragment-selection.json +1 -1
  15. package/corpus/dev/contracts/no-collection-quantifier.json +1 -1
  16. package/corpus/dev/contracts/no-operation-inventory.json +1 -1
  17. package/corpus/dev/contracts/no-read-back-relation.json +1 -1
  18. package/corpus/dev/contracts/no-state-change-marker.json +1 -1
  19. package/corpus/dev/contracts/no-type-violating-step.json +1 -1
  20. package/corpus/dev/contracts/notes-tool-server.json +1 -0
  21. package/corpus/dev/contracts/per-key-split-oracles.json +1 -1
  22. package/corpus/dev/contracts/review-corpus.json +1 -1
  23. package/corpus/dev/contracts/satisfied-declarations.json +1 -1
  24. package/corpus/dev/contracts/single-required-response-key.json +1 -1
  25. package/corpus/dev/contracts/split-indicator-oracle.json +1 -1
  26. package/corpus/dev/contracts/unaddressed-parameter-sibling.json +1 -1
  27. package/corpus/dev/contracts/unnamed-reference-set.json +1 -1
  28. package/corpus/dev/contracts/wrong-cardinality-form.json +1 -1
  29. package/corpus/dev/index.json +1 -1
  30. package/dist/adapters/command-line-adapter.js +44 -6
  31. package/dist/adapters/index.d.ts +2 -0
  32. package/dist/adapters/index.js +1 -0
  33. package/dist/adapters/mcp-adapter.d.ts +32 -0
  34. package/dist/adapters/mcp-adapter.js +357 -0
  35. package/dist/adapters/mcp-target-policy.d.ts +39 -0
  36. package/dist/adapters/mcp-target-policy.js +30 -0
  37. package/dist/cli/render.d.ts +8 -3
  38. package/dist/cli/render.js +13 -6
  39. package/dist/cli/run.js +2 -1
  40. package/dist/core/compile/bindings.d.ts +8 -18
  41. package/dist/core/compile/bindings.js +13 -10
  42. package/dist/core/compile/interface-inventory.d.ts +81 -3
  43. package/dist/core/compile/interface-inventory.js +134 -23
  44. package/dist/core/compile/reachability.d.ts +73 -1
  45. package/dist/core/compile/reachability.js +134 -19
  46. package/dist/core/compile/sensitivity-witness.d.ts +22 -10
  47. package/dist/core/compile/sensitivity-witness.js +101 -13
  48. package/dist/core/coverage/operations.d.ts +1 -1
  49. package/dist/core/coverage/operations.js +1 -1
  50. package/dist/core/coverage/relevance.d.ts +3 -3
  51. package/dist/core/coverage/relevance.js +3 -3
  52. package/dist/core/declared-inputs.d.ts +21 -9
  53. package/dist/core/declared-inputs.js +51 -16
  54. package/dist/core/evaluate/evidence-resolution.d.ts +8 -7
  55. package/dist/core/evaluate/evidence-resolution.js +25 -18
  56. package/dist/core/preflight/plan.js +28 -6
  57. package/dist/core/preflight/projection.d.ts +10 -1
  58. package/dist/core/preflight/projection.js +9 -5
  59. package/dist/core/preflight/reduce.js +6 -2
  60. package/dist/core/preflight/witness-evidence.js +31 -9
  61. package/dist/core/schemas/artifact.d.ts +145 -49
  62. package/dist/core/schemas/defect-signature.d.ts +280 -23
  63. package/dist/core/schemas/defect-signature.js +65 -37
  64. package/dist/core/schemas/eval-contract.d.ts +33 -48
  65. package/dist/core/schemas/eval-contract.js +3 -3
  66. package/dist/core/schemas/interface.d.ts +193 -55
  67. package/dist/core/schemas/interface.js +82 -15
  68. package/dist/core/schemas/plan.d.ts +45 -1
  69. package/dist/core/schemas/plan.js +13 -2
  70. package/dist/core/schemas/pointer.d.ts +23 -9
  71. package/dist/core/schemas/pointer.js +25 -11
  72. package/dist/core/schemas/port-messages.d.ts +81 -0
  73. package/dist/core/schemas/port-messages.js +50 -3
  74. package/dist/core/schemas/primitives.d.ts +18 -0
  75. package/dist/core/schemas/primitives.js +29 -0
  76. package/dist/core/schemas/probe-policy.d.ts +41 -0
  77. package/dist/core/schemas/probe-policy.js +61 -1
  78. package/dist/core/schemas/probe.d.ts +115 -2
  79. package/dist/core/schemas/probe.js +2 -2
  80. package/dist/core/schemas/sealed-run-record.d.ts +11 -5
  81. package/dist/core/schemas/sealed-run-record.js +21 -9
  82. package/dist/core/schemas/sensitivity-witness.d.ts +31 -7
  83. package/dist/core/schemas/sensitivity-witness.js +32 -9
  84. package/dist/core/score/bindings.d.ts +1 -1
  85. package/dist/core/score/bindings.js +4 -4
  86. package/dist/core/score/qualification.d.ts +7 -5
  87. package/dist/core/score/qualification.js +92 -23
  88. package/dist/core/score/score.js +1 -1
  89. package/dist/core/seal/derived-reference.js +20 -17
  90. package/dist/core/seal/plan-index.d.ts +18 -9
  91. package/dist/core/seal/plan-index.js +79 -37
  92. package/dist/index.d.ts +1 -1
  93. package/dist/index.js +1 -1
  94. package/dist/ports/environment-probe-port.d.ts +50 -17
  95. package/dist/ports/environment-probe-port.js +26 -17
  96. package/dist/testing/conformance.d.ts +3 -2
  97. package/dist/testing/conformance.js +2 -1
  98. package/dist/testing/index.d.ts +3 -3
  99. package/dist/testing/index.js +1 -1
  100. package/dist/testing/probe-conformance.d.ts +90 -13
  101. package/dist/testing/probe-conformance.js +375 -160
  102. package/package.json +4 -2
  103. package/schemas/eval-contract.schema.json +571 -18
  104. package/schemas/probe.schema.json +152 -12
  105. package/schemas/rubric.schema.json +1 -1
  106. package/schemas/sealed-run-record.schema.json +24 -17
@@ -114,7 +114,7 @@ export declare const Budgets: z.ZodObject<{
114
114
  * `compile` is the reader that performs it. The constant lives here beside the
115
115
  * schema whose version it names, so the bump and the constant are one edit.
116
116
  */
117
- export declare const EVAL_CONTRACT_SCHEMA_VERSION = 4;
117
+ export declare const EVAL_CONTRACT_SCHEMA_VERSION = 5;
118
118
  export declare const EvalContract: z.ZodObject<{
119
119
  schemaVersion: z.ZodInt;
120
120
  parentDigest: z.ZodNullable<z.ZodString>;
@@ -305,6 +305,7 @@ export declare const EvalContract: z.ZodObject<{
305
305
  witnessId: z.ZodString;
306
306
  channel: z.ZodEnum<{
307
307
  argument: "argument";
308
+ arguments: "arguments";
308
309
  body: "body";
309
310
  environment: "environment";
310
311
  option: "option";
@@ -337,6 +338,8 @@ export declare const EvalContract: z.ZodObject<{
337
338
  }, z.core.$strict>, z.ZodObject<{
338
339
  kind: z.ZodLiteral<"absent">;
339
340
  }, z.core.$strict>], "kind">;
341
+ }, z.core.$strict>, z.ZodObject<{
342
+ arguments: z.ZodType<import("./primitives.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonObject, unknown>>;
340
343
  }, z.core.$strict>]>;
341
344
  }, z.core.$strict>>;
342
345
  relation: z.ZodType<import("./expression.ts").Expression, unknown, z.core.$ZodTypeInternals<import("./expression.ts").Expression, unknown>>;
@@ -446,6 +449,7 @@ export declare const EvalContract: z.ZodObject<{
446
449
  witnessId: z.ZodString;
447
450
  channel: z.ZodEnum<{
448
451
  argument: "argument";
452
+ arguments: "arguments";
449
453
  body: "body";
450
454
  environment: "environment";
451
455
  option: "option";
@@ -478,6 +482,8 @@ export declare const EvalContract: z.ZodObject<{
478
482
  }, z.core.$strict>, z.ZodObject<{
479
483
  kind: z.ZodLiteral<"absent">;
480
484
  }, z.core.$strict>], "kind">;
485
+ }, z.core.$strict>, z.ZodObject<{
486
+ arguments: z.ZodType<import("./primitives.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonObject, unknown>>;
481
487
  }, z.core.$strict>]>;
482
488
  }, z.core.$strict>>;
483
489
  relation: z.ZodType<import("./expression.ts").Expression, unknown, z.core.$ZodTypeInternals<import("./expression.ts").Expression, unknown>>;
@@ -488,55 +494,10 @@ export declare const EvalContract: z.ZodObject<{
488
494
  kind: z.ZodLiteral<"mcp">;
489
495
  operations: z.ZodArray<z.ZodObject<{
490
496
  operationId: z.ZodString;
491
- method: z.ZodEnum<{
492
- DELETE: "DELETE";
493
- GET: "GET";
494
- HEAD: "HEAD";
495
- OPTIONS: "OPTIONS";
496
- PATCH: "PATCH";
497
- POST: "POST";
498
- PUT: "PUT";
499
- }>;
500
- pathTemplate: z.ZodString;
497
+ toolName: z.ZodString;
501
498
  stateChangeMarker: z.ZodBoolean;
502
499
  requestShape: z.ZodObject<{
503
- path: z.ZodObject<{
504
- requiredKeys: z.ZodArray<z.ZodString>;
505
- permittedKeys: z.ZodArray<z.ZodString>;
506
- types: z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodEnum<{
507
- array: "array";
508
- boolean: "boolean";
509
- null: "null";
510
- number: "number";
511
- object: "object";
512
- string: "string";
513
- }>>>;
514
- }, z.core.$strict>;
515
- query: z.ZodObject<{
516
- requiredKeys: z.ZodArray<z.ZodString>;
517
- permittedKeys: z.ZodArray<z.ZodString>;
518
- types: z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodEnum<{
519
- array: "array";
520
- boolean: "boolean";
521
- null: "null";
522
- number: "number";
523
- object: "object";
524
- string: "string";
525
- }>>>;
526
- }, z.core.$strict>;
527
- header: z.ZodObject<{
528
- requiredKeys: z.ZodArray<z.ZodString>;
529
- permittedKeys: z.ZodArray<z.ZodString>;
530
- types: z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodEnum<{
531
- array: "array";
532
- boolean: "boolean";
533
- null: "null";
534
- number: "number";
535
- object: "object";
536
- string: "string";
537
- }>>>;
538
- }, z.core.$strict>;
539
- body: z.ZodObject<{
500
+ arguments: z.ZodObject<{
540
501
  requiredKeys: z.ZodArray<z.ZodString>;
541
502
  permittedKeys: z.ZodArray<z.ZodString>;
542
503
  types: z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodEnum<{
@@ -549,6 +510,9 @@ export declare const EvalContract: z.ZodObject<{
549
510
  }>>>;
550
511
  }, z.core.$strict>;
551
512
  }, z.core.$strict>;
513
+ descriptorChannel: z.ZodDiscriminatedUnion<[z.ZodObject<{
514
+ kind: z.ZodLiteral<"structured-result">;
515
+ }, z.core.$strict>], "kind">;
552
516
  responseDescriptor: z.ZodObject<{
553
517
  requiredKeys: z.ZodArray<z.ZodString>;
554
518
  permittedKeys: z.ZodArray<z.ZodString>;
@@ -587,6 +551,7 @@ export declare const EvalContract: z.ZodObject<{
587
551
  witnessId: z.ZodString;
588
552
  channel: z.ZodEnum<{
589
553
  argument: "argument";
554
+ arguments: "arguments";
590
555
  body: "body";
591
556
  environment: "environment";
592
557
  option: "option";
@@ -619,6 +584,8 @@ export declare const EvalContract: z.ZodObject<{
619
584
  }, z.core.$strict>, z.ZodObject<{
620
585
  kind: z.ZodLiteral<"absent">;
621
586
  }, z.core.$strict>], "kind">;
587
+ }, z.core.$strict>, z.ZodObject<{
588
+ arguments: z.ZodType<import("./primitives.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonObject, unknown>>;
622
589
  }, z.core.$strict>]>;
623
590
  }, z.core.$strict>>;
624
591
  relation: z.ZodType<import("./expression.ts").Expression, unknown, z.core.$ZodTypeInternals<import("./expression.ts").Expression, unknown>>;
@@ -733,6 +700,7 @@ export declare const EvalContract: z.ZodObject<{
733
700
  witnessId: z.ZodString;
734
701
  channel: z.ZodEnum<{
735
702
  argument: "argument";
703
+ arguments: "arguments";
736
704
  body: "body";
737
705
  environment: "environment";
738
706
  option: "option";
@@ -765,6 +733,8 @@ export declare const EvalContract: z.ZodObject<{
765
733
  }, z.core.$strict>, z.ZodObject<{
766
734
  kind: z.ZodLiteral<"absent">;
767
735
  }, z.core.$strict>], "kind">;
736
+ }, z.core.$strict>, z.ZodObject<{
737
+ arguments: z.ZodType<import("./primitives.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonObject, unknown>>;
768
738
  }, z.core.$strict>]>;
769
739
  }, z.core.$strict>>;
770
740
  relation: z.ZodType<import("./expression.ts").Expression, unknown, z.core.$ZodTypeInternals<import("./expression.ts").Expression, unknown>>;
@@ -881,6 +851,19 @@ export declare const EvalContract: z.ZodObject<{
881
851
  }, z.core.$strict>, z.ZodObject<{
882
852
  principal: z.ZodString;
883
853
  }, z.core.$strict>]>>>;
854
+ }, z.core.$strict>, z.ZodObject<{
855
+ arguments: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
856
+ literal: z.ZodType<import("./primitives.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonValue, unknown>>;
857
+ }, z.core.$strict>, z.ZodObject<{
858
+ matcher: z.ZodEnum<{
859
+ any: "any";
860
+ "type-violating": "type-violating";
861
+ }>;
862
+ }, z.core.$strict>, z.ZodObject<{
863
+ captured: z.ZodString;
864
+ }, z.core.$strict>, z.ZodObject<{
865
+ principal: z.ZodString;
866
+ }, z.core.$strict>]>>>;
884
867
  }, z.core.$strict>]>;
885
868
  after: z.ZodNullable<z.ZodString>;
886
869
  cardinality: z.ZodEnum<{
@@ -947,6 +930,8 @@ export declare const EvalContract: z.ZodObject<{
947
930
  }, z.core.$strict>, z.ZodObject<{
948
931
  kind: z.ZodLiteral<"absent">;
949
932
  }, z.core.$strict>], "kind">;
933
+ }, z.core.$strict>, z.ZodObject<{
934
+ arguments: z.ZodType<import("./primitives.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonObject, unknown>>;
950
935
  }, z.core.$strict>]>;
951
936
  }, z.core.$strict>>;
952
937
  }, z.core.$strict>;
@@ -120,7 +120,7 @@ export const Budgets = z.strictObject({
120
120
  * `compile` is the reader that performs it. The constant lives here beside the
121
121
  * schema whose version it names, so the bump and the constant are one edit.
122
122
  */
123
- export const EVAL_CONTRACT_SCHEMA_VERSION = 4;
123
+ export const EVAL_CONTRACT_SCHEMA_VERSION = 5;
124
124
  export const EvalContract = z
125
125
  .strictObject({
126
126
  // AD-11's schemaVersion and AD-29's lineage pair, spread from the leaf
@@ -144,7 +144,7 @@ export const EvalContract = z
144
144
  waivers: z.array(Waiver),
145
145
  permittedInterfaces: z
146
146
  .array(PermittedInterface)
147
- .describe("AD-35: logical identifiers only. No entry here is ever a URL, a host, or a port. Discriminated on `kind`, which makes this field the eval contract's `schemaVersion` 3 -> 4 BREAKING bump under AD-11, whose rule is that \"adding an optional field is a `schemaVersion` bump recorded in the field's own description; removing or retyping is breaking\". The `api`, `web`, and `mcp` branches carry the shipped operation shape unchanged, so a version-3 contract's own bytes still parse on them; the `cli` branch carries a command operation, which declares a logical invocation instead of a method and a path template, four command input channels instead of the four transport channels, a nominated output channel for its one response descriptor, and the files it writes."),
147
+ .describe('AD-35: logical identifiers only. No entry here is ever a URL, a host, or a port. Discriminated on `kind`, and the field AD-11 puts this artifact\'s bump record on, whose rule is that "adding an optional field is a `schemaVersion` bump recorded in the field\'s own description; removing or retyping is breaking". Version 4 added the `cli` branch, carrying a command operation: a logical invocation in place of a method and a path template, four command input channels, a nominated output channel for its one response descriptor, and the files it writes. Version 5 is the `schemaVersion` 4 -> 5 BREAKING bump: the `mcp` branch stops carrying the HTTP operation shape and carries a tool call instead, declaring a published tool name as its whole transport identity, one `arguments` request channel, and a tagged descriptor channel over the structured result. An `mcp` interface written against version 4 no longer parses. `api`, `web`, and `cli` keep every byte they had.'),
148
148
  referenceSets: z
149
149
  .record(Identifier, ReferenceSetDeclaration)
150
150
  .nullable()
@@ -173,5 +173,5 @@ export const EvalContract = z
173
173
  })
174
174
  .meta({
175
175
  id: 'EvalContract',
176
- description: "The Eval Contract. Succeeds the prior-art `eval-contract` schema per AD-24. It carries every declaration AD-19 requires so that AD-31's fourteen relevance and satisfaction predicates are decidable from declarations alone. AD-10's sensitivity witnesses arrived on each operation as an additive `schemaVersion` bump; version 4 opens `permittedInterfaces` to a second interface kind, so a contract may describe a system under test that runs behind a command, and widens the interaction pointer's accepted language with the four command input channels and the `artifact` channel. The widening retypes nothing on its own, since every pointer legal under version 3 is still legal; it carries the same version because it ships in the same release as the retypes. Each bump is recorded in its own field's description, and `compile` compares the stamp against `EVAL_CONTRACT_SCHEMA_VERSION` and throws AD-28's `schema-version-mismatch` on anything else.",
176
+ description: "The Eval Contract. Succeeds the prior-art `eval-contract` schema per AD-24. It carries every declaration AD-19 requires so that AD-31's fourteen relevance and satisfaction predicates are decidable from declarations alone. AD-10's sensitivity witnesses arrived on each operation as an additive `schemaVersion` bump; version 4 opens `permittedInterfaces` to a second interface kind, so a contract may describe a system under test that runs behind a command, and widens the interaction pointer's accepted language with the four command input channels and the `artifact` channel. The widening retypes nothing on its own, since every pointer legal under version 3 is still legal; it carries the same version because it ships in the same release as the retypes. Version 5 gives the `mcp` kind its own operation shape, so a contract may describe a tool server, and widens the pointer language and a step's input binding with the `arguments` channel. Each bump is recorded in its own field's description, and `compile` compares the stamp against `EVAL_CONTRACT_SCHEMA_VERSION` and throws AD-28's `schema-version-mismatch` on anything else.",
177
177
  });
@@ -250,6 +250,7 @@ export declare const Operation: z.ZodObject<{
250
250
  witnessId: z.ZodString;
251
251
  channel: z.ZodEnum<{
252
252
  argument: "argument";
253
+ arguments: "arguments";
253
254
  body: "body";
254
255
  environment: "environment";
255
256
  option: "option";
@@ -282,6 +283,8 @@ export declare const Operation: z.ZodObject<{
282
283
  }, z.core.$strict>, z.ZodObject<{
283
284
  kind: z.ZodLiteral<"absent">;
284
285
  }, z.core.$strict>], "kind">;
286
+ }, z.core.$strict>, z.ZodObject<{
287
+ arguments: z.ZodType<import("./primitives.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonObject, unknown>>;
285
288
  }, z.core.$strict>]>;
286
289
  }, z.core.$strict>>;
287
290
  relation: z.ZodType<import("./expression.ts").Expression, unknown, z.core.$ZodTypeInternals<import("./expression.ts").Expression, unknown>>;
@@ -505,6 +508,7 @@ export declare const CommandOperation: z.ZodObject<{
505
508
  witnessId: z.ZodString;
506
509
  channel: z.ZodEnum<{
507
510
  argument: "argument";
511
+ arguments: "arguments";
508
512
  body: "body";
509
513
  environment: "environment";
510
514
  option: "option";
@@ -537,14 +541,170 @@ export declare const CommandOperation: z.ZodObject<{
537
541
  }, z.core.$strict>, z.ZodObject<{
538
542
  kind: z.ZodLiteral<"absent">;
539
543
  }, z.core.$strict>], "kind">;
544
+ }, z.core.$strict>, z.ZodObject<{
545
+ arguments: z.ZodType<import("./primitives.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonObject, unknown>>;
540
546
  }, z.core.$strict>]>;
541
547
  }, z.core.$strict>>;
542
548
  relation: z.ZodType<import("./expression.ts").Expression, unknown, z.core.$ZodTypeInternals<import("./expression.ts").Expression, unknown>>;
543
549
  }, z.core.$strict>>;
544
550
  }, z.core.$strict>;
545
551
  export type CommandOperation = z.infer<typeof CommandOperation>;
546
- /** Either operation shape, for the consumers that read only kind-neutral fields. */
547
- export type AnyOperation = Operation | CommandOperation;
552
+ /**
553
+ * The tool-call counterpart of `RequestShape`, a one-key strict object for the
554
+ * reason that comment gives: a record over a channel enum demands every member
555
+ * at parse time, and the partial spelling that would relax it is the one the
556
+ * Consistency Conventions ban.
557
+ *
558
+ * One key rather than four. A tool call carries an arguments object and nothing
559
+ * else, so declaring `path`, `query`, and `header` beside it would put three
560
+ * channels on every contract that no call can ever send and no oracle can ever
561
+ * reach.
562
+ */
563
+ export declare const McpRequestShape: z.ZodObject<{
564
+ arguments: z.ZodObject<{
565
+ requiredKeys: z.ZodArray<z.ZodString>;
566
+ permittedKeys: z.ZodArray<z.ZodString>;
567
+ types: z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodEnum<{
568
+ array: "array";
569
+ boolean: "boolean";
570
+ null: "null";
571
+ number: "number";
572
+ object: "object";
573
+ string: "string";
574
+ }>>>;
575
+ }, z.core.$strict>;
576
+ }, z.core.$strict>;
577
+ export type McpRequestShape = z.infer<typeof McpRequestShape>;
578
+ /**
579
+ * Which output channel the operation's one response descriptor describes.
580
+ *
581
+ * Tagged on `kind` with one member, following `CommandDescriptorChannel`. The
582
+ * second member is already known: a tool that returns prose rather than
583
+ * structured content is outside this version, and admitting it later adds a
584
+ * member, which AD-11 makes additive, where retyping a bare field would be
585
+ * breaking.
586
+ */
587
+ export declare const McpDescriptorChannel: z.ZodDiscriminatedUnion<[z.ZodObject<{
588
+ kind: z.ZodLiteral<"structured-result">;
589
+ }, z.core.$strict>], "kind">;
590
+ export type McpDescriptorChannel = z.infer<typeof McpDescriptorChannel>;
591
+ /**
592
+ * A tool-call operation.
593
+ *
594
+ * `toolName` is the whole transport identity. Every MCP call shares the one
595
+ * transport identity `tools/call` and the tool name is what distinguishes two
596
+ * of them, so a method and a path template would render one signature for every
597
+ * tool a server publishes and collide under `duplicate-operation-signature`.
598
+ * AD-40 needs that identity readable by a probe seeder who has never opened the
599
+ * contract, and a published tool name is exactly that.
600
+ *
601
+ * It carries the same `ResponseDescriptor` an api operation carries, over the
602
+ * structured result its `descriptorChannel` nominates, so all fourteen AD-31
603
+ * predicates read one descriptor one dereference deep with no kind-specific
604
+ * arm.
605
+ */
606
+ export declare const McpOperation: z.ZodObject<{
607
+ operationId: z.ZodString;
608
+ toolName: z.ZodString;
609
+ stateChangeMarker: z.ZodBoolean;
610
+ requestShape: z.ZodObject<{
611
+ arguments: z.ZodObject<{
612
+ requiredKeys: z.ZodArray<z.ZodString>;
613
+ permittedKeys: z.ZodArray<z.ZodString>;
614
+ types: z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodEnum<{
615
+ array: "array";
616
+ boolean: "boolean";
617
+ null: "null";
618
+ number: "number";
619
+ object: "object";
620
+ string: "string";
621
+ }>>>;
622
+ }, z.core.$strict>;
623
+ }, z.core.$strict>;
624
+ descriptorChannel: z.ZodDiscriminatedUnion<[z.ZodObject<{
625
+ kind: z.ZodLiteral<"structured-result">;
626
+ }, z.core.$strict>], "kind">;
627
+ responseDescriptor: z.ZodObject<{
628
+ requiredKeys: z.ZodArray<z.ZodString>;
629
+ permittedKeys: z.ZodArray<z.ZodString>;
630
+ types: z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodEnum<{
631
+ array: "array";
632
+ boolean: "boolean";
633
+ null: "null";
634
+ number: "number";
635
+ object: "object";
636
+ string: "string";
637
+ }>>>;
638
+ successIndicator: z.ZodNullable<z.ZodString>;
639
+ channelRoles: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodEnum<{
640
+ collection: "collection";
641
+ diagnostic: "diagnostic";
642
+ payload: "payload";
643
+ "success-indicator": "success-indicator";
644
+ }>>>;
645
+ collectionLocations: z.ZodNullable<z.ZodArray<z.ZodObject<{
646
+ pointer: z.ZodString;
647
+ expectedCardinality: z.ZodDiscriminatedUnion<[z.ZodObject<{
648
+ mode: z.ZodLiteral<"exact">;
649
+ count: z.ZodInt;
650
+ }, z.core.$strict>, z.ZodObject<{
651
+ mode: z.ZodLiteral<"at-most">;
652
+ max: z.ZodInt;
653
+ }, z.core.$strict>, z.ZodObject<{
654
+ mode: z.ZodLiteral<"page-bounded">;
655
+ max: z.ZodInt;
656
+ }, z.core.$strict>], "mode">;
657
+ referenceSet: z.ZodNullable<z.ZodString>;
658
+ }, z.core.$strict>>>;
659
+ }, z.core.$strict>;
660
+ volatilePointers: z.ZodArray<z.ZodString>;
661
+ sensitivityWitness: z.ZodNullable<z.ZodObject<{
662
+ witnessId: z.ZodString;
663
+ channel: z.ZodEnum<{
664
+ argument: "argument";
665
+ arguments: "arguments";
666
+ body: "body";
667
+ environment: "environment";
668
+ option: "option";
669
+ path: "path";
670
+ query: "query";
671
+ stdin: "stdin";
672
+ }>;
673
+ legs: z.ZodArray<z.ZodObject<{
674
+ legId: z.ZodString;
675
+ inputs: z.ZodUnion<readonly [z.ZodObject<{
676
+ path: z.ZodType<import("./primitives.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonObject, unknown>>;
677
+ query: z.ZodType<import("./primitives.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonObject, unknown>>;
678
+ header: z.ZodRecord<z.ZodString, z.ZodString>;
679
+ body: z.ZodDiscriminatedUnion<[z.ZodObject<{
680
+ kind: z.ZodLiteral<"json">;
681
+ value: z.ZodType<import("./primitives.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonValue, unknown>>;
682
+ }, z.core.$strict>, z.ZodObject<{
683
+ kind: z.ZodLiteral<"absent">;
684
+ }, z.core.$strict>], "kind">;
685
+ }, z.core.$strict>, z.ZodObject<{
686
+ argument: z.ZodType<import("./primitives.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonObject, unknown>>;
687
+ option: z.ZodType<import("./primitives.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonObject, unknown>>;
688
+ environment: z.ZodRecord<z.ZodString, z.ZodString>;
689
+ stdin: z.ZodDiscriminatedUnion<[z.ZodObject<{
690
+ kind: z.ZodLiteral<"json">;
691
+ value: z.ZodType<import("./primitives.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonValue, unknown>>;
692
+ }, z.core.$strict>, z.ZodObject<{
693
+ kind: z.ZodLiteral<"text">;
694
+ value: z.ZodString;
695
+ }, z.core.$strict>, z.ZodObject<{
696
+ kind: z.ZodLiteral<"absent">;
697
+ }, z.core.$strict>], "kind">;
698
+ }, z.core.$strict>, z.ZodObject<{
699
+ arguments: z.ZodType<import("./primitives.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonObject, unknown>>;
700
+ }, z.core.$strict>]>;
701
+ }, z.core.$strict>>;
702
+ relation: z.ZodType<import("./expression.ts").Expression, unknown, z.core.$ZodTypeInternals<import("./expression.ts").Expression, unknown>>;
703
+ }, z.core.$strict>>;
704
+ }, z.core.$strict>;
705
+ export type McpOperation = z.infer<typeof McpOperation>;
706
+ /** Any operation shape, for the consumers that read only kind-neutral fields. */
707
+ export type AnyOperation = Operation | CommandOperation | McpOperation;
548
708
  /**
549
709
  * AD-19's four interface kinds, exported once so nothing else respells them:
550
710
  * the sealed evaluator brief carries interface identity without the operation
@@ -562,8 +722,9 @@ export declare const InterfaceKind: z.ZodEnum<{
562
722
  }>;
563
723
  /**
564
724
  * Discriminated on `kind`, so an operation shape cannot be smuggled onto the
565
- * wrong interface: a `cli` interface declaring `method` and an `api` interface
566
- * declaring `invocation` are both parse errors.
725
+ * wrong interface: a `cli` interface declaring `method`, an `api` interface
726
+ * declaring `invocation`, and an `mcp` interface declaring either are all parse
727
+ * errors.
567
728
  */
568
729
  export declare const PermittedInterface: z.ZodDiscriminatedUnion<[z.ZodObject<{
569
730
  logicalId: z.ZodString;
@@ -669,6 +830,7 @@ export declare const PermittedInterface: z.ZodDiscriminatedUnion<[z.ZodObject<{
669
830
  witnessId: z.ZodString;
670
831
  channel: z.ZodEnum<{
671
832
  argument: "argument";
833
+ arguments: "arguments";
672
834
  body: "body";
673
835
  environment: "environment";
674
836
  option: "option";
@@ -701,6 +863,8 @@ export declare const PermittedInterface: z.ZodDiscriminatedUnion<[z.ZodObject<{
701
863
  }, z.core.$strict>, z.ZodObject<{
702
864
  kind: z.ZodLiteral<"absent">;
703
865
  }, z.core.$strict>], "kind">;
866
+ }, z.core.$strict>, z.ZodObject<{
867
+ arguments: z.ZodType<import("./primitives.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonObject, unknown>>;
704
868
  }, z.core.$strict>]>;
705
869
  }, z.core.$strict>>;
706
870
  relation: z.ZodType<import("./expression.ts").Expression, unknown, z.core.$ZodTypeInternals<import("./expression.ts").Expression, unknown>>;
@@ -810,6 +974,7 @@ export declare const PermittedInterface: z.ZodDiscriminatedUnion<[z.ZodObject<{
810
974
  witnessId: z.ZodString;
811
975
  channel: z.ZodEnum<{
812
976
  argument: "argument";
977
+ arguments: "arguments";
813
978
  body: "body";
814
979
  environment: "environment";
815
980
  option: "option";
@@ -842,6 +1007,8 @@ export declare const PermittedInterface: z.ZodDiscriminatedUnion<[z.ZodObject<{
842
1007
  }, z.core.$strict>, z.ZodObject<{
843
1008
  kind: z.ZodLiteral<"absent">;
844
1009
  }, z.core.$strict>], "kind">;
1010
+ }, z.core.$strict>, z.ZodObject<{
1011
+ arguments: z.ZodType<import("./primitives.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonObject, unknown>>;
845
1012
  }, z.core.$strict>]>;
846
1013
  }, z.core.$strict>>;
847
1014
  relation: z.ZodType<import("./expression.ts").Expression, unknown, z.core.$ZodTypeInternals<import("./expression.ts").Expression, unknown>>;
@@ -852,55 +1019,10 @@ export declare const PermittedInterface: z.ZodDiscriminatedUnion<[z.ZodObject<{
852
1019
  kind: z.ZodLiteral<"mcp">;
853
1020
  operations: z.ZodArray<z.ZodObject<{
854
1021
  operationId: z.ZodString;
855
- method: z.ZodEnum<{
856
- DELETE: "DELETE";
857
- GET: "GET";
858
- HEAD: "HEAD";
859
- OPTIONS: "OPTIONS";
860
- PATCH: "PATCH";
861
- POST: "POST";
862
- PUT: "PUT";
863
- }>;
864
- pathTemplate: z.ZodString;
1022
+ toolName: z.ZodString;
865
1023
  stateChangeMarker: z.ZodBoolean;
866
1024
  requestShape: z.ZodObject<{
867
- path: z.ZodObject<{
868
- requiredKeys: z.ZodArray<z.ZodString>;
869
- permittedKeys: z.ZodArray<z.ZodString>;
870
- types: z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodEnum<{
871
- array: "array";
872
- boolean: "boolean";
873
- null: "null";
874
- number: "number";
875
- object: "object";
876
- string: "string";
877
- }>>>;
878
- }, z.core.$strict>;
879
- query: z.ZodObject<{
880
- requiredKeys: z.ZodArray<z.ZodString>;
881
- permittedKeys: z.ZodArray<z.ZodString>;
882
- types: z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodEnum<{
883
- array: "array";
884
- boolean: "boolean";
885
- null: "null";
886
- number: "number";
887
- object: "object";
888
- string: "string";
889
- }>>>;
890
- }, z.core.$strict>;
891
- header: z.ZodObject<{
892
- requiredKeys: z.ZodArray<z.ZodString>;
893
- permittedKeys: z.ZodArray<z.ZodString>;
894
- types: z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodEnum<{
895
- array: "array";
896
- boolean: "boolean";
897
- null: "null";
898
- number: "number";
899
- object: "object";
900
- string: "string";
901
- }>>>;
902
- }, z.core.$strict>;
903
- body: z.ZodObject<{
1025
+ arguments: z.ZodObject<{
904
1026
  requiredKeys: z.ZodArray<z.ZodString>;
905
1027
  permittedKeys: z.ZodArray<z.ZodString>;
906
1028
  types: z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodEnum<{
@@ -913,6 +1035,9 @@ export declare const PermittedInterface: z.ZodDiscriminatedUnion<[z.ZodObject<{
913
1035
  }>>>;
914
1036
  }, z.core.$strict>;
915
1037
  }, z.core.$strict>;
1038
+ descriptorChannel: z.ZodDiscriminatedUnion<[z.ZodObject<{
1039
+ kind: z.ZodLiteral<"structured-result">;
1040
+ }, z.core.$strict>], "kind">;
916
1041
  responseDescriptor: z.ZodObject<{
917
1042
  requiredKeys: z.ZodArray<z.ZodString>;
918
1043
  permittedKeys: z.ZodArray<z.ZodString>;
@@ -951,6 +1076,7 @@ export declare const PermittedInterface: z.ZodDiscriminatedUnion<[z.ZodObject<{
951
1076
  witnessId: z.ZodString;
952
1077
  channel: z.ZodEnum<{
953
1078
  argument: "argument";
1079
+ arguments: "arguments";
954
1080
  body: "body";
955
1081
  environment: "environment";
956
1082
  option: "option";
@@ -983,6 +1109,8 @@ export declare const PermittedInterface: z.ZodDiscriminatedUnion<[z.ZodObject<{
983
1109
  }, z.core.$strict>, z.ZodObject<{
984
1110
  kind: z.ZodLiteral<"absent">;
985
1111
  }, z.core.$strict>], "kind">;
1112
+ }, z.core.$strict>, z.ZodObject<{
1113
+ arguments: z.ZodType<import("./primitives.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonObject, unknown>>;
986
1114
  }, z.core.$strict>]>;
987
1115
  }, z.core.$strict>>;
988
1116
  relation: z.ZodType<import("./expression.ts").Expression, unknown, z.core.$ZodTypeInternals<import("./expression.ts").Expression, unknown>>;
@@ -1097,6 +1225,7 @@ export declare const PermittedInterface: z.ZodDiscriminatedUnion<[z.ZodObject<{
1097
1225
  witnessId: z.ZodString;
1098
1226
  channel: z.ZodEnum<{
1099
1227
  argument: "argument";
1228
+ arguments: "arguments";
1100
1229
  body: "body";
1101
1230
  environment: "environment";
1102
1231
  option: "option";
@@ -1129,6 +1258,8 @@ export declare const PermittedInterface: z.ZodDiscriminatedUnion<[z.ZodObject<{
1129
1258
  }, z.core.$strict>, z.ZodObject<{
1130
1259
  kind: z.ZodLiteral<"absent">;
1131
1260
  }, z.core.$strict>], "kind">;
1261
+ }, z.core.$strict>, z.ZodObject<{
1262
+ arguments: z.ZodType<import("./primitives.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("./primitives.ts").JsonObject, unknown>>;
1132
1263
  }, z.core.$strict>]>;
1133
1264
  }, z.core.$strict>>;
1134
1265
  relation: z.ZodType<import("./expression.ts").Expression, unknown, z.core.$ZodTypeInternals<import("./expression.ts").Expression, unknown>>;
@@ -1137,9 +1268,16 @@ export declare const PermittedInterface: z.ZodDiscriminatedUnion<[z.ZodObject<{
1137
1268
  }, z.core.$strict>], "kind">;
1138
1269
  export type PermittedInterface = z.infer<typeof PermittedInterface>;
1139
1270
  /**
1140
- * One interface's operations widened to the element union. TypeScript will not
1141
- * iterate `iface.operations` directly, because the union's branches give it a
1142
- * union of array types whose `map` signatures do not unify; this is the one
1143
- * place that widening is spelled, so no call site invents its own.
1271
+ * One interface's operations widened to the element union, for the callers
1272
+ * that read only fields all three shapes carry. `iface.operations.map(...)` on
1273
+ * an un-narrowed interface does not compile, because the union's branches give
1274
+ * it a union of array types whose `map` signatures do not unify, and this is
1275
+ * the one place that widening is spelled so no call site invents its own.
1276
+ *
1277
+ * A caller that narrows on `iface.kind` first wants the opposite and should
1278
+ * read `iface.operations` directly: each branch declares its own element type,
1279
+ * and this function discards the kind-to-shape correlation that a later kind
1280
+ * test cannot recover. `buildPlanIndex` (`core/seal/plan-index.ts`) is the site
1281
+ * that sorts by kind, and it narrows first for exactly that reason.
1144
1282
  */
1145
1283
  export declare const operationsOf: (iface: PermittedInterface) => readonly AnyOperation[];