@cleocode/adapters 2026.9.8 → 2026.9.10

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
@@ -480,7 +480,7 @@ var init_cant_context = __esm({
480
480
 
481
481
  // packages/contracts/src/acceptance-gate-schema.ts
482
482
  import { z } from "zod";
483
- var gateBaseSchema, fileAssertionSchema, testGateSchema, fileGateSchema, commandGateSchema, lintGateSchema, httpGateSchema, manualGateSchema, acceptanceGateSchema, gateResultDetailsSchema, acceptanceGateResultSchema, acceptanceItemSchema, acceptanceArraySchema;
483
+ var gateBaseSchema, fileAssertionSchema, testGateSchema, testCountReportSchema, fileGateSchema, commandGateSchema, lintGateSchema, httpGateSchema, manualGateSchema, acceptanceGateSchema, gateResultDetailsSchema, capturedExecutionSchema, gateBindingPathSchema, acceptanceGateBindingSchema, acceptanceGateResultSchema, acceptanceItemSchema, acceptanceArraySchema;
484
484
  var init_acceptance_gate_schema = __esm({
485
485
  "packages/contracts/src/acceptance-gate-schema.ts"() {
486
486
  "use strict";
@@ -519,6 +519,52 @@ var init_acceptance_gate_schema = __esm({
519
519
  cwd: z.string().optional(),
520
520
  env: z.record(z.string(), z.string()).optional()
521
521
  });
522
+ testCountReportSchema = z.object({
523
+ numTotalTests: z.number().int().nonnegative().safe(),
524
+ numPassedTests: z.number().int().nonnegative().safe(),
525
+ numFailedTests: z.number().int().nonnegative().safe(),
526
+ numPendingTests: z.number().int().nonnegative().safe(),
527
+ numTodoTests: z.number().int().nonnegative().safe(),
528
+ numTotalTestSuites: z.number().int().nonnegative().safe(),
529
+ numPassedTestSuites: z.number().int().nonnegative().safe(),
530
+ numFailedTestSuites: z.number().int().nonnegative().safe(),
531
+ numPendingTestSuites: z.number().int().nonnegative().safe(),
532
+ success: z.boolean(),
533
+ testResults: z.array(
534
+ z.object({
535
+ name: z.string().min(1),
536
+ status: z.enum(["passed", "failed"]),
537
+ assertionResults: z.array(
538
+ z.object({
539
+ fullName: z.string(),
540
+ status: z.enum(["passed", "failed", "pending", "skipped", "todo"])
541
+ })
542
+ )
543
+ })
544
+ )
545
+ }).superRefine((report, context) => {
546
+ const assertions = report.testResults.flatMap((file2) => file2.assertionResults);
547
+ const passed = assertions.filter((test) => test.status === "passed").length;
548
+ const failed = assertions.filter((test) => test.status === "failed").length;
549
+ const pending = assertions.filter(
550
+ (test) => test.status === "pending" || test.status === "skipped"
551
+ ).length;
552
+ const todo = assertions.filter((test) => test.status === "todo").length;
553
+ if (report.numTotalTests !== assertions.length || report.numPassedTests !== passed || report.numFailedTests !== failed || report.numPendingTests !== pending || report.numTodoTests !== todo) {
554
+ context.addIssue({
555
+ code: "custom",
556
+ message: "Test counters disagree with assertion results"
557
+ });
558
+ }
559
+ if (report.numTotalTestSuites !== report.numPassedTestSuites + report.numFailedTestSuites + report.numPendingTestSuites) {
560
+ context.addIssue({ code: "custom", message: "Suite counters are inconsistent" });
561
+ }
562
+ if (report.testResults.some(
563
+ (file2) => file2.status === "passed" && file2.assertionResults.some((test) => test.status === "failed")
564
+ ) || report.success && (failed > 0 || report.numFailedTestSuites > 0 || report.testResults.some((file2) => file2.status === "failed"))) {
565
+ context.addIssue({ code: "custom", message: "Success status contradicts failed results" });
566
+ }
567
+ });
522
568
  fileGateSchema = gateBaseSchema.extend({
523
569
  kind: z.literal("file"),
524
570
  /** Absolute or project-root-relative file path. Mutually exclusive with `attachmentSha256`. */
@@ -608,7 +654,116 @@ var init_acceptance_gate_schema = __esm({
608
654
  accepted: z.boolean()
609
655
  })
610
656
  ]);
657
+ capturedExecutionSchema = z.object({
658
+ started: z.boolean(),
659
+ targetPid: z.number().int().positive().safe().nullable(),
660
+ exitCode: z.number().int().nonnegative().safe().nullable(),
661
+ signal: z.string().min(1).nullable(),
662
+ error: z.string().nullable(),
663
+ stopped: z.enum([
664
+ "deadline",
665
+ "cancelled",
666
+ "teardown",
667
+ "output-limit",
668
+ "resource-limit",
669
+ "transport-error"
670
+ ]).nullable(),
671
+ stdout: z.string(),
672
+ stderr: z.string(),
673
+ outputTruncated: z.boolean(),
674
+ durationMs: z.number().finite().nonnegative(),
675
+ mode: z.enum(["systemd", "pgid"]),
676
+ unitName: z.string().min(1).optional(),
677
+ nativeMemory: z.enum(["unverified", "observed-cgroup"]),
678
+ resourceLimits: z.object({
679
+ cgroup: z.string().startsWith("/"),
680
+ memoryMaxBytes: z.number().int().positive().safe().nullable(),
681
+ tasksMax: z.number().int().positive().safe().nullable()
682
+ }).strict().optional(),
683
+ cleanupScope: z.enum(["process-group", "direct-child"]),
684
+ transportClosed: z.literal(true),
685
+ targetCloseObserved: z.boolean(),
686
+ cleanupObservation: z.enum([
687
+ "scope-terminal",
688
+ "process-group-absent",
689
+ "process-group-signalled",
690
+ "unverified"
691
+ ]),
692
+ cleanupErrors: z.array(z.string())
693
+ }).strict().superRefine((execution, context) => {
694
+ if (execution.started !== (execution.targetPid !== null) || !execution.started && (execution.exitCode !== null || execution.signal !== null) || execution.exitCode !== null && execution.signal !== null || !execution.targetCloseObserved && (execution.exitCode !== null || execution.signal !== null))
695
+ context.addIssue({ code: "custom", message: "Contradictory target lifecycle observation" });
696
+ if (execution.nativeMemory === "observed-cgroup" && !execution.resourceLimits?.memoryMaxBytes)
697
+ context.addIssue({
698
+ code: "custom",
699
+ message: "Observed native-memory claim requires a finite kernel limit"
700
+ });
701
+ if (execution.resourceLimits && (execution.mode !== "systemd" || !execution.unitName || !execution.resourceLimits.cgroup.split("/").includes(execution.unitName) || execution.resourceLimits.cgroup.split("/").includes("..")))
702
+ context.addIssue({
703
+ code: "custom",
704
+ message: "Resource observation must name the exact owned scope"
705
+ });
706
+ if (execution.cleanupObservation === "scope-terminal" && (execution.mode !== "systemd" || !execution.unitName))
707
+ context.addIssue({
708
+ code: "custom",
709
+ message: "Terminal scope observation requires an identified systemd scope"
710
+ });
711
+ });
712
+ gateBindingPathSchema = z.string().min(1).refine(
713
+ (value) => /^(?:\/|[A-Za-z]:[\\/]|\\\\)/.test(value) && !value.includes("\0"),
714
+ "Captured gate paths must be absolute and contain no null byte"
715
+ );
716
+ acceptanceGateBindingSchema = z.object({
717
+ version: z.literal(1),
718
+ verificationId: z.string().uuid(),
719
+ identity: z.object({
720
+ projectId: z.string().min(1),
721
+ projectRoot: gateBindingPathSchema,
722
+ actor: z.string().min(1),
723
+ operation: z.literal("check.gate.verify"),
724
+ idempotencyKey: z.string().min(1)
725
+ }).strict(),
726
+ taskId: z.string().min(1),
727
+ criterionId: z.string().uuid(),
728
+ criterionHash: z.string().regex(/^[a-f0-9]{64}$/),
729
+ gateHash: z.string().regex(/^[a-f0-9]{64}$/),
730
+ capturedAt: z.string().datetime(),
731
+ deadlineAt: z.number().int().positive().safe(),
732
+ invocation: z.object({
733
+ command: z.string().min(1),
734
+ args: z.array(z.string()),
735
+ cwd: gateBindingPathSchema,
736
+ environmentHash: z.string().regex(/^[a-f0-9]{64}$/)
737
+ }).strict().optional(),
738
+ artifacts: z.array(
739
+ z.object({
740
+ path: gateBindingPathSchema,
741
+ sha256: z.string().regex(/^[a-f0-9]{64}$/).nullable(),
742
+ bytes: z.number().int().nonnegative().safe().nullable()
743
+ }).strict().superRefine((artifact, context) => {
744
+ if (artifact.sha256 === null !== (artifact.bytes === null))
745
+ context.addIssue({
746
+ code: "custom",
747
+ message: "Absent input requires both null digest and size"
748
+ });
749
+ })
750
+ )
751
+ }).strict().superRefine((binding, context) => {
752
+ if (new Set(binding.artifacts.map(({ path }) => path)).size !== binding.artifacts.length)
753
+ context.addIssue({
754
+ code: "custom",
755
+ path: ["artifacts"],
756
+ message: "Input paths must be unique"
757
+ });
758
+ if (Date.parse(binding.capturedAt) >= binding.deadlineAt)
759
+ context.addIssue({
760
+ code: "custom",
761
+ path: ["deadlineAt"],
762
+ message: "Input capture must precede the original deadline"
763
+ });
764
+ });
611
765
  acceptanceGateResultSchema = z.object({
766
+ binding: acceptanceGateBindingSchema.optional(),
612
767
  index: z.number().int().nonnegative(),
613
768
  req: z.string().optional(),
614
769
  kind: z.enum(["test", "file", "command", "lint", "http", "manual"]),
@@ -616,11 +771,57 @@ var init_acceptance_gate_schema = __esm({
616
771
  durationMs: z.number().nonnegative(),
617
772
  /** Typed kind-specific detail payload (T802). */
618
773
  details: gateResultDetailsSchema.optional(),
774
+ /** Actual target/transport/containment observations when supplied by the runner. */
775
+ execution: capturedExecutionSchema.optional(),
619
776
  evidence: z.string().optional(),
620
777
  errorMessage: z.string().optional(),
621
778
  /** ISO 8601 timestamp. */
622
779
  checkedAt: z.string().datetime(),
623
780
  checkedBy: z.string().min(1)
781
+ }).superRefine((result, context) => {
782
+ const binding = result.binding;
783
+ if (binding) {
784
+ if (binding.identity.actor !== result.checkedBy)
785
+ context.addIssue({
786
+ code: "custom",
787
+ path: ["binding", "identity", "actor"],
788
+ message: "Result actor must match captured operation identity"
789
+ });
790
+ if (Date.parse(binding.capturedAt) > Date.parse(result.checkedAt))
791
+ context.addIssue({
792
+ code: "custom",
793
+ path: ["binding", "capturedAt"],
794
+ message: "Result cannot precede input capture"
795
+ });
796
+ const executable = ["test", "command", "lint"].includes(result.kind);
797
+ if (executable && !binding.invocation)
798
+ context.addIssue({
799
+ code: "custom",
800
+ path: ["binding", "invocation"],
801
+ message: "Executable gate requires captured invocation"
802
+ });
803
+ if (["pass", "fail", "warn"].includes(result.result)) {
804
+ if (executable && !result.execution)
805
+ context.addIssue({
806
+ code: "custom",
807
+ path: ["execution"],
808
+ message: "Bound executable verdict requires process observation"
809
+ });
810
+ if (Date.parse(result.checkedAt) > binding.deadlineAt)
811
+ context.addIssue({
812
+ code: "custom",
813
+ path: ["checkedAt"],
814
+ message: "Verdict exceeds the original admitted deadline"
815
+ });
816
+ }
817
+ }
818
+ const execution = result.execution;
819
+ if (execution && ["pass", "fail", "warn"].includes(result.result) && (!execution.started || !execution.targetCloseObserved || execution.exitCode === null || execution.signal !== null || execution.error !== null || execution.stopped !== null || execution.outputTruncated || execution.cleanupErrors.length > 0))
820
+ context.addIssue({
821
+ code: "custom",
822
+ path: ["execution"],
823
+ message: "Incomplete process observation cannot establish a gate verdict"
824
+ });
624
825
  });
625
826
  acceptanceItemSchema = z.union([
626
827
  z.string().trim().min(1, {
@@ -1502,11 +1703,46 @@ var init_docs_taxonomy = __esm({
1502
1703
  });
1503
1704
 
1504
1705
  // packages/contracts/src/operations/docs.ts
1505
- var DOCS_LIFECYCLE_STATUSES;
1706
+ import { z as z7 } from "zod";
1707
+ var DOCS_PROJECTION_PROPOSAL_SCHEMA, DOCS_PROJECTION_RECEIPT_SCHEMA, DOCS_LIFECYCLE_STATUSES;
1506
1708
  var init_docs = __esm({
1507
1709
  "packages/contracts/src/operations/docs.ts"() {
1508
1710
  "use strict";
1509
1711
  init_docs_taxonomy();
1712
+ DOCS_PROJECTION_PROPOSAL_SCHEMA = z7.object({
1713
+ version: z7.literal(1),
1714
+ operation: z7.literal("docs.projection"),
1715
+ identity: z7.object({
1716
+ projectId: z7.string().min(1),
1717
+ projectRoot: z7.string().min(1),
1718
+ actor: z7.string().min(1),
1719
+ operation: z7.literal("docs.projection"),
1720
+ idempotencyKey: z7.string().min(1)
1721
+ }).strict(),
1722
+ source: z7.object({
1723
+ attachmentId: z7.string().min(1),
1724
+ sha256: z7.string().regex(/^[a-f0-9]{64}$/),
1725
+ ownerId: z7.string().min(1),
1726
+ ownerType: z7.enum(["task", "session", "observation", "decision", "learning", "pattern"]),
1727
+ label: z7.string().min(1)
1728
+ }).strict(),
1729
+ observation: z7.object({
1730
+ kind: z7.literal("doc-attachment"),
1731
+ attachmentId: z7.string().min(1),
1732
+ ownerId: z7.string().min(1),
1733
+ addedAt: z7.string().min(1),
1734
+ slug: z7.string().optional(),
1735
+ type: z7.string().optional()
1736
+ }).strict()
1737
+ }).strict();
1738
+ DOCS_PROJECTION_RECEIPT_SCHEMA = z7.object({
1739
+ version: z7.literal(1),
1740
+ sourceHash: z7.string().regex(/^[a-f0-9]{64}$/),
1741
+ graph: z7.enum(["completed", "disabled"]),
1742
+ observationId: z7.string().min(1),
1743
+ verifiedAt: z7.string().min(1),
1744
+ actor: z7.string().min(1)
1745
+ }).strict();
1510
1746
  DOCS_LIFECYCLE_STATUSES = [
1511
1747
  "draft",
1512
1748
  "proposed",
@@ -2038,7 +2274,7 @@ var init_service = __esm({
2038
2274
  });
2039
2275
 
2040
2276
  // packages/contracts/src/operations/output-contracts-data.ts
2041
- var tasksShowOutputContract, tasksListOutputContract, tasksFindOutputContract, TASK_MUTATION_DATA_SCHEMA, tasksAddOutputContract, tasksAddBatchOutputContract, tasksUpdateOutputContract, tasksCompleteOutputContract, tasksReorderRankOutputContract, tasksBulkMoveOutputContract, tasksAssigneeOutputContract, adminConfigGetOutputContract, adminConfigListOutputContract, adminConfigValidateOutputContract, adminConfigUnsetOutputContract, OUTPUT_CONTRACTS;
2277
+ var tasksShowOutputContract, taskPopulationSchema, tasksListOutputContract, tasksFindOutputContract, TASK_MUTATION_DATA_SCHEMA, tasksAddOutputContract, tasksAddBatchOutputContract, tasksUpdateOutputContract, tasksCompleteOutputContract, tasksReorderRankOutputContract, tasksBulkMoveOutputContract, tasksAssigneeOutputContract, adminConfigGetOutputContract, adminConfigListOutputContract, adminConfigValidateOutputContract, adminConfigUnsetOutputContract, OUTPUT_CONTRACTS;
2042
2278
  var init_output_contracts_data = __esm({
2043
2279
  "packages/contracts/src/operations/output-contracts-data.ts"() {
2044
2280
  "use strict";
@@ -2105,12 +2341,27 @@ var init_output_contracts_data = __esm({
2105
2341
  "/data/view/title"
2106
2342
  ]
2107
2343
  };
2344
+ taskPopulationSchema = {
2345
+ type: "object",
2346
+ required: ["matched", "returned", "truncated", "archive", "limit", "offset"],
2347
+ properties: {
2348
+ matched: { type: "number", description: "All rows matching the query before pagination." },
2349
+ returned: {
2350
+ type: "number",
2351
+ description: "Rows present in this response; also --output count."
2352
+ },
2353
+ truncated: { type: "boolean", description: "Matching rows are omitted by this page." },
2354
+ archive: { type: "string", enum: ["included", "excluded", "only"] },
2355
+ limit: { type: ["number", "null"] },
2356
+ offset: { type: "number" }
2357
+ }
2358
+ };
2108
2359
  tasksListOutputContract = {
2109
2360
  operation: "tasks.list",
2110
2361
  shapeNote: "Rows are under /data/tasks (an array); counts are /data/total and /data/filtered.",
2111
2362
  dataSchema: {
2112
2363
  type: "object",
2113
- required: ["tasks", "total", "filtered"],
2364
+ required: ["tasks", "total", "filtered", "population"],
2114
2365
  additionalProperties: true,
2115
2366
  properties: {
2116
2367
  tasks: {
@@ -2126,7 +2377,8 @@ var init_output_contracts_data = __esm({
2126
2377
  }
2127
2378
  },
2128
2379
  total: { type: "number", description: "Total tasks before filtering." },
2129
- filtered: { type: "number", description: "Number of tasks after filters applied." }
2380
+ filtered: { type: "number", description: "Number of tasks after filters applied." },
2381
+ population: taskPopulationSchema
2130
2382
  }
2131
2383
  },
2132
2384
  fieldPointers: [
@@ -2134,7 +2386,10 @@ var init_output_contracts_data = __esm({
2134
2386
  "/data/tasks/0/title",
2135
2387
  "/data/tasks/0/status",
2136
2388
  "/data/total",
2137
- "/data/filtered"
2389
+ "/data/filtered",
2390
+ "/data/population/matched",
2391
+ "/data/population/returned",
2392
+ "/data/population/archive"
2138
2393
  ]
2139
2394
  };
2140
2395
  tasksFindOutputContract = {
@@ -2142,7 +2397,7 @@ var init_output_contracts_data = __esm({
2142
2397
  shapeNote: "Results are wrapped: /data/results (array of matches), /data/total (count). Use /data/results/0/id \u2014 NOT /data/0/id.",
2143
2398
  dataSchema: {
2144
2399
  type: "object",
2145
- required: ["results", "total"],
2400
+ required: ["results", "total", "population"],
2146
2401
  additionalProperties: true,
2147
2402
  properties: {
2148
2403
  results: {
@@ -2159,15 +2414,24 @@ var init_output_contracts_data = __esm({
2159
2414
  }
2160
2415
  },
2161
2416
  total: { type: "number", description: "Total matching tasks." },
2417
+ population: taskPopulationSchema,
2162
2418
  query: { type: "string", description: "The query string that was searched." },
2163
- searchType: { type: "string", description: "Kind of search performed (fts, semantic, ...)." }
2419
+ searchType: {
2420
+ type: "string",
2421
+ description: "Requested matching mode: lexical (default), fuzzy (explicit opt-in), exact, id, or filter."
2422
+ }
2164
2423
  }
2165
2424
  },
2166
2425
  fieldPointers: [
2167
2426
  "/data/results/0/id",
2168
2427
  "/data/results/0/title",
2169
2428
  "/data/results/0/status",
2170
- "/data/total"
2429
+ "/data/results/0/match",
2430
+ "/data/searchType",
2431
+ "/data/total",
2432
+ "/data/population/matched",
2433
+ "/data/population/returned",
2434
+ "/data/population/archive"
2171
2435
  ]
2172
2436
  };
2173
2437
  TASK_MUTATION_DATA_SCHEMA = {
@@ -2454,6 +2718,7 @@ var init_tasks = __esm({
2454
2718
  enum: ["pending", "active", "blocked", "done", "cancelled"]
2455
2719
  },
2456
2720
  priority: { type: "string", enum: ["low", "medium", "high", "critical"] },
2721
+ phase: { type: "string" },
2457
2722
  notes: { type: "string" },
2458
2723
  labels: { type: "array", items: { type: "string" } },
2459
2724
  addLabels: { type: "array", items: { type: "string" } },
@@ -2479,6 +2744,7 @@ var init_tasks = __esm({
2479
2744
  dependsWaiver: { type: "string" },
2480
2745
  blockedBy: { type: "string" },
2481
2746
  clearBlockedBy: { type: "boolean" },
2747
+ noAutoComplete: { type: "boolean" },
2482
2748
  relates: {
2483
2749
  type: "array",
2484
2750
  items: {
@@ -2530,14 +2796,142 @@ var init_tasks = __esm({
2530
2796
  });
2531
2797
 
2532
2798
  // packages/contracts/src/dispatch/operations-registry.ts
2533
- var OPERATIONS;
2799
+ var requirementTaskParam, OPERATIONS;
2534
2800
  var init_operations_registry = __esm({
2535
2801
  "packages/contracts/src/dispatch/operations-registry.ts"() {
2536
2802
  "use strict";
2537
2803
  init_docs();
2538
2804
  init_output_contracts_data();
2539
2805
  init_tasks();
2806
+ requirementTaskParam = {
2807
+ name: "taskId",
2808
+ type: "string",
2809
+ required: true,
2810
+ description: "Task that owns the requirement gates",
2811
+ cli: { positional: true }
2812
+ };
2540
2813
  OPERATIONS = [
2814
+ {
2815
+ gateway: "mutate",
2816
+ domain: "tasks",
2817
+ operation: "req.add",
2818
+ description: "Add a validated typed requirement gate without executing it",
2819
+ tier: 1,
2820
+ idempotent: false,
2821
+ sessionRequired: true,
2822
+ requiredParams: ["taskId", "gate"],
2823
+ params: [
2824
+ requirementTaskParam,
2825
+ {
2826
+ name: "gate",
2827
+ type: "string",
2828
+ required: true,
2829
+ description: "AcceptanceGate JSON; must include kind, description and kind-specific fields",
2830
+ cli: { flag: "gate" }
2831
+ }
2832
+ ],
2833
+ inputSchema: {
2834
+ operation: "tasks.req.add",
2835
+ schema: {
2836
+ type: "object",
2837
+ required: ["taskId", "gate"],
2838
+ additionalProperties: false,
2839
+ properties: {
2840
+ taskId: { type: "string", minLength: 1 },
2841
+ gate: { type: "string", minLength: 1 }
2842
+ }
2843
+ },
2844
+ examples: [
2845
+ {
2846
+ name: "test",
2847
+ value: {
2848
+ taskId: "T121",
2849
+ gate: '{"kind":"test","command":"node","args":["verify.mjs"],"expect":"exit0","description":"Task harness passes","req":"PARTNER-121"}'
2850
+ }
2851
+ }
2852
+ ]
2853
+ }
2854
+ },
2855
+ {
2856
+ gateway: "query",
2857
+ domain: "tasks",
2858
+ operation: "req.list",
2859
+ description: "List named typed requirement gates without executing them",
2860
+ tier: 1,
2861
+ idempotent: true,
2862
+ sessionRequired: false,
2863
+ requiredParams: ["taskId"],
2864
+ params: [requirementTaskParam],
2865
+ inputSchema: {
2866
+ operation: "tasks.req.list",
2867
+ schema: {
2868
+ type: "object",
2869
+ required: ["taskId"],
2870
+ additionalProperties: false,
2871
+ properties: { taskId: { type: "string", minLength: 1 } }
2872
+ },
2873
+ examples: [{ name: "task", value: { taskId: "T121" } }]
2874
+ }
2875
+ },
2876
+ {
2877
+ gateway: "query",
2878
+ domain: "tasks",
2879
+ operation: "req.migrate.preview",
2880
+ description: "Preview typed-gate migration proposals without writing",
2881
+ tier: 1,
2882
+ idempotent: true,
2883
+ sessionRequired: false,
2884
+ requiredParams: ["taskId"],
2885
+ params: [
2886
+ requirementTaskParam,
2887
+ {
2888
+ name: "apply",
2889
+ type: "boolean",
2890
+ required: false,
2891
+ description: "Must be absent or false for preview"
2892
+ }
2893
+ ],
2894
+ inputSchema: {
2895
+ operation: "tasks.req.migrate.preview",
2896
+ schema: {
2897
+ type: "object",
2898
+ required: ["taskId"],
2899
+ additionalProperties: false,
2900
+ properties: { taskId: { type: "string", minLength: 1 }, apply: { const: false } }
2901
+ },
2902
+ examples: [{ name: "preview", value: { taskId: "T121", apply: false } }]
2903
+ }
2904
+ },
2905
+ {
2906
+ gateway: "mutate",
2907
+ domain: "tasks",
2908
+ operation: "req.migrate",
2909
+ description: "Explicitly apply validated typed-gate migration proposals",
2910
+ tier: 1,
2911
+ idempotent: false,
2912
+ sessionRequired: true,
2913
+ requiredParams: ["taskId", "apply"],
2914
+ params: [
2915
+ requirementTaskParam,
2916
+ {
2917
+ name: "apply",
2918
+ type: "boolean",
2919
+ required: true,
2920
+ description: "Must be true to apply proposals",
2921
+ cli: { flag: "apply" }
2922
+ }
2923
+ ],
2924
+ inputSchema: {
2925
+ operation: "tasks.req.migrate",
2926
+ schema: {
2927
+ type: "object",
2928
+ required: ["taskId", "apply"],
2929
+ additionalProperties: false,
2930
+ properties: { taskId: { type: "string", minLength: 1 }, apply: { const: true } }
2931
+ },
2932
+ examples: [{ name: "apply", value: { taskId: "T121", apply: true } }]
2933
+ }
2934
+ },
2541
2935
  {
2542
2936
  gateway: "query",
2543
2937
  domain: "tasks",
@@ -2772,6 +3166,13 @@ var init_operations_registry = __esm({
2772
3166
  sessionRequired: false,
2773
3167
  requiredParams: [],
2774
3168
  params: [
3169
+ {
3170
+ name: "includeArchive",
3171
+ type: "boolean",
3172
+ required: false,
3173
+ description: "Include archived rows under the same filters",
3174
+ cli: { flag: "include-archive" }
3175
+ },
2775
3176
  { name: "parent", type: "string", required: false, description: "Filter by parent task ID" },
2776
3177
  { name: "status", type: "string", required: false, description: "Filter by task status" },
2777
3178
  { name: "priority", type: "string", required: false, description: "Filter by task priority" },
@@ -2800,7 +3201,7 @@ var init_operations_registry = __esm({
2800
3201
  name: "limit",
2801
3202
  type: "number",
2802
3203
  required: false,
2803
- description: "Maximum number of tasks to return (default 10). Use --all to return every match. (--limit 0 also returns every match, but only on this command \u2014 prefer --all.)"
3204
+ description: "Maximum number of tasks to return (default 10). --all or --limit 0 returns every match."
2804
3205
  },
2805
3206
  {
2806
3207
  name: "offset",
@@ -4129,6 +4530,35 @@ var init_operations_registry = __esm({
4129
4530
  }
4130
4531
  ]
4131
4532
  },
4533
+ // T12308: the typed-gate runner `cleo verify <id> --run`. A query — it
4534
+ // executes the gates and reports them, and records nothing. Documented as
4535
+ // the canonical driver since T768 and emitted into every validation-stage
4536
+ // spawn prompt, but the flag had been dropped from the command.
4537
+ {
4538
+ gateway: "query",
4539
+ domain: "check",
4540
+ operation: "gate.run",
4541
+ description: "check.gate.run (query) \u2014 execute a task's typed acceptance gates and report results; persists nothing (T12308)",
4542
+ tier: 1,
4543
+ idempotent: false,
4544
+ sessionRequired: false,
4545
+ requiredParams: ["taskId"],
4546
+ params: [
4547
+ {
4548
+ name: "taskId",
4549
+ type: "string",
4550
+ required: true,
4551
+ description: "Task whose typed gates should run",
4552
+ cli: { positional: true }
4553
+ },
4554
+ {
4555
+ name: "agent",
4556
+ type: "string",
4557
+ required: false,
4558
+ description: "Actor attribution recorded on each gate result"
4559
+ }
4560
+ ]
4561
+ },
4132
4562
  // check.archive.stats incoming from admin (T5615)
4133
4563
  {
4134
4564
  gateway: "query",
@@ -4932,7 +5362,7 @@ var init_operations_registry = __esm({
4932
5362
  type: "string",
4933
5363
  required: false,
4934
5364
  description: "Task type",
4935
- enum: ["epic", "task", "subtask"],
5365
+ enum: ["saga", "epic", "task", "subtask"],
4936
5366
  cli: { flag: "type", short: "-t" }
4937
5367
  },
4938
5368
  {
@@ -4984,6 +5414,72 @@ var init_operations_registry = __esm({
4984
5414
  required: false,
4985
5415
  description: "Initial note entry for the task",
4986
5416
  cli: { flag: "notes" }
5417
+ },
5418
+ {
5419
+ name: "dependsWaiver",
5420
+ type: "string",
5421
+ required: false,
5422
+ description: "Nonempty reason waiving dependencies for explicit critical priority",
5423
+ cli: { flag: "depends-waiver" }
5424
+ },
5425
+ {
5426
+ name: "files",
5427
+ type: "array",
5428
+ required: false,
5429
+ description: "Associated repository file paths",
5430
+ cli: { flag: "files" }
5431
+ },
5432
+ {
5433
+ name: "dryRun",
5434
+ type: "boolean",
5435
+ required: false,
5436
+ description: "Preview creation without task or committed audit writes",
5437
+ cli: { flag: "dry-run" }
5438
+ },
5439
+ {
5440
+ name: "parentSearch",
5441
+ type: "string",
5442
+ required: false,
5443
+ description: "Search term for resolving the parent task",
5444
+ cli: { flag: "parent-search" }
5445
+ },
5446
+ {
5447
+ name: "kind",
5448
+ type: "string",
5449
+ required: false,
5450
+ description: "Task intent, independent of hierarchy",
5451
+ enum: ["work", "research", "experiment", "bug", "spike", "release"],
5452
+ cli: { flag: "kind" }
5453
+ },
5454
+ {
5455
+ name: "scope",
5456
+ type: "string",
5457
+ required: false,
5458
+ description: "Task granularity",
5459
+ enum: ["project", "feature", "unit"],
5460
+ cli: { flag: "scope" }
5461
+ },
5462
+ {
5463
+ name: "severity",
5464
+ type: "string",
5465
+ required: false,
5466
+ description: "Project-authorized severity with transactional signed evidence",
5467
+ enum: ["P0", "P1", "P2", "P3"],
5468
+ cli: { flag: "severity" }
5469
+ },
5470
+ {
5471
+ name: "forceDuplicate",
5472
+ type: "boolean",
5473
+ required: false,
5474
+ description: "Bypass duplicate rejection with committed decision provenance",
5475
+ cli: { flag: "force-duplicate" }
5476
+ },
5477
+ {
5478
+ name: "autoDecompose",
5479
+ type: "boolean",
5480
+ required: false,
5481
+ description: "Move the parent's text acceptance criteria onto a new first subtask when they would otherwise block this add (PM-Core V2 design-point 3) (T12298)",
5482
+ cli: { flag: "auto-decompose" }
4987
5483
  }
4988
5484
  ]
4989
5485
  },
@@ -5218,6 +5714,20 @@ var init_operations_registry = __esm({
5218
5714
  type: "array",
5219
5715
  required: false,
5220
5716
  description: "Remove related-task edges by taskId"
5717
+ },
5718
+ {
5719
+ name: "phase",
5720
+ type: "string",
5721
+ required: false,
5722
+ description: "Project-defined phase, independent of pipeline stage",
5723
+ cli: { flag: "phase" }
5724
+ },
5725
+ {
5726
+ name: "noAutoComplete",
5727
+ type: "boolean",
5728
+ required: false,
5729
+ description: "Disable automatic parent completion",
5730
+ cli: { flag: "no-auto-complete" }
5221
5731
  }
5222
5732
  ],
5223
5733
  inputSchema: tasksUpdateInputContract,
@@ -5288,44 +5798,59 @@ var init_operations_registry = __esm({
5288
5798
  required: true,
5289
5799
  description: "taskId parameter",
5290
5800
  cli: { positional: true }
5801
+ },
5802
+ {
5803
+ name: "force",
5804
+ type: "boolean",
5805
+ required: false,
5806
+ description: "Allow dependents and orphan children unless cascade is enabled"
5807
+ },
5808
+ {
5809
+ name: "cascade",
5810
+ type: "boolean",
5811
+ required: false,
5812
+ description: "Archive all descendants with the selected task"
5291
5813
  }
5292
5814
  ]
5293
5815
  },
5294
5816
  {
5295
5817
  gateway: "mutate",
5296
5818
  domain: "tasks",
5297
- operation: "archive",
5298
- description: "tasks.archive (mutate)",
5299
- tier: 1,
5300
- idempotent: false,
5301
- sessionRequired: false,
5302
- requiredParams: [],
5303
- params: []
5304
- },
5305
- {
5306
- gateway: "mutate",
5307
- domain: "tasks",
5308
- operation: "restore",
5309
- description: "tasks.restore (mutate) \u2014 absorbs reopen and unarchive via from param",
5819
+ operation: "reconcile-scope",
5820
+ description: "tasks.reconcile-scope (mutate) \u2014 sweep a saga/epic subtree for tasks whose scope overlaps and propose merge/absorb/split/link; read-only unless --apply",
5310
5821
  tier: 1,
5311
- idempotent: false,
5822
+ idempotent: true,
5312
5823
  sessionRequired: false,
5313
- requiredParams: ["taskId"],
5824
+ requiredParams: ["rootId"],
5314
5825
  params: [
5315
5826
  {
5316
- name: "taskId",
5827
+ name: "rootId",
5317
5828
  type: "string",
5318
5829
  required: true,
5319
- description: "taskId parameter",
5830
+ description: "Saga, epic or other container to sweep (its whole subtree is considered)",
5320
5831
  cli: { positional: true }
5832
+ },
5833
+ {
5834
+ name: "apply",
5835
+ type: "boolean",
5836
+ required: false,
5837
+ description: "Write the proposed `relates` edges (read-only without it)",
5838
+ cli: { flag: "apply" }
5839
+ },
5840
+ {
5841
+ name: "threshold",
5842
+ type: "number",
5843
+ required: false,
5844
+ description: "Report pairs at or above this similarity score, 0-1 (default 0.55)",
5845
+ cli: { flag: "threshold" }
5321
5846
  }
5322
5847
  ]
5323
5848
  },
5324
5849
  {
5325
5850
  gateway: "mutate",
5326
5851
  domain: "tasks",
5327
- operation: "reparent",
5328
- description: "tasks.reparent (mutate) \u2014 absorbs promote via newParentId:null",
5852
+ operation: "decompose",
5853
+ description: "tasks.decompose (mutate) \u2014 move a task\u2019s free-text acceptance criteria onto a new first child, turning the leaf into a container (PM-Core V2 design-point 3)",
5329
5854
  tier: 1,
5330
5855
  idempotent: false,
5331
5856
  sessionRequired: false,
@@ -5335,16 +5860,83 @@ var init_operations_registry = __esm({
5335
5860
  name: "taskId",
5336
5861
  type: "string",
5337
5862
  required: true,
5338
- description: "taskId parameter",
5863
+ description: "Task whose text acceptance criteria move to a new child",
5339
5864
  cli: { positional: true }
5865
+ },
5866
+ {
5867
+ name: "childTitle",
5868
+ type: "string",
5869
+ required: false,
5870
+ description: "Title for the child that inherits the criteria (default: the parent\u2019s)"
5871
+ },
5872
+ {
5873
+ name: "childDescription",
5874
+ type: "string",
5875
+ required: false,
5876
+ description: "Description for the child (default: the parent\u2019s)"
5877
+ },
5878
+ {
5879
+ name: "dryRun",
5880
+ type: "boolean",
5881
+ required: false,
5882
+ description: "Preview the move without writing"
5340
5883
  }
5341
5884
  ]
5342
5885
  },
5343
5886
  {
5344
5887
  gateway: "mutate",
5345
5888
  domain: "tasks",
5346
- operation: "reorder",
5347
- description: "tasks.reorder (mutate)",
5889
+ operation: "archive",
5890
+ description: "tasks.archive (mutate)",
5891
+ tier: 1,
5892
+ idempotent: false,
5893
+ sessionRequired: false,
5894
+ requiredParams: [],
5895
+ params: []
5896
+ },
5897
+ {
5898
+ gateway: "mutate",
5899
+ domain: "tasks",
5900
+ operation: "restore",
5901
+ description: "tasks.restore (mutate) \u2014 absorbs reopen and unarchive via from param",
5902
+ tier: 1,
5903
+ idempotent: false,
5904
+ sessionRequired: false,
5905
+ requiredParams: ["taskId"],
5906
+ params: [
5907
+ {
5908
+ name: "taskId",
5909
+ type: "string",
5910
+ required: true,
5911
+ description: "taskId parameter",
5912
+ cli: { positional: true }
5913
+ }
5914
+ ]
5915
+ },
5916
+ {
5917
+ gateway: "mutate",
5918
+ domain: "tasks",
5919
+ operation: "reparent",
5920
+ description: "tasks.reparent (mutate) \u2014 absorbs promote via newParentId:null",
5921
+ tier: 1,
5922
+ idempotent: false,
5923
+ sessionRequired: false,
5924
+ requiredParams: ["taskId"],
5925
+ params: [
5926
+ {
5927
+ name: "taskId",
5928
+ type: "string",
5929
+ required: true,
5930
+ description: "taskId parameter",
5931
+ cli: { positional: true }
5932
+ }
5933
+ ]
5934
+ },
5935
+ {
5936
+ gateway: "mutate",
5937
+ domain: "tasks",
5938
+ operation: "reorder",
5939
+ description: "tasks.reorder (mutate)",
5348
5940
  tier: 1,
5349
5941
  idempotent: false,
5350
5942
  sessionRequired: false,
@@ -6790,7 +7382,27 @@ var init_operations_registry = __esm({
6790
7382
  idempotent: false,
6791
7383
  sessionRequired: false,
6792
7384
  requiredParams: [],
6793
- params: []
7385
+ params: [
7386
+ {
7387
+ name: "source",
7388
+ type: "string",
7389
+ required: false,
7390
+ description: "Source of the reviewed backfill request."
7391
+ },
7392
+ { name: "kind", type: "string", required: false, description: "Backfill classification." },
7393
+ {
7394
+ name: "targetTable",
7395
+ type: "string",
7396
+ required: false,
7397
+ description: "Derived brain_page_nodes target only."
7398
+ },
7399
+ {
7400
+ name: "nodeIds",
7401
+ type: "array",
7402
+ required: false,
7403
+ description: "Exact qualified graph node IDs to stage; all must resolve to missing, eligible typed sources."
7404
+ }
7405
+ ]
6794
7406
  },
6795
7407
  {
6796
7408
  gateway: "mutate",
@@ -9552,279 +10164,642 @@ var init_operations_registry = __esm({
9552
10164
  name: "limit",
9553
10165
  type: "number",
9554
10166
  required: false,
9555
- description: "Maximum number of patterns to return"
10167
+ description: "Maximum number of patterns to return"
10168
+ }
10169
+ ]
10170
+ },
10171
+ {
10172
+ gateway: "query",
10173
+ domain: "intelligence",
10174
+ operation: "confidence",
10175
+ description: "Score verification confidence for a task based on current gate state",
10176
+ tier: 1,
10177
+ idempotent: true,
10178
+ sessionRequired: false,
10179
+ requiredParams: ["taskId"],
10180
+ params: [
10181
+ { name: "taskId", type: "string", required: true, description: "Task ID to score" }
10182
+ ]
10183
+ },
10184
+ {
10185
+ gateway: "query",
10186
+ domain: "intelligence",
10187
+ operation: "match",
10188
+ description: "Match known brain patterns against a task",
10189
+ tier: 1,
10190
+ idempotent: true,
10191
+ sessionRequired: false,
10192
+ requiredParams: ["taskId"],
10193
+ params: [
10194
+ {
10195
+ name: "taskId",
10196
+ type: "string",
10197
+ required: true,
10198
+ description: "Task ID to match patterns against"
10199
+ }
10200
+ ]
10201
+ },
10202
+ // ===========================================================================
10203
+ // DIAGNOSTICS domain (T624) — opt-in telemetry for self-improvement
10204
+ // ===========================================================================
10205
+ {
10206
+ gateway: "query",
10207
+ domain: "diagnostics",
10208
+ operation: "status",
10209
+ description: "diagnostics.status (query) \u2014 show telemetry opt-in state and DB path",
10210
+ tier: 2,
10211
+ idempotent: true,
10212
+ sessionRequired: false,
10213
+ requiredParams: [],
10214
+ params: []
10215
+ },
10216
+ {
10217
+ gateway: "query",
10218
+ domain: "diagnostics",
10219
+ operation: "analyze",
10220
+ description: "diagnostics.analyze (query) \u2014 aggregate telemetry patterns; surface failing/slow commands and generate BRAIN observations",
10221
+ tier: 2,
10222
+ idempotent: true,
10223
+ sessionRequired: false,
10224
+ requiredParams: [],
10225
+ params: [
10226
+ {
10227
+ name: "days",
10228
+ type: "number",
10229
+ required: false,
10230
+ description: "Analysis window in days (default: 30)",
10231
+ cli: { flag: "days", short: "-d" }
10232
+ },
10233
+ {
10234
+ name: "noBrain",
10235
+ type: "boolean",
10236
+ required: false,
10237
+ description: "Skip pushing observations to BRAIN",
10238
+ cli: { flag: "no-brain" }
10239
+ }
10240
+ ]
10241
+ },
10242
+ {
10243
+ gateway: "query",
10244
+ domain: "diagnostics",
10245
+ operation: "export",
10246
+ description: "diagnostics.export (query) \u2014 JSON dump of all telemetry events",
10247
+ tier: 2,
10248
+ idempotent: true,
10249
+ sessionRequired: false,
10250
+ requiredParams: [],
10251
+ params: [
10252
+ {
10253
+ name: "days",
10254
+ type: "number",
10255
+ required: false,
10256
+ description: "Limit export to last N days (default: all)",
10257
+ cli: { flag: "days", short: "-d" }
10258
+ }
10259
+ ]
10260
+ },
10261
+ {
10262
+ gateway: "mutate",
10263
+ domain: "diagnostics",
10264
+ operation: "enable",
10265
+ description: "diagnostics.enable (mutate) \u2014 opt in to anonymous command telemetry; generates stable anonymousId",
10266
+ tier: 2,
10267
+ idempotent: true,
10268
+ sessionRequired: false,
10269
+ requiredParams: [],
10270
+ params: []
10271
+ },
10272
+ {
10273
+ gateway: "mutate",
10274
+ domain: "diagnostics",
10275
+ operation: "disable",
10276
+ description: "diagnostics.disable (mutate) \u2014 opt out of telemetry collection",
10277
+ tier: 2,
10278
+ idempotent: true,
10279
+ sessionRequired: false,
10280
+ requiredParams: [],
10281
+ params: []
10282
+ },
10283
+ // ── docs (T797) ────────────────────────────────────────────────────────────
10284
+ {
10285
+ gateway: "mutate",
10286
+ domain: "docs",
10287
+ operation: "add",
10288
+ description: "docs.add (mutate) \u2014 attach a local file, URL, or inline content to a CLEO owner entity (task, session, observation)",
10289
+ tier: 1,
10290
+ idempotent: false,
10291
+ sessionRequired: false,
10292
+ requiredParams: ["ownerId"],
10293
+ params: [
10294
+ {
10295
+ name: "ownerId",
10296
+ type: "string",
10297
+ required: true,
10298
+ description: "Owner entity ID (e.g. T123, ses_*, O-abc)"
10299
+ },
10300
+ {
10301
+ name: "file",
10302
+ type: "string",
10303
+ required: false,
10304
+ description: "Path to local file to attach"
10305
+ },
10306
+ {
10307
+ name: "url",
10308
+ type: "string",
10309
+ required: false,
10310
+ description: "Remote URL to attach"
10311
+ },
10312
+ {
10313
+ name: "content",
10314
+ type: "string",
10315
+ required: false,
10316
+ description: "Inline document body (T10965); mutually exclusive with file/url"
10317
+ },
10318
+ {
10319
+ name: "desc",
10320
+ type: "string",
10321
+ required: false,
10322
+ description: "Free-text description"
10323
+ },
10324
+ {
10325
+ name: "labels",
10326
+ type: "string",
10327
+ required: false,
10328
+ description: "Comma-separated labels"
10329
+ },
10330
+ {
10331
+ name: "attachedBy",
10332
+ type: "string",
10333
+ required: false,
10334
+ description: 'Agent identity (defaults to "human")'
10335
+ }
10336
+ ]
10337
+ },
10338
+ {
10339
+ gateway: "query",
10340
+ domain: "docs",
10341
+ operation: "list",
10342
+ description: "docs.list (query) \u2014 list attachments associated with a CLEO owner entity",
10343
+ tier: 1,
10344
+ idempotent: true,
10345
+ sessionRequired: false,
10346
+ requiredParams: [],
10347
+ params: [
10348
+ {
10349
+ name: "task",
10350
+ type: "string",
10351
+ required: false,
10352
+ description: "Filter by task ID (e.g. T123)"
10353
+ },
10354
+ {
10355
+ name: "session",
10356
+ type: "string",
10357
+ required: false,
10358
+ description: "Filter by session ID (e.g. ses_*)"
10359
+ },
10360
+ {
10361
+ name: "observation",
10362
+ type: "string",
10363
+ required: false,
10364
+ description: "Filter by observation ID (e.g. O-abc)"
10365
+ }
10366
+ ]
10367
+ },
10368
+ {
10369
+ gateway: "query",
10370
+ domain: "docs",
10371
+ operation: "fetch",
10372
+ description: "docs.fetch (query) \u2014 retrieve attachment bytes and metadata by attachment ID or SHA-256",
10373
+ tier: 1,
10374
+ idempotent: true,
10375
+ sessionRequired: false,
10376
+ requiredParams: ["attachmentRef"],
10377
+ params: [
10378
+ {
10379
+ name: "attachmentRef",
10380
+ type: "string",
10381
+ required: true,
10382
+ description: "Attachment ID (att_*) or SHA-256 hex"
10383
+ }
10384
+ ]
10385
+ },
10386
+ {
10387
+ gateway: "mutate",
10388
+ domain: "docs",
10389
+ operation: "remove",
10390
+ description: "docs.remove (mutate) \u2014 remove an attachment ref from an owner; purges blob when refCount reaches zero",
10391
+ tier: 1,
10392
+ idempotent: true,
10393
+ sessionRequired: false,
10394
+ requiredParams: ["attachmentRef", "from"],
10395
+ params: [
10396
+ {
10397
+ name: "attachmentRef",
10398
+ type: "string",
10399
+ required: true,
10400
+ description: "Attachment ID (att_*) or SHA-256 hex"
10401
+ },
10402
+ {
10403
+ name: "from",
10404
+ type: "string",
10405
+ required: true,
10406
+ description: "Owner entity ID to remove the ref from"
10407
+ }
10408
+ ]
10409
+ },
10410
+ // ── docs.supersede (T10162) ──────────────────────────────────────────────
10411
+ {
10412
+ gateway: "mutate",
10413
+ domain: "docs",
10414
+ operation: "supersede",
10415
+ description: "docs.supersede (mutate) \u2014 atomically flip an older doc to `superseded` and link both rows via the supersedes/superseded_by self-FK pointers (T10162 \xB7 Saga T9855)",
10416
+ tier: 1,
10417
+ idempotent: true,
10418
+ sessionRequired: false,
10419
+ requiredParams: ["oldSlug", "newSlug"],
10420
+ params: [
10421
+ {
10422
+ name: "oldSlug",
10423
+ type: "string",
10424
+ required: true,
10425
+ description: "Slug of the doc being replaced",
10426
+ cli: { positional: true }
10427
+ },
10428
+ {
10429
+ name: "newSlug",
10430
+ type: "string",
10431
+ required: true,
10432
+ description: "Slug of the doc that replaces oldSlug",
10433
+ cli: { positional: true }
10434
+ },
10435
+ {
10436
+ name: "reason",
10437
+ type: "string",
10438
+ required: false,
10439
+ description: "Optional human-readable reason carried back on the response"
10440
+ }
10441
+ ]
10442
+ },
10443
+ {
10444
+ gateway: "query",
10445
+ domain: "docs",
10446
+ operation: "status",
10447
+ description: "docs.status (query) \u2014 inspect published documentation drift",
10448
+ tier: 1,
10449
+ idempotent: true,
10450
+ sessionRequired: false,
10451
+ requiredParams: [],
10452
+ params: []
10453
+ },
10454
+ {
10455
+ gateway: "query",
10456
+ domain: "docs",
10457
+ operation: "export",
10458
+ description: "docs.export (query) \u2014 Export a task document",
10459
+ tier: 1,
10460
+ idempotent: true,
10461
+ sessionRequired: false,
10462
+ requiredParams: ["taskId"],
10463
+ params: [
10464
+ {
10465
+ name: "taskId",
10466
+ type: "string",
10467
+ required: true,
10468
+ description: "Task whose document to export"
10469
+ },
10470
+ {
10471
+ name: "includeAttachments",
10472
+ type: "boolean",
10473
+ required: false,
10474
+ description: "Include attachment manifest"
10475
+ },
10476
+ {
10477
+ name: "includeMemoryRefs",
10478
+ type: "boolean",
10479
+ required: false,
10480
+ description: "Include memory references"
10481
+ }
10482
+ ]
10483
+ },
10484
+ {
10485
+ gateway: "query",
10486
+ domain: "docs",
10487
+ operation: "search",
10488
+ description: "docs.search (query) \u2014 Search document content",
10489
+ tier: 1,
10490
+ idempotent: true,
10491
+ sessionRequired: false,
10492
+ requiredParams: ["query"],
10493
+ params: [
10494
+ {
10495
+ name: "query",
10496
+ type: "string",
10497
+ required: true,
10498
+ description: "Document search text"
10499
+ },
10500
+ {
10501
+ name: "ownerId",
10502
+ type: "string",
10503
+ required: false,
10504
+ description: "Optional owner scope"
10505
+ },
10506
+ { name: "limit", type: "number", required: false, description: "Maximum matches" },
10507
+ {
10508
+ name: "type",
10509
+ type: "string",
10510
+ required: false,
10511
+ description: "Document kind filter"
9556
10512
  }
9557
10513
  ]
9558
10514
  },
9559
10515
  {
9560
10516
  gateway: "query",
9561
- domain: "intelligence",
9562
- operation: "confidence",
9563
- description: "Score verification confidence for a task based on current gate state",
10517
+ domain: "docs",
10518
+ operation: "find",
10519
+ description: "docs.find (query) \u2014 Find similar documents",
9564
10520
  tier: 1,
9565
10521
  idempotent: true,
9566
10522
  sessionRequired: false,
9567
- requiredParams: ["taskId"],
10523
+ requiredParams: ["similarSlug"],
9568
10524
  params: [
9569
- { name: "taskId", type: "string", required: true, description: "Task ID to score" }
10525
+ {
10526
+ name: "similarSlug",
10527
+ type: "string",
10528
+ required: true,
10529
+ description: "Existing document slug to compare"
10530
+ },
10531
+ { name: "limit", type: "number", required: false, description: "Maximum matches" },
10532
+ {
10533
+ name: "threshold",
10534
+ type: "number",
10535
+ required: false,
10536
+ description: "Minimum similarity"
10537
+ },
10538
+ {
10539
+ name: "allKinds",
10540
+ type: "boolean",
10541
+ required: false,
10542
+ description: "Compare all document kinds"
10543
+ }
9570
10544
  ]
9571
10545
  },
9572
10546
  {
9573
10547
  gateway: "query",
9574
- domain: "intelligence",
9575
- operation: "match",
9576
- description: "Match known brain patterns against a task",
10548
+ domain: "docs",
10549
+ operation: "merge",
10550
+ description: "docs.merge (query) \u2014 Preview a document merge",
9577
10551
  tier: 1,
9578
10552
  idempotent: true,
9579
10553
  sessionRequired: false,
9580
- requiredParams: ["taskId"],
10554
+ requiredParams: ["attA", "attB"],
9581
10555
  params: [
9582
10556
  {
9583
- name: "taskId",
10557
+ name: "attA",
9584
10558
  type: "string",
9585
10559
  required: true,
9586
- description: "Task ID to match patterns against"
10560
+ description: "First attachment reference"
10561
+ },
10562
+ {
10563
+ name: "attB",
10564
+ type: "string",
10565
+ required: true,
10566
+ description: "Second attachment reference"
10567
+ },
10568
+ {
10569
+ name: "strategy",
10570
+ type: "string",
10571
+ required: false,
10572
+ description: "three-way, cherry-pick, or multi-diff"
10573
+ },
10574
+ {
10575
+ name: "base",
10576
+ type: "string",
10577
+ required: false,
10578
+ description: "Common ancestor attachment reference"
9587
10579
  }
9588
10580
  ]
9589
10581
  },
9590
- // ===========================================================================
9591
- // DIAGNOSTICS domain (T624) — opt-in telemetry for self-improvement
9592
- // ===========================================================================
9593
- {
9594
- gateway: "query",
9595
- domain: "diagnostics",
9596
- operation: "status",
9597
- description: "diagnostics.status (query) \u2014 show telemetry opt-in state and DB path",
9598
- tier: 2,
9599
- idempotent: true,
9600
- sessionRequired: false,
9601
- requiredParams: [],
9602
- params: []
9603
- },
9604
10582
  {
9605
10583
  gateway: "query",
9606
- domain: "diagnostics",
9607
- operation: "analyze",
9608
- description: "diagnostics.analyze (query) \u2014 aggregate telemetry patterns; surface failing/slow commands and generate BRAIN observations",
9609
- tier: 2,
10584
+ domain: "docs",
10585
+ operation: "rank",
10586
+ description: "docs.rank (query) \u2014 Rank owner documents",
10587
+ tier: 1,
9610
10588
  idempotent: true,
9611
10589
  sessionRequired: false,
9612
- requiredParams: [],
10590
+ requiredParams: ["ownerId"],
9613
10591
  params: [
9614
10592
  {
9615
- name: "days",
9616
- type: "number",
9617
- required: false,
9618
- description: "Analysis window in days (default: 30)",
9619
- cli: { flag: "days", short: "-d" }
10593
+ name: "ownerId",
10594
+ type: "string",
10595
+ required: true,
10596
+ description: "Owner whose documents to rank"
9620
10597
  },
9621
10598
  {
9622
- name: "noBrain",
9623
- type: "boolean",
10599
+ name: "query",
10600
+ type: "string",
9624
10601
  required: false,
9625
- description: "Skip pushing observations to BRAIN",
9626
- cli: { flag: "no-brain" }
10602
+ description: "Optional ranking query"
9627
10603
  }
9628
10604
  ]
9629
10605
  },
9630
10606
  {
9631
10607
  gateway: "query",
9632
- domain: "diagnostics",
9633
- operation: "export",
9634
- description: "diagnostics.export (query) \u2014 JSON dump of all telemetry events",
9635
- tier: 2,
10608
+ domain: "docs",
10609
+ operation: "versions",
10610
+ description: "docs.versions (query) \u2014 List document versions",
10611
+ tier: 1,
9636
10612
  idempotent: true,
9637
10613
  sessionRequired: false,
9638
- requiredParams: [],
10614
+ requiredParams: ["ownerId"],
9639
10615
  params: [
10616
+ { name: "ownerId", type: "string", required: true, description: "Document owner" },
9640
10617
  {
9641
- name: "days",
9642
- type: "number",
10618
+ name: "name",
10619
+ type: "string",
9643
10620
  required: false,
9644
- description: "Limit export to last N days (default: all)",
9645
- cli: { flag: "days", short: "-d" }
10621
+ description: "Optional document name"
9646
10622
  }
9647
10623
  ]
9648
10624
  },
9649
- {
9650
- gateway: "mutate",
9651
- domain: "diagnostics",
9652
- operation: "enable",
9653
- description: "diagnostics.enable (mutate) \u2014 opt in to anonymous command telemetry; generates stable anonymousId",
9654
- tier: 2,
9655
- idempotent: true,
9656
- sessionRequired: false,
9657
- requiredParams: [],
9658
- params: []
9659
- },
9660
- {
9661
- gateway: "mutate",
9662
- domain: "diagnostics",
9663
- operation: "disable",
9664
- description: "diagnostics.disable (mutate) \u2014 opt out of telemetry collection",
9665
- tier: 2,
9666
- idempotent: true,
9667
- sessionRequired: false,
9668
- requiredParams: [],
9669
- params: []
9670
- },
9671
- // ── docs (T797) ────────────────────────────────────────────────────────────
9672
10625
  {
9673
10626
  gateway: "mutate",
9674
10627
  domain: "docs",
9675
- operation: "add",
9676
- description: "docs.add (mutate) \u2014 attach a local file, URL, or inline content to a CLEO owner entity (task, session, observation)",
10628
+ operation: "publish",
10629
+ description: "docs.publish (mutate) \u2014 Publish a document to a file or pull request",
9677
10630
  tier: 1,
9678
10631
  idempotent: false,
9679
10632
  sessionRequired: false,
9680
- requiredParams: ["ownerId"],
10633
+ requiredParams: [],
9681
10634
  params: [
9682
10635
  {
9683
- name: "ownerId",
10636
+ name: "target",
9684
10637
  type: "string",
9685
- required: true,
9686
- description: "Owner entity ID (e.g. T123, ses_*, O-abc)"
10638
+ required: false,
10639
+ description: "Publication target: file or pr"
9687
10640
  },
9688
10641
  {
9689
- name: "file",
10642
+ name: "ownerId",
9690
10643
  type: "string",
9691
10644
  required: false,
9692
- description: "Path to local file to attach"
10645
+ description: "Required for file publication"
9693
10646
  },
9694
10647
  {
9695
- name: "url",
10648
+ name: "toPath",
9696
10649
  type: "string",
9697
10650
  required: false,
9698
- description: "Remote URL to attach"
10651
+ description: "Required destination for file publication"
9699
10652
  },
9700
10653
  {
9701
- name: "content",
10654
+ name: "attachmentId",
9702
10655
  type: "string",
9703
10656
  required: false,
9704
- description: "Inline document body (T10965); mutually exclusive with file/url"
10657
+ description: "Attachment to publish"
9705
10658
  },
9706
10659
  {
9707
- name: "desc",
10660
+ name: "slugOrId",
9708
10661
  type: "string",
9709
10662
  required: false,
9710
- description: "Free-text description"
10663
+ description: "Required document reference for PR publication"
9711
10664
  },
9712
10665
  {
9713
- name: "labels",
10666
+ name: "slug",
9714
10667
  type: "string",
9715
10668
  required: false,
9716
- description: "Comma-separated labels"
10669
+ description: "Override document slug"
9717
10670
  },
9718
10671
  {
9719
- name: "attachedBy",
10672
+ name: "type",
9720
10673
  type: "string",
9721
10674
  required: false,
9722
- description: 'Agent identity (defaults to "human")'
9723
- }
10675
+ description: "Override document kind"
10676
+ },
10677
+ { name: "title", type: "string", required: false, description: "Override PR title" },
10678
+ { name: "body", type: "string", required: false, description: "Override PR body" },
10679
+ { name: "base", type: "string", required: false, description: "PR base branch" }
9724
10680
  ]
9725
10681
  },
9726
10682
  {
9727
- gateway: "query",
10683
+ gateway: "mutate",
9728
10684
  domain: "docs",
9729
- operation: "list",
9730
- description: "docs.list (query) \u2014 list attachments associated with a CLEO owner entity",
10685
+ operation: "publish-pr",
10686
+ description: "docs.publish-pr (mutate) \u2014 Legacy alias for PR publication",
9731
10687
  tier: 1,
9732
- idempotent: true,
10688
+ idempotent: false,
9733
10689
  sessionRequired: false,
9734
- requiredParams: [],
10690
+ requiredParams: ["slugOrId"],
9735
10691
  params: [
9736
10692
  {
9737
- name: "task",
10693
+ name: "slugOrId",
9738
10694
  type: "string",
9739
- required: false,
9740
- description: "Filter by task ID (e.g. T123)"
10695
+ required: true,
10696
+ description: "Document reference to publish"
9741
10697
  },
9742
10698
  {
9743
- name: "session",
10699
+ name: "slug",
9744
10700
  type: "string",
9745
10701
  required: false,
9746
- description: "Filter by session ID (e.g. ses_*)"
10702
+ description: "Override document slug"
9747
10703
  },
9748
10704
  {
9749
- name: "observation",
10705
+ name: "type",
9750
10706
  type: "string",
9751
10707
  required: false,
9752
- description: "Filter by observation ID (e.g. O-abc)"
9753
- }
10708
+ description: "Override document kind"
10709
+ },
10710
+ { name: "title", type: "string", required: false, description: "Override PR title" },
10711
+ { name: "body", type: "string", required: false, description: "Override PR body" },
10712
+ { name: "base", type: "string", required: false, description: "PR base branch" }
9754
10713
  ]
9755
10714
  },
9756
10715
  {
9757
- gateway: "query",
10716
+ gateway: "mutate",
9758
10717
  domain: "docs",
9759
- operation: "fetch",
9760
- description: "docs.fetch (query) \u2014 retrieve attachment bytes and metadata by attachment ID or SHA-256",
10718
+ operation: "sync",
10719
+ description: "docs.sync (mutate) \u2014 Sync document content from a file",
9761
10720
  tier: 1,
9762
- idempotent: true,
10721
+ idempotent: false,
9763
10722
  sessionRequired: false,
9764
- requiredParams: ["attachmentRef"],
10723
+ requiredParams: ["ownerId", "fromPath"],
9765
10724
  params: [
10725
+ { name: "ownerId", type: "string", required: true, description: "Document owner" },
9766
10726
  {
9767
- name: "attachmentRef",
10727
+ name: "fromPath",
9768
10728
  type: "string",
9769
10729
  required: true,
9770
- description: "Attachment ID (att_*) or SHA-256 hex"
10730
+ description: "Source file path"
10731
+ },
10732
+ {
10733
+ name: "blobName",
10734
+ type: "string",
10735
+ required: false,
10736
+ description: "Document blob name"
10737
+ },
10738
+ {
10739
+ name: "contentType",
10740
+ type: "string",
10741
+ required: false,
10742
+ description: "Document media type"
9771
10743
  }
9772
10744
  ]
9773
10745
  },
9774
10746
  {
9775
10747
  gateway: "mutate",
9776
10748
  domain: "docs",
9777
- operation: "remove",
9778
- description: "docs.remove (mutate) \u2014 remove an attachment ref from an owner; purges blob when refCount reaches zero",
10749
+ operation: "import",
10750
+ description: "docs.import (mutate) \u2014 Import classified project documents",
9779
10751
  tier: 1,
9780
- idempotent: true,
10752
+ idempotent: false,
9781
10753
  sessionRequired: false,
9782
- requiredParams: ["attachmentRef", "from"],
10754
+ requiredParams: ["scanRoot"],
9783
10755
  params: [
9784
10756
  {
9785
- name: "attachmentRef",
10757
+ name: "scanRoot",
9786
10758
  type: "string",
9787
10759
  required: true,
9788
- description: "Attachment ID (att_*) or SHA-256 hex"
10760
+ description: "Root directory to scan"
9789
10761
  },
9790
10762
  {
9791
- name: "from",
10763
+ name: "dryRun",
10764
+ type: "boolean",
10765
+ required: false,
10766
+ description: "Preview without writing"
10767
+ },
10768
+ {
10769
+ name: "force",
10770
+ type: "boolean",
10771
+ required: false,
10772
+ description: "Replace conflicting import mappings"
10773
+ },
10774
+ {
10775
+ name: "manifestPath",
9792
10776
  type: "string",
9793
- required: true,
9794
- description: "Owner entity ID to remove the ref from"
10777
+ required: false,
10778
+ description: "Import manifest path"
9795
10779
  }
9796
10780
  ]
9797
10781
  },
9798
- // ── docs.supersede (T10162) ──────────────────────────────────────────────
9799
10782
  {
9800
- gateway: "mutate",
10783
+ gateway: "query",
9801
10784
  domain: "docs",
9802
- operation: "supersede",
9803
- description: "docs.supersede (mutate) \u2014 atomically flip an older doc to `superseded` and link both rows via the supersedes/superseded_by self-FK pointers (T10162 \xB7 Saga T9855)",
10785
+ operation: "audit",
10786
+ description: "docs.audit (query) \u2014 inspect document history or verify audit chain integrity",
9804
10787
  tier: 1,
9805
10788
  idempotent: true,
9806
10789
  sessionRequired: false,
9807
- requiredParams: ["oldSlug", "newSlug"],
10790
+ requiredParams: [],
9808
10791
  params: [
9809
10792
  {
9810
- name: "oldSlug",
9811
- type: "string",
9812
- required: true,
9813
- description: "Slug of the doc being replaced",
9814
- cli: { positional: true }
9815
- },
9816
- {
9817
- name: "newSlug",
10793
+ name: "slug",
9818
10794
  type: "string",
9819
- required: true,
9820
- description: "Slug of the doc that replaces oldSlug",
9821
- cli: { positional: true }
10795
+ required: false,
10796
+ description: "Document slug whose history to inspect"
9822
10797
  },
9823
10798
  {
9824
- name: "reason",
9825
- type: "string",
10799
+ name: "verify",
10800
+ type: "boolean",
9826
10801
  required: false,
9827
- description: "Optional human-readable reason carried back on the response"
10802
+ description: "Verify the full audit chain"
9828
10803
  }
9829
10804
  ]
9830
10805
  },
@@ -12067,7 +13042,7 @@ var init_operations_registry = __esm({
12067
13042
  });
12068
13043
 
12069
13044
  // packages/contracts/src/docs/provenance.ts
12070
- import { z as z7 } from "zod";
13045
+ import { z as z8 } from "zod";
12071
13046
  var PROVENANCE_NODE_KINDS, PROVENANCE_EDGE_RELATIONS, DOC_LIFECYCLE_STATUSES, provenanceNodeKindSchema, provenanceEdgeRelationSchema, docLifecycleStatusSchema, provenanceNodeBaseFields, provenanceDocNodeSchema, provenanceTaskNodeSchema, provenanceDecisionNodeSchema, provenanceSessionNodeSchema, provenanceMemoryNodeSchema, provenanceNodeSchema, provenanceEdgeSchema, docProvenanceResponseSchema;
12072
13047
  var init_provenance = __esm({
12073
13048
  "packages/contracts/src/docs/provenance.ts"() {
@@ -12094,102 +13069,102 @@ var init_provenance = __esm({
12094
13069
  "archived",
12095
13070
  "draft"
12096
13071
  ];
12097
- provenanceNodeKindSchema = z7.enum(PROVENANCE_NODE_KINDS);
12098
- provenanceEdgeRelationSchema = z7.enum(PROVENANCE_EDGE_RELATIONS);
12099
- docLifecycleStatusSchema = z7.enum(DOC_LIFECYCLE_STATUSES);
13072
+ provenanceNodeKindSchema = z8.enum(PROVENANCE_NODE_KINDS);
13073
+ provenanceEdgeRelationSchema = z8.enum(PROVENANCE_EDGE_RELATIONS);
13074
+ docLifecycleStatusSchema = z8.enum(DOC_LIFECYCLE_STATUSES);
12100
13075
  provenanceNodeBaseFields = {
12101
- id: z7.string().min(1),
12102
- title: z7.string().min(1),
12103
- metadata: z7.record(z7.string(), z7.unknown()).optional()
13076
+ id: z8.string().min(1),
13077
+ title: z8.string().min(1),
13078
+ metadata: z8.record(z8.string(), z8.unknown()).optional()
12104
13079
  };
12105
- provenanceDocNodeSchema = z7.object({
13080
+ provenanceDocNodeSchema = z8.object({
12106
13081
  ...provenanceNodeBaseFields,
12107
- kind: z7.literal("doc"),
12108
- slug: z7.string().min(1),
12109
- docKind: z7.string().min(1),
13082
+ kind: z8.literal("doc"),
13083
+ slug: z8.string().min(1),
13084
+ docKind: z8.string().min(1),
12110
13085
  lifecycleStatus: docLifecycleStatusSchema,
12111
- publishedAt: z7.string().min(1),
12112
- supersededAt: z7.string().min(1).optional(),
12113
- summary: z7.string().optional()
13086
+ publishedAt: z8.string().min(1),
13087
+ supersededAt: z8.string().min(1).optional(),
13088
+ summary: z8.string().optional()
12114
13089
  });
12115
- provenanceTaskNodeSchema = z7.object({
13090
+ provenanceTaskNodeSchema = z8.object({
12116
13091
  ...provenanceNodeBaseFields,
12117
- kind: z7.literal("task"),
12118
- taskType: z7.enum(["saga", "epic", "task", "subtask"]),
12119
- status: z7.enum(["pending", "in_progress", "done", "blocked", "cancelled", "archived"])
13092
+ kind: z8.literal("task"),
13093
+ taskType: z8.enum(["saga", "epic", "task", "subtask"]),
13094
+ status: z8.enum(["pending", "in_progress", "done", "blocked", "cancelled", "archived"])
12120
13095
  });
12121
- provenanceDecisionNodeSchema = z7.object({
13096
+ provenanceDecisionNodeSchema = z8.object({
12122
13097
  ...provenanceNodeBaseFields,
12123
- kind: z7.literal("decision"),
12124
- outcome: z7.enum(["proposed", "accepted", "rejected", "superseded"]),
12125
- decidedAt: z7.string().min(1)
13098
+ kind: z8.literal("decision"),
13099
+ outcome: z8.enum(["proposed", "accepted", "rejected", "superseded"]),
13100
+ decidedAt: z8.string().min(1)
12126
13101
  });
12127
- provenanceSessionNodeSchema = z7.object({
13102
+ provenanceSessionNodeSchema = z8.object({
12128
13103
  ...provenanceNodeBaseFields,
12129
- kind: z7.literal("session"),
12130
- startedAt: z7.string().min(1),
12131
- endedAt: z7.string().min(1).optional()
13104
+ kind: z8.literal("session"),
13105
+ startedAt: z8.string().min(1),
13106
+ endedAt: z8.string().min(1).optional()
12132
13107
  });
12133
- provenanceMemoryNodeSchema = z7.object({
13108
+ provenanceMemoryNodeSchema = z8.object({
12134
13109
  ...provenanceNodeBaseFields,
12135
- kind: z7.literal("memory"),
12136
- memoryType: z7.enum(["observation", "pattern", "decision", "diary"]),
12137
- recordedAt: z7.string().min(1)
13110
+ kind: z8.literal("memory"),
13111
+ memoryType: z8.enum(["observation", "pattern", "decision", "diary"]),
13112
+ recordedAt: z8.string().min(1)
12138
13113
  });
12139
- provenanceNodeSchema = z7.discriminatedUnion("kind", [
13114
+ provenanceNodeSchema = z8.discriminatedUnion("kind", [
12140
13115
  provenanceDocNodeSchema,
12141
13116
  provenanceTaskNodeSchema,
12142
13117
  provenanceDecisionNodeSchema,
12143
13118
  provenanceSessionNodeSchema,
12144
13119
  provenanceMemoryNodeSchema
12145
13120
  ]);
12146
- provenanceEdgeSchema = z7.object({
13121
+ provenanceEdgeSchema = z8.object({
12147
13122
  relation: provenanceEdgeRelationSchema,
12148
- from: z7.string().min(1),
13123
+ from: z8.string().min(1),
12149
13124
  fromKind: provenanceNodeKindSchema,
12150
- to: z7.string().min(1),
13125
+ to: z8.string().min(1),
12151
13126
  toKind: provenanceNodeKindSchema,
12152
- addedAt: z7.string().min(1),
12153
- summary: z7.string().optional()
13127
+ addedAt: z8.string().min(1),
13128
+ summary: z8.string().optional()
12154
13129
  });
12155
- docProvenanceResponseSchema = z7.object({
12156
- nodes: z7.array(provenanceNodeSchema).readonly(),
12157
- edges: z7.array(provenanceEdgeSchema).readonly(),
12158
- totalNodes: z7.number().int().nonnegative(),
12159
- totalEdges: z7.number().int().nonnegative()
13130
+ docProvenanceResponseSchema = z8.object({
13131
+ nodes: z8.array(provenanceNodeSchema).readonly(),
13132
+ edges: z8.array(provenanceEdgeSchema).readonly(),
13133
+ totalNodes: z8.number().int().nonnegative(),
13134
+ totalEdges: z8.number().int().nonnegative()
12160
13135
  });
12161
13136
  }
12162
13137
  });
12163
13138
 
12164
13139
  // packages/contracts/src/docs/read.ts
12165
- import { z as z8 } from "zod";
13140
+ import { z as z9 } from "zod";
12166
13141
  var docFrontmatterSchema, docBodySchema, docReadResponseSchema;
12167
13142
  var init_read = __esm({
12168
13143
  "packages/contracts/src/docs/read.ts"() {
12169
13144
  "use strict";
12170
- docFrontmatterSchema = z8.object({
12171
- slug: z8.string(),
12172
- kind: z8.string().nullable(),
12173
- title: z8.string().nullable(),
12174
- summary: z8.string().nullable(),
12175
- lifecycleStatus: z8.string(),
12176
- docVersion: z8.number().int(),
12177
- ownerVersion: z8.string().nullable(),
12178
- supersedes: z8.string().nullable(),
12179
- supersededBy: z8.string().nullable(),
12180
- topics: z8.array(z8.string()).readonly(),
12181
- relatedTasks: z8.array(z8.string()).readonly(),
12182
- sha256: z8.string(),
12183
- createdAt: z8.string()
12184
- });
12185
- docBodySchema = z8.object({
12186
- encoding: z8.enum(["utf-8", "base64"]),
12187
- text: z8.string().optional(),
12188
- base64: z8.string().optional(),
12189
- sizeBytes: z8.number().int().nonnegative(),
12190
- mimeType: z8.string().nullable()
12191
- });
12192
- docReadResponseSchema = z8.object({
13145
+ docFrontmatterSchema = z9.object({
13146
+ slug: z9.string(),
13147
+ kind: z9.string().nullable(),
13148
+ title: z9.string().nullable(),
13149
+ summary: z9.string().nullable(),
13150
+ lifecycleStatus: z9.string(),
13151
+ docVersion: z9.number().int(),
13152
+ ownerVersion: z9.string().nullable(),
13153
+ supersedes: z9.string().nullable(),
13154
+ supersededBy: z9.string().nullable(),
13155
+ topics: z9.array(z9.string()).readonly(),
13156
+ relatedTasks: z9.array(z9.string()).readonly(),
13157
+ sha256: z9.string(),
13158
+ createdAt: z9.string()
13159
+ });
13160
+ docBodySchema = z9.object({
13161
+ encoding: z9.enum(["utf-8", "base64"]),
13162
+ text: z9.string().optional(),
13163
+ base64: z9.string().optional(),
13164
+ sizeBytes: z9.number().int().nonnegative(),
13165
+ mimeType: z9.string().nullable()
13166
+ });
13167
+ docReadResponseSchema = z9.object({
12193
13168
  frontmatter: docFrontmatterSchema,
12194
13169
  body: docBodySchema
12195
13170
  });
@@ -12249,7 +13224,7 @@ var init_errors = __esm({
12249
13224
  });
12250
13225
 
12251
13226
  // packages/contracts/src/evidence-atom-schema.ts
12252
- import { z as z9 } from "zod";
13227
+ import { z as z10 } from "zod";
12253
13228
  var EVIDENCE_ATOM_KINDS, PARSER_PREFIXES, KIND_BOUNDARY_REGEX, commitAtomSchema, filesAtomSchema, testRunAtomSchema, toolAtomSchema, urlAtomSchema, noteAtomSchema, decisionAtomSchema, prAtomSchema, locDropAtomSchema, callsiteCoverageAtomSchema, AC_UUID_REGEX, AC_ALIAS_REGEX, SATISFIES_TASK_ID_REGEX, SATISFIES_VERSION_PIN_REGEX, satisfiesAtomSchema, EvidenceAtomSchema, GATE_EVIDENCE_REQUIREMENTS, ATOM_EXAMPLES;
12254
13229
  var init_evidence_atom_schema = __esm({
12255
13230
  "packages/contracts/src/evidence-atom-schema.ts"() {
@@ -12269,67 +13244,67 @@ var init_evidence_atom_schema = __esm({
12269
13244
  ];
12270
13245
  PARSER_PREFIXES = [...EVIDENCE_ATOM_KINDS, "state"];
12271
13246
  KIND_BOUNDARY_REGEX = new RegExp(`;(?=\\s*(?:${PARSER_PREFIXES.join("|")})\\s*:)`, "g");
12272
- commitAtomSchema = z9.object({
12273
- kind: z9.literal("commit"),
12274
- sha: z9.string().regex(/^[0-9a-f]{7,40}$/i, "commit sha must be 7-40 hex characters")
13247
+ commitAtomSchema = z10.object({
13248
+ kind: z10.literal("commit"),
13249
+ sha: z10.string().regex(/^[0-9a-f]{7,40}$/i, "commit sha must be 7-40 hex characters")
12275
13250
  });
12276
- filesAtomSchema = z9.object({
12277
- kind: z9.literal("files"),
12278
- paths: z9.array(z9.string().min(1)).min(1, "files atom requires at least one path")
13251
+ filesAtomSchema = z10.object({
13252
+ kind: z10.literal("files"),
13253
+ paths: z10.array(z10.string().min(1)).min(1, "files atom requires at least one path")
12279
13254
  });
12280
- testRunAtomSchema = z9.object({
12281
- kind: z9.literal("test-run"),
12282
- path: z9.string().min(1, "test-run atom requires a non-empty path")
13255
+ testRunAtomSchema = z10.object({
13256
+ kind: z10.literal("test-run"),
13257
+ path: z10.string().min(1, "test-run atom requires a non-empty path")
12283
13258
  });
12284
- toolAtomSchema = z9.object({
12285
- kind: z9.literal("tool"),
12286
- tool: z9.string().min(1, "tool atom requires a non-empty tool name")
13259
+ toolAtomSchema = z10.object({
13260
+ kind: z10.literal("tool"),
13261
+ tool: z10.string().min(1, "tool atom requires a non-empty tool name")
12287
13262
  });
12288
- urlAtomSchema = z9.object({
12289
- kind: z9.literal("url"),
12290
- url: z9.string().min(1).regex(/^https?:\/\//, "url atom must start with http:// or https://")
13263
+ urlAtomSchema = z10.object({
13264
+ kind: z10.literal("url"),
13265
+ url: z10.string().min(1).regex(/^https?:\/\//, "url atom must start with http:// or https://")
12291
13266
  });
12292
- noteAtomSchema = z9.object({
12293
- kind: z9.literal("note"),
12294
- note: z9.string().min(1, "note atom must be non-empty").max(512, "note atom is too long (max 512 chars)")
13267
+ noteAtomSchema = z10.object({
13268
+ kind: z10.literal("note"),
13269
+ note: z10.string().min(1, "note atom must be non-empty").max(512, "note atom is too long (max 512 chars)")
12295
13270
  });
12296
- decisionAtomSchema = z9.object({
12297
- kind: z9.literal("decision"),
12298
- decisionId: z9.string().min(1, "decision atom requires a non-empty decision ID")
13271
+ decisionAtomSchema = z10.object({
13272
+ kind: z10.literal("decision"),
13273
+ decisionId: z10.string().min(1, "decision atom requires a non-empty decision ID")
12299
13274
  });
12300
- prAtomSchema = z9.object({
12301
- kind: z9.literal("pr"),
12302
- prNumber: z9.number().int().positive("pr atom requires a positive integer PR number")
13275
+ prAtomSchema = z10.object({
13276
+ kind: z10.literal("pr"),
13277
+ prNumber: z10.number().int().positive("pr atom requires a positive integer PR number")
12303
13278
  });
12304
- locDropAtomSchema = z9.object({
12305
- kind: z9.literal("loc-drop"),
12306
- fromLines: z9.number().int().nonnegative("loc-drop fromLines must be \u2265 0"),
12307
- toLines: z9.number().int().nonnegative("loc-drop toLines must be \u2265 0")
13279
+ locDropAtomSchema = z10.object({
13280
+ kind: z10.literal("loc-drop"),
13281
+ fromLines: z10.number().int().nonnegative("loc-drop fromLines must be \u2265 0"),
13282
+ toLines: z10.number().int().nonnegative("loc-drop toLines must be \u2265 0")
12308
13283
  });
12309
- callsiteCoverageAtomSchema = z9.object({
12310
- kind: z9.literal("callsite-coverage"),
12311
- symbolName: z9.string().min(1, "callsite-coverage atom requires a non-empty symbolName"),
12312
- relativeSourcePath: z9.string().min(1, "callsite-coverage atom requires a non-empty relativeSourcePath")
13284
+ callsiteCoverageAtomSchema = z10.object({
13285
+ kind: z10.literal("callsite-coverage"),
13286
+ symbolName: z10.string().min(1, "callsite-coverage atom requires a non-empty symbolName"),
13287
+ relativeSourcePath: z10.string().min(1, "callsite-coverage atom requires a non-empty relativeSourcePath")
12313
13288
  });
12314
13289
  AC_UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[45][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;
12315
13290
  AC_ALIAS_REGEX = /^AC[0-9]{1,4}$/;
12316
13291
  SATISFIES_TASK_ID_REGEX = /^T[0-9]{1,7}$/;
12317
13292
  SATISFIES_VERSION_PIN_REGEX = /^[0-9]{14}$/;
12318
- satisfiesAtomSchema = z9.object({
12319
- kind: z9.literal("satisfies"),
13293
+ satisfiesAtomSchema = z10.object({
13294
+ kind: z10.literal("satisfies"),
12320
13295
  /** Target task ID — `T<1-7 digits>` per ADR-079-r2 §2.1. */
12321
- targetTaskId: z9.string().regex(SATISFIES_TASK_ID_REGEX, "satisfies atom targetTaskId must match /^T[0-9]{1,7}$/"),
13296
+ targetTaskId: z10.string().regex(SATISFIES_TASK_ID_REGEX, "satisfies atom targetTaskId must match /^T[0-9]{1,7}$/"),
12322
13297
  /** Lowercase UUIDv4/v5 — populated for the canonical form; undefined for alias form. */
12323
- targetAcId: z9.string().regex(AC_UUID_REGEX, "satisfies atom targetAcId must be a lowercase UUIDv4/v5").optional(),
13298
+ targetAcId: z10.string().regex(AC_UUID_REGEX, "satisfies atom targetAcId must be a lowercase UUIDv4/v5").optional(),
12324
13299
  /** Positional alias `AC<1-4 digits>` — populated for alias form; undefined for UUID form. */
12325
- targetAcAlias: z9.string().regex(AC_ALIAS_REGEX, "satisfies atom targetAcAlias must match /^AC[0-9]{1,4}$/").optional(),
13300
+ targetAcAlias: z10.string().regex(AC_ALIAS_REGEX, "satisfies atom targetAcAlias must match /^AC[0-9]{1,4}$/").optional(),
12326
13301
  /** Optional `@<14-digit YYYYMMDDhhmmss>` pin captured at mint time. */
12327
- versionPin: z9.string().regex(
13302
+ versionPin: z10.string().regex(
12328
13303
  SATISFIES_VERSION_PIN_REGEX,
12329
13304
  "satisfies atom versionPin must be 14 digits (YYYYMMDDhhmmss)"
12330
13305
  ).optional()
12331
13306
  });
12332
- EvidenceAtomSchema = z9.discriminatedUnion("kind", [
13307
+ EvidenceAtomSchema = z10.discriminatedUnion("kind", [
12333
13308
  commitAtomSchema,
12334
13309
  filesAtomSchema,
12335
13310
  testRunAtomSchema,
@@ -12349,11 +13324,11 @@ var init_evidence_atom_schema = __esm({
12349
13324
  ["commit", "note"],
12350
13325
  ["decision", "files"],
12351
13326
  ["decision", "note"],
12352
- ["pr"]
13327
+ ["pr", "files"]
12353
13328
  ]
12354
13329
  },
12355
- testsPassed: { oneOf: [["test-run"], ["tool"], ["pr"]] },
12356
- qaPassed: { oneOf: [["tool"], ["pr"]] },
13330
+ testsPassed: { oneOf: [["test-run"], ["tool"]] },
13331
+ qaPassed: { oneOf: [["tool"]] },
12357
13332
  documented: { oneOf: [["files"], ["url"]] },
12358
13333
  securityPassed: { oneOf: [["tool"], ["note"]] },
12359
13334
  cleanupDone: { oneOf: [["note"]] },
@@ -12376,58 +13351,58 @@ var init_evidence_atom_schema = __esm({
12376
13351
  });
12377
13352
 
12378
13353
  // packages/contracts/src/evidence-record-schema.ts
12379
- import { z as z10 } from "zod";
13354
+ import { z as z11 } from "zod";
12380
13355
  var evidenceBaseSchema, implDiffRecordSchema, validateSpecCheckRecordSchema, testOutputRecordSchema, lintReportRecordSchema, commandOutputRecordSchema, evidenceRecordSchema;
12381
13356
  var init_evidence_record_schema = __esm({
12382
13357
  "packages/contracts/src/evidence-record-schema.ts"() {
12383
13358
  "use strict";
12384
- evidenceBaseSchema = z10.object({
13359
+ evidenceBaseSchema = z11.object({
12385
13360
  /** Identity string of the agent that produced this record. */
12386
- agentIdentity: z10.string().min(1),
13361
+ agentIdentity: z11.string().min(1),
12387
13362
  /** SHA-256 hex digest (64 chars) of the attached artifact. */
12388
- attachmentSha256: z10.string().length(64),
13363
+ attachmentSha256: z11.string().length(64),
12389
13364
  /** ISO 8601 timestamp at which the action ran. */
12390
- ranAt: z10.string().datetime(),
13365
+ ranAt: z11.string().datetime(),
12391
13366
  /** Wall-clock duration of the action in milliseconds. */
12392
- durationMs: z10.number().nonnegative()
13367
+ durationMs: z11.number().nonnegative()
12393
13368
  });
12394
13369
  implDiffRecordSchema = evidenceBaseSchema.extend({
12395
- kind: z10.literal("impl-diff"),
12396
- phase: z10.literal("implement"),
12397
- filesChanged: z10.array(z10.string().min(1)).min(1),
12398
- linesAdded: z10.number().int().nonnegative(),
12399
- linesRemoved: z10.number().int().nonnegative()
13370
+ kind: z11.literal("impl-diff"),
13371
+ phase: z11.literal("implement"),
13372
+ filesChanged: z11.array(z11.string().min(1)).min(1),
13373
+ linesAdded: z11.number().int().nonnegative(),
13374
+ linesRemoved: z11.number().int().nonnegative()
12400
13375
  });
12401
13376
  validateSpecCheckRecordSchema = evidenceBaseSchema.extend({
12402
- kind: z10.literal("validate-spec-check"),
12403
- phase: z10.literal("validate"),
12404
- reqIdsChecked: z10.array(z10.string().min(1)).min(1),
12405
- passed: z10.boolean(),
12406
- details: z10.string().min(1)
13377
+ kind: z11.literal("validate-spec-check"),
13378
+ phase: z11.literal("validate"),
13379
+ reqIdsChecked: z11.array(z11.string().min(1)).min(1),
13380
+ passed: z11.boolean(),
13381
+ details: z11.string().min(1)
12407
13382
  });
12408
13383
  testOutputRecordSchema = evidenceBaseSchema.extend({
12409
- kind: z10.literal("test-output"),
12410
- phase: z10.literal("test"),
12411
- command: z10.string().min(1),
12412
- exitCode: z10.number().int(),
12413
- testsPassed: z10.number().int().nonnegative(),
12414
- testsFailed: z10.number().int().nonnegative()
13384
+ kind: z11.literal("test-output"),
13385
+ phase: z11.literal("test"),
13386
+ command: z11.string().min(1),
13387
+ exitCode: z11.number().int(),
13388
+ testsPassed: z11.number().int().nonnegative(),
13389
+ testsFailed: z11.number().int().nonnegative()
12415
13390
  });
12416
13391
  lintReportRecordSchema = evidenceBaseSchema.extend({
12417
- kind: z10.literal("lint-report"),
12418
- phase: z10.enum(["implement", "test"]),
12419
- tool: z10.string().min(1),
12420
- passed: z10.boolean(),
12421
- warnings: z10.number().int().nonnegative(),
12422
- errors: z10.number().int().nonnegative()
13392
+ kind: z11.literal("lint-report"),
13393
+ phase: z11.enum(["implement", "test"]),
13394
+ tool: z11.string().min(1),
13395
+ passed: z11.boolean(),
13396
+ warnings: z11.number().int().nonnegative(),
13397
+ errors: z11.number().int().nonnegative()
12423
13398
  });
12424
13399
  commandOutputRecordSchema = evidenceBaseSchema.extend({
12425
- kind: z10.literal("command-output"),
12426
- phase: z10.enum(["implement", "validate", "test"]),
12427
- cmd: z10.string().min(1),
12428
- exitCode: z10.number().int()
13400
+ kind: z11.literal("command-output"),
13401
+ phase: z11.enum(["implement", "validate", "test"]),
13402
+ cmd: z11.string().min(1),
13403
+ exitCode: z11.number().int()
12429
13404
  });
12430
- evidenceRecordSchema = z10.discriminatedUnion("kind", [
13405
+ evidenceRecordSchema = z11.discriminatedUnion("kind", [
12431
13406
  implDiffRecordSchema,
12432
13407
  validateSpecCheckRecordSchema,
12433
13408
  testOutputRecordSchema,
@@ -12577,7 +13552,7 @@ var init_adr_070_orchestration = __esm({
12577
13552
  WORKTREE_CREATE_MODULE = "packages/worktree/src/worktree-create.ts";
12578
13553
  CT_ORCHESTRATOR_SKILL = "packages/skills/skills/ct-orchestrator/SKILL.md";
12579
13554
  VALIDATE_SPAWN_MODULE = "packages/core/src/orchestration/validate-spawn.ts";
12580
- SKILL_VALIDATOR_TESTS = "packages/core/src/skills/orchestrator/__tests__/validator.test.ts";
13555
+ SKILL_VALIDATOR_TESTS = "packages/core/src/skills/orchestrator/__tests__/validator.orchestrator.test.ts";
12581
13556
  ADR_070_INVARIANTS = Object.freeze([
12582
13557
  {
12583
13558
  adr: "ADR-070",
@@ -12861,8 +13836,8 @@ var init_adr_073_saga = __esm({
12861
13836
  {
12862
13837
  adr: "ADR-073",
12863
13838
  code: "I7",
12864
- name: "Maximum parent depth is 3",
12865
- description: "The parent ladder Subtask \u2192 Task \u2192 Epic is fixed at depth 3 (hierarchy.maxDepth=3). Sagas do NOT consume depth \u2014 they attach via groups relations, not parent edges. Enforced at runtime by assertSagaInvariantI7.",
13839
+ name: "No nested sagas",
13840
+ description: 'A saga-member candidate MUST NOT itself be saga-shaped. Enforced at runtime by assertSagaInvariantI7, which checks exactly this and nothing else. The depth clause this invariant used to carry \u2014 "the parent ladder Subtask \u2192 Task \u2192 Epic is fixed at depth 3; sagas do NOT consume depth, they attach via groups relations, not parent edges" \u2014 is SUPERSEDED BY ADR-088: member epics now attach via tasks.parent_id containment and task_relations.groups is non-containment provenance only, so a saga DOES consume a level. The canonical spine is saga(0) \u2192 epic(1) \u2192 task(2) \u2192 subtask(3) at hierarchy.maxDepth=3, inclusive; the depth rule lives in exceedsMaxDepth (core tasks/hierarchy.ts), never here. The stale clause outlived its premise by long enough for the write-path guards calibrated on it to make the subtask tier unreachable.',
12866
13841
  severity: "error",
12867
13842
  runtimeGate: {
12868
13843
  module: SAGA_ENFORCEMENT_MODULE,
@@ -12931,111 +13906,111 @@ var init_lafs = __esm({
12931
13906
  });
12932
13907
 
12933
13908
  // packages/contracts/src/lease-ipc/messages.ts
12934
- import { z as z11 } from "zod";
13909
+ import { z as z12 } from "zod";
12935
13910
  var LeaseScopeSchema, LeaseLaneSchema, LeaseAcquireRequestSchema, LeaseReleaseRequestSchema, LeaseRenewRequestSchema, RateCheckRequestSchema, ToolGrantRequestSchema, QueuePriorityClassSchema, QueueAdmitRequestSchema, WorkerHeartbeatRequestSchema, ResourceAdmitRequestSchema, ResourceReleaseRequestSchema, LeaseIpcRequestSchema, LeaseGrantedResponseSchema, LeaseQueuedResponseSchema, LeaseDeniedResponseSchema, RateResultResponseSchema, ToolGrantedResponseSchema, LeaseRevokedResponseSchema, ChildKilledUnresponsiveResponseSchema, QueueAdmitDispositionSchema, QueueAdmitResultResponseSchema, HeartbeatAckResponseSchema, ResourceAdmitDispositionSchema, ResourceAdmitResultResponseSchema, ResourceReleaseResultResponseSchema, LeaseErrorResponseSchema, LeaseIpcResponseSchema, LeaseIpcRequestEnvelopeSchema, LeaseIpcResponseEnvelopeSchema, LeaseIpcEnvelopeSchema, LEASE_IPC_REQUEST_KINDS, LEASE_IPC_RESPONSE_KINDS, LEASE_IPC_MESSAGE_KINDS;
12936
13911
  var init_messages2 = __esm({
12937
13912
  "packages/contracts/src/lease-ipc/messages.ts"() {
12938
13913
  "use strict";
12939
- LeaseScopeSchema = z11.enum(["project", "global"]);
12940
- LeaseLaneSchema = z11.enum(["tasks", "brain", "bulk"]);
12941
- LeaseAcquireRequestSchema = z11.object({
13914
+ LeaseScopeSchema = z12.enum(["project", "global"]);
13915
+ LeaseLaneSchema = z12.enum(["tasks", "brain", "bulk"]);
13916
+ LeaseAcquireRequestSchema = z12.object({
12942
13917
  /** Tag discriminating this request variant. */
12943
- kind: z11.literal("lease_acquire"),
13918
+ kind: z12.literal("lease_acquire"),
12944
13919
  /** The cleo.db scope being arbitrated. */
12945
13920
  scope: LeaseScopeSchema,
12946
13921
  /** The write lane within the scope. */
12947
13922
  lane: LeaseLaneSchema,
12948
13923
  /** Process+lane holder identity. */
12949
- holder_id: z11.string().min(1),
13924
+ holder_id: z12.string().min(1),
12950
13925
  /** Advisory priority — lower acquires sooner. `0` = highest. */
12951
- priority: z11.number().int().min(0).max(255),
13926
+ priority: z12.number().int().min(0).max(255),
12952
13927
  /** Lease time-to-live in milliseconds. */
12953
- ttl_ms: z11.number().int().nonnegative(),
13928
+ ttl_ms: z12.number().int().nonnegative(),
12954
13929
  /** When true, a same-holder acquire re-enters (refcount++) rather than queuing. */
12955
- reentrant: z11.boolean()
13930
+ reentrant: z12.boolean()
12956
13931
  }).strict();
12957
- LeaseReleaseRequestSchema = z11.object({
13932
+ LeaseReleaseRequestSchema = z12.object({
12958
13933
  /** Tag discriminating this request variant. */
12959
- kind: z11.literal("lease_release"),
13934
+ kind: z12.literal("lease_release"),
12960
13935
  /** The cleo.db scope being arbitrated. */
12961
13936
  scope: LeaseScopeSchema,
12962
13937
  /** The write lane within the scope. */
12963
13938
  lane: LeaseLaneSchema,
12964
13939
  /** Process+lane holder identity. */
12965
- holder_id: z11.string().min(1),
13940
+ holder_id: z12.string().min(1),
12966
13941
  /** The epoch fence the holder acquired — a stale epoch no-ops. */
12967
- epoch: z11.number().int().nonnegative()
13942
+ epoch: z12.number().int().nonnegative()
12968
13943
  }).strict();
12969
- LeaseRenewRequestSchema = z11.object({
13944
+ LeaseRenewRequestSchema = z12.object({
12970
13945
  /** Tag discriminating this request variant. */
12971
- kind: z11.literal("lease_renew"),
13946
+ kind: z12.literal("lease_renew"),
12972
13947
  /** The cleo.db scope being arbitrated. */
12973
13948
  scope: LeaseScopeSchema,
12974
13949
  /** The write lane within the scope. */
12975
13950
  lane: LeaseLaneSchema,
12976
13951
  /** Process+lane holder identity. */
12977
- holder_id: z11.string().min(1),
13952
+ holder_id: z12.string().min(1),
12978
13953
  /** The epoch fence the holder acquired (epoch-guarded renew). */
12979
- epoch: z11.number().int().nonnegative()
13954
+ epoch: z12.number().int().nonnegative()
12980
13955
  }).strict();
12981
- RateCheckRequestSchema = z11.object({
13956
+ RateCheckRequestSchema = z12.object({
12982
13957
  /** Tag discriminating this request variant. */
12983
- kind: z11.literal("rate_check"),
13958
+ kind: z12.literal("rate_check"),
12984
13959
  /** The cleo.db scope being checked. */
12985
13960
  scope: LeaseScopeSchema,
12986
13961
  /** The write lane within the scope. */
12987
13962
  lane: LeaseLaneSchema,
12988
13963
  /** Estimated bytes the caller intends to write. */
12989
- est_bytes: z11.number().int().nonnegative()
13964
+ est_bytes: z12.number().int().nonnegative()
12990
13965
  }).strict();
12991
- ToolGrantRequestSchema = z11.object({
13966
+ ToolGrantRequestSchema = z12.object({
12992
13967
  /** Tag discriminating this request variant. */
12993
- kind: z11.literal("tool_grant"),
13968
+ kind: z12.literal("tool_grant"),
12994
13969
  /** The tool name being requested. */
12995
- tool: z11.string().min(1),
13970
+ tool: z12.string().min(1),
12996
13971
  /** The requesting holder identity. */
12997
- holder_id: z11.string().min(1)
13972
+ holder_id: z12.string().min(1)
12998
13973
  }).strict();
12999
- QueuePriorityClassSchema = z11.enum(["lead", "worker", "background"]);
13000
- QueueAdmitRequestSchema = z11.object({
13974
+ QueuePriorityClassSchema = z12.enum(["lead", "worker", "background"]);
13975
+ QueueAdmitRequestSchema = z12.object({
13001
13976
  /** Tag discriminating this request variant. */
13002
- kind: z11.literal("queue_admit"),
13977
+ kind: z12.literal("queue_admit"),
13003
13978
  /** The LLM provider id the call targets (rate budget is per-provider). */
13004
- provider: z11.string().min(1),
13979
+ provider: z12.string().min(1),
13005
13980
  /** The caller's priority class (lead > worker > background). */
13006
13981
  priority_class: QueuePriorityClassSchema,
13007
13982
  /** The caller's estimate of the request's token cost (debited on admit). */
13008
- est_tokens: z11.number().int().nonnegative(),
13983
+ est_tokens: z12.number().int().nonnegative(),
13009
13984
  /** The child the call belongs to (in-flight tracking — the watchdog seam). */
13010
- child_id: z11.string().min(1)
13985
+ child_id: z12.string().min(1)
13011
13986
  }).strict();
13012
- WorkerHeartbeatRequestSchema = z11.object({
13987
+ WorkerHeartbeatRequestSchema = z12.object({
13013
13988
  /** Tag discriminating this request variant. */
13014
- kind: z11.literal("worker_heartbeat"),
13989
+ kind: z12.literal("worker_heartbeat"),
13015
13990
  /** The logical id of the heartbeating child (matches the registry key). */
13016
- child_id: z11.string().min(1),
13991
+ child_id: z12.string().min(1),
13017
13992
  /** The worker's own view of whether it is currently inside an LLM call. */
13018
- in_flight_llm: z11.boolean()
13993
+ in_flight_llm: z12.boolean()
13019
13994
  }).strict();
13020
- ResourceAdmitRequestSchema = z11.object({
13995
+ ResourceAdmitRequestSchema = z12.object({
13021
13996
  /** Tag discriminating this request variant. */
13022
- kind: z11.literal("resource_admit"),
13997
+ kind: z12.literal("resource_admit"),
13023
13998
  /** The resource class (e.g. `"db-heavy"`, `"full-build"`, `"test-run"`). */
13024
- class: z11.string().min(1),
13999
+ class: z12.string().min(1),
13025
14000
  /** The caller holding the slot — process/worktree-unique; the release key. */
13026
- holder_id: z11.string().min(1),
14001
+ holder_id: z12.string().min(1),
13027
14002
  /** The client-computed budget: the max concurrent holders for this class. */
13028
- budget: z11.number().int().nonnegative()
14003
+ budget: z12.number().int().nonnegative()
13029
14004
  }).strict();
13030
- ResourceReleaseRequestSchema = z11.object({
14005
+ ResourceReleaseRequestSchema = z12.object({
13031
14006
  /** Tag discriminating this request variant. */
13032
- kind: z11.literal("resource_release"),
14007
+ kind: z12.literal("resource_release"),
13033
14008
  /** The resource class the slot belongs to. */
13034
- class: z11.string().min(1),
14009
+ class: z12.string().min(1),
13035
14010
  /** The holder that was admitted (matches the admit `holder_id`). */
13036
- holder_id: z11.string().min(1)
14011
+ holder_id: z12.string().min(1)
13037
14012
  }).strict();
13038
- LeaseIpcRequestSchema = z11.discriminatedUnion("kind", [
14013
+ LeaseIpcRequestSchema = z12.discriminatedUnion("kind", [
13039
14014
  LeaseAcquireRequestSchema,
13040
14015
  LeaseReleaseRequestSchema,
13041
14016
  LeaseRenewRequestSchema,
@@ -13046,133 +14021,133 @@ var init_messages2 = __esm({
13046
14021
  ResourceAdmitRequestSchema,
13047
14022
  ResourceReleaseRequestSchema
13048
14023
  ]);
13049
- LeaseGrantedResponseSchema = z11.object({
14024
+ LeaseGrantedResponseSchema = z12.object({
13050
14025
  /** Tag discriminating this response variant. */
13051
- kind: z11.literal("lease_granted"),
14026
+ kind: z12.literal("lease_granted"),
13052
14027
  /** The granted cleo.db scope. */
13053
14028
  scope: LeaseScopeSchema,
13054
14029
  /** The granted write lane. */
13055
14030
  lane: LeaseLaneSchema,
13056
14031
  /** The holder the lease was granted to. */
13057
- holder_id: z11.string().min(1),
14032
+ holder_id: z12.string().min(1),
13058
14033
  /** The monotonic epoch fence assigned to this grant. */
13059
- epoch: z11.number().int().nonnegative(),
14034
+ epoch: z12.number().int().nonnegative(),
13060
14035
  /** The lease TTL in milliseconds. */
13061
- ttl_ms: z11.number().int().nonnegative(),
14036
+ ttl_ms: z12.number().int().nonnegative(),
13062
14037
  /** Absolute expiry timestamp (epoch ms) for this grant. */
13063
- expires_at_ms: z11.number().int().nonnegative()
14038
+ expires_at_ms: z12.number().int().nonnegative()
13064
14039
  }).strict();
13065
- LeaseQueuedResponseSchema = z11.object({
14040
+ LeaseQueuedResponseSchema = z12.object({
13066
14041
  /** Tag discriminating this response variant. */
13067
- kind: z11.literal("lease_queued"),
14042
+ kind: z12.literal("lease_queued"),
13068
14043
  /** The queued cleo.db scope. */
13069
14044
  scope: LeaseScopeSchema,
13070
14045
  /** The queued write lane. */
13071
14046
  lane: LeaseLaneSchema,
13072
14047
  /** The monotonic ticket assigned for FIFO tiebreak. */
13073
- ticket: z11.number().int().nonnegative(),
14048
+ ticket: z12.number().int().nonnegative(),
13074
14049
  /** Number of waiters ahead of this one. */
13075
- ahead: z11.number().int().nonnegative()
14050
+ ahead: z12.number().int().nonnegative()
13076
14051
  }).strict();
13077
- LeaseDeniedResponseSchema = z11.object({
14052
+ LeaseDeniedResponseSchema = z12.object({
13078
14053
  /** Tag discriminating this response variant. */
13079
- kind: z11.literal("lease_denied"),
14054
+ kind: z12.literal("lease_denied"),
13080
14055
  /** The denied cleo.db scope. */
13081
14056
  scope: LeaseScopeSchema,
13082
14057
  /** Machine-readable denial code (e.g. `E_LEASE_UNAVAILABLE`). */
13083
- code: z11.string().min(1),
14058
+ code: z12.string().min(1),
13084
14059
  /** Human-readable denial message. */
13085
- message: z11.string()
14060
+ message: z12.string()
13086
14061
  }).strict();
13087
- RateResultResponseSchema = z11.object({
14062
+ RateResultResponseSchema = z12.object({
13088
14063
  /** Tag discriminating this response variant. */
13089
- kind: z11.literal("rate_result"),
14064
+ kind: z12.literal("rate_result"),
13090
14065
  /** The checked cleo.db scope. */
13091
14066
  scope: LeaseScopeSchema,
13092
14067
  /** Whether the write is within budget. */
13093
- ok: z11.boolean(),
14068
+ ok: z12.boolean(),
13094
14069
  /** Suggested back-off in milliseconds when `ok` is false. */
13095
- retry_after_ms: z11.number().int().nonnegative(),
14070
+ retry_after_ms: z12.number().int().nonnegative(),
13096
14071
  /** Remaining token budget for the scope. */
13097
- tokens_remaining: z11.number().int().nonnegative()
14072
+ tokens_remaining: z12.number().int().nonnegative()
13098
14073
  }).strict();
13099
- ToolGrantedResponseSchema = z11.object({
14074
+ ToolGrantedResponseSchema = z12.object({
13100
14075
  /** Tag discriminating this response variant. */
13101
- kind: z11.literal("tool_granted"),
14076
+ kind: z12.literal("tool_granted"),
13102
14077
  /** The granted tool name. */
13103
- tool: z11.string().min(1),
14078
+ tool: z12.string().min(1),
13104
14079
  /** The holder the tool grant was issued to. */
13105
- holder_id: z11.string().min(1)
14080
+ holder_id: z12.string().min(1)
13106
14081
  }).strict();
13107
- LeaseRevokedResponseSchema = z11.object({
14082
+ LeaseRevokedResponseSchema = z12.object({
13108
14083
  /** Tag discriminating this response variant. */
13109
- kind: z11.literal("lease_revoked"),
14084
+ kind: z12.literal("lease_revoked"),
13110
14085
  /** The revoked cleo.db scope. */
13111
14086
  scope: LeaseScopeSchema,
13112
14087
  /** The revoked write lane. */
13113
14088
  lane: LeaseLaneSchema,
13114
14089
  /** The holder whose lease was revoked. */
13115
- holder_id: z11.string().min(1),
14090
+ holder_id: z12.string().min(1),
13116
14091
  /** Human-readable reason for the revocation. */
13117
- reason: z11.string()
14092
+ reason: z12.string()
13118
14093
  }).strict();
13119
- ChildKilledUnresponsiveResponseSchema = z11.object({
14094
+ ChildKilledUnresponsiveResponseSchema = z12.object({
13120
14095
  /** Tag discriminating this response variant. */
13121
- kind: z11.literal("child_killed_unresponsive"),
14096
+ kind: z12.literal("child_killed_unresponsive"),
13122
14097
  /** Logical id of the killed child. */
13123
- child_id: z11.string().min(1),
14098
+ child_id: z12.string().min(1),
13124
14099
  /** The holder identity the killed child held the lease as. */
13125
- holder_id: z11.string().min(1),
14100
+ holder_id: z12.string().min(1),
13126
14101
  /** The cleo.db scope the killed child held the lease in. */
13127
14102
  scope: LeaseScopeSchema,
13128
14103
  /** Human-readable reason for the kill. */
13129
- reason: z11.string()
14104
+ reason: z12.string()
13130
14105
  }).strict();
13131
- QueueAdmitDispositionSchema = z11.enum(["admitted", "deferred"]);
13132
- QueueAdmitResultResponseSchema = z11.object({
14106
+ QueueAdmitDispositionSchema = z12.enum(["admitted", "deferred"]);
14107
+ QueueAdmitResultResponseSchema = z12.object({
13133
14108
  /** Tag discriminating this response variant. */
13134
- kind: z11.literal("queue_admit_result"),
14109
+ kind: z12.literal("queue_admit_result"),
13135
14110
  /** Whether the LLM call was admitted or deferred. */
13136
14111
  disposition: QueueAdmitDispositionSchema,
13137
14112
  /** Back-off in ms before re-requesting (0 when admitted). */
13138
- retry_after_ms: z11.number().int().nonnegative(),
14113
+ retry_after_ms: z12.number().int().nonnegative(),
13139
14114
  /** Remaining provider token budget after this decision. */
13140
- tokens_remaining: z11.number().int().nonnegative(),
14115
+ tokens_remaining: z12.number().int().nonnegative(),
13141
14116
  /** Number of higher/equal-priority waiters ahead (0 when admitted). */
13142
- queue_position: z11.number().int().nonnegative()
14117
+ queue_position: z12.number().int().nonnegative()
13143
14118
  }).strict();
13144
- HeartbeatAckResponseSchema = z11.object({
14119
+ HeartbeatAckResponseSchema = z12.object({
13145
14120
  /** Tag discriminating this response variant. */
13146
- kind: z11.literal("heartbeat_ack")
14121
+ kind: z12.literal("heartbeat_ack")
13147
14122
  }).strict();
13148
- ResourceAdmitDispositionSchema = z11.enum(["admitted", "deferred"]);
13149
- ResourceAdmitResultResponseSchema = z11.object({
14123
+ ResourceAdmitDispositionSchema = z12.enum(["admitted", "deferred"]);
14124
+ ResourceAdmitResultResponseSchema = z12.object({
13150
14125
  /** Tag discriminating this response variant. */
13151
- kind: z11.literal("resource_admit_result"),
14126
+ kind: z12.literal("resource_admit_result"),
13152
14127
  /** Whether the heavy op was admitted or deferred. */
13153
14128
  disposition: ResourceAdmitDispositionSchema,
13154
14129
  /** Back-off in ms before re-requesting (0 when admitted). */
13155
- retry_after_ms: z11.number().int().nonnegative(),
14130
+ retry_after_ms: z12.number().int().nonnegative(),
13156
14131
  /** Remaining slots for the class after this decision. */
13157
- slots_remaining: z11.number().int().nonnegative()
14132
+ slots_remaining: z12.number().int().nonnegative()
13158
14133
  }).strict();
13159
- ResourceReleaseResultResponseSchema = z11.object({
14134
+ ResourceReleaseResultResponseSchema = z12.object({
13160
14135
  /** Tag discriminating this response variant. */
13161
- kind: z11.literal("resource_release_result"),
14136
+ kind: z12.literal("resource_release_result"),
13162
14137
  /** Whether a held slot was actually released (false = no such holder). */
13163
- released: z11.boolean(),
14138
+ released: z12.boolean(),
13164
14139
  /** Remaining in-flight holders for the class after the release. */
13165
- slots_remaining: z11.number().int().nonnegative()
14140
+ slots_remaining: z12.number().int().nonnegative()
13166
14141
  }).strict();
13167
- LeaseErrorResponseSchema = z11.object({
14142
+ LeaseErrorResponseSchema = z12.object({
13168
14143
  /** Tag discriminating this response variant. */
13169
- kind: z11.literal("error"),
14144
+ kind: z12.literal("error"),
13170
14145
  /** Machine-readable error code (e.g. `E_LEASE_BAD_VERSION`, `E_LEASE_UNIMPLEMENTED`). */
13171
- code: z11.string().min(1),
14146
+ code: z12.string().min(1),
13172
14147
  /** Human-readable error message. */
13173
- message: z11.string()
14148
+ message: z12.string()
13174
14149
  }).strict();
13175
- LeaseIpcResponseSchema = z11.discriminatedUnion("kind", [
14150
+ LeaseIpcResponseSchema = z12.discriminatedUnion("kind", [
13176
14151
  LeaseGrantedResponseSchema,
13177
14152
  LeaseQueuedResponseSchema,
13178
14153
  LeaseDeniedResponseSchema,
@@ -13186,27 +14161,27 @@ var init_messages2 = __esm({
13186
14161
  ResourceReleaseResultResponseSchema,
13187
14162
  LeaseErrorResponseSchema
13188
14163
  ]);
13189
- LeaseIpcRequestEnvelopeSchema = z11.object({
14164
+ LeaseIpcRequestEnvelopeSchema = z12.object({
13190
14165
  /** Parallel protocol version. */
13191
- protocol_version: z11.string(),
14166
+ protocol_version: z12.string(),
13192
14167
  /** Correlation id echoed back on the matching response. */
13193
- id: z11.string().min(1),
14168
+ id: z12.string().min(1),
13194
14169
  /** Direction discriminator. */
13195
- direction: z11.literal("request"),
14170
+ direction: z12.literal("request"),
13196
14171
  /** The request body. */
13197
14172
  request: LeaseIpcRequestSchema
13198
14173
  }).strict();
13199
- LeaseIpcResponseEnvelopeSchema = z11.object({
14174
+ LeaseIpcResponseEnvelopeSchema = z12.object({
13200
14175
  /** Parallel protocol version. */
13201
- protocol_version: z11.string(),
14176
+ protocol_version: z12.string(),
13202
14177
  /** Correlation id echoed from the originating request (or a fresh id for events). */
13203
- id: z11.string().min(1),
14178
+ id: z12.string().min(1),
13204
14179
  /** Direction discriminator. */
13205
- direction: z11.literal("response"),
14180
+ direction: z12.literal("response"),
13206
14181
  /** The response body. */
13207
14182
  response: LeaseIpcResponseSchema
13208
14183
  }).strict();
13209
- LeaseIpcEnvelopeSchema = z11.discriminatedUnion("direction", [
14184
+ LeaseIpcEnvelopeSchema = z12.discriminatedUnion("direction", [
13210
14185
  LeaseIpcRequestEnvelopeSchema,
13211
14186
  LeaseIpcResponseEnvelopeSchema
13212
14187
  ]);
@@ -13259,7 +14234,7 @@ var init_lease_ipc = __esm({
13259
14234
  });
13260
14235
 
13261
14236
  // packages/contracts/src/llm/catalog-schema.ts
13262
- import { z as z12 } from "zod";
14237
+ import { z as z13 } from "zod";
13263
14238
  var CATALOG_MODEL_STATUSES, CATALOG_AUTH_TYPES, isoDate, semver, catalogModalitiesSchema, catalogCostSchema, catalogLimitSchema, catalogModelProviderSchema, catalogModelEntrySchema, catalogProviderSchema, curatedCatalogSchema, modelsCatalogRowInsertSchema, modelsCatalogRowSelectSchema;
13264
14239
  var init_catalog_schema = __esm({
13265
14240
  "packages/contracts/src/llm/catalog-schema.ts"() {
@@ -13272,78 +14247,78 @@ var init_catalog_schema = __esm({
13272
14247
  "retired"
13273
14248
  ];
13274
14249
  CATALOG_AUTH_TYPES = ["api_key", "oauth", "bedrock", "vertex"];
13275
- isoDate = z12.string().regex(/^\d{4}-\d{2}-\d{2}$/, "must be an ISO date (YYYY-MM-DD)");
13276
- semver = z12.string().regex(/^\d+\.\d+\.\d+$/, "must be semver (MAJOR.MINOR.PATCH)");
13277
- catalogModalitiesSchema = z12.object({
13278
- input: z12.array(z12.string()),
13279
- output: z12.array(z12.string())
14250
+ isoDate = z13.string().regex(/^\d{4}-\d{2}-\d{2}$/, "must be an ISO date (YYYY-MM-DD)");
14251
+ semver = z13.string().regex(/^\d+\.\d+\.\d+$/, "must be semver (MAJOR.MINOR.PATCH)");
14252
+ catalogModalitiesSchema = z13.object({
14253
+ input: z13.array(z13.string()),
14254
+ output: z13.array(z13.string())
13280
14255
  }).strict();
13281
- catalogCostSchema = z12.object({
13282
- input: z12.number().optional(),
13283
- output: z12.number().optional(),
13284
- cache_read: z12.number().optional(),
13285
- cache_write: z12.number().optional(),
13286
- context_over_200k: z12.number().optional()
14256
+ catalogCostSchema = z13.object({
14257
+ input: z13.number().optional(),
14258
+ output: z13.number().optional(),
14259
+ cache_read: z13.number().optional(),
14260
+ cache_write: z13.number().optional(),
14261
+ context_over_200k: z13.number().optional()
13287
14262
  }).strict();
13288
- catalogLimitSchema = z12.object({
13289
- context: z12.number(),
13290
- output: z12.number()
14263
+ catalogLimitSchema = z13.object({
14264
+ context: z13.number(),
14265
+ output: z13.number()
13291
14266
  }).strict();
13292
- catalogModelProviderSchema = z12.object({
13293
- npm: z12.string(),
13294
- api: z12.string()
14267
+ catalogModelProviderSchema = z13.object({
14268
+ npm: z13.string(),
14269
+ api: z13.string()
13295
14270
  }).strict();
13296
- catalogModelEntrySchema = z12.object({
13297
- id: z12.string(),
13298
- name: z12.string(),
13299
- family: z12.string(),
13300
- attachment: z12.boolean(),
13301
- reasoning: z12.boolean(),
13302
- temperature: z12.boolean(),
13303
- interleaved: z12.boolean(),
13304
- tool_call: z12.boolean(),
14271
+ catalogModelEntrySchema = z13.object({
14272
+ id: z13.string(),
14273
+ name: z13.string(),
14274
+ family: z13.string(),
14275
+ attachment: z13.boolean(),
14276
+ reasoning: z13.boolean(),
14277
+ temperature: z13.boolean(),
14278
+ interleaved: z13.boolean(),
14279
+ tool_call: z13.boolean(),
13305
14280
  modalities: catalogModalitiesSchema,
13306
14281
  cost: catalogCostSchema,
13307
14282
  limit: catalogLimitSchema,
13308
- status: z12.enum(CATALOG_MODEL_STATUSES),
14283
+ status: z13.enum(CATALOG_MODEL_STATUSES),
13309
14284
  release_date: isoDate,
13310
14285
  provider: catalogModelProviderSchema
13311
14286
  }).strict();
13312
- catalogProviderSchema = z12.object({
13313
- id: z12.string(),
13314
- endpoint: z12.string(),
13315
- authTypes: z12.array(z12.enum(CATALOG_AUTH_TYPES)).min(1),
13316
- npm: z12.string().optional()
14287
+ catalogProviderSchema = z13.object({
14288
+ id: z13.string(),
14289
+ endpoint: z13.string(),
14290
+ authTypes: z13.array(z13.enum(CATALOG_AUTH_TYPES)).min(1),
14291
+ npm: z13.string().optional()
13317
14292
  }).strict();
13318
- curatedCatalogSchema = z12.object({
13319
- $schema: z12.string().optional(),
14293
+ curatedCatalogSchema = z13.object({
14294
+ $schema: z13.string().optional(),
13320
14295
  version: semver,
13321
14296
  lastUpdated: isoDate,
13322
- providers: z12.record(z12.string(), catalogProviderSchema),
13323
- models: z12.record(z12.string(), z12.record(z12.string(), catalogModelEntrySchema))
14297
+ providers: z13.record(z13.string(), catalogProviderSchema),
14298
+ models: z13.record(z13.string(), z13.record(z13.string(), catalogModelEntrySchema))
13324
14299
  }).strict();
13325
- modelsCatalogRowInsertSchema = z12.object({
13326
- id: z12.string(),
13327
- providerId: z12.string(),
13328
- name: z12.string(),
13329
- family: z12.string(),
13330
- attachment: z12.boolean(),
13331
- reasoning: z12.boolean(),
13332
- temperature: z12.boolean(),
13333
- interleaved: z12.boolean(),
13334
- toolCall: z12.boolean(),
13335
- modalities: z12.string(),
13336
- cost: z12.string(),
13337
- contextLimit: z12.number().nullable().optional(),
13338
- outputLimit: z12.number().nullable().optional(),
13339
- status: z12.enum(CATALOG_MODEL_STATUSES),
14300
+ modelsCatalogRowInsertSchema = z13.object({
14301
+ id: z13.string(),
14302
+ providerId: z13.string(),
14303
+ name: z13.string(),
14304
+ family: z13.string(),
14305
+ attachment: z13.boolean(),
14306
+ reasoning: z13.boolean(),
14307
+ temperature: z13.boolean(),
14308
+ interleaved: z13.boolean(),
14309
+ toolCall: z13.boolean(),
14310
+ modalities: z13.string(),
14311
+ cost: z13.string(),
14312
+ contextLimit: z13.number().nullable().optional(),
14313
+ outputLimit: z13.number().nullable().optional(),
14314
+ status: z13.enum(CATALOG_MODEL_STATUSES),
13340
14315
  releaseDate: isoDate,
13341
- modelsDevId: z12.string(),
13342
- source: z12.string(),
13343
- seededAt: z12.string().optional()
14316
+ modelsDevId: z13.string(),
14317
+ source: z13.string(),
14318
+ seededAt: z13.string().optional()
13344
14319
  }).strict();
13345
14320
  modelsCatalogRowSelectSchema = modelsCatalogRowInsertSchema.extend({
13346
- seededAt: z12.string()
14321
+ seededAt: z13.string()
13347
14322
  });
13348
14323
  }
13349
14324
  });
@@ -13458,7 +14433,7 @@ var init_status_registry = __esm({
13458
14433
  });
13459
14434
 
13460
14435
  // packages/contracts/src/workgraph.ts
13461
- import { z as z13 } from "zod";
14436
+ import { z as z14 } from "zod";
13462
14437
  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;
13463
14438
  var init_workgraph = __esm({
13464
14439
  "packages/contracts/src/workgraph.ts"() {
@@ -13466,10 +14441,10 @@ var init_workgraph = __esm({
13466
14441
  init_enums();
13467
14442
  init_status_registry();
13468
14443
  E_WORKGRAPH_PARENT_TYPE_MATRIX = "E_WORKGRAPH_PARENT_TYPE_MATRIX";
13469
- taskTypeSchema = z13.enum(["saga", "epic", "task", "subtask"]);
13470
- taskPrioritySchema = z13.enum(["critical", "high", "medium", "low"]);
13471
- taskStatusSchema = z13.enum(TASK_STATUSES);
13472
- verificationGateSchema = z13.enum([
14444
+ taskTypeSchema = z14.enum(["saga", "epic", "task", "subtask"]);
14445
+ taskPrioritySchema = z14.enum(["critical", "high", "medium", "low"]);
14446
+ taskStatusSchema = z14.enum(TASK_STATUSES);
14447
+ verificationGateSchema = z14.enum([
13473
14448
  "implemented",
13474
14449
  "testsPassed",
13475
14450
  "qaPassed",
@@ -13478,7 +14453,7 @@ var init_workgraph = __esm({
13478
14453
  "documented",
13479
14454
  "nexusImpact"
13480
14455
  ]);
13481
- workGraphRelationKindSchema = z13.enum([
14456
+ workGraphRelationKindSchema = z14.enum([
13482
14457
  "contains",
13483
14458
  "depends_on",
13484
14459
  "blocks",
@@ -13486,317 +14461,317 @@ var init_workgraph = __esm({
13486
14461
  "groups",
13487
14462
  "satisfies"
13488
14463
  ]);
13489
- workGraphTraversalDirectionSchema = z13.enum([
14464
+ workGraphTraversalDirectionSchema = z14.enum([
13490
14465
  "ancestors",
13491
14466
  "descendants",
13492
14467
  "upstream",
13493
14468
  "downstream"
13494
14469
  ]);
13495
- workGraphEdgeDirectionSchema = z13.enum(["out", "in", "both"]);
13496
- paginationParamsSchema = z13.object({
13497
- cursor: z13.string().min(1).optional(),
13498
- limit: z13.number().int().positive().max(500).optional()
14470
+ workGraphEdgeDirectionSchema = z14.enum(["out", "in", "both"]);
14471
+ paginationParamsSchema = z14.object({
14472
+ cursor: z14.string().min(1).optional(),
14473
+ limit: z14.number().int().positive().max(500).optional()
13499
14474
  });
13500
- workGraphNodeSchema = z13.object({
13501
- id: z13.string().min(1),
14475
+ workGraphNodeSchema = z14.object({
14476
+ id: z14.string().min(1),
13502
14477
  type: taskTypeSchema,
13503
- title: z13.string(),
14478
+ title: z14.string(),
13504
14479
  status: taskStatusSchema,
13505
14480
  priority: taskPrioritySchema,
13506
- parentId: z13.string().min(1).optional()
14481
+ parentId: z14.string().min(1).optional()
13507
14482
  });
13508
- workGraphEdgeSchema = z13.object({
13509
- fromId: z13.string().min(1),
13510
- toId: z13.string().min(1),
14483
+ workGraphEdgeSchema = z14.object({
14484
+ fromId: z14.string().min(1),
14485
+ toId: z14.string().min(1),
13511
14486
  kind: workGraphRelationKindSchema
13512
14487
  });
13513
- workGraphHierarchyEdgeSchema = z13.object({
13514
- fromId: z13.string().min(1),
13515
- toId: z13.string().min(1),
13516
- kind: z13.literal("contains")
14488
+ workGraphHierarchyEdgeSchema = z14.object({
14489
+ fromId: z14.string().min(1),
14490
+ toId: z14.string().min(1),
14491
+ kind: z14.literal("contains")
13517
14492
  }).strict();
13518
- workGraphPageInfoSchema = z13.object({
13519
- nextCursor: z13.string().min(1).optional(),
13520
- hasMore: z13.boolean()
13521
- });
13522
- workGraphRollupCountsSchema = z13.object({
13523
- total: z13.number().int().nonnegative(),
13524
- byStatus: z13.partialRecord(taskStatusSchema, z13.number().int().nonnegative()),
13525
- byType: z13.partialRecord(taskTypeSchema, z13.number().int().nonnegative())
13526
- });
13527
- workGraphSubtreePercentagesSchema = z13.object({
13528
- done: z13.number().nonnegative(),
13529
- active: z13.number().nonnegative(),
13530
- blocked: z13.number().nonnegative(),
13531
- pending: z13.number().nonnegative(),
13532
- cancelled: z13.number().nonnegative()
13533
- });
13534
- workGraphProjectionMismatchSchema = z13.object({
13535
- field: z13.string().min(1),
13536
- expected: z13.number().int().nonnegative(),
13537
- actual: z13.number().int().nonnegative()
14493
+ workGraphPageInfoSchema = z14.object({
14494
+ nextCursor: z14.string().min(1).optional(),
14495
+ hasMore: z14.boolean()
14496
+ });
14497
+ workGraphRollupCountsSchema = z14.object({
14498
+ total: z14.number().int().nonnegative(),
14499
+ byStatus: z14.partialRecord(taskStatusSchema, z14.number().int().nonnegative()),
14500
+ byType: z14.partialRecord(taskTypeSchema, z14.number().int().nonnegative())
14501
+ });
14502
+ workGraphSubtreePercentagesSchema = z14.object({
14503
+ done: z14.number().nonnegative(),
14504
+ active: z14.number().nonnegative(),
14505
+ blocked: z14.number().nonnegative(),
14506
+ pending: z14.number().nonnegative(),
14507
+ cancelled: z14.number().nonnegative()
14508
+ });
14509
+ workGraphProjectionMismatchSchema = z14.object({
14510
+ field: z14.string().min(1),
14511
+ expected: z14.number().int().nonnegative(),
14512
+ actual: z14.number().int().nonnegative()
13538
14513
  });
13539
14514
  workGraphReadyFrontierTaskSchema = workGraphNodeSchema.extend({
13540
- role: z13.string().min(1).optional(),
13541
- dependencyBlockers: z13.array(z13.object({ taskId: z13.string().min(1), status: taskStatusSchema })),
13542
- gateBlockers: z13.array(z13.object({ gate: verificationGateSchema }))
14515
+ role: z14.string().min(1).optional(),
14516
+ dependencyBlockers: z14.array(z14.object({ taskId: z14.string().min(1), status: taskStatusSchema })),
14517
+ gateBlockers: z14.array(z14.object({ gate: verificationGateSchema }))
13543
14518
  });
13544
14519
  workGraphRelationEdgeSchema = workGraphEdgeSchema.extend({
13545
- source: z13.literal("relation"),
13546
- relationType: z13.enum(TASK_RELATION_TYPES),
13547
- reason: z13.string().min(1).optional()
14520
+ source: z14.literal("relation"),
14521
+ relationType: z14.enum(TASK_RELATION_TYPES),
14522
+ reason: z14.string().min(1).optional()
13548
14523
  });
13549
14524
  workGraphDependencyEdgeSchema = workGraphEdgeSchema.extend({
13550
- source: z13.literal("dependency"),
13551
- kind: z13.literal("depends_on")
14525
+ source: z14.literal("dependency"),
14526
+ kind: z14.literal("depends_on")
13552
14527
  });
13553
- workGraphOmissionReasonSchema = z13.enum([
14528
+ workGraphOmissionReasonSchema = z14.enum([
13554
14529
  "budget_exceeded",
13555
14530
  "not_requested",
13556
14531
  "not_available",
13557
14532
  "redacted",
13558
14533
  "truncated"
13559
14534
  ]);
13560
- workGraphContextBudgetSchema = z13.object({
13561
- tokenBudget: z13.number().int().nonnegative(),
13562
- estimatedTokens: z13.number().int().nonnegative(),
13563
- remainingTokens: z13.number().int().nonnegative(),
13564
- truncated: z13.boolean()
13565
- });
13566
- workGraphOmissionSchema = z13.object({
13567
- path: z13.string().min(1),
14535
+ workGraphContextBudgetSchema = z14.object({
14536
+ tokenBudget: z14.number().int().nonnegative(),
14537
+ estimatedTokens: z14.number().int().nonnegative(),
14538
+ remainingTokens: z14.number().int().nonnegative(),
14539
+ truncated: z14.boolean()
14540
+ });
14541
+ workGraphOmissionSchema = z14.object({
14542
+ path: z14.string().min(1),
13568
14543
  reason: workGraphOmissionReasonSchema,
13569
- message: z13.string().min(1),
13570
- estimatedTokens: z13.number().int().nonnegative().optional()
14544
+ message: z14.string().min(1),
14545
+ estimatedTokens: z14.number().int().nonnegative().optional()
13571
14546
  });
13572
- workGraphDirectEdgeSchema = z13.discriminatedUnion("source", [
14547
+ workGraphDirectEdgeSchema = z14.discriminatedUnion("source", [
13573
14548
  workGraphRelationEdgeSchema,
13574
14549
  workGraphDependencyEdgeSchema
13575
14550
  ]);
13576
14551
  workGraphContextPackParamsSchema = paginationParamsSchema.extend({
13577
- rootId: z13.string().min(1),
13578
- tokenBudget: z13.number().int().positive().optional(),
13579
- includeRelations: z13.boolean().optional(),
13580
- includeReadiness: z13.boolean().optional(),
13581
- includeRollup: z13.boolean().optional()
14552
+ rootId: z14.string().min(1),
14553
+ tokenBudget: z14.number().int().positive().optional(),
14554
+ includeRelations: z14.boolean().optional(),
14555
+ includeReadiness: z14.boolean().optional(),
14556
+ includeRollup: z14.boolean().optional()
13582
14557
  });
13583
14558
  workGraphSliceParamsSchema = paginationParamsSchema.extend({
13584
- rootId: z13.string().min(1),
14559
+ rootId: z14.string().min(1),
13585
14560
  direction: workGraphTraversalDirectionSchema.optional(),
13586
- maxDepth: z13.number().int().nonnegative().optional(),
13587
- includeRelations: z13.boolean().optional()
14561
+ maxDepth: z14.number().int().nonnegative().optional(),
14562
+ includeRelations: z14.boolean().optional()
13588
14563
  });
13589
- workGraphSliceSchema = z13.object({
13590
- rootId: z13.string().min(1),
14564
+ workGraphSliceSchema = z14.object({
14565
+ rootId: z14.string().min(1),
13591
14566
  direction: workGraphTraversalDirectionSchema,
13592
- nodes: z13.array(workGraphNodeSchema),
13593
- edges: z13.array(workGraphEdgeSchema),
14567
+ nodes: z14.array(workGraphNodeSchema),
14568
+ edges: z14.array(workGraphEdgeSchema),
13594
14569
  pageInfo: workGraphPageInfoSchema,
13595
- omissions: z13.array(workGraphOmissionSchema).optional()
13596
- });
13597
- workGraphReadinessParamsSchema = z13.object({
13598
- rootId: z13.string().min(1),
13599
- role: z13.string().min(1).optional(),
13600
- includeGateBlockers: z13.boolean().optional()
13601
- });
13602
- workGraphReadinessResultSchema = z13.object({
13603
- rootId: z13.string().min(1),
13604
- role: z13.string().min(1).optional(),
13605
- ready: z13.boolean(),
13606
- warnings: z13.array(z13.string()),
13607
- groups: z13.object({
13608
- ready: z13.array(workGraphReadyFrontierTaskSchema),
13609
- blocked: z13.array(workGraphReadyFrontierTaskSchema),
13610
- blockedBy: z13.array(
13611
- z13.discriminatedUnion("kind", [
13612
- z13.object({
13613
- kind: z13.literal("dependency"),
13614
- blockerId: z13.string().min(1),
13615
- blocks: z13.array(z13.string().min(1))
14570
+ omissions: z14.array(workGraphOmissionSchema).optional()
14571
+ });
14572
+ workGraphReadinessParamsSchema = z14.object({
14573
+ rootId: z14.string().min(1),
14574
+ role: z14.string().min(1).optional(),
14575
+ includeGateBlockers: z14.boolean().optional()
14576
+ });
14577
+ workGraphReadinessResultSchema = z14.object({
14578
+ rootId: z14.string().min(1),
14579
+ role: z14.string().min(1).optional(),
14580
+ ready: z14.boolean(),
14581
+ warnings: z14.array(z14.string()),
14582
+ groups: z14.object({
14583
+ ready: z14.array(workGraphReadyFrontierTaskSchema),
14584
+ blocked: z14.array(workGraphReadyFrontierTaskSchema),
14585
+ blockedBy: z14.array(
14586
+ z14.discriminatedUnion("kind", [
14587
+ z14.object({
14588
+ kind: z14.literal("dependency"),
14589
+ blockerId: z14.string().min(1),
14590
+ blocks: z14.array(z14.string().min(1))
13616
14591
  }),
13617
- z13.object({
13618
- kind: z13.literal("gate"),
14592
+ z14.object({
14593
+ kind: z14.literal("gate"),
13619
14594
  gate: verificationGateSchema,
13620
- blocks: z13.array(z13.string().min(1))
14595
+ blocks: z14.array(z14.string().min(1))
13621
14596
  })
13622
14597
  ])
13623
14598
  )
13624
14599
  })
13625
14600
  });
13626
- workGraphContextPackSchema = z13.object({
13627
- rootId: z13.string().min(1),
13628
- generatedAt: z13.string().min(1),
14601
+ workGraphContextPackSchema = z14.object({
14602
+ rootId: z14.string().min(1),
14603
+ generatedAt: z14.string().min(1),
13629
14604
  budget: workGraphContextBudgetSchema,
13630
14605
  slice: workGraphSliceSchema,
13631
- relationEdges: z13.object({
13632
- rootId: z13.string().min(1),
14606
+ relationEdges: z14.object({
14607
+ rootId: z14.string().min(1),
13633
14608
  direction: workGraphEdgeDirectionSchema,
13634
- edges: z13.array(workGraphDirectEdgeSchema)
14609
+ edges: z14.array(workGraphDirectEdgeSchema)
13635
14610
  }).optional(),
13636
14611
  readiness: workGraphReadinessResultSchema.optional(),
13637
- rollup: z13.lazy(() => tasksRollupResultSchema).optional(),
13638
- omissions: z13.array(workGraphOmissionSchema)
13639
- });
13640
- workGraphScaffoldValidateParamsSchema = z13.object({
13641
- rootId: z13.string().min(1),
13642
- nodes: z13.array(
13643
- z13.object({
13644
- id: z13.string().min(1),
14612
+ rollup: z14.lazy(() => tasksRollupResultSchema).optional(),
14613
+ omissions: z14.array(workGraphOmissionSchema)
14614
+ });
14615
+ workGraphScaffoldValidateParamsSchema = z14.object({
14616
+ rootId: z14.string().min(1),
14617
+ nodes: z14.array(
14618
+ z14.object({
14619
+ id: z14.string().min(1),
13645
14620
  type: taskTypeSchema,
13646
- parentId: z13.string().min(1).nullable().optional()
14621
+ parentId: z14.string().min(1).nullable().optional()
13647
14622
  })
13648
14623
  ),
13649
- edges: z13.array(workGraphDirectEdgeSchema).optional(),
13650
- dryRun: z13.boolean().optional()
13651
- });
13652
- workGraphScaffoldValidationIssueSchema = z13.object({
13653
- code: z13.string().min(1),
13654
- message: z13.string().min(1),
13655
- taskId: z13.string().min(1).optional(),
13656
- severity: z13.enum(["error", "warning"])
13657
- });
13658
- workGraphScaffoldValidateResultSchema = z13.object({
13659
- rootId: z13.string().min(1),
13660
- valid: z13.boolean(),
13661
- dryRun: z13.boolean(),
13662
- issues: z13.array(workGraphScaffoldValidationIssueSchema),
13663
- hierarchy: z13.object({
13664
- valid: z13.boolean(),
13665
- violations: z13.array(
13666
- z13.object({
13667
- code: z13.literal(E_WORKGRAPH_PARENT_TYPE_MATRIX),
13668
- taskId: z13.string().min(1),
14624
+ edges: z14.array(workGraphDirectEdgeSchema).optional(),
14625
+ dryRun: z14.boolean().optional()
14626
+ });
14627
+ workGraphScaffoldValidationIssueSchema = z14.object({
14628
+ code: z14.string().min(1),
14629
+ message: z14.string().min(1),
14630
+ taskId: z14.string().min(1).optional(),
14631
+ severity: z14.enum(["error", "warning"])
14632
+ });
14633
+ workGraphScaffoldValidateResultSchema = z14.object({
14634
+ rootId: z14.string().min(1),
14635
+ valid: z14.boolean(),
14636
+ dryRun: z14.boolean(),
14637
+ issues: z14.array(workGraphScaffoldValidationIssueSchema),
14638
+ hierarchy: z14.object({
14639
+ valid: z14.boolean(),
14640
+ violations: z14.array(
14641
+ z14.object({
14642
+ code: z14.literal(E_WORKGRAPH_PARENT_TYPE_MATRIX),
14643
+ taskId: z14.string().min(1),
13669
14644
  taskType: taskTypeSchema,
13670
- parentId: z13.string().min(1).nullable(),
14645
+ parentId: z14.string().min(1).nullable(),
13671
14646
  parentType: taskTypeSchema.optional(),
13672
- message: z13.string().min(1)
14647
+ message: z14.string().min(1)
13673
14648
  })
13674
14649
  )
13675
14650
  })
13676
14651
  });
13677
14652
  workGraphScaffoldApplyParamsSchema = workGraphScaffoldValidateParamsSchema.extend({
13678
- apply: z13.boolean().optional()
14653
+ apply: z14.boolean().optional()
13679
14654
  });
13680
14655
  workGraphScaffoldApplyResultSchema = workGraphScaffoldValidateResultSchema.extend({
13681
- applied: z13.boolean(),
13682
- nodesChanged: z13.number().int().nonnegative(),
13683
- edgesChanged: z13.number().int().nonnegative()
13684
- });
13685
- workGraphPlanningDocParamsSchema = z13.object({
13686
- rootId: z13.string().min(1),
13687
- audience: z13.enum(["agent", "maintainer"]),
13688
- tokenBudget: z13.number().int().positive().optional(),
13689
- includeRelations: z13.boolean().optional(),
13690
- includeReadiness: z13.boolean().optional(),
13691
- includeRollup: z13.boolean().optional()
13692
- });
13693
- workGraphPlanningDocSchema = z13.object({
13694
- rootId: z13.string().min(1),
13695
- generatedAt: z13.string().min(1),
13696
- audience: z13.enum(["agent", "maintainer"]),
13697
- title: z13.string().min(1),
13698
- content: z13.string(),
13699
- sections: z13.array(z13.string().min(1)),
13700
- estimatedTokens: z13.number().int().nonnegative(),
13701
- budget: z13.object({
13702
- tokenBudget: z13.number().int().positive(),
13703
- truncated: z13.boolean()
14656
+ applied: z14.boolean(),
14657
+ nodesChanged: z14.number().int().nonnegative(),
14658
+ edgesChanged: z14.number().int().nonnegative()
14659
+ });
14660
+ workGraphPlanningDocParamsSchema = z14.object({
14661
+ rootId: z14.string().min(1),
14662
+ audience: z14.enum(["agent", "maintainer"]),
14663
+ tokenBudget: z14.number().int().positive().optional(),
14664
+ includeRelations: z14.boolean().optional(),
14665
+ includeReadiness: z14.boolean().optional(),
14666
+ includeRollup: z14.boolean().optional()
14667
+ });
14668
+ workGraphPlanningDocSchema = z14.object({
14669
+ rootId: z14.string().min(1),
14670
+ generatedAt: z14.string().min(1),
14671
+ audience: z14.enum(["agent", "maintainer"]),
14672
+ title: z14.string().min(1),
14673
+ content: z14.string(),
14674
+ sections: z14.array(z14.string().min(1)),
14675
+ estimatedTokens: z14.number().int().nonnegative(),
14676
+ budget: z14.object({
14677
+ tokenBudget: z14.number().int().positive(),
14678
+ truncated: z14.boolean()
13704
14679
  }).optional()
13705
14680
  });
13706
14681
  tasksTraverseParamsSchema = paginationParamsSchema.extend({
13707
- rootId: z13.string().min(1),
14682
+ rootId: z14.string().min(1),
13708
14683
  direction: workGraphTraversalDirectionSchema,
13709
- maxDepth: z13.number().int().nonnegative().optional(),
13710
- includeRelations: z13.boolean().optional()
14684
+ maxDepth: z14.number().int().nonnegative().optional(),
14685
+ includeRelations: z14.boolean().optional()
13711
14686
  });
13712
- tasksTraverseResultSchema = z13.object({
13713
- rootId: z13.string().min(1),
14687
+ tasksTraverseResultSchema = z14.object({
14688
+ rootId: z14.string().min(1),
13714
14689
  direction: workGraphTraversalDirectionSchema,
13715
- nodes: z13.array(workGraphNodeSchema),
13716
- edges: z13.array(workGraphEdgeSchema),
14690
+ nodes: z14.array(workGraphNodeSchema),
14691
+ edges: z14.array(workGraphEdgeSchema),
13717
14692
  pageInfo: workGraphPageInfoSchema
13718
14693
  });
13719
14694
  tasksTreeParamsSchema = paginationParamsSchema.extend({
13720
- rootId: z13.string().min(1),
13721
- maxDepth: z13.number().int().nonnegative().optional()
14695
+ rootId: z14.string().min(1),
14696
+ maxDepth: z14.number().int().nonnegative().optional()
13722
14697
  });
13723
- tasksTreeResultSchema = z13.object({
13724
- rootId: z13.string().min(1),
13725
- nodes: z13.array(workGraphNodeSchema.extend({ depth: z13.number().int().positive() })),
13726
- edges: z13.array(workGraphHierarchyEdgeSchema),
14698
+ tasksTreeResultSchema = z14.object({
14699
+ rootId: z14.string().min(1),
14700
+ nodes: z14.array(workGraphNodeSchema.extend({ depth: z14.number().int().positive() })),
14701
+ edges: z14.array(workGraphHierarchyEdgeSchema),
13727
14702
  pageInfo: workGraphPageInfoSchema
13728
14703
  });
13729
- tasksRollupParamsSchema = z13.object({
13730
- rootId: z13.string().min(1),
14704
+ tasksRollupParamsSchema = z14.object({
14705
+ rootId: z14.string().min(1),
13731
14706
  expectedDirectRollup: workGraphRollupCountsSchema.optional()
13732
14707
  });
13733
- tasksRollupResultSchema = z13.object({
13734
- rootId: z13.string().min(1),
14708
+ tasksRollupResultSchema = z14.object({
14709
+ rootId: z14.string().min(1),
13735
14710
  direct: workGraphRollupCountsSchema,
13736
14711
  subtree: workGraphRollupCountsSchema,
13737
- percentDenominator: z13.object({
13738
- basis: z13.literal("subtree-total"),
13739
- total: z13.number().int().nonnegative(),
13740
- description: z13.string().min(1)
14712
+ percentDenominator: z14.object({
14713
+ basis: z14.literal("subtree-total"),
14714
+ total: z14.number().int().nonnegative(),
14715
+ description: z14.string().min(1)
13741
14716
  }),
13742
14717
  percentages: workGraphSubtreePercentagesSchema,
13743
- staleProjection: z13.boolean(),
13744
- projectionMismatches: z13.array(workGraphProjectionMismatchSchema)
13745
- });
13746
- tasksFrontierParamsSchema = z13.object({
13747
- rootId: z13.string().min(1),
13748
- role: z13.string().min(1).optional()
13749
- });
13750
- tasksFrontierResultSchema = z13.object({
13751
- rootId: z13.string().min(1),
13752
- role: z13.string().min(1).optional(),
13753
- groups: z13.object({
13754
- ready: z13.array(workGraphReadyFrontierTaskSchema),
13755
- blocked: z13.array(workGraphReadyFrontierTaskSchema),
13756
- blockedBy: z13.array(
13757
- z13.discriminatedUnion("kind", [
13758
- z13.object({
13759
- kind: z13.literal("dependency"),
13760
- blockerId: z13.string().min(1),
13761
- blocks: z13.array(z13.string().min(1))
14718
+ staleProjection: z14.boolean(),
14719
+ projectionMismatches: z14.array(workGraphProjectionMismatchSchema)
14720
+ });
14721
+ tasksFrontierParamsSchema = z14.object({
14722
+ rootId: z14.string().min(1),
14723
+ role: z14.string().min(1).optional()
14724
+ });
14725
+ tasksFrontierResultSchema = z14.object({
14726
+ rootId: z14.string().min(1),
14727
+ role: z14.string().min(1).optional(),
14728
+ groups: z14.object({
14729
+ ready: z14.array(workGraphReadyFrontierTaskSchema),
14730
+ blocked: z14.array(workGraphReadyFrontierTaskSchema),
14731
+ blockedBy: z14.array(
14732
+ z14.discriminatedUnion("kind", [
14733
+ z14.object({
14734
+ kind: z14.literal("dependency"),
14735
+ blockerId: z14.string().min(1),
14736
+ blocks: z14.array(z14.string().min(1))
13762
14737
  }),
13763
- z13.object({
13764
- kind: z13.literal("gate"),
14738
+ z14.object({
14739
+ kind: z14.literal("gate"),
13765
14740
  gate: verificationGateSchema,
13766
- blocks: z13.array(z13.string().min(1))
14741
+ blocks: z14.array(z14.string().min(1))
13767
14742
  })
13768
14743
  ])
13769
14744
  )
13770
14745
  })
13771
14746
  });
13772
14747
  tasksWorkGraphAuditParamsSchema = paginationParamsSchema.extend({
13773
- rootId: z13.string().min(1),
13774
- maxDepth: z13.number().int().nonnegative().optional(),
13775
- includeRelations: z13.boolean().optional()
13776
- });
13777
- tasksWorkGraphAuditResultSchema = z13.object({
13778
- rootId: z13.string().min(1),
13779
- hierarchy: z13.object({
13780
- valid: z13.boolean(),
13781
- violations: z13.array(
13782
- z13.object({
13783
- code: z13.literal(E_WORKGRAPH_PARENT_TYPE_MATRIX),
13784
- taskId: z13.string().min(1),
14748
+ rootId: z14.string().min(1),
14749
+ maxDepth: z14.number().int().nonnegative().optional(),
14750
+ includeRelations: z14.boolean().optional()
14751
+ });
14752
+ tasksWorkGraphAuditResultSchema = z14.object({
14753
+ rootId: z14.string().min(1),
14754
+ hierarchy: z14.object({
14755
+ valid: z14.boolean(),
14756
+ violations: z14.array(
14757
+ z14.object({
14758
+ code: z14.literal(E_WORKGRAPH_PARENT_TYPE_MATRIX),
14759
+ taskId: z14.string().min(1),
13785
14760
  taskType: taskTypeSchema,
13786
- parentId: z13.string().min(1).nullable(),
14761
+ parentId: z14.string().min(1).nullable(),
13787
14762
  parentType: taskTypeSchema.optional(),
13788
- message: z13.string().min(1)
14763
+ message: z14.string().min(1)
13789
14764
  })
13790
14765
  )
13791
14766
  }),
13792
14767
  traversal: tasksTraverseResultSchema,
13793
14768
  frontier: tasksFrontierResultSchema,
13794
14769
  rollup: tasksRollupResultSchema,
13795
- relationEdges: z13.object({
13796
- rootId: z13.string().min(1),
14770
+ relationEdges: z14.object({
14771
+ rootId: z14.string().min(1),
13797
14772
  direction: workGraphEdgeDirectionSchema,
13798
- edges: z13.array(
13799
- z13.discriminatedUnion("source", [
14773
+ edges: z14.array(
14774
+ z14.discriminatedUnion("source", [
13800
14775
  workGraphRelationEdgeSchema,
13801
14776
  workGraphDependencyEdgeSchema
13802
14777
  ])
@@ -13816,22 +14791,22 @@ var init_operation_envelope_validation = __esm({
13816
14791
  });
13817
14792
 
13818
14793
  // packages/contracts/src/operations/ensures-schema-registry.ts
13819
- import { z as z14 } from "zod";
14794
+ import { z as z15 } from "zod";
13820
14795
  var taskTreeEntrySchema, taskTreeSchema, evidenceSchema, passthroughSchema, LEGACY_PASSTHROUGH_SCHEMA_NAMES, ENSURES_SCHEMA_REGISTRY;
13821
14796
  var init_ensures_schema_registry = __esm({
13822
14797
  "packages/contracts/src/operations/ensures-schema-registry.ts"() {
13823
14798
  "use strict";
13824
- taskTreeEntrySchema = z14.object({
13825
- title: z14.string({ message: "title must be a non-empty string" }).refine((s) => s.trim().length > 0, { message: "title must be a non-empty string" }),
13826
- acceptance: z14.array(z14.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), {
14799
+ taskTreeEntrySchema = z15.object({
14800
+ title: z15.string({ message: "title must be a non-empty string" }).refine((s) => s.trim().length > 0, { message: "title must be a non-empty string" }),
14801
+ acceptance: z15.array(z15.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), {
13827
14802
  message: "acceptance array contains no non-empty strings"
13828
14803
  }),
13829
- id: z14.string().optional(),
13830
- parentId: z14.string().optional(),
13831
- depends: z14.array(z14.string()).optional()
14804
+ id: z15.string().optional(),
14805
+ parentId: z15.string().optional(),
14806
+ depends: z15.array(z15.string()).optional()
13832
14807
  });
13833
- taskTreeSchema = z14.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" });
13834
- evidenceSchema = z14.unknown().superRefine((value, ctx) => {
14808
+ taskTreeSchema = z15.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" });
14809
+ evidenceSchema = z15.unknown().superRefine((value, ctx) => {
13835
14810
  if (value === null || value === void 0) {
13836
14811
  ctx.addIssue({
13837
14812
  code: "custom",
@@ -13865,7 +14840,7 @@ var init_ensures_schema_registry = __esm({
13865
14840
  message: `evidence must be a string, array, or object (got ${typeof value})`
13866
14841
  });
13867
14842
  });
13868
- passthroughSchema = z14.unknown();
14843
+ passthroughSchema = z15.unknown();
13869
14844
  LEGACY_PASSTHROUGH_SCHEMA_NAMES = [
13870
14845
  // release.cantbook
13871
14846
  "version_bump_report",
@@ -14143,31 +15118,37 @@ var init_peer = __esm({
14143
15118
  });
14144
15119
 
14145
15120
  // packages/contracts/src/release/evidence-atoms.ts
14146
- import { z as z15 } from "zod";
15121
+ import { z as z16 } from "zod";
14147
15122
  var parsedPrEvidenceAtomSchema, prEvidenceStateModifierSchema, ghPrViewSchema, PR_REQUIRED_WORKFLOWS;
14148
15123
  var init_evidence_atoms = __esm({
14149
15124
  "packages/contracts/src/release/evidence-atoms.ts"() {
14150
15125
  "use strict";
14151
- parsedPrEvidenceAtomSchema = z15.object({
14152
- kind: z15.literal("pr"),
14153
- prNumber: z15.number().int().positive()
14154
- });
14155
- prEvidenceStateModifierSchema = z15.object({
14156
- kind: z15.literal("state"),
14157
- value: z15.literal("MERGED")
14158
- });
14159
- ghPrViewSchema = z15.object({
14160
- state: z15.enum(["OPEN", "CLOSED", "MERGED"]),
14161
- mergedAt: z15.string().nullable(),
14162
- headRefOid: z15.string().optional(),
14163
- mergeable: z15.string().optional(),
14164
- statusCheckRollup: z15.array(
14165
- z15.object({
14166
- __typename: z15.string().optional(),
14167
- name: z15.string().optional(),
14168
- workflowName: z15.string().optional(),
14169
- conclusion: z15.string().nullable().optional(),
14170
- status: z15.string().optional()
15126
+ parsedPrEvidenceAtomSchema = z16.object({
15127
+ kind: z16.literal("pr"),
15128
+ prNumber: z16.number().int().positive()
15129
+ });
15130
+ prEvidenceStateModifierSchema = z16.object({
15131
+ kind: z16.literal("state"),
15132
+ value: z16.literal("MERGED")
15133
+ });
15134
+ ghPrViewSchema = z16.object({
15135
+ state: z16.enum(["OPEN", "CLOSED", "MERGED"]),
15136
+ mergedAt: z16.string().nullable(),
15137
+ headRefOid: z16.string().optional(),
15138
+ mergeCommit: z16.object({ oid: z16.string() }).nullable().optional(),
15139
+ title: z16.string().optional(),
15140
+ body: z16.string().optional(),
15141
+ headRefName: z16.string().optional(),
15142
+ files: z16.array(z16.object({ path: z16.string() })).optional(),
15143
+ changedFiles: z16.number().int().nonnegative().optional(),
15144
+ mergeable: z16.string().optional(),
15145
+ statusCheckRollup: z16.array(
15146
+ z16.object({
15147
+ __typename: z16.string().optional(),
15148
+ name: z16.string().optional(),
15149
+ workflowName: z16.string().optional(),
15150
+ conclusion: z16.string().nullable().optional(),
15151
+ status: z16.string().optional()
14171
15152
  }).passthrough()
14172
15153
  ).optional().default([])
14173
15154
  }).passthrough();
@@ -14180,7 +15161,7 @@ var init_evidence_atoms = __esm({
14180
15161
  });
14181
15162
 
14182
15163
  // packages/contracts/src/release/plan.ts
14183
- import { z as z16 } from "zod";
15164
+ import { z as z17 } from "zod";
14184
15165
  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;
14185
15166
  var init_plan = __esm({
14186
15167
  "packages/contracts/src/release/plan.ts"() {
@@ -14223,20 +15204,20 @@ var init_plan = __esm({
14223
15204
  ];
14224
15205
  IMPACT = ["major", "minor", "patch"];
14225
15206
  RESOLVED_SOURCE = ["project-context", "language-default", "legacy-alias"];
14226
- ReleaseChannelSchema = z16.enum(RELEASE_CHANNEL);
14227
- ReleaseSchemeSchema = z16.enum(RELEASE_SCHEME);
14228
- ReleaseKindSchema = z16.enum(RELEASE_KIND);
14229
- ReleaseStatusSchema = z16.enum(RELEASE_STATUS);
14230
- GateStatusSchema = z16.enum(GATE_STATUS);
14231
- GateNameSchema = z16.enum(GATE_NAME);
14232
- PlatformTupleSchema = z16.enum(PLATFORM_TUPLE);
14233
- PublisherSchema = z16.enum(PUBLISHER);
14234
- TaskKindSchema = z16.enum(TASK_KIND);
14235
- ImpactSchema = z16.enum(IMPACT);
14236
- ResolvedSourceSchema = z16.enum(RESOLVED_SOURCE);
14237
- Iso8601 = z16.iso.datetime({ offset: true });
14238
- NonEmptyString = z16.string().min(1);
14239
- ReleasePlanTaskSchema = z16.object({
15207
+ ReleaseChannelSchema = z17.enum(RELEASE_CHANNEL);
15208
+ ReleaseSchemeSchema = z17.enum(RELEASE_SCHEME);
15209
+ ReleaseKindSchema = z17.enum(RELEASE_KIND);
15210
+ ReleaseStatusSchema = z17.enum(RELEASE_STATUS);
15211
+ GateStatusSchema = z17.enum(GATE_STATUS);
15212
+ GateNameSchema = z17.enum(GATE_NAME);
15213
+ PlatformTupleSchema = z17.enum(PLATFORM_TUPLE);
15214
+ PublisherSchema = z17.enum(PUBLISHER);
15215
+ TaskKindSchema = z17.enum(TASK_KIND);
15216
+ ImpactSchema = z17.enum(IMPACT);
15217
+ ResolvedSourceSchema = z17.enum(RESOLVED_SOURCE);
15218
+ Iso8601 = z17.iso.datetime({ offset: true });
15219
+ NonEmptyString = z17.string().min(1);
15220
+ ReleasePlanTaskSchema = z17.object({
14240
15221
  /** Task ID (e.g. "T10001"). Format intentionally loose so historical IDs validate. */
14241
15222
  id: NonEmptyString,
14242
15223
  /** Conventional-commit-aligned task classification. */
@@ -14244,20 +15225,20 @@ var init_plan = __esm({
14244
15225
  /** SemVer impact classification. */
14245
15226
  impact: ImpactSchema,
14246
15227
  /** Human-readable changelog line for this task. */
14247
- userFacingSummary: z16.string(),
15228
+ userFacingSummary: z17.string(),
14248
15229
  /**
14249
15230
  * ADR-051 evidence atoms attesting the task's gate results. Format is
14250
15231
  * `kind:value` (e.g. `commit:abc123`, `test-run:vitest.json`). The contract
14251
15232
  * accepts empty arrays so legacy plans validate; `cleo release plan`
14252
15233
  * enforces non-empty via R-301.
14253
15234
  */
14254
- evidenceAtoms: z16.array(NonEmptyString),
15235
+ evidenceAtoms: z17.array(NonEmptyString),
14255
15236
  /** IVTR phase at plan time — informational only per R-316. */
14256
- ivtrPhaseAtPlan: z16.string().optional(),
15237
+ ivtrPhaseAtPlan: z17.string().optional(),
14257
15238
  /** Epic this task rolls up to, locked at plan time per R-303. */
14258
15239
  epicAncestor: NonEmptyString
14259
15240
  });
14260
- ReleaseGateSchema = z16.object({
15241
+ ReleaseGateSchema = z17.object({
14261
15242
  /** Canonical gate name. */
14262
15243
  name: GateNameSchema,
14263
15244
  /** ADR-051 atom string identifying the resolved tool (e.g. `tool:test`). */
@@ -14267,11 +15248,11 @@ var init_plan = __esm({
14267
15248
  /** ISO-8601 timestamp the gate was last verified. */
14268
15249
  lastVerifiedAt: Iso8601,
14269
15250
  /** Resolved shell command (e.g. `pnpm run test`). Optional for unresolved gates. */
14270
- resolvedCommand: z16.string().optional(),
15251
+ resolvedCommand: z17.string().optional(),
14271
15252
  /** Provenance of the resolved command. Optional for unresolved gates. */
14272
15253
  resolvedSource: ResolvedSourceSchema.optional()
14273
15254
  });
14274
- ReleasePlatformMatrixEntrySchema = z16.object({
15255
+ ReleasePlatformMatrixEntrySchema = z17.object({
14275
15256
  /** Target platform tuple. */
14276
15257
  platform: PlatformTupleSchema,
14277
15258
  /** Distribution backend. */
@@ -14279,47 +15260,47 @@ var init_plan = __esm({
14279
15260
  /** Package identifier on the target backend (e.g. `@cleocode/cleo`). */
14280
15261
  package: NonEmptyString,
14281
15262
  /** Whether to run the GHA smoke job for this matrix entry. */
14282
- smoke: z16.boolean().default(true).optional()
15263
+ smoke: z17.boolean().default(true).optional()
14283
15264
  });
14284
- ReleasePreflightSummarySchema = z16.object({
15265
+ ReleasePreflightSummarySchema = z17.object({
14285
15266
  /** True if esbuild externals are out of sync with package.json. */
14286
- esbuildExternalsDrift: z16.boolean(),
15267
+ esbuildExternalsDrift: z17.boolean(),
14287
15268
  /** True if `pnpm-lock.yaml` diverges from the workspace manifest. */
14288
- lockfileDrift: z16.boolean(),
15269
+ lockfileDrift: z17.boolean(),
14289
15270
  /** True if all epic children are in terminal lifecycle states. */
14290
- epicCompletenessClean: z16.boolean(),
15271
+ epicCompletenessClean: z17.boolean(),
14291
15272
  /** True if no task appears in multiple in-flight release plans. */
14292
- doubleListingClean: z16.boolean(),
15273
+ doubleListingClean: z17.boolean(),
14293
15274
  /** Non-fatal preflight warnings (e.g. unresolved tools per R-024). */
14294
- preflightWarnings: z16.array(z16.string()).default([]).optional()
15275
+ preflightWarnings: z17.array(z17.string()).default([]).optional()
14295
15276
  });
14296
- ReleasePlanChangelogSchema = z16.object({
15277
+ ReleasePlanChangelogSchema = z17.object({
14297
15278
  /** `kind=feat` tasks. */
14298
- features: z16.array(NonEmptyString).default([]),
15279
+ features: z17.array(NonEmptyString).default([]),
14299
15280
  /** `kind=fix` or `kind=hotfix` tasks. */
14300
- fixes: z16.array(NonEmptyString).default([]),
15281
+ fixes: z17.array(NonEmptyString).default([]),
14301
15282
  /** `kind=chore`, `docs`, `refactor`, `test`, `perf` tasks. */
14302
- chores: z16.array(NonEmptyString).default([]),
15283
+ chores: z17.array(NonEmptyString).default([]),
14303
15284
  /** `kind=breaking` or `kind=revert` tasks. */
14304
- breaking: z16.array(NonEmptyString).default([])
15285
+ breaking: z17.array(NonEmptyString).default([])
14305
15286
  });
14306
- ReleasePlanMetaSchema = z16.object({
15287
+ ReleasePlanMetaSchema = z17.object({
14307
15288
  /** True if this is the project's first ever release. */
14308
- firstEverRelease: z16.boolean().optional(),
15289
+ firstEverRelease: z17.boolean().optional(),
14309
15290
  /** Canonical tool names that could not be resolved at plan time. */
14310
- unresolvedTools: z16.array(z16.string()).optional(),
15291
+ unresolvedTools: z17.array(z17.string()).optional(),
14311
15292
  /** Project archetype detected at plan time. */
14312
- archetype: z16.string().optional()
14313
- }).catchall(z16.unknown());
14314
- ReleasePlanSchema = z16.object({
15293
+ archetype: z17.string().optional()
15294
+ }).catchall(z17.unknown());
15295
+ ReleasePlanSchema = z17.object({
14315
15296
  /** Schema URL for this plan version. */
14316
- $schema: z16.string().optional(),
15297
+ $schema: z17.string().optional(),
14317
15298
  /** Requested version string (e.g. "v2026.6.0"). Includes the leading `v`. */
14318
15299
  version: NonEmptyString,
14319
15300
  /** Resolved version string after suffix application (e.g. "v2026.6.0.2"). */
14320
15301
  resolvedVersion: NonEmptyString,
14321
15302
  /** True if a `calver-suffix` was applied to disambiguate a same-day hotfix. */
14322
- suffixApplied: z16.boolean(),
15303
+ suffixApplied: z17.boolean(),
14323
15304
  /** Versioning scheme governing `version` / `resolvedVersion`. */
14324
15305
  scheme: ReleaseSchemeSchema,
14325
15306
  /** npm dist-tag channel for this release. */
@@ -14336,27 +15317,27 @@ var init_plan = __esm({
14336
15317
  * Version of the previous release on the same channel. MUST be `null` only
14337
15318
  * for first-ever releases (R-300, enforced at the verb layer).
14338
15319
  */
14339
- previousVersion: z16.string().nullable(),
15320
+ previousVersion: z17.string().nullable(),
14340
15321
  /** Git tag of the previous release (typically `previousVersion` prefixed). */
14341
- previousTag: z16.string().nullable(),
15322
+ previousTag: z17.string().nullable(),
14342
15323
  /** ISO-8601 timestamp the previous release was published. */
14343
15324
  previousShippedAt: Iso8601.nullable(),
14344
15325
  /** Tasks rolled into this release. */
14345
- tasks: z16.array(ReleasePlanTaskSchema),
15326
+ tasks: z17.array(ReleasePlanTaskSchema),
14346
15327
  /** Bucketed changelog. */
14347
15328
  changelog: ReleasePlanChangelogSchema,
14348
15329
  /** Per-gate verification status. */
14349
- gates: z16.array(ReleaseGateSchema),
15330
+ gates: z17.array(ReleaseGateSchema),
14350
15331
  /** Platform / publisher matrix. */
14351
- platformMatrix: z16.array(ReleasePlatformMatrixEntrySchema),
15332
+ platformMatrix: z17.array(ReleasePlatformMatrixEntrySchema),
14352
15333
  /** Preflight summary from `cleo release plan`. */
14353
15334
  preflightSummary: ReleasePreflightSummarySchema,
14354
15335
  /** URL of the GHA workflow run (populated by `release-prepare.yml`). */
14355
- workflowRunUrl: z16.string().nullable(),
15336
+ workflowRunUrl: z17.string().nullable(),
14356
15337
  /** URL of the bump PR (populated by `cleo release open`). */
14357
- prUrl: z16.string().nullable(),
15338
+ prUrl: z17.string().nullable(),
14358
15339
  /** Merge commit SHA on `main` (populated by `release-publish.yml`). */
14359
- mergeCommitSha: z16.string().nullable(),
15340
+ mergeCommitSha: z17.string().nullable(),
14360
15341
  /** Current FSM state per R-302. */
14361
15342
  status: ReleaseStatusSchema,
14362
15343
  /** Informational / forward-compat metadata. */
@@ -14430,52 +15411,52 @@ var init_session2 = __esm({
14430
15411
  });
14431
15412
 
14432
15413
  // packages/contracts/src/session-journal.ts
14433
- import { z as z17 } from "zod";
15414
+ import { z as z18 } from "zod";
14434
15415
  var SESSION_JOURNAL_SCHEMA_VERSION, sessionJournalDoctorSummarySchema, sessionJournalDebriefSummarySchema, sessionJournalEntrySchema;
14435
15416
  var init_session_journal = __esm({
14436
15417
  "packages/contracts/src/session-journal.ts"() {
14437
15418
  "use strict";
14438
15419
  SESSION_JOURNAL_SCHEMA_VERSION = "1.0";
14439
- sessionJournalDoctorSummarySchema = z17.object({
15420
+ sessionJournalDoctorSummarySchema = z18.object({
14440
15421
  /** `true` when zero noise patterns were detected. */
14441
- isClean: z17.boolean(),
15422
+ isClean: z18.boolean(),
14442
15423
  /** Total number of noise findings across all patterns. */
14443
- findingsCount: z17.number().int().nonnegative(),
15424
+ findingsCount: z18.number().int().nonnegative(),
14444
15425
  /** Pattern names that were detected (empty when isClean). */
14445
- patterns: z17.array(z17.string()),
15426
+ patterns: z18.array(z18.string()),
14446
15427
  /** Total brain entries scanned. `0` = empty or unavailable. */
14447
- totalScanned: z17.number().int().nonnegative()
15428
+ totalScanned: z18.number().int().nonnegative()
14448
15429
  });
14449
- sessionJournalDebriefSummarySchema = z17.object({
15430
+ sessionJournalDebriefSummarySchema = z18.object({
14450
15431
  /** First 200 characters of the session end note (if provided). */
14451
- noteExcerpt: z17.string().max(200).optional(),
15432
+ noteExcerpt: z18.string().max(200).optional(),
14452
15433
  /** Number of tasks completed during the session. */
14453
- tasksCompletedCount: z17.number().int().nonnegative(),
15434
+ tasksCompletedCount: z18.number().int().nonnegative(),
14454
15435
  /** Up to 5 task IDs (not titles) that were the focus of the session. */
14455
- tasksFocused: z17.array(z17.string()).max(5).optional()
15436
+ tasksFocused: z18.array(z18.string()).max(5).optional()
14456
15437
  });
14457
- sessionJournalEntrySchema = z17.object({
15438
+ sessionJournalEntrySchema = z18.object({
14458
15439
  // Identity
14459
15440
  /** Schema version for forward-compatibility. Always `'1.0'` in this release. */
14460
- schemaVersion: z17.literal(SESSION_JOURNAL_SCHEMA_VERSION),
15441
+ schemaVersion: z18.literal(SESSION_JOURNAL_SCHEMA_VERSION),
14461
15442
  /** ISO 8601 timestamp when the entry was written. */
14462
- timestamp: z17.string(),
15443
+ timestamp: z18.string(),
14463
15444
  /** CLEO session ID (e.g. `ses_20260424055456_ede571`). */
14464
- sessionId: z17.string(),
15445
+ sessionId: z18.string(),
14465
15446
  /** Event type that triggered this journal entry. */
14466
- eventType: z17.enum(["session_start", "session_end", "observation", "decision", "error"]),
15447
+ eventType: z18.enum(["session_start", "session_end", "observation", "decision", "error"]),
14467
15448
  // Session metadata (set on session_start / session_end)
14468
15449
  /** Agent identifier (e.g. `cleo-prime`, `claude-code`). */
14469
- agentIdentifier: z17.string().optional(),
15450
+ agentIdentifier: z18.string().optional(),
14470
15451
  /** Provider adapter ID active for this session. */
14471
- providerId: z17.string().optional(),
15452
+ providerId: z18.string().optional(),
14472
15453
  /** Session scope string (e.g. `'global'` or `'epic:T1263'`). */
14473
- scope: z17.string().optional(),
15454
+ scope: z18.string().optional(),
14474
15455
  // Session-end fields
14475
15456
  /** Duration of the session in seconds (session_end only). */
14476
- duration: z17.number().int().nonnegative().optional(),
15457
+ duration: z18.number().int().nonnegative().optional(),
14477
15458
  /** Task IDs (not titles) completed during the session. */
14478
- tasksCompleted: z17.array(z17.string()).optional(),
15459
+ tasksCompleted: z18.array(z18.string()).optional(),
14479
15460
  // Doctor summary (T1262 absorbed)
14480
15461
  /** Compact result of `scanBrainNoise` run at session-end. */
14481
15462
  doctorSummary: sessionJournalDoctorSummarySchema.optional(),
@@ -14484,7 +15465,7 @@ var init_session_journal = __esm({
14484
15465
  debriefSummary: sessionJournalDebriefSummarySchema.optional(),
14485
15466
  // Optional hash chain
14486
15467
  /** SHA-256 hex of the previous entry's raw JSON string (for integrity chain). */
14487
- prevEntryHash: z17.string().optional()
15468
+ prevEntryHash: z18.string().optional()
14488
15469
  });
14489
15470
  }
14490
15471
  });
@@ -14497,52 +15478,52 @@ var init_task = __esm({
14497
15478
  });
14498
15479
 
14499
15480
  // packages/contracts/src/task-evidence.ts
14500
- import { z as z18 } from "zod";
15481
+ import { z as z19 } from "zod";
14501
15482
  var fileEvidenceSchema, logEvidenceSchema, screenshotEvidenceSchema, testOutputEvidenceSchema, commandOutputEvidenceSchema, taskEvidenceSchema;
14502
15483
  var init_task_evidence = __esm({
14503
15484
  "packages/contracts/src/task-evidence.ts"() {
14504
15485
  "use strict";
14505
- fileEvidenceSchema = z18.object({
14506
- kind: z18.literal("file"),
14507
- sha256: z18.string().length(64),
14508
- timestamp: z18.string().datetime(),
14509
- path: z18.string().min(1),
14510
- mime: z18.string().optional(),
14511
- description: z18.string().optional()
14512
- });
14513
- logEvidenceSchema = z18.object({
14514
- kind: z18.literal("log"),
14515
- sha256: z18.string().length(64),
14516
- timestamp: z18.string().datetime(),
14517
- source: z18.string().min(1),
14518
- description: z18.string().optional()
14519
- });
14520
- screenshotEvidenceSchema = z18.object({
14521
- kind: z18.literal("screenshot"),
14522
- sha256: z18.string().length(64),
14523
- timestamp: z18.string().datetime(),
14524
- mime: z18.enum(["image/png", "image/jpeg", "image/webp"]).optional(),
14525
- description: z18.string().optional()
14526
- });
14527
- testOutputEvidenceSchema = z18.object({
14528
- kind: z18.literal("test-output"),
14529
- sha256: z18.string().length(64),
14530
- timestamp: z18.string().datetime(),
14531
- passed: z18.number().int().nonnegative(),
14532
- failed: z18.number().int().nonnegative(),
14533
- skipped: z18.number().int().nonnegative(),
14534
- exitCode: z18.number().int(),
14535
- description: z18.string().optional()
14536
- });
14537
- commandOutputEvidenceSchema = z18.object({
14538
- kind: z18.literal("command-output"),
14539
- sha256: z18.string().length(64),
14540
- timestamp: z18.string().datetime(),
14541
- cmd: z18.string().min(1),
14542
- exitCode: z18.number().int(),
14543
- description: z18.string().optional()
14544
- });
14545
- taskEvidenceSchema = z18.discriminatedUnion("kind", [
15486
+ fileEvidenceSchema = z19.object({
15487
+ kind: z19.literal("file"),
15488
+ sha256: z19.string().length(64),
15489
+ timestamp: z19.string().datetime(),
15490
+ path: z19.string().min(1),
15491
+ mime: z19.string().optional(),
15492
+ description: z19.string().optional()
15493
+ });
15494
+ logEvidenceSchema = z19.object({
15495
+ kind: z19.literal("log"),
15496
+ sha256: z19.string().length(64),
15497
+ timestamp: z19.string().datetime(),
15498
+ source: z19.string().min(1),
15499
+ description: z19.string().optional()
15500
+ });
15501
+ screenshotEvidenceSchema = z19.object({
15502
+ kind: z19.literal("screenshot"),
15503
+ sha256: z19.string().length(64),
15504
+ timestamp: z19.string().datetime(),
15505
+ mime: z19.enum(["image/png", "image/jpeg", "image/webp"]).optional(),
15506
+ description: z19.string().optional()
15507
+ });
15508
+ testOutputEvidenceSchema = z19.object({
15509
+ kind: z19.literal("test-output"),
15510
+ sha256: z19.string().length(64),
15511
+ timestamp: z19.string().datetime(),
15512
+ passed: z19.number().int().nonnegative(),
15513
+ failed: z19.number().int().nonnegative(),
15514
+ skipped: z19.number().int().nonnegative(),
15515
+ exitCode: z19.number().int(),
15516
+ description: z19.string().optional()
15517
+ });
15518
+ commandOutputEvidenceSchema = z19.object({
15519
+ kind: z19.literal("command-output"),
15520
+ sha256: z19.string().length(64),
15521
+ timestamp: z19.string().datetime(),
15522
+ cmd: z19.string().min(1),
15523
+ exitCode: z19.number().int(),
15524
+ description: z19.string().optional()
15525
+ });
15526
+ taskEvidenceSchema = z19.discriminatedUnion("kind", [
14546
15527
  fileEvidenceSchema,
14547
15528
  logEvidenceSchema,
14548
15529
  screenshotEvidenceSchema,
@@ -14553,12 +15534,12 @@ var init_task_evidence = __esm({
14553
15534
  });
14554
15535
 
14555
15536
  // packages/contracts/src/tasks/archive.ts
14556
- import { z as z19 } from "zod";
15537
+ import { z as z20 } from "zod";
14557
15538
  var ArchiveReason, ARCHIVE_REASON_VALUES;
14558
15539
  var init_archive = __esm({
14559
15540
  "packages/contracts/src/tasks/archive.ts"() {
14560
15541
  "use strict";
14561
- ArchiveReason = z19.enum([
15542
+ ArchiveReason = z20.enum([
14562
15543
  "verified",
14563
15544
  "reconciled",
14564
15545
  "superseded",
@@ -14571,47 +15552,47 @@ var init_archive = __esm({
14571
15552
  });
14572
15553
 
14573
15554
  // packages/contracts/src/tasks.ts
14574
- import { z as z20 } from "zod";
15555
+ import { z as z21 } from "zod";
14575
15556
  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;
14576
15557
  var init_tasks2 = __esm({
14577
15558
  "packages/contracts/src/tasks.ts"() {
14578
15559
  "use strict";
14579
15560
  init_status_registry();
14580
- taskMutationWarningSeveritySchema = z20.enum(["info", "warning"]);
14581
- taskMutationWarningSchema = z20.object({
14582
- code: z20.string().min(1),
14583
- message: z20.string().min(1),
15561
+ taskMutationWarningSeveritySchema = z21.enum(["info", "warning"]);
15562
+ taskMutationWarningSchema = z21.object({
15563
+ code: z21.string().min(1),
15564
+ message: z21.string().min(1),
14584
15565
  severity: taskMutationWarningSeveritySchema.optional(),
14585
- taskId: z20.string().min(1).optional(),
14586
- field: z20.string().min(1).optional(),
14587
- index: z20.number().int().nonnegative().optional()
14588
- });
14589
- taskMutationDryRunSummarySchema = z20.object({
14590
- dryRun: z20.literal(true),
14591
- wouldCreate: z20.number().int().nonnegative(),
14592
- wouldUpdate: z20.number().int().nonnegative(),
14593
- wouldDelete: z20.number().int().nonnegative(),
14594
- wouldAffect: z20.number().int().nonnegative(),
14595
- validatedCount: z20.number().int().nonnegative(),
14596
- insertedCount: z20.literal(0),
14597
- updatedCount: z20.literal(0),
14598
- deletedCount: z20.literal(0),
14599
- warnings: z20.array(taskMutationWarningSchema)
14600
- });
14601
- taskMutationTaskRecordSchema = z20.object({ id: z20.string().min(1) }).passthrough();
14602
- taskMutationEnvelopeSchema = z20.object({
14603
- dryRun: z20.boolean().optional(),
14604
- created: z20.array(taskMutationTaskRecordSchema),
14605
- updated: z20.array(taskMutationTaskRecordSchema),
14606
- deleted: z20.array(taskMutationTaskRecordSchema),
14607
- affectedCount: z20.number().int().nonnegative(),
14608
- mutationWarnings: z20.array(taskMutationWarningSchema),
15566
+ taskId: z21.string().min(1).optional(),
15567
+ field: z21.string().min(1).optional(),
15568
+ index: z21.number().int().nonnegative().optional()
15569
+ });
15570
+ taskMutationDryRunSummarySchema = z21.object({
15571
+ dryRun: z21.literal(true),
15572
+ wouldCreate: z21.number().int().nonnegative(),
15573
+ wouldUpdate: z21.number().int().nonnegative(),
15574
+ wouldDelete: z21.number().int().nonnegative(),
15575
+ wouldAffect: z21.number().int().nonnegative(),
15576
+ validatedCount: z21.number().int().nonnegative(),
15577
+ insertedCount: z21.literal(0),
15578
+ updatedCount: z21.literal(0),
15579
+ deletedCount: z21.literal(0),
15580
+ warnings: z21.array(taskMutationWarningSchema)
15581
+ });
15582
+ taskMutationTaskRecordSchema = z21.object({ id: z21.string().min(1) }).passthrough();
15583
+ taskMutationEnvelopeSchema = z21.object({
15584
+ dryRun: z21.boolean().optional(),
15585
+ created: z21.array(taskMutationTaskRecordSchema),
15586
+ updated: z21.array(taskMutationTaskRecordSchema),
15587
+ deleted: z21.array(taskMutationTaskRecordSchema),
15588
+ affectedCount: z21.number().int().nonnegative(),
15589
+ mutationWarnings: z21.array(taskMutationWarningSchema),
14609
15590
  dryRunSummary: taskMutationDryRunSummarySchema.optional()
14610
15591
  });
14611
- completionTaskStatusSchema = z20.enum(TASK_STATUSES);
14612
- completionCriterionKindSchema = z20.enum(["text", "evidence_bound", "child_task"]);
14613
- completionCriterionStatusSchema = z20.enum(["satisfied", "unsatisfied", "waived", "replaced"]);
14614
- completionBlockerReasonSchema = z20.enum([
15592
+ completionTaskStatusSchema = z21.enum(TASK_STATUSES);
15593
+ completionCriterionKindSchema = z21.enum(["text", "evidence_bound", "child_task"]);
15594
+ completionCriterionStatusSchema = z21.enum(["satisfied", "unsatisfied", "waived", "replaced"]);
15595
+ completionBlockerReasonSchema = z21.enum([
14615
15596
  "missing_evidence_binding",
14616
15597
  "child_not_done",
14617
15598
  "child_cancelled_requires_waiver",
@@ -14619,68 +15600,68 @@ var init_tasks2 = __esm({
14619
15600
  "child_missing",
14620
15601
  "done_parent_stale"
14621
15602
  ]);
14622
- completionStaleReasonSchema = z20.enum(["done_parent_has_unsatisfied_criteria"]);
14623
- completionProjectionRepairErrorCodeSchema = z20.enum([
15603
+ completionStaleReasonSchema = z21.enum(["done_parent_has_unsatisfied_criteria"]);
15604
+ completionProjectionRepairErrorCodeSchema = z21.enum([
14624
15605
  "projection_not_stale",
14625
15606
  "criteria_missing",
14626
15607
  "binding_target_missing",
14627
15608
  "repair_conflict"
14628
15609
  ]);
14629
- completionCriterionWaiverSchema = z20.object({
14630
- criterionAcId: z20.string().min(1),
14631
- childTaskId: z20.string().min(1),
14632
- reason: z20.string().min(1),
14633
- actor: z20.string().min(1),
14634
- waivedAt: z20.string().min(1)
14635
- });
14636
- completionCriterionReplacementSchema = z20.object({
14637
- criterionAcId: z20.string().min(1),
14638
- originalChildTaskId: z20.string().min(1),
14639
- replacementChildTaskId: z20.string().min(1),
14640
- reason: z20.string().min(1),
14641
- actor: z20.string().min(1),
14642
- replacedAt: z20.string().min(1)
14643
- });
14644
- completionCriterionEvaluationSchema = z20.object({
14645
- acId: z20.string().min(1),
14646
- alias: z20.string().min(1),
14647
- text: z20.string(),
15610
+ completionCriterionWaiverSchema = z21.object({
15611
+ criterionAcId: z21.string().min(1),
15612
+ childTaskId: z21.string().min(1),
15613
+ reason: z21.string().min(1),
15614
+ actor: z21.string().min(1),
15615
+ waivedAt: z21.string().min(1)
15616
+ });
15617
+ completionCriterionReplacementSchema = z21.object({
15618
+ criterionAcId: z21.string().min(1),
15619
+ originalChildTaskId: z21.string().min(1),
15620
+ replacementChildTaskId: z21.string().min(1),
15621
+ reason: z21.string().min(1),
15622
+ actor: z21.string().min(1),
15623
+ replacedAt: z21.string().min(1)
15624
+ });
15625
+ completionCriterionEvaluationSchema = z21.object({
15626
+ acId: z21.string().min(1),
15627
+ alias: z21.string().min(1),
15628
+ text: z21.string(),
14648
15629
  kind: completionCriterionKindSchema,
14649
15630
  status: completionCriterionStatusSchema,
14650
15631
  reason: completionBlockerReasonSchema.optional(),
14651
- targetTaskId: z20.string().min(1).optional(),
15632
+ targetTaskId: z21.string().min(1).optional(),
14652
15633
  targetTaskStatus: completionTaskStatusSchema.optional(),
14653
15634
  waiver: completionCriterionWaiverSchema.optional(),
14654
15635
  replacement: completionCriterionReplacementSchema.optional(),
14655
15636
  replacementTaskStatus: completionTaskStatusSchema.optional(),
14656
- evidenceBindings: z20.number().int().nonnegative()
15637
+ evidenceBindings: z21.number().int().nonnegative()
14657
15638
  });
14658
15639
  unsatisfiedCompletionCriterionSchema = completionCriterionEvaluationSchema.extend({
14659
- status: z20.literal("unsatisfied"),
15640
+ status: z21.literal("unsatisfied"),
14660
15641
  reason: completionBlockerReasonSchema
14661
15642
  });
14662
- completionTotalsSchema = z20.object({
14663
- criteria: z20.number().int().nonnegative(),
14664
- satisfied: z20.number().int().nonnegative(),
14665
- unsatisfied: z20.number().int().nonnegative(),
14666
- waived: z20.number().int().nonnegative(),
14667
- replaced: z20.number().int().nonnegative()
14668
- });
14669
- completionContextPackSchema = z20.object({
14670
- taskId: z20.string().min(1),
14671
- generatedAt: z20.string().min(1),
14672
- source: z20.literal("audit_log"),
14673
- window: z20.object({
14674
- limit: z20.number().int().positive(),
14675
- since: z20.string().min(1).optional(),
14676
- relationDepth: z20.number().int().nonnegative(),
14677
- relatedTaskIds: z20.array(z20.string().min(1))
15643
+ completionTotalsSchema = z21.object({
15644
+ criteria: z21.number().int().nonnegative(),
15645
+ satisfied: z21.number().int().nonnegative(),
15646
+ unsatisfied: z21.number().int().nonnegative(),
15647
+ waived: z21.number().int().nonnegative(),
15648
+ replaced: z21.number().int().nonnegative()
15649
+ });
15650
+ completionContextPackSchema = z21.object({
15651
+ taskId: z21.string().min(1),
15652
+ generatedAt: z21.string().min(1),
15653
+ source: z21.literal("audit_log"),
15654
+ window: z21.object({
15655
+ limit: z21.number().int().positive(),
15656
+ since: z21.string().min(1).optional(),
15657
+ relationDepth: z21.number().int().nonnegative(),
15658
+ relatedTaskIds: z21.array(z21.string().min(1))
14678
15659
  }),
14679
- events: z20.array(
14680
- z20.object({
14681
- id: z20.string().min(1),
14682
- timestamp: z20.string().min(1),
14683
- action: z20.enum([
15660
+ events: z21.array(
15661
+ z21.object({
15662
+ id: z21.string().min(1),
15663
+ timestamp: z21.string().min(1),
15664
+ action: z21.enum([
14684
15665
  "task_completed",
14685
15666
  "task_reopened",
14686
15667
  "task_cancelled",
@@ -14688,77 +15669,77 @@ var init_tasks2 = __esm({
14688
15669
  "task_reparented",
14689
15670
  "ac_projection_rebuilt"
14690
15671
  ]),
14691
- taskId: z20.string().min(1),
14692
- relation: z20.enum(["self", "parent", "child", "sibling", "related"]),
14693
- actor: z20.string().min(1),
14694
- details: z20.record(z20.string(), z20.unknown()).optional(),
14695
- before: z20.record(z20.string(), z20.unknown()).optional(),
14696
- after: z20.record(z20.string(), z20.unknown()).optional()
15672
+ taskId: z21.string().min(1),
15673
+ relation: z21.enum(["self", "parent", "child", "sibling", "related"]),
15674
+ actor: z21.string().min(1),
15675
+ details: z21.record(z21.string(), z21.unknown()).optional(),
15676
+ before: z21.record(z21.string(), z21.unknown()).optional(),
15677
+ after: z21.record(z21.string(), z21.unknown()).optional()
14697
15678
  })
14698
15679
  ),
14699
- summary: z20.object({
14700
- totalEvents: z20.number().int().nonnegative(),
14701
- byAction: z20.record(z20.string(), z20.number().int().nonnegative()),
14702
- byRelation: z20.record(z20.string(), z20.number().int().nonnegative()),
14703
- latestEventAt: z20.string().nullable()
15680
+ summary: z21.object({
15681
+ totalEvents: z21.number().int().nonnegative(),
15682
+ byAction: z21.record(z21.string(), z21.number().int().nonnegative()),
15683
+ byRelation: z21.record(z21.string(), z21.number().int().nonnegative()),
15684
+ latestEventAt: z21.string().nullable()
14704
15685
  })
14705
15686
  });
14706
- completionEvaluationSchema = z20.object({
14707
- taskId: z20.string().min(1),
15687
+ completionEvaluationSchema = z21.object({
15688
+ taskId: z21.string().min(1),
14708
15689
  taskStatus: completionTaskStatusSchema,
14709
- ready: z20.boolean(),
14710
- stale: z20.boolean(),
14711
- staleReasons: z20.array(completionStaleReasonSchema),
15690
+ ready: z21.boolean(),
15691
+ stale: z21.boolean(),
15692
+ staleReasons: z21.array(completionStaleReasonSchema),
14712
15693
  contextPack: completionContextPackSchema.optional(),
14713
- satisfied: z20.array(completionCriterionEvaluationSchema),
14714
- unsatisfied: z20.array(unsatisfiedCompletionCriterionSchema),
14715
- waived: z20.array(completionCriterionEvaluationSchema),
14716
- replaced: z20.array(completionCriterionEvaluationSchema),
15694
+ satisfied: z21.array(completionCriterionEvaluationSchema),
15695
+ unsatisfied: z21.array(unsatisfiedCompletionCriterionSchema),
15696
+ waived: z21.array(completionCriterionEvaluationSchema),
15697
+ replaced: z21.array(completionCriterionEvaluationSchema),
14717
15698
  totals: completionTotalsSchema
14718
15699
  });
14719
- completionExplanationSchema = z20.object({
14720
- taskId: z20.string().min(1),
14721
- ready: z20.boolean(),
14722
- stale: z20.boolean(),
14723
- summary: z20.string(),
15700
+ completionExplanationSchema = z21.object({
15701
+ taskId: z21.string().min(1),
15702
+ ready: z21.boolean(),
15703
+ stale: z21.boolean(),
15704
+ summary: z21.string(),
14724
15705
  contextPack: completionContextPackSchema.optional(),
14725
- blockers: z20.array(completionCriterionEvaluationSchema)
15706
+ blockers: z21.array(completionCriterionEvaluationSchema)
14726
15707
  });
14727
- completionListParamsSchema = z20.object({
14728
- taskId: z20.string().min(1),
15708
+ completionListParamsSchema = z21.object({
15709
+ taskId: z21.string().min(1),
14729
15710
  status: completionCriterionStatusSchema.optional(),
14730
15711
  kind: completionCriterionKindSchema.optional()
14731
15712
  });
14732
- completionListResultSchema = z20.object({
14733
- taskId: z20.string().min(1),
14734
- criteria: z20.array(completionCriterionEvaluationSchema),
15713
+ completionListResultSchema = z21.object({
15714
+ taskId: z21.string().min(1),
15715
+ criteria: z21.array(completionCriterionEvaluationSchema),
14735
15716
  totals: completionTotalsSchema
14736
15717
  });
14737
- completionEvaluateParamsSchema = z20.object({
14738
- taskId: z20.string().min(1),
14739
- includeContext: z20.boolean().optional(),
14740
- limit: z20.number().int().positive().optional(),
14741
- since: z20.string().min(1).optional(),
14742
- relationDepth: z20.number().int().nonnegative().optional()
15718
+ completionEvaluateParamsSchema = z21.object({
15719
+ taskId: z21.string().min(1),
15720
+ includeContext: z21.boolean().optional(),
15721
+ limit: z21.number().int().positive().optional(),
15722
+ since: z21.string().min(1).optional(),
15723
+ relationDepth: z21.number().int().nonnegative().optional()
14743
15724
  });
14744
- completionProjectionRepairErrorSchema = z20.object({
15725
+ completionProjectionRepairErrorSchema = z21.object({
14745
15726
  code: completionProjectionRepairErrorCodeSchema,
14746
- message: z20.string().min(1),
14747
- taskId: z20.string().min(1),
14748
- acId: z20.string().min(1).optional(),
14749
- evidenceAtomId: z20.string().min(1).optional()
15727
+ message: z21.string().min(1),
15728
+ taskId: z21.string().min(1),
15729
+ acId: z21.string().min(1).optional(),
15730
+ evidenceAtomId: z21.string().min(1).optional()
14750
15731
  });
14751
- completionProjectionRepairParamsSchema = z20.object({
14752
- taskId: z20.string().min(1),
14753
- dryRun: z20.boolean().optional()
15732
+ completionProjectionRepairParamsSchema = z21.object({
15733
+ taskId: z21.string().min(1),
15734
+ dryRun: z21.boolean().optional()
14754
15735
  });
14755
- completionProjectionRepairResultSchema = z20.object({
14756
- taskId: z20.string().min(1),
14757
- repaired: z20.boolean(),
14758
- dryRun: z20.boolean(),
14759
- staleBefore: z20.boolean(),
14760
- staleAfter: z20.boolean(),
14761
- errors: z20.array(completionProjectionRepairErrorSchema)
15736
+ completionProjectionRepairResultSchema = z21.object({
15737
+ taskId: z21.string().min(1),
15738
+ repaired: z21.boolean(),
15739
+ dryRun: z21.boolean(),
15740
+ staleBefore: z21.boolean(),
15741
+ staleAfter: z21.boolean(),
15742
+ errors: z21.array(completionProjectionRepairErrorSchema)
14762
15743
  });
14763
15744
  }
14764
15745
  });
@@ -15269,7 +16250,7 @@ var init_taxonomy = __esm({
15269
16250
  });
15270
16251
 
15271
16252
  // packages/contracts/src/templates/manifest.ts
15272
- import { z as z21 } from "zod";
16253
+ import { z as z22 } from "zod";
15273
16254
  var TEMPLATE_KINDS, TEMPLATE_SUBSTITUTIONS, TEMPLATE_UPDATE_STRATEGIES, PLACEHOLDER_SOURCES, PlaceholderSpecSchema, TemplateManifestEntrySchema;
15274
16255
  var init_manifest2 = __esm({
15275
16256
  "packages/contracts/src/templates/manifest.ts"() {
@@ -15290,85 +16271,85 @@ var init_manifest2 = __esm({
15290
16271
  "tool-resolver",
15291
16272
  "literal"
15292
16273
  ];
15293
- PlaceholderSpecSchema = z21.object({
16274
+ PlaceholderSpecSchema = z22.object({
15294
16275
  /**
15295
16276
  * Placeholder identifier as it appears in the template body
15296
16277
  * (e.g. `NODE_VERSION` matches `{{NODE_VERSION}}`).
15297
16278
  */
15298
- name: z21.string().min(1, "placeholder name must be non-empty"),
16279
+ name: z22.string().min(1, "placeholder name must be non-empty"),
15299
16280
  /** Resolver source the installer consults for this placeholder. */
15300
- source: z21.enum(PLACEHOLDER_SOURCES),
16281
+ source: z22.enum(PLACEHOLDER_SOURCES),
15301
16282
  /**
15302
16283
  * Path expression evaluated against `source` (e.g. `engines.node` against
15303
16284
  * `project-context`, `defaults.branchModel` against `.cleo/config`).
15304
16285
  * For `literal` source, this MAY be the literal value's identifier.
15305
16286
  */
15306
- sourcePath: z21.string().min(1, "placeholder sourcePath must be non-empty"),
16287
+ sourcePath: z22.string().min(1, "placeholder sourcePath must be non-empty"),
15307
16288
  /**
15308
16289
  * Fallback value used when `source[sourcePath]` resolves to `undefined`.
15309
16290
  * `null` is permitted to explicitly mark "no default — failure required".
15310
16291
  */
15311
- defaultValue: z21.union([z21.string(), z21.number(), z21.boolean(), z21.null()]).optional()
16292
+ defaultValue: z22.union([z22.string(), z22.number(), z22.boolean(), z22.null()]).optional()
15312
16293
  });
15313
- TemplateManifestEntrySchema = z21.object({
16294
+ TemplateManifestEntrySchema = z22.object({
15314
16295
  /** Stable identifier for this template entry. */
15315
- id: z21.string().min(1, "id must be non-empty"),
16296
+ id: z22.string().min(1, "id must be non-empty"),
15316
16297
  /** Category of file this template represents. */
15317
- kind: z21.enum(TEMPLATE_KINDS),
16298
+ kind: z22.enum(TEMPLATE_KINDS),
15318
16299
  /** Repo-relative path of the template source file. */
15319
- sourcePath: z21.string().min(1, "sourcePath must be non-empty"),
16300
+ sourcePath: z22.string().min(1, "sourcePath must be non-empty"),
15320
16301
  /** Project-relative path where the rendered template installs. */
15321
- installPath: z21.string().min(1, "installPath must be non-empty"),
16302
+ installPath: z22.string().min(1, "installPath must be non-empty"),
15322
16303
  /** Substitution strategy the installer applies to `sourcePath`. */
15323
- substitution: z21.enum(TEMPLATE_SUBSTITUTIONS),
16304
+ substitution: z22.enum(TEMPLATE_SUBSTITUTIONS),
15324
16305
  /** Declared placeholders this template requires. May be empty. */
15325
- placeholders: z21.array(PlaceholderSpecSchema),
16306
+ placeholders: z22.array(PlaceholderSpecSchema),
15326
16307
  /** Reconciliation policy on upgrade. */
15327
- updateStrategy: z21.enum(TEMPLATE_UPDATE_STRATEGIES)
16308
+ updateStrategy: z22.enum(TEMPLATE_UPDATE_STRATEGIES)
15328
16309
  });
15329
16310
  }
15330
16311
  });
15331
16312
 
15332
16313
  // packages/contracts/src/validator/index.ts
15333
- import { z as z22 } from "zod";
16314
+ import { z as z23 } from "zod";
15334
16315
  var VALIDATOR_ID_REGEX, validatorFindingSchema, validatorAttestationSchema, validatorRejectionSchema, validatorVerdictSchema;
15335
16316
  var init_validator = __esm({
15336
16317
  "packages/contracts/src/validator/index.ts"() {
15337
16318
  "use strict";
15338
16319
  VALIDATOR_ID_REGEX = /^validator-[a-z0-9][a-z0-9-]*$/;
15339
- validatorFindingSchema = z22.object({
15340
- acId: z22.string().min(1, "acId must be non-empty"),
15341
- status: z22.enum(["pass", "fail", "inconclusive"]),
15342
- reasoning: z22.string().min(1, "reasoning must be non-empty"),
15343
- evidenceRefs: z22.array(z22.string()).optional(),
15344
- checkedAt: z22.string().min(1, "checkedAt must be a non-empty ISO-8601 string")
15345
- });
15346
- validatorAttestationSchema = z22.object({
15347
- verdict: z22.literal("attest"),
15348
- taskId: z22.string().min(1),
15349
- validatorId: z22.string().regex(VALIDATOR_ID_REGEX, "validatorId must match the pattern validator-<discriminator>"),
15350
- findings: z22.array(validatorFindingSchema).min(1, "attestation must contain at least one finding").refine(
16320
+ validatorFindingSchema = z23.object({
16321
+ acId: z23.string().min(1, "acId must be non-empty"),
16322
+ status: z23.enum(["pass", "fail", "inconclusive"]),
16323
+ reasoning: z23.string().min(1, "reasoning must be non-empty"),
16324
+ evidenceRefs: z23.array(z23.string()).optional(),
16325
+ checkedAt: z23.string().min(1, "checkedAt must be a non-empty ISO-8601 string")
16326
+ });
16327
+ validatorAttestationSchema = z23.object({
16328
+ verdict: z23.literal("attest"),
16329
+ taskId: z23.string().min(1),
16330
+ validatorId: z23.string().regex(VALIDATOR_ID_REGEX, "validatorId must match the pattern validator-<discriminator>"),
16331
+ findings: z23.array(validatorFindingSchema).min(1, "attestation must contain at least one finding").refine(
15351
16332
  (findings) => findings.every((f) => f.status === "pass"),
15352
16333
  'attestation requires every finding to have status="pass"'
15353
16334
  ),
15354
- summary: z22.string().optional(),
15355
- attestedAt: z22.string().min(1),
15356
- schemaVersion: z22.literal("1")
15357
- });
15358
- validatorRejectionSchema = z22.object({
15359
- verdict: z22.literal("reject"),
15360
- taskId: z22.string().min(1),
15361
- validatorId: z22.string().regex(VALIDATOR_ID_REGEX, "validatorId must match the pattern validator-<discriminator>"),
15362
- findings: z22.array(validatorFindingSchema).min(1, "rejection must contain at least one finding").refine(
16335
+ summary: z23.string().optional(),
16336
+ attestedAt: z23.string().min(1),
16337
+ schemaVersion: z23.literal("1")
16338
+ });
16339
+ validatorRejectionSchema = z23.object({
16340
+ verdict: z23.literal("reject"),
16341
+ taskId: z23.string().min(1),
16342
+ validatorId: z23.string().regex(VALIDATOR_ID_REGEX, "validatorId must match the pattern validator-<discriminator>"),
16343
+ findings: z23.array(validatorFindingSchema).min(1, "rejection must contain at least one finding").refine(
15363
16344
  (findings) => findings.some((f) => f.status !== "pass"),
15364
16345
  'rejection requires at least one finding with status "fail" or "inconclusive"'
15365
16346
  ),
15366
- summary: z22.string().min(1, "rejection summary must be non-empty"),
15367
- remediationHints: z22.array(z22.string()).optional(),
15368
- rejectedAt: z22.string().min(1),
15369
- schemaVersion: z22.literal("1")
16347
+ summary: z23.string().min(1, "rejection summary must be non-empty"),
16348
+ remediationHints: z23.array(z23.string()).optional(),
16349
+ rejectedAt: z23.string().min(1),
16350
+ schemaVersion: z23.literal("1")
15370
16351
  });
15371
- validatorVerdictSchema = z22.discriminatedUnion("verdict", [
16352
+ validatorVerdictSchema = z23.discriminatedUnion("verdict", [
15372
16353
  validatorAttestationSchema,
15373
16354
  validatorRejectionSchema
15374
16355
  ]);
@@ -30234,7 +31215,7 @@ function resolveRef(ref, ctx) {
30234
31215
  function convertBaseSchema(schema, ctx) {
30235
31216
  if (schema.not !== void 0) {
30236
31217
  if (typeof schema.not === "object" && Object.keys(schema.not).length === 0) {
30237
- return z23.never();
31218
+ return z24.never();
30238
31219
  }
30239
31220
  throw new Error("not is not supported in Zod (except { not: {} } for never)");
30240
31221
  }
@@ -30256,7 +31237,7 @@ function convertBaseSchema(schema, ctx) {
30256
31237
  return ctx.refs.get(refPath);
30257
31238
  }
30258
31239
  if (ctx.processing.has(refPath)) {
30259
- return z23.lazy(() => {
31240
+ return z24.lazy(() => {
30260
31241
  if (!ctx.refs.has(refPath)) {
30261
31242
  throw new Error(`Circular reference not resolved: ${refPath}`);
30262
31243
  }
@@ -30273,25 +31254,25 @@ function convertBaseSchema(schema, ctx) {
30273
31254
  if (schema.enum !== void 0) {
30274
31255
  const enumValues = schema.enum;
30275
31256
  if (ctx.version === "openapi-3.0" && schema.nullable === true && enumValues.length === 1 && enumValues[0] === null) {
30276
- return z23.null();
31257
+ return z24.null();
30277
31258
  }
30278
31259
  if (enumValues.length === 0) {
30279
- return z23.never();
31260
+ return z24.never();
30280
31261
  }
30281
31262
  if (enumValues.length === 1) {
30282
- return z23.literal(enumValues[0]);
31263
+ return z24.literal(enumValues[0]);
30283
31264
  }
30284
31265
  if (enumValues.every((v) => typeof v === "string")) {
30285
- return z23.enum(enumValues);
31266
+ return z24.enum(enumValues);
30286
31267
  }
30287
- const literalSchemas = enumValues.map((v) => z23.literal(v));
31268
+ const literalSchemas = enumValues.map((v) => z24.literal(v));
30288
31269
  if (literalSchemas.length < 2) {
30289
31270
  return literalSchemas[0];
30290
31271
  }
30291
- return z23.union([literalSchemas[0], literalSchemas[1], ...literalSchemas.slice(2)]);
31272
+ return z24.union([literalSchemas[0], literalSchemas[1], ...literalSchemas.slice(2)]);
30292
31273
  }
30293
31274
  if (schema.const !== void 0) {
30294
- return z23.literal(schema.const);
31275
+ return z24.literal(schema.const);
30295
31276
  }
30296
31277
  const type = schema.type;
30297
31278
  if (Array.isArray(type)) {
@@ -30300,68 +31281,68 @@ function convertBaseSchema(schema, ctx) {
30300
31281
  return convertBaseSchema(typeSchema, ctx);
30301
31282
  });
30302
31283
  if (typeSchemas.length === 0) {
30303
- return z23.never();
31284
+ return z24.never();
30304
31285
  }
30305
31286
  if (typeSchemas.length === 1) {
30306
31287
  return typeSchemas[0];
30307
31288
  }
30308
- return z23.union(typeSchemas);
31289
+ return z24.union(typeSchemas);
30309
31290
  }
30310
31291
  if (!type) {
30311
- return z23.any();
31292
+ return z24.any();
30312
31293
  }
30313
31294
  let zodSchema2;
30314
31295
  switch (type) {
30315
31296
  case "string": {
30316
- let stringSchema = z23.string();
31297
+ let stringSchema = z24.string();
30317
31298
  if (schema.format) {
30318
31299
  const format = schema.format;
30319
31300
  if (format === "email") {
30320
- stringSchema = stringSchema.check(z23.email());
31301
+ stringSchema = stringSchema.check(z24.email());
30321
31302
  } else if (format === "uri" || format === "uri-reference") {
30322
- stringSchema = stringSchema.check(z23.url());
31303
+ stringSchema = stringSchema.check(z24.url());
30323
31304
  } else if (format === "uuid" || format === "guid") {
30324
- stringSchema = stringSchema.check(z23.uuid());
31305
+ stringSchema = stringSchema.check(z24.uuid());
30325
31306
  } else if (format === "date-time") {
30326
- stringSchema = stringSchema.check(z23.iso.datetime());
31307
+ stringSchema = stringSchema.check(z24.iso.datetime());
30327
31308
  } else if (format === "date") {
30328
- stringSchema = stringSchema.check(z23.iso.date());
31309
+ stringSchema = stringSchema.check(z24.iso.date());
30329
31310
  } else if (format === "time") {
30330
- stringSchema = stringSchema.check(z23.iso.time());
31311
+ stringSchema = stringSchema.check(z24.iso.time());
30331
31312
  } else if (format === "duration") {
30332
- stringSchema = stringSchema.check(z23.iso.duration());
31313
+ stringSchema = stringSchema.check(z24.iso.duration());
30333
31314
  } else if (format === "ipv4") {
30334
- stringSchema = stringSchema.check(z23.ipv4());
31315
+ stringSchema = stringSchema.check(z24.ipv4());
30335
31316
  } else if (format === "ipv6") {
30336
- stringSchema = stringSchema.check(z23.ipv6());
31317
+ stringSchema = stringSchema.check(z24.ipv6());
30337
31318
  } else if (format === "mac") {
30338
- stringSchema = stringSchema.check(z23.mac());
31319
+ stringSchema = stringSchema.check(z24.mac());
30339
31320
  } else if (format === "cidr") {
30340
- stringSchema = stringSchema.check(z23.cidrv4());
31321
+ stringSchema = stringSchema.check(z24.cidrv4());
30341
31322
  } else if (format === "cidr-v6") {
30342
- stringSchema = stringSchema.check(z23.cidrv6());
31323
+ stringSchema = stringSchema.check(z24.cidrv6());
30343
31324
  } else if (format === "base64") {
30344
- stringSchema = stringSchema.check(z23.base64());
31325
+ stringSchema = stringSchema.check(z24.base64());
30345
31326
  } else if (format === "base64url") {
30346
- stringSchema = stringSchema.check(z23.base64url());
31327
+ stringSchema = stringSchema.check(z24.base64url());
30347
31328
  } else if (format === "e164") {
30348
- stringSchema = stringSchema.check(z23.e164());
31329
+ stringSchema = stringSchema.check(z24.e164());
30349
31330
  } else if (format === "jwt") {
30350
- stringSchema = stringSchema.check(z23.jwt());
31331
+ stringSchema = stringSchema.check(z24.jwt());
30351
31332
  } else if (format === "emoji") {
30352
- stringSchema = stringSchema.check(z23.emoji());
31333
+ stringSchema = stringSchema.check(z24.emoji());
30353
31334
  } else if (format === "nanoid") {
30354
- stringSchema = stringSchema.check(z23.nanoid());
31335
+ stringSchema = stringSchema.check(z24.nanoid());
30355
31336
  } else if (format === "cuid") {
30356
- stringSchema = stringSchema.check(z23.cuid());
31337
+ stringSchema = stringSchema.check(z24.cuid());
30357
31338
  } else if (format === "cuid2") {
30358
- stringSchema = stringSchema.check(z23.cuid2());
31339
+ stringSchema = stringSchema.check(z24.cuid2());
30359
31340
  } else if (format === "ulid") {
30360
- stringSchema = stringSchema.check(z23.ulid());
31341
+ stringSchema = stringSchema.check(z24.ulid());
30361
31342
  } else if (format === "xid") {
30362
- stringSchema = stringSchema.check(z23.xid());
31343
+ stringSchema = stringSchema.check(z24.xid());
30363
31344
  } else if (format === "ksuid") {
30364
- stringSchema = stringSchema.check(z23.ksuid());
31345
+ stringSchema = stringSchema.check(z24.ksuid());
30365
31346
  }
30366
31347
  }
30367
31348
  if (typeof schema.minLength === "number") {
@@ -30378,7 +31359,7 @@ function convertBaseSchema(schema, ctx) {
30378
31359
  }
30379
31360
  case "number":
30380
31361
  case "integer": {
30381
- let numberSchema = type === "integer" ? z23.number().int() : z23.number();
31362
+ let numberSchema = type === "integer" ? z24.number().int() : z24.number();
30382
31363
  if (typeof schema.minimum === "number") {
30383
31364
  numberSchema = numberSchema.min(schema.minimum);
30384
31365
  }
@@ -30402,11 +31383,11 @@ function convertBaseSchema(schema, ctx) {
30402
31383
  break;
30403
31384
  }
30404
31385
  case "boolean": {
30405
- zodSchema2 = z23.boolean();
31386
+ zodSchema2 = z24.boolean();
30406
31387
  break;
30407
31388
  }
30408
31389
  case "null": {
30409
- zodSchema2 = z23.null();
31390
+ zodSchema2 = z24.null();
30410
31391
  break;
30411
31392
  }
30412
31393
  case "object": {
@@ -30419,14 +31400,14 @@ function convertBaseSchema(schema, ctx) {
30419
31400
  }
30420
31401
  if (schema.propertyNames) {
30421
31402
  const keySchema = convertSchema(schema.propertyNames, ctx);
30422
- const valueSchema = schema.additionalProperties && typeof schema.additionalProperties === "object" ? convertSchema(schema.additionalProperties, ctx) : z23.any();
31403
+ const valueSchema = schema.additionalProperties && typeof schema.additionalProperties === "object" ? convertSchema(schema.additionalProperties, ctx) : z24.any();
30423
31404
  if (Object.keys(shape).length === 0) {
30424
- zodSchema2 = z23.record(keySchema, valueSchema);
31405
+ zodSchema2 = z24.record(keySchema, valueSchema);
30425
31406
  break;
30426
31407
  }
30427
- const objectSchema2 = z23.object(shape).passthrough();
30428
- const recordSchema = z23.looseRecord(keySchema, valueSchema);
30429
- zodSchema2 = z23.intersection(objectSchema2, recordSchema);
31408
+ const objectSchema2 = z24.object(shape).passthrough();
31409
+ const recordSchema = z24.looseRecord(keySchema, valueSchema);
31410
+ zodSchema2 = z24.intersection(objectSchema2, recordSchema);
30430
31411
  break;
30431
31412
  }
30432
31413
  if (schema.patternProperties) {
@@ -30435,28 +31416,28 @@ function convertBaseSchema(schema, ctx) {
30435
31416
  const looseRecords = [];
30436
31417
  for (const pattern of patternKeys) {
30437
31418
  const patternValue = convertSchema(patternProps[pattern], ctx);
30438
- const keySchema = z23.string().regex(new RegExp(pattern));
30439
- looseRecords.push(z23.looseRecord(keySchema, patternValue));
31419
+ const keySchema = z24.string().regex(new RegExp(pattern));
31420
+ looseRecords.push(z24.looseRecord(keySchema, patternValue));
30440
31421
  }
30441
31422
  const schemasToIntersect = [];
30442
31423
  if (Object.keys(shape).length > 0) {
30443
- schemasToIntersect.push(z23.object(shape).passthrough());
31424
+ schemasToIntersect.push(z24.object(shape).passthrough());
30444
31425
  }
30445
31426
  schemasToIntersect.push(...looseRecords);
30446
31427
  if (schemasToIntersect.length === 0) {
30447
- zodSchema2 = z23.object({}).passthrough();
31428
+ zodSchema2 = z24.object({}).passthrough();
30448
31429
  } else if (schemasToIntersect.length === 1) {
30449
31430
  zodSchema2 = schemasToIntersect[0];
30450
31431
  } else {
30451
- let result = z23.intersection(schemasToIntersect[0], schemasToIntersect[1]);
31432
+ let result = z24.intersection(schemasToIntersect[0], schemasToIntersect[1]);
30452
31433
  for (let i = 2; i < schemasToIntersect.length; i++) {
30453
- result = z23.intersection(result, schemasToIntersect[i]);
31434
+ result = z24.intersection(result, schemasToIntersect[i]);
30454
31435
  }
30455
31436
  zodSchema2 = result;
30456
31437
  }
30457
31438
  break;
30458
31439
  }
30459
- const objectSchema = z23.object(shape);
31440
+ const objectSchema = z24.object(shape);
30460
31441
  if (schema.additionalProperties === false) {
30461
31442
  zodSchema2 = objectSchema.strict();
30462
31443
  } else if (typeof schema.additionalProperties === "object") {
@@ -30473,33 +31454,33 @@ function convertBaseSchema(schema, ctx) {
30473
31454
  const tupleItems = prefixItems.map((item) => convertSchema(item, ctx));
30474
31455
  const rest = items && typeof items === "object" && !Array.isArray(items) ? convertSchema(items, ctx) : void 0;
30475
31456
  if (rest) {
30476
- zodSchema2 = z23.tuple(tupleItems).rest(rest);
31457
+ zodSchema2 = z24.tuple(tupleItems).rest(rest);
30477
31458
  } else {
30478
- zodSchema2 = z23.tuple(tupleItems);
31459
+ zodSchema2 = z24.tuple(tupleItems);
30479
31460
  }
30480
31461
  if (typeof schema.minItems === "number") {
30481
- zodSchema2 = zodSchema2.check(z23.minLength(schema.minItems));
31462
+ zodSchema2 = zodSchema2.check(z24.minLength(schema.minItems));
30482
31463
  }
30483
31464
  if (typeof schema.maxItems === "number") {
30484
- zodSchema2 = zodSchema2.check(z23.maxLength(schema.maxItems));
31465
+ zodSchema2 = zodSchema2.check(z24.maxLength(schema.maxItems));
30485
31466
  }
30486
31467
  } else if (Array.isArray(items)) {
30487
31468
  const tupleItems = items.map((item) => convertSchema(item, ctx));
30488
31469
  const rest = schema.additionalItems && typeof schema.additionalItems === "object" ? convertSchema(schema.additionalItems, ctx) : void 0;
30489
31470
  if (rest) {
30490
- zodSchema2 = z23.tuple(tupleItems).rest(rest);
31471
+ zodSchema2 = z24.tuple(tupleItems).rest(rest);
30491
31472
  } else {
30492
- zodSchema2 = z23.tuple(tupleItems);
31473
+ zodSchema2 = z24.tuple(tupleItems);
30493
31474
  }
30494
31475
  if (typeof schema.minItems === "number") {
30495
- zodSchema2 = zodSchema2.check(z23.minLength(schema.minItems));
31476
+ zodSchema2 = zodSchema2.check(z24.minLength(schema.minItems));
30496
31477
  }
30497
31478
  if (typeof schema.maxItems === "number") {
30498
- zodSchema2 = zodSchema2.check(z23.maxLength(schema.maxItems));
31479
+ zodSchema2 = zodSchema2.check(z24.maxLength(schema.maxItems));
30499
31480
  }
30500
31481
  } else if (items !== void 0) {
30501
31482
  const element = convertSchema(items, ctx);
30502
- let arraySchema = z23.array(element);
31483
+ let arraySchema = z24.array(element);
30503
31484
  if (typeof schema.minItems === "number") {
30504
31485
  arraySchema = arraySchema.min(schema.minItems);
30505
31486
  }
@@ -30508,7 +31489,7 @@ function convertBaseSchema(schema, ctx) {
30508
31489
  }
30509
31490
  zodSchema2 = arraySchema;
30510
31491
  } else {
30511
- zodSchema2 = z23.array(z23.any());
31492
+ zodSchema2 = z24.array(z24.any());
30512
31493
  }
30513
31494
  break;
30514
31495
  }
@@ -30525,37 +31506,37 @@ function convertBaseSchema(schema, ctx) {
30525
31506
  }
30526
31507
  function convertSchema(schema, ctx) {
30527
31508
  if (typeof schema === "boolean") {
30528
- return schema ? z23.any() : z23.never();
31509
+ return schema ? z24.any() : z24.never();
30529
31510
  }
30530
31511
  let baseSchema = convertBaseSchema(schema, ctx);
30531
31512
  const hasExplicitType = schema.type || schema.enum !== void 0 || schema.const !== void 0;
30532
31513
  if (schema.anyOf && Array.isArray(schema.anyOf)) {
30533
31514
  const options = schema.anyOf.map((s) => convertSchema(s, ctx));
30534
- const anyOfUnion = z23.union(options);
30535
- baseSchema = hasExplicitType ? z23.intersection(baseSchema, anyOfUnion) : anyOfUnion;
31515
+ const anyOfUnion = z24.union(options);
31516
+ baseSchema = hasExplicitType ? z24.intersection(baseSchema, anyOfUnion) : anyOfUnion;
30536
31517
  }
30537
31518
  if (schema.oneOf && Array.isArray(schema.oneOf)) {
30538
31519
  const options = schema.oneOf.map((s) => convertSchema(s, ctx));
30539
- const oneOfUnion = z23.xor(options);
30540
- baseSchema = hasExplicitType ? z23.intersection(baseSchema, oneOfUnion) : oneOfUnion;
31520
+ const oneOfUnion = z24.xor(options);
31521
+ baseSchema = hasExplicitType ? z24.intersection(baseSchema, oneOfUnion) : oneOfUnion;
30541
31522
  }
30542
31523
  if (schema.allOf && Array.isArray(schema.allOf)) {
30543
31524
  if (schema.allOf.length === 0) {
30544
- baseSchema = hasExplicitType ? baseSchema : z23.any();
31525
+ baseSchema = hasExplicitType ? baseSchema : z24.any();
30545
31526
  } else {
30546
31527
  let result = hasExplicitType ? baseSchema : convertSchema(schema.allOf[0], ctx);
30547
31528
  const startIdx = hasExplicitType ? 0 : 1;
30548
31529
  for (let i = startIdx; i < schema.allOf.length; i++) {
30549
- result = z23.intersection(result, convertSchema(schema.allOf[i], ctx));
31530
+ result = z24.intersection(result, convertSchema(schema.allOf[i], ctx));
30550
31531
  }
30551
31532
  baseSchema = result;
30552
31533
  }
30553
31534
  }
30554
31535
  if (schema.nullable === true && ctx.version === "openapi-3.0") {
30555
- baseSchema = z23.nullable(baseSchema);
31536
+ baseSchema = z24.nullable(baseSchema);
30556
31537
  }
30557
31538
  if (schema.readOnly === true) {
30558
- baseSchema = z23.readonly(baseSchema);
31539
+ baseSchema = z24.readonly(baseSchema);
30559
31540
  }
30560
31541
  const extraMeta = {};
30561
31542
  const coreMetadataKeys = ["$id", "id", "$comment", "$anchor", "$vocabulary", "$dynamicRef", "$dynamicAnchor"];
@@ -30582,7 +31563,7 @@ function convertSchema(schema, ctx) {
30582
31563
  }
30583
31564
  function fromJSONSchema(schema, params) {
30584
31565
  if (typeof schema === "boolean") {
30585
- return schema ? z23.any() : z23.never();
31566
+ return schema ? z24.any() : z24.never();
30586
31567
  }
30587
31568
  const version2 = detectVersion(schema, params?.defaultTarget);
30588
31569
  const defs = schema.$defs || schema.definitions || {};
@@ -30596,14 +31577,14 @@ function fromJSONSchema(schema, params) {
30596
31577
  };
30597
31578
  return convertSchema(schema, ctx);
30598
31579
  }
30599
- var z23, RECOGNIZED_KEYS;
31580
+ var z24, RECOGNIZED_KEYS;
30600
31581
  var init_from_json_schema = __esm({
30601
31582
  "node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/from-json-schema.js"() {
30602
31583
  init_registries();
30603
31584
  init_checks2();
30604
31585
  init_iso();
30605
31586
  init_schemas2();
30606
- z23 = {
31587
+ z24 = {
30607
31588
  ...schemas_exports2,
30608
31589
  ...checks_exports2,
30609
31590
  iso: iso_exports