@cleocode/adapters 2026.6.11 → 2026.6.13

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/dist/index.js CHANGED
@@ -2917,37 +2917,6 @@ var init_operations_registry = __esm({
2917
2917
  requiredParams: [],
2918
2918
  params: []
2919
2919
  },
2920
- // T5405: WarpChain pipeline operations
2921
- {
2922
- gateway: "query",
2923
- domain: "pipeline",
2924
- operation: "chain.show",
2925
- description: "pipeline.chain.show (query) \u2014 get chain definition by ID",
2926
- tier: 2,
2927
- idempotent: true,
2928
- sessionRequired: false,
2929
- requiredParams: ["chainId"],
2930
- params: [
2931
- {
2932
- name: "chainId",
2933
- type: "string",
2934
- required: true,
2935
- description: "chainId parameter",
2936
- cli: { positional: true }
2937
- }
2938
- ]
2939
- },
2940
- {
2941
- gateway: "query",
2942
- domain: "pipeline",
2943
- operation: "chain.list",
2944
- description: "pipeline.chain.list (query) \u2014 list all chain definitions",
2945
- tier: 2,
2946
- idempotent: true,
2947
- sessionRequired: false,
2948
- requiredParams: [],
2949
- params: []
2950
- },
2951
2920
  {
2952
2921
  gateway: "query",
2953
2922
  domain: "check",
@@ -3141,26 +3110,6 @@ var init_operations_registry = __esm({
3141
3110
  }
3142
3111
  ]
3143
3112
  },
3144
- // T5405: WarpChain validation query
3145
- {
3146
- gateway: "query",
3147
- domain: "check",
3148
- operation: "chain.validate",
3149
- description: "check.chain.validate (query) \u2014 validate a WarpChain definition",
3150
- tier: 2,
3151
- idempotent: true,
3152
- sessionRequired: false,
3153
- requiredParams: ["chain"],
3154
- params: [
3155
- {
3156
- name: "chain",
3157
- type: "string",
3158
- required: true,
3159
- description: "chain parameter",
3160
- cli: { positional: true }
3161
- }
3162
- ]
3163
- },
3164
3113
  // T646: Canon drift detection — CI gate
3165
3114
  {
3166
3115
  gateway: "query",
@@ -5637,77 +5586,6 @@ var init_operations_registry = __esm({
5637
5586
  { name: "force", type: "boolean", required: false, description: "Required safety flag" }
5638
5587
  ]
5639
5588
  },
5640
- // T5405: WarpChain pipeline mutate operations
5641
- {
5642
- gateway: "mutate",
5643
- domain: "pipeline",
5644
- operation: "chain.add",
5645
- description: "pipeline.chain.add (mutate) \u2014 store a validated chain definition",
5646
- tier: 2,
5647
- idempotent: false,
5648
- sessionRequired: false,
5649
- requiredParams: ["chain"],
5650
- params: [
5651
- {
5652
- name: "chain",
5653
- type: "string",
5654
- required: true,
5655
- description: "chain parameter",
5656
- cli: { positional: true }
5657
- }
5658
- ]
5659
- },
5660
- {
5661
- gateway: "mutate",
5662
- domain: "pipeline",
5663
- operation: "chain.instantiate",
5664
- description: "pipeline.chain.instantiate (mutate) \u2014 create chain instance for epic",
5665
- tier: 2,
5666
- idempotent: false,
5667
- sessionRequired: false,
5668
- requiredParams: ["chainId", "epicId"],
5669
- params: [
5670
- {
5671
- name: "chainId",
5672
- type: "string",
5673
- required: true,
5674
- description: "chainId parameter",
5675
- cli: { positional: true }
5676
- },
5677
- {
5678
- name: "epicId",
5679
- type: "string",
5680
- required: true,
5681
- description: "epicId parameter",
5682
- cli: { positional: true }
5683
- }
5684
- ]
5685
- },
5686
- {
5687
- gateway: "mutate",
5688
- domain: "pipeline",
5689
- operation: "chain.advance",
5690
- description: "pipeline.chain.advance (mutate) \u2014 advance instance to next stage",
5691
- tier: 2,
5692
- idempotent: false,
5693
- sessionRequired: false,
5694
- requiredParams: ["instanceId", "nextStage"],
5695
- params: [
5696
- {
5697
- name: "instanceId",
5698
- type: "string",
5699
- required: true,
5700
- description: "instanceId parameter",
5701
- cli: { positional: true }
5702
- },
5703
- {
5704
- name: "nextStage",
5705
- type: "string",
5706
- required: true,
5707
- description: "nextStage parameter"
5708
- }
5709
- ]
5710
- },
5711
5589
  {
5712
5590
  gateway: "mutate",
5713
5591
  domain: "check",
@@ -7896,52 +7774,6 @@ var init_operations_registry = __esm({
7896
7774
  }
7897
7775
  ]
7898
7776
  },
7899
- // orchestrate — tessera template operations (T5411)
7900
- // tessera.show removed — merged into tessera.list via optional id param (T5615)
7901
- {
7902
- gateway: "query",
7903
- domain: "orchestrate",
7904
- operation: "tessera.list",
7905
- description: "orchestrate.tessera.list (query) \u2014 list Tessera templates; absorbs tessera.show via optional id param",
7906
- tier: 1,
7907
- idempotent: true,
7908
- sessionRequired: false,
7909
- requiredParams: [],
7910
- params: [
7911
- {
7912
- name: "id",
7913
- type: "string",
7914
- required: false,
7915
- description: "Optional template ID for single-item lookup (replaces tessera.show)"
7916
- }
7917
- ]
7918
- },
7919
- {
7920
- gateway: "mutate",
7921
- domain: "orchestrate",
7922
- operation: "tessera.instantiate",
7923
- description: "orchestrate.tessera.instantiate (mutate) \u2014 instantiate a Tessera template into a chain instance",
7924
- tier: 1,
7925
- idempotent: false,
7926
- sessionRequired: false,
7927
- requiredParams: ["templateId", "epicId"],
7928
- params: [
7929
- {
7930
- name: "templateId",
7931
- type: "string",
7932
- required: true,
7933
- description: "templateId parameter",
7934
- cli: { positional: true }
7935
- },
7936
- {
7937
- name: "epicId",
7938
- type: "string",
7939
- required: true,
7940
- description: "epicId parameter",
7941
- cli: { positional: true }
7942
- }
7943
- ]
7944
- },
7945
7777
  // orchestrate — Wave 7a dispatch ops (T408, T409, T410, T415)
7946
7778
  {
7947
7779
  gateway: "query",
@@ -10108,6 +9940,52 @@ var init_operations_registry = __esm({
10108
9940
  description: "Maximum depth for graph edges when includeEdges is true. Default: 1"
10109
9941
  }
10110
9942
  ]
9943
+ },
9944
+ // ── selfimprove mutate: run (T11889 / T11889-D — the self-dogfooding loop) ──
9945
+ // Boots ONE sandbox → replays the named canned scenario → diffs result
9946
+ // envelopes vs the golden → on a regression emits ONE leased `selfimprove_dhq`
9947
+ // row and opens ONE DRAFT PR. The walking skeleton's default scenario is
9948
+ // query-only so the in-process replay never mutates. DEFAULT OFF: without
9949
+ // `execute` the loop runs DRY-RUN (replay + diff + report; NO DB write, NO PR).
9950
+ // The CORE engine (`runSelfImprove`) owns boot/replay/diff/persist/egress +
9951
+ // the budget + circuit-breaker; the dispatch handler is a thin delegate that
9952
+ // supplies the in-process `ReplayDispatch` port (Gate-6). `sessionRequired`
9953
+ // links each run to its origin session for provenance.
9954
+ {
9955
+ gateway: "mutate",
9956
+ domain: "selfimprove",
9957
+ operation: "run",
9958
+ description: "selfimprove.run (mutate) \u2014 boot ONE sandbox, replay a canned dogfood scenario, diff vs golden; on regression emit ONE leased selfimprove_dhq row + ONE DRAFT PR. Default OFF \u2014 requires --execute (else DRY-RUN). Budget-capped + circuit-broken (T11889 / T11889-D).",
9959
+ tier: 2,
9960
+ idempotent: false,
9961
+ sessionRequired: true,
9962
+ requiredParams: ["scenario"],
9963
+ params: [
9964
+ {
9965
+ name: "scenario",
9966
+ type: "string",
9967
+ required: true,
9968
+ description: "Canned dogfood scenario name to replay (e.g. dhq-replay-find)"
9969
+ },
9970
+ {
9971
+ name: "execute",
9972
+ type: "boolean",
9973
+ required: false,
9974
+ description: "Permit mutation (leased DHQ UPSERT) + egress (draft PR). DEFAULT false \u21D2 DRY-RUN (replay + diff + report only \u2014 no DB write, no PR)."
9975
+ },
9976
+ {
9977
+ name: "dryRun",
9978
+ type: "boolean",
9979
+ required: false,
9980
+ description: "Force DRY-RUN explicitly (no DB write, no PR). Equivalent to omitting --execute; the loop is default-OFF."
9981
+ },
9982
+ {
9983
+ name: "backend",
9984
+ type: "string",
9985
+ required: false,
9986
+ description: "Confinement backend preference: 'gondolin' (micro-VM; degrades to the in-process guarded env when VM infra is absent \u2014 the CI path) | 'guarded'. Default: gondolin."
9987
+ }
9988
+ ]
10111
9989
  }
10112
9990
  ];
10113
9991
  }
@@ -10962,6 +10840,243 @@ var init_lafs = __esm({
10962
10840
  }
10963
10841
  });
10964
10842
 
10843
+ // packages/contracts/src/lease-ipc/messages.ts
10844
+ import { z as z11 } from "zod";
10845
+ var LeaseScopeSchema, LeaseLaneSchema, LeaseAcquireRequestSchema, LeaseReleaseRequestSchema, LeaseRenewRequestSchema, RateCheckRequestSchema, ToolGrantRequestSchema, LeaseIpcRequestSchema, LeaseGrantedResponseSchema, LeaseQueuedResponseSchema, LeaseDeniedResponseSchema, RateResultResponseSchema, ToolGrantedResponseSchema, LeaseRevokedResponseSchema, ChildKilledUnresponsiveResponseSchema, LeaseErrorResponseSchema, LeaseIpcResponseSchema, LeaseIpcRequestEnvelopeSchema, LeaseIpcResponseEnvelopeSchema, LeaseIpcEnvelopeSchema, LEASE_IPC_REQUEST_KINDS, LEASE_IPC_RESPONSE_KINDS, LEASE_IPC_MESSAGE_KINDS;
10846
+ var init_messages2 = __esm({
10847
+ "packages/contracts/src/lease-ipc/messages.ts"() {
10848
+ "use strict";
10849
+ LeaseScopeSchema = z11.enum(["project", "global"]);
10850
+ LeaseLaneSchema = z11.enum(["tasks", "brain", "bulk"]);
10851
+ LeaseAcquireRequestSchema = z11.object({
10852
+ /** Tag discriminating this request variant. */
10853
+ kind: z11.literal("lease_acquire"),
10854
+ /** The cleo.db scope being arbitrated. */
10855
+ scope: LeaseScopeSchema,
10856
+ /** The write lane within the scope. */
10857
+ lane: LeaseLaneSchema,
10858
+ /** Process+lane holder identity. */
10859
+ holder_id: z11.string().min(1),
10860
+ /** Advisory priority — lower acquires sooner. `0` = highest. */
10861
+ priority: z11.number().int().min(0).max(255),
10862
+ /** Lease time-to-live in milliseconds. */
10863
+ ttl_ms: z11.number().int().nonnegative(),
10864
+ /** When true, a same-holder acquire re-enters (refcount++) rather than queuing. */
10865
+ reentrant: z11.boolean()
10866
+ }).strict();
10867
+ LeaseReleaseRequestSchema = z11.object({
10868
+ /** Tag discriminating this request variant. */
10869
+ kind: z11.literal("lease_release"),
10870
+ /** The cleo.db scope being arbitrated. */
10871
+ scope: LeaseScopeSchema,
10872
+ /** The write lane within the scope. */
10873
+ lane: LeaseLaneSchema,
10874
+ /** Process+lane holder identity. */
10875
+ holder_id: z11.string().min(1),
10876
+ /** The epoch fence the holder acquired — a stale epoch no-ops. */
10877
+ epoch: z11.number().int().nonnegative()
10878
+ }).strict();
10879
+ LeaseRenewRequestSchema = z11.object({
10880
+ /** Tag discriminating this request variant. */
10881
+ kind: z11.literal("lease_renew"),
10882
+ /** The cleo.db scope being arbitrated. */
10883
+ scope: LeaseScopeSchema,
10884
+ /** The write lane within the scope. */
10885
+ lane: LeaseLaneSchema,
10886
+ /** Process+lane holder identity. */
10887
+ holder_id: z11.string().min(1),
10888
+ /** The epoch fence the holder acquired (epoch-guarded renew). */
10889
+ epoch: z11.number().int().nonnegative()
10890
+ }).strict();
10891
+ RateCheckRequestSchema = z11.object({
10892
+ /** Tag discriminating this request variant. */
10893
+ kind: z11.literal("rate_check"),
10894
+ /** The cleo.db scope being checked. */
10895
+ scope: LeaseScopeSchema,
10896
+ /** The write lane within the scope. */
10897
+ lane: LeaseLaneSchema,
10898
+ /** Estimated bytes the caller intends to write. */
10899
+ est_bytes: z11.number().int().nonnegative()
10900
+ }).strict();
10901
+ ToolGrantRequestSchema = z11.object({
10902
+ /** Tag discriminating this request variant. */
10903
+ kind: z11.literal("tool_grant"),
10904
+ /** The tool name being requested. */
10905
+ tool: z11.string().min(1),
10906
+ /** The requesting holder identity. */
10907
+ holder_id: z11.string().min(1)
10908
+ }).strict();
10909
+ LeaseIpcRequestSchema = z11.discriminatedUnion("kind", [
10910
+ LeaseAcquireRequestSchema,
10911
+ LeaseReleaseRequestSchema,
10912
+ LeaseRenewRequestSchema,
10913
+ RateCheckRequestSchema,
10914
+ ToolGrantRequestSchema
10915
+ ]);
10916
+ LeaseGrantedResponseSchema = z11.object({
10917
+ /** Tag discriminating this response variant. */
10918
+ kind: z11.literal("lease_granted"),
10919
+ /** The granted cleo.db scope. */
10920
+ scope: LeaseScopeSchema,
10921
+ /** The granted write lane. */
10922
+ lane: LeaseLaneSchema,
10923
+ /** The holder the lease was granted to. */
10924
+ holder_id: z11.string().min(1),
10925
+ /** The monotonic epoch fence assigned to this grant. */
10926
+ epoch: z11.number().int().nonnegative(),
10927
+ /** The lease TTL in milliseconds. */
10928
+ ttl_ms: z11.number().int().nonnegative(),
10929
+ /** Absolute expiry timestamp (epoch ms) for this grant. */
10930
+ expires_at_ms: z11.number().int().nonnegative()
10931
+ }).strict();
10932
+ LeaseQueuedResponseSchema = z11.object({
10933
+ /** Tag discriminating this response variant. */
10934
+ kind: z11.literal("lease_queued"),
10935
+ /** The queued cleo.db scope. */
10936
+ scope: LeaseScopeSchema,
10937
+ /** The queued write lane. */
10938
+ lane: LeaseLaneSchema,
10939
+ /** The monotonic ticket assigned for FIFO tiebreak. */
10940
+ ticket: z11.number().int().nonnegative(),
10941
+ /** Number of waiters ahead of this one. */
10942
+ ahead: z11.number().int().nonnegative()
10943
+ }).strict();
10944
+ LeaseDeniedResponseSchema = z11.object({
10945
+ /** Tag discriminating this response variant. */
10946
+ kind: z11.literal("lease_denied"),
10947
+ /** The denied cleo.db scope. */
10948
+ scope: LeaseScopeSchema,
10949
+ /** Machine-readable denial code (e.g. `E_LEASE_UNAVAILABLE`). */
10950
+ code: z11.string().min(1),
10951
+ /** Human-readable denial message. */
10952
+ message: z11.string()
10953
+ }).strict();
10954
+ RateResultResponseSchema = z11.object({
10955
+ /** Tag discriminating this response variant. */
10956
+ kind: z11.literal("rate_result"),
10957
+ /** The checked cleo.db scope. */
10958
+ scope: LeaseScopeSchema,
10959
+ /** Whether the write is within budget. */
10960
+ ok: z11.boolean(),
10961
+ /** Suggested back-off in milliseconds when `ok` is false. */
10962
+ retry_after_ms: z11.number().int().nonnegative(),
10963
+ /** Remaining token budget for the scope. */
10964
+ tokens_remaining: z11.number().int().nonnegative()
10965
+ }).strict();
10966
+ ToolGrantedResponseSchema = z11.object({
10967
+ /** Tag discriminating this response variant. */
10968
+ kind: z11.literal("tool_granted"),
10969
+ /** The granted tool name. */
10970
+ tool: z11.string().min(1),
10971
+ /** The holder the tool grant was issued to. */
10972
+ holder_id: z11.string().min(1)
10973
+ }).strict();
10974
+ LeaseRevokedResponseSchema = z11.object({
10975
+ /** Tag discriminating this response variant. */
10976
+ kind: z11.literal("lease_revoked"),
10977
+ /** The revoked cleo.db scope. */
10978
+ scope: LeaseScopeSchema,
10979
+ /** The revoked write lane. */
10980
+ lane: LeaseLaneSchema,
10981
+ /** The holder whose lease was revoked. */
10982
+ holder_id: z11.string().min(1),
10983
+ /** Human-readable reason for the revocation. */
10984
+ reason: z11.string()
10985
+ }).strict();
10986
+ ChildKilledUnresponsiveResponseSchema = z11.object({
10987
+ /** Tag discriminating this response variant. */
10988
+ kind: z11.literal("child_killed_unresponsive"),
10989
+ /** Logical id of the killed child. */
10990
+ child_id: z11.string().min(1),
10991
+ /** The holder identity the killed child held the lease as. */
10992
+ holder_id: z11.string().min(1),
10993
+ /** The cleo.db scope the killed child held the lease in. */
10994
+ scope: LeaseScopeSchema,
10995
+ /** Human-readable reason for the kill. */
10996
+ reason: z11.string()
10997
+ }).strict();
10998
+ LeaseErrorResponseSchema = z11.object({
10999
+ /** Tag discriminating this response variant. */
11000
+ kind: z11.literal("error"),
11001
+ /** Machine-readable error code (e.g. `E_LEASE_BAD_VERSION`, `E_LEASE_UNIMPLEMENTED`). */
11002
+ code: z11.string().min(1),
11003
+ /** Human-readable error message. */
11004
+ message: z11.string()
11005
+ }).strict();
11006
+ LeaseIpcResponseSchema = z11.discriminatedUnion("kind", [
11007
+ LeaseGrantedResponseSchema,
11008
+ LeaseQueuedResponseSchema,
11009
+ LeaseDeniedResponseSchema,
11010
+ RateResultResponseSchema,
11011
+ ToolGrantedResponseSchema,
11012
+ LeaseRevokedResponseSchema,
11013
+ ChildKilledUnresponsiveResponseSchema,
11014
+ LeaseErrorResponseSchema
11015
+ ]);
11016
+ LeaseIpcRequestEnvelopeSchema = z11.object({
11017
+ /** Parallel protocol version. */
11018
+ protocol_version: z11.string(),
11019
+ /** Correlation id echoed back on the matching response. */
11020
+ id: z11.string().min(1),
11021
+ /** Direction discriminator. */
11022
+ direction: z11.literal("request"),
11023
+ /** The request body. */
11024
+ request: LeaseIpcRequestSchema
11025
+ }).strict();
11026
+ LeaseIpcResponseEnvelopeSchema = z11.object({
11027
+ /** Parallel protocol version. */
11028
+ protocol_version: z11.string(),
11029
+ /** Correlation id echoed from the originating request (or a fresh id for events). */
11030
+ id: z11.string().min(1),
11031
+ /** Direction discriminator. */
11032
+ direction: z11.literal("response"),
11033
+ /** The response body. */
11034
+ response: LeaseIpcResponseSchema
11035
+ }).strict();
11036
+ LeaseIpcEnvelopeSchema = z11.discriminatedUnion("direction", [
11037
+ LeaseIpcRequestEnvelopeSchema,
11038
+ LeaseIpcResponseEnvelopeSchema
11039
+ ]);
11040
+ LEASE_IPC_REQUEST_KINDS = [
11041
+ "lease_acquire",
11042
+ "lease_release",
11043
+ "lease_renew",
11044
+ "rate_check",
11045
+ "tool_grant"
11046
+ ];
11047
+ LEASE_IPC_RESPONSE_KINDS = [
11048
+ "lease_granted",
11049
+ "lease_queued",
11050
+ "lease_denied",
11051
+ "rate_result",
11052
+ "tool_granted",
11053
+ "lease_revoked",
11054
+ "child_killed_unresponsive",
11055
+ "error"
11056
+ ];
11057
+ LEASE_IPC_MESSAGE_KINDS = [
11058
+ ...LEASE_IPC_REQUEST_KINDS,
11059
+ ...LEASE_IPC_RESPONSE_KINDS
11060
+ ];
11061
+ }
11062
+ });
11063
+
11064
+ // packages/contracts/src/lease-ipc/version.ts
11065
+ var init_version2 = __esm({
11066
+ "packages/contracts/src/lease-ipc/version.ts"() {
11067
+ "use strict";
11068
+ }
11069
+ });
11070
+
11071
+ // packages/contracts/src/lease-ipc/index.ts
11072
+ var init_lease_ipc = __esm({
11073
+ "packages/contracts/src/lease-ipc/index.ts"() {
11074
+ "use strict";
11075
+ init_messages2();
11076
+ init_version2();
11077
+ }
11078
+ });
11079
+
10965
11080
  // packages/contracts/src/llm/plugin-llm.ts
10966
11081
  var init_plugin_llm = __esm({
10967
11082
  "packages/contracts/src/llm/plugin-llm.ts"() {
@@ -10969,6 +11084,56 @@ var init_plugin_llm = __esm({
10969
11084
  }
10970
11085
  });
10971
11086
 
11087
+ // packages/contracts/src/llm/system-of-use.ts
11088
+ var ROLE_SYSTEM_IDS, ORCHESTRATION_TIER_IDS, AUX_SYSTEM_IDS, BUILTIN_SYSTEMS_OF_USE;
11089
+ var init_system_of_use = __esm({
11090
+ "packages/contracts/src/llm/system-of-use.ts"() {
11091
+ "use strict";
11092
+ ROLE_SYSTEM_IDS = [
11093
+ "extraction",
11094
+ "consolidation",
11095
+ "derivation",
11096
+ "hygiene",
11097
+ "judgement",
11098
+ "plugin",
11099
+ "compression"
11100
+ ];
11101
+ ORCHESTRATION_TIER_IDS = [
11102
+ "frontier",
11103
+ "standard",
11104
+ "fast",
11105
+ "local"
11106
+ ];
11107
+ AUX_SYSTEM_IDS = [
11108
+ /** Dream-cycle / consolidation subsystem (BRAIN sentient layer). */
11109
+ "sentient",
11110
+ /** BRAIN memory extraction subsystem. */
11111
+ "memory",
11112
+ /** Task-executor judgement subsystem. */
11113
+ "task-executor",
11114
+ /** BRAIN deriver subsystem. */
11115
+ "deriver",
11116
+ /** Hygiene-scan subsystem. */
11117
+ "hygiene",
11118
+ /** Plugin-scoped single-turn calls. */
11119
+ "plugin",
11120
+ /** Context-compression / summarization subsystem. */
11121
+ "compression",
11122
+ /** Decision conflict-validator (ADR write-gate). */
11123
+ "decision-validator",
11124
+ /** Title / summary generation (cheap aux tier). */
11125
+ "title-generation",
11126
+ /** Embedding generation for vector retrieval. */
11127
+ "embedding"
11128
+ ];
11129
+ BUILTIN_SYSTEMS_OF_USE = [
11130
+ ...ORCHESTRATION_TIER_IDS.map((id) => ({ kind: "orchestration", id })),
11131
+ ...ROLE_SYSTEM_IDS.map((id) => ({ kind: "role", id })),
11132
+ ...AUX_SYSTEM_IDS.map((id) => ({ kind: "aux", id }))
11133
+ ];
11134
+ }
11135
+ });
11136
+
10972
11137
  // packages/contracts/src/llm/system-resolver.ts
10973
11138
  var init_system_resolver = __esm({
10974
11139
  "packages/contracts/src/llm/system-resolver.ts"() {
@@ -11015,7 +11180,7 @@ var init_status_registry = __esm({
11015
11180
  });
11016
11181
 
11017
11182
  // packages/contracts/src/workgraph.ts
11018
- import { z as z11 } from "zod";
11183
+ import { z as z12 } from "zod";
11019
11184
  var E_WORKGRAPH_PARENT_TYPE_MATRIX, taskTypeSchema, taskPrioritySchema, taskStatusSchema, verificationGateSchema, workGraphRelationKindSchema, workGraphTraversalDirectionSchema, workGraphEdgeDirectionSchema, paginationParamsSchema, workGraphNodeSchema, workGraphEdgeSchema, workGraphHierarchyEdgeSchema, workGraphPageInfoSchema, workGraphRollupCountsSchema, workGraphSubtreePercentagesSchema, workGraphProjectionMismatchSchema, workGraphReadyFrontierTaskSchema, workGraphRelationEdgeSchema, workGraphDependencyEdgeSchema, workGraphOmissionReasonSchema, workGraphContextBudgetSchema, workGraphOmissionSchema, workGraphDirectEdgeSchema, workGraphContextPackParamsSchema, workGraphSliceParamsSchema, workGraphSliceSchema, workGraphReadinessParamsSchema, workGraphReadinessResultSchema, workGraphContextPackSchema, workGraphScaffoldValidateParamsSchema, workGraphScaffoldValidationIssueSchema, workGraphScaffoldValidateResultSchema, workGraphScaffoldApplyParamsSchema, workGraphScaffoldApplyResultSchema, workGraphPlanningDocParamsSchema, workGraphPlanningDocSchema, tasksTraverseParamsSchema, tasksTraverseResultSchema, tasksTreeParamsSchema, tasksTreeResultSchema, tasksRollupParamsSchema, tasksRollupResultSchema, tasksFrontierParamsSchema, tasksFrontierResultSchema, tasksWorkGraphAuditParamsSchema, tasksWorkGraphAuditResultSchema;
11020
11185
  var init_workgraph = __esm({
11021
11186
  "packages/contracts/src/workgraph.ts"() {
@@ -11023,10 +11188,10 @@ var init_workgraph = __esm({
11023
11188
  init_enums();
11024
11189
  init_status_registry();
11025
11190
  E_WORKGRAPH_PARENT_TYPE_MATRIX = "E_WORKGRAPH_PARENT_TYPE_MATRIX";
11026
- taskTypeSchema = z11.enum(["saga", "epic", "task", "subtask"]);
11027
- taskPrioritySchema = z11.enum(["critical", "high", "medium", "low"]);
11028
- taskStatusSchema = z11.enum(TASK_STATUSES);
11029
- verificationGateSchema = z11.enum([
11191
+ taskTypeSchema = z12.enum(["saga", "epic", "task", "subtask"]);
11192
+ taskPrioritySchema = z12.enum(["critical", "high", "medium", "low"]);
11193
+ taskStatusSchema = z12.enum(TASK_STATUSES);
11194
+ verificationGateSchema = z12.enum([
11030
11195
  "implemented",
11031
11196
  "testsPassed",
11032
11197
  "qaPassed",
@@ -11035,7 +11200,7 @@ var init_workgraph = __esm({
11035
11200
  "documented",
11036
11201
  "nexusImpact"
11037
11202
  ]);
11038
- workGraphRelationKindSchema = z11.enum([
11203
+ workGraphRelationKindSchema = z12.enum([
11039
11204
  "contains",
11040
11205
  "depends_on",
11041
11206
  "blocks",
@@ -11043,317 +11208,317 @@ var init_workgraph = __esm({
11043
11208
  "groups",
11044
11209
  "satisfies"
11045
11210
  ]);
11046
- workGraphTraversalDirectionSchema = z11.enum([
11211
+ workGraphTraversalDirectionSchema = z12.enum([
11047
11212
  "ancestors",
11048
11213
  "descendants",
11049
11214
  "upstream",
11050
11215
  "downstream"
11051
11216
  ]);
11052
- workGraphEdgeDirectionSchema = z11.enum(["out", "in", "both"]);
11053
- paginationParamsSchema = z11.object({
11054
- cursor: z11.string().min(1).optional(),
11055
- limit: z11.number().int().positive().max(500).optional()
11217
+ workGraphEdgeDirectionSchema = z12.enum(["out", "in", "both"]);
11218
+ paginationParamsSchema = z12.object({
11219
+ cursor: z12.string().min(1).optional(),
11220
+ limit: z12.number().int().positive().max(500).optional()
11056
11221
  });
11057
- workGraphNodeSchema = z11.object({
11058
- id: z11.string().min(1),
11222
+ workGraphNodeSchema = z12.object({
11223
+ id: z12.string().min(1),
11059
11224
  type: taskTypeSchema,
11060
- title: z11.string(),
11225
+ title: z12.string(),
11061
11226
  status: taskStatusSchema,
11062
11227
  priority: taskPrioritySchema,
11063
- parentId: z11.string().min(1).optional()
11228
+ parentId: z12.string().min(1).optional()
11064
11229
  });
11065
- workGraphEdgeSchema = z11.object({
11066
- fromId: z11.string().min(1),
11067
- toId: z11.string().min(1),
11230
+ workGraphEdgeSchema = z12.object({
11231
+ fromId: z12.string().min(1),
11232
+ toId: z12.string().min(1),
11068
11233
  kind: workGraphRelationKindSchema
11069
11234
  });
11070
- workGraphHierarchyEdgeSchema = z11.object({
11071
- fromId: z11.string().min(1),
11072
- toId: z11.string().min(1),
11073
- kind: z11.literal("contains")
11235
+ workGraphHierarchyEdgeSchema = z12.object({
11236
+ fromId: z12.string().min(1),
11237
+ toId: z12.string().min(1),
11238
+ kind: z12.literal("contains")
11074
11239
  }).strict();
11075
- workGraphPageInfoSchema = z11.object({
11076
- nextCursor: z11.string().min(1).optional(),
11077
- hasMore: z11.boolean()
11078
- });
11079
- workGraphRollupCountsSchema = z11.object({
11080
- total: z11.number().int().nonnegative(),
11081
- byStatus: z11.partialRecord(taskStatusSchema, z11.number().int().nonnegative()),
11082
- byType: z11.partialRecord(taskTypeSchema, z11.number().int().nonnegative())
11083
- });
11084
- workGraphSubtreePercentagesSchema = z11.object({
11085
- done: z11.number().nonnegative(),
11086
- active: z11.number().nonnegative(),
11087
- blocked: z11.number().nonnegative(),
11088
- pending: z11.number().nonnegative(),
11089
- cancelled: z11.number().nonnegative()
11090
- });
11091
- workGraphProjectionMismatchSchema = z11.object({
11092
- field: z11.string().min(1),
11093
- expected: z11.number().int().nonnegative(),
11094
- actual: z11.number().int().nonnegative()
11240
+ workGraphPageInfoSchema = z12.object({
11241
+ nextCursor: z12.string().min(1).optional(),
11242
+ hasMore: z12.boolean()
11243
+ });
11244
+ workGraphRollupCountsSchema = z12.object({
11245
+ total: z12.number().int().nonnegative(),
11246
+ byStatus: z12.partialRecord(taskStatusSchema, z12.number().int().nonnegative()),
11247
+ byType: z12.partialRecord(taskTypeSchema, z12.number().int().nonnegative())
11248
+ });
11249
+ workGraphSubtreePercentagesSchema = z12.object({
11250
+ done: z12.number().nonnegative(),
11251
+ active: z12.number().nonnegative(),
11252
+ blocked: z12.number().nonnegative(),
11253
+ pending: z12.number().nonnegative(),
11254
+ cancelled: z12.number().nonnegative()
11255
+ });
11256
+ workGraphProjectionMismatchSchema = z12.object({
11257
+ field: z12.string().min(1),
11258
+ expected: z12.number().int().nonnegative(),
11259
+ actual: z12.number().int().nonnegative()
11095
11260
  });
11096
11261
  workGraphReadyFrontierTaskSchema = workGraphNodeSchema.extend({
11097
- role: z11.string().min(1).optional(),
11098
- dependencyBlockers: z11.array(z11.object({ taskId: z11.string().min(1), status: taskStatusSchema })),
11099
- gateBlockers: z11.array(z11.object({ gate: verificationGateSchema }))
11262
+ role: z12.string().min(1).optional(),
11263
+ dependencyBlockers: z12.array(z12.object({ taskId: z12.string().min(1), status: taskStatusSchema })),
11264
+ gateBlockers: z12.array(z12.object({ gate: verificationGateSchema }))
11100
11265
  });
11101
11266
  workGraphRelationEdgeSchema = workGraphEdgeSchema.extend({
11102
- source: z11.literal("relation"),
11103
- relationType: z11.enum(TASK_RELATION_TYPES),
11104
- reason: z11.string().min(1).optional()
11267
+ source: z12.literal("relation"),
11268
+ relationType: z12.enum(TASK_RELATION_TYPES),
11269
+ reason: z12.string().min(1).optional()
11105
11270
  });
11106
11271
  workGraphDependencyEdgeSchema = workGraphEdgeSchema.extend({
11107
- source: z11.literal("dependency"),
11108
- kind: z11.literal("depends_on")
11272
+ source: z12.literal("dependency"),
11273
+ kind: z12.literal("depends_on")
11109
11274
  });
11110
- workGraphOmissionReasonSchema = z11.enum([
11275
+ workGraphOmissionReasonSchema = z12.enum([
11111
11276
  "budget_exceeded",
11112
11277
  "not_requested",
11113
11278
  "not_available",
11114
11279
  "redacted",
11115
11280
  "truncated"
11116
11281
  ]);
11117
- workGraphContextBudgetSchema = z11.object({
11118
- tokenBudget: z11.number().int().nonnegative(),
11119
- estimatedTokens: z11.number().int().nonnegative(),
11120
- remainingTokens: z11.number().int().nonnegative(),
11121
- truncated: z11.boolean()
11122
- });
11123
- workGraphOmissionSchema = z11.object({
11124
- path: z11.string().min(1),
11282
+ workGraphContextBudgetSchema = z12.object({
11283
+ tokenBudget: z12.number().int().nonnegative(),
11284
+ estimatedTokens: z12.number().int().nonnegative(),
11285
+ remainingTokens: z12.number().int().nonnegative(),
11286
+ truncated: z12.boolean()
11287
+ });
11288
+ workGraphOmissionSchema = z12.object({
11289
+ path: z12.string().min(1),
11125
11290
  reason: workGraphOmissionReasonSchema,
11126
- message: z11.string().min(1),
11127
- estimatedTokens: z11.number().int().nonnegative().optional()
11291
+ message: z12.string().min(1),
11292
+ estimatedTokens: z12.number().int().nonnegative().optional()
11128
11293
  });
11129
- workGraphDirectEdgeSchema = z11.discriminatedUnion("source", [
11294
+ workGraphDirectEdgeSchema = z12.discriminatedUnion("source", [
11130
11295
  workGraphRelationEdgeSchema,
11131
11296
  workGraphDependencyEdgeSchema
11132
11297
  ]);
11133
11298
  workGraphContextPackParamsSchema = paginationParamsSchema.extend({
11134
- rootId: z11.string().min(1),
11135
- tokenBudget: z11.number().int().positive().optional(),
11136
- includeRelations: z11.boolean().optional(),
11137
- includeReadiness: z11.boolean().optional(),
11138
- includeRollup: z11.boolean().optional()
11299
+ rootId: z12.string().min(1),
11300
+ tokenBudget: z12.number().int().positive().optional(),
11301
+ includeRelations: z12.boolean().optional(),
11302
+ includeReadiness: z12.boolean().optional(),
11303
+ includeRollup: z12.boolean().optional()
11139
11304
  });
11140
11305
  workGraphSliceParamsSchema = paginationParamsSchema.extend({
11141
- rootId: z11.string().min(1),
11306
+ rootId: z12.string().min(1),
11142
11307
  direction: workGraphTraversalDirectionSchema.optional(),
11143
- maxDepth: z11.number().int().nonnegative().optional(),
11144
- includeRelations: z11.boolean().optional()
11308
+ maxDepth: z12.number().int().nonnegative().optional(),
11309
+ includeRelations: z12.boolean().optional()
11145
11310
  });
11146
- workGraphSliceSchema = z11.object({
11147
- rootId: z11.string().min(1),
11311
+ workGraphSliceSchema = z12.object({
11312
+ rootId: z12.string().min(1),
11148
11313
  direction: workGraphTraversalDirectionSchema,
11149
- nodes: z11.array(workGraphNodeSchema),
11150
- edges: z11.array(workGraphEdgeSchema),
11314
+ nodes: z12.array(workGraphNodeSchema),
11315
+ edges: z12.array(workGraphEdgeSchema),
11151
11316
  pageInfo: workGraphPageInfoSchema,
11152
- omissions: z11.array(workGraphOmissionSchema).optional()
11153
- });
11154
- workGraphReadinessParamsSchema = z11.object({
11155
- rootId: z11.string().min(1),
11156
- role: z11.string().min(1).optional(),
11157
- includeGateBlockers: z11.boolean().optional()
11158
- });
11159
- workGraphReadinessResultSchema = z11.object({
11160
- rootId: z11.string().min(1),
11161
- role: z11.string().min(1).optional(),
11162
- ready: z11.boolean(),
11163
- warnings: z11.array(z11.string()),
11164
- groups: z11.object({
11165
- ready: z11.array(workGraphReadyFrontierTaskSchema),
11166
- blocked: z11.array(workGraphReadyFrontierTaskSchema),
11167
- blockedBy: z11.array(
11168
- z11.discriminatedUnion("kind", [
11169
- z11.object({
11170
- kind: z11.literal("dependency"),
11171
- blockerId: z11.string().min(1),
11172
- blocks: z11.array(z11.string().min(1))
11317
+ omissions: z12.array(workGraphOmissionSchema).optional()
11318
+ });
11319
+ workGraphReadinessParamsSchema = z12.object({
11320
+ rootId: z12.string().min(1),
11321
+ role: z12.string().min(1).optional(),
11322
+ includeGateBlockers: z12.boolean().optional()
11323
+ });
11324
+ workGraphReadinessResultSchema = z12.object({
11325
+ rootId: z12.string().min(1),
11326
+ role: z12.string().min(1).optional(),
11327
+ ready: z12.boolean(),
11328
+ warnings: z12.array(z12.string()),
11329
+ groups: z12.object({
11330
+ ready: z12.array(workGraphReadyFrontierTaskSchema),
11331
+ blocked: z12.array(workGraphReadyFrontierTaskSchema),
11332
+ blockedBy: z12.array(
11333
+ z12.discriminatedUnion("kind", [
11334
+ z12.object({
11335
+ kind: z12.literal("dependency"),
11336
+ blockerId: z12.string().min(1),
11337
+ blocks: z12.array(z12.string().min(1))
11173
11338
  }),
11174
- z11.object({
11175
- kind: z11.literal("gate"),
11339
+ z12.object({
11340
+ kind: z12.literal("gate"),
11176
11341
  gate: verificationGateSchema,
11177
- blocks: z11.array(z11.string().min(1))
11342
+ blocks: z12.array(z12.string().min(1))
11178
11343
  })
11179
11344
  ])
11180
11345
  )
11181
11346
  })
11182
11347
  });
11183
- workGraphContextPackSchema = z11.object({
11184
- rootId: z11.string().min(1),
11185
- generatedAt: z11.string().min(1),
11348
+ workGraphContextPackSchema = z12.object({
11349
+ rootId: z12.string().min(1),
11350
+ generatedAt: z12.string().min(1),
11186
11351
  budget: workGraphContextBudgetSchema,
11187
11352
  slice: workGraphSliceSchema,
11188
- relationEdges: z11.object({
11189
- rootId: z11.string().min(1),
11353
+ relationEdges: z12.object({
11354
+ rootId: z12.string().min(1),
11190
11355
  direction: workGraphEdgeDirectionSchema,
11191
- edges: z11.array(workGraphDirectEdgeSchema)
11356
+ edges: z12.array(workGraphDirectEdgeSchema)
11192
11357
  }).optional(),
11193
11358
  readiness: workGraphReadinessResultSchema.optional(),
11194
- rollup: z11.lazy(() => tasksRollupResultSchema).optional(),
11195
- omissions: z11.array(workGraphOmissionSchema)
11196
- });
11197
- workGraphScaffoldValidateParamsSchema = z11.object({
11198
- rootId: z11.string().min(1),
11199
- nodes: z11.array(
11200
- z11.object({
11201
- id: z11.string().min(1),
11359
+ rollup: z12.lazy(() => tasksRollupResultSchema).optional(),
11360
+ omissions: z12.array(workGraphOmissionSchema)
11361
+ });
11362
+ workGraphScaffoldValidateParamsSchema = z12.object({
11363
+ rootId: z12.string().min(1),
11364
+ nodes: z12.array(
11365
+ z12.object({
11366
+ id: z12.string().min(1),
11202
11367
  type: taskTypeSchema,
11203
- parentId: z11.string().min(1).nullable().optional()
11368
+ parentId: z12.string().min(1).nullable().optional()
11204
11369
  })
11205
11370
  ),
11206
- edges: z11.array(workGraphDirectEdgeSchema).optional(),
11207
- dryRun: z11.boolean().optional()
11208
- });
11209
- workGraphScaffoldValidationIssueSchema = z11.object({
11210
- code: z11.string().min(1),
11211
- message: z11.string().min(1),
11212
- taskId: z11.string().min(1).optional(),
11213
- severity: z11.enum(["error", "warning"])
11214
- });
11215
- workGraphScaffoldValidateResultSchema = z11.object({
11216
- rootId: z11.string().min(1),
11217
- valid: z11.boolean(),
11218
- dryRun: z11.boolean(),
11219
- issues: z11.array(workGraphScaffoldValidationIssueSchema),
11220
- hierarchy: z11.object({
11221
- valid: z11.boolean(),
11222
- violations: z11.array(
11223
- z11.object({
11224
- code: z11.literal(E_WORKGRAPH_PARENT_TYPE_MATRIX),
11225
- taskId: z11.string().min(1),
11371
+ edges: z12.array(workGraphDirectEdgeSchema).optional(),
11372
+ dryRun: z12.boolean().optional()
11373
+ });
11374
+ workGraphScaffoldValidationIssueSchema = z12.object({
11375
+ code: z12.string().min(1),
11376
+ message: z12.string().min(1),
11377
+ taskId: z12.string().min(1).optional(),
11378
+ severity: z12.enum(["error", "warning"])
11379
+ });
11380
+ workGraphScaffoldValidateResultSchema = z12.object({
11381
+ rootId: z12.string().min(1),
11382
+ valid: z12.boolean(),
11383
+ dryRun: z12.boolean(),
11384
+ issues: z12.array(workGraphScaffoldValidationIssueSchema),
11385
+ hierarchy: z12.object({
11386
+ valid: z12.boolean(),
11387
+ violations: z12.array(
11388
+ z12.object({
11389
+ code: z12.literal(E_WORKGRAPH_PARENT_TYPE_MATRIX),
11390
+ taskId: z12.string().min(1),
11226
11391
  taskType: taskTypeSchema,
11227
- parentId: z11.string().min(1).nullable(),
11392
+ parentId: z12.string().min(1).nullable(),
11228
11393
  parentType: taskTypeSchema.optional(),
11229
- message: z11.string().min(1)
11394
+ message: z12.string().min(1)
11230
11395
  })
11231
11396
  )
11232
11397
  })
11233
11398
  });
11234
11399
  workGraphScaffoldApplyParamsSchema = workGraphScaffoldValidateParamsSchema.extend({
11235
- apply: z11.boolean().optional()
11400
+ apply: z12.boolean().optional()
11236
11401
  });
11237
11402
  workGraphScaffoldApplyResultSchema = workGraphScaffoldValidateResultSchema.extend({
11238
- applied: z11.boolean(),
11239
- nodesChanged: z11.number().int().nonnegative(),
11240
- edgesChanged: z11.number().int().nonnegative()
11241
- });
11242
- workGraphPlanningDocParamsSchema = z11.object({
11243
- rootId: z11.string().min(1),
11244
- audience: z11.enum(["agent", "maintainer"]),
11245
- tokenBudget: z11.number().int().positive().optional(),
11246
- includeRelations: z11.boolean().optional(),
11247
- includeReadiness: z11.boolean().optional(),
11248
- includeRollup: z11.boolean().optional()
11249
- });
11250
- workGraphPlanningDocSchema = z11.object({
11251
- rootId: z11.string().min(1),
11252
- generatedAt: z11.string().min(1),
11253
- audience: z11.enum(["agent", "maintainer"]),
11254
- title: z11.string().min(1),
11255
- content: z11.string(),
11256
- sections: z11.array(z11.string().min(1)),
11257
- estimatedTokens: z11.number().int().nonnegative(),
11258
- budget: z11.object({
11259
- tokenBudget: z11.number().int().positive(),
11260
- truncated: z11.boolean()
11403
+ applied: z12.boolean(),
11404
+ nodesChanged: z12.number().int().nonnegative(),
11405
+ edgesChanged: z12.number().int().nonnegative()
11406
+ });
11407
+ workGraphPlanningDocParamsSchema = z12.object({
11408
+ rootId: z12.string().min(1),
11409
+ audience: z12.enum(["agent", "maintainer"]),
11410
+ tokenBudget: z12.number().int().positive().optional(),
11411
+ includeRelations: z12.boolean().optional(),
11412
+ includeReadiness: z12.boolean().optional(),
11413
+ includeRollup: z12.boolean().optional()
11414
+ });
11415
+ workGraphPlanningDocSchema = z12.object({
11416
+ rootId: z12.string().min(1),
11417
+ generatedAt: z12.string().min(1),
11418
+ audience: z12.enum(["agent", "maintainer"]),
11419
+ title: z12.string().min(1),
11420
+ content: z12.string(),
11421
+ sections: z12.array(z12.string().min(1)),
11422
+ estimatedTokens: z12.number().int().nonnegative(),
11423
+ budget: z12.object({
11424
+ tokenBudget: z12.number().int().positive(),
11425
+ truncated: z12.boolean()
11261
11426
  }).optional()
11262
11427
  });
11263
11428
  tasksTraverseParamsSchema = paginationParamsSchema.extend({
11264
- rootId: z11.string().min(1),
11429
+ rootId: z12.string().min(1),
11265
11430
  direction: workGraphTraversalDirectionSchema,
11266
- maxDepth: z11.number().int().nonnegative().optional(),
11267
- includeRelations: z11.boolean().optional()
11431
+ maxDepth: z12.number().int().nonnegative().optional(),
11432
+ includeRelations: z12.boolean().optional()
11268
11433
  });
11269
- tasksTraverseResultSchema = z11.object({
11270
- rootId: z11.string().min(1),
11434
+ tasksTraverseResultSchema = z12.object({
11435
+ rootId: z12.string().min(1),
11271
11436
  direction: workGraphTraversalDirectionSchema,
11272
- nodes: z11.array(workGraphNodeSchema),
11273
- edges: z11.array(workGraphEdgeSchema),
11437
+ nodes: z12.array(workGraphNodeSchema),
11438
+ edges: z12.array(workGraphEdgeSchema),
11274
11439
  pageInfo: workGraphPageInfoSchema
11275
11440
  });
11276
11441
  tasksTreeParamsSchema = paginationParamsSchema.extend({
11277
- rootId: z11.string().min(1),
11278
- maxDepth: z11.number().int().nonnegative().optional()
11442
+ rootId: z12.string().min(1),
11443
+ maxDepth: z12.number().int().nonnegative().optional()
11279
11444
  });
11280
- tasksTreeResultSchema = z11.object({
11281
- rootId: z11.string().min(1),
11282
- nodes: z11.array(workGraphNodeSchema.extend({ depth: z11.number().int().positive() })),
11283
- edges: z11.array(workGraphHierarchyEdgeSchema),
11445
+ tasksTreeResultSchema = z12.object({
11446
+ rootId: z12.string().min(1),
11447
+ nodes: z12.array(workGraphNodeSchema.extend({ depth: z12.number().int().positive() })),
11448
+ edges: z12.array(workGraphHierarchyEdgeSchema),
11284
11449
  pageInfo: workGraphPageInfoSchema
11285
11450
  });
11286
- tasksRollupParamsSchema = z11.object({
11287
- rootId: z11.string().min(1),
11451
+ tasksRollupParamsSchema = z12.object({
11452
+ rootId: z12.string().min(1),
11288
11453
  expectedDirectRollup: workGraphRollupCountsSchema.optional()
11289
11454
  });
11290
- tasksRollupResultSchema = z11.object({
11291
- rootId: z11.string().min(1),
11455
+ tasksRollupResultSchema = z12.object({
11456
+ rootId: z12.string().min(1),
11292
11457
  direct: workGraphRollupCountsSchema,
11293
11458
  subtree: workGraphRollupCountsSchema,
11294
- percentDenominator: z11.object({
11295
- basis: z11.literal("subtree-total"),
11296
- total: z11.number().int().nonnegative(),
11297
- description: z11.string().min(1)
11459
+ percentDenominator: z12.object({
11460
+ basis: z12.literal("subtree-total"),
11461
+ total: z12.number().int().nonnegative(),
11462
+ description: z12.string().min(1)
11298
11463
  }),
11299
11464
  percentages: workGraphSubtreePercentagesSchema,
11300
- staleProjection: z11.boolean(),
11301
- projectionMismatches: z11.array(workGraphProjectionMismatchSchema)
11302
- });
11303
- tasksFrontierParamsSchema = z11.object({
11304
- rootId: z11.string().min(1),
11305
- role: z11.string().min(1).optional()
11306
- });
11307
- tasksFrontierResultSchema = z11.object({
11308
- rootId: z11.string().min(1),
11309
- role: z11.string().min(1).optional(),
11310
- groups: z11.object({
11311
- ready: z11.array(workGraphReadyFrontierTaskSchema),
11312
- blocked: z11.array(workGraphReadyFrontierTaskSchema),
11313
- blockedBy: z11.array(
11314
- z11.discriminatedUnion("kind", [
11315
- z11.object({
11316
- kind: z11.literal("dependency"),
11317
- blockerId: z11.string().min(1),
11318
- blocks: z11.array(z11.string().min(1))
11465
+ staleProjection: z12.boolean(),
11466
+ projectionMismatches: z12.array(workGraphProjectionMismatchSchema)
11467
+ });
11468
+ tasksFrontierParamsSchema = z12.object({
11469
+ rootId: z12.string().min(1),
11470
+ role: z12.string().min(1).optional()
11471
+ });
11472
+ tasksFrontierResultSchema = z12.object({
11473
+ rootId: z12.string().min(1),
11474
+ role: z12.string().min(1).optional(),
11475
+ groups: z12.object({
11476
+ ready: z12.array(workGraphReadyFrontierTaskSchema),
11477
+ blocked: z12.array(workGraphReadyFrontierTaskSchema),
11478
+ blockedBy: z12.array(
11479
+ z12.discriminatedUnion("kind", [
11480
+ z12.object({
11481
+ kind: z12.literal("dependency"),
11482
+ blockerId: z12.string().min(1),
11483
+ blocks: z12.array(z12.string().min(1))
11319
11484
  }),
11320
- z11.object({
11321
- kind: z11.literal("gate"),
11485
+ z12.object({
11486
+ kind: z12.literal("gate"),
11322
11487
  gate: verificationGateSchema,
11323
- blocks: z11.array(z11.string().min(1))
11488
+ blocks: z12.array(z12.string().min(1))
11324
11489
  })
11325
11490
  ])
11326
11491
  )
11327
11492
  })
11328
11493
  });
11329
11494
  tasksWorkGraphAuditParamsSchema = paginationParamsSchema.extend({
11330
- rootId: z11.string().min(1),
11331
- maxDepth: z11.number().int().nonnegative().optional(),
11332
- includeRelations: z11.boolean().optional()
11333
- });
11334
- tasksWorkGraphAuditResultSchema = z11.object({
11335
- rootId: z11.string().min(1),
11336
- hierarchy: z11.object({
11337
- valid: z11.boolean(),
11338
- violations: z11.array(
11339
- z11.object({
11340
- code: z11.literal(E_WORKGRAPH_PARENT_TYPE_MATRIX),
11341
- taskId: z11.string().min(1),
11495
+ rootId: z12.string().min(1),
11496
+ maxDepth: z12.number().int().nonnegative().optional(),
11497
+ includeRelations: z12.boolean().optional()
11498
+ });
11499
+ tasksWorkGraphAuditResultSchema = z12.object({
11500
+ rootId: z12.string().min(1),
11501
+ hierarchy: z12.object({
11502
+ valid: z12.boolean(),
11503
+ violations: z12.array(
11504
+ z12.object({
11505
+ code: z12.literal(E_WORKGRAPH_PARENT_TYPE_MATRIX),
11506
+ taskId: z12.string().min(1),
11342
11507
  taskType: taskTypeSchema,
11343
- parentId: z11.string().min(1).nullable(),
11508
+ parentId: z12.string().min(1).nullable(),
11344
11509
  parentType: taskTypeSchema.optional(),
11345
- message: z11.string().min(1)
11510
+ message: z12.string().min(1)
11346
11511
  })
11347
11512
  )
11348
11513
  }),
11349
11514
  traversal: tasksTraverseResultSchema,
11350
11515
  frontier: tasksFrontierResultSchema,
11351
11516
  rollup: tasksRollupResultSchema,
11352
- relationEdges: z11.object({
11353
- rootId: z11.string().min(1),
11517
+ relationEdges: z12.object({
11518
+ rootId: z12.string().min(1),
11354
11519
  direction: workGraphEdgeDirectionSchema,
11355
- edges: z11.array(
11356
- z11.discriminatedUnion("source", [
11520
+ edges: z12.array(
11521
+ z12.discriminatedUnion("source", [
11357
11522
  workGraphRelationEdgeSchema,
11358
11523
  workGraphDependencyEdgeSchema
11359
11524
  ])
@@ -11372,6 +11537,85 @@ var init_operation_envelope_validation = __esm({
11372
11537
  }
11373
11538
  });
11374
11539
 
11540
+ // packages/contracts/src/operations/ensures-schema-registry.ts
11541
+ import { z as z13 } from "zod";
11542
+ var taskTreeEntrySchema, taskTreeSchema, evidenceSchema, passthroughSchema, LEGACY_PASSTHROUGH_SCHEMA_NAMES, ENSURES_SCHEMA_REGISTRY;
11543
+ var init_ensures_schema_registry = __esm({
11544
+ "packages/contracts/src/operations/ensures-schema-registry.ts"() {
11545
+ "use strict";
11546
+ taskTreeEntrySchema = z13.object({
11547
+ title: z13.string({ message: "title must be a non-empty string" }).refine((s) => s.trim().length > 0, { message: "title must be a non-empty string" }),
11548
+ acceptance: z13.array(z13.unknown(), { message: "must have a non-empty acceptance array" }).min(1, { message: "must have a non-empty acceptance array" }).refine((arr) => arr.some((s) => typeof s === "string" && s.trim().length > 0), {
11549
+ message: "acceptance array contains no non-empty strings"
11550
+ }),
11551
+ id: z13.string().optional(),
11552
+ parentId: z13.string().optional(),
11553
+ depends: z13.array(z13.string()).optional()
11554
+ });
11555
+ taskTreeSchema = z13.array(taskTreeEntrySchema, { message: "task_tree must be a non-empty array" }).min(1, { message: "task_tree is an empty array \u2014 decomposition produced no tasks" });
11556
+ evidenceSchema = z13.unknown().superRefine((value, ctx) => {
11557
+ if (value === null || value === void 0) {
11558
+ ctx.addIssue({
11559
+ code: "custom",
11560
+ message: "evidence must be present (non-null, non-undefined)"
11561
+ });
11562
+ return;
11563
+ }
11564
+ if (typeof value === "string") {
11565
+ if (value.trim().length === 0) {
11566
+ ctx.addIssue({ code: "custom", message: "evidence string must not be empty" });
11567
+ }
11568
+ return;
11569
+ }
11570
+ if (Array.isArray(value)) {
11571
+ if (value.length === 0) {
11572
+ ctx.addIssue({ code: "custom", message: "evidence array must not be empty" });
11573
+ }
11574
+ return;
11575
+ }
11576
+ if (typeof value === "object") {
11577
+ if (Object.keys(value).length === 0) {
11578
+ ctx.addIssue({
11579
+ code: "custom",
11580
+ message: "evidence object must have at least one key (got {})"
11581
+ });
11582
+ }
11583
+ return;
11584
+ }
11585
+ ctx.addIssue({
11586
+ code: "custom",
11587
+ message: `evidence must be a string, array, or object (got ${typeof value})`
11588
+ });
11589
+ });
11590
+ passthroughSchema = z13.unknown();
11591
+ LEGACY_PASSTHROUGH_SCHEMA_NAMES = [
11592
+ // release.cantbook
11593
+ "version_bump_report",
11594
+ "changelog_entry",
11595
+ "publish_report",
11596
+ // rcasd.cantbook
11597
+ "research_summary",
11598
+ "consensus_decision",
11599
+ "architecture_plan",
11600
+ "specification_document",
11601
+ // ivtr.cantbook
11602
+ "implementation_diff",
11603
+ "validation_report",
11604
+ "audit_report",
11605
+ "test_report",
11606
+ "release_confirmation"
11607
+ ];
11608
+ ENSURES_SCHEMA_REGISTRY = new Map([
11609
+ ["task_tree", { name: "task_tree", contextKey: "task_tree", schema: taskTreeSchema }],
11610
+ ["evidence", { name: "evidence", contextKey: "evidence", schema: evidenceSchema }],
11611
+ ...LEGACY_PASSTHROUGH_SCHEMA_NAMES.map((name15) => [
11612
+ name15,
11613
+ { name: name15, contextKey: name15, schema: passthroughSchema }
11614
+ ])
11615
+ ]);
11616
+ }
11617
+ });
11618
+
11375
11619
  // packages/contracts/src/operations/admin.ts
11376
11620
  var init_admin = __esm({
11377
11621
  "packages/contracts/src/operations/admin.ts"() {
@@ -11708,31 +11952,31 @@ var init_peer = __esm({
11708
11952
  });
11709
11953
 
11710
11954
  // packages/contracts/src/release/evidence-atoms.ts
11711
- import { z as z12 } from "zod";
11955
+ import { z as z14 } from "zod";
11712
11956
  var parsedPrEvidenceAtomSchema, prEvidenceStateModifierSchema, ghPrViewSchema, PR_REQUIRED_WORKFLOWS;
11713
11957
  var init_evidence_atoms = __esm({
11714
11958
  "packages/contracts/src/release/evidence-atoms.ts"() {
11715
11959
  "use strict";
11716
- parsedPrEvidenceAtomSchema = z12.object({
11717
- kind: z12.literal("pr"),
11718
- prNumber: z12.number().int().positive()
11719
- });
11720
- prEvidenceStateModifierSchema = z12.object({
11721
- kind: z12.literal("state"),
11722
- value: z12.literal("MERGED")
11723
- });
11724
- ghPrViewSchema = z12.object({
11725
- state: z12.enum(["OPEN", "CLOSED", "MERGED"]),
11726
- mergedAt: z12.string().nullable(),
11727
- headRefOid: z12.string().optional(),
11728
- mergeable: z12.string().optional(),
11729
- statusCheckRollup: z12.array(
11730
- z12.object({
11731
- __typename: z12.string().optional(),
11732
- name: z12.string().optional(),
11733
- workflowName: z12.string().optional(),
11734
- conclusion: z12.string().nullable().optional(),
11735
- status: z12.string().optional()
11960
+ parsedPrEvidenceAtomSchema = z14.object({
11961
+ kind: z14.literal("pr"),
11962
+ prNumber: z14.number().int().positive()
11963
+ });
11964
+ prEvidenceStateModifierSchema = z14.object({
11965
+ kind: z14.literal("state"),
11966
+ value: z14.literal("MERGED")
11967
+ });
11968
+ ghPrViewSchema = z14.object({
11969
+ state: z14.enum(["OPEN", "CLOSED", "MERGED"]),
11970
+ mergedAt: z14.string().nullable(),
11971
+ headRefOid: z14.string().optional(),
11972
+ mergeable: z14.string().optional(),
11973
+ statusCheckRollup: z14.array(
11974
+ z14.object({
11975
+ __typename: z14.string().optional(),
11976
+ name: z14.string().optional(),
11977
+ workflowName: z14.string().optional(),
11978
+ conclusion: z14.string().nullable().optional(),
11979
+ status: z14.string().optional()
11736
11980
  }).passthrough()
11737
11981
  ).optional().default([])
11738
11982
  }).passthrough();
@@ -11745,7 +11989,7 @@ var init_evidence_atoms = __esm({
11745
11989
  });
11746
11990
 
11747
11991
  // packages/contracts/src/release/plan.ts
11748
- import { z as z13 } from "zod";
11992
+ import { z as z15 } from "zod";
11749
11993
  var RELEASE_CHANNEL, RELEASE_SCHEME, RELEASE_KIND, RELEASE_STATUS, GATE_STATUS, GATE_NAME, PLATFORM_TUPLE, PUBLISHER, TASK_KIND, IMPACT, RESOLVED_SOURCE, ReleaseChannelSchema, ReleaseSchemeSchema, ReleaseKindSchema, ReleaseStatusSchema, GateStatusSchema, GateNameSchema, PlatformTupleSchema, PublisherSchema, TaskKindSchema, ImpactSchema, ResolvedSourceSchema, Iso8601, NonEmptyString, ReleasePlanTaskSchema, ReleaseGateSchema, ReleasePlatformMatrixEntrySchema, ReleasePreflightSummarySchema, ReleasePlanChangelogSchema, ReleasePlanMetaSchema, ReleasePlanSchema;
11750
11994
  var init_plan = __esm({
11751
11995
  "packages/contracts/src/release/plan.ts"() {
@@ -11788,20 +12032,20 @@ var init_plan = __esm({
11788
12032
  ];
11789
12033
  IMPACT = ["major", "minor", "patch"];
11790
12034
  RESOLVED_SOURCE = ["project-context", "language-default", "legacy-alias"];
11791
- ReleaseChannelSchema = z13.enum(RELEASE_CHANNEL);
11792
- ReleaseSchemeSchema = z13.enum(RELEASE_SCHEME);
11793
- ReleaseKindSchema = z13.enum(RELEASE_KIND);
11794
- ReleaseStatusSchema = z13.enum(RELEASE_STATUS);
11795
- GateStatusSchema = z13.enum(GATE_STATUS);
11796
- GateNameSchema = z13.enum(GATE_NAME);
11797
- PlatformTupleSchema = z13.enum(PLATFORM_TUPLE);
11798
- PublisherSchema = z13.enum(PUBLISHER);
11799
- TaskKindSchema = z13.enum(TASK_KIND);
11800
- ImpactSchema = z13.enum(IMPACT);
11801
- ResolvedSourceSchema = z13.enum(RESOLVED_SOURCE);
11802
- Iso8601 = z13.iso.datetime({ offset: true });
11803
- NonEmptyString = z13.string().min(1);
11804
- ReleasePlanTaskSchema = z13.object({
12035
+ ReleaseChannelSchema = z15.enum(RELEASE_CHANNEL);
12036
+ ReleaseSchemeSchema = z15.enum(RELEASE_SCHEME);
12037
+ ReleaseKindSchema = z15.enum(RELEASE_KIND);
12038
+ ReleaseStatusSchema = z15.enum(RELEASE_STATUS);
12039
+ GateStatusSchema = z15.enum(GATE_STATUS);
12040
+ GateNameSchema = z15.enum(GATE_NAME);
12041
+ PlatformTupleSchema = z15.enum(PLATFORM_TUPLE);
12042
+ PublisherSchema = z15.enum(PUBLISHER);
12043
+ TaskKindSchema = z15.enum(TASK_KIND);
12044
+ ImpactSchema = z15.enum(IMPACT);
12045
+ ResolvedSourceSchema = z15.enum(RESOLVED_SOURCE);
12046
+ Iso8601 = z15.iso.datetime({ offset: true });
12047
+ NonEmptyString = z15.string().min(1);
12048
+ ReleasePlanTaskSchema = z15.object({
11805
12049
  /** Task ID (e.g. "T10001"). Format intentionally loose so historical IDs validate. */
11806
12050
  id: NonEmptyString,
11807
12051
  /** Conventional-commit-aligned task classification. */
@@ -11809,20 +12053,20 @@ var init_plan = __esm({
11809
12053
  /** SemVer impact classification. */
11810
12054
  impact: ImpactSchema,
11811
12055
  /** Human-readable changelog line for this task. */
11812
- userFacingSummary: z13.string(),
12056
+ userFacingSummary: z15.string(),
11813
12057
  /**
11814
12058
  * ADR-051 evidence atoms attesting the task's gate results. Format is
11815
12059
  * `kind:value` (e.g. `commit:abc123`, `test-run:vitest.json`). The contract
11816
12060
  * accepts empty arrays so legacy plans validate; `cleo release plan`
11817
12061
  * enforces non-empty via R-301.
11818
12062
  */
11819
- evidenceAtoms: z13.array(NonEmptyString),
12063
+ evidenceAtoms: z15.array(NonEmptyString),
11820
12064
  /** IVTR phase at plan time — informational only per R-316. */
11821
- ivtrPhaseAtPlan: z13.string().optional(),
12065
+ ivtrPhaseAtPlan: z15.string().optional(),
11822
12066
  /** Epic this task rolls up to, locked at plan time per R-303. */
11823
12067
  epicAncestor: NonEmptyString
11824
12068
  });
11825
- ReleaseGateSchema = z13.object({
12069
+ ReleaseGateSchema = z15.object({
11826
12070
  /** Canonical gate name. */
11827
12071
  name: GateNameSchema,
11828
12072
  /** ADR-051 atom string identifying the resolved tool (e.g. `tool:test`). */
@@ -11832,11 +12076,11 @@ var init_plan = __esm({
11832
12076
  /** ISO-8601 timestamp the gate was last verified. */
11833
12077
  lastVerifiedAt: Iso8601,
11834
12078
  /** Resolved shell command (e.g. `pnpm run test`). Optional for unresolved gates. */
11835
- resolvedCommand: z13.string().optional(),
12079
+ resolvedCommand: z15.string().optional(),
11836
12080
  /** Provenance of the resolved command. Optional for unresolved gates. */
11837
12081
  resolvedSource: ResolvedSourceSchema.optional()
11838
12082
  });
11839
- ReleasePlatformMatrixEntrySchema = z13.object({
12083
+ ReleasePlatformMatrixEntrySchema = z15.object({
11840
12084
  /** Target platform tuple. */
11841
12085
  platform: PlatformTupleSchema,
11842
12086
  /** Distribution backend. */
@@ -11844,47 +12088,47 @@ var init_plan = __esm({
11844
12088
  /** Package identifier on the target backend (e.g. `@cleocode/cleo`). */
11845
12089
  package: NonEmptyString,
11846
12090
  /** Whether to run the GHA smoke job for this matrix entry. */
11847
- smoke: z13.boolean().default(true).optional()
12091
+ smoke: z15.boolean().default(true).optional()
11848
12092
  });
11849
- ReleasePreflightSummarySchema = z13.object({
12093
+ ReleasePreflightSummarySchema = z15.object({
11850
12094
  /** True if esbuild externals are out of sync with package.json. */
11851
- esbuildExternalsDrift: z13.boolean(),
12095
+ esbuildExternalsDrift: z15.boolean(),
11852
12096
  /** True if `pnpm-lock.yaml` diverges from the workspace manifest. */
11853
- lockfileDrift: z13.boolean(),
12097
+ lockfileDrift: z15.boolean(),
11854
12098
  /** True if all epic children are in terminal lifecycle states. */
11855
- epicCompletenessClean: z13.boolean(),
12099
+ epicCompletenessClean: z15.boolean(),
11856
12100
  /** True if no task appears in multiple in-flight release plans. */
11857
- doubleListingClean: z13.boolean(),
12101
+ doubleListingClean: z15.boolean(),
11858
12102
  /** Non-fatal preflight warnings (e.g. unresolved tools per R-024). */
11859
- preflightWarnings: z13.array(z13.string()).default([]).optional()
12103
+ preflightWarnings: z15.array(z15.string()).default([]).optional()
11860
12104
  });
11861
- ReleasePlanChangelogSchema = z13.object({
12105
+ ReleasePlanChangelogSchema = z15.object({
11862
12106
  /** `kind=feat` tasks. */
11863
- features: z13.array(NonEmptyString).default([]),
12107
+ features: z15.array(NonEmptyString).default([]),
11864
12108
  /** `kind=fix` or `kind=hotfix` tasks. */
11865
- fixes: z13.array(NonEmptyString).default([]),
12109
+ fixes: z15.array(NonEmptyString).default([]),
11866
12110
  /** `kind=chore`, `docs`, `refactor`, `test`, `perf` tasks. */
11867
- chores: z13.array(NonEmptyString).default([]),
12111
+ chores: z15.array(NonEmptyString).default([]),
11868
12112
  /** `kind=breaking` or `kind=revert` tasks. */
11869
- breaking: z13.array(NonEmptyString).default([])
12113
+ breaking: z15.array(NonEmptyString).default([])
11870
12114
  });
11871
- ReleasePlanMetaSchema = z13.object({
12115
+ ReleasePlanMetaSchema = z15.object({
11872
12116
  /** True if this is the project's first ever release. */
11873
- firstEverRelease: z13.boolean().optional(),
12117
+ firstEverRelease: z15.boolean().optional(),
11874
12118
  /** Canonical tool names that could not be resolved at plan time. */
11875
- unresolvedTools: z13.array(z13.string()).optional(),
12119
+ unresolvedTools: z15.array(z15.string()).optional(),
11876
12120
  /** Project archetype detected at plan time. */
11877
- archetype: z13.string().optional()
11878
- }).catchall(z13.unknown());
11879
- ReleasePlanSchema = z13.object({
12121
+ archetype: z15.string().optional()
12122
+ }).catchall(z15.unknown());
12123
+ ReleasePlanSchema = z15.object({
11880
12124
  /** Schema URL for this plan version. */
11881
- $schema: z13.string().optional(),
12125
+ $schema: z15.string().optional(),
11882
12126
  /** Requested version string (e.g. "v2026.6.0"). Includes the leading `v`. */
11883
12127
  version: NonEmptyString,
11884
12128
  /** Resolved version string after suffix application (e.g. "v2026.6.0.2"). */
11885
12129
  resolvedVersion: NonEmptyString,
11886
12130
  /** True if a `calver-suffix` was applied to disambiguate a same-day hotfix. */
11887
- suffixApplied: z13.boolean(),
12131
+ suffixApplied: z15.boolean(),
11888
12132
  /** Versioning scheme governing `version` / `resolvedVersion`. */
11889
12133
  scheme: ReleaseSchemeSchema,
11890
12134
  /** npm dist-tag channel for this release. */
@@ -11901,27 +12145,27 @@ var init_plan = __esm({
11901
12145
  * Version of the previous release on the same channel. MUST be `null` only
11902
12146
  * for first-ever releases (R-300, enforced at the verb layer).
11903
12147
  */
11904
- previousVersion: z13.string().nullable(),
12148
+ previousVersion: z15.string().nullable(),
11905
12149
  /** Git tag of the previous release (typically `previousVersion` prefixed). */
11906
- previousTag: z13.string().nullable(),
12150
+ previousTag: z15.string().nullable(),
11907
12151
  /** ISO-8601 timestamp the previous release was published. */
11908
12152
  previousShippedAt: Iso8601.nullable(),
11909
12153
  /** Tasks rolled into this release. */
11910
- tasks: z13.array(ReleasePlanTaskSchema),
12154
+ tasks: z15.array(ReleasePlanTaskSchema),
11911
12155
  /** Bucketed changelog. */
11912
12156
  changelog: ReleasePlanChangelogSchema,
11913
12157
  /** Per-gate verification status. */
11914
- gates: z13.array(ReleaseGateSchema),
12158
+ gates: z15.array(ReleaseGateSchema),
11915
12159
  /** Platform / publisher matrix. */
11916
- platformMatrix: z13.array(ReleasePlatformMatrixEntrySchema),
12160
+ platformMatrix: z15.array(ReleasePlatformMatrixEntrySchema),
11917
12161
  /** Preflight summary from `cleo release plan`. */
11918
12162
  preflightSummary: ReleasePreflightSummarySchema,
11919
12163
  /** URL of the GHA workflow run (populated by `release-prepare.yml`). */
11920
- workflowRunUrl: z13.string().nullable(),
12164
+ workflowRunUrl: z15.string().nullable(),
11921
12165
  /** URL of the bump PR (populated by `cleo release open`). */
11922
- prUrl: z13.string().nullable(),
12166
+ prUrl: z15.string().nullable(),
11923
12167
  /** Merge commit SHA on `main` (populated by `release-publish.yml`). */
11924
- mergeCommitSha: z13.string().nullable(),
12168
+ mergeCommitSha: z15.string().nullable(),
11925
12169
  /** Current FSM state per R-302. */
11926
12170
  status: ReleaseStatusSchema,
11927
12171
  /** Informational / forward-compat metadata. */
@@ -11977,52 +12221,52 @@ var init_session2 = __esm({
11977
12221
  });
11978
12222
 
11979
12223
  // packages/contracts/src/session-journal.ts
11980
- import { z as z14 } from "zod";
12224
+ import { z as z16 } from "zod";
11981
12225
  var SESSION_JOURNAL_SCHEMA_VERSION, sessionJournalDoctorSummarySchema, sessionJournalDebriefSummarySchema, sessionJournalEntrySchema;
11982
12226
  var init_session_journal = __esm({
11983
12227
  "packages/contracts/src/session-journal.ts"() {
11984
12228
  "use strict";
11985
12229
  SESSION_JOURNAL_SCHEMA_VERSION = "1.0";
11986
- sessionJournalDoctorSummarySchema = z14.object({
12230
+ sessionJournalDoctorSummarySchema = z16.object({
11987
12231
  /** `true` when zero noise patterns were detected. */
11988
- isClean: z14.boolean(),
12232
+ isClean: z16.boolean(),
11989
12233
  /** Total number of noise findings across all patterns. */
11990
- findingsCount: z14.number().int().nonnegative(),
12234
+ findingsCount: z16.number().int().nonnegative(),
11991
12235
  /** Pattern names that were detected (empty when isClean). */
11992
- patterns: z14.array(z14.string()),
12236
+ patterns: z16.array(z16.string()),
11993
12237
  /** Total brain entries scanned. `0` = empty or unavailable. */
11994
- totalScanned: z14.number().int().nonnegative()
12238
+ totalScanned: z16.number().int().nonnegative()
11995
12239
  });
11996
- sessionJournalDebriefSummarySchema = z14.object({
12240
+ sessionJournalDebriefSummarySchema = z16.object({
11997
12241
  /** First 200 characters of the session end note (if provided). */
11998
- noteExcerpt: z14.string().max(200).optional(),
12242
+ noteExcerpt: z16.string().max(200).optional(),
11999
12243
  /** Number of tasks completed during the session. */
12000
- tasksCompletedCount: z14.number().int().nonnegative(),
12244
+ tasksCompletedCount: z16.number().int().nonnegative(),
12001
12245
  /** Up to 5 task IDs (not titles) that were the focus of the session. */
12002
- tasksFocused: z14.array(z14.string()).max(5).optional()
12246
+ tasksFocused: z16.array(z16.string()).max(5).optional()
12003
12247
  });
12004
- sessionJournalEntrySchema = z14.object({
12248
+ sessionJournalEntrySchema = z16.object({
12005
12249
  // Identity
12006
12250
  /** Schema version for forward-compatibility. Always `'1.0'` in this release. */
12007
- schemaVersion: z14.literal(SESSION_JOURNAL_SCHEMA_VERSION),
12251
+ schemaVersion: z16.literal(SESSION_JOURNAL_SCHEMA_VERSION),
12008
12252
  /** ISO 8601 timestamp when the entry was written. */
12009
- timestamp: z14.string(),
12253
+ timestamp: z16.string(),
12010
12254
  /** CLEO session ID (e.g. `ses_20260424055456_ede571`). */
12011
- sessionId: z14.string(),
12255
+ sessionId: z16.string(),
12012
12256
  /** Event type that triggered this journal entry. */
12013
- eventType: z14.enum(["session_start", "session_end", "observation", "decision", "error"]),
12257
+ eventType: z16.enum(["session_start", "session_end", "observation", "decision", "error"]),
12014
12258
  // Session metadata (set on session_start / session_end)
12015
12259
  /** Agent identifier (e.g. `cleo-prime`, `claude-code`). */
12016
- agentIdentifier: z14.string().optional(),
12260
+ agentIdentifier: z16.string().optional(),
12017
12261
  /** Provider adapter ID active for this session. */
12018
- providerId: z14.string().optional(),
12262
+ providerId: z16.string().optional(),
12019
12263
  /** Session scope string (e.g. `'global'` or `'epic:T1263'`). */
12020
- scope: z14.string().optional(),
12264
+ scope: z16.string().optional(),
12021
12265
  // Session-end fields
12022
12266
  /** Duration of the session in seconds (session_end only). */
12023
- duration: z14.number().int().nonnegative().optional(),
12267
+ duration: z16.number().int().nonnegative().optional(),
12024
12268
  /** Task IDs (not titles) completed during the session. */
12025
- tasksCompleted: z14.array(z14.string()).optional(),
12269
+ tasksCompleted: z16.array(z16.string()).optional(),
12026
12270
  // Doctor summary (T1262 absorbed)
12027
12271
  /** Compact result of `scanBrainNoise` run at session-end. */
12028
12272
  doctorSummary: sessionJournalDoctorSummarySchema.optional(),
@@ -12031,7 +12275,7 @@ var init_session_journal = __esm({
12031
12275
  debriefSummary: sessionJournalDebriefSummarySchema.optional(),
12032
12276
  // Optional hash chain
12033
12277
  /** SHA-256 hex of the previous entry's raw JSON string (for integrity chain). */
12034
- prevEntryHash: z14.string().optional()
12278
+ prevEntryHash: z16.string().optional()
12035
12279
  });
12036
12280
  }
12037
12281
  });
@@ -12044,52 +12288,52 @@ var init_task = __esm({
12044
12288
  });
12045
12289
 
12046
12290
  // packages/contracts/src/task-evidence.ts
12047
- import { z as z15 } from "zod";
12291
+ import { z as z17 } from "zod";
12048
12292
  var fileEvidenceSchema, logEvidenceSchema, screenshotEvidenceSchema, testOutputEvidenceSchema, commandOutputEvidenceSchema, taskEvidenceSchema;
12049
12293
  var init_task_evidence = __esm({
12050
12294
  "packages/contracts/src/task-evidence.ts"() {
12051
12295
  "use strict";
12052
- fileEvidenceSchema = z15.object({
12053
- kind: z15.literal("file"),
12054
- sha256: z15.string().length(64),
12055
- timestamp: z15.string().datetime(),
12056
- path: z15.string().min(1),
12057
- mime: z15.string().optional(),
12058
- description: z15.string().optional()
12059
- });
12060
- logEvidenceSchema = z15.object({
12061
- kind: z15.literal("log"),
12062
- sha256: z15.string().length(64),
12063
- timestamp: z15.string().datetime(),
12064
- source: z15.string().min(1),
12065
- description: z15.string().optional()
12066
- });
12067
- screenshotEvidenceSchema = z15.object({
12068
- kind: z15.literal("screenshot"),
12069
- sha256: z15.string().length(64),
12070
- timestamp: z15.string().datetime(),
12071
- mime: z15.enum(["image/png", "image/jpeg", "image/webp"]).optional(),
12072
- description: z15.string().optional()
12073
- });
12074
- testOutputEvidenceSchema = z15.object({
12075
- kind: z15.literal("test-output"),
12076
- sha256: z15.string().length(64),
12077
- timestamp: z15.string().datetime(),
12078
- passed: z15.number().int().nonnegative(),
12079
- failed: z15.number().int().nonnegative(),
12080
- skipped: z15.number().int().nonnegative(),
12081
- exitCode: z15.number().int(),
12082
- description: z15.string().optional()
12083
- });
12084
- commandOutputEvidenceSchema = z15.object({
12085
- kind: z15.literal("command-output"),
12086
- sha256: z15.string().length(64),
12087
- timestamp: z15.string().datetime(),
12088
- cmd: z15.string().min(1),
12089
- exitCode: z15.number().int(),
12090
- description: z15.string().optional()
12091
- });
12092
- taskEvidenceSchema = z15.discriminatedUnion("kind", [
12296
+ fileEvidenceSchema = z17.object({
12297
+ kind: z17.literal("file"),
12298
+ sha256: z17.string().length(64),
12299
+ timestamp: z17.string().datetime(),
12300
+ path: z17.string().min(1),
12301
+ mime: z17.string().optional(),
12302
+ description: z17.string().optional()
12303
+ });
12304
+ logEvidenceSchema = z17.object({
12305
+ kind: z17.literal("log"),
12306
+ sha256: z17.string().length(64),
12307
+ timestamp: z17.string().datetime(),
12308
+ source: z17.string().min(1),
12309
+ description: z17.string().optional()
12310
+ });
12311
+ screenshotEvidenceSchema = z17.object({
12312
+ kind: z17.literal("screenshot"),
12313
+ sha256: z17.string().length(64),
12314
+ timestamp: z17.string().datetime(),
12315
+ mime: z17.enum(["image/png", "image/jpeg", "image/webp"]).optional(),
12316
+ description: z17.string().optional()
12317
+ });
12318
+ testOutputEvidenceSchema = z17.object({
12319
+ kind: z17.literal("test-output"),
12320
+ sha256: z17.string().length(64),
12321
+ timestamp: z17.string().datetime(),
12322
+ passed: z17.number().int().nonnegative(),
12323
+ failed: z17.number().int().nonnegative(),
12324
+ skipped: z17.number().int().nonnegative(),
12325
+ exitCode: z17.number().int(),
12326
+ description: z17.string().optional()
12327
+ });
12328
+ commandOutputEvidenceSchema = z17.object({
12329
+ kind: z17.literal("command-output"),
12330
+ sha256: z17.string().length(64),
12331
+ timestamp: z17.string().datetime(),
12332
+ cmd: z17.string().min(1),
12333
+ exitCode: z17.number().int(),
12334
+ description: z17.string().optional()
12335
+ });
12336
+ taskEvidenceSchema = z17.discriminatedUnion("kind", [
12093
12337
  fileEvidenceSchema,
12094
12338
  logEvidenceSchema,
12095
12339
  screenshotEvidenceSchema,
@@ -12100,12 +12344,12 @@ var init_task_evidence = __esm({
12100
12344
  });
12101
12345
 
12102
12346
  // packages/contracts/src/tasks/archive.ts
12103
- import { z as z16 } from "zod";
12347
+ import { z as z18 } from "zod";
12104
12348
  var ArchiveReason, ARCHIVE_REASON_VALUES;
12105
12349
  var init_archive = __esm({
12106
12350
  "packages/contracts/src/tasks/archive.ts"() {
12107
12351
  "use strict";
12108
- ArchiveReason = z16.enum([
12352
+ ArchiveReason = z18.enum([
12109
12353
  "verified",
12110
12354
  "reconciled",
12111
12355
  "superseded",
@@ -12118,47 +12362,47 @@ var init_archive = __esm({
12118
12362
  });
12119
12363
 
12120
12364
  // packages/contracts/src/tasks.ts
12121
- import { z as z17 } from "zod";
12365
+ import { z as z19 } from "zod";
12122
12366
  var taskMutationWarningSeveritySchema, taskMutationWarningSchema, taskMutationDryRunSummarySchema, taskMutationTaskRecordSchema, taskMutationEnvelopeSchema, completionTaskStatusSchema, completionCriterionKindSchema, completionCriterionStatusSchema, completionBlockerReasonSchema, completionStaleReasonSchema, completionProjectionRepairErrorCodeSchema, completionCriterionWaiverSchema, completionCriterionReplacementSchema, completionCriterionEvaluationSchema, unsatisfiedCompletionCriterionSchema, completionTotalsSchema, completionContextPackSchema, completionEvaluationSchema, completionExplanationSchema, completionListParamsSchema, completionListResultSchema, completionEvaluateParamsSchema, completionProjectionRepairErrorSchema, completionProjectionRepairParamsSchema, completionProjectionRepairResultSchema;
12123
12367
  var init_tasks2 = __esm({
12124
12368
  "packages/contracts/src/tasks.ts"() {
12125
12369
  "use strict";
12126
12370
  init_status_registry();
12127
- taskMutationWarningSeveritySchema = z17.enum(["info", "warning"]);
12128
- taskMutationWarningSchema = z17.object({
12129
- code: z17.string().min(1),
12130
- message: z17.string().min(1),
12371
+ taskMutationWarningSeveritySchema = z19.enum(["info", "warning"]);
12372
+ taskMutationWarningSchema = z19.object({
12373
+ code: z19.string().min(1),
12374
+ message: z19.string().min(1),
12131
12375
  severity: taskMutationWarningSeveritySchema.optional(),
12132
- taskId: z17.string().min(1).optional(),
12133
- field: z17.string().min(1).optional(),
12134
- index: z17.number().int().nonnegative().optional()
12135
- });
12136
- taskMutationDryRunSummarySchema = z17.object({
12137
- dryRun: z17.literal(true),
12138
- wouldCreate: z17.number().int().nonnegative(),
12139
- wouldUpdate: z17.number().int().nonnegative(),
12140
- wouldDelete: z17.number().int().nonnegative(),
12141
- wouldAffect: z17.number().int().nonnegative(),
12142
- validatedCount: z17.number().int().nonnegative(),
12143
- insertedCount: z17.literal(0),
12144
- updatedCount: z17.literal(0),
12145
- deletedCount: z17.literal(0),
12146
- warnings: z17.array(taskMutationWarningSchema)
12147
- });
12148
- taskMutationTaskRecordSchema = z17.object({ id: z17.string().min(1) }).passthrough();
12149
- taskMutationEnvelopeSchema = z17.object({
12150
- dryRun: z17.boolean().optional(),
12151
- created: z17.array(taskMutationTaskRecordSchema),
12152
- updated: z17.array(taskMutationTaskRecordSchema),
12153
- deleted: z17.array(taskMutationTaskRecordSchema),
12154
- affectedCount: z17.number().int().nonnegative(),
12155
- mutationWarnings: z17.array(taskMutationWarningSchema),
12376
+ taskId: z19.string().min(1).optional(),
12377
+ field: z19.string().min(1).optional(),
12378
+ index: z19.number().int().nonnegative().optional()
12379
+ });
12380
+ taskMutationDryRunSummarySchema = z19.object({
12381
+ dryRun: z19.literal(true),
12382
+ wouldCreate: z19.number().int().nonnegative(),
12383
+ wouldUpdate: z19.number().int().nonnegative(),
12384
+ wouldDelete: z19.number().int().nonnegative(),
12385
+ wouldAffect: z19.number().int().nonnegative(),
12386
+ validatedCount: z19.number().int().nonnegative(),
12387
+ insertedCount: z19.literal(0),
12388
+ updatedCount: z19.literal(0),
12389
+ deletedCount: z19.literal(0),
12390
+ warnings: z19.array(taskMutationWarningSchema)
12391
+ });
12392
+ taskMutationTaskRecordSchema = z19.object({ id: z19.string().min(1) }).passthrough();
12393
+ taskMutationEnvelopeSchema = z19.object({
12394
+ dryRun: z19.boolean().optional(),
12395
+ created: z19.array(taskMutationTaskRecordSchema),
12396
+ updated: z19.array(taskMutationTaskRecordSchema),
12397
+ deleted: z19.array(taskMutationTaskRecordSchema),
12398
+ affectedCount: z19.number().int().nonnegative(),
12399
+ mutationWarnings: z19.array(taskMutationWarningSchema),
12156
12400
  dryRunSummary: taskMutationDryRunSummarySchema.optional()
12157
12401
  });
12158
- completionTaskStatusSchema = z17.enum(TASK_STATUSES);
12159
- completionCriterionKindSchema = z17.enum(["text", "evidence_bound", "child_task"]);
12160
- completionCriterionStatusSchema = z17.enum(["satisfied", "unsatisfied", "waived", "replaced"]);
12161
- completionBlockerReasonSchema = z17.enum([
12402
+ completionTaskStatusSchema = z19.enum(TASK_STATUSES);
12403
+ completionCriterionKindSchema = z19.enum(["text", "evidence_bound", "child_task"]);
12404
+ completionCriterionStatusSchema = z19.enum(["satisfied", "unsatisfied", "waived", "replaced"]);
12405
+ completionBlockerReasonSchema = z19.enum([
12162
12406
  "missing_evidence_binding",
12163
12407
  "child_not_done",
12164
12408
  "child_cancelled_requires_waiver",
@@ -12166,68 +12410,68 @@ var init_tasks2 = __esm({
12166
12410
  "child_missing",
12167
12411
  "done_parent_stale"
12168
12412
  ]);
12169
- completionStaleReasonSchema = z17.enum(["done_parent_has_unsatisfied_criteria"]);
12170
- completionProjectionRepairErrorCodeSchema = z17.enum([
12413
+ completionStaleReasonSchema = z19.enum(["done_parent_has_unsatisfied_criteria"]);
12414
+ completionProjectionRepairErrorCodeSchema = z19.enum([
12171
12415
  "projection_not_stale",
12172
12416
  "criteria_missing",
12173
12417
  "binding_target_missing",
12174
12418
  "repair_conflict"
12175
12419
  ]);
12176
- completionCriterionWaiverSchema = z17.object({
12177
- criterionAcId: z17.string().min(1),
12178
- childTaskId: z17.string().min(1),
12179
- reason: z17.string().min(1),
12180
- actor: z17.string().min(1),
12181
- waivedAt: z17.string().min(1)
12182
- });
12183
- completionCriterionReplacementSchema = z17.object({
12184
- criterionAcId: z17.string().min(1),
12185
- originalChildTaskId: z17.string().min(1),
12186
- replacementChildTaskId: z17.string().min(1),
12187
- reason: z17.string().min(1),
12188
- actor: z17.string().min(1),
12189
- replacedAt: z17.string().min(1)
12190
- });
12191
- completionCriterionEvaluationSchema = z17.object({
12192
- acId: z17.string().min(1),
12193
- alias: z17.string().min(1),
12194
- text: z17.string(),
12420
+ completionCriterionWaiverSchema = z19.object({
12421
+ criterionAcId: z19.string().min(1),
12422
+ childTaskId: z19.string().min(1),
12423
+ reason: z19.string().min(1),
12424
+ actor: z19.string().min(1),
12425
+ waivedAt: z19.string().min(1)
12426
+ });
12427
+ completionCriterionReplacementSchema = z19.object({
12428
+ criterionAcId: z19.string().min(1),
12429
+ originalChildTaskId: z19.string().min(1),
12430
+ replacementChildTaskId: z19.string().min(1),
12431
+ reason: z19.string().min(1),
12432
+ actor: z19.string().min(1),
12433
+ replacedAt: z19.string().min(1)
12434
+ });
12435
+ completionCriterionEvaluationSchema = z19.object({
12436
+ acId: z19.string().min(1),
12437
+ alias: z19.string().min(1),
12438
+ text: z19.string(),
12195
12439
  kind: completionCriterionKindSchema,
12196
12440
  status: completionCriterionStatusSchema,
12197
12441
  reason: completionBlockerReasonSchema.optional(),
12198
- targetTaskId: z17.string().min(1).optional(),
12442
+ targetTaskId: z19.string().min(1).optional(),
12199
12443
  targetTaskStatus: completionTaskStatusSchema.optional(),
12200
12444
  waiver: completionCriterionWaiverSchema.optional(),
12201
12445
  replacement: completionCriterionReplacementSchema.optional(),
12202
12446
  replacementTaskStatus: completionTaskStatusSchema.optional(),
12203
- evidenceBindings: z17.number().int().nonnegative()
12447
+ evidenceBindings: z19.number().int().nonnegative()
12204
12448
  });
12205
12449
  unsatisfiedCompletionCriterionSchema = completionCriterionEvaluationSchema.extend({
12206
- status: z17.literal("unsatisfied"),
12450
+ status: z19.literal("unsatisfied"),
12207
12451
  reason: completionBlockerReasonSchema
12208
12452
  });
12209
- completionTotalsSchema = z17.object({
12210
- criteria: z17.number().int().nonnegative(),
12211
- satisfied: z17.number().int().nonnegative(),
12212
- unsatisfied: z17.number().int().nonnegative(),
12213
- waived: z17.number().int().nonnegative(),
12214
- replaced: z17.number().int().nonnegative()
12215
- });
12216
- completionContextPackSchema = z17.object({
12217
- taskId: z17.string().min(1),
12218
- generatedAt: z17.string().min(1),
12219
- source: z17.literal("audit_log"),
12220
- window: z17.object({
12221
- limit: z17.number().int().positive(),
12222
- since: z17.string().min(1).optional(),
12223
- relationDepth: z17.number().int().nonnegative(),
12224
- relatedTaskIds: z17.array(z17.string().min(1))
12453
+ completionTotalsSchema = z19.object({
12454
+ criteria: z19.number().int().nonnegative(),
12455
+ satisfied: z19.number().int().nonnegative(),
12456
+ unsatisfied: z19.number().int().nonnegative(),
12457
+ waived: z19.number().int().nonnegative(),
12458
+ replaced: z19.number().int().nonnegative()
12459
+ });
12460
+ completionContextPackSchema = z19.object({
12461
+ taskId: z19.string().min(1),
12462
+ generatedAt: z19.string().min(1),
12463
+ source: z19.literal("audit_log"),
12464
+ window: z19.object({
12465
+ limit: z19.number().int().positive(),
12466
+ since: z19.string().min(1).optional(),
12467
+ relationDepth: z19.number().int().nonnegative(),
12468
+ relatedTaskIds: z19.array(z19.string().min(1))
12225
12469
  }),
12226
- events: z17.array(
12227
- z17.object({
12228
- id: z17.string().min(1),
12229
- timestamp: z17.string().min(1),
12230
- action: z17.enum([
12470
+ events: z19.array(
12471
+ z19.object({
12472
+ id: z19.string().min(1),
12473
+ timestamp: z19.string().min(1),
12474
+ action: z19.enum([
12231
12475
  "task_completed",
12232
12476
  "task_reopened",
12233
12477
  "task_cancelled",
@@ -12235,77 +12479,77 @@ var init_tasks2 = __esm({
12235
12479
  "task_reparented",
12236
12480
  "ac_projection_rebuilt"
12237
12481
  ]),
12238
- taskId: z17.string().min(1),
12239
- relation: z17.enum(["self", "parent", "child", "sibling", "related"]),
12240
- actor: z17.string().min(1),
12241
- details: z17.record(z17.string(), z17.unknown()).optional(),
12242
- before: z17.record(z17.string(), z17.unknown()).optional(),
12243
- after: z17.record(z17.string(), z17.unknown()).optional()
12482
+ taskId: z19.string().min(1),
12483
+ relation: z19.enum(["self", "parent", "child", "sibling", "related"]),
12484
+ actor: z19.string().min(1),
12485
+ details: z19.record(z19.string(), z19.unknown()).optional(),
12486
+ before: z19.record(z19.string(), z19.unknown()).optional(),
12487
+ after: z19.record(z19.string(), z19.unknown()).optional()
12244
12488
  })
12245
12489
  ),
12246
- summary: z17.object({
12247
- totalEvents: z17.number().int().nonnegative(),
12248
- byAction: z17.record(z17.string(), z17.number().int().nonnegative()),
12249
- byRelation: z17.record(z17.string(), z17.number().int().nonnegative()),
12250
- latestEventAt: z17.string().nullable()
12490
+ summary: z19.object({
12491
+ totalEvents: z19.number().int().nonnegative(),
12492
+ byAction: z19.record(z19.string(), z19.number().int().nonnegative()),
12493
+ byRelation: z19.record(z19.string(), z19.number().int().nonnegative()),
12494
+ latestEventAt: z19.string().nullable()
12251
12495
  })
12252
12496
  });
12253
- completionEvaluationSchema = z17.object({
12254
- taskId: z17.string().min(1),
12497
+ completionEvaluationSchema = z19.object({
12498
+ taskId: z19.string().min(1),
12255
12499
  taskStatus: completionTaskStatusSchema,
12256
- ready: z17.boolean(),
12257
- stale: z17.boolean(),
12258
- staleReasons: z17.array(completionStaleReasonSchema),
12500
+ ready: z19.boolean(),
12501
+ stale: z19.boolean(),
12502
+ staleReasons: z19.array(completionStaleReasonSchema),
12259
12503
  contextPack: completionContextPackSchema.optional(),
12260
- satisfied: z17.array(completionCriterionEvaluationSchema),
12261
- unsatisfied: z17.array(unsatisfiedCompletionCriterionSchema),
12262
- waived: z17.array(completionCriterionEvaluationSchema),
12263
- replaced: z17.array(completionCriterionEvaluationSchema),
12504
+ satisfied: z19.array(completionCriterionEvaluationSchema),
12505
+ unsatisfied: z19.array(unsatisfiedCompletionCriterionSchema),
12506
+ waived: z19.array(completionCriterionEvaluationSchema),
12507
+ replaced: z19.array(completionCriterionEvaluationSchema),
12264
12508
  totals: completionTotalsSchema
12265
12509
  });
12266
- completionExplanationSchema = z17.object({
12267
- taskId: z17.string().min(1),
12268
- ready: z17.boolean(),
12269
- stale: z17.boolean(),
12270
- summary: z17.string(),
12510
+ completionExplanationSchema = z19.object({
12511
+ taskId: z19.string().min(1),
12512
+ ready: z19.boolean(),
12513
+ stale: z19.boolean(),
12514
+ summary: z19.string(),
12271
12515
  contextPack: completionContextPackSchema.optional(),
12272
- blockers: z17.array(completionCriterionEvaluationSchema)
12516
+ blockers: z19.array(completionCriterionEvaluationSchema)
12273
12517
  });
12274
- completionListParamsSchema = z17.object({
12275
- taskId: z17.string().min(1),
12518
+ completionListParamsSchema = z19.object({
12519
+ taskId: z19.string().min(1),
12276
12520
  status: completionCriterionStatusSchema.optional(),
12277
12521
  kind: completionCriterionKindSchema.optional()
12278
12522
  });
12279
- completionListResultSchema = z17.object({
12280
- taskId: z17.string().min(1),
12281
- criteria: z17.array(completionCriterionEvaluationSchema),
12523
+ completionListResultSchema = z19.object({
12524
+ taskId: z19.string().min(1),
12525
+ criteria: z19.array(completionCriterionEvaluationSchema),
12282
12526
  totals: completionTotalsSchema
12283
12527
  });
12284
- completionEvaluateParamsSchema = z17.object({
12285
- taskId: z17.string().min(1),
12286
- includeContext: z17.boolean().optional(),
12287
- limit: z17.number().int().positive().optional(),
12288
- since: z17.string().min(1).optional(),
12289
- relationDepth: z17.number().int().nonnegative().optional()
12528
+ completionEvaluateParamsSchema = z19.object({
12529
+ taskId: z19.string().min(1),
12530
+ includeContext: z19.boolean().optional(),
12531
+ limit: z19.number().int().positive().optional(),
12532
+ since: z19.string().min(1).optional(),
12533
+ relationDepth: z19.number().int().nonnegative().optional()
12290
12534
  });
12291
- completionProjectionRepairErrorSchema = z17.object({
12535
+ completionProjectionRepairErrorSchema = z19.object({
12292
12536
  code: completionProjectionRepairErrorCodeSchema,
12293
- message: z17.string().min(1),
12294
- taskId: z17.string().min(1),
12295
- acId: z17.string().min(1).optional(),
12296
- evidenceAtomId: z17.string().min(1).optional()
12537
+ message: z19.string().min(1),
12538
+ taskId: z19.string().min(1),
12539
+ acId: z19.string().min(1).optional(),
12540
+ evidenceAtomId: z19.string().min(1).optional()
12297
12541
  });
12298
- completionProjectionRepairParamsSchema = z17.object({
12299
- taskId: z17.string().min(1),
12300
- dryRun: z17.boolean().optional()
12542
+ completionProjectionRepairParamsSchema = z19.object({
12543
+ taskId: z19.string().min(1),
12544
+ dryRun: z19.boolean().optional()
12301
12545
  });
12302
- completionProjectionRepairResultSchema = z17.object({
12303
- taskId: z17.string().min(1),
12304
- repaired: z17.boolean(),
12305
- dryRun: z17.boolean(),
12306
- staleBefore: z17.boolean(),
12307
- staleAfter: z17.boolean(),
12308
- errors: z17.array(completionProjectionRepairErrorSchema)
12546
+ completionProjectionRepairResultSchema = z19.object({
12547
+ taskId: z19.string().min(1),
12548
+ repaired: z19.boolean(),
12549
+ dryRun: z19.boolean(),
12550
+ staleBefore: z19.boolean(),
12551
+ staleAfter: z19.boolean(),
12552
+ errors: z19.array(completionProjectionRepairErrorSchema)
12309
12553
  });
12310
12554
  }
12311
12555
  });
@@ -12816,7 +13060,7 @@ var init_taxonomy = __esm({
12816
13060
  });
12817
13061
 
12818
13062
  // packages/contracts/src/templates/manifest.ts
12819
- import { z as z18 } from "zod";
13063
+ import { z as z20 } from "zod";
12820
13064
  var TEMPLATE_KINDS, TEMPLATE_SUBSTITUTIONS, TEMPLATE_UPDATE_STRATEGIES, PLACEHOLDER_SOURCES, PlaceholderSpecSchema, TemplateManifestEntrySchema;
12821
13065
  var init_manifest2 = __esm({
12822
13066
  "packages/contracts/src/templates/manifest.ts"() {
@@ -12837,85 +13081,85 @@ var init_manifest2 = __esm({
12837
13081
  "tool-resolver",
12838
13082
  "literal"
12839
13083
  ];
12840
- PlaceholderSpecSchema = z18.object({
13084
+ PlaceholderSpecSchema = z20.object({
12841
13085
  /**
12842
13086
  * Placeholder identifier as it appears in the template body
12843
13087
  * (e.g. `NODE_VERSION` matches `{{NODE_VERSION}}`).
12844
13088
  */
12845
- name: z18.string().min(1, "placeholder name must be non-empty"),
13089
+ name: z20.string().min(1, "placeholder name must be non-empty"),
12846
13090
  /** Resolver source the installer consults for this placeholder. */
12847
- source: z18.enum(PLACEHOLDER_SOURCES),
13091
+ source: z20.enum(PLACEHOLDER_SOURCES),
12848
13092
  /**
12849
13093
  * Path expression evaluated against `source` (e.g. `engines.node` against
12850
13094
  * `project-context`, `defaults.branchModel` against `.cleo/config`).
12851
13095
  * For `literal` source, this MAY be the literal value's identifier.
12852
13096
  */
12853
- sourcePath: z18.string().min(1, "placeholder sourcePath must be non-empty"),
13097
+ sourcePath: z20.string().min(1, "placeholder sourcePath must be non-empty"),
12854
13098
  /**
12855
13099
  * Fallback value used when `source[sourcePath]` resolves to `undefined`.
12856
13100
  * `null` is permitted to explicitly mark "no default — failure required".
12857
13101
  */
12858
- defaultValue: z18.union([z18.string(), z18.number(), z18.boolean(), z18.null()]).optional()
13102
+ defaultValue: z20.union([z20.string(), z20.number(), z20.boolean(), z20.null()]).optional()
12859
13103
  });
12860
- TemplateManifestEntrySchema = z18.object({
13104
+ TemplateManifestEntrySchema = z20.object({
12861
13105
  /** Stable identifier for this template entry. */
12862
- id: z18.string().min(1, "id must be non-empty"),
13106
+ id: z20.string().min(1, "id must be non-empty"),
12863
13107
  /** Category of file this template represents. */
12864
- kind: z18.enum(TEMPLATE_KINDS),
13108
+ kind: z20.enum(TEMPLATE_KINDS),
12865
13109
  /** Repo-relative path of the template source file. */
12866
- sourcePath: z18.string().min(1, "sourcePath must be non-empty"),
13110
+ sourcePath: z20.string().min(1, "sourcePath must be non-empty"),
12867
13111
  /** Project-relative path where the rendered template installs. */
12868
- installPath: z18.string().min(1, "installPath must be non-empty"),
13112
+ installPath: z20.string().min(1, "installPath must be non-empty"),
12869
13113
  /** Substitution strategy the installer applies to `sourcePath`. */
12870
- substitution: z18.enum(TEMPLATE_SUBSTITUTIONS),
13114
+ substitution: z20.enum(TEMPLATE_SUBSTITUTIONS),
12871
13115
  /** Declared placeholders this template requires. May be empty. */
12872
- placeholders: z18.array(PlaceholderSpecSchema),
13116
+ placeholders: z20.array(PlaceholderSpecSchema),
12873
13117
  /** Reconciliation policy on upgrade. */
12874
- updateStrategy: z18.enum(TEMPLATE_UPDATE_STRATEGIES)
13118
+ updateStrategy: z20.enum(TEMPLATE_UPDATE_STRATEGIES)
12875
13119
  });
12876
13120
  }
12877
13121
  });
12878
13122
 
12879
13123
  // packages/contracts/src/validator/index.ts
12880
- import { z as z19 } from "zod";
13124
+ import { z as z21 } from "zod";
12881
13125
  var VALIDATOR_ID_REGEX, validatorFindingSchema, validatorAttestationSchema, validatorRejectionSchema, validatorVerdictSchema;
12882
13126
  var init_validator = __esm({
12883
13127
  "packages/contracts/src/validator/index.ts"() {
12884
13128
  "use strict";
12885
13129
  VALIDATOR_ID_REGEX = /^validator-[a-z0-9][a-z0-9-]*$/;
12886
- validatorFindingSchema = z19.object({
12887
- acId: z19.string().min(1, "acId must be non-empty"),
12888
- status: z19.enum(["pass", "fail", "inconclusive"]),
12889
- reasoning: z19.string().min(1, "reasoning must be non-empty"),
12890
- evidenceRefs: z19.array(z19.string()).optional(),
12891
- checkedAt: z19.string().min(1, "checkedAt must be a non-empty ISO-8601 string")
12892
- });
12893
- validatorAttestationSchema = z19.object({
12894
- verdict: z19.literal("attest"),
12895
- taskId: z19.string().min(1),
12896
- validatorId: z19.string().regex(VALIDATOR_ID_REGEX, "validatorId must match the pattern validator-<discriminator>"),
12897
- findings: z19.array(validatorFindingSchema).min(1, "attestation must contain at least one finding").refine(
13130
+ validatorFindingSchema = z21.object({
13131
+ acId: z21.string().min(1, "acId must be non-empty"),
13132
+ status: z21.enum(["pass", "fail", "inconclusive"]),
13133
+ reasoning: z21.string().min(1, "reasoning must be non-empty"),
13134
+ evidenceRefs: z21.array(z21.string()).optional(),
13135
+ checkedAt: z21.string().min(1, "checkedAt must be a non-empty ISO-8601 string")
13136
+ });
13137
+ validatorAttestationSchema = z21.object({
13138
+ verdict: z21.literal("attest"),
13139
+ taskId: z21.string().min(1),
13140
+ validatorId: z21.string().regex(VALIDATOR_ID_REGEX, "validatorId must match the pattern validator-<discriminator>"),
13141
+ findings: z21.array(validatorFindingSchema).min(1, "attestation must contain at least one finding").refine(
12898
13142
  (findings) => findings.every((f) => f.status === "pass"),
12899
13143
  'attestation requires every finding to have status="pass"'
12900
13144
  ),
12901
- summary: z19.string().optional(),
12902
- attestedAt: z19.string().min(1),
12903
- schemaVersion: z19.literal("1")
12904
- });
12905
- validatorRejectionSchema = z19.object({
12906
- verdict: z19.literal("reject"),
12907
- taskId: z19.string().min(1),
12908
- validatorId: z19.string().regex(VALIDATOR_ID_REGEX, "validatorId must match the pattern validator-<discriminator>"),
12909
- findings: z19.array(validatorFindingSchema).min(1, "rejection must contain at least one finding").refine(
13145
+ summary: z21.string().optional(),
13146
+ attestedAt: z21.string().min(1),
13147
+ schemaVersion: z21.literal("1")
13148
+ });
13149
+ validatorRejectionSchema = z21.object({
13150
+ verdict: z21.literal("reject"),
13151
+ taskId: z21.string().min(1),
13152
+ validatorId: z21.string().regex(VALIDATOR_ID_REGEX, "validatorId must match the pattern validator-<discriminator>"),
13153
+ findings: z21.array(validatorFindingSchema).min(1, "rejection must contain at least one finding").refine(
12910
13154
  (findings) => findings.some((f) => f.status !== "pass"),
12911
13155
  'rejection requires at least one finding with status "fail" or "inconclusive"'
12912
13156
  ),
12913
- summary: z19.string().min(1, "rejection summary must be non-empty"),
12914
- remediationHints: z19.array(z19.string()).optional(),
12915
- rejectedAt: z19.string().min(1),
12916
- schemaVersion: z19.literal("1")
13157
+ summary: z21.string().min(1, "rejection summary must be non-empty"),
13158
+ remediationHints: z21.array(z21.string()).optional(),
13159
+ rejectedAt: z21.string().min(1),
13160
+ schemaVersion: z21.literal("1")
12917
13161
  });
12918
- validatorVerdictSchema = z19.discriminatedUnion("verdict", [
13162
+ validatorVerdictSchema = z21.discriminatedUnion("verdict", [
12919
13163
  validatorAttestationSchema,
12920
13164
  validatorRejectionSchema
12921
13165
  ]);
@@ -12952,13 +13196,16 @@ var init_src = __esm({
12952
13196
  init_graph();
12953
13197
  init_invariants();
12954
13198
  init_lafs();
13199
+ init_lease_ipc();
12955
13200
  init_plugin_llm();
13201
+ init_system_of_use();
12956
13202
  init_system_resolver();
12957
13203
  init_observe();
12958
13204
  init_migration_parity();
12959
13205
  init_mvi();
12960
13206
  init_operation_envelope_validation();
12961
13207
  init_docs();
13208
+ init_ensures_schema_registry();
12962
13209
  init_operations();
12963
13210
  init_nexus_scope_map();
12964
13211
  init_output_contracts_data();
@@ -26999,7 +27246,7 @@ function resolveRef(ref, ctx) {
26999
27246
  function convertBaseSchema(schema, ctx) {
27000
27247
  if (schema.not !== void 0) {
27001
27248
  if (typeof schema.not === "object" && Object.keys(schema.not).length === 0) {
27002
- return z20.never();
27249
+ return z22.never();
27003
27250
  }
27004
27251
  throw new Error("not is not supported in Zod (except { not: {} } for never)");
27005
27252
  }
@@ -27021,7 +27268,7 @@ function convertBaseSchema(schema, ctx) {
27021
27268
  return ctx.refs.get(refPath);
27022
27269
  }
27023
27270
  if (ctx.processing.has(refPath)) {
27024
- return z20.lazy(() => {
27271
+ return z22.lazy(() => {
27025
27272
  if (!ctx.refs.has(refPath)) {
27026
27273
  throw new Error(`Circular reference not resolved: ${refPath}`);
27027
27274
  }
@@ -27038,25 +27285,25 @@ function convertBaseSchema(schema, ctx) {
27038
27285
  if (schema.enum !== void 0) {
27039
27286
  const enumValues = schema.enum;
27040
27287
  if (ctx.version === "openapi-3.0" && schema.nullable === true && enumValues.length === 1 && enumValues[0] === null) {
27041
- return z20.null();
27288
+ return z22.null();
27042
27289
  }
27043
27290
  if (enumValues.length === 0) {
27044
- return z20.never();
27291
+ return z22.never();
27045
27292
  }
27046
27293
  if (enumValues.length === 1) {
27047
- return z20.literal(enumValues[0]);
27294
+ return z22.literal(enumValues[0]);
27048
27295
  }
27049
27296
  if (enumValues.every((v) => typeof v === "string")) {
27050
- return z20.enum(enumValues);
27297
+ return z22.enum(enumValues);
27051
27298
  }
27052
- const literalSchemas = enumValues.map((v) => z20.literal(v));
27299
+ const literalSchemas = enumValues.map((v) => z22.literal(v));
27053
27300
  if (literalSchemas.length < 2) {
27054
27301
  return literalSchemas[0];
27055
27302
  }
27056
- return z20.union([literalSchemas[0], literalSchemas[1], ...literalSchemas.slice(2)]);
27303
+ return z22.union([literalSchemas[0], literalSchemas[1], ...literalSchemas.slice(2)]);
27057
27304
  }
27058
27305
  if (schema.const !== void 0) {
27059
- return z20.literal(schema.const);
27306
+ return z22.literal(schema.const);
27060
27307
  }
27061
27308
  const type = schema.type;
27062
27309
  if (Array.isArray(type)) {
@@ -27065,68 +27312,68 @@ function convertBaseSchema(schema, ctx) {
27065
27312
  return convertBaseSchema(typeSchema, ctx);
27066
27313
  });
27067
27314
  if (typeSchemas.length === 0) {
27068
- return z20.never();
27315
+ return z22.never();
27069
27316
  }
27070
27317
  if (typeSchemas.length === 1) {
27071
27318
  return typeSchemas[0];
27072
27319
  }
27073
- return z20.union(typeSchemas);
27320
+ return z22.union(typeSchemas);
27074
27321
  }
27075
27322
  if (!type) {
27076
- return z20.any();
27323
+ return z22.any();
27077
27324
  }
27078
27325
  let zodSchema2;
27079
27326
  switch (type) {
27080
27327
  case "string": {
27081
- let stringSchema = z20.string();
27328
+ let stringSchema = z22.string();
27082
27329
  if (schema.format) {
27083
27330
  const format = schema.format;
27084
27331
  if (format === "email") {
27085
- stringSchema = stringSchema.check(z20.email());
27332
+ stringSchema = stringSchema.check(z22.email());
27086
27333
  } else if (format === "uri" || format === "uri-reference") {
27087
- stringSchema = stringSchema.check(z20.url());
27334
+ stringSchema = stringSchema.check(z22.url());
27088
27335
  } else if (format === "uuid" || format === "guid") {
27089
- stringSchema = stringSchema.check(z20.uuid());
27336
+ stringSchema = stringSchema.check(z22.uuid());
27090
27337
  } else if (format === "date-time") {
27091
- stringSchema = stringSchema.check(z20.iso.datetime());
27338
+ stringSchema = stringSchema.check(z22.iso.datetime());
27092
27339
  } else if (format === "date") {
27093
- stringSchema = stringSchema.check(z20.iso.date());
27340
+ stringSchema = stringSchema.check(z22.iso.date());
27094
27341
  } else if (format === "time") {
27095
- stringSchema = stringSchema.check(z20.iso.time());
27342
+ stringSchema = stringSchema.check(z22.iso.time());
27096
27343
  } else if (format === "duration") {
27097
- stringSchema = stringSchema.check(z20.iso.duration());
27344
+ stringSchema = stringSchema.check(z22.iso.duration());
27098
27345
  } else if (format === "ipv4") {
27099
- stringSchema = stringSchema.check(z20.ipv4());
27346
+ stringSchema = stringSchema.check(z22.ipv4());
27100
27347
  } else if (format === "ipv6") {
27101
- stringSchema = stringSchema.check(z20.ipv6());
27348
+ stringSchema = stringSchema.check(z22.ipv6());
27102
27349
  } else if (format === "mac") {
27103
- stringSchema = stringSchema.check(z20.mac());
27350
+ stringSchema = stringSchema.check(z22.mac());
27104
27351
  } else if (format === "cidr") {
27105
- stringSchema = stringSchema.check(z20.cidrv4());
27352
+ stringSchema = stringSchema.check(z22.cidrv4());
27106
27353
  } else if (format === "cidr-v6") {
27107
- stringSchema = stringSchema.check(z20.cidrv6());
27354
+ stringSchema = stringSchema.check(z22.cidrv6());
27108
27355
  } else if (format === "base64") {
27109
- stringSchema = stringSchema.check(z20.base64());
27356
+ stringSchema = stringSchema.check(z22.base64());
27110
27357
  } else if (format === "base64url") {
27111
- stringSchema = stringSchema.check(z20.base64url());
27358
+ stringSchema = stringSchema.check(z22.base64url());
27112
27359
  } else if (format === "e164") {
27113
- stringSchema = stringSchema.check(z20.e164());
27360
+ stringSchema = stringSchema.check(z22.e164());
27114
27361
  } else if (format === "jwt") {
27115
- stringSchema = stringSchema.check(z20.jwt());
27362
+ stringSchema = stringSchema.check(z22.jwt());
27116
27363
  } else if (format === "emoji") {
27117
- stringSchema = stringSchema.check(z20.emoji());
27364
+ stringSchema = stringSchema.check(z22.emoji());
27118
27365
  } else if (format === "nanoid") {
27119
- stringSchema = stringSchema.check(z20.nanoid());
27366
+ stringSchema = stringSchema.check(z22.nanoid());
27120
27367
  } else if (format === "cuid") {
27121
- stringSchema = stringSchema.check(z20.cuid());
27368
+ stringSchema = stringSchema.check(z22.cuid());
27122
27369
  } else if (format === "cuid2") {
27123
- stringSchema = stringSchema.check(z20.cuid2());
27370
+ stringSchema = stringSchema.check(z22.cuid2());
27124
27371
  } else if (format === "ulid") {
27125
- stringSchema = stringSchema.check(z20.ulid());
27372
+ stringSchema = stringSchema.check(z22.ulid());
27126
27373
  } else if (format === "xid") {
27127
- stringSchema = stringSchema.check(z20.xid());
27374
+ stringSchema = stringSchema.check(z22.xid());
27128
27375
  } else if (format === "ksuid") {
27129
- stringSchema = stringSchema.check(z20.ksuid());
27376
+ stringSchema = stringSchema.check(z22.ksuid());
27130
27377
  }
27131
27378
  }
27132
27379
  if (typeof schema.minLength === "number") {
@@ -27143,7 +27390,7 @@ function convertBaseSchema(schema, ctx) {
27143
27390
  }
27144
27391
  case "number":
27145
27392
  case "integer": {
27146
- let numberSchema = type === "integer" ? z20.number().int() : z20.number();
27393
+ let numberSchema = type === "integer" ? z22.number().int() : z22.number();
27147
27394
  if (typeof schema.minimum === "number") {
27148
27395
  numberSchema = numberSchema.min(schema.minimum);
27149
27396
  }
@@ -27167,11 +27414,11 @@ function convertBaseSchema(schema, ctx) {
27167
27414
  break;
27168
27415
  }
27169
27416
  case "boolean": {
27170
- zodSchema2 = z20.boolean();
27417
+ zodSchema2 = z22.boolean();
27171
27418
  break;
27172
27419
  }
27173
27420
  case "null": {
27174
- zodSchema2 = z20.null();
27421
+ zodSchema2 = z22.null();
27175
27422
  break;
27176
27423
  }
27177
27424
  case "object": {
@@ -27184,14 +27431,14 @@ function convertBaseSchema(schema, ctx) {
27184
27431
  }
27185
27432
  if (schema.propertyNames) {
27186
27433
  const keySchema = convertSchema(schema.propertyNames, ctx);
27187
- const valueSchema = schema.additionalProperties && typeof schema.additionalProperties === "object" ? convertSchema(schema.additionalProperties, ctx) : z20.any();
27434
+ const valueSchema = schema.additionalProperties && typeof schema.additionalProperties === "object" ? convertSchema(schema.additionalProperties, ctx) : z22.any();
27188
27435
  if (Object.keys(shape).length === 0) {
27189
- zodSchema2 = z20.record(keySchema, valueSchema);
27436
+ zodSchema2 = z22.record(keySchema, valueSchema);
27190
27437
  break;
27191
27438
  }
27192
- const objectSchema2 = z20.object(shape).passthrough();
27193
- const recordSchema = z20.looseRecord(keySchema, valueSchema);
27194
- zodSchema2 = z20.intersection(objectSchema2, recordSchema);
27439
+ const objectSchema2 = z22.object(shape).passthrough();
27440
+ const recordSchema = z22.looseRecord(keySchema, valueSchema);
27441
+ zodSchema2 = z22.intersection(objectSchema2, recordSchema);
27195
27442
  break;
27196
27443
  }
27197
27444
  if (schema.patternProperties) {
@@ -27200,28 +27447,28 @@ function convertBaseSchema(schema, ctx) {
27200
27447
  const looseRecords = [];
27201
27448
  for (const pattern of patternKeys) {
27202
27449
  const patternValue = convertSchema(patternProps[pattern], ctx);
27203
- const keySchema = z20.string().regex(new RegExp(pattern));
27204
- looseRecords.push(z20.looseRecord(keySchema, patternValue));
27450
+ const keySchema = z22.string().regex(new RegExp(pattern));
27451
+ looseRecords.push(z22.looseRecord(keySchema, patternValue));
27205
27452
  }
27206
27453
  const schemasToIntersect = [];
27207
27454
  if (Object.keys(shape).length > 0) {
27208
- schemasToIntersect.push(z20.object(shape).passthrough());
27455
+ schemasToIntersect.push(z22.object(shape).passthrough());
27209
27456
  }
27210
27457
  schemasToIntersect.push(...looseRecords);
27211
27458
  if (schemasToIntersect.length === 0) {
27212
- zodSchema2 = z20.object({}).passthrough();
27459
+ zodSchema2 = z22.object({}).passthrough();
27213
27460
  } else if (schemasToIntersect.length === 1) {
27214
27461
  zodSchema2 = schemasToIntersect[0];
27215
27462
  } else {
27216
- let result = z20.intersection(schemasToIntersect[0], schemasToIntersect[1]);
27463
+ let result = z22.intersection(schemasToIntersect[0], schemasToIntersect[1]);
27217
27464
  for (let i = 2; i < schemasToIntersect.length; i++) {
27218
- result = z20.intersection(result, schemasToIntersect[i]);
27465
+ result = z22.intersection(result, schemasToIntersect[i]);
27219
27466
  }
27220
27467
  zodSchema2 = result;
27221
27468
  }
27222
27469
  break;
27223
27470
  }
27224
- const objectSchema = z20.object(shape);
27471
+ const objectSchema = z22.object(shape);
27225
27472
  if (schema.additionalProperties === false) {
27226
27473
  zodSchema2 = objectSchema.strict();
27227
27474
  } else if (typeof schema.additionalProperties === "object") {
@@ -27238,33 +27485,33 @@ function convertBaseSchema(schema, ctx) {
27238
27485
  const tupleItems = prefixItems.map((item) => convertSchema(item, ctx));
27239
27486
  const rest = items && typeof items === "object" && !Array.isArray(items) ? convertSchema(items, ctx) : void 0;
27240
27487
  if (rest) {
27241
- zodSchema2 = z20.tuple(tupleItems).rest(rest);
27488
+ zodSchema2 = z22.tuple(tupleItems).rest(rest);
27242
27489
  } else {
27243
- zodSchema2 = z20.tuple(tupleItems);
27490
+ zodSchema2 = z22.tuple(tupleItems);
27244
27491
  }
27245
27492
  if (typeof schema.minItems === "number") {
27246
- zodSchema2 = zodSchema2.check(z20.minLength(schema.minItems));
27493
+ zodSchema2 = zodSchema2.check(z22.minLength(schema.minItems));
27247
27494
  }
27248
27495
  if (typeof schema.maxItems === "number") {
27249
- zodSchema2 = zodSchema2.check(z20.maxLength(schema.maxItems));
27496
+ zodSchema2 = zodSchema2.check(z22.maxLength(schema.maxItems));
27250
27497
  }
27251
27498
  } else if (Array.isArray(items)) {
27252
27499
  const tupleItems = items.map((item) => convertSchema(item, ctx));
27253
27500
  const rest = schema.additionalItems && typeof schema.additionalItems === "object" ? convertSchema(schema.additionalItems, ctx) : void 0;
27254
27501
  if (rest) {
27255
- zodSchema2 = z20.tuple(tupleItems).rest(rest);
27502
+ zodSchema2 = z22.tuple(tupleItems).rest(rest);
27256
27503
  } else {
27257
- zodSchema2 = z20.tuple(tupleItems);
27504
+ zodSchema2 = z22.tuple(tupleItems);
27258
27505
  }
27259
27506
  if (typeof schema.minItems === "number") {
27260
- zodSchema2 = zodSchema2.check(z20.minLength(schema.minItems));
27507
+ zodSchema2 = zodSchema2.check(z22.minLength(schema.minItems));
27261
27508
  }
27262
27509
  if (typeof schema.maxItems === "number") {
27263
- zodSchema2 = zodSchema2.check(z20.maxLength(schema.maxItems));
27510
+ zodSchema2 = zodSchema2.check(z22.maxLength(schema.maxItems));
27264
27511
  }
27265
27512
  } else if (items !== void 0) {
27266
27513
  const element = convertSchema(items, ctx);
27267
- let arraySchema = z20.array(element);
27514
+ let arraySchema = z22.array(element);
27268
27515
  if (typeof schema.minItems === "number") {
27269
27516
  arraySchema = arraySchema.min(schema.minItems);
27270
27517
  }
@@ -27273,7 +27520,7 @@ function convertBaseSchema(schema, ctx) {
27273
27520
  }
27274
27521
  zodSchema2 = arraySchema;
27275
27522
  } else {
27276
- zodSchema2 = z20.array(z20.any());
27523
+ zodSchema2 = z22.array(z22.any());
27277
27524
  }
27278
27525
  break;
27279
27526
  }
@@ -27290,37 +27537,37 @@ function convertBaseSchema(schema, ctx) {
27290
27537
  }
27291
27538
  function convertSchema(schema, ctx) {
27292
27539
  if (typeof schema === "boolean") {
27293
- return schema ? z20.any() : z20.never();
27540
+ return schema ? z22.any() : z22.never();
27294
27541
  }
27295
27542
  let baseSchema = convertBaseSchema(schema, ctx);
27296
27543
  const hasExplicitType = schema.type || schema.enum !== void 0 || schema.const !== void 0;
27297
27544
  if (schema.anyOf && Array.isArray(schema.anyOf)) {
27298
27545
  const options = schema.anyOf.map((s) => convertSchema(s, ctx));
27299
- const anyOfUnion = z20.union(options);
27300
- baseSchema = hasExplicitType ? z20.intersection(baseSchema, anyOfUnion) : anyOfUnion;
27546
+ const anyOfUnion = z22.union(options);
27547
+ baseSchema = hasExplicitType ? z22.intersection(baseSchema, anyOfUnion) : anyOfUnion;
27301
27548
  }
27302
27549
  if (schema.oneOf && Array.isArray(schema.oneOf)) {
27303
27550
  const options = schema.oneOf.map((s) => convertSchema(s, ctx));
27304
- const oneOfUnion = z20.xor(options);
27305
- baseSchema = hasExplicitType ? z20.intersection(baseSchema, oneOfUnion) : oneOfUnion;
27551
+ const oneOfUnion = z22.xor(options);
27552
+ baseSchema = hasExplicitType ? z22.intersection(baseSchema, oneOfUnion) : oneOfUnion;
27306
27553
  }
27307
27554
  if (schema.allOf && Array.isArray(schema.allOf)) {
27308
27555
  if (schema.allOf.length === 0) {
27309
- baseSchema = hasExplicitType ? baseSchema : z20.any();
27556
+ baseSchema = hasExplicitType ? baseSchema : z22.any();
27310
27557
  } else {
27311
27558
  let result = hasExplicitType ? baseSchema : convertSchema(schema.allOf[0], ctx);
27312
27559
  const startIdx = hasExplicitType ? 0 : 1;
27313
27560
  for (let i = startIdx; i < schema.allOf.length; i++) {
27314
- result = z20.intersection(result, convertSchema(schema.allOf[i], ctx));
27561
+ result = z22.intersection(result, convertSchema(schema.allOf[i], ctx));
27315
27562
  }
27316
27563
  baseSchema = result;
27317
27564
  }
27318
27565
  }
27319
27566
  if (schema.nullable === true && ctx.version === "openapi-3.0") {
27320
- baseSchema = z20.nullable(baseSchema);
27567
+ baseSchema = z22.nullable(baseSchema);
27321
27568
  }
27322
27569
  if (schema.readOnly === true) {
27323
- baseSchema = z20.readonly(baseSchema);
27570
+ baseSchema = z22.readonly(baseSchema);
27324
27571
  }
27325
27572
  const extraMeta = {};
27326
27573
  const coreMetadataKeys = ["$id", "id", "$comment", "$anchor", "$vocabulary", "$dynamicRef", "$dynamicAnchor"];
@@ -27347,7 +27594,7 @@ function convertSchema(schema, ctx) {
27347
27594
  }
27348
27595
  function fromJSONSchema(schema, params) {
27349
27596
  if (typeof schema === "boolean") {
27350
- return schema ? z20.any() : z20.never();
27597
+ return schema ? z22.any() : z22.never();
27351
27598
  }
27352
27599
  const version2 = detectVersion(schema, params?.defaultTarget);
27353
27600
  const defs = schema.$defs || schema.definitions || {};
@@ -27361,14 +27608,14 @@ function fromJSONSchema(schema, params) {
27361
27608
  };
27362
27609
  return convertSchema(schema, ctx);
27363
27610
  }
27364
- var z20, RECOGNIZED_KEYS;
27611
+ var z22, RECOGNIZED_KEYS;
27365
27612
  var init_from_json_schema = __esm({
27366
27613
  "node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/from-json-schema.js"() {
27367
27614
  init_registries();
27368
27615
  init_checks2();
27369
27616
  init_iso();
27370
27617
  init_schemas2();
27371
- z20 = {
27618
+ z22 = {
27372
27619
  ...schemas_exports2,
27373
27620
  ...checks_exports2,
27374
27621
  iso: iso_exports