@cleocode/core 2026.6.7 → 2026.6.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/dist/db/index.d.ts +5 -1
  2. package/dist/db/index.d.ts.map +1 -1
  3. package/dist/db/index.js +5 -1
  4. package/dist/db/index.js.map +1 -1
  5. package/dist/docs/build-provenance-graph.d.ts +12 -0
  6. package/dist/docs/build-provenance-graph.d.ts.map +1 -1
  7. package/dist/docs/build-provenance-graph.js +52 -0
  8. package/dist/docs/build-provenance-graph.js.map +1 -1
  9. package/dist/docs/docs-read-model.d.ts +40 -0
  10. package/dist/docs/docs-read-model.d.ts.map +1 -1
  11. package/dist/docs/docs-read-model.js +29 -0
  12. package/dist/docs/docs-read-model.js.map +1 -1
  13. package/dist/docs/export-document.js +897 -730
  14. package/dist/docs/export-document.js.map +3 -3
  15. package/dist/docs/index.d.ts +4 -0
  16. package/dist/docs/index.d.ts.map +1 -1
  17. package/dist/docs/index.js +2 -0
  18. package/dist/docs/index.js.map +1 -1
  19. package/dist/docs/read-doc.d.ts +60 -0
  20. package/dist/docs/read-doc.d.ts.map +1 -0
  21. package/dist/docs/read-doc.js +188 -0
  22. package/dist/docs/read-doc.js.map +1 -0
  23. package/dist/docs/wikilinks.d.ts +119 -0
  24. package/dist/docs/wikilinks.d.ts.map +1 -0
  25. package/dist/docs/wikilinks.js +217 -0
  26. package/dist/docs/wikilinks.js.map +1 -0
  27. package/dist/llm/plugin-facade.js +941 -776
  28. package/dist/llm/plugin-facade.js.map +3 -3
  29. package/dist/store/dual-scope-db.d.ts +83 -0
  30. package/dist/store/dual-scope-db.d.ts.map +1 -1
  31. package/dist/store/dual-scope-db.js +135 -6
  32. package/dist/store/dual-scope-db.js.map +1 -1
  33. package/dist/store/exodus/abort-events.d.ts +116 -0
  34. package/dist/store/exodus/abort-events.d.ts.map +1 -0
  35. package/dist/store/exodus/abort-events.js +130 -0
  36. package/dist/store/exodus/abort-events.js.map +1 -0
  37. package/dist/store/exodus/index.d.ts +1 -0
  38. package/dist/store/exodus/index.d.ts.map +1 -1
  39. package/dist/store/exodus/index.js +1 -0
  40. package/dist/store/exodus/index.js.map +1 -1
  41. package/dist/store/repair-malformed-dbs.d.ts +87 -0
  42. package/dist/store/repair-malformed-dbs.d.ts.map +1 -0
  43. package/dist/store/repair-malformed-dbs.js +188 -0
  44. package/dist/store/repair-malformed-dbs.js.map +1 -0
  45. package/dist/store/schema/attachments.d.ts +133 -0
  46. package/dist/store/schema/attachments.d.ts.map +1 -1
  47. package/dist/store/schema/attachments.js +63 -0
  48. package/dist/store/schema/attachments.js.map +1 -1
  49. package/migrations/drizzle-tasks/20260605000001_t11826-docs-wikilinks/migration.sql +110 -0
  50. package/package.json +12 -12
@@ -7926,7 +7926,7 @@ var init_operations_registry = __esm({
7926
7926
  gateway: "mutate",
7927
7927
  domain: "docs",
7928
7928
  operation: "add",
7929
- description: "docs.add (mutate) \u2014 attach a local file or URL to a CLEO owner entity (task, session, observation)",
7929
+ description: "docs.add (mutate) \u2014 attach a local file, URL, or inline content to a CLEO owner entity (task, session, observation)",
7930
7930
  tier: 1,
7931
7931
  idempotent: false,
7932
7932
  sessionRequired: false,
@@ -7950,6 +7950,12 @@ var init_operations_registry = __esm({
7950
7950
  required: false,
7951
7951
  description: "Remote URL to attach"
7952
7952
  },
7953
+ {
7954
+ name: "content",
7955
+ type: "string",
7956
+ required: false,
7957
+ description: "Inline document body (T10965); mutually exclusive with file/url"
7958
+ },
7953
7959
  {
7954
7960
  name: "desc",
7955
7961
  type: "string",
@@ -9656,7 +9662,8 @@ var init_provenance = __esm({
9656
9662
  "superseded-by",
9657
9663
  "related-task",
9658
9664
  "linked-decision",
9659
- "derived-from"
9665
+ "derived-from",
9666
+ "shares-topic"
9660
9667
  ];
9661
9668
  DOC_LIFECYCLE_STATUSES = [
9662
9669
  "active",
@@ -9731,6 +9738,41 @@ var init_provenance = __esm({
9731
9738
  }
9732
9739
  });
9733
9740
 
9741
+ // packages/contracts/src/docs/read.ts
9742
+ import { z as z8 } from "zod";
9743
+ var docFrontmatterSchema, docBodySchema, docReadResponseSchema;
9744
+ var init_read = __esm({
9745
+ "packages/contracts/src/docs/read.ts"() {
9746
+ "use strict";
9747
+ docFrontmatterSchema = z8.object({
9748
+ slug: z8.string(),
9749
+ kind: z8.string().nullable(),
9750
+ title: z8.string().nullable(),
9751
+ summary: z8.string().nullable(),
9752
+ lifecycleStatus: z8.string(),
9753
+ docVersion: z8.number().int(),
9754
+ ownerVersion: z8.string().nullable(),
9755
+ supersedes: z8.string().nullable(),
9756
+ supersededBy: z8.string().nullable(),
9757
+ topics: z8.array(z8.string()).readonly(),
9758
+ relatedTasks: z8.array(z8.string()).readonly(),
9759
+ sha256: z8.string(),
9760
+ createdAt: z8.string()
9761
+ });
9762
+ docBodySchema = z8.object({
9763
+ encoding: z8.enum(["utf-8", "base64"]),
9764
+ text: z8.string().optional(),
9765
+ base64: z8.string().optional(),
9766
+ sizeBytes: z8.number().int().nonnegative(),
9767
+ mimeType: z8.string().nullable()
9768
+ });
9769
+ docReadResponseSchema = z8.object({
9770
+ frontmatter: docFrontmatterSchema,
9771
+ body: docBodySchema
9772
+ });
9773
+ }
9774
+ });
9775
+
9734
9776
  // packages/contracts/src/engine-result.ts
9735
9777
  var init_engine_result = __esm({
9736
9778
  "packages/contracts/src/engine-result.ts"() {
@@ -9906,72 +9948,72 @@ var init_errors = __esm({
9906
9948
  });
9907
9949
 
9908
9950
  // packages/contracts/src/evidence-atom-schema.ts
9909
- import { z as z8 } from "zod";
9951
+ import { z as z9 } from "zod";
9910
9952
  var 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;
9911
9953
  var init_evidence_atom_schema = __esm({
9912
9954
  "packages/contracts/src/evidence-atom-schema.ts"() {
9913
9955
  "use strict";
9914
- commitAtomSchema = z8.object({
9915
- kind: z8.literal("commit"),
9916
- sha: z8.string().regex(/^[0-9a-f]{7,40}$/i, "commit sha must be 7-40 hex characters")
9956
+ commitAtomSchema = z9.object({
9957
+ kind: z9.literal("commit"),
9958
+ sha: z9.string().regex(/^[0-9a-f]{7,40}$/i, "commit sha must be 7-40 hex characters")
9917
9959
  });
9918
- filesAtomSchema = z8.object({
9919
- kind: z8.literal("files"),
9920
- paths: z8.array(z8.string().min(1)).min(1, "files atom requires at least one path")
9960
+ filesAtomSchema = z9.object({
9961
+ kind: z9.literal("files"),
9962
+ paths: z9.array(z9.string().min(1)).min(1, "files atom requires at least one path")
9921
9963
  });
9922
- testRunAtomSchema = z8.object({
9923
- kind: z8.literal("test-run"),
9924
- path: z8.string().min(1, "test-run atom requires a non-empty path")
9964
+ testRunAtomSchema = z9.object({
9965
+ kind: z9.literal("test-run"),
9966
+ path: z9.string().min(1, "test-run atom requires a non-empty path")
9925
9967
  });
9926
- toolAtomSchema = z8.object({
9927
- kind: z8.literal("tool"),
9928
- tool: z8.string().min(1, "tool atom requires a non-empty tool name")
9968
+ toolAtomSchema = z9.object({
9969
+ kind: z9.literal("tool"),
9970
+ tool: z9.string().min(1, "tool atom requires a non-empty tool name")
9929
9971
  });
9930
- urlAtomSchema = z8.object({
9931
- kind: z8.literal("url"),
9932
- url: z8.string().min(1).regex(/^https?:\/\//, "url atom must start with http:// or https://")
9972
+ urlAtomSchema = z9.object({
9973
+ kind: z9.literal("url"),
9974
+ url: z9.string().min(1).regex(/^https?:\/\//, "url atom must start with http:// or https://")
9933
9975
  });
9934
- noteAtomSchema = z8.object({
9935
- kind: z8.literal("note"),
9936
- note: z8.string().min(1, "note atom must be non-empty").max(512, "note atom is too long (max 512 chars)")
9976
+ noteAtomSchema = z9.object({
9977
+ kind: z9.literal("note"),
9978
+ note: z9.string().min(1, "note atom must be non-empty").max(512, "note atom is too long (max 512 chars)")
9937
9979
  });
9938
- decisionAtomSchema = z8.object({
9939
- kind: z8.literal("decision"),
9940
- decisionId: z8.string().min(1, "decision atom requires a non-empty decision ID")
9980
+ decisionAtomSchema = z9.object({
9981
+ kind: z9.literal("decision"),
9982
+ decisionId: z9.string().min(1, "decision atom requires a non-empty decision ID")
9941
9983
  });
9942
- prAtomSchema = z8.object({
9943
- kind: z8.literal("pr"),
9944
- prNumber: z8.number().int().positive("pr atom requires a positive integer PR number")
9984
+ prAtomSchema = z9.object({
9985
+ kind: z9.literal("pr"),
9986
+ prNumber: z9.number().int().positive("pr atom requires a positive integer PR number")
9945
9987
  });
9946
- locDropAtomSchema = z8.object({
9947
- kind: z8.literal("loc-drop"),
9948
- fromLines: z8.number().int().nonnegative("loc-drop fromLines must be \u2265 0"),
9949
- toLines: z8.number().int().nonnegative("loc-drop toLines must be \u2265 0")
9988
+ locDropAtomSchema = z9.object({
9989
+ kind: z9.literal("loc-drop"),
9990
+ fromLines: z9.number().int().nonnegative("loc-drop fromLines must be \u2265 0"),
9991
+ toLines: z9.number().int().nonnegative("loc-drop toLines must be \u2265 0")
9950
9992
  });
9951
- callsiteCoverageAtomSchema = z8.object({
9952
- kind: z8.literal("callsite-coverage"),
9953
- symbolName: z8.string().min(1, "callsite-coverage atom requires a non-empty symbolName"),
9954
- relativeSourcePath: z8.string().min(1, "callsite-coverage atom requires a non-empty relativeSourcePath")
9993
+ callsiteCoverageAtomSchema = z9.object({
9994
+ kind: z9.literal("callsite-coverage"),
9995
+ symbolName: z9.string().min(1, "callsite-coverage atom requires a non-empty symbolName"),
9996
+ relativeSourcePath: z9.string().min(1, "callsite-coverage atom requires a non-empty relativeSourcePath")
9955
9997
  });
9956
9998
  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}$/;
9957
9999
  AC_ALIAS_REGEX = /^AC[0-9]{1,4}$/;
9958
10000
  SATISFIES_TASK_ID_REGEX = /^T[0-9]{1,7}$/;
9959
10001
  SATISFIES_VERSION_PIN_REGEX = /^[0-9]{14}$/;
9960
- satisfiesAtomSchema = z8.object({
9961
- kind: z8.literal("satisfies"),
10002
+ satisfiesAtomSchema = z9.object({
10003
+ kind: z9.literal("satisfies"),
9962
10004
  /** Target task ID — `T<1-7 digits>` per ADR-079-r2 §2.1. */
9963
- targetTaskId: z8.string().regex(SATISFIES_TASK_ID_REGEX, "satisfies atom targetTaskId must match /^T[0-9]{1,7}$/"),
10005
+ targetTaskId: z9.string().regex(SATISFIES_TASK_ID_REGEX, "satisfies atom targetTaskId must match /^T[0-9]{1,7}$/"),
9964
10006
  /** Lowercase UUIDv4/v5 — populated for the canonical form; undefined for alias form. */
9965
- targetAcId: z8.string().regex(AC_UUID_REGEX, "satisfies atom targetAcId must be a lowercase UUIDv4/v5").optional(),
10007
+ targetAcId: z9.string().regex(AC_UUID_REGEX, "satisfies atom targetAcId must be a lowercase UUIDv4/v5").optional(),
9966
10008
  /** Positional alias `AC<1-4 digits>` — populated for alias form; undefined for UUID form. */
9967
- targetAcAlias: z8.string().regex(AC_ALIAS_REGEX, "satisfies atom targetAcAlias must match /^AC[0-9]{1,4}$/").optional(),
10009
+ targetAcAlias: z9.string().regex(AC_ALIAS_REGEX, "satisfies atom targetAcAlias must match /^AC[0-9]{1,4}$/").optional(),
9968
10010
  /** Optional `@<14-digit YYYYMMDDhhmmss>` pin captured at mint time. */
9969
- versionPin: z8.string().regex(
10011
+ versionPin: z9.string().regex(
9970
10012
  SATISFIES_VERSION_PIN_REGEX,
9971
10013
  "satisfies atom versionPin must be 14 digits (YYYYMMDDhhmmss)"
9972
10014
  ).optional()
9973
10015
  });
9974
- EvidenceAtomSchema = z8.discriminatedUnion("kind", [
10016
+ EvidenceAtomSchema = z9.discriminatedUnion("kind", [
9975
10017
  commitAtomSchema,
9976
10018
  filesAtomSchema,
9977
10019
  testRunAtomSchema,
@@ -10018,58 +10060,58 @@ var init_evidence_atom_schema = __esm({
10018
10060
  });
10019
10061
 
10020
10062
  // packages/contracts/src/evidence-record-schema.ts
10021
- import { z as z9 } from "zod";
10063
+ import { z as z10 } from "zod";
10022
10064
  var evidenceBaseSchema, implDiffRecordSchema, validateSpecCheckRecordSchema, testOutputRecordSchema, lintReportRecordSchema, commandOutputRecordSchema, evidenceRecordSchema;
10023
10065
  var init_evidence_record_schema = __esm({
10024
10066
  "packages/contracts/src/evidence-record-schema.ts"() {
10025
10067
  "use strict";
10026
- evidenceBaseSchema = z9.object({
10068
+ evidenceBaseSchema = z10.object({
10027
10069
  /** Identity string of the agent that produced this record. */
10028
- agentIdentity: z9.string().min(1),
10070
+ agentIdentity: z10.string().min(1),
10029
10071
  /** SHA-256 hex digest (64 chars) of the attached artifact. */
10030
- attachmentSha256: z9.string().length(64),
10072
+ attachmentSha256: z10.string().length(64),
10031
10073
  /** ISO 8601 timestamp at which the action ran. */
10032
- ranAt: z9.string().datetime(),
10074
+ ranAt: z10.string().datetime(),
10033
10075
  /** Wall-clock duration of the action in milliseconds. */
10034
- durationMs: z9.number().nonnegative()
10076
+ durationMs: z10.number().nonnegative()
10035
10077
  });
10036
10078
  implDiffRecordSchema = evidenceBaseSchema.extend({
10037
- kind: z9.literal("impl-diff"),
10038
- phase: z9.literal("implement"),
10039
- filesChanged: z9.array(z9.string().min(1)).min(1),
10040
- linesAdded: z9.number().int().nonnegative(),
10041
- linesRemoved: z9.number().int().nonnegative()
10079
+ kind: z10.literal("impl-diff"),
10080
+ phase: z10.literal("implement"),
10081
+ filesChanged: z10.array(z10.string().min(1)).min(1),
10082
+ linesAdded: z10.number().int().nonnegative(),
10083
+ linesRemoved: z10.number().int().nonnegative()
10042
10084
  });
10043
10085
  validateSpecCheckRecordSchema = evidenceBaseSchema.extend({
10044
- kind: z9.literal("validate-spec-check"),
10045
- phase: z9.literal("validate"),
10046
- reqIdsChecked: z9.array(z9.string().min(1)).min(1),
10047
- passed: z9.boolean(),
10048
- details: z9.string().min(1)
10086
+ kind: z10.literal("validate-spec-check"),
10087
+ phase: z10.literal("validate"),
10088
+ reqIdsChecked: z10.array(z10.string().min(1)).min(1),
10089
+ passed: z10.boolean(),
10090
+ details: z10.string().min(1)
10049
10091
  });
10050
10092
  testOutputRecordSchema = evidenceBaseSchema.extend({
10051
- kind: z9.literal("test-output"),
10052
- phase: z9.literal("test"),
10053
- command: z9.string().min(1),
10054
- exitCode: z9.number().int(),
10055
- testsPassed: z9.number().int().nonnegative(),
10056
- testsFailed: z9.number().int().nonnegative()
10093
+ kind: z10.literal("test-output"),
10094
+ phase: z10.literal("test"),
10095
+ command: z10.string().min(1),
10096
+ exitCode: z10.number().int(),
10097
+ testsPassed: z10.number().int().nonnegative(),
10098
+ testsFailed: z10.number().int().nonnegative()
10057
10099
  });
10058
10100
  lintReportRecordSchema = evidenceBaseSchema.extend({
10059
- kind: z9.literal("lint-report"),
10060
- phase: z9.enum(["implement", "test"]),
10061
- tool: z9.string().min(1),
10062
- passed: z9.boolean(),
10063
- warnings: z9.number().int().nonnegative(),
10064
- errors: z9.number().int().nonnegative()
10101
+ kind: z10.literal("lint-report"),
10102
+ phase: z10.enum(["implement", "test"]),
10103
+ tool: z10.string().min(1),
10104
+ passed: z10.boolean(),
10105
+ warnings: z10.number().int().nonnegative(),
10106
+ errors: z10.number().int().nonnegative()
10065
10107
  });
10066
10108
  commandOutputRecordSchema = evidenceBaseSchema.extend({
10067
- kind: z9.literal("command-output"),
10068
- phase: z9.enum(["implement", "validate", "test"]),
10069
- cmd: z9.string().min(1),
10070
- exitCode: z9.number().int()
10109
+ kind: z10.literal("command-output"),
10110
+ phase: z10.enum(["implement", "validate", "test"]),
10111
+ cmd: z10.string().min(1),
10112
+ exitCode: z10.number().int()
10071
10113
  });
10072
- evidenceRecordSchema = z9.discriminatedUnion("kind", [
10114
+ evidenceRecordSchema = z10.discriminatedUnion("kind", [
10073
10115
  implDiffRecordSchema,
10074
10116
  validateSpecCheckRecordSchema,
10075
10117
  testOutputRecordSchema,
@@ -10727,7 +10769,7 @@ var init_status_registry = __esm({
10727
10769
  });
10728
10770
 
10729
10771
  // packages/contracts/src/workgraph.ts
10730
- import { z as z10 } from "zod";
10772
+ import { z as z11 } from "zod";
10731
10773
  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;
10732
10774
  var init_workgraph = __esm({
10733
10775
  "packages/contracts/src/workgraph.ts"() {
@@ -10735,10 +10777,10 @@ var init_workgraph = __esm({
10735
10777
  init_enums();
10736
10778
  init_status_registry();
10737
10779
  E_WORKGRAPH_PARENT_TYPE_MATRIX = "E_WORKGRAPH_PARENT_TYPE_MATRIX";
10738
- taskTypeSchema = z10.enum(["saga", "epic", "task", "subtask"]);
10739
- taskPrioritySchema = z10.enum(["critical", "high", "medium", "low"]);
10740
- taskStatusSchema = z10.enum(TASK_STATUSES);
10741
- verificationGateSchema = z10.enum([
10780
+ taskTypeSchema = z11.enum(["saga", "epic", "task", "subtask"]);
10781
+ taskPrioritySchema = z11.enum(["critical", "high", "medium", "low"]);
10782
+ taskStatusSchema = z11.enum(TASK_STATUSES);
10783
+ verificationGateSchema = z11.enum([
10742
10784
  "implemented",
10743
10785
  "testsPassed",
10744
10786
  "qaPassed",
@@ -10747,7 +10789,7 @@ var init_workgraph = __esm({
10747
10789
  "documented",
10748
10790
  "nexusImpact"
10749
10791
  ]);
10750
- workGraphRelationKindSchema = z10.enum([
10792
+ workGraphRelationKindSchema = z11.enum([
10751
10793
  "contains",
10752
10794
  "depends_on",
10753
10795
  "blocks",
@@ -10755,317 +10797,317 @@ var init_workgraph = __esm({
10755
10797
  "groups",
10756
10798
  "satisfies"
10757
10799
  ]);
10758
- workGraphTraversalDirectionSchema = z10.enum([
10800
+ workGraphTraversalDirectionSchema = z11.enum([
10759
10801
  "ancestors",
10760
10802
  "descendants",
10761
10803
  "upstream",
10762
10804
  "downstream"
10763
10805
  ]);
10764
- workGraphEdgeDirectionSchema = z10.enum(["out", "in", "both"]);
10765
- paginationParamsSchema = z10.object({
10766
- cursor: z10.string().min(1).optional(),
10767
- limit: z10.number().int().positive().max(500).optional()
10806
+ workGraphEdgeDirectionSchema = z11.enum(["out", "in", "both"]);
10807
+ paginationParamsSchema = z11.object({
10808
+ cursor: z11.string().min(1).optional(),
10809
+ limit: z11.number().int().positive().max(500).optional()
10768
10810
  });
10769
- workGraphNodeSchema = z10.object({
10770
- id: z10.string().min(1),
10811
+ workGraphNodeSchema = z11.object({
10812
+ id: z11.string().min(1),
10771
10813
  type: taskTypeSchema,
10772
- title: z10.string(),
10814
+ title: z11.string(),
10773
10815
  status: taskStatusSchema,
10774
10816
  priority: taskPrioritySchema,
10775
- parentId: z10.string().min(1).optional()
10817
+ parentId: z11.string().min(1).optional()
10776
10818
  });
10777
- workGraphEdgeSchema = z10.object({
10778
- fromId: z10.string().min(1),
10779
- toId: z10.string().min(1),
10819
+ workGraphEdgeSchema = z11.object({
10820
+ fromId: z11.string().min(1),
10821
+ toId: z11.string().min(1),
10780
10822
  kind: workGraphRelationKindSchema
10781
10823
  });
10782
- workGraphHierarchyEdgeSchema = z10.object({
10783
- fromId: z10.string().min(1),
10784
- toId: z10.string().min(1),
10785
- kind: z10.literal("contains")
10824
+ workGraphHierarchyEdgeSchema = z11.object({
10825
+ fromId: z11.string().min(1),
10826
+ toId: z11.string().min(1),
10827
+ kind: z11.literal("contains")
10786
10828
  }).strict();
10787
- workGraphPageInfoSchema = z10.object({
10788
- nextCursor: z10.string().min(1).optional(),
10789
- hasMore: z10.boolean()
10829
+ workGraphPageInfoSchema = z11.object({
10830
+ nextCursor: z11.string().min(1).optional(),
10831
+ hasMore: z11.boolean()
10790
10832
  });
10791
- workGraphRollupCountsSchema = z10.object({
10792
- total: z10.number().int().nonnegative(),
10793
- byStatus: z10.partialRecord(taskStatusSchema, z10.number().int().nonnegative()),
10794
- byType: z10.partialRecord(taskTypeSchema, z10.number().int().nonnegative())
10833
+ workGraphRollupCountsSchema = z11.object({
10834
+ total: z11.number().int().nonnegative(),
10835
+ byStatus: z11.partialRecord(taskStatusSchema, z11.number().int().nonnegative()),
10836
+ byType: z11.partialRecord(taskTypeSchema, z11.number().int().nonnegative())
10795
10837
  });
10796
- workGraphSubtreePercentagesSchema = z10.object({
10797
- done: z10.number().nonnegative(),
10798
- active: z10.number().nonnegative(),
10799
- blocked: z10.number().nonnegative(),
10800
- pending: z10.number().nonnegative(),
10801
- cancelled: z10.number().nonnegative()
10838
+ workGraphSubtreePercentagesSchema = z11.object({
10839
+ done: z11.number().nonnegative(),
10840
+ active: z11.number().nonnegative(),
10841
+ blocked: z11.number().nonnegative(),
10842
+ pending: z11.number().nonnegative(),
10843
+ cancelled: z11.number().nonnegative()
10802
10844
  });
10803
- workGraphProjectionMismatchSchema = z10.object({
10804
- field: z10.string().min(1),
10805
- expected: z10.number().int().nonnegative(),
10806
- actual: z10.number().int().nonnegative()
10845
+ workGraphProjectionMismatchSchema = z11.object({
10846
+ field: z11.string().min(1),
10847
+ expected: z11.number().int().nonnegative(),
10848
+ actual: z11.number().int().nonnegative()
10807
10849
  });
10808
10850
  workGraphReadyFrontierTaskSchema = workGraphNodeSchema.extend({
10809
- role: z10.string().min(1).optional(),
10810
- dependencyBlockers: z10.array(z10.object({ taskId: z10.string().min(1), status: taskStatusSchema })),
10811
- gateBlockers: z10.array(z10.object({ gate: verificationGateSchema }))
10851
+ role: z11.string().min(1).optional(),
10852
+ dependencyBlockers: z11.array(z11.object({ taskId: z11.string().min(1), status: taskStatusSchema })),
10853
+ gateBlockers: z11.array(z11.object({ gate: verificationGateSchema }))
10812
10854
  });
10813
10855
  workGraphRelationEdgeSchema = workGraphEdgeSchema.extend({
10814
- source: z10.literal("relation"),
10815
- relationType: z10.enum(TASK_RELATION_TYPES),
10816
- reason: z10.string().min(1).optional()
10856
+ source: z11.literal("relation"),
10857
+ relationType: z11.enum(TASK_RELATION_TYPES),
10858
+ reason: z11.string().min(1).optional()
10817
10859
  });
10818
10860
  workGraphDependencyEdgeSchema = workGraphEdgeSchema.extend({
10819
- source: z10.literal("dependency"),
10820
- kind: z10.literal("depends_on")
10861
+ source: z11.literal("dependency"),
10862
+ kind: z11.literal("depends_on")
10821
10863
  });
10822
- workGraphOmissionReasonSchema = z10.enum([
10864
+ workGraphOmissionReasonSchema = z11.enum([
10823
10865
  "budget_exceeded",
10824
10866
  "not_requested",
10825
10867
  "not_available",
10826
10868
  "redacted",
10827
10869
  "truncated"
10828
10870
  ]);
10829
- workGraphContextBudgetSchema = z10.object({
10830
- tokenBudget: z10.number().int().nonnegative(),
10831
- estimatedTokens: z10.number().int().nonnegative(),
10832
- remainingTokens: z10.number().int().nonnegative(),
10833
- truncated: z10.boolean()
10871
+ workGraphContextBudgetSchema = z11.object({
10872
+ tokenBudget: z11.number().int().nonnegative(),
10873
+ estimatedTokens: z11.number().int().nonnegative(),
10874
+ remainingTokens: z11.number().int().nonnegative(),
10875
+ truncated: z11.boolean()
10834
10876
  });
10835
- workGraphOmissionSchema = z10.object({
10836
- path: z10.string().min(1),
10877
+ workGraphOmissionSchema = z11.object({
10878
+ path: z11.string().min(1),
10837
10879
  reason: workGraphOmissionReasonSchema,
10838
- message: z10.string().min(1),
10839
- estimatedTokens: z10.number().int().nonnegative().optional()
10880
+ message: z11.string().min(1),
10881
+ estimatedTokens: z11.number().int().nonnegative().optional()
10840
10882
  });
10841
- workGraphDirectEdgeSchema = z10.discriminatedUnion("source", [
10883
+ workGraphDirectEdgeSchema = z11.discriminatedUnion("source", [
10842
10884
  workGraphRelationEdgeSchema,
10843
10885
  workGraphDependencyEdgeSchema
10844
10886
  ]);
10845
10887
  workGraphContextPackParamsSchema = paginationParamsSchema.extend({
10846
- rootId: z10.string().min(1),
10847
- tokenBudget: z10.number().int().positive().optional(),
10848
- includeRelations: z10.boolean().optional(),
10849
- includeReadiness: z10.boolean().optional(),
10850
- includeRollup: z10.boolean().optional()
10888
+ rootId: z11.string().min(1),
10889
+ tokenBudget: z11.number().int().positive().optional(),
10890
+ includeRelations: z11.boolean().optional(),
10891
+ includeReadiness: z11.boolean().optional(),
10892
+ includeRollup: z11.boolean().optional()
10851
10893
  });
10852
10894
  workGraphSliceParamsSchema = paginationParamsSchema.extend({
10853
- rootId: z10.string().min(1),
10895
+ rootId: z11.string().min(1),
10854
10896
  direction: workGraphTraversalDirectionSchema.optional(),
10855
- maxDepth: z10.number().int().nonnegative().optional(),
10856
- includeRelations: z10.boolean().optional()
10897
+ maxDepth: z11.number().int().nonnegative().optional(),
10898
+ includeRelations: z11.boolean().optional()
10857
10899
  });
10858
- workGraphSliceSchema = z10.object({
10859
- rootId: z10.string().min(1),
10900
+ workGraphSliceSchema = z11.object({
10901
+ rootId: z11.string().min(1),
10860
10902
  direction: workGraphTraversalDirectionSchema,
10861
- nodes: z10.array(workGraphNodeSchema),
10862
- edges: z10.array(workGraphEdgeSchema),
10903
+ nodes: z11.array(workGraphNodeSchema),
10904
+ edges: z11.array(workGraphEdgeSchema),
10863
10905
  pageInfo: workGraphPageInfoSchema,
10864
- omissions: z10.array(workGraphOmissionSchema).optional()
10906
+ omissions: z11.array(workGraphOmissionSchema).optional()
10865
10907
  });
10866
- workGraphReadinessParamsSchema = z10.object({
10867
- rootId: z10.string().min(1),
10868
- role: z10.string().min(1).optional(),
10869
- includeGateBlockers: z10.boolean().optional()
10908
+ workGraphReadinessParamsSchema = z11.object({
10909
+ rootId: z11.string().min(1),
10910
+ role: z11.string().min(1).optional(),
10911
+ includeGateBlockers: z11.boolean().optional()
10870
10912
  });
10871
- workGraphReadinessResultSchema = z10.object({
10872
- rootId: z10.string().min(1),
10873
- role: z10.string().min(1).optional(),
10874
- ready: z10.boolean(),
10875
- warnings: z10.array(z10.string()),
10876
- groups: z10.object({
10877
- ready: z10.array(workGraphReadyFrontierTaskSchema),
10878
- blocked: z10.array(workGraphReadyFrontierTaskSchema),
10879
- blockedBy: z10.array(
10880
- z10.discriminatedUnion("kind", [
10881
- z10.object({
10882
- kind: z10.literal("dependency"),
10883
- blockerId: z10.string().min(1),
10884
- blocks: z10.array(z10.string().min(1))
10913
+ workGraphReadinessResultSchema = z11.object({
10914
+ rootId: z11.string().min(1),
10915
+ role: z11.string().min(1).optional(),
10916
+ ready: z11.boolean(),
10917
+ warnings: z11.array(z11.string()),
10918
+ groups: z11.object({
10919
+ ready: z11.array(workGraphReadyFrontierTaskSchema),
10920
+ blocked: z11.array(workGraphReadyFrontierTaskSchema),
10921
+ blockedBy: z11.array(
10922
+ z11.discriminatedUnion("kind", [
10923
+ z11.object({
10924
+ kind: z11.literal("dependency"),
10925
+ blockerId: z11.string().min(1),
10926
+ blocks: z11.array(z11.string().min(1))
10885
10927
  }),
10886
- z10.object({
10887
- kind: z10.literal("gate"),
10928
+ z11.object({
10929
+ kind: z11.literal("gate"),
10888
10930
  gate: verificationGateSchema,
10889
- blocks: z10.array(z10.string().min(1))
10931
+ blocks: z11.array(z11.string().min(1))
10890
10932
  })
10891
10933
  ])
10892
10934
  )
10893
10935
  })
10894
10936
  });
10895
- workGraphContextPackSchema = z10.object({
10896
- rootId: z10.string().min(1),
10897
- generatedAt: z10.string().min(1),
10937
+ workGraphContextPackSchema = z11.object({
10938
+ rootId: z11.string().min(1),
10939
+ generatedAt: z11.string().min(1),
10898
10940
  budget: workGraphContextBudgetSchema,
10899
10941
  slice: workGraphSliceSchema,
10900
- relationEdges: z10.object({
10901
- rootId: z10.string().min(1),
10942
+ relationEdges: z11.object({
10943
+ rootId: z11.string().min(1),
10902
10944
  direction: workGraphEdgeDirectionSchema,
10903
- edges: z10.array(workGraphDirectEdgeSchema)
10945
+ edges: z11.array(workGraphDirectEdgeSchema)
10904
10946
  }).optional(),
10905
10947
  readiness: workGraphReadinessResultSchema.optional(),
10906
- rollup: z10.lazy(() => tasksRollupResultSchema).optional(),
10907
- omissions: z10.array(workGraphOmissionSchema)
10948
+ rollup: z11.lazy(() => tasksRollupResultSchema).optional(),
10949
+ omissions: z11.array(workGraphOmissionSchema)
10908
10950
  });
10909
- workGraphScaffoldValidateParamsSchema = z10.object({
10910
- rootId: z10.string().min(1),
10911
- nodes: z10.array(
10912
- z10.object({
10913
- id: z10.string().min(1),
10951
+ workGraphScaffoldValidateParamsSchema = z11.object({
10952
+ rootId: z11.string().min(1),
10953
+ nodes: z11.array(
10954
+ z11.object({
10955
+ id: z11.string().min(1),
10914
10956
  type: taskTypeSchema,
10915
- parentId: z10.string().min(1).nullable().optional()
10957
+ parentId: z11.string().min(1).nullable().optional()
10916
10958
  })
10917
10959
  ),
10918
- edges: z10.array(workGraphDirectEdgeSchema).optional(),
10919
- dryRun: z10.boolean().optional()
10960
+ edges: z11.array(workGraphDirectEdgeSchema).optional(),
10961
+ dryRun: z11.boolean().optional()
10920
10962
  });
10921
- workGraphScaffoldValidationIssueSchema = z10.object({
10922
- code: z10.string().min(1),
10923
- message: z10.string().min(1),
10924
- taskId: z10.string().min(1).optional(),
10925
- severity: z10.enum(["error", "warning"])
10963
+ workGraphScaffoldValidationIssueSchema = z11.object({
10964
+ code: z11.string().min(1),
10965
+ message: z11.string().min(1),
10966
+ taskId: z11.string().min(1).optional(),
10967
+ severity: z11.enum(["error", "warning"])
10926
10968
  });
10927
- workGraphScaffoldValidateResultSchema = z10.object({
10928
- rootId: z10.string().min(1),
10929
- valid: z10.boolean(),
10930
- dryRun: z10.boolean(),
10931
- issues: z10.array(workGraphScaffoldValidationIssueSchema),
10932
- hierarchy: z10.object({
10933
- valid: z10.boolean(),
10934
- violations: z10.array(
10935
- z10.object({
10936
- code: z10.literal(E_WORKGRAPH_PARENT_TYPE_MATRIX),
10937
- taskId: z10.string().min(1),
10969
+ workGraphScaffoldValidateResultSchema = z11.object({
10970
+ rootId: z11.string().min(1),
10971
+ valid: z11.boolean(),
10972
+ dryRun: z11.boolean(),
10973
+ issues: z11.array(workGraphScaffoldValidationIssueSchema),
10974
+ hierarchy: z11.object({
10975
+ valid: z11.boolean(),
10976
+ violations: z11.array(
10977
+ z11.object({
10978
+ code: z11.literal(E_WORKGRAPH_PARENT_TYPE_MATRIX),
10979
+ taskId: z11.string().min(1),
10938
10980
  taskType: taskTypeSchema,
10939
- parentId: z10.string().min(1).nullable(),
10981
+ parentId: z11.string().min(1).nullable(),
10940
10982
  parentType: taskTypeSchema.optional(),
10941
- message: z10.string().min(1)
10983
+ message: z11.string().min(1)
10942
10984
  })
10943
10985
  )
10944
10986
  })
10945
10987
  });
10946
10988
  workGraphScaffoldApplyParamsSchema = workGraphScaffoldValidateParamsSchema.extend({
10947
- apply: z10.boolean().optional()
10989
+ apply: z11.boolean().optional()
10948
10990
  });
10949
10991
  workGraphScaffoldApplyResultSchema = workGraphScaffoldValidateResultSchema.extend({
10950
- applied: z10.boolean(),
10951
- nodesChanged: z10.number().int().nonnegative(),
10952
- edgesChanged: z10.number().int().nonnegative()
10992
+ applied: z11.boolean(),
10993
+ nodesChanged: z11.number().int().nonnegative(),
10994
+ edgesChanged: z11.number().int().nonnegative()
10953
10995
  });
10954
- workGraphPlanningDocParamsSchema = z10.object({
10955
- rootId: z10.string().min(1),
10956
- audience: z10.enum(["agent", "maintainer"]),
10957
- tokenBudget: z10.number().int().positive().optional(),
10958
- includeRelations: z10.boolean().optional(),
10959
- includeReadiness: z10.boolean().optional(),
10960
- includeRollup: z10.boolean().optional()
10996
+ workGraphPlanningDocParamsSchema = z11.object({
10997
+ rootId: z11.string().min(1),
10998
+ audience: z11.enum(["agent", "maintainer"]),
10999
+ tokenBudget: z11.number().int().positive().optional(),
11000
+ includeRelations: z11.boolean().optional(),
11001
+ includeReadiness: z11.boolean().optional(),
11002
+ includeRollup: z11.boolean().optional()
10961
11003
  });
10962
- workGraphPlanningDocSchema = z10.object({
10963
- rootId: z10.string().min(1),
10964
- generatedAt: z10.string().min(1),
10965
- audience: z10.enum(["agent", "maintainer"]),
10966
- title: z10.string().min(1),
10967
- content: z10.string(),
10968
- sections: z10.array(z10.string().min(1)),
10969
- estimatedTokens: z10.number().int().nonnegative(),
10970
- budget: z10.object({
10971
- tokenBudget: z10.number().int().positive(),
10972
- truncated: z10.boolean()
11004
+ workGraphPlanningDocSchema = z11.object({
11005
+ rootId: z11.string().min(1),
11006
+ generatedAt: z11.string().min(1),
11007
+ audience: z11.enum(["agent", "maintainer"]),
11008
+ title: z11.string().min(1),
11009
+ content: z11.string(),
11010
+ sections: z11.array(z11.string().min(1)),
11011
+ estimatedTokens: z11.number().int().nonnegative(),
11012
+ budget: z11.object({
11013
+ tokenBudget: z11.number().int().positive(),
11014
+ truncated: z11.boolean()
10973
11015
  }).optional()
10974
11016
  });
10975
11017
  tasksTraverseParamsSchema = paginationParamsSchema.extend({
10976
- rootId: z10.string().min(1),
11018
+ rootId: z11.string().min(1),
10977
11019
  direction: workGraphTraversalDirectionSchema,
10978
- maxDepth: z10.number().int().nonnegative().optional(),
10979
- includeRelations: z10.boolean().optional()
11020
+ maxDepth: z11.number().int().nonnegative().optional(),
11021
+ includeRelations: z11.boolean().optional()
10980
11022
  });
10981
- tasksTraverseResultSchema = z10.object({
10982
- rootId: z10.string().min(1),
11023
+ tasksTraverseResultSchema = z11.object({
11024
+ rootId: z11.string().min(1),
10983
11025
  direction: workGraphTraversalDirectionSchema,
10984
- nodes: z10.array(workGraphNodeSchema),
10985
- edges: z10.array(workGraphEdgeSchema),
11026
+ nodes: z11.array(workGraphNodeSchema),
11027
+ edges: z11.array(workGraphEdgeSchema),
10986
11028
  pageInfo: workGraphPageInfoSchema
10987
11029
  });
10988
11030
  tasksTreeParamsSchema = paginationParamsSchema.extend({
10989
- rootId: z10.string().min(1),
10990
- maxDepth: z10.number().int().nonnegative().optional()
11031
+ rootId: z11.string().min(1),
11032
+ maxDepth: z11.number().int().nonnegative().optional()
10991
11033
  });
10992
- tasksTreeResultSchema = z10.object({
10993
- rootId: z10.string().min(1),
10994
- nodes: z10.array(workGraphNodeSchema.extend({ depth: z10.number().int().positive() })),
10995
- edges: z10.array(workGraphHierarchyEdgeSchema),
11034
+ tasksTreeResultSchema = z11.object({
11035
+ rootId: z11.string().min(1),
11036
+ nodes: z11.array(workGraphNodeSchema.extend({ depth: z11.number().int().positive() })),
11037
+ edges: z11.array(workGraphHierarchyEdgeSchema),
10996
11038
  pageInfo: workGraphPageInfoSchema
10997
11039
  });
10998
- tasksRollupParamsSchema = z10.object({
10999
- rootId: z10.string().min(1),
11040
+ tasksRollupParamsSchema = z11.object({
11041
+ rootId: z11.string().min(1),
11000
11042
  expectedDirectRollup: workGraphRollupCountsSchema.optional()
11001
11043
  });
11002
- tasksRollupResultSchema = z10.object({
11003
- rootId: z10.string().min(1),
11044
+ tasksRollupResultSchema = z11.object({
11045
+ rootId: z11.string().min(1),
11004
11046
  direct: workGraphRollupCountsSchema,
11005
11047
  subtree: workGraphRollupCountsSchema,
11006
- percentDenominator: z10.object({
11007
- basis: z10.literal("subtree-total"),
11008
- total: z10.number().int().nonnegative(),
11009
- description: z10.string().min(1)
11048
+ percentDenominator: z11.object({
11049
+ basis: z11.literal("subtree-total"),
11050
+ total: z11.number().int().nonnegative(),
11051
+ description: z11.string().min(1)
11010
11052
  }),
11011
11053
  percentages: workGraphSubtreePercentagesSchema,
11012
- staleProjection: z10.boolean(),
11013
- projectionMismatches: z10.array(workGraphProjectionMismatchSchema)
11054
+ staleProjection: z11.boolean(),
11055
+ projectionMismatches: z11.array(workGraphProjectionMismatchSchema)
11014
11056
  });
11015
- tasksFrontierParamsSchema = z10.object({
11016
- rootId: z10.string().min(1),
11017
- role: z10.string().min(1).optional()
11057
+ tasksFrontierParamsSchema = z11.object({
11058
+ rootId: z11.string().min(1),
11059
+ role: z11.string().min(1).optional()
11018
11060
  });
11019
- tasksFrontierResultSchema = z10.object({
11020
- rootId: z10.string().min(1),
11021
- role: z10.string().min(1).optional(),
11022
- groups: z10.object({
11023
- ready: z10.array(workGraphReadyFrontierTaskSchema),
11024
- blocked: z10.array(workGraphReadyFrontierTaskSchema),
11025
- blockedBy: z10.array(
11026
- z10.discriminatedUnion("kind", [
11027
- z10.object({
11028
- kind: z10.literal("dependency"),
11029
- blockerId: z10.string().min(1),
11030
- blocks: z10.array(z10.string().min(1))
11061
+ tasksFrontierResultSchema = z11.object({
11062
+ rootId: z11.string().min(1),
11063
+ role: z11.string().min(1).optional(),
11064
+ groups: z11.object({
11065
+ ready: z11.array(workGraphReadyFrontierTaskSchema),
11066
+ blocked: z11.array(workGraphReadyFrontierTaskSchema),
11067
+ blockedBy: z11.array(
11068
+ z11.discriminatedUnion("kind", [
11069
+ z11.object({
11070
+ kind: z11.literal("dependency"),
11071
+ blockerId: z11.string().min(1),
11072
+ blocks: z11.array(z11.string().min(1))
11031
11073
  }),
11032
- z10.object({
11033
- kind: z10.literal("gate"),
11074
+ z11.object({
11075
+ kind: z11.literal("gate"),
11034
11076
  gate: verificationGateSchema,
11035
- blocks: z10.array(z10.string().min(1))
11077
+ blocks: z11.array(z11.string().min(1))
11036
11078
  })
11037
11079
  ])
11038
11080
  )
11039
11081
  })
11040
11082
  });
11041
11083
  tasksWorkGraphAuditParamsSchema = paginationParamsSchema.extend({
11042
- rootId: z10.string().min(1),
11043
- maxDepth: z10.number().int().nonnegative().optional(),
11044
- includeRelations: z10.boolean().optional()
11084
+ rootId: z11.string().min(1),
11085
+ maxDepth: z11.number().int().nonnegative().optional(),
11086
+ includeRelations: z11.boolean().optional()
11045
11087
  });
11046
- tasksWorkGraphAuditResultSchema = z10.object({
11047
- rootId: z10.string().min(1),
11048
- hierarchy: z10.object({
11049
- valid: z10.boolean(),
11050
- violations: z10.array(
11051
- z10.object({
11052
- code: z10.literal(E_WORKGRAPH_PARENT_TYPE_MATRIX),
11053
- taskId: z10.string().min(1),
11088
+ tasksWorkGraphAuditResultSchema = z11.object({
11089
+ rootId: z11.string().min(1),
11090
+ hierarchy: z11.object({
11091
+ valid: z11.boolean(),
11092
+ violations: z11.array(
11093
+ z11.object({
11094
+ code: z11.literal(E_WORKGRAPH_PARENT_TYPE_MATRIX),
11095
+ taskId: z11.string().min(1),
11054
11096
  taskType: taskTypeSchema,
11055
- parentId: z10.string().min(1).nullable(),
11097
+ parentId: z11.string().min(1).nullable(),
11056
11098
  parentType: taskTypeSchema.optional(),
11057
- message: z10.string().min(1)
11099
+ message: z11.string().min(1)
11058
11100
  })
11059
11101
  )
11060
11102
  }),
11061
11103
  traversal: tasksTraverseResultSchema,
11062
11104
  frontier: tasksFrontierResultSchema,
11063
11105
  rollup: tasksRollupResultSchema,
11064
- relationEdges: z10.object({
11065
- rootId: z10.string().min(1),
11106
+ relationEdges: z11.object({
11107
+ rootId: z11.string().min(1),
11066
11108
  direction: workGraphEdgeDirectionSchema,
11067
- edges: z10.array(
11068
- z10.discriminatedUnion("source", [
11109
+ edges: z11.array(
11110
+ z11.discriminatedUnion("source", [
11069
11111
  workGraphRelationEdgeSchema,
11070
11112
  workGraphDependencyEdgeSchema
11071
11113
  ])
@@ -11420,31 +11462,31 @@ var init_peer = __esm({
11420
11462
  });
11421
11463
 
11422
11464
  // packages/contracts/src/release/evidence-atoms.ts
11423
- import { z as z11 } from "zod";
11465
+ import { z as z12 } from "zod";
11424
11466
  var parsedPrEvidenceAtomSchema, prEvidenceStateModifierSchema, ghPrViewSchema, PR_REQUIRED_WORKFLOWS;
11425
11467
  var init_evidence_atoms = __esm({
11426
11468
  "packages/contracts/src/release/evidence-atoms.ts"() {
11427
11469
  "use strict";
11428
- parsedPrEvidenceAtomSchema = z11.object({
11429
- kind: z11.literal("pr"),
11430
- prNumber: z11.number().int().positive()
11470
+ parsedPrEvidenceAtomSchema = z12.object({
11471
+ kind: z12.literal("pr"),
11472
+ prNumber: z12.number().int().positive()
11431
11473
  });
11432
- prEvidenceStateModifierSchema = z11.object({
11433
- kind: z11.literal("state"),
11434
- value: z11.literal("MERGED")
11474
+ prEvidenceStateModifierSchema = z12.object({
11475
+ kind: z12.literal("state"),
11476
+ value: z12.literal("MERGED")
11435
11477
  });
11436
- ghPrViewSchema = z11.object({
11437
- state: z11.enum(["OPEN", "CLOSED", "MERGED"]),
11438
- mergedAt: z11.string().nullable(),
11439
- headRefOid: z11.string().optional(),
11440
- mergeable: z11.string().optional(),
11441
- statusCheckRollup: z11.array(
11442
- z11.object({
11443
- __typename: z11.string().optional(),
11444
- name: z11.string().optional(),
11445
- workflowName: z11.string().optional(),
11446
- conclusion: z11.string().nullable().optional(),
11447
- status: z11.string().optional()
11478
+ ghPrViewSchema = z12.object({
11479
+ state: z12.enum(["OPEN", "CLOSED", "MERGED"]),
11480
+ mergedAt: z12.string().nullable(),
11481
+ headRefOid: z12.string().optional(),
11482
+ mergeable: z12.string().optional(),
11483
+ statusCheckRollup: z12.array(
11484
+ z12.object({
11485
+ __typename: z12.string().optional(),
11486
+ name: z12.string().optional(),
11487
+ workflowName: z12.string().optional(),
11488
+ conclusion: z12.string().nullable().optional(),
11489
+ status: z12.string().optional()
11448
11490
  }).passthrough()
11449
11491
  ).optional().default([])
11450
11492
  }).passthrough();
@@ -11457,7 +11499,7 @@ var init_evidence_atoms = __esm({
11457
11499
  });
11458
11500
 
11459
11501
  // packages/contracts/src/release/plan.ts
11460
- import { z as z12 } from "zod";
11502
+ import { z as z13 } from "zod";
11461
11503
  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;
11462
11504
  var init_plan = __esm({
11463
11505
  "packages/contracts/src/release/plan.ts"() {
@@ -11500,20 +11542,20 @@ var init_plan = __esm({
11500
11542
  ];
11501
11543
  IMPACT = ["major", "minor", "patch"];
11502
11544
  RESOLVED_SOURCE = ["project-context", "language-default", "legacy-alias"];
11503
- ReleaseChannelSchema = z12.enum(RELEASE_CHANNEL);
11504
- ReleaseSchemeSchema = z12.enum(RELEASE_SCHEME);
11505
- ReleaseKindSchema = z12.enum(RELEASE_KIND);
11506
- ReleaseStatusSchema = z12.enum(RELEASE_STATUS);
11507
- GateStatusSchema = z12.enum(GATE_STATUS);
11508
- GateNameSchema = z12.enum(GATE_NAME);
11509
- PlatformTupleSchema = z12.enum(PLATFORM_TUPLE);
11510
- PublisherSchema = z12.enum(PUBLISHER);
11511
- TaskKindSchema = z12.enum(TASK_KIND);
11512
- ImpactSchema = z12.enum(IMPACT);
11513
- ResolvedSourceSchema = z12.enum(RESOLVED_SOURCE);
11514
- Iso8601 = z12.iso.datetime({ offset: true });
11515
- NonEmptyString = z12.string().min(1);
11516
- ReleasePlanTaskSchema = z12.object({
11545
+ ReleaseChannelSchema = z13.enum(RELEASE_CHANNEL);
11546
+ ReleaseSchemeSchema = z13.enum(RELEASE_SCHEME);
11547
+ ReleaseKindSchema = z13.enum(RELEASE_KIND);
11548
+ ReleaseStatusSchema = z13.enum(RELEASE_STATUS);
11549
+ GateStatusSchema = z13.enum(GATE_STATUS);
11550
+ GateNameSchema = z13.enum(GATE_NAME);
11551
+ PlatformTupleSchema = z13.enum(PLATFORM_TUPLE);
11552
+ PublisherSchema = z13.enum(PUBLISHER);
11553
+ TaskKindSchema = z13.enum(TASK_KIND);
11554
+ ImpactSchema = z13.enum(IMPACT);
11555
+ ResolvedSourceSchema = z13.enum(RESOLVED_SOURCE);
11556
+ Iso8601 = z13.iso.datetime({ offset: true });
11557
+ NonEmptyString = z13.string().min(1);
11558
+ ReleasePlanTaskSchema = z13.object({
11517
11559
  /** Task ID (e.g. "T10001"). Format intentionally loose so historical IDs validate. */
11518
11560
  id: NonEmptyString,
11519
11561
  /** Conventional-commit-aligned task classification. */
@@ -11521,20 +11563,20 @@ var init_plan = __esm({
11521
11563
  /** SemVer impact classification. */
11522
11564
  impact: ImpactSchema,
11523
11565
  /** Human-readable changelog line for this task. */
11524
- userFacingSummary: z12.string(),
11566
+ userFacingSummary: z13.string(),
11525
11567
  /**
11526
11568
  * ADR-051 evidence atoms attesting the task's gate results. Format is
11527
11569
  * `kind:value` (e.g. `commit:abc123`, `test-run:vitest.json`). The contract
11528
11570
  * accepts empty arrays so legacy plans validate; `cleo release plan`
11529
11571
  * enforces non-empty via R-301.
11530
11572
  */
11531
- evidenceAtoms: z12.array(NonEmptyString),
11573
+ evidenceAtoms: z13.array(NonEmptyString),
11532
11574
  /** IVTR phase at plan time — informational only per R-316. */
11533
- ivtrPhaseAtPlan: z12.string().optional(),
11575
+ ivtrPhaseAtPlan: z13.string().optional(),
11534
11576
  /** Epic this task rolls up to, locked at plan time per R-303. */
11535
11577
  epicAncestor: NonEmptyString
11536
11578
  });
11537
- ReleaseGateSchema = z12.object({
11579
+ ReleaseGateSchema = z13.object({
11538
11580
  /** Canonical gate name. */
11539
11581
  name: GateNameSchema,
11540
11582
  /** ADR-051 atom string identifying the resolved tool (e.g. `tool:test`). */
@@ -11544,11 +11586,11 @@ var init_plan = __esm({
11544
11586
  /** ISO-8601 timestamp the gate was last verified. */
11545
11587
  lastVerifiedAt: Iso8601,
11546
11588
  /** Resolved shell command (e.g. `pnpm run test`). Optional for unresolved gates. */
11547
- resolvedCommand: z12.string().optional(),
11589
+ resolvedCommand: z13.string().optional(),
11548
11590
  /** Provenance of the resolved command. Optional for unresolved gates. */
11549
11591
  resolvedSource: ResolvedSourceSchema.optional()
11550
11592
  });
11551
- ReleasePlatformMatrixEntrySchema = z12.object({
11593
+ ReleasePlatformMatrixEntrySchema = z13.object({
11552
11594
  /** Target platform tuple. */
11553
11595
  platform: PlatformTupleSchema,
11554
11596
  /** Distribution backend. */
@@ -11556,47 +11598,47 @@ var init_plan = __esm({
11556
11598
  /** Package identifier on the target backend (e.g. `@cleocode/cleo`). */
11557
11599
  package: NonEmptyString,
11558
11600
  /** Whether to run the GHA smoke job for this matrix entry. */
11559
- smoke: z12.boolean().default(true).optional()
11601
+ smoke: z13.boolean().default(true).optional()
11560
11602
  });
11561
- ReleasePreflightSummarySchema = z12.object({
11603
+ ReleasePreflightSummarySchema = z13.object({
11562
11604
  /** True if esbuild externals are out of sync with package.json. */
11563
- esbuildExternalsDrift: z12.boolean(),
11605
+ esbuildExternalsDrift: z13.boolean(),
11564
11606
  /** True if `pnpm-lock.yaml` diverges from the workspace manifest. */
11565
- lockfileDrift: z12.boolean(),
11607
+ lockfileDrift: z13.boolean(),
11566
11608
  /** True if all epic children are in terminal lifecycle states. */
11567
- epicCompletenessClean: z12.boolean(),
11609
+ epicCompletenessClean: z13.boolean(),
11568
11610
  /** True if no task appears in multiple in-flight release plans. */
11569
- doubleListingClean: z12.boolean(),
11611
+ doubleListingClean: z13.boolean(),
11570
11612
  /** Non-fatal preflight warnings (e.g. unresolved tools per R-024). */
11571
- preflightWarnings: z12.array(z12.string()).default([]).optional()
11613
+ preflightWarnings: z13.array(z13.string()).default([]).optional()
11572
11614
  });
11573
- ReleasePlanChangelogSchema = z12.object({
11615
+ ReleasePlanChangelogSchema = z13.object({
11574
11616
  /** `kind=feat` tasks. */
11575
- features: z12.array(NonEmptyString).default([]),
11617
+ features: z13.array(NonEmptyString).default([]),
11576
11618
  /** `kind=fix` or `kind=hotfix` tasks. */
11577
- fixes: z12.array(NonEmptyString).default([]),
11619
+ fixes: z13.array(NonEmptyString).default([]),
11578
11620
  /** `kind=chore`, `docs`, `refactor`, `test`, `perf` tasks. */
11579
- chores: z12.array(NonEmptyString).default([]),
11621
+ chores: z13.array(NonEmptyString).default([]),
11580
11622
  /** `kind=breaking` or `kind=revert` tasks. */
11581
- breaking: z12.array(NonEmptyString).default([])
11623
+ breaking: z13.array(NonEmptyString).default([])
11582
11624
  });
11583
- ReleasePlanMetaSchema = z12.object({
11625
+ ReleasePlanMetaSchema = z13.object({
11584
11626
  /** True if this is the project's first ever release. */
11585
- firstEverRelease: z12.boolean().optional(),
11627
+ firstEverRelease: z13.boolean().optional(),
11586
11628
  /** Canonical tool names that could not be resolved at plan time. */
11587
- unresolvedTools: z12.array(z12.string()).optional(),
11629
+ unresolvedTools: z13.array(z13.string()).optional(),
11588
11630
  /** Project archetype detected at plan time. */
11589
- archetype: z12.string().optional()
11590
- }).catchall(z12.unknown());
11591
- ReleasePlanSchema = z12.object({
11631
+ archetype: z13.string().optional()
11632
+ }).catchall(z13.unknown());
11633
+ ReleasePlanSchema = z13.object({
11592
11634
  /** Schema URL for this plan version. */
11593
- $schema: z12.string().optional(),
11635
+ $schema: z13.string().optional(),
11594
11636
  /** Requested version string (e.g. "v2026.6.0"). Includes the leading `v`. */
11595
11637
  version: NonEmptyString,
11596
11638
  /** Resolved version string after suffix application (e.g. "v2026.6.0.2"). */
11597
11639
  resolvedVersion: NonEmptyString,
11598
11640
  /** True if a `calver-suffix` was applied to disambiguate a same-day hotfix. */
11599
- suffixApplied: z12.boolean(),
11641
+ suffixApplied: z13.boolean(),
11600
11642
  /** Versioning scheme governing `version` / `resolvedVersion`. */
11601
11643
  scheme: ReleaseSchemeSchema,
11602
11644
  /** npm dist-tag channel for this release. */
@@ -11613,27 +11655,27 @@ var init_plan = __esm({
11613
11655
  * Version of the previous release on the same channel. MUST be `null` only
11614
11656
  * for first-ever releases (R-300, enforced at the verb layer).
11615
11657
  */
11616
- previousVersion: z12.string().nullable(),
11658
+ previousVersion: z13.string().nullable(),
11617
11659
  /** Git tag of the previous release (typically `previousVersion` prefixed). */
11618
- previousTag: z12.string().nullable(),
11660
+ previousTag: z13.string().nullable(),
11619
11661
  /** ISO-8601 timestamp the previous release was published. */
11620
11662
  previousShippedAt: Iso8601.nullable(),
11621
11663
  /** Tasks rolled into this release. */
11622
- tasks: z12.array(ReleasePlanTaskSchema),
11664
+ tasks: z13.array(ReleasePlanTaskSchema),
11623
11665
  /** Bucketed changelog. */
11624
11666
  changelog: ReleasePlanChangelogSchema,
11625
11667
  /** Per-gate verification status. */
11626
- gates: z12.array(ReleaseGateSchema),
11668
+ gates: z13.array(ReleaseGateSchema),
11627
11669
  /** Platform / publisher matrix. */
11628
- platformMatrix: z12.array(ReleasePlatformMatrixEntrySchema),
11670
+ platformMatrix: z13.array(ReleasePlatformMatrixEntrySchema),
11629
11671
  /** Preflight summary from `cleo release plan`. */
11630
11672
  preflightSummary: ReleasePreflightSummarySchema,
11631
11673
  /** URL of the GHA workflow run (populated by `release-prepare.yml`). */
11632
- workflowRunUrl: z12.string().nullable(),
11674
+ workflowRunUrl: z13.string().nullable(),
11633
11675
  /** URL of the bump PR (populated by `cleo release open`). */
11634
- prUrl: z12.string().nullable(),
11676
+ prUrl: z13.string().nullable(),
11635
11677
  /** Merge commit SHA on `main` (populated by `release-publish.yml`). */
11636
- mergeCommitSha: z12.string().nullable(),
11678
+ mergeCommitSha: z13.string().nullable(),
11637
11679
  /** Current FSM state per R-302. */
11638
11680
  status: ReleaseStatusSchema,
11639
11681
  /** Informational / forward-compat metadata. */
@@ -11689,52 +11731,52 @@ var init_session2 = __esm({
11689
11731
  });
11690
11732
 
11691
11733
  // packages/contracts/src/session-journal.ts
11692
- import { z as z13 } from "zod";
11734
+ import { z as z14 } from "zod";
11693
11735
  var SESSION_JOURNAL_SCHEMA_VERSION, sessionJournalDoctorSummarySchema, sessionJournalDebriefSummarySchema, sessionJournalEntrySchema;
11694
11736
  var init_session_journal = __esm({
11695
11737
  "packages/contracts/src/session-journal.ts"() {
11696
11738
  "use strict";
11697
11739
  SESSION_JOURNAL_SCHEMA_VERSION = "1.0";
11698
- sessionJournalDoctorSummarySchema = z13.object({
11740
+ sessionJournalDoctorSummarySchema = z14.object({
11699
11741
  /** `true` when zero noise patterns were detected. */
11700
- isClean: z13.boolean(),
11742
+ isClean: z14.boolean(),
11701
11743
  /** Total number of noise findings across all patterns. */
11702
- findingsCount: z13.number().int().nonnegative(),
11744
+ findingsCount: z14.number().int().nonnegative(),
11703
11745
  /** Pattern names that were detected (empty when isClean). */
11704
- patterns: z13.array(z13.string()),
11746
+ patterns: z14.array(z14.string()),
11705
11747
  /** Total brain entries scanned. `0` = empty or unavailable. */
11706
- totalScanned: z13.number().int().nonnegative()
11748
+ totalScanned: z14.number().int().nonnegative()
11707
11749
  });
11708
- sessionJournalDebriefSummarySchema = z13.object({
11750
+ sessionJournalDebriefSummarySchema = z14.object({
11709
11751
  /** First 200 characters of the session end note (if provided). */
11710
- noteExcerpt: z13.string().max(200).optional(),
11752
+ noteExcerpt: z14.string().max(200).optional(),
11711
11753
  /** Number of tasks completed during the session. */
11712
- tasksCompletedCount: z13.number().int().nonnegative(),
11754
+ tasksCompletedCount: z14.number().int().nonnegative(),
11713
11755
  /** Up to 5 task IDs (not titles) that were the focus of the session. */
11714
- tasksFocused: z13.array(z13.string()).max(5).optional()
11756
+ tasksFocused: z14.array(z14.string()).max(5).optional()
11715
11757
  });
11716
- sessionJournalEntrySchema = z13.object({
11758
+ sessionJournalEntrySchema = z14.object({
11717
11759
  // Identity
11718
11760
  /** Schema version for forward-compatibility. Always `'1.0'` in this release. */
11719
- schemaVersion: z13.literal(SESSION_JOURNAL_SCHEMA_VERSION),
11761
+ schemaVersion: z14.literal(SESSION_JOURNAL_SCHEMA_VERSION),
11720
11762
  /** ISO 8601 timestamp when the entry was written. */
11721
- timestamp: z13.string(),
11763
+ timestamp: z14.string(),
11722
11764
  /** CLEO session ID (e.g. `ses_20260424055456_ede571`). */
11723
- sessionId: z13.string(),
11765
+ sessionId: z14.string(),
11724
11766
  /** Event type that triggered this journal entry. */
11725
- eventType: z13.enum(["session_start", "session_end", "observation", "decision", "error"]),
11767
+ eventType: z14.enum(["session_start", "session_end", "observation", "decision", "error"]),
11726
11768
  // Session metadata (set on session_start / session_end)
11727
11769
  /** Agent identifier (e.g. `cleo-prime`, `claude-code`). */
11728
- agentIdentifier: z13.string().optional(),
11770
+ agentIdentifier: z14.string().optional(),
11729
11771
  /** Provider adapter ID active for this session. */
11730
- providerId: z13.string().optional(),
11772
+ providerId: z14.string().optional(),
11731
11773
  /** Session scope string (e.g. `'global'` or `'epic:T1263'`). */
11732
- scope: z13.string().optional(),
11774
+ scope: z14.string().optional(),
11733
11775
  // Session-end fields
11734
11776
  /** Duration of the session in seconds (session_end only). */
11735
- duration: z13.number().int().nonnegative().optional(),
11777
+ duration: z14.number().int().nonnegative().optional(),
11736
11778
  /** Task IDs (not titles) completed during the session. */
11737
- tasksCompleted: z13.array(z13.string()).optional(),
11779
+ tasksCompleted: z14.array(z14.string()).optional(),
11738
11780
  // Doctor summary (T1262 absorbed)
11739
11781
  /** Compact result of `scanBrainNoise` run at session-end. */
11740
11782
  doctorSummary: sessionJournalDoctorSummarySchema.optional(),
@@ -11743,7 +11785,7 @@ var init_session_journal = __esm({
11743
11785
  debriefSummary: sessionJournalDebriefSummarySchema.optional(),
11744
11786
  // Optional hash chain
11745
11787
  /** SHA-256 hex of the previous entry's raw JSON string (for integrity chain). */
11746
- prevEntryHash: z13.string().optional()
11788
+ prevEntryHash: z14.string().optional()
11747
11789
  });
11748
11790
  }
11749
11791
  });
@@ -11756,52 +11798,52 @@ var init_task = __esm({
11756
11798
  });
11757
11799
 
11758
11800
  // packages/contracts/src/task-evidence.ts
11759
- import { z as z14 } from "zod";
11801
+ import { z as z15 } from "zod";
11760
11802
  var fileEvidenceSchema, logEvidenceSchema, screenshotEvidenceSchema, testOutputEvidenceSchema, commandOutputEvidenceSchema, taskEvidenceSchema;
11761
11803
  var init_task_evidence = __esm({
11762
11804
  "packages/contracts/src/task-evidence.ts"() {
11763
11805
  "use strict";
11764
- fileEvidenceSchema = z14.object({
11765
- kind: z14.literal("file"),
11766
- sha256: z14.string().length(64),
11767
- timestamp: z14.string().datetime(),
11768
- path: z14.string().min(1),
11769
- mime: z14.string().optional(),
11770
- description: z14.string().optional()
11806
+ fileEvidenceSchema = z15.object({
11807
+ kind: z15.literal("file"),
11808
+ sha256: z15.string().length(64),
11809
+ timestamp: z15.string().datetime(),
11810
+ path: z15.string().min(1),
11811
+ mime: z15.string().optional(),
11812
+ description: z15.string().optional()
11771
11813
  });
11772
- logEvidenceSchema = z14.object({
11773
- kind: z14.literal("log"),
11774
- sha256: z14.string().length(64),
11775
- timestamp: z14.string().datetime(),
11776
- source: z14.string().min(1),
11777
- description: z14.string().optional()
11814
+ logEvidenceSchema = z15.object({
11815
+ kind: z15.literal("log"),
11816
+ sha256: z15.string().length(64),
11817
+ timestamp: z15.string().datetime(),
11818
+ source: z15.string().min(1),
11819
+ description: z15.string().optional()
11778
11820
  });
11779
- screenshotEvidenceSchema = z14.object({
11780
- kind: z14.literal("screenshot"),
11781
- sha256: z14.string().length(64),
11782
- timestamp: z14.string().datetime(),
11783
- mime: z14.enum(["image/png", "image/jpeg", "image/webp"]).optional(),
11784
- description: z14.string().optional()
11821
+ screenshotEvidenceSchema = z15.object({
11822
+ kind: z15.literal("screenshot"),
11823
+ sha256: z15.string().length(64),
11824
+ timestamp: z15.string().datetime(),
11825
+ mime: z15.enum(["image/png", "image/jpeg", "image/webp"]).optional(),
11826
+ description: z15.string().optional()
11785
11827
  });
11786
- testOutputEvidenceSchema = z14.object({
11787
- kind: z14.literal("test-output"),
11788
- sha256: z14.string().length(64),
11789
- timestamp: z14.string().datetime(),
11790
- passed: z14.number().int().nonnegative(),
11791
- failed: z14.number().int().nonnegative(),
11792
- skipped: z14.number().int().nonnegative(),
11793
- exitCode: z14.number().int(),
11794
- description: z14.string().optional()
11828
+ testOutputEvidenceSchema = z15.object({
11829
+ kind: z15.literal("test-output"),
11830
+ sha256: z15.string().length(64),
11831
+ timestamp: z15.string().datetime(),
11832
+ passed: z15.number().int().nonnegative(),
11833
+ failed: z15.number().int().nonnegative(),
11834
+ skipped: z15.number().int().nonnegative(),
11835
+ exitCode: z15.number().int(),
11836
+ description: z15.string().optional()
11795
11837
  });
11796
- commandOutputEvidenceSchema = z14.object({
11797
- kind: z14.literal("command-output"),
11798
- sha256: z14.string().length(64),
11799
- timestamp: z14.string().datetime(),
11800
- cmd: z14.string().min(1),
11801
- exitCode: z14.number().int(),
11802
- description: z14.string().optional()
11838
+ commandOutputEvidenceSchema = z15.object({
11839
+ kind: z15.literal("command-output"),
11840
+ sha256: z15.string().length(64),
11841
+ timestamp: z15.string().datetime(),
11842
+ cmd: z15.string().min(1),
11843
+ exitCode: z15.number().int(),
11844
+ description: z15.string().optional()
11803
11845
  });
11804
- taskEvidenceSchema = z14.discriminatedUnion("kind", [
11846
+ taskEvidenceSchema = z15.discriminatedUnion("kind", [
11805
11847
  fileEvidenceSchema,
11806
11848
  logEvidenceSchema,
11807
11849
  screenshotEvidenceSchema,
@@ -11812,12 +11854,12 @@ var init_task_evidence = __esm({
11812
11854
  });
11813
11855
 
11814
11856
  // packages/contracts/src/tasks/archive.ts
11815
- import { z as z15 } from "zod";
11857
+ import { z as z16 } from "zod";
11816
11858
  var ArchiveReason, ARCHIVE_REASON_VALUES;
11817
11859
  var init_archive = __esm({
11818
11860
  "packages/contracts/src/tasks/archive.ts"() {
11819
11861
  "use strict";
11820
- ArchiveReason = z15.enum([
11862
+ ArchiveReason = z16.enum([
11821
11863
  "verified",
11822
11864
  "reconciled",
11823
11865
  "superseded",
@@ -11830,47 +11872,47 @@ var init_archive = __esm({
11830
11872
  });
11831
11873
 
11832
11874
  // packages/contracts/src/tasks.ts
11833
- import { z as z16 } from "zod";
11875
+ import { z as z17 } from "zod";
11834
11876
  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;
11835
11877
  var init_tasks2 = __esm({
11836
11878
  "packages/contracts/src/tasks.ts"() {
11837
11879
  "use strict";
11838
11880
  init_status_registry();
11839
- taskMutationWarningSeveritySchema = z16.enum(["info", "warning"]);
11840
- taskMutationWarningSchema = z16.object({
11841
- code: z16.string().min(1),
11842
- message: z16.string().min(1),
11881
+ taskMutationWarningSeveritySchema = z17.enum(["info", "warning"]);
11882
+ taskMutationWarningSchema = z17.object({
11883
+ code: z17.string().min(1),
11884
+ message: z17.string().min(1),
11843
11885
  severity: taskMutationWarningSeveritySchema.optional(),
11844
- taskId: z16.string().min(1).optional(),
11845
- field: z16.string().min(1).optional(),
11846
- index: z16.number().int().nonnegative().optional()
11886
+ taskId: z17.string().min(1).optional(),
11887
+ field: z17.string().min(1).optional(),
11888
+ index: z17.number().int().nonnegative().optional()
11847
11889
  });
11848
- taskMutationDryRunSummarySchema = z16.object({
11849
- dryRun: z16.literal(true),
11850
- wouldCreate: z16.number().int().nonnegative(),
11851
- wouldUpdate: z16.number().int().nonnegative(),
11852
- wouldDelete: z16.number().int().nonnegative(),
11853
- wouldAffect: z16.number().int().nonnegative(),
11854
- validatedCount: z16.number().int().nonnegative(),
11855
- insertedCount: z16.literal(0),
11856
- updatedCount: z16.literal(0),
11857
- deletedCount: z16.literal(0),
11858
- warnings: z16.array(taskMutationWarningSchema)
11890
+ taskMutationDryRunSummarySchema = z17.object({
11891
+ dryRun: z17.literal(true),
11892
+ wouldCreate: z17.number().int().nonnegative(),
11893
+ wouldUpdate: z17.number().int().nonnegative(),
11894
+ wouldDelete: z17.number().int().nonnegative(),
11895
+ wouldAffect: z17.number().int().nonnegative(),
11896
+ validatedCount: z17.number().int().nonnegative(),
11897
+ insertedCount: z17.literal(0),
11898
+ updatedCount: z17.literal(0),
11899
+ deletedCount: z17.literal(0),
11900
+ warnings: z17.array(taskMutationWarningSchema)
11859
11901
  });
11860
- taskMutationTaskRecordSchema = z16.object({ id: z16.string().min(1) }).passthrough();
11861
- taskMutationEnvelopeSchema = z16.object({
11862
- dryRun: z16.boolean().optional(),
11863
- created: z16.array(taskMutationTaskRecordSchema),
11864
- updated: z16.array(taskMutationTaskRecordSchema),
11865
- deleted: z16.array(taskMutationTaskRecordSchema),
11866
- affectedCount: z16.number().int().nonnegative(),
11867
- mutationWarnings: z16.array(taskMutationWarningSchema),
11902
+ taskMutationTaskRecordSchema = z17.object({ id: z17.string().min(1) }).passthrough();
11903
+ taskMutationEnvelopeSchema = z17.object({
11904
+ dryRun: z17.boolean().optional(),
11905
+ created: z17.array(taskMutationTaskRecordSchema),
11906
+ updated: z17.array(taskMutationTaskRecordSchema),
11907
+ deleted: z17.array(taskMutationTaskRecordSchema),
11908
+ affectedCount: z17.number().int().nonnegative(),
11909
+ mutationWarnings: z17.array(taskMutationWarningSchema),
11868
11910
  dryRunSummary: taskMutationDryRunSummarySchema.optional()
11869
11911
  });
11870
- completionTaskStatusSchema = z16.enum(TASK_STATUSES);
11871
- completionCriterionKindSchema = z16.enum(["text", "evidence_bound", "child_task"]);
11872
- completionCriterionStatusSchema = z16.enum(["satisfied", "unsatisfied", "waived", "replaced"]);
11873
- completionBlockerReasonSchema = z16.enum([
11912
+ completionTaskStatusSchema = z17.enum(TASK_STATUSES);
11913
+ completionCriterionKindSchema = z17.enum(["text", "evidence_bound", "child_task"]);
11914
+ completionCriterionStatusSchema = z17.enum(["satisfied", "unsatisfied", "waived", "replaced"]);
11915
+ completionBlockerReasonSchema = z17.enum([
11874
11916
  "missing_evidence_binding",
11875
11917
  "child_not_done",
11876
11918
  "child_cancelled_requires_waiver",
@@ -11878,68 +11920,68 @@ var init_tasks2 = __esm({
11878
11920
  "child_missing",
11879
11921
  "done_parent_stale"
11880
11922
  ]);
11881
- completionStaleReasonSchema = z16.enum(["done_parent_has_unsatisfied_criteria"]);
11882
- completionProjectionRepairErrorCodeSchema = z16.enum([
11923
+ completionStaleReasonSchema = z17.enum(["done_parent_has_unsatisfied_criteria"]);
11924
+ completionProjectionRepairErrorCodeSchema = z17.enum([
11883
11925
  "projection_not_stale",
11884
11926
  "criteria_missing",
11885
11927
  "binding_target_missing",
11886
11928
  "repair_conflict"
11887
11929
  ]);
11888
- completionCriterionWaiverSchema = z16.object({
11889
- criterionAcId: z16.string().min(1),
11890
- childTaskId: z16.string().min(1),
11891
- reason: z16.string().min(1),
11892
- actor: z16.string().min(1),
11893
- waivedAt: z16.string().min(1)
11930
+ completionCriterionWaiverSchema = z17.object({
11931
+ criterionAcId: z17.string().min(1),
11932
+ childTaskId: z17.string().min(1),
11933
+ reason: z17.string().min(1),
11934
+ actor: z17.string().min(1),
11935
+ waivedAt: z17.string().min(1)
11894
11936
  });
11895
- completionCriterionReplacementSchema = z16.object({
11896
- criterionAcId: z16.string().min(1),
11897
- originalChildTaskId: z16.string().min(1),
11898
- replacementChildTaskId: z16.string().min(1),
11899
- reason: z16.string().min(1),
11900
- actor: z16.string().min(1),
11901
- replacedAt: z16.string().min(1)
11937
+ completionCriterionReplacementSchema = z17.object({
11938
+ criterionAcId: z17.string().min(1),
11939
+ originalChildTaskId: z17.string().min(1),
11940
+ replacementChildTaskId: z17.string().min(1),
11941
+ reason: z17.string().min(1),
11942
+ actor: z17.string().min(1),
11943
+ replacedAt: z17.string().min(1)
11902
11944
  });
11903
- completionCriterionEvaluationSchema = z16.object({
11904
- acId: z16.string().min(1),
11905
- alias: z16.string().min(1),
11906
- text: z16.string(),
11945
+ completionCriterionEvaluationSchema = z17.object({
11946
+ acId: z17.string().min(1),
11947
+ alias: z17.string().min(1),
11948
+ text: z17.string(),
11907
11949
  kind: completionCriterionKindSchema,
11908
11950
  status: completionCriterionStatusSchema,
11909
11951
  reason: completionBlockerReasonSchema.optional(),
11910
- targetTaskId: z16.string().min(1).optional(),
11952
+ targetTaskId: z17.string().min(1).optional(),
11911
11953
  targetTaskStatus: completionTaskStatusSchema.optional(),
11912
11954
  waiver: completionCriterionWaiverSchema.optional(),
11913
11955
  replacement: completionCriterionReplacementSchema.optional(),
11914
11956
  replacementTaskStatus: completionTaskStatusSchema.optional(),
11915
- evidenceBindings: z16.number().int().nonnegative()
11957
+ evidenceBindings: z17.number().int().nonnegative()
11916
11958
  });
11917
11959
  unsatisfiedCompletionCriterionSchema = completionCriterionEvaluationSchema.extend({
11918
- status: z16.literal("unsatisfied"),
11960
+ status: z17.literal("unsatisfied"),
11919
11961
  reason: completionBlockerReasonSchema
11920
11962
  });
11921
- completionTotalsSchema = z16.object({
11922
- criteria: z16.number().int().nonnegative(),
11923
- satisfied: z16.number().int().nonnegative(),
11924
- unsatisfied: z16.number().int().nonnegative(),
11925
- waived: z16.number().int().nonnegative(),
11926
- replaced: z16.number().int().nonnegative()
11963
+ completionTotalsSchema = z17.object({
11964
+ criteria: z17.number().int().nonnegative(),
11965
+ satisfied: z17.number().int().nonnegative(),
11966
+ unsatisfied: z17.number().int().nonnegative(),
11967
+ waived: z17.number().int().nonnegative(),
11968
+ replaced: z17.number().int().nonnegative()
11927
11969
  });
11928
- completionContextPackSchema = z16.object({
11929
- taskId: z16.string().min(1),
11930
- generatedAt: z16.string().min(1),
11931
- source: z16.literal("audit_log"),
11932
- window: z16.object({
11933
- limit: z16.number().int().positive(),
11934
- since: z16.string().min(1).optional(),
11935
- relationDepth: z16.number().int().nonnegative(),
11936
- relatedTaskIds: z16.array(z16.string().min(1))
11970
+ completionContextPackSchema = z17.object({
11971
+ taskId: z17.string().min(1),
11972
+ generatedAt: z17.string().min(1),
11973
+ source: z17.literal("audit_log"),
11974
+ window: z17.object({
11975
+ limit: z17.number().int().positive(),
11976
+ since: z17.string().min(1).optional(),
11977
+ relationDepth: z17.number().int().nonnegative(),
11978
+ relatedTaskIds: z17.array(z17.string().min(1))
11937
11979
  }),
11938
- events: z16.array(
11939
- z16.object({
11940
- id: z16.string().min(1),
11941
- timestamp: z16.string().min(1),
11942
- action: z16.enum([
11980
+ events: z17.array(
11981
+ z17.object({
11982
+ id: z17.string().min(1),
11983
+ timestamp: z17.string().min(1),
11984
+ action: z17.enum([
11943
11985
  "task_completed",
11944
11986
  "task_reopened",
11945
11987
  "task_cancelled",
@@ -11947,77 +11989,77 @@ var init_tasks2 = __esm({
11947
11989
  "task_reparented",
11948
11990
  "ac_projection_rebuilt"
11949
11991
  ]),
11950
- taskId: z16.string().min(1),
11951
- relation: z16.enum(["self", "parent", "child", "sibling", "related"]),
11952
- actor: z16.string().min(1),
11953
- details: z16.record(z16.string(), z16.unknown()).optional(),
11954
- before: z16.record(z16.string(), z16.unknown()).optional(),
11955
- after: z16.record(z16.string(), z16.unknown()).optional()
11992
+ taskId: z17.string().min(1),
11993
+ relation: z17.enum(["self", "parent", "child", "sibling", "related"]),
11994
+ actor: z17.string().min(1),
11995
+ details: z17.record(z17.string(), z17.unknown()).optional(),
11996
+ before: z17.record(z17.string(), z17.unknown()).optional(),
11997
+ after: z17.record(z17.string(), z17.unknown()).optional()
11956
11998
  })
11957
11999
  ),
11958
- summary: z16.object({
11959
- totalEvents: z16.number().int().nonnegative(),
11960
- byAction: z16.record(z16.string(), z16.number().int().nonnegative()),
11961
- byRelation: z16.record(z16.string(), z16.number().int().nonnegative()),
11962
- latestEventAt: z16.string().nullable()
12000
+ summary: z17.object({
12001
+ totalEvents: z17.number().int().nonnegative(),
12002
+ byAction: z17.record(z17.string(), z17.number().int().nonnegative()),
12003
+ byRelation: z17.record(z17.string(), z17.number().int().nonnegative()),
12004
+ latestEventAt: z17.string().nullable()
11963
12005
  })
11964
12006
  });
11965
- completionEvaluationSchema = z16.object({
11966
- taskId: z16.string().min(1),
12007
+ completionEvaluationSchema = z17.object({
12008
+ taskId: z17.string().min(1),
11967
12009
  taskStatus: completionTaskStatusSchema,
11968
- ready: z16.boolean(),
11969
- stale: z16.boolean(),
11970
- staleReasons: z16.array(completionStaleReasonSchema),
12010
+ ready: z17.boolean(),
12011
+ stale: z17.boolean(),
12012
+ staleReasons: z17.array(completionStaleReasonSchema),
11971
12013
  contextPack: completionContextPackSchema.optional(),
11972
- satisfied: z16.array(completionCriterionEvaluationSchema),
11973
- unsatisfied: z16.array(unsatisfiedCompletionCriterionSchema),
11974
- waived: z16.array(completionCriterionEvaluationSchema),
11975
- replaced: z16.array(completionCriterionEvaluationSchema),
12014
+ satisfied: z17.array(completionCriterionEvaluationSchema),
12015
+ unsatisfied: z17.array(unsatisfiedCompletionCriterionSchema),
12016
+ waived: z17.array(completionCriterionEvaluationSchema),
12017
+ replaced: z17.array(completionCriterionEvaluationSchema),
11976
12018
  totals: completionTotalsSchema
11977
12019
  });
11978
- completionExplanationSchema = z16.object({
11979
- taskId: z16.string().min(1),
11980
- ready: z16.boolean(),
11981
- stale: z16.boolean(),
11982
- summary: z16.string(),
12020
+ completionExplanationSchema = z17.object({
12021
+ taskId: z17.string().min(1),
12022
+ ready: z17.boolean(),
12023
+ stale: z17.boolean(),
12024
+ summary: z17.string(),
11983
12025
  contextPack: completionContextPackSchema.optional(),
11984
- blockers: z16.array(completionCriterionEvaluationSchema)
12026
+ blockers: z17.array(completionCriterionEvaluationSchema)
11985
12027
  });
11986
- completionListParamsSchema = z16.object({
11987
- taskId: z16.string().min(1),
12028
+ completionListParamsSchema = z17.object({
12029
+ taskId: z17.string().min(1),
11988
12030
  status: completionCriterionStatusSchema.optional(),
11989
12031
  kind: completionCriterionKindSchema.optional()
11990
12032
  });
11991
- completionListResultSchema = z16.object({
11992
- taskId: z16.string().min(1),
11993
- criteria: z16.array(completionCriterionEvaluationSchema),
12033
+ completionListResultSchema = z17.object({
12034
+ taskId: z17.string().min(1),
12035
+ criteria: z17.array(completionCriterionEvaluationSchema),
11994
12036
  totals: completionTotalsSchema
11995
12037
  });
11996
- completionEvaluateParamsSchema = z16.object({
11997
- taskId: z16.string().min(1),
11998
- includeContext: z16.boolean().optional(),
11999
- limit: z16.number().int().positive().optional(),
12000
- since: z16.string().min(1).optional(),
12001
- relationDepth: z16.number().int().nonnegative().optional()
12038
+ completionEvaluateParamsSchema = z17.object({
12039
+ taskId: z17.string().min(1),
12040
+ includeContext: z17.boolean().optional(),
12041
+ limit: z17.number().int().positive().optional(),
12042
+ since: z17.string().min(1).optional(),
12043
+ relationDepth: z17.number().int().nonnegative().optional()
12002
12044
  });
12003
- completionProjectionRepairErrorSchema = z16.object({
12045
+ completionProjectionRepairErrorSchema = z17.object({
12004
12046
  code: completionProjectionRepairErrorCodeSchema,
12005
- message: z16.string().min(1),
12006
- taskId: z16.string().min(1),
12007
- acId: z16.string().min(1).optional(),
12008
- evidenceAtomId: z16.string().min(1).optional()
12047
+ message: z17.string().min(1),
12048
+ taskId: z17.string().min(1),
12049
+ acId: z17.string().min(1).optional(),
12050
+ evidenceAtomId: z17.string().min(1).optional()
12009
12051
  });
12010
- completionProjectionRepairParamsSchema = z16.object({
12011
- taskId: z16.string().min(1),
12012
- dryRun: z16.boolean().optional()
12052
+ completionProjectionRepairParamsSchema = z17.object({
12053
+ taskId: z17.string().min(1),
12054
+ dryRun: z17.boolean().optional()
12013
12055
  });
12014
- completionProjectionRepairResultSchema = z16.object({
12015
- taskId: z16.string().min(1),
12016
- repaired: z16.boolean(),
12017
- dryRun: z16.boolean(),
12018
- staleBefore: z16.boolean(),
12019
- staleAfter: z16.boolean(),
12020
- errors: z16.array(completionProjectionRepairErrorSchema)
12056
+ completionProjectionRepairResultSchema = z17.object({
12057
+ taskId: z17.string().min(1),
12058
+ repaired: z17.boolean(),
12059
+ dryRun: z17.boolean(),
12060
+ staleBefore: z17.boolean(),
12061
+ staleAfter: z17.boolean(),
12062
+ errors: z17.array(completionProjectionRepairErrorSchema)
12021
12063
  });
12022
12064
  }
12023
12065
  });
@@ -12528,7 +12570,7 @@ var init_taxonomy = __esm({
12528
12570
  });
12529
12571
 
12530
12572
  // packages/contracts/src/templates/manifest.ts
12531
- import { z as z17 } from "zod";
12573
+ import { z as z18 } from "zod";
12532
12574
  var TEMPLATE_KINDS, TEMPLATE_SUBSTITUTIONS, TEMPLATE_UPDATE_STRATEGIES, PLACEHOLDER_SOURCES, PlaceholderSpecSchema, TemplateManifestEntrySchema;
12533
12575
  var init_manifest2 = __esm({
12534
12576
  "packages/contracts/src/templates/manifest.ts"() {
@@ -12549,85 +12591,85 @@ var init_manifest2 = __esm({
12549
12591
  "tool-resolver",
12550
12592
  "literal"
12551
12593
  ];
12552
- PlaceholderSpecSchema = z17.object({
12594
+ PlaceholderSpecSchema = z18.object({
12553
12595
  /**
12554
12596
  * Placeholder identifier as it appears in the template body
12555
12597
  * (e.g. `NODE_VERSION` matches `{{NODE_VERSION}}`).
12556
12598
  */
12557
- name: z17.string().min(1, "placeholder name must be non-empty"),
12599
+ name: z18.string().min(1, "placeholder name must be non-empty"),
12558
12600
  /** Resolver source the installer consults for this placeholder. */
12559
- source: z17.enum(PLACEHOLDER_SOURCES),
12601
+ source: z18.enum(PLACEHOLDER_SOURCES),
12560
12602
  /**
12561
12603
  * Path expression evaluated against `source` (e.g. `engines.node` against
12562
12604
  * `project-context`, `defaults.branchModel` against `.cleo/config`).
12563
12605
  * For `literal` source, this MAY be the literal value's identifier.
12564
12606
  */
12565
- sourcePath: z17.string().min(1, "placeholder sourcePath must be non-empty"),
12607
+ sourcePath: z18.string().min(1, "placeholder sourcePath must be non-empty"),
12566
12608
  /**
12567
12609
  * Fallback value used when `source[sourcePath]` resolves to `undefined`.
12568
12610
  * `null` is permitted to explicitly mark "no default — failure required".
12569
12611
  */
12570
- defaultValue: z17.union([z17.string(), z17.number(), z17.boolean(), z17.null()]).optional()
12612
+ defaultValue: z18.union([z18.string(), z18.number(), z18.boolean(), z18.null()]).optional()
12571
12613
  });
12572
- TemplateManifestEntrySchema = z17.object({
12614
+ TemplateManifestEntrySchema = z18.object({
12573
12615
  /** Stable identifier for this template entry. */
12574
- id: z17.string().min(1, "id must be non-empty"),
12616
+ id: z18.string().min(1, "id must be non-empty"),
12575
12617
  /** Category of file this template represents. */
12576
- kind: z17.enum(TEMPLATE_KINDS),
12618
+ kind: z18.enum(TEMPLATE_KINDS),
12577
12619
  /** Repo-relative path of the template source file. */
12578
- sourcePath: z17.string().min(1, "sourcePath must be non-empty"),
12620
+ sourcePath: z18.string().min(1, "sourcePath must be non-empty"),
12579
12621
  /** Project-relative path where the rendered template installs. */
12580
- installPath: z17.string().min(1, "installPath must be non-empty"),
12622
+ installPath: z18.string().min(1, "installPath must be non-empty"),
12581
12623
  /** Substitution strategy the installer applies to `sourcePath`. */
12582
- substitution: z17.enum(TEMPLATE_SUBSTITUTIONS),
12624
+ substitution: z18.enum(TEMPLATE_SUBSTITUTIONS),
12583
12625
  /** Declared placeholders this template requires. May be empty. */
12584
- placeholders: z17.array(PlaceholderSpecSchema),
12626
+ placeholders: z18.array(PlaceholderSpecSchema),
12585
12627
  /** Reconciliation policy on upgrade. */
12586
- updateStrategy: z17.enum(TEMPLATE_UPDATE_STRATEGIES)
12628
+ updateStrategy: z18.enum(TEMPLATE_UPDATE_STRATEGIES)
12587
12629
  });
12588
12630
  }
12589
12631
  });
12590
12632
 
12591
12633
  // packages/contracts/src/validator/index.ts
12592
- import { z as z18 } from "zod";
12634
+ import { z as z19 } from "zod";
12593
12635
  var VALIDATOR_ID_REGEX, validatorFindingSchema, validatorAttestationSchema, validatorRejectionSchema, validatorVerdictSchema;
12594
12636
  var init_validator = __esm({
12595
12637
  "packages/contracts/src/validator/index.ts"() {
12596
12638
  "use strict";
12597
12639
  VALIDATOR_ID_REGEX = /^validator-[a-z0-9][a-z0-9-]*$/;
12598
- validatorFindingSchema = z18.object({
12599
- acId: z18.string().min(1, "acId must be non-empty"),
12600
- status: z18.enum(["pass", "fail", "inconclusive"]),
12601
- reasoning: z18.string().min(1, "reasoning must be non-empty"),
12602
- evidenceRefs: z18.array(z18.string()).optional(),
12603
- checkedAt: z18.string().min(1, "checkedAt must be a non-empty ISO-8601 string")
12640
+ validatorFindingSchema = z19.object({
12641
+ acId: z19.string().min(1, "acId must be non-empty"),
12642
+ status: z19.enum(["pass", "fail", "inconclusive"]),
12643
+ reasoning: z19.string().min(1, "reasoning must be non-empty"),
12644
+ evidenceRefs: z19.array(z19.string()).optional(),
12645
+ checkedAt: z19.string().min(1, "checkedAt must be a non-empty ISO-8601 string")
12604
12646
  });
12605
- validatorAttestationSchema = z18.object({
12606
- verdict: z18.literal("attest"),
12607
- taskId: z18.string().min(1),
12608
- validatorId: z18.string().regex(VALIDATOR_ID_REGEX, "validatorId must match the pattern validator-<discriminator>"),
12609
- findings: z18.array(validatorFindingSchema).min(1, "attestation must contain at least one finding").refine(
12647
+ validatorAttestationSchema = z19.object({
12648
+ verdict: z19.literal("attest"),
12649
+ taskId: z19.string().min(1),
12650
+ validatorId: z19.string().regex(VALIDATOR_ID_REGEX, "validatorId must match the pattern validator-<discriminator>"),
12651
+ findings: z19.array(validatorFindingSchema).min(1, "attestation must contain at least one finding").refine(
12610
12652
  (findings) => findings.every((f) => f.status === "pass"),
12611
12653
  'attestation requires every finding to have status="pass"'
12612
12654
  ),
12613
- summary: z18.string().optional(),
12614
- attestedAt: z18.string().min(1),
12615
- schemaVersion: z18.literal("1")
12655
+ summary: z19.string().optional(),
12656
+ attestedAt: z19.string().min(1),
12657
+ schemaVersion: z19.literal("1")
12616
12658
  });
12617
- validatorRejectionSchema = z18.object({
12618
- verdict: z18.literal("reject"),
12619
- taskId: z18.string().min(1),
12620
- validatorId: z18.string().regex(VALIDATOR_ID_REGEX, "validatorId must match the pattern validator-<discriminator>"),
12621
- findings: z18.array(validatorFindingSchema).min(1, "rejection must contain at least one finding").refine(
12659
+ validatorRejectionSchema = z19.object({
12660
+ verdict: z19.literal("reject"),
12661
+ taskId: z19.string().min(1),
12662
+ validatorId: z19.string().regex(VALIDATOR_ID_REGEX, "validatorId must match the pattern validator-<discriminator>"),
12663
+ findings: z19.array(validatorFindingSchema).min(1, "rejection must contain at least one finding").refine(
12622
12664
  (findings) => findings.some((f) => f.status !== "pass"),
12623
12665
  'rejection requires at least one finding with status "fail" or "inconclusive"'
12624
12666
  ),
12625
- summary: z18.string().min(1, "rejection summary must be non-empty"),
12626
- remediationHints: z18.array(z18.string()).optional(),
12627
- rejectedAt: z18.string().min(1),
12628
- schemaVersion: z18.literal("1")
12667
+ summary: z19.string().min(1, "rejection summary must be non-empty"),
12668
+ remediationHints: z19.array(z19.string()).optional(),
12669
+ rejectedAt: z19.string().min(1),
12670
+ schemaVersion: z19.literal("1")
12629
12671
  });
12630
- validatorVerdictSchema = z18.discriminatedUnion("verdict", [
12672
+ validatorVerdictSchema = z19.discriminatedUnion("verdict", [
12631
12673
  validatorAttestationSchema,
12632
12674
  validatorRejectionSchema
12633
12675
  ]);
@@ -12651,6 +12693,7 @@ var init_src = __esm({
12651
12693
  init_identity();
12652
12694
  init_operations_registry();
12653
12695
  init_provenance();
12696
+ init_read();
12654
12697
  init_docs_taxonomy();
12655
12698
  init_engine_result();
12656
12699
  init_enums();
@@ -14071,10 +14114,10 @@ var init_subquery = __esm({
14071
14114
  init_entity();
14072
14115
  Subquery = class {
14073
14116
  static [entityKind] = "Subquery";
14074
- constructor(sql31, fields, alias, isWith = false, usedTables = []) {
14117
+ constructor(sql32, fields, alias, isWith = false, usedTables = []) {
14075
14118
  this._ = {
14076
14119
  brand: "Subquery",
14077
- sql: sql31,
14120
+ sql: sql32,
14078
14121
  selectedFields: fields,
14079
14122
  alias,
14080
14123
  isWith,
@@ -14688,8 +14731,8 @@ var init_sql = __esm({
14688
14731
  isSelectionField = false;
14689
14732
  /** @internal */
14690
14733
  origin;
14691
- constructor(sql31, fieldAlias) {
14692
- this.sql = sql31;
14734
+ constructor(sql32, fieldAlias) {
14735
+ this.sql = sql32;
14693
14736
  this.fieldAlias = fieldAlias;
14694
14737
  }
14695
14738
  getSQL() {
@@ -16258,17 +16301,17 @@ var init_custom = __esm({
16258
16301
  mapFromJsonValue(value) {
16259
16302
  return typeof this.mapJson === "function" ? this.mapJson(value) : this.mapFromDriverValue(value);
16260
16303
  }
16261
- jsonSelectIdentifier(identifier, sql31) {
16262
- if (typeof this.forJsonSelect === "function") return this.forJsonSelect(identifier, sql31);
16304
+ jsonSelectIdentifier(identifier, sql32) {
16305
+ if (typeof this.forJsonSelect === "function") return this.forJsonSelect(identifier, sql32);
16263
16306
  const rawType = this.getSQLType().toLowerCase();
16264
16307
  const parenPos = rawType.indexOf("(");
16265
16308
  switch (parenPos + 1 ? rawType.slice(0, parenPos) : rawType) {
16266
16309
  case "numeric":
16267
16310
  case "decimal":
16268
16311
  case "bigint":
16269
- return sql31`cast(${identifier} as text)`;
16312
+ return sql32`cast(${identifier} as text)`;
16270
16313
  case "blob":
16271
- return sql31`hex(${identifier})`;
16314
+ return sql32`hex(${identifier})`;
16272
16315
  default:
16273
16316
  return identifier;
16274
16317
  }
@@ -20556,8 +20599,8 @@ var init_dialect = __esm({
20556
20599
  const returningSql = returning ? sql` returning ${this.buildSelection(returning, { isSingleTable: true })}` : void 0;
20557
20600
  return sql`${withSql}insert into ${table} ${insertOrder} ${valuesSql}${onConflict?.length ? sql.join(onConflict) : void 0}${returningSql}`;
20558
20601
  }
20559
- sqlToQuery(sql31, invokeSource) {
20560
- return sql31.toQuery({
20602
+ sqlToQuery(sql32, invokeSource) {
20603
+ return sql32.toQuery({
20561
20604
  escapeName: this.escapeName,
20562
20605
  escapeParam: this.escapeParam,
20563
20606
  escapeString: this.escapeString,
@@ -22074,8 +22117,8 @@ var init_db = __esm({
22074
22117
  });
22075
22118
 
22076
22119
  // node_modules/.pnpm/drizzle-orm@1.0.0-rc.3_@opentelemetry+api@1.9.0_@sinclair+typebox@0.34.49_@types+mssql@_e8baa2fb26279933413bcd023f31ad8f/node_modules/drizzle-orm/cache/core/cache.js
22077
- async function hashQuery(sql31, params) {
22078
- const dataToHash = `${sql31}-${JSON.stringify(params, (_, v) => typeof v === "bigint" ? `${v}n` : v)}`;
22120
+ async function hashQuery(sql32, params) {
22121
+ const dataToHash = `${sql32}-${JSON.stringify(params, (_, v) => typeof v === "bigint" ? `${v}n` : v)}`;
22079
22122
  const data = new TextEncoder().encode(dataToHash);
22080
22123
  const hashBuffer = await crypto.subtle.digest("SHA-256", data);
22081
22124
  return [...new Uint8Array(hashBuffer)].map((b) => b.toString(16).padStart(2, "0")).join("");
@@ -22254,8 +22297,8 @@ var init_session3 = __esm({
22254
22297
  values(query) {
22255
22298
  return this.prepareOneTimeQuery(this.dialect.sqlToQuery(query), void 0, "run").values();
22256
22299
  }
22257
- async count(sql31) {
22258
- return (await this.values(sql31))[0][0];
22300
+ async count(sql32) {
22301
+ return (await this.values(sql32))[0][0];
22259
22302
  }
22260
22303
  /** @internal */
22261
22304
  extractRawValuesValueFromBatchResult(_result) {
@@ -22516,6 +22559,48 @@ var init_logger2 = __esm({
22516
22559
  }
22517
22560
  });
22518
22561
 
22562
+ // packages/core/src/store/exodus/abort-events.ts
22563
+ var abort_events_exports = {};
22564
+ __export(abort_events_exports, {
22565
+ clearExodusAborts: () => clearExodusAborts,
22566
+ emitExodusAbort: () => emitExodusAbort,
22567
+ exodusAbortEvents: () => exodusAbortEvents,
22568
+ getRecordedExodusAbort: () => getRecordedExodusAbort
22569
+ });
22570
+ import { EventEmitter } from "node:events";
22571
+ function emitExodusAbort(detail) {
22572
+ _abortedScopes.set(detail.scope, detail);
22573
+ try {
22574
+ return exodusAbortEvents.emit("abort", detail);
22575
+ } catch {
22576
+ return false;
22577
+ }
22578
+ }
22579
+ function getRecordedExodusAbort(scope) {
22580
+ if (scope !== void 0) return _abortedScopes.get(scope);
22581
+ let latest;
22582
+ for (const detail of _abortedScopes.values()) {
22583
+ if (!latest || detail.at >= latest.at) latest = detail;
22584
+ }
22585
+ return latest;
22586
+ }
22587
+ function clearExodusAborts(scope) {
22588
+ if (scope !== void 0) {
22589
+ _abortedScopes.delete(scope);
22590
+ return;
22591
+ }
22592
+ _abortedScopes.clear();
22593
+ }
22594
+ var exodusAbortEvents, _abortedScopes;
22595
+ var init_abort_events = __esm({
22596
+ "packages/core/src/store/exodus/abort-events.ts"() {
22597
+ "use strict";
22598
+ exodusAbortEvents = new EventEmitter();
22599
+ exodusAbortEvents.setMaxListeners(50);
22600
+ _abortedScopes = /* @__PURE__ */ new Map();
22601
+ }
22602
+ });
22603
+
22519
22604
  // node_modules/.pnpm/drizzle-orm@1.0.0-rc.3_@opentelemetry+api@1.9.0_@sinclair+typebox@0.34.49_@types+mssql@_e8baa2fb26279933413bcd023f31ad8f/node_modules/drizzle-orm/migrator.js
22520
22605
  import crypto2 from "node:crypto";
22521
22606
  import fs, { existsSync, readdirSync } from "node:fs";
@@ -27101,7 +27186,8 @@ var init_conduit2 = __esm({
27101
27186
  });
27102
27187
 
27103
27188
  // packages/core/src/store/schema/attachments.ts
27104
- var ATTACHMENT_OWNER_TYPES, ATTACHMENT_LIFECYCLE_STATUSES, attachments, attachmentRefs;
27189
+ import { sql as sql11 } from "drizzle-orm";
27190
+ var ATTACHMENT_OWNER_TYPES, ATTACHMENT_LIFECYCLE_STATUSES, attachments, attachmentRefs, DOCS_WIKILINK_RELATIONS, docsWikilinks;
27105
27191
  var init_attachments = __esm({
27106
27192
  "packages/core/src/store/schema/attachments.ts"() {
27107
27193
  "use strict";
@@ -27270,11 +27356,38 @@ var init_attachments = __esm({
27270
27356
  index("idx_attachment_refs_owner").on(table.ownerType, table.ownerId)
27271
27357
  ]
27272
27358
  );
27359
+ DOCS_WIKILINK_RELATIONS = [
27360
+ "supersedes",
27361
+ "superseded-by",
27362
+ "related-task",
27363
+ "topic"
27364
+ ];
27365
+ docsWikilinks = sqliteTable(
27366
+ "docs_wikilinks",
27367
+ {
27368
+ /** Source doc slug (→ `attachments.slug`). Always a doc. */
27369
+ fromSlug: text("from_slug").notNull(),
27370
+ /** Target slug — a doc slug, or a `T####` task id when `toIsTask = 1`. */
27371
+ toSlug: text("to_slug").notNull(),
27372
+ /** Which provenance column produced this edge — dispatch-validated, no SQL CHECK. */
27373
+ relation: text("relation", { enum: DOCS_WIKILINK_RELATIONS }).notNull(),
27374
+ /** 1 when `to_slug` is a task id (`related-task` edges); 0 for doc→doc edges. */
27375
+ toIsTask: integer("to_is_task", { mode: "boolean" }).notNull().default(false),
27376
+ /** ISO-8601 UTC instant this edge was last (re)derived. */
27377
+ derivedAt: text("derived_at").notNull().default(sql11`(datetime('now'))`)
27378
+ },
27379
+ (table) => [
27380
+ primaryKey({ columns: [table.fromSlug, table.toSlug, table.relation] }),
27381
+ index("idx_docs_wikilinks_from").on(table.fromSlug),
27382
+ index("idx_docs_wikilinks_to").on(table.toSlug),
27383
+ index("idx_docs_wikilinks_relation").on(table.relation)
27384
+ ]
27385
+ );
27273
27386
  }
27274
27387
  });
27275
27388
 
27276
27389
  // packages/core/src/store/schema/cleo-project/docs.ts
27277
- import { sql as sql11 } from "drizzle-orm";
27390
+ import { sql as sql12 } from "drizzle-orm";
27278
27391
  var docsAttachments, docsAttachmentRefs, docsManifestEntries, docsPipelineManifest;
27279
27392
  var init_docs2 = __esm({
27280
27393
  "packages/core/src/store/schema/cleo-project/docs.ts"() {
@@ -27297,7 +27410,7 @@ var init_docs2 = __esm({
27297
27410
  */
27298
27411
  attachmentJson: text("attachment_json").notNull(),
27299
27412
  /** ISO-8601 UTC creation instant (canonical TEXT timestamp, §4). */
27300
- createdAt: text("created_at").notNull().default(sql11`(datetime('now'))`),
27413
+ createdAt: text("created_at").notNull().default(sql12`(datetime('now'))`),
27301
27414
  /** Number of `docs_attachment_refs` rows pointing here; GC-eligible at 0. */
27302
27415
  refCount: integer("ref_count").notNull().default(0),
27303
27416
  /** Optional human-friendly slug, unique per project. */
@@ -27382,7 +27495,7 @@ var init_docs2 = __esm({
27382
27495
  /** Agent identity (or `"human"`) that created the entry. */
27383
27496
  createdBy: text("created_by"),
27384
27497
  /** ISO-8601 UTC creation instant (canonical TEXT timestamp, §4). */
27385
- createdAt: text("created_at").notNull().default(sql11`(datetime('now'))`)
27498
+ createdAt: text("created_at").notNull().default(sql12`(datetime('now'))`)
27386
27499
  },
27387
27500
  (table) => [
27388
27501
  index("idx_docs_manifest_entries_pipeline_id").on(table.pipelineId),
@@ -27429,7 +27542,7 @@ var init_docs2 = __esm({
27429
27542
  /** Optional serialized metadata (TEXT per JSON audit). */
27430
27543
  metadataJson: text("metadata_json"),
27431
27544
  /** ISO-8601 UTC creation instant (canonical TEXT timestamp, §4). */
27432
- createdAt: text("created_at").notNull().default(sql11`(datetime('now'))`),
27545
+ createdAt: text("created_at").notNull().default(sql12`(datetime('now'))`),
27433
27546
  /** ISO-8601 UTC archival instant; NULL while active (canonical TEXT, §4). */
27434
27547
  archivedAt: text("archived_at")
27435
27548
  },
@@ -27445,7 +27558,7 @@ var init_docs2 = __esm({
27445
27558
  });
27446
27559
 
27447
27560
  // packages/core/src/store/schema/cleo-project/lifecycle.ts
27448
- import { sql as sql12 } from "drizzle-orm";
27561
+ import { sql as sql13 } from "drizzle-orm";
27449
27562
  var LIFECYCLE_VALIDATION_STATUSES, tasksLifecyclePipelines, tasksLifecycleStages, tasksLifecycleGateResults, tasksLifecycleEvidence, tasksLifecycleTransitions;
27450
27563
  var init_lifecycle3 = __esm({
27451
27564
  "packages/core/src/store/schema/cleo-project/lifecycle.ts"() {
@@ -27472,11 +27585,11 @@ var init_lifecycle3 = __esm({
27472
27585
  /** Current stage id pointer. */
27473
27586
  currentStageId: text("current_stage_id"),
27474
27587
  /** ISO-8601 UTC start instant (canonical TEXT, §4). */
27475
- startedAt: text("started_at").notNull().default(sql12`(datetime('now'))`),
27588
+ startedAt: text("started_at").notNull().default(sql13`(datetime('now'))`),
27476
27589
  /** ISO-8601 UTC completion instant; NULL while active (canonical TEXT, §4). */
27477
27590
  completedAt: text("completed_at"),
27478
27591
  /** ISO-8601 UTC last-update instant (canonical TEXT, §4). */
27479
- updatedAt: text("updated_at").default(sql12`(datetime('now'))`),
27592
+ updatedAt: text("updated_at").default(sql13`(datetime('now'))`),
27480
27593
  /** Optimistic-concurrency version counter. */
27481
27594
  version: integer("version").notNull().default(1)
27482
27595
  },
@@ -27546,7 +27659,7 @@ var init_lifecycle3 = __esm({
27546
27659
  /** Result — CHECK-backed via {@link LIFECYCLE_GATE_RESULTS}. */
27547
27660
  result: text("result", { enum: LIFECYCLE_GATE_RESULTS }).notNull(),
27548
27661
  /** ISO-8601 UTC check instant (canonical TEXT, §4). */
27549
- checkedAt: text("checked_at").notNull().default(sql12`(datetime('now'))`),
27662
+ checkedAt: text("checked_at").notNull().default(sql13`(datetime('now'))`),
27550
27663
  /** Checker identity. */
27551
27664
  checkedBy: text("checked_by").notNull(),
27552
27665
  /** Optional detail payload. */
@@ -27568,7 +27681,7 @@ var init_lifecycle3 = __esm({
27568
27681
  /** Evidence type — CHECK-backed via {@link LIFECYCLE_EVIDENCE_TYPES}. */
27569
27682
  type: text("type", { enum: LIFECYCLE_EVIDENCE_TYPES }).notNull(),
27570
27683
  /** ISO-8601 UTC record instant (canonical TEXT, §4). */
27571
- recordedAt: text("recorded_at").notNull().default(sql12`(datetime('now'))`),
27684
+ recordedAt: text("recorded_at").notNull().default(sql13`(datetime('now'))`),
27572
27685
  /** Recorder identity. */
27573
27686
  recordedBy: text("recorded_by"),
27574
27687
  /** Optional description. */
@@ -27592,7 +27705,7 @@ var init_lifecycle3 = __esm({
27592
27705
  /** Actor identity. */
27593
27706
  transitionedBy: text("transitioned_by"),
27594
27707
  /** ISO-8601 UTC creation instant (canonical TEXT, §4). */
27595
- createdAt: text("created_at").notNull().default(sql12`(datetime('now'))`)
27708
+ createdAt: text("created_at").notNull().default(sql13`(datetime('now'))`)
27596
27709
  },
27597
27710
  (table) => [index("idx_tasks_lifecycle_transitions_pipeline_id").on(table.pipelineId)]
27598
27711
  );
@@ -27600,7 +27713,7 @@ var init_lifecycle3 = __esm({
27600
27713
  });
27601
27714
 
27602
27715
  // packages/core/src/store/schema/cleo-project/nexus-graph.ts
27603
- import { sql as sql13 } from "drizzle-orm";
27716
+ import { sql as sql14 } from "drizzle-orm";
27604
27717
  var NEXUS_NODE_KINDS, NEXUS_RELATION_TYPES, NEXUS_CONTRACT_TYPES, CODE_INDEX_KINDS, nexusNodes, nexusRelations, nexusRelationWeights, nexusContracts, nexusCodeIndex;
27605
27718
  var init_nexus_graph = __esm({
27606
27719
  "packages/core/src/store/schema/cleo-project/nexus-graph.ts"() {
@@ -27740,7 +27853,7 @@ var init_nexus_graph = __esm({
27740
27853
  /** Whether this node is an external/unresolved module (E10 §3a — typed boolean). */
27741
27854
  isExternal: integer("is_external", { mode: "boolean" }).notNull().default(false),
27742
27855
  /** ISO-8601 UTC last-indexed instant (canonical TEXT, §4). */
27743
- indexedAt: text("indexed_at").notNull().default(sql13`(datetime('now'))`)
27856
+ indexedAt: text("indexed_at").notNull().default(sql14`(datetime('now'))`)
27744
27857
  },
27745
27858
  (table) => [
27746
27859
  index("idx_nexus_nodes_kind").on(table.kind),
@@ -27770,7 +27883,7 @@ var init_nexus_graph = __esm({
27770
27883
  /** Step index within an execution flow (for step_in_process relations). */
27771
27884
  step: integer("step"),
27772
27885
  /** ISO-8601 UTC last-indexed instant (canonical TEXT, §4). */
27773
- indexedAt: text("indexed_at").notNull().default(sql13`(datetime('now'))`)
27886
+ indexedAt: text("indexed_at").notNull().default(sql14`(datetime('now'))`)
27774
27887
  // T998 plasticity columns (`weight`, `last_accessed_at`, `co_accessed_count`)
27775
27888
  // PARTITIONED out into the sibling `nexus_relation_weights` table by T11545
27776
27889
  // (ADR-090 §5.3). See {@link nexusRelationWeights}.
@@ -27825,9 +27938,9 @@ var init_nexus_graph = __esm({
27825
27938
  /** Human-readable description. */
27826
27939
  description: text("description"),
27827
27940
  /** ISO-8601 UTC creation instant (canonical TEXT, §4). */
27828
- createdAt: text("created_at").notNull().default(sql13`(datetime('now'))`),
27941
+ createdAt: text("created_at").notNull().default(sql14`(datetime('now'))`),
27829
27942
  /** ISO-8601 UTC last-update instant (canonical TEXT, §4). */
27830
- updatedAt: text("updated_at").notNull().default(sql13`(datetime('now'))`)
27943
+ updatedAt: text("updated_at").notNull().default(sql14`(datetime('now'))`)
27831
27944
  },
27832
27945
  (table) => [
27833
27946
  index("idx_nexus_contracts_type").on(table.type),
@@ -27875,7 +27988,7 @@ var init_nexus_graph = __esm({
27875
27988
  });
27876
27989
 
27877
27990
  // packages/core/src/store/schema/provenance/commits.ts
27878
- import { sql as sql14 } from "drizzle-orm";
27991
+ import { sql as sql15 } from "drizzle-orm";
27879
27992
  var COMMIT_CONVENTIONAL_TYPES, COMMIT_LINK_KINDS, COMMIT_LINK_SOURCES, COMMIT_FILE_CHANGE_TYPES, commits, taskCommits, commitFiles;
27880
27993
  var init_commits = __esm({
27881
27994
  "packages/core/src/store/schema/provenance/commits.ts"() {
@@ -27957,7 +28070,7 @@ var init_commits = __esm({
27957
28070
  */
27958
28071
  projectHash: text("project_hash"),
27959
28072
  /** ISO-8601 timestamp when this row was inserted into tasks.db. */
27960
- createdAt: text("created_at").notNull().default(sql14`(datetime('now'))`)
28073
+ createdAt: text("created_at").notNull().default(sql15`(datetime('now'))`)
27961
28074
  },
27962
28075
  (table) => [
27963
28076
  index("idx_commits_short_sha").on(table.shortSha),
@@ -27989,7 +28102,7 @@ var init_commits = __esm({
27989
28102
  */
27990
28103
  linkSource: text("link_source").notNull(),
27991
28104
  /** ISO-8601 timestamp when this link was created. */
27992
- createdAt: text("created_at").notNull().default(sql14`(datetime('now'))`)
28105
+ createdAt: text("created_at").notNull().default(sql15`(datetime('now'))`)
27993
28106
  },
27994
28107
  (table) => [
27995
28108
  primaryKey({ columns: [table.taskId, table.commitSha, table.linkKind] }),
@@ -28032,7 +28145,7 @@ var init_commits = __esm({
28032
28145
  });
28033
28146
 
28034
28147
  // packages/core/src/store/schema/cleo-project/provenance-commits.ts
28035
- import { sql as sql15 } from "drizzle-orm";
28148
+ import { sql as sql16 } from "drizzle-orm";
28036
28149
  var tasksCommits, tasksTaskCommits, tasksCommitFiles;
28037
28150
  var init_provenance_commits = __esm({
28038
28151
  "packages/core/src/store/schema/cleo-project/provenance-commits.ts"() {
@@ -28090,7 +28203,7 @@ var init_provenance_commits = __esm({
28090
28203
  /** Project hash correlating commits to a specific CLEO project. */
28091
28204
  projectHash: text("project_hash"),
28092
28205
  /** ISO-8601 UTC insertion instant (canonical TEXT timestamp, §4). */
28093
- createdAt: text("created_at").notNull().default(sql15`(datetime('now'))`)
28206
+ createdAt: text("created_at").notNull().default(sql16`(datetime('now'))`)
28094
28207
  },
28095
28208
  (table) => [
28096
28209
  index("idx_tasks_commits_short_sha").on(table.shortSha),
@@ -28113,7 +28226,7 @@ var init_provenance_commits = __esm({
28113
28226
  /** How this link was discovered — E10 §5b CHECK-backed. */
28114
28227
  linkSource: text("link_source", { enum: COMMIT_LINK_SOURCES }).notNull(),
28115
28228
  /** ISO-8601 UTC link-creation instant (canonical TEXT timestamp, §4). */
28116
- createdAt: text("created_at").notNull().default(sql15`(datetime('now'))`)
28229
+ createdAt: text("created_at").notNull().default(sql16`(datetime('now'))`)
28117
28230
  },
28118
28231
  (table) => [
28119
28232
  primaryKey({ columns: [table.taskId, table.commitSha, table.linkKind] }),
@@ -28150,7 +28263,7 @@ var init_provenance_commits = __esm({
28150
28263
  });
28151
28264
 
28152
28265
  // packages/core/src/store/schema/cleo-project/provenance-orphans.ts
28153
- import { sql as sql16 } from "drizzle-orm";
28266
+ import { sql as sql17 } from "drizzle-orm";
28154
28267
  var BRAIN_RELEASE_LINK_TYPES_CONSOLIDATED, tasksAgentCredentials, tasksBrainReleaseLinks;
28155
28268
  var init_provenance_orphans = __esm({
28156
28269
  "packages/core/src/store/schema/cleo-project/provenance-orphans.ts"() {
@@ -28188,9 +28301,9 @@ var init_provenance_orphans = __esm({
28188
28301
  /** Unix epoch of most recent use (milliseconds). Null = never used. */
28189
28302
  lastUsedAt: integer("last_used_at"),
28190
28303
  /** Unix epoch when this credential was created (milliseconds). */
28191
- createdAt: integer("created_at").notNull().default(sql16`(unixepoch())`),
28304
+ createdAt: integer("created_at").notNull().default(sql17`(unixepoch())`),
28192
28305
  /** Unix epoch when this credential was last updated (milliseconds). */
28193
- updatedAt: integer("updated_at").notNull().default(sql16`(unixepoch())`)
28306
+ updatedAt: integer("updated_at").notNull().default(sql17`(unixepoch())`)
28194
28307
  },
28195
28308
  (table) => [
28196
28309
  index("idx_tasks_agent_cred_active").on(table.isActive),
@@ -28210,7 +28323,7 @@ var init_provenance_orphans = __esm({
28210
28323
  /** Semantic relationship type. */
28211
28324
  linkType: text("link_type", { enum: BRAIN_RELEASE_LINK_TYPES_CONSOLIDATED }).notNull(),
28212
28325
  /** ISO-8601 timestamp when this link was created. */
28213
- createdAt: text("created_at").notNull().default(sql16`(datetime('now'))`),
28326
+ createdAt: text("created_at").notNull().default(sql17`(datetime('now'))`),
28214
28327
  /** Identity of the agent or user that created this link. */
28215
28328
  createdBy: text("created_by")
28216
28329
  },
@@ -28225,7 +28338,7 @@ var init_provenance_orphans = __esm({
28225
28338
  });
28226
28339
 
28227
28340
  // packages/core/src/store/schema/provenance/pull-requests.ts
28228
- import { sql as sql17 } from "drizzle-orm";
28341
+ import { sql as sql18 } from "drizzle-orm";
28229
28342
  var PR_STATES, PR_LINK_SOURCES, PR_LINK_KINDS, pullRequests, prCommits, prTasks;
28230
28343
  var init_pull_requests = __esm({
28231
28344
  "packages/core/src/store/schema/provenance/pull-requests.ts"() {
@@ -28304,9 +28417,9 @@ var init_pull_requests = __esm({
28304
28417
  */
28305
28418
  projectHash: text("project_hash"),
28306
28419
  /** ISO-8601 timestamp when this row was first inserted into tasks.db. */
28307
- createdAt: text("created_at").notNull().default(sql17`(datetime('now'))`),
28420
+ createdAt: text("created_at").notNull().default(sql18`(datetime('now'))`),
28308
28421
  /** ISO-8601 timestamp of the last update to this row. */
28309
- updatedAt: text("updated_at").notNull().default(sql17`(datetime('now'))`)
28422
+ updatedAt: text("updated_at").notNull().default(sql18`(datetime('now'))`)
28310
28423
  },
28311
28424
  (table) => [
28312
28425
  index("idx_pr_number").on(table.prNumber),
@@ -28353,7 +28466,7 @@ var init_pull_requests = __esm({
28353
28466
  */
28354
28467
  linkKind: text("link_kind").notNull(),
28355
28468
  /** ISO-8601 timestamp when this link was created. */
28356
- createdAt: text("created_at").notNull().default(sql17`(datetime('now'))`)
28469
+ createdAt: text("created_at").notNull().default(sql18`(datetime('now'))`)
28357
28470
  },
28358
28471
  (table) => [
28359
28472
  primaryKey({ columns: [table.prId, table.taskId, table.linkKind] }),
@@ -28366,7 +28479,7 @@ var init_pull_requests = __esm({
28366
28479
  });
28367
28480
 
28368
28481
  // packages/core/src/store/schema/provenance/releases.ts
28369
- import { sql as sql18 } from "drizzle-orm";
28482
+ import { sql as sql19 } from "drizzle-orm";
28370
28483
  var RELEASE_SCHEMES, RELEASE_CHANNELS, RELEASE_KINDS, RELEASE_STATUSES, RELEASE_CHANGE_TYPES, RELEASE_IMPACTS, RELEASE_CLASSIFIED_BY, RELEASE_ARTIFACT_TYPES, BRAIN_RELEASE_LINK_TYPES, releases, releaseCommits, releaseChanges, releaseChangesets, releaseArtifacts, brainReleaseLinks;
28371
28484
  var init_releases = __esm({
28372
28485
  "packages/core/src/store/schema/provenance/releases.ts"() {
@@ -28476,7 +28589,7 @@ var init_releases = __esm({
28476
28589
  /** URL of the GitHub Actions workflow run that built and published this release. */
28477
28590
  workflowRunUrl: text("workflow_run_url"),
28478
28591
  /** ISO-8601 timestamp when this row was inserted. */
28479
- createdAt: text("created_at").notNull().default(sql18`(datetime('now'))`),
28592
+ createdAt: text("created_at").notNull().default(sql19`(datetime('now'))`),
28480
28593
  /** ISO-8601 timestamp when `cleo release plan` created the plan (new pipeline). */
28481
28594
  plannedAt: text("planned_at"),
28482
28595
  /** ISO-8601 timestamp when the bump-PR was opened (new pipeline). */
@@ -28598,7 +28711,7 @@ var init_releases = __esm({
28598
28711
  */
28599
28712
  classifiedBy: text("classified_by", { enum: RELEASE_CLASSIFIED_BY }).notNull().default("auto"),
28600
28713
  /** ISO-8601 timestamp when this change was classified. */
28601
- classifiedAt: text("classified_at").notNull().default(sql18`(datetime('now'))`)
28714
+ classifiedAt: text("classified_at").notNull().default(sql19`(datetime('now'))`)
28602
28715
  },
28603
28716
  (table) => [
28604
28717
  index("idx_release_changes_release_id").on(table.releaseId),
@@ -28629,7 +28742,7 @@ var init_releases = __esm({
28629
28742
  /** Migration note when `kind = 'breaking'`, nullable. */
28630
28743
  breaking: text("breaking"),
28631
28744
  /** ISO-8601 timestamp when this row was inserted. */
28632
- createdAt: text("created_at").notNull().default(sql18`(datetime('now'))`)
28745
+ createdAt: text("created_at").notNull().default(sql19`(datetime('now'))`)
28633
28746
  },
28634
28747
  (table) => [
28635
28748
  index("release_changesets_release_id_idx").on(table.releaseId),
@@ -28684,7 +28797,7 @@ var init_releases = __esm({
28684
28797
  */
28685
28798
  linkType: text("link_type", { enum: BRAIN_RELEASE_LINK_TYPES }).notNull(),
28686
28799
  /** ISO-8601 timestamp when this link was created. */
28687
- createdAt: text("created_at").notNull().default(sql18`(datetime('now'))`),
28800
+ createdAt: text("created_at").notNull().default(sql19`(datetime('now'))`),
28688
28801
  /** Identifier of the agent or user that created this link. Nullable. */
28689
28802
  createdBy: text("created_by")
28690
28803
  },
@@ -28699,7 +28812,7 @@ var init_releases = __esm({
28699
28812
  });
28700
28813
 
28701
28814
  // packages/core/src/store/schema/cleo-project/provenance-rest.ts
28702
- import { sql as sql19 } from "drizzle-orm";
28815
+ import { sql as sql20 } from "drizzle-orm";
28703
28816
  var tasksPullRequests, tasksPrCommits, tasksPrTasks, tasksReleases, tasksReleaseCommits, tasksReleaseChanges, tasksReleaseChangesets, tasksReleaseArtifacts;
28704
28817
  var init_provenance_rest = __esm({
28705
28818
  "packages/core/src/store/schema/cleo-project/provenance-rest.ts"() {
@@ -28748,9 +28861,9 @@ var init_provenance_rest = __esm({
28748
28861
  /** Project correlation hash. */
28749
28862
  projectHash: text("project_hash"),
28750
28863
  /** ISO-8601 UTC creation instant (canonical TEXT, §4). */
28751
- createdAt: text("created_at").notNull().default(sql19`(datetime('now'))`),
28864
+ createdAt: text("created_at").notNull().default(sql20`(datetime('now'))`),
28752
28865
  /** ISO-8601 UTC last-update instant (canonical TEXT, §4). */
28753
- updatedAt: text("updated_at").notNull().default(sql19`(datetime('now'))`)
28866
+ updatedAt: text("updated_at").notNull().default(sql20`(datetime('now'))`)
28754
28867
  },
28755
28868
  (table) => [
28756
28869
  index("idx_tasks_pull_requests_pr_number").on(table.prNumber),
@@ -28790,7 +28903,7 @@ var init_provenance_rest = __esm({
28790
28903
  /** Relationship classification — E10 §5b CHECK-backed via {@link PR_LINK_KINDS}. */
28791
28904
  linkKind: text("link_kind", { enum: PR_LINK_KINDS }).notNull(),
28792
28905
  /** ISO-8601 UTC creation instant (canonical TEXT, §4). */
28793
- createdAt: text("created_at").notNull().default(sql19`(datetime('now'))`)
28906
+ createdAt: text("created_at").notNull().default(sql20`(datetime('now'))`)
28794
28907
  },
28795
28908
  (table) => [
28796
28909
  primaryKey({ columns: [table.prId, table.taskId, table.linkKind] }),
@@ -28825,7 +28938,7 @@ var init_provenance_rest = __esm({
28825
28938
  /** GitHub Actions workflow run URL. */
28826
28939
  workflowRunUrl: text("workflow_run_url"),
28827
28940
  /** ISO-8601 UTC creation instant (canonical TEXT, §4). */
28828
- createdAt: text("created_at").notNull().default(sql19`(datetime('now'))`),
28941
+ createdAt: text("created_at").notNull().default(sql20`(datetime('now'))`),
28829
28942
  /** ISO-8601 UTC planned instant (canonical TEXT, §4). */
28830
28943
  plannedAt: text("planned_at"),
28831
28944
  /** ISO-8601 UTC PR-opened instant (canonical TEXT, §4). */
@@ -28919,7 +29032,7 @@ var init_provenance_rest = __esm({
28919
29032
  /** Classification provenance — CHECK-backed via {@link RELEASE_CLASSIFIED_BY}. */
28920
29033
  classifiedBy: text("classified_by", { enum: RELEASE_CLASSIFIED_BY }).notNull().default("auto"),
28921
29034
  /** ISO-8601 UTC classification instant (canonical TEXT, §4). */
28922
- classifiedAt: text("classified_at").notNull().default(sql19`(datetime('now'))`)
29035
+ classifiedAt: text("classified_at").notNull().default(sql20`(datetime('now'))`)
28923
29036
  },
28924
29037
  (table) => [
28925
29038
  index("idx_tasks_release_changes_release_id").on(table.releaseId),
@@ -28950,7 +29063,7 @@ var init_provenance_rest = __esm({
28950
29063
  /** Breaking-change migration note. */
28951
29064
  breaking: text("breaking"),
28952
29065
  /** ISO-8601 UTC creation instant (canonical TEXT, §4). */
28953
- createdAt: text("created_at").notNull().default(sql19`(datetime('now'))`)
29066
+ createdAt: text("created_at").notNull().default(sql20`(datetime('now'))`)
28954
29067
  },
28955
29068
  (table) => [
28956
29069
  index("idx_tasks_release_changesets_release_id").on(table.releaseId),
@@ -28987,7 +29100,7 @@ var init_provenance_rest = __esm({
28987
29100
  });
28988
29101
 
28989
29102
  // packages/core/src/store/schema/agent-schema.ts
28990
- import { sql as sql20 } from "drizzle-orm";
29103
+ import { sql as sql21 } from "drizzle-orm";
28991
29104
  var AGENT_INSTANCE_STATUSES2, AGENT_TYPES2, agentInstances, agentErrorLog;
28992
29105
  var init_agent_schema = __esm({
28993
29106
  "packages/core/src/store/schema/agent-schema.ts"() {
@@ -29024,8 +29137,8 @@ var init_agent_schema = __esm({
29024
29137
  // cross-db-annotation-ok: intra-DB FK to tasks.sessions.id (no .references() because the row may pre-date the session being created)
29025
29138
  taskId: text("task_id"),
29026
29139
  // cross-db-annotation-ok: intra-DB FK to tasks.tasks.id (no .references() because agent may not be bound to any task)
29027
- startedAt: text("started_at").notNull().default(sql20`(datetime('now'))`),
29028
- lastHeartbeat: text("last_heartbeat").notNull().default(sql20`(datetime('now'))`),
29140
+ startedAt: text("started_at").notNull().default(sql21`(datetime('now'))`),
29141
+ lastHeartbeat: text("last_heartbeat").notNull().default(sql21`(datetime('now'))`),
29029
29142
  stoppedAt: text("stopped_at"),
29030
29143
  errorCount: integer("error_count").notNull().default(0),
29031
29144
  totalTasksCompleted: integer("total_tasks_completed").notNull().default(0),
@@ -29054,7 +29167,7 @@ var init_agent_schema = __esm({
29054
29167
  }).notNull(),
29055
29168
  message: text("message").notNull(),
29056
29169
  stack: text("stack"),
29057
- occurredAt: text("occurred_at").notNull().default(sql20`(datetime('now'))`),
29170
+ occurredAt: text("occurred_at").notNull().default(sql21`(datetime('now'))`),
29058
29171
  resolved: integer("resolved", { mode: "boolean" }).notNull().default(false)
29059
29172
  },
29060
29173
  (table) => [
@@ -29067,7 +29180,7 @@ var init_agent_schema = __esm({
29067
29180
  });
29068
29181
 
29069
29182
  // packages/core/src/store/schema/chain-schema.ts
29070
- import { sql as sql21 } from "drizzle-orm";
29183
+ import { sql as sql22 } from "drizzle-orm";
29071
29184
  var WARP_CHAIN_INSTANCE_STATUSES, warpChains, warpChainInstances;
29072
29185
  var init_chain_schema = __esm({
29073
29186
  "packages/core/src/store/schema/chain-schema.ts"() {
@@ -29090,8 +29203,8 @@ var init_chain_schema = __esm({
29090
29203
  definition: text("definition").notNull(),
29091
29204
  // JSON-serialized WarpChain
29092
29205
  validated: integer("validated", { mode: "boolean" }).default(false),
29093
- createdAt: text("created_at").default(sql21`(datetime('now'))`),
29094
- updatedAt: text("updated_at").default(sql21`(datetime('now'))`)
29206
+ createdAt: text("created_at").default(sql22`(datetime('now'))`),
29207
+ updatedAt: text("updated_at").default(sql22`(datetime('now'))`)
29095
29208
  },
29096
29209
  (table) => [index("idx_warp_chains_name").on(table.name)]
29097
29210
  );
@@ -29109,8 +29222,8 @@ var init_chain_schema = __esm({
29109
29222
  currentStage: text("current_stage"),
29110
29223
  gateResults: text("gate_results"),
29111
29224
  // JSON array of GateResult
29112
- createdAt: text("created_at").default(sql21`(datetime('now'))`),
29113
- updatedAt: text("updated_at").default(sql21`(datetime('now'))`)
29225
+ createdAt: text("created_at").default(sql22`(datetime('now'))`),
29226
+ updatedAt: text("updated_at").default(sql22`(datetime('now'))`)
29114
29227
  },
29115
29228
  (table) => [
29116
29229
  index("idx_warp_instances_chain").on(table.chainId),
@@ -29122,7 +29235,7 @@ var init_chain_schema = __esm({
29122
29235
  });
29123
29236
 
29124
29237
  // packages/core/src/store/schema/cleo-project/runtime.ts
29125
- import { sql as sql22 } from "drizzle-orm";
29238
+ import { sql as sql23 } from "drizzle-orm";
29126
29239
  var AGENT_ERROR_TYPES, PLAYBOOK_RUN_STATUSES, PLAYBOOK_APPROVAL_STATUSES, tasksWarpChains, tasksWarpChainInstances, tasksAgentInstances, tasksAgentErrorLog, tasksPlaybookRuns, tasksPlaybookApprovals;
29127
29240
  var init_runtime = __esm({
29128
29241
  "packages/core/src/store/schema/cleo-project/runtime.ts"() {
@@ -29159,9 +29272,9 @@ var init_runtime = __esm({
29159
29272
  /** Whether the definition validated. §3a boolean — already typed, preserved. */
29160
29273
  validated: integer("validated", { mode: "boolean" }).default(false),
29161
29274
  /** ISO-8601 UTC creation instant (canonical TEXT, §4). */
29162
- createdAt: text("created_at").default(sql22`(datetime('now'))`),
29275
+ createdAt: text("created_at").default(sql23`(datetime('now'))`),
29163
29276
  /** ISO-8601 UTC last-update instant (canonical TEXT, §4). */
29164
- updatedAt: text("updated_at").default(sql22`(datetime('now'))`)
29277
+ updatedAt: text("updated_at").default(sql23`(datetime('now'))`)
29165
29278
  },
29166
29279
  (table) => [index("idx_tasks_warp_chains_name").on(table.name)]
29167
29280
  );
@@ -29185,9 +29298,9 @@ var init_runtime = __esm({
29185
29298
  /** JSON array of gate results (TEXT per JSON audit). */
29186
29299
  gateResults: text("gate_results"),
29187
29300
  /** ISO-8601 UTC creation instant (canonical TEXT, §4). */
29188
- createdAt: text("created_at").default(sql22`(datetime('now'))`),
29301
+ createdAt: text("created_at").default(sql23`(datetime('now'))`),
29189
29302
  /** ISO-8601 UTC last-update instant (canonical TEXT, §4). */
29190
- updatedAt: text("updated_at").default(sql22`(datetime('now'))`)
29303
+ updatedAt: text("updated_at").default(sql23`(datetime('now'))`)
29191
29304
  },
29192
29305
  (table) => [
29193
29306
  index("idx_tasks_warp_chain_instances_chain").on(table.chainId),
@@ -29209,9 +29322,9 @@ var init_runtime = __esm({
29209
29322
  /** Intra-DB soft ref → `tasks_tasks.id`. */
29210
29323
  taskId: text("task_id"),
29211
29324
  /** ISO-8601 UTC start instant (canonical TEXT, §4). */
29212
- startedAt: text("started_at").notNull().default(sql22`(datetime('now'))`),
29325
+ startedAt: text("started_at").notNull().default(sql23`(datetime('now'))`),
29213
29326
  /** ISO-8601 UTC last-heartbeat instant (canonical TEXT, §4). */
29214
- lastHeartbeat: text("last_heartbeat").notNull().default(sql22`(datetime('now'))`),
29327
+ lastHeartbeat: text("last_heartbeat").notNull().default(sql23`(datetime('now'))`),
29215
29328
  /** ISO-8601 UTC stop instant (canonical TEXT, §4). */
29216
29329
  stoppedAt: text("stopped_at"),
29217
29330
  /** Error count. */
@@ -29248,7 +29361,7 @@ var init_runtime = __esm({
29248
29361
  /** Optional stack trace. */
29249
29362
  stack: text("stack"),
29250
29363
  /** ISO-8601 UTC occurrence instant (canonical TEXT, §4). */
29251
- occurredAt: text("occurred_at").notNull().default(sql22`(datetime('now'))`),
29364
+ occurredAt: text("occurred_at").notNull().default(sql23`(datetime('now'))`),
29252
29365
  /** Whether the error was resolved. §3a boolean — already typed, preserved. */
29253
29366
  resolved: integer("resolved", { mode: "boolean" }).notNull().default(false)
29254
29367
  },
@@ -29280,7 +29393,7 @@ var init_runtime = __esm({
29280
29393
  /** Optional session id (cross-table soft ref → `tasks_sessions.id`). */
29281
29394
  sessionId: text("session_id"),
29282
29395
  /** ISO-8601 UTC start instant (canonical TEXT, §4). */
29283
- startedAt: text("started_at").notNull().default(sql22`(datetime('now'))`),
29396
+ startedAt: text("started_at").notNull().default(sql23`(datetime('now'))`),
29284
29397
  /** ISO-8601 UTC completion instant (canonical TEXT, §4). */
29285
29398
  completedAt: text("completed_at")
29286
29399
  });
@@ -29294,7 +29407,7 @@ var init_runtime = __esm({
29294
29407
  /** HMAC resume token (unique). */
29295
29408
  token: text("token").notNull().unique(),
29296
29409
  /** ISO-8601 UTC request instant (canonical TEXT, §4). */
29297
- requestedAt: text("requested_at").notNull().default(sql22`(datetime('now'))`),
29410
+ requestedAt: text("requested_at").notNull().default(sql23`(datetime('now'))`),
29298
29411
  /** ISO-8601 UTC approval instant (canonical TEXT, §4). */
29299
29412
  approvedAt: text("approved_at"),
29300
29413
  /** Approver identity. */
@@ -29318,7 +29431,7 @@ import {
29318
29431
  TASK_SEVERITIES as TASK_SEVERITIES3,
29319
29432
  TASK_SIZES as TASK_SIZES3
29320
29433
  } from "@cleocode/contracts/enums";
29321
- import { sql as sql23 } from "drizzle-orm";
29434
+ import { sql as sql24 } from "drizzle-orm";
29322
29435
  var TASK_AC_KINDS, tasksTasks, tasksTaskAcceptanceCriteria, tasksAcceptanceProjectionState, tasksAcceptanceProjectionDirty, tasksTaskDependencies, tasksTaskRelations, tasksSessions, tasksSessionHandoffEntries, tasksTaskWorkHistory, tasksTaskAcceptanceCriteriaHistory, tasksExternalTaskLinks;
29323
29436
  var init_tasks_core = __esm({
29324
29437
  "packages/core/src/store/schema/cleo-project/tasks-core.ts"() {
@@ -29377,7 +29490,7 @@ var init_tasks_core = __esm({
29377
29490
  /** Whether auto-complete is suppressed. §3a boolean — already typed, preserved. */
29378
29491
  noAutoComplete: integer("no_auto_complete", { mode: "boolean" }),
29379
29492
  /** ISO-8601 UTC creation instant (canonical TEXT, §4). */
29380
- createdAt: text("created_at").notNull().default(sql23`(datetime('now'))`),
29493
+ createdAt: text("created_at").notNull().default(sql24`(datetime('now'))`),
29381
29494
  /** ISO-8601 UTC last-update instant (canonical TEXT, §4). */
29382
29495
  updatedAt: text("updated_at"),
29383
29496
  /** ISO-8601 UTC completion instant (canonical TEXT, §4). */
@@ -29433,7 +29546,7 @@ var init_tasks_core = __esm({
29433
29546
  index("idx_tasks_tasks_role").on(table.kind),
29434
29547
  index("idx_tasks_tasks_scope").on(table.scope),
29435
29548
  index("idx_tasks_tasks_role_status").on(table.kind, table.status),
29436
- index("idx_tasks_tasks_created_date").on(sql23`date(${table.createdAt})`),
29549
+ index("idx_tasks_tasks_created_date").on(sql24`date(${table.createdAt})`),
29437
29550
  unique("uq_tasks_tasks_idempotency_key").on(table.idempotencyKey)
29438
29551
  ]
29439
29552
  );
@@ -29459,7 +29572,7 @@ var init_tasks_core = __esm({
29459
29572
  /** The AC statement. */
29460
29573
  text: text("text").notNull(),
29461
29574
  /** ISO-8601 UTC creation instant (canonical TEXT, §4). */
29462
- createdAt: text("created_at").notNull().default(sql23`(CURRENT_TIMESTAMP)`),
29575
+ createdAt: text("created_at").notNull().default(sql24`(CURRENT_TIMESTAMP)`),
29463
29576
  /** ISO-8601 UTC last-edit instant (canonical TEXT, §4). */
29464
29577
  updatedAt: text("updated_at"),
29465
29578
  /** Optional sha256(text) drift snapshot. */
@@ -29488,7 +29601,7 @@ var init_tasks_core = __esm({
29488
29601
  /** Source frontier fingerprint. */
29489
29602
  sourceFingerprint: text("source_fingerprint"),
29490
29603
  /** ISO-8601 UTC creation instant (canonical TEXT, §4). */
29491
- createdAt: text("created_at").notNull().default(sql23`(CURRENT_TIMESTAMP)`),
29604
+ createdAt: text("created_at").notNull().default(sql24`(CURRENT_TIMESTAMP)`),
29492
29605
  /** ISO-8601 UTC last-update instant (canonical TEXT, §4). */
29493
29606
  updatedAt: text("updated_at")
29494
29607
  },
@@ -29512,7 +29625,7 @@ var init_tasks_core = __esm({
29512
29625
  /** ISO-8601 UTC source-update that triggered this (canonical TEXT, §4). */
29513
29626
  sourceUpdatedAt: text("source_updated_at"),
29514
29627
  /** ISO-8601 UTC queue-insertion instant (canonical TEXT, §4). */
29515
- queuedAt: text("queued_at").notNull().default(sql23`(CURRENT_TIMESTAMP)`),
29628
+ queuedAt: text("queued_at").notNull().default(sql24`(CURRENT_TIMESTAMP)`),
29516
29629
  /** JSON producer context (TEXT per JSON audit). */
29517
29630
  payloadJson: text("payload_json")
29518
29631
  },
@@ -29585,7 +29698,7 @@ var init_tasks_core = __esm({
29585
29698
  /** JSON handoff payload (TEXT per JSON audit). */
29586
29699
  handoffJson: text("handoff_json"),
29587
29700
  /** ISO-8601 UTC start instant (canonical TEXT, §4). */
29588
- startedAt: text("started_at").notNull().default(sql23`(datetime('now'))`),
29701
+ startedAt: text("started_at").notNull().default(sql24`(datetime('now'))`),
29589
29702
  /** ISO-8601 UTC end instant (canonical TEXT, §4). */
29590
29703
  endedAt: text("ended_at"),
29591
29704
  /** Previous session pointer (self-FK). */
@@ -29647,7 +29760,7 @@ var init_tasks_core = __esm({
29647
29760
  /** Serialised handoff/debrief JSON (TEXT per JSON audit). */
29648
29761
  handoffJson: text("handoff_json").notNull(),
29649
29762
  /** ISO-8601 UTC creation instant (canonical TEXT, §4). */
29650
- createdAt: text("created_at").notNull().default(sql23`(datetime('now'))`)
29763
+ createdAt: text("created_at").notNull().default(sql24`(datetime('now'))`)
29651
29764
  },
29652
29765
  (table) => [index("idx_tasks_session_handoff_entries_session_id").on(table.sessionId)]
29653
29766
  );
@@ -29661,7 +29774,7 @@ var init_tasks_core = __esm({
29661
29774
  /** FK → `tasks_tasks.id`. ON DELETE CASCADE. */
29662
29775
  taskId: text("task_id").notNull().references(() => tasksTasks.id, { onDelete: "cascade" }),
29663
29776
  /** ISO-8601 UTC set instant (canonical TEXT, §4). */
29664
- setAt: text("set_at").notNull().default(sql23`(datetime('now'))`),
29777
+ setAt: text("set_at").notNull().default(sql24`(datetime('now'))`),
29665
29778
  /** ISO-8601 UTC cleared instant (canonical TEXT, §4). */
29666
29779
  clearedAt: text("cleared_at")
29667
29780
  },
@@ -29675,7 +29788,7 @@ var init_tasks_core = __esm({
29675
29788
  /** AC id this row records (NOT an FK — survives AC deletion). */
29676
29789
  acId: text("ac_id").notNull(),
29677
29790
  /** ISO-8601 UTC record instant (canonical TEXT, §4). */
29678
- recordedAt: text("recorded_at").notNull().default(sql23`(datetime('now'))`),
29791
+ recordedAt: text("recorded_at").notNull().default(sql24`(datetime('now'))`),
29679
29792
  /** AC text BEFORE this change. */
29680
29793
  previousText: text("previous_text").notNull(),
29681
29794
  /**
@@ -29689,7 +29802,7 @@ var init_tasks_core = __esm({
29689
29802
  (table) => [
29690
29803
  index("idx_tasks_task_acceptance_criteria_history_ac_id_recorded_at").on(
29691
29804
  table.acId,
29692
- sql23`${table.recordedAt} desc`
29805
+ sql24`${table.recordedAt} desc`
29693
29806
  )
29694
29807
  ]
29695
29808
  );
@@ -29715,7 +29828,7 @@ var init_tasks_core = __esm({
29715
29828
  /** JSON provider metadata (TEXT per JSON audit; empty-object default). */
29716
29829
  metadataJson: text("metadata_json").default("{}"),
29717
29830
  /** ISO-8601 UTC link-creation instant (canonical TEXT, §4). */
29718
- linkedAt: text("linked_at").notNull().default(sql23`(datetime('now'))`),
29831
+ linkedAt: text("linked_at").notNull().default(sql24`(datetime('now'))`),
29719
29832
  /** ISO-8601 UTC last-sync instant (canonical TEXT, §4). */
29720
29833
  lastSyncAt: text("last_sync_at")
29721
29834
  },
@@ -29782,7 +29895,7 @@ var init_background_jobs = __esm({
29782
29895
  });
29783
29896
 
29784
29897
  // packages/core/src/store/schema/evidence-bindings.ts
29785
- import { sql as sql24 } from "drizzle-orm";
29898
+ import { sql as sql25 } from "drizzle-orm";
29786
29899
  var EVIDENCE_BINDING_TYPES, evidenceAcBindings;
29787
29900
  var init_evidence_bindings = __esm({
29788
29901
  "packages/core/src/store/schema/evidence-bindings.ts"() {
@@ -29807,7 +29920,7 @@ var init_evidence_bindings = __esm({
29807
29920
  enum: EVIDENCE_BINDING_TYPES
29808
29921
  }).notNull(),
29809
29922
  /** ISO-8601 timestamp of binding creation. */
29810
- createdAt: text("created_at").notNull().default(sql24`(datetime('now'))`)
29923
+ createdAt: text("created_at").notNull().default(sql25`(datetime('now'))`)
29811
29924
  },
29812
29925
  (table) => [
29813
29926
  // One binding per atom/ac/type triple — idempotent re-inserts collapse.
@@ -29826,7 +29939,7 @@ var init_evidence_bindings = __esm({
29826
29939
  });
29827
29940
 
29828
29941
  // packages/core/src/store/schema/cleo-project/tasks-core-batch2.ts
29829
- import { sql as sql25 } from "drizzle-orm";
29942
+ import { sql as sql26 } from "drizzle-orm";
29830
29943
  var tasksBackgroundJobs, tasksExperiments, tasksEvidenceAcBindings, tasksTaskLabels;
29831
29944
  var init_tasks_core_batch2 = __esm({
29832
29945
  "packages/core/src/store/schema/cleo-project/tasks-core-batch2.ts"() {
@@ -29844,7 +29957,7 @@ var init_tasks_core_batch2 = __esm({
29844
29957
  /** Current lifecycle status — CHECK-backed via {@link BACKGROUND_JOB_STATUSES}. */
29845
29958
  status: text("status", { enum: BACKGROUND_JOB_STATUSES }).notNull().default("pending"),
29846
29959
  /** ISO-8601 UTC creation instant (was ms epoch, §4 / §8.1). */
29847
- startedAt: text("started_at").notNull().default(sql25`(datetime('now'))`),
29960
+ startedAt: text("started_at").notNull().default(sql26`(datetime('now'))`),
29848
29961
  /** ISO-8601 UTC completion instant; NULL while running (was ms epoch, §4). */
29849
29962
  completedAt: text("completed_at"),
29850
29963
  /** JSON-serialised result payload; NULL on failure or while running (TEXT). */
@@ -29854,7 +29967,7 @@ var init_tasks_core_batch2 = __esm({
29854
29967
  /** Execution progress 0-100; NULL until progress is reported. */
29855
29968
  progress: integer("progress"),
29856
29969
  /** ISO-8601 UTC last-heartbeat instant (was ms epoch, §4 / §8.1). */
29857
- heartbeatAt: text("heartbeat_at").notNull().default(sql25`(datetime('now'))`),
29970
+ heartbeatAt: text("heartbeat_at").notNull().default(sql26`(datetime('now'))`),
29858
29971
  /** Agent or session ID that claimed this job; NULL if unclaimed. */
29859
29972
  claimedBy: text("claimed_by"),
29860
29973
  /**
@@ -29906,7 +30019,7 @@ var init_tasks_core_batch2 = __esm({
29906
30019
  /** One of {direct, satisfies, coverage} — CHECK-backed via {@link EVIDENCE_BINDING_TYPES}. */
29907
30020
  bindingType: text("binding_type", { enum: EVIDENCE_BINDING_TYPES }).notNull(),
29908
30021
  /** ISO-8601 UTC binding-creation instant (already canonical TEXT, §4). */
29909
- createdAt: text("created_at").notNull().default(sql25`(datetime('now'))`)
30022
+ createdAt: text("created_at").notNull().default(sql26`(datetime('now'))`)
29910
30023
  },
29911
30024
  (table) => [
29912
30025
  uniqueIndex("uq_tasks_evidence_ac_bindings_atom_ac_type").on(
@@ -30074,7 +30187,7 @@ var init_cleo_project = __esm({
30074
30187
  });
30075
30188
 
30076
30189
  // packages/core/src/store/schema/cleo-global/agent-registry.ts
30077
- import { sql as sql26 } from "drizzle-orm";
30190
+ import { sql as sql27 } from "drizzle-orm";
30078
30191
  var AGENT_REGISTRY_USER_ROLES, AGENT_REGISTRY_AGENT_STATUSES, agentRegistryUsers, agentRegistryOrganization, agentRegistryAgents, agentRegistryClaimCodes, agentRegistryCapabilities, agentRegistrySkills, agentRegistryAgentCapabilities, agentRegistryAgentSkills, agentRegistryAgentConnections, agentRegistryAccounts, agentRegistrySessions, agentRegistryVerifications, agentRegistryOrgAgentKeys;
30079
30192
  var init_agent_registry = __esm({
30080
30193
  "packages/core/src/store/schema/cleo-global/agent-registry.ts"() {
@@ -30140,9 +30253,9 @@ var init_agent_registry = __esm({
30140
30253
  /** Owner user id (soft FK → agent_registry_users.id). */
30141
30254
  ownerId: text("owner_id"),
30142
30255
  /** ISO-8601 UTC creation instant (E10 §4: epoch → TEXT ISO8601). */
30143
- createdAt: text("created_at").notNull().default(sql26`(datetime('now'))`),
30256
+ createdAt: text("created_at").notNull().default(sql27`(datetime('now'))`),
30144
30257
  /** ISO-8601 UTC last-update instant (E10 §4: epoch → TEXT ISO8601). */
30145
- updatedAt: text("updated_at").notNull().default(sql26`(datetime('now'))`)
30258
+ updatedAt: text("updated_at").notNull().default(sql27`(datetime('now'))`)
30146
30259
  },
30147
30260
  (table) => [index("idx_agent_registry_organization_slug").on(table.slug)]
30148
30261
  );
@@ -30315,7 +30428,7 @@ var init_agent_registry = __esm({
30315
30428
  /** Skill-attachment provenance (cant / manual / computed). */
30316
30429
  source: text("source").notNull().default("manual"),
30317
30430
  /** ISO-8601 UTC attachment instant (already canonical TEXT, §4). */
30318
- attachedAt: text("attached_at").notNull().default(sql26`(datetime('now'))`)
30431
+ attachedAt: text("attached_at").notNull().default(sql27`(datetime('now'))`)
30319
30432
  },
30320
30433
  (table) => [
30321
30434
  primaryKey({ columns: [table.agentId, table.skillId] }),
@@ -30453,7 +30566,7 @@ var init_agent_registry = __esm({
30453
30566
  });
30454
30567
 
30455
30568
  // packages/core/src/store/schema/cleo-global/nexus.ts
30456
- import { sql as sql27 } from "drizzle-orm";
30569
+ import { sql as sql28 } from "drizzle-orm";
30457
30570
  var SIGIL_ROLES, nexusProjectRegistry, nexusProjectIdAliases, nexusAuditLog, nexusSchemaMeta, nexusUserProfile, nexusSigils;
30458
30571
  var init_nexus2 = __esm({
30459
30572
  "packages/core/src/store/schema/cleo-global/nexus.ts"() {
@@ -30481,9 +30594,9 @@ var init_nexus2 = __esm({
30481
30594
  /** Human-readable project name. */
30482
30595
  name: text("name").notNull(),
30483
30596
  /** ISO-8601 UTC registration instant (canonical TEXT, §4). */
30484
- registeredAt: text("registered_at").notNull().default(sql27`(datetime('now'))`),
30597
+ registeredAt: text("registered_at").notNull().default(sql28`(datetime('now'))`),
30485
30598
  /** ISO-8601 UTC last-seen instant (canonical TEXT, §4). */
30486
- lastSeen: text("last_seen").notNull().default(sql27`(datetime('now'))`),
30599
+ lastSeen: text("last_seen").notNull().default(sql28`(datetime('now'))`),
30487
30600
  /** Health status string (e.g. "healthy", "warning", "unknown"). */
30488
30601
  healthStatus: text("health_status").notNull().default("unknown"),
30489
30602
  /** ISO-8601 UTC last health-check instant; NULL until first check. */
@@ -30491,7 +30604,7 @@ var init_nexus2 = __esm({
30491
30604
  /** Permission level ("read" / "write"). */
30492
30605
  permissions: text("permissions").notNull().default("read"),
30493
30606
  /** ISO-8601 UTC last-sync instant (canonical TEXT, §4). */
30494
- lastSync: text("last_sync").notNull().default(sql27`(datetime('now'))`),
30607
+ lastSync: text("last_sync").notNull().default(sql28`(datetime('now'))`),
30495
30608
  /** Cached task count for the project. */
30496
30609
  taskCount: integer("task_count").notNull().default(0),
30497
30610
  /** JSON array of project labels (serialized TEXT per JSON-Column Audit). */
@@ -30520,7 +30633,7 @@ var init_nexus2 = __esm({
30520
30633
  /** Canonical 12-hex-char ID this alias maps to (soft FK → nexus_project_registry). */
30521
30634
  canonicalId: text("canonical_id").notNull(),
30522
30635
  /** ISO-8601 UTC creation instant (canonical TEXT, §4). */
30523
- createdAt: text("created_at").notNull().default(sql27`(datetime('now'))`)
30636
+ createdAt: text("created_at").notNull().default(sql28`(datetime('now'))`)
30524
30637
  },
30525
30638
  (table) => [index("idx_nexus_project_id_aliases_canonical").on(table.canonicalId)]
30526
30639
  );
@@ -30530,7 +30643,7 @@ var init_nexus2 = __esm({
30530
30643
  /** UUID primary key. */
30531
30644
  id: text("id").primaryKey(),
30532
30645
  /** ISO-8601 UTC instant of the audited operation (canonical TEXT, §4). */
30533
- timestamp: text("timestamp").notNull().default(sql27`(datetime('now'))`),
30646
+ timestamp: text("timestamp").notNull().default(sql28`(datetime('now'))`),
30534
30647
  /** Audited action name. */
30535
30648
  action: text("action").notNull(),
30536
30649
  /** Project hash context; NULL for global operations. */
@@ -30625,9 +30738,9 @@ var init_nexus2 = __esm({
30625
30738
  /** JSON-encoded capability flags object (serialized TEXT); NULL until set. */
30626
30739
  capabilityFlags: text("capability_flags"),
30627
30740
  /** ISO-8601 UTC creation instant (E10 §4: Drizzle-Date → TEXT ISO8601). */
30628
- createdAt: text("created_at").notNull().default(sql27`(datetime('now'))`),
30741
+ createdAt: text("created_at").notNull().default(sql28`(datetime('now'))`),
30629
30742
  /** ISO-8601 UTC last-update instant (E10 §4: Drizzle-Date → TEXT ISO8601). */
30630
- updatedAt: text("updated_at").notNull().default(sql27`(datetime('now'))`)
30743
+ updatedAt: text("updated_at").notNull().default(sql28`(datetime('now'))`)
30631
30744
  },
30632
30745
  (table) => [
30633
30746
  index("idx_nexus_sigils_display_name").on(table.displayName),
@@ -30638,7 +30751,7 @@ var init_nexus2 = __esm({
30638
30751
  });
30639
30752
 
30640
30753
  // packages/core/src/store/schema/cleo-global/skills.ts
30641
- import { sql as sql28 } from "drizzle-orm";
30754
+ import { sql as sql29 } from "drizzle-orm";
30642
30755
  var SKILL_SOURCE_TYPES, SKILL_LIFECYCLE_STATES, SKILL_REVIEW_OUTCOMES, SKILL_PATCH_STATUSES, skillsSkills, skillsSkillUsage, skillsSkillReviews, skillsSkillPatches;
30643
30756
  var init_skills2 = __esm({
30644
30757
  "packages/core/src/store/schema/cleo-global/skills.ts"() {
@@ -30693,7 +30806,7 @@ var init_skills2 = __esm({
30693
30806
  /** Logical FK to {@link skillsSkills}.name — denormalised for query speed. */
30694
30807
  skillName: text("skill_name").notNull(),
30695
30808
  /** ISO-8601 wall-clock timestamp of the load/invoke event (canonical TEXT, §4). */
30696
- observedAt: text("observed_at").notNull().default(sql28`(datetime('now'))`),
30809
+ observedAt: text("observed_at").notNull().default(sql29`(datetime('now'))`),
30697
30810
  /** Event kind — `load`, `invoke`, `error`, etc. */
30698
30811
  eventKind: text("event_kind").notNull(),
30699
30812
  /**
@@ -30733,7 +30846,7 @@ var init_skills2 = __esm({
30733
30846
  /** Logical FK to {@link skillsSkills}.name. */
30734
30847
  skillName: text("skill_name").notNull(),
30735
30848
  /** ISO-8601 timestamp of the review (canonical TEXT, §4). */
30736
- reviewedAt: text("reviewed_at").notNull().default(sql28`(datetime('now'))`),
30849
+ reviewedAt: text("reviewed_at").notNull().default(sql29`(datetime('now'))`),
30737
30850
  /** Outcome verdict from {@link SKILL_REVIEW_OUTCOMES} (E10 §5a). */
30738
30851
  outcome: text("outcome", { enum: SKILL_REVIEW_OUTCOMES }).notNull(),
30739
30852
  /** Numeric grade (0-100); NULL if review was council-only. */
@@ -30756,7 +30869,7 @@ var init_skills2 = __esm({
30756
30869
  /** Logical FK to {@link skillsSkills}.name. */
30757
30870
  skillName: text("skill_name").notNull(),
30758
30871
  /** ISO-8601 timestamp the patch was proposed (canonical TEXT, §4). */
30759
- proposedAt: text("proposed_at").notNull().default(sql28`(datetime('now'))`),
30872
+ proposedAt: text("proposed_at").notNull().default(sql29`(datetime('now'))`),
30760
30873
  /** ISO-8601 timestamp the patch was applied; NULL while proposed (canonical TEXT, §4). */
30761
30874
  appliedAt: text("applied_at"),
30762
30875
  /** Logical FK to {@link skillsSkillReviews}.id that gated this patch. */
@@ -30777,7 +30890,7 @@ var init_skills2 = __esm({
30777
30890
  });
30778
30891
 
30779
30892
  // packages/core/src/store/schema/cleo-global/telemetry.ts
30780
- import { sql as sql29 } from "drizzle-orm";
30893
+ import { sql as sql30 } from "drizzle-orm";
30781
30894
  var telemetryEvents, telemetrySchemaMeta;
30782
30895
  var init_telemetry = __esm({
30783
30896
  "packages/core/src/store/schema/cleo-global/telemetry.ts"() {
@@ -30806,7 +30919,7 @@ var init_telemetry = __esm({
30806
30919
  /** Machine-readable error code when exit_code != 0. NULL on success. */
30807
30920
  errorCode: text("error_code"),
30808
30921
  /** ISO-8601 UTC instant of the invocation (canonical TEXT timestamp, §4). */
30809
- timestamp: text("timestamp").notNull().default(sql29`(datetime('now'))`)
30922
+ timestamp: text("timestamp").notNull().default(sql30`(datetime('now'))`)
30810
30923
  },
30811
30924
  (table) => [
30812
30925
  index("idx_telemetry_command").on(table.command),
@@ -33547,12 +33660,16 @@ __export(exodus_exports, {
33547
33660
  archiveStrandedResidue: () => archiveStrandedResidue,
33548
33661
  buildExodusHealth: () => buildExodusHealth,
33549
33662
  buildExodusPlan: () => buildExodusPlan,
33663
+ clearExodusAborts: () => clearExodusAborts,
33550
33664
  clearExodusJournal: () => clearExodusJournal,
33551
33665
  computeCountParity: () => computeCountParity,
33552
33666
  deriveStagingDirName: () => deriveStagingDirName,
33553
33667
  detectStrandedResidue: () => detectStrandedResidue,
33668
+ emitExodusAbort: () => emitExodusAbort,
33669
+ exodusAbortEvents: () => exodusAbortEvents,
33554
33670
  exodusArchiveDir: () => exodusArchiveDir,
33555
33671
  exodusMarkerPath: () => exodusMarkerPath,
33672
+ getRecordedExodusAbort: () => getRecordedExodusAbort,
33556
33673
  hasExodusCompleteMarker: () => hasExodusCompleteMarker,
33557
33674
  isDerivedOrInternalTable: () => isDerivedOrInternalTable,
33558
33675
  resolveConsolidatedTableName: () => resolveConsolidatedTableName,
@@ -33568,6 +33685,7 @@ __export(exodus_exports, {
33568
33685
  var init_exodus = __esm({
33569
33686
  "packages/core/src/store/exodus/index.ts"() {
33570
33687
  "use strict";
33688
+ init_abort_events();
33571
33689
  init_archive2();
33572
33690
  init_count_parity();
33573
33691
  init_health2();
@@ -33825,7 +33943,9 @@ var init_on_open = __esm({
33825
33943
  // packages/core/src/store/dual-scope-db.ts
33826
33944
  var dual_scope_db_exports = {};
33827
33945
  __export(dual_scope_db_exports, {
33946
+ ExodusAbortWriteUnsafeError: () => ExodusAbortWriteUnsafeError,
33828
33947
  _resetDualScopeDbCache: () => _resetDualScopeDbCache,
33948
+ assertWriteDurable: () => assertWriteDurable,
33829
33949
  insertIdempotent: () => insertIdempotent,
33830
33950
  openDualScopeDb: () => openDualScopeDb,
33831
33951
  openDualScopeDbAtPath: () => openDualScopeDbAtPath,
@@ -33835,6 +33955,17 @@ __export(dual_scope_db_exports, {
33835
33955
  import { existsSync as existsSync11, mkdirSync as mkdirSync3 } from "node:fs";
33836
33956
  import { createRequire as createRequire4 } from "node:module";
33837
33957
  import { dirname as dirname4, join as join10 } from "node:path";
33958
+ function assertWriteDurable(handle) {
33959
+ if (handle.exodusAbort) {
33960
+ throw new ExodusAbortWriteUnsafeError(handle.exodusAbort);
33961
+ }
33962
+ }
33963
+ function assertNoRecordedExodusAbort() {
33964
+ const detail = getRecordedExodusAbort();
33965
+ if (detail) {
33966
+ throw new ExodusAbortWriteUnsafeError(detail);
33967
+ }
33968
+ }
33838
33969
  function cacheKey(scope, dbPath) {
33839
33970
  return `${scope}::${dbPath}`;
33840
33971
  }
@@ -33974,13 +34105,25 @@ async function openDualScopeDbAtPath(scope, dbPath, exodusCwd, options) {
33974
34105
  const { maybeRunExodusOnOpen: maybeRunExodusOnOpen2 } = await Promise.resolve().then(() => (init_on_open(), on_open_exports));
33975
34106
  const result = await maybeRunExodusOnOpen2(scope, dbPath, nativeDb, exodusCwd);
33976
34107
  if (result.outcome === "migrated" || result.outcome === "aborted") {
34108
+ const reopened = scope === "project" ? await openDualScopeDbAtPath("project", dbPath) : await openDualScopeDbAtPath("global", dbPath);
33977
34109
  if (result.outcome === "aborted") {
34110
+ const abort = {
34111
+ scope,
34112
+ dbPath,
34113
+ reason: result.reason,
34114
+ at: Date.now()
34115
+ };
33978
34116
  log7.warn(
33979
34117
  { scope, reason: result.reason },
33980
- "exodus-on-open aborted; consolidated cleo.db left empty, legacy kept as source"
34118
+ "exodus-on-open aborted; consolidated cleo.db left empty, legacy kept as source \u2014 mutating callers must check handle.exodusAbort / call assertWriteDurable (T11828)"
33981
34119
  );
34120
+ const { emitExodusAbort: emitExodusAbort2 } = await Promise.resolve().then(() => (init_abort_events(), abort_events_exports));
34121
+ emitExodusAbort2(abort);
34122
+ return { ...reopened, exodusAbort: abort };
33982
34123
  }
33983
- return scope === "project" ? openDualScopeDbAtPath("project", dbPath) : openDualScopeDbAtPath("global", dbPath);
34124
+ const { clearExodusAborts: clearExodusAborts2 } = await Promise.resolve().then(() => (init_abort_events(), abort_events_exports));
34125
+ clearExodusAborts2(scope);
34126
+ return reopened;
33984
34127
  }
33985
34128
  } catch (err) {
33986
34129
  log7.warn(
@@ -34018,10 +34161,12 @@ function _resetDualScopeDbCache(scope) {
34018
34161
  }
34019
34162
  }
34020
34163
  async function insertIdempotent(db, table, row, _keyColumn) {
34164
+ assertNoRecordedExodusAbort();
34021
34165
  const result = await db.insert(table).values(row).onConflictDoNothing().returning();
34022
34166
  return result.length;
34023
34167
  }
34024
34168
  async function upsertIdempotent(db, table, row, _keyColumn, conflictTarget, set2) {
34169
+ assertNoRecordedExodusAbort();
34025
34170
  const updateSet = set2 ?? row;
34026
34171
  const result = await db.insert(table).values(row).onConflictDoUpdate({
34027
34172
  target: conflictTarget,
@@ -34030,15 +34175,35 @@ async function upsertIdempotent(db, table, row, _keyColumn, conflictTarget, set2
34030
34175
  }).returning();
34031
34176
  return result.length;
34032
34177
  }
34033
- var _cache, _require2, _drizzle, _DatabaseSyncCtor, _projectSchema, _globalSchema;
34178
+ var ExodusAbortWriteUnsafeError, _cache, _require2, _drizzle, _DatabaseSyncCtor, _projectSchema, _globalSchema;
34034
34179
  var init_dual_scope_db = __esm({
34035
34180
  "packages/core/src/store/dual-scope-db.ts"() {
34036
34181
  "use strict";
34037
34182
  init_logger2();
34038
34183
  init_paths();
34184
+ init_abort_events();
34039
34185
  init_migration_manager();
34040
34186
  init_resolve_migrations_folder();
34041
34187
  init_sqlite_pragmas();
34188
+ ExodusAbortWriteUnsafeError = class extends Error {
34189
+ /** Stable string error code for envelope `codeName` / log correlation. */
34190
+ codeName = "E_EXODUS_ABORT_WRITE_UNSAFE";
34191
+ /** The structured abort detail carried by the handle. */
34192
+ detail;
34193
+ /** Remediation hint surfaced to the operator. */
34194
+ fix;
34195
+ /**
34196
+ * @param detail - The {@link ExodusAbortDetail} stamped on the handle.
34197
+ */
34198
+ constructor(detail) {
34199
+ super(
34200
+ `Refusing to write to consolidated ${detail.scope} cleo.db \u2014 exodus-on-open ABORTED (${detail.reason}). The DB is empty; legacy data is the source of truth. Run \`cleo doctor exodus-health\` then \`cleo exodus migrate\` (or restore via \`cleo doctor repair --role ${detail.scope === "project" ? "tasks" : "nexus"}\`) before writing.`
34201
+ );
34202
+ this.name = "ExodusAbortWriteUnsafeError";
34203
+ this.detail = detail;
34204
+ this.fix = "Resolve the aborted migration (`cleo doctor exodus-health` \u2192 `cleo exodus migrate`) so the consolidated cleo.db carries your data before mutating it.";
34205
+ }
34206
+ };
34042
34207
  _cache = /* @__PURE__ */ new Map();
34043
34208
  _require2 = createRequire4(import.meta.url);
34044
34209
  _drizzle = null;
@@ -34066,7 +34231,7 @@ __export(nexus_schema_exports, {
34066
34231
  sigils: () => sigils,
34067
34232
  userProfile: () => userProfile
34068
34233
  });
34069
- import { sql as sql30 } from "drizzle-orm";
34234
+ import { sql as sql31 } from "drizzle-orm";
34070
34235
  var projectRegistry, projectIdAliases, nexusAuditLog2, nexusSchemaMeta2, NEXUS_NODE_KINDS2, nexusNodes2, NEXUS_RELATION_TYPES2, nexusRelations2, nexusRelationWeights2, NEXUS_CONTRACT_TYPES2, nexusContracts2, userProfile, SIGIL_ROLES2, sigils;
34071
34236
  var init_nexus_schema = __esm({
34072
34237
  "packages/core/src/store/schema/nexus-schema.ts"() {
@@ -34094,12 +34259,12 @@ var init_nexus_schema = __esm({
34094
34259
  */
34095
34260
  projectPath: text("project_path").notNull().unique(),
34096
34261
  name: text("name").notNull(),
34097
- registeredAt: text("registered_at").notNull().default(sql30`(datetime('now'))`),
34098
- lastSeen: text("last_seen").notNull().default(sql30`(datetime('now'))`),
34262
+ registeredAt: text("registered_at").notNull().default(sql31`(datetime('now'))`),
34263
+ lastSeen: text("last_seen").notNull().default(sql31`(datetime('now'))`),
34099
34264
  healthStatus: text("health_status").notNull().default("unknown"),
34100
34265
  healthLastCheck: text("health_last_check"),
34101
34266
  permissions: text("permissions").notNull().default("read"),
34102
- lastSync: text("last_sync").notNull().default(sql30`(datetime('now'))`),
34267
+ lastSync: text("last_sync").notNull().default(sql31`(datetime('now'))`),
34103
34268
  taskCount: integer("task_count").notNull().default(0),
34104
34269
  labelsJson: text("labels_json").notNull().default("[]"),
34105
34270
  /**
@@ -34138,7 +34303,7 @@ var init_nexus_schema = __esm({
34138
34303
  /** The canonical 12-hex-char ID this alias maps to. */
34139
34304
  canonicalId: text("canonical_id").notNull(),
34140
34305
  /** ISO 8601 timestamp when this alias was recorded. */
34141
- createdAt: text("created_at").notNull().default(sql30`(datetime('now'))`)
34306
+ createdAt: text("created_at").notNull().default(sql31`(datetime('now'))`)
34142
34307
  },
34143
34308
  (table) => [index("idx_nexus_project_id_aliases_canonical").on(table.canonicalId)]
34144
34309
  );
@@ -34146,7 +34311,7 @@ var init_nexus_schema = __esm({
34146
34311
  "nexus_audit_log",
34147
34312
  {
34148
34313
  id: text("id").primaryKey(),
34149
- timestamp: text("timestamp").notNull().default(sql30`(datetime('now'))`),
34314
+ timestamp: text("timestamp").notNull().default(sql31`(datetime('now'))`),
34150
34315
  action: text("action").notNull(),
34151
34316
  projectHash: text("project_hash"),
34152
34317
  /** @cross-db nexus.project_registry.project_id — intra-DB soft FK (kept here for symmetry with the audit-log shape). */
@@ -34273,7 +34438,7 @@ var init_nexus_schema = __esm({
34273
34438
  * an import specifier cannot be resolved to a local file. */
34274
34439
  isExternal: integer("is_external", { mode: "boolean" }).notNull().default(false),
34275
34440
  /** ISO 8601 timestamp when this node was last indexed. */
34276
- indexedAt: text("indexed_at").notNull().default(sql30`(datetime('now'))`)
34441
+ indexedAt: text("indexed_at").notNull().default(sql31`(datetime('now'))`)
34277
34442
  },
34278
34443
  (table) => [
34279
34444
  // `idx_nexus_nodes_project` + the two `project_id`-leading composite indexes
@@ -34356,7 +34521,7 @@ var init_nexus_schema = __esm({
34356
34521
  /** Step index within an execution flow (for step_in_process relations). */
34357
34522
  step: integer("step"),
34358
34523
  /** ISO 8601 timestamp when this relation was last indexed. */
34359
- indexedAt: text("indexed_at").notNull().default(sql30`(datetime('now'))`)
34524
+ indexedAt: text("indexed_at").notNull().default(sql31`(datetime('now'))`)
34360
34525
  // T998 plasticity columns (`weight`, `last_accessed_at`, `co_accessed_count`)
34361
34526
  // were PARTITIONED out into the sibling `nexus_relation_weights` table by
34362
34527
  // T11545 (ADR-090 §5.3) to keep the read-mostly structural graph row narrow
@@ -34419,9 +34584,9 @@ var init_nexus_schema = __esm({
34419
34584
  /** Human-readable description. */
34420
34585
  description: text("description"),
34421
34586
  /** ISO 8601 timestamp when contract was extracted. */
34422
- createdAt: text("created_at").notNull().default(sql30`(datetime('now'))`),
34587
+ createdAt: text("created_at").notNull().default(sql31`(datetime('now'))`),
34423
34588
  /** ISO 8601 timestamp of last update. */
34424
- updatedAt: text("updated_at").notNull().default(sql30`(datetime('now'))`)
34589
+ updatedAt: text("updated_at").notNull().default(sql31`(datetime('now'))`)
34425
34590
  },
34426
34591
  (table) => [
34427
34592
  // `idx_nexus_contracts_project` + `idx_nexus_contracts_project_type` DROPPED
@@ -40193,7 +40358,7 @@ var init_structured_output = __esm({
40193
40358
 
40194
40359
  // packages/core/src/llm/transports/anthropic.ts
40195
40360
  import Anthropic from "@anthropic-ai/sdk";
40196
- import { z as z19 } from "zod";
40361
+ import { z as z20 } from "zod";
40197
40362
  function isTextBlock(block) {
40198
40363
  return block.type === "text";
40199
40364
  }
@@ -40265,8 +40430,8 @@ function mapUsage(usage) {
40265
40430
  function zodSchemaFrom(responseFormat) {
40266
40431
  if (responseFormat == null) return null;
40267
40432
  const asAny = responseFormat;
40268
- if (asAny["schema"] instanceof z19.ZodType) return asAny["schema"];
40269
- if (responseFormat instanceof z19.ZodType) return responseFormat;
40433
+ if (asAny["schema"] instanceof z20.ZodType) return asAny["schema"];
40434
+ if (responseFormat instanceof z20.ZodType) return responseFormat;
40270
40435
  return null;
40271
40436
  }
40272
40437
  function getJsonSchemaString(responseFormat) {
@@ -40672,7 +40837,7 @@ ${schemaJson}`
40672
40837
  content = typeof validated === "string" ? validated : JSON.stringify(validated);
40673
40838
  } catch {
40674
40839
  try {
40675
- const repaired = repairResponseModelJson(rawContent, zodSchema2 ?? z19.unknown(), modelName);
40840
+ const repaired = repairResponseModelJson(rawContent, zodSchema2 ?? z20.unknown(), modelName);
40676
40841
  content = typeof repaired === "string" ? repaired : JSON.stringify(repaired);
40677
40842
  } catch {
40678
40843
  content = rawContent || null;
@@ -42108,7 +42273,7 @@ var init_caching = __esm({
42108
42273
 
42109
42274
  // packages/core/src/llm/transports/gemini.ts
42110
42275
  import { GoogleGenerativeAI } from "@google/generative-ai";
42111
- import { z as z20 } from "zod";
42276
+ import { z as z21 } from "zod";
42112
42277
  function messagesToRaw(messages, system) {
42113
42278
  const raw = [];
42114
42279
  if (system) {
@@ -42496,7 +42661,7 @@ var init_gemini2 = __esm({
42496
42661
  const parsed = response["parsed"];
42497
42662
  if (parsed !== null && parsed !== void 0) {
42498
42663
  try {
42499
- const zodResult = z20.string().safeParse(String(parsed));
42664
+ const zodResult = z21.string().safeParse(String(parsed));
42500
42665
  if (!zodResult.success) {
42501
42666
  content = JSON.stringify(parsed);
42502
42667
  } else {
@@ -56893,7 +57058,7 @@ function resolveRef(ref, ctx) {
56893
57058
  function convertBaseSchema(schema, ctx) {
56894
57059
  if (schema.not !== void 0) {
56895
57060
  if (typeof schema.not === "object" && Object.keys(schema.not).length === 0) {
56896
- return z21.never();
57061
+ return z22.never();
56897
57062
  }
56898
57063
  throw new Error("not is not supported in Zod (except { not: {} } for never)");
56899
57064
  }
@@ -56915,7 +57080,7 @@ function convertBaseSchema(schema, ctx) {
56915
57080
  return ctx.refs.get(refPath);
56916
57081
  }
56917
57082
  if (ctx.processing.has(refPath)) {
56918
- return z21.lazy(() => {
57083
+ return z22.lazy(() => {
56919
57084
  if (!ctx.refs.has(refPath)) {
56920
57085
  throw new Error(`Circular reference not resolved: ${refPath}`);
56921
57086
  }
@@ -56932,25 +57097,25 @@ function convertBaseSchema(schema, ctx) {
56932
57097
  if (schema.enum !== void 0) {
56933
57098
  const enumValues = schema.enum;
56934
57099
  if (ctx.version === "openapi-3.0" && schema.nullable === true && enumValues.length === 1 && enumValues[0] === null) {
56935
- return z21.null();
57100
+ return z22.null();
56936
57101
  }
56937
57102
  if (enumValues.length === 0) {
56938
- return z21.never();
57103
+ return z22.never();
56939
57104
  }
56940
57105
  if (enumValues.length === 1) {
56941
- return z21.literal(enumValues[0]);
57106
+ return z22.literal(enumValues[0]);
56942
57107
  }
56943
57108
  if (enumValues.every((v) => typeof v === "string")) {
56944
- return z21.enum(enumValues);
57109
+ return z22.enum(enumValues);
56945
57110
  }
56946
- const literalSchemas = enumValues.map((v) => z21.literal(v));
57111
+ const literalSchemas = enumValues.map((v) => z22.literal(v));
56947
57112
  if (literalSchemas.length < 2) {
56948
57113
  return literalSchemas[0];
56949
57114
  }
56950
- return z21.union([literalSchemas[0], literalSchemas[1], ...literalSchemas.slice(2)]);
57115
+ return z22.union([literalSchemas[0], literalSchemas[1], ...literalSchemas.slice(2)]);
56951
57116
  }
56952
57117
  if (schema.const !== void 0) {
56953
- return z21.literal(schema.const);
57118
+ return z22.literal(schema.const);
56954
57119
  }
56955
57120
  const type = schema.type;
56956
57121
  if (Array.isArray(type)) {
@@ -56959,68 +57124,68 @@ function convertBaseSchema(schema, ctx) {
56959
57124
  return convertBaseSchema(typeSchema, ctx);
56960
57125
  });
56961
57126
  if (typeSchemas.length === 0) {
56962
- return z21.never();
57127
+ return z22.never();
56963
57128
  }
56964
57129
  if (typeSchemas.length === 1) {
56965
57130
  return typeSchemas[0];
56966
57131
  }
56967
- return z21.union(typeSchemas);
57132
+ return z22.union(typeSchemas);
56968
57133
  }
56969
57134
  if (!type) {
56970
- return z21.any();
57135
+ return z22.any();
56971
57136
  }
56972
57137
  let zodSchema2;
56973
57138
  switch (type) {
56974
57139
  case "string": {
56975
- let stringSchema = z21.string();
57140
+ let stringSchema = z22.string();
56976
57141
  if (schema.format) {
56977
57142
  const format = schema.format;
56978
57143
  if (format === "email") {
56979
- stringSchema = stringSchema.check(z21.email());
57144
+ stringSchema = stringSchema.check(z22.email());
56980
57145
  } else if (format === "uri" || format === "uri-reference") {
56981
- stringSchema = stringSchema.check(z21.url());
57146
+ stringSchema = stringSchema.check(z22.url());
56982
57147
  } else if (format === "uuid" || format === "guid") {
56983
- stringSchema = stringSchema.check(z21.uuid());
57148
+ stringSchema = stringSchema.check(z22.uuid());
56984
57149
  } else if (format === "date-time") {
56985
- stringSchema = stringSchema.check(z21.iso.datetime());
57150
+ stringSchema = stringSchema.check(z22.iso.datetime());
56986
57151
  } else if (format === "date") {
56987
- stringSchema = stringSchema.check(z21.iso.date());
57152
+ stringSchema = stringSchema.check(z22.iso.date());
56988
57153
  } else if (format === "time") {
56989
- stringSchema = stringSchema.check(z21.iso.time());
57154
+ stringSchema = stringSchema.check(z22.iso.time());
56990
57155
  } else if (format === "duration") {
56991
- stringSchema = stringSchema.check(z21.iso.duration());
57156
+ stringSchema = stringSchema.check(z22.iso.duration());
56992
57157
  } else if (format === "ipv4") {
56993
- stringSchema = stringSchema.check(z21.ipv4());
57158
+ stringSchema = stringSchema.check(z22.ipv4());
56994
57159
  } else if (format === "ipv6") {
56995
- stringSchema = stringSchema.check(z21.ipv6());
57160
+ stringSchema = stringSchema.check(z22.ipv6());
56996
57161
  } else if (format === "mac") {
56997
- stringSchema = stringSchema.check(z21.mac());
57162
+ stringSchema = stringSchema.check(z22.mac());
56998
57163
  } else if (format === "cidr") {
56999
- stringSchema = stringSchema.check(z21.cidrv4());
57164
+ stringSchema = stringSchema.check(z22.cidrv4());
57000
57165
  } else if (format === "cidr-v6") {
57001
- stringSchema = stringSchema.check(z21.cidrv6());
57166
+ stringSchema = stringSchema.check(z22.cidrv6());
57002
57167
  } else if (format === "base64") {
57003
- stringSchema = stringSchema.check(z21.base64());
57168
+ stringSchema = stringSchema.check(z22.base64());
57004
57169
  } else if (format === "base64url") {
57005
- stringSchema = stringSchema.check(z21.base64url());
57170
+ stringSchema = stringSchema.check(z22.base64url());
57006
57171
  } else if (format === "e164") {
57007
- stringSchema = stringSchema.check(z21.e164());
57172
+ stringSchema = stringSchema.check(z22.e164());
57008
57173
  } else if (format === "jwt") {
57009
- stringSchema = stringSchema.check(z21.jwt());
57174
+ stringSchema = stringSchema.check(z22.jwt());
57010
57175
  } else if (format === "emoji") {
57011
- stringSchema = stringSchema.check(z21.emoji());
57176
+ stringSchema = stringSchema.check(z22.emoji());
57012
57177
  } else if (format === "nanoid") {
57013
- stringSchema = stringSchema.check(z21.nanoid());
57178
+ stringSchema = stringSchema.check(z22.nanoid());
57014
57179
  } else if (format === "cuid") {
57015
- stringSchema = stringSchema.check(z21.cuid());
57180
+ stringSchema = stringSchema.check(z22.cuid());
57016
57181
  } else if (format === "cuid2") {
57017
- stringSchema = stringSchema.check(z21.cuid2());
57182
+ stringSchema = stringSchema.check(z22.cuid2());
57018
57183
  } else if (format === "ulid") {
57019
- stringSchema = stringSchema.check(z21.ulid());
57184
+ stringSchema = stringSchema.check(z22.ulid());
57020
57185
  } else if (format === "xid") {
57021
- stringSchema = stringSchema.check(z21.xid());
57186
+ stringSchema = stringSchema.check(z22.xid());
57022
57187
  } else if (format === "ksuid") {
57023
- stringSchema = stringSchema.check(z21.ksuid());
57188
+ stringSchema = stringSchema.check(z22.ksuid());
57024
57189
  }
57025
57190
  }
57026
57191
  if (typeof schema.minLength === "number") {
@@ -57037,7 +57202,7 @@ function convertBaseSchema(schema, ctx) {
57037
57202
  }
57038
57203
  case "number":
57039
57204
  case "integer": {
57040
- let numberSchema = type === "integer" ? z21.number().int() : z21.number();
57205
+ let numberSchema = type === "integer" ? z22.number().int() : z22.number();
57041
57206
  if (typeof schema.minimum === "number") {
57042
57207
  numberSchema = numberSchema.min(schema.minimum);
57043
57208
  }
@@ -57061,11 +57226,11 @@ function convertBaseSchema(schema, ctx) {
57061
57226
  break;
57062
57227
  }
57063
57228
  case "boolean": {
57064
- zodSchema2 = z21.boolean();
57229
+ zodSchema2 = z22.boolean();
57065
57230
  break;
57066
57231
  }
57067
57232
  case "null": {
57068
- zodSchema2 = z21.null();
57233
+ zodSchema2 = z22.null();
57069
57234
  break;
57070
57235
  }
57071
57236
  case "object": {
@@ -57078,14 +57243,14 @@ function convertBaseSchema(schema, ctx) {
57078
57243
  }
57079
57244
  if (schema.propertyNames) {
57080
57245
  const keySchema = convertSchema(schema.propertyNames, ctx);
57081
- const valueSchema = schema.additionalProperties && typeof schema.additionalProperties === "object" ? convertSchema(schema.additionalProperties, ctx) : z21.any();
57246
+ const valueSchema = schema.additionalProperties && typeof schema.additionalProperties === "object" ? convertSchema(schema.additionalProperties, ctx) : z22.any();
57082
57247
  if (Object.keys(shape).length === 0) {
57083
- zodSchema2 = z21.record(keySchema, valueSchema);
57248
+ zodSchema2 = z22.record(keySchema, valueSchema);
57084
57249
  break;
57085
57250
  }
57086
- const objectSchema2 = z21.object(shape).passthrough();
57087
- const recordSchema = z21.looseRecord(keySchema, valueSchema);
57088
- zodSchema2 = z21.intersection(objectSchema2, recordSchema);
57251
+ const objectSchema2 = z22.object(shape).passthrough();
57252
+ const recordSchema = z22.looseRecord(keySchema, valueSchema);
57253
+ zodSchema2 = z22.intersection(objectSchema2, recordSchema);
57089
57254
  break;
57090
57255
  }
57091
57256
  if (schema.patternProperties) {
@@ -57094,28 +57259,28 @@ function convertBaseSchema(schema, ctx) {
57094
57259
  const looseRecords = [];
57095
57260
  for (const pattern of patternKeys) {
57096
57261
  const patternValue = convertSchema(patternProps[pattern], ctx);
57097
- const keySchema = z21.string().regex(new RegExp(pattern));
57098
- looseRecords.push(z21.looseRecord(keySchema, patternValue));
57262
+ const keySchema = z22.string().regex(new RegExp(pattern));
57263
+ looseRecords.push(z22.looseRecord(keySchema, patternValue));
57099
57264
  }
57100
57265
  const schemasToIntersect = [];
57101
57266
  if (Object.keys(shape).length > 0) {
57102
- schemasToIntersect.push(z21.object(shape).passthrough());
57267
+ schemasToIntersect.push(z22.object(shape).passthrough());
57103
57268
  }
57104
57269
  schemasToIntersect.push(...looseRecords);
57105
57270
  if (schemasToIntersect.length === 0) {
57106
- zodSchema2 = z21.object({}).passthrough();
57271
+ zodSchema2 = z22.object({}).passthrough();
57107
57272
  } else if (schemasToIntersect.length === 1) {
57108
57273
  zodSchema2 = schemasToIntersect[0];
57109
57274
  } else {
57110
- let result = z21.intersection(schemasToIntersect[0], schemasToIntersect[1]);
57275
+ let result = z22.intersection(schemasToIntersect[0], schemasToIntersect[1]);
57111
57276
  for (let i = 2; i < schemasToIntersect.length; i++) {
57112
- result = z21.intersection(result, schemasToIntersect[i]);
57277
+ result = z22.intersection(result, schemasToIntersect[i]);
57113
57278
  }
57114
57279
  zodSchema2 = result;
57115
57280
  }
57116
57281
  break;
57117
57282
  }
57118
- const objectSchema = z21.object(shape);
57283
+ const objectSchema = z22.object(shape);
57119
57284
  if (schema.additionalProperties === false) {
57120
57285
  zodSchema2 = objectSchema.strict();
57121
57286
  } else if (typeof schema.additionalProperties === "object") {
@@ -57132,33 +57297,33 @@ function convertBaseSchema(schema, ctx) {
57132
57297
  const tupleItems = prefixItems.map((item) => convertSchema(item, ctx));
57133
57298
  const rest = items && typeof items === "object" && !Array.isArray(items) ? convertSchema(items, ctx) : void 0;
57134
57299
  if (rest) {
57135
- zodSchema2 = z21.tuple(tupleItems).rest(rest);
57300
+ zodSchema2 = z22.tuple(tupleItems).rest(rest);
57136
57301
  } else {
57137
- zodSchema2 = z21.tuple(tupleItems);
57302
+ zodSchema2 = z22.tuple(tupleItems);
57138
57303
  }
57139
57304
  if (typeof schema.minItems === "number") {
57140
- zodSchema2 = zodSchema2.check(z21.minLength(schema.minItems));
57305
+ zodSchema2 = zodSchema2.check(z22.minLength(schema.minItems));
57141
57306
  }
57142
57307
  if (typeof schema.maxItems === "number") {
57143
- zodSchema2 = zodSchema2.check(z21.maxLength(schema.maxItems));
57308
+ zodSchema2 = zodSchema2.check(z22.maxLength(schema.maxItems));
57144
57309
  }
57145
57310
  } else if (Array.isArray(items)) {
57146
57311
  const tupleItems = items.map((item) => convertSchema(item, ctx));
57147
57312
  const rest = schema.additionalItems && typeof schema.additionalItems === "object" ? convertSchema(schema.additionalItems, ctx) : void 0;
57148
57313
  if (rest) {
57149
- zodSchema2 = z21.tuple(tupleItems).rest(rest);
57314
+ zodSchema2 = z22.tuple(tupleItems).rest(rest);
57150
57315
  } else {
57151
- zodSchema2 = z21.tuple(tupleItems);
57316
+ zodSchema2 = z22.tuple(tupleItems);
57152
57317
  }
57153
57318
  if (typeof schema.minItems === "number") {
57154
- zodSchema2 = zodSchema2.check(z21.minLength(schema.minItems));
57319
+ zodSchema2 = zodSchema2.check(z22.minLength(schema.minItems));
57155
57320
  }
57156
57321
  if (typeof schema.maxItems === "number") {
57157
- zodSchema2 = zodSchema2.check(z21.maxLength(schema.maxItems));
57322
+ zodSchema2 = zodSchema2.check(z22.maxLength(schema.maxItems));
57158
57323
  }
57159
57324
  } else if (items !== void 0) {
57160
57325
  const element = convertSchema(items, ctx);
57161
- let arraySchema = z21.array(element);
57326
+ let arraySchema = z22.array(element);
57162
57327
  if (typeof schema.minItems === "number") {
57163
57328
  arraySchema = arraySchema.min(schema.minItems);
57164
57329
  }
@@ -57167,7 +57332,7 @@ function convertBaseSchema(schema, ctx) {
57167
57332
  }
57168
57333
  zodSchema2 = arraySchema;
57169
57334
  } else {
57170
- zodSchema2 = z21.array(z21.any());
57335
+ zodSchema2 = z22.array(z22.any());
57171
57336
  }
57172
57337
  break;
57173
57338
  }
@@ -57184,37 +57349,37 @@ function convertBaseSchema(schema, ctx) {
57184
57349
  }
57185
57350
  function convertSchema(schema, ctx) {
57186
57351
  if (typeof schema === "boolean") {
57187
- return schema ? z21.any() : z21.never();
57352
+ return schema ? z22.any() : z22.never();
57188
57353
  }
57189
57354
  let baseSchema = convertBaseSchema(schema, ctx);
57190
57355
  const hasExplicitType = schema.type || schema.enum !== void 0 || schema.const !== void 0;
57191
57356
  if (schema.anyOf && Array.isArray(schema.anyOf)) {
57192
57357
  const options = schema.anyOf.map((s) => convertSchema(s, ctx));
57193
- const anyOfUnion = z21.union(options);
57194
- baseSchema = hasExplicitType ? z21.intersection(baseSchema, anyOfUnion) : anyOfUnion;
57358
+ const anyOfUnion = z22.union(options);
57359
+ baseSchema = hasExplicitType ? z22.intersection(baseSchema, anyOfUnion) : anyOfUnion;
57195
57360
  }
57196
57361
  if (schema.oneOf && Array.isArray(schema.oneOf)) {
57197
57362
  const options = schema.oneOf.map((s) => convertSchema(s, ctx));
57198
- const oneOfUnion = z21.xor(options);
57199
- baseSchema = hasExplicitType ? z21.intersection(baseSchema, oneOfUnion) : oneOfUnion;
57363
+ const oneOfUnion = z22.xor(options);
57364
+ baseSchema = hasExplicitType ? z22.intersection(baseSchema, oneOfUnion) : oneOfUnion;
57200
57365
  }
57201
57366
  if (schema.allOf && Array.isArray(schema.allOf)) {
57202
57367
  if (schema.allOf.length === 0) {
57203
- baseSchema = hasExplicitType ? baseSchema : z21.any();
57368
+ baseSchema = hasExplicitType ? baseSchema : z22.any();
57204
57369
  } else {
57205
57370
  let result = hasExplicitType ? baseSchema : convertSchema(schema.allOf[0], ctx);
57206
57371
  const startIdx = hasExplicitType ? 0 : 1;
57207
57372
  for (let i = startIdx; i < schema.allOf.length; i++) {
57208
- result = z21.intersection(result, convertSchema(schema.allOf[i], ctx));
57373
+ result = z22.intersection(result, convertSchema(schema.allOf[i], ctx));
57209
57374
  }
57210
57375
  baseSchema = result;
57211
57376
  }
57212
57377
  }
57213
57378
  if (schema.nullable === true && ctx.version === "openapi-3.0") {
57214
- baseSchema = z21.nullable(baseSchema);
57379
+ baseSchema = z22.nullable(baseSchema);
57215
57380
  }
57216
57381
  if (schema.readOnly === true) {
57217
- baseSchema = z21.readonly(baseSchema);
57382
+ baseSchema = z22.readonly(baseSchema);
57218
57383
  }
57219
57384
  const extraMeta = {};
57220
57385
  const coreMetadataKeys = ["$id", "id", "$comment", "$anchor", "$vocabulary", "$dynamicRef", "$dynamicAnchor"];
@@ -57241,7 +57406,7 @@ function convertSchema(schema, ctx) {
57241
57406
  }
57242
57407
  function fromJSONSchema(schema, params) {
57243
57408
  if (typeof schema === "boolean") {
57244
- return schema ? z21.any() : z21.never();
57409
+ return schema ? z22.any() : z22.never();
57245
57410
  }
57246
57411
  const version2 = detectVersion(schema, params?.defaultTarget);
57247
57412
  const defs = schema.$defs || schema.definitions || {};
@@ -57255,14 +57420,14 @@ function fromJSONSchema(schema, params) {
57255
57420
  };
57256
57421
  return convertSchema(schema, ctx);
57257
57422
  }
57258
- var z21, RECOGNIZED_KEYS;
57423
+ var z22, RECOGNIZED_KEYS;
57259
57424
  var init_from_json_schema = __esm({
57260
57425
  "node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/from-json-schema.js"() {
57261
57426
  init_registries();
57262
57427
  init_checks2();
57263
57428
  init_iso();
57264
57429
  init_schemas2();
57265
- z21 = {
57430
+ z22 = {
57266
57431
  ...schemas_exports2,
57267
57432
  ...checks_exports2,
57268
57433
  iso: iso_exports