@cleocode/core 2026.6.7 → 2026.6.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/db/index.d.ts +5 -1
- package/dist/db/index.d.ts.map +1 -1
- package/dist/db/index.js +5 -1
- package/dist/db/index.js.map +1 -1
- package/dist/docs/build-provenance-graph.d.ts +12 -0
- package/dist/docs/build-provenance-graph.d.ts.map +1 -1
- package/dist/docs/build-provenance-graph.js +52 -0
- package/dist/docs/build-provenance-graph.js.map +1 -1
- package/dist/docs/display-alias.d.ts +97 -0
- package/dist/docs/display-alias.d.ts.map +1 -0
- package/dist/docs/display-alias.js +136 -0
- package/dist/docs/display-alias.js.map +1 -0
- package/dist/docs/docs-read-model.d.ts +47 -0
- package/dist/docs/docs-read-model.d.ts.map +1 -1
- package/dist/docs/docs-read-model.js +40 -2
- package/dist/docs/docs-read-model.js.map +1 -1
- package/dist/docs/export-document.js +929 -732
- package/dist/docs/export-document.js.map +3 -3
- package/dist/docs/index.d.ts +6 -0
- package/dist/docs/index.d.ts.map +1 -1
- package/dist/docs/index.js +3 -0
- package/dist/docs/index.js.map +1 -1
- package/dist/docs/numbering.d.ts +29 -0
- package/dist/docs/numbering.d.ts.map +1 -1
- package/dist/docs/numbering.js +41 -0
- package/dist/docs/numbering.js.map +1 -1
- package/dist/docs/read-doc.d.ts +60 -0
- package/dist/docs/read-doc.d.ts.map +1 -0
- package/dist/docs/read-doc.js +188 -0
- package/dist/docs/read-doc.js.map +1 -0
- package/dist/docs/wikilinks.d.ts +119 -0
- package/dist/docs/wikilinks.d.ts.map +1 -0
- package/dist/docs/wikilinks.js +217 -0
- package/dist/docs/wikilinks.js.map +1 -0
- package/dist/internal.d.ts +3 -1
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +2 -1
- package/dist/internal.js.map +1 -1
- package/dist/llm/plugin-facade.js +973 -778
- package/dist/llm/plugin-facade.js.map +3 -3
- package/dist/store/attachment-store.d.ts +5 -0
- package/dist/store/attachment-store.d.ts.map +1 -1
- package/dist/store/attachment-store.js +7 -1
- package/dist/store/attachment-store.js.map +1 -1
- package/dist/store/dual-scope-db.d.ts +83 -0
- package/dist/store/dual-scope-db.d.ts.map +1 -1
- package/dist/store/dual-scope-db.js +135 -6
- package/dist/store/dual-scope-db.js.map +1 -1
- package/dist/store/exodus/abort-events.d.ts +116 -0
- package/dist/store/exodus/abort-events.d.ts.map +1 -0
- package/dist/store/exodus/abort-events.js +130 -0
- package/dist/store/exodus/abort-events.js.map +1 -0
- package/dist/store/exodus/index.d.ts +1 -0
- package/dist/store/exodus/index.d.ts.map +1 -1
- package/dist/store/exodus/index.js +1 -0
- package/dist/store/exodus/index.js.map +1 -1
- package/dist/store/repair-malformed-dbs.d.ts +87 -0
- package/dist/store/repair-malformed-dbs.d.ts.map +1 -0
- package/dist/store/repair-malformed-dbs.js +188 -0
- package/dist/store/repair-malformed-dbs.js.map +1 -0
- package/dist/store/schema/attachments.d.ts +149 -0
- package/dist/store/schema/attachments.d.ts.map +1 -1
- package/dist/store/schema/attachments.js +93 -0
- package/dist/store/schema/attachments.js.map +1 -1
- package/migrations/drizzle-tasks/20260605000001_t11826-docs-wikilinks/migration.sql +110 -0
- package/migrations/drizzle-tasks/20260606000001_t11875-attachments-display-alias/migration.sql +46 -0
- package/package.json +12 -12
|
@@ -7902,7 +7902,7 @@ var init_operations_registry = __esm({
|
|
|
7902
7902
|
gateway: "mutate",
|
|
7903
7903
|
domain: "docs",
|
|
7904
7904
|
operation: "add",
|
|
7905
|
-
description: "docs.add (mutate) \u2014 attach a local file or
|
|
7905
|
+
description: "docs.add (mutate) \u2014 attach a local file, URL, or inline content to a CLEO owner entity (task, session, observation)",
|
|
7906
7906
|
tier: 1,
|
|
7907
7907
|
idempotent: false,
|
|
7908
7908
|
sessionRequired: false,
|
|
@@ -7926,6 +7926,12 @@ var init_operations_registry = __esm({
|
|
|
7926
7926
|
required: false,
|
|
7927
7927
|
description: "Remote URL to attach"
|
|
7928
7928
|
},
|
|
7929
|
+
{
|
|
7930
|
+
name: "content",
|
|
7931
|
+
type: "string",
|
|
7932
|
+
required: false,
|
|
7933
|
+
description: "Inline document body (T10965); mutually exclusive with file/url"
|
|
7934
|
+
},
|
|
7929
7935
|
{
|
|
7930
7936
|
name: "desc",
|
|
7931
7937
|
type: "string",
|
|
@@ -9632,7 +9638,8 @@ var init_provenance = __esm({
|
|
|
9632
9638
|
"superseded-by",
|
|
9633
9639
|
"related-task",
|
|
9634
9640
|
"linked-decision",
|
|
9635
|
-
"derived-from"
|
|
9641
|
+
"derived-from",
|
|
9642
|
+
"shares-topic"
|
|
9636
9643
|
];
|
|
9637
9644
|
DOC_LIFECYCLE_STATUSES = [
|
|
9638
9645
|
"active",
|
|
@@ -9707,6 +9714,41 @@ var init_provenance = __esm({
|
|
|
9707
9714
|
}
|
|
9708
9715
|
});
|
|
9709
9716
|
|
|
9717
|
+
// packages/contracts/src/docs/read.ts
|
|
9718
|
+
import { z as z8 } from "zod";
|
|
9719
|
+
var docFrontmatterSchema, docBodySchema, docReadResponseSchema;
|
|
9720
|
+
var init_read = __esm({
|
|
9721
|
+
"packages/contracts/src/docs/read.ts"() {
|
|
9722
|
+
"use strict";
|
|
9723
|
+
docFrontmatterSchema = z8.object({
|
|
9724
|
+
slug: z8.string(),
|
|
9725
|
+
kind: z8.string().nullable(),
|
|
9726
|
+
title: z8.string().nullable(),
|
|
9727
|
+
summary: z8.string().nullable(),
|
|
9728
|
+
lifecycleStatus: z8.string(),
|
|
9729
|
+
docVersion: z8.number().int(),
|
|
9730
|
+
ownerVersion: z8.string().nullable(),
|
|
9731
|
+
supersedes: z8.string().nullable(),
|
|
9732
|
+
supersededBy: z8.string().nullable(),
|
|
9733
|
+
topics: z8.array(z8.string()).readonly(),
|
|
9734
|
+
relatedTasks: z8.array(z8.string()).readonly(),
|
|
9735
|
+
sha256: z8.string(),
|
|
9736
|
+
createdAt: z8.string()
|
|
9737
|
+
});
|
|
9738
|
+
docBodySchema = z8.object({
|
|
9739
|
+
encoding: z8.enum(["utf-8", "base64"]),
|
|
9740
|
+
text: z8.string().optional(),
|
|
9741
|
+
base64: z8.string().optional(),
|
|
9742
|
+
sizeBytes: z8.number().int().nonnegative(),
|
|
9743
|
+
mimeType: z8.string().nullable()
|
|
9744
|
+
});
|
|
9745
|
+
docReadResponseSchema = z8.object({
|
|
9746
|
+
frontmatter: docFrontmatterSchema,
|
|
9747
|
+
body: docBodySchema
|
|
9748
|
+
});
|
|
9749
|
+
}
|
|
9750
|
+
});
|
|
9751
|
+
|
|
9710
9752
|
// packages/contracts/src/engine-result.ts
|
|
9711
9753
|
var init_engine_result = __esm({
|
|
9712
9754
|
"packages/contracts/src/engine-result.ts"() {
|
|
@@ -9882,72 +9924,72 @@ var init_errors = __esm({
|
|
|
9882
9924
|
});
|
|
9883
9925
|
|
|
9884
9926
|
// packages/contracts/src/evidence-atom-schema.ts
|
|
9885
|
-
import { z as
|
|
9927
|
+
import { z as z9 } from "zod";
|
|
9886
9928
|
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;
|
|
9887
9929
|
var init_evidence_atom_schema = __esm({
|
|
9888
9930
|
"packages/contracts/src/evidence-atom-schema.ts"() {
|
|
9889
9931
|
"use strict";
|
|
9890
|
-
commitAtomSchema =
|
|
9891
|
-
kind:
|
|
9892
|
-
sha:
|
|
9932
|
+
commitAtomSchema = z9.object({
|
|
9933
|
+
kind: z9.literal("commit"),
|
|
9934
|
+
sha: z9.string().regex(/^[0-9a-f]{7,40}$/i, "commit sha must be 7-40 hex characters")
|
|
9893
9935
|
});
|
|
9894
|
-
filesAtomSchema =
|
|
9895
|
-
kind:
|
|
9896
|
-
paths:
|
|
9936
|
+
filesAtomSchema = z9.object({
|
|
9937
|
+
kind: z9.literal("files"),
|
|
9938
|
+
paths: z9.array(z9.string().min(1)).min(1, "files atom requires at least one path")
|
|
9897
9939
|
});
|
|
9898
|
-
testRunAtomSchema =
|
|
9899
|
-
kind:
|
|
9900
|
-
path:
|
|
9940
|
+
testRunAtomSchema = z9.object({
|
|
9941
|
+
kind: z9.literal("test-run"),
|
|
9942
|
+
path: z9.string().min(1, "test-run atom requires a non-empty path")
|
|
9901
9943
|
});
|
|
9902
|
-
toolAtomSchema =
|
|
9903
|
-
kind:
|
|
9904
|
-
tool:
|
|
9944
|
+
toolAtomSchema = z9.object({
|
|
9945
|
+
kind: z9.literal("tool"),
|
|
9946
|
+
tool: z9.string().min(1, "tool atom requires a non-empty tool name")
|
|
9905
9947
|
});
|
|
9906
|
-
urlAtomSchema =
|
|
9907
|
-
kind:
|
|
9908
|
-
url:
|
|
9948
|
+
urlAtomSchema = z9.object({
|
|
9949
|
+
kind: z9.literal("url"),
|
|
9950
|
+
url: z9.string().min(1).regex(/^https?:\/\//, "url atom must start with http:// or https://")
|
|
9909
9951
|
});
|
|
9910
|
-
noteAtomSchema =
|
|
9911
|
-
kind:
|
|
9912
|
-
note:
|
|
9952
|
+
noteAtomSchema = z9.object({
|
|
9953
|
+
kind: z9.literal("note"),
|
|
9954
|
+
note: z9.string().min(1, "note atom must be non-empty").max(512, "note atom is too long (max 512 chars)")
|
|
9913
9955
|
});
|
|
9914
|
-
decisionAtomSchema =
|
|
9915
|
-
kind:
|
|
9916
|
-
decisionId:
|
|
9956
|
+
decisionAtomSchema = z9.object({
|
|
9957
|
+
kind: z9.literal("decision"),
|
|
9958
|
+
decisionId: z9.string().min(1, "decision atom requires a non-empty decision ID")
|
|
9917
9959
|
});
|
|
9918
|
-
prAtomSchema =
|
|
9919
|
-
kind:
|
|
9920
|
-
prNumber:
|
|
9960
|
+
prAtomSchema = z9.object({
|
|
9961
|
+
kind: z9.literal("pr"),
|
|
9962
|
+
prNumber: z9.number().int().positive("pr atom requires a positive integer PR number")
|
|
9921
9963
|
});
|
|
9922
|
-
locDropAtomSchema =
|
|
9923
|
-
kind:
|
|
9924
|
-
fromLines:
|
|
9925
|
-
toLines:
|
|
9964
|
+
locDropAtomSchema = z9.object({
|
|
9965
|
+
kind: z9.literal("loc-drop"),
|
|
9966
|
+
fromLines: z9.number().int().nonnegative("loc-drop fromLines must be \u2265 0"),
|
|
9967
|
+
toLines: z9.number().int().nonnegative("loc-drop toLines must be \u2265 0")
|
|
9926
9968
|
});
|
|
9927
|
-
callsiteCoverageAtomSchema =
|
|
9928
|
-
kind:
|
|
9929
|
-
symbolName:
|
|
9930
|
-
relativeSourcePath:
|
|
9969
|
+
callsiteCoverageAtomSchema = z9.object({
|
|
9970
|
+
kind: z9.literal("callsite-coverage"),
|
|
9971
|
+
symbolName: z9.string().min(1, "callsite-coverage atom requires a non-empty symbolName"),
|
|
9972
|
+
relativeSourcePath: z9.string().min(1, "callsite-coverage atom requires a non-empty relativeSourcePath")
|
|
9931
9973
|
});
|
|
9932
9974
|
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}$/;
|
|
9933
9975
|
AC_ALIAS_REGEX = /^AC[0-9]{1,4}$/;
|
|
9934
9976
|
SATISFIES_TASK_ID_REGEX = /^T[0-9]{1,7}$/;
|
|
9935
9977
|
SATISFIES_VERSION_PIN_REGEX = /^[0-9]{14}$/;
|
|
9936
|
-
satisfiesAtomSchema =
|
|
9937
|
-
kind:
|
|
9978
|
+
satisfiesAtomSchema = z9.object({
|
|
9979
|
+
kind: z9.literal("satisfies"),
|
|
9938
9980
|
/** Target task ID — `T<1-7 digits>` per ADR-079-r2 §2.1. */
|
|
9939
|
-
targetTaskId:
|
|
9981
|
+
targetTaskId: z9.string().regex(SATISFIES_TASK_ID_REGEX, "satisfies atom targetTaskId must match /^T[0-9]{1,7}$/"),
|
|
9940
9982
|
/** Lowercase UUIDv4/v5 — populated for the canonical form; undefined for alias form. */
|
|
9941
|
-
targetAcId:
|
|
9983
|
+
targetAcId: z9.string().regex(AC_UUID_REGEX, "satisfies atom targetAcId must be a lowercase UUIDv4/v5").optional(),
|
|
9942
9984
|
/** Positional alias `AC<1-4 digits>` — populated for alias form; undefined for UUID form. */
|
|
9943
|
-
targetAcAlias:
|
|
9985
|
+
targetAcAlias: z9.string().regex(AC_ALIAS_REGEX, "satisfies atom targetAcAlias must match /^AC[0-9]{1,4}$/").optional(),
|
|
9944
9986
|
/** Optional `@<14-digit YYYYMMDDhhmmss>` pin captured at mint time. */
|
|
9945
|
-
versionPin:
|
|
9987
|
+
versionPin: z9.string().regex(
|
|
9946
9988
|
SATISFIES_VERSION_PIN_REGEX,
|
|
9947
9989
|
"satisfies atom versionPin must be 14 digits (YYYYMMDDhhmmss)"
|
|
9948
9990
|
).optional()
|
|
9949
9991
|
});
|
|
9950
|
-
EvidenceAtomSchema =
|
|
9992
|
+
EvidenceAtomSchema = z9.discriminatedUnion("kind", [
|
|
9951
9993
|
commitAtomSchema,
|
|
9952
9994
|
filesAtomSchema,
|
|
9953
9995
|
testRunAtomSchema,
|
|
@@ -9994,58 +10036,58 @@ var init_evidence_atom_schema = __esm({
|
|
|
9994
10036
|
});
|
|
9995
10037
|
|
|
9996
10038
|
// packages/contracts/src/evidence-record-schema.ts
|
|
9997
|
-
import { z as
|
|
10039
|
+
import { z as z10 } from "zod";
|
|
9998
10040
|
var evidenceBaseSchema, implDiffRecordSchema, validateSpecCheckRecordSchema, testOutputRecordSchema, lintReportRecordSchema, commandOutputRecordSchema, evidenceRecordSchema;
|
|
9999
10041
|
var init_evidence_record_schema = __esm({
|
|
10000
10042
|
"packages/contracts/src/evidence-record-schema.ts"() {
|
|
10001
10043
|
"use strict";
|
|
10002
|
-
evidenceBaseSchema =
|
|
10044
|
+
evidenceBaseSchema = z10.object({
|
|
10003
10045
|
/** Identity string of the agent that produced this record. */
|
|
10004
|
-
agentIdentity:
|
|
10046
|
+
agentIdentity: z10.string().min(1),
|
|
10005
10047
|
/** SHA-256 hex digest (64 chars) of the attached artifact. */
|
|
10006
|
-
attachmentSha256:
|
|
10048
|
+
attachmentSha256: z10.string().length(64),
|
|
10007
10049
|
/** ISO 8601 timestamp at which the action ran. */
|
|
10008
|
-
ranAt:
|
|
10050
|
+
ranAt: z10.string().datetime(),
|
|
10009
10051
|
/** Wall-clock duration of the action in milliseconds. */
|
|
10010
|
-
durationMs:
|
|
10052
|
+
durationMs: z10.number().nonnegative()
|
|
10011
10053
|
});
|
|
10012
10054
|
implDiffRecordSchema = evidenceBaseSchema.extend({
|
|
10013
|
-
kind:
|
|
10014
|
-
phase:
|
|
10015
|
-
filesChanged:
|
|
10016
|
-
linesAdded:
|
|
10017
|
-
linesRemoved:
|
|
10055
|
+
kind: z10.literal("impl-diff"),
|
|
10056
|
+
phase: z10.literal("implement"),
|
|
10057
|
+
filesChanged: z10.array(z10.string().min(1)).min(1),
|
|
10058
|
+
linesAdded: z10.number().int().nonnegative(),
|
|
10059
|
+
linesRemoved: z10.number().int().nonnegative()
|
|
10018
10060
|
});
|
|
10019
10061
|
validateSpecCheckRecordSchema = evidenceBaseSchema.extend({
|
|
10020
|
-
kind:
|
|
10021
|
-
phase:
|
|
10022
|
-
reqIdsChecked:
|
|
10023
|
-
passed:
|
|
10024
|
-
details:
|
|
10062
|
+
kind: z10.literal("validate-spec-check"),
|
|
10063
|
+
phase: z10.literal("validate"),
|
|
10064
|
+
reqIdsChecked: z10.array(z10.string().min(1)).min(1),
|
|
10065
|
+
passed: z10.boolean(),
|
|
10066
|
+
details: z10.string().min(1)
|
|
10025
10067
|
});
|
|
10026
10068
|
testOutputRecordSchema = evidenceBaseSchema.extend({
|
|
10027
|
-
kind:
|
|
10028
|
-
phase:
|
|
10029
|
-
command:
|
|
10030
|
-
exitCode:
|
|
10031
|
-
testsPassed:
|
|
10032
|
-
testsFailed:
|
|
10069
|
+
kind: z10.literal("test-output"),
|
|
10070
|
+
phase: z10.literal("test"),
|
|
10071
|
+
command: z10.string().min(1),
|
|
10072
|
+
exitCode: z10.number().int(),
|
|
10073
|
+
testsPassed: z10.number().int().nonnegative(),
|
|
10074
|
+
testsFailed: z10.number().int().nonnegative()
|
|
10033
10075
|
});
|
|
10034
10076
|
lintReportRecordSchema = evidenceBaseSchema.extend({
|
|
10035
|
-
kind:
|
|
10036
|
-
phase:
|
|
10037
|
-
tool:
|
|
10038
|
-
passed:
|
|
10039
|
-
warnings:
|
|
10040
|
-
errors:
|
|
10077
|
+
kind: z10.literal("lint-report"),
|
|
10078
|
+
phase: z10.enum(["implement", "test"]),
|
|
10079
|
+
tool: z10.string().min(1),
|
|
10080
|
+
passed: z10.boolean(),
|
|
10081
|
+
warnings: z10.number().int().nonnegative(),
|
|
10082
|
+
errors: z10.number().int().nonnegative()
|
|
10041
10083
|
});
|
|
10042
10084
|
commandOutputRecordSchema = evidenceBaseSchema.extend({
|
|
10043
|
-
kind:
|
|
10044
|
-
phase:
|
|
10045
|
-
cmd:
|
|
10046
|
-
exitCode:
|
|
10085
|
+
kind: z10.literal("command-output"),
|
|
10086
|
+
phase: z10.enum(["implement", "validate", "test"]),
|
|
10087
|
+
cmd: z10.string().min(1),
|
|
10088
|
+
exitCode: z10.number().int()
|
|
10047
10089
|
});
|
|
10048
|
-
evidenceRecordSchema =
|
|
10090
|
+
evidenceRecordSchema = z10.discriminatedUnion("kind", [
|
|
10049
10091
|
implDiffRecordSchema,
|
|
10050
10092
|
validateSpecCheckRecordSchema,
|
|
10051
10093
|
testOutputRecordSchema,
|
|
@@ -10647,7 +10689,7 @@ var init_status_registry = __esm({
|
|
|
10647
10689
|
});
|
|
10648
10690
|
|
|
10649
10691
|
// packages/contracts/src/workgraph.ts
|
|
10650
|
-
import { z as
|
|
10692
|
+
import { z as z11 } from "zod";
|
|
10651
10693
|
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;
|
|
10652
10694
|
var init_workgraph = __esm({
|
|
10653
10695
|
"packages/contracts/src/workgraph.ts"() {
|
|
@@ -10655,10 +10697,10 @@ var init_workgraph = __esm({
|
|
|
10655
10697
|
init_enums();
|
|
10656
10698
|
init_status_registry();
|
|
10657
10699
|
E_WORKGRAPH_PARENT_TYPE_MATRIX = "E_WORKGRAPH_PARENT_TYPE_MATRIX";
|
|
10658
|
-
taskTypeSchema =
|
|
10659
|
-
taskPrioritySchema =
|
|
10660
|
-
taskStatusSchema =
|
|
10661
|
-
verificationGateSchema =
|
|
10700
|
+
taskTypeSchema = z11.enum(["saga", "epic", "task", "subtask"]);
|
|
10701
|
+
taskPrioritySchema = z11.enum(["critical", "high", "medium", "low"]);
|
|
10702
|
+
taskStatusSchema = z11.enum(TASK_STATUSES);
|
|
10703
|
+
verificationGateSchema = z11.enum([
|
|
10662
10704
|
"implemented",
|
|
10663
10705
|
"testsPassed",
|
|
10664
10706
|
"qaPassed",
|
|
@@ -10667,7 +10709,7 @@ var init_workgraph = __esm({
|
|
|
10667
10709
|
"documented",
|
|
10668
10710
|
"nexusImpact"
|
|
10669
10711
|
]);
|
|
10670
|
-
workGraphRelationKindSchema =
|
|
10712
|
+
workGraphRelationKindSchema = z11.enum([
|
|
10671
10713
|
"contains",
|
|
10672
10714
|
"depends_on",
|
|
10673
10715
|
"blocks",
|
|
@@ -10675,317 +10717,317 @@ var init_workgraph = __esm({
|
|
|
10675
10717
|
"groups",
|
|
10676
10718
|
"satisfies"
|
|
10677
10719
|
]);
|
|
10678
|
-
workGraphTraversalDirectionSchema =
|
|
10720
|
+
workGraphTraversalDirectionSchema = z11.enum([
|
|
10679
10721
|
"ancestors",
|
|
10680
10722
|
"descendants",
|
|
10681
10723
|
"upstream",
|
|
10682
10724
|
"downstream"
|
|
10683
10725
|
]);
|
|
10684
|
-
workGraphEdgeDirectionSchema =
|
|
10685
|
-
paginationParamsSchema =
|
|
10686
|
-
cursor:
|
|
10687
|
-
limit:
|
|
10726
|
+
workGraphEdgeDirectionSchema = z11.enum(["out", "in", "both"]);
|
|
10727
|
+
paginationParamsSchema = z11.object({
|
|
10728
|
+
cursor: z11.string().min(1).optional(),
|
|
10729
|
+
limit: z11.number().int().positive().max(500).optional()
|
|
10688
10730
|
});
|
|
10689
|
-
workGraphNodeSchema =
|
|
10690
|
-
id:
|
|
10731
|
+
workGraphNodeSchema = z11.object({
|
|
10732
|
+
id: z11.string().min(1),
|
|
10691
10733
|
type: taskTypeSchema,
|
|
10692
|
-
title:
|
|
10734
|
+
title: z11.string(),
|
|
10693
10735
|
status: taskStatusSchema,
|
|
10694
10736
|
priority: taskPrioritySchema,
|
|
10695
|
-
parentId:
|
|
10737
|
+
parentId: z11.string().min(1).optional()
|
|
10696
10738
|
});
|
|
10697
|
-
workGraphEdgeSchema =
|
|
10698
|
-
fromId:
|
|
10699
|
-
toId:
|
|
10739
|
+
workGraphEdgeSchema = z11.object({
|
|
10740
|
+
fromId: z11.string().min(1),
|
|
10741
|
+
toId: z11.string().min(1),
|
|
10700
10742
|
kind: workGraphRelationKindSchema
|
|
10701
10743
|
});
|
|
10702
|
-
workGraphHierarchyEdgeSchema =
|
|
10703
|
-
fromId:
|
|
10704
|
-
toId:
|
|
10705
|
-
kind:
|
|
10744
|
+
workGraphHierarchyEdgeSchema = z11.object({
|
|
10745
|
+
fromId: z11.string().min(1),
|
|
10746
|
+
toId: z11.string().min(1),
|
|
10747
|
+
kind: z11.literal("contains")
|
|
10706
10748
|
}).strict();
|
|
10707
|
-
workGraphPageInfoSchema =
|
|
10708
|
-
nextCursor:
|
|
10709
|
-
hasMore:
|
|
10749
|
+
workGraphPageInfoSchema = z11.object({
|
|
10750
|
+
nextCursor: z11.string().min(1).optional(),
|
|
10751
|
+
hasMore: z11.boolean()
|
|
10710
10752
|
});
|
|
10711
|
-
workGraphRollupCountsSchema =
|
|
10712
|
-
total:
|
|
10713
|
-
byStatus:
|
|
10714
|
-
byType:
|
|
10753
|
+
workGraphRollupCountsSchema = z11.object({
|
|
10754
|
+
total: z11.number().int().nonnegative(),
|
|
10755
|
+
byStatus: z11.partialRecord(taskStatusSchema, z11.number().int().nonnegative()),
|
|
10756
|
+
byType: z11.partialRecord(taskTypeSchema, z11.number().int().nonnegative())
|
|
10715
10757
|
});
|
|
10716
|
-
workGraphSubtreePercentagesSchema =
|
|
10717
|
-
done:
|
|
10718
|
-
active:
|
|
10719
|
-
blocked:
|
|
10720
|
-
pending:
|
|
10721
|
-
cancelled:
|
|
10758
|
+
workGraphSubtreePercentagesSchema = z11.object({
|
|
10759
|
+
done: z11.number().nonnegative(),
|
|
10760
|
+
active: z11.number().nonnegative(),
|
|
10761
|
+
blocked: z11.number().nonnegative(),
|
|
10762
|
+
pending: z11.number().nonnegative(),
|
|
10763
|
+
cancelled: z11.number().nonnegative()
|
|
10722
10764
|
});
|
|
10723
|
-
workGraphProjectionMismatchSchema =
|
|
10724
|
-
field:
|
|
10725
|
-
expected:
|
|
10726
|
-
actual:
|
|
10765
|
+
workGraphProjectionMismatchSchema = z11.object({
|
|
10766
|
+
field: z11.string().min(1),
|
|
10767
|
+
expected: z11.number().int().nonnegative(),
|
|
10768
|
+
actual: z11.number().int().nonnegative()
|
|
10727
10769
|
});
|
|
10728
10770
|
workGraphReadyFrontierTaskSchema = workGraphNodeSchema.extend({
|
|
10729
|
-
role:
|
|
10730
|
-
dependencyBlockers:
|
|
10731
|
-
gateBlockers:
|
|
10771
|
+
role: z11.string().min(1).optional(),
|
|
10772
|
+
dependencyBlockers: z11.array(z11.object({ taskId: z11.string().min(1), status: taskStatusSchema })),
|
|
10773
|
+
gateBlockers: z11.array(z11.object({ gate: verificationGateSchema }))
|
|
10732
10774
|
});
|
|
10733
10775
|
workGraphRelationEdgeSchema = workGraphEdgeSchema.extend({
|
|
10734
|
-
source:
|
|
10735
|
-
relationType:
|
|
10736
|
-
reason:
|
|
10776
|
+
source: z11.literal("relation"),
|
|
10777
|
+
relationType: z11.enum(TASK_RELATION_TYPES),
|
|
10778
|
+
reason: z11.string().min(1).optional()
|
|
10737
10779
|
});
|
|
10738
10780
|
workGraphDependencyEdgeSchema = workGraphEdgeSchema.extend({
|
|
10739
|
-
source:
|
|
10740
|
-
kind:
|
|
10781
|
+
source: z11.literal("dependency"),
|
|
10782
|
+
kind: z11.literal("depends_on")
|
|
10741
10783
|
});
|
|
10742
|
-
workGraphOmissionReasonSchema =
|
|
10784
|
+
workGraphOmissionReasonSchema = z11.enum([
|
|
10743
10785
|
"budget_exceeded",
|
|
10744
10786
|
"not_requested",
|
|
10745
10787
|
"not_available",
|
|
10746
10788
|
"redacted",
|
|
10747
10789
|
"truncated"
|
|
10748
10790
|
]);
|
|
10749
|
-
workGraphContextBudgetSchema =
|
|
10750
|
-
tokenBudget:
|
|
10751
|
-
estimatedTokens:
|
|
10752
|
-
remainingTokens:
|
|
10753
|
-
truncated:
|
|
10791
|
+
workGraphContextBudgetSchema = z11.object({
|
|
10792
|
+
tokenBudget: z11.number().int().nonnegative(),
|
|
10793
|
+
estimatedTokens: z11.number().int().nonnegative(),
|
|
10794
|
+
remainingTokens: z11.number().int().nonnegative(),
|
|
10795
|
+
truncated: z11.boolean()
|
|
10754
10796
|
});
|
|
10755
|
-
workGraphOmissionSchema =
|
|
10756
|
-
path:
|
|
10797
|
+
workGraphOmissionSchema = z11.object({
|
|
10798
|
+
path: z11.string().min(1),
|
|
10757
10799
|
reason: workGraphOmissionReasonSchema,
|
|
10758
|
-
message:
|
|
10759
|
-
estimatedTokens:
|
|
10800
|
+
message: z11.string().min(1),
|
|
10801
|
+
estimatedTokens: z11.number().int().nonnegative().optional()
|
|
10760
10802
|
});
|
|
10761
|
-
workGraphDirectEdgeSchema =
|
|
10803
|
+
workGraphDirectEdgeSchema = z11.discriminatedUnion("source", [
|
|
10762
10804
|
workGraphRelationEdgeSchema,
|
|
10763
10805
|
workGraphDependencyEdgeSchema
|
|
10764
10806
|
]);
|
|
10765
10807
|
workGraphContextPackParamsSchema = paginationParamsSchema.extend({
|
|
10766
|
-
rootId:
|
|
10767
|
-
tokenBudget:
|
|
10768
|
-
includeRelations:
|
|
10769
|
-
includeReadiness:
|
|
10770
|
-
includeRollup:
|
|
10808
|
+
rootId: z11.string().min(1),
|
|
10809
|
+
tokenBudget: z11.number().int().positive().optional(),
|
|
10810
|
+
includeRelations: z11.boolean().optional(),
|
|
10811
|
+
includeReadiness: z11.boolean().optional(),
|
|
10812
|
+
includeRollup: z11.boolean().optional()
|
|
10771
10813
|
});
|
|
10772
10814
|
workGraphSliceParamsSchema = paginationParamsSchema.extend({
|
|
10773
|
-
rootId:
|
|
10815
|
+
rootId: z11.string().min(1),
|
|
10774
10816
|
direction: workGraphTraversalDirectionSchema.optional(),
|
|
10775
|
-
maxDepth:
|
|
10776
|
-
includeRelations:
|
|
10817
|
+
maxDepth: z11.number().int().nonnegative().optional(),
|
|
10818
|
+
includeRelations: z11.boolean().optional()
|
|
10777
10819
|
});
|
|
10778
|
-
workGraphSliceSchema =
|
|
10779
|
-
rootId:
|
|
10820
|
+
workGraphSliceSchema = z11.object({
|
|
10821
|
+
rootId: z11.string().min(1),
|
|
10780
10822
|
direction: workGraphTraversalDirectionSchema,
|
|
10781
|
-
nodes:
|
|
10782
|
-
edges:
|
|
10823
|
+
nodes: z11.array(workGraphNodeSchema),
|
|
10824
|
+
edges: z11.array(workGraphEdgeSchema),
|
|
10783
10825
|
pageInfo: workGraphPageInfoSchema,
|
|
10784
|
-
omissions:
|
|
10826
|
+
omissions: z11.array(workGraphOmissionSchema).optional()
|
|
10785
10827
|
});
|
|
10786
|
-
workGraphReadinessParamsSchema =
|
|
10787
|
-
rootId:
|
|
10788
|
-
role:
|
|
10789
|
-
includeGateBlockers:
|
|
10828
|
+
workGraphReadinessParamsSchema = z11.object({
|
|
10829
|
+
rootId: z11.string().min(1),
|
|
10830
|
+
role: z11.string().min(1).optional(),
|
|
10831
|
+
includeGateBlockers: z11.boolean().optional()
|
|
10790
10832
|
});
|
|
10791
|
-
workGraphReadinessResultSchema =
|
|
10792
|
-
rootId:
|
|
10793
|
-
role:
|
|
10794
|
-
ready:
|
|
10795
|
-
warnings:
|
|
10796
|
-
groups:
|
|
10797
|
-
ready:
|
|
10798
|
-
blocked:
|
|
10799
|
-
blockedBy:
|
|
10800
|
-
|
|
10801
|
-
|
|
10802
|
-
kind:
|
|
10803
|
-
blockerId:
|
|
10804
|
-
blocks:
|
|
10833
|
+
workGraphReadinessResultSchema = z11.object({
|
|
10834
|
+
rootId: z11.string().min(1),
|
|
10835
|
+
role: z11.string().min(1).optional(),
|
|
10836
|
+
ready: z11.boolean(),
|
|
10837
|
+
warnings: z11.array(z11.string()),
|
|
10838
|
+
groups: z11.object({
|
|
10839
|
+
ready: z11.array(workGraphReadyFrontierTaskSchema),
|
|
10840
|
+
blocked: z11.array(workGraphReadyFrontierTaskSchema),
|
|
10841
|
+
blockedBy: z11.array(
|
|
10842
|
+
z11.discriminatedUnion("kind", [
|
|
10843
|
+
z11.object({
|
|
10844
|
+
kind: z11.literal("dependency"),
|
|
10845
|
+
blockerId: z11.string().min(1),
|
|
10846
|
+
blocks: z11.array(z11.string().min(1))
|
|
10805
10847
|
}),
|
|
10806
|
-
|
|
10807
|
-
kind:
|
|
10848
|
+
z11.object({
|
|
10849
|
+
kind: z11.literal("gate"),
|
|
10808
10850
|
gate: verificationGateSchema,
|
|
10809
|
-
blocks:
|
|
10851
|
+
blocks: z11.array(z11.string().min(1))
|
|
10810
10852
|
})
|
|
10811
10853
|
])
|
|
10812
10854
|
)
|
|
10813
10855
|
})
|
|
10814
10856
|
});
|
|
10815
|
-
workGraphContextPackSchema =
|
|
10816
|
-
rootId:
|
|
10817
|
-
generatedAt:
|
|
10857
|
+
workGraphContextPackSchema = z11.object({
|
|
10858
|
+
rootId: z11.string().min(1),
|
|
10859
|
+
generatedAt: z11.string().min(1),
|
|
10818
10860
|
budget: workGraphContextBudgetSchema,
|
|
10819
10861
|
slice: workGraphSliceSchema,
|
|
10820
|
-
relationEdges:
|
|
10821
|
-
rootId:
|
|
10862
|
+
relationEdges: z11.object({
|
|
10863
|
+
rootId: z11.string().min(1),
|
|
10822
10864
|
direction: workGraphEdgeDirectionSchema,
|
|
10823
|
-
edges:
|
|
10865
|
+
edges: z11.array(workGraphDirectEdgeSchema)
|
|
10824
10866
|
}).optional(),
|
|
10825
10867
|
readiness: workGraphReadinessResultSchema.optional(),
|
|
10826
|
-
rollup:
|
|
10827
|
-
omissions:
|
|
10868
|
+
rollup: z11.lazy(() => tasksRollupResultSchema).optional(),
|
|
10869
|
+
omissions: z11.array(workGraphOmissionSchema)
|
|
10828
10870
|
});
|
|
10829
|
-
workGraphScaffoldValidateParamsSchema =
|
|
10830
|
-
rootId:
|
|
10831
|
-
nodes:
|
|
10832
|
-
|
|
10833
|
-
id:
|
|
10871
|
+
workGraphScaffoldValidateParamsSchema = z11.object({
|
|
10872
|
+
rootId: z11.string().min(1),
|
|
10873
|
+
nodes: z11.array(
|
|
10874
|
+
z11.object({
|
|
10875
|
+
id: z11.string().min(1),
|
|
10834
10876
|
type: taskTypeSchema,
|
|
10835
|
-
parentId:
|
|
10877
|
+
parentId: z11.string().min(1).nullable().optional()
|
|
10836
10878
|
})
|
|
10837
10879
|
),
|
|
10838
|
-
edges:
|
|
10839
|
-
dryRun:
|
|
10880
|
+
edges: z11.array(workGraphDirectEdgeSchema).optional(),
|
|
10881
|
+
dryRun: z11.boolean().optional()
|
|
10840
10882
|
});
|
|
10841
|
-
workGraphScaffoldValidationIssueSchema =
|
|
10842
|
-
code:
|
|
10843
|
-
message:
|
|
10844
|
-
taskId:
|
|
10845
|
-
severity:
|
|
10883
|
+
workGraphScaffoldValidationIssueSchema = z11.object({
|
|
10884
|
+
code: z11.string().min(1),
|
|
10885
|
+
message: z11.string().min(1),
|
|
10886
|
+
taskId: z11.string().min(1).optional(),
|
|
10887
|
+
severity: z11.enum(["error", "warning"])
|
|
10846
10888
|
});
|
|
10847
|
-
workGraphScaffoldValidateResultSchema =
|
|
10848
|
-
rootId:
|
|
10849
|
-
valid:
|
|
10850
|
-
dryRun:
|
|
10851
|
-
issues:
|
|
10852
|
-
hierarchy:
|
|
10853
|
-
valid:
|
|
10854
|
-
violations:
|
|
10855
|
-
|
|
10856
|
-
code:
|
|
10857
|
-
taskId:
|
|
10889
|
+
workGraphScaffoldValidateResultSchema = z11.object({
|
|
10890
|
+
rootId: z11.string().min(1),
|
|
10891
|
+
valid: z11.boolean(),
|
|
10892
|
+
dryRun: z11.boolean(),
|
|
10893
|
+
issues: z11.array(workGraphScaffoldValidationIssueSchema),
|
|
10894
|
+
hierarchy: z11.object({
|
|
10895
|
+
valid: z11.boolean(),
|
|
10896
|
+
violations: z11.array(
|
|
10897
|
+
z11.object({
|
|
10898
|
+
code: z11.literal(E_WORKGRAPH_PARENT_TYPE_MATRIX),
|
|
10899
|
+
taskId: z11.string().min(1),
|
|
10858
10900
|
taskType: taskTypeSchema,
|
|
10859
|
-
parentId:
|
|
10901
|
+
parentId: z11.string().min(1).nullable(),
|
|
10860
10902
|
parentType: taskTypeSchema.optional(),
|
|
10861
|
-
message:
|
|
10903
|
+
message: z11.string().min(1)
|
|
10862
10904
|
})
|
|
10863
10905
|
)
|
|
10864
10906
|
})
|
|
10865
10907
|
});
|
|
10866
10908
|
workGraphScaffoldApplyParamsSchema = workGraphScaffoldValidateParamsSchema.extend({
|
|
10867
|
-
apply:
|
|
10909
|
+
apply: z11.boolean().optional()
|
|
10868
10910
|
});
|
|
10869
10911
|
workGraphScaffoldApplyResultSchema = workGraphScaffoldValidateResultSchema.extend({
|
|
10870
|
-
applied:
|
|
10871
|
-
nodesChanged:
|
|
10872
|
-
edgesChanged:
|
|
10912
|
+
applied: z11.boolean(),
|
|
10913
|
+
nodesChanged: z11.number().int().nonnegative(),
|
|
10914
|
+
edgesChanged: z11.number().int().nonnegative()
|
|
10873
10915
|
});
|
|
10874
|
-
workGraphPlanningDocParamsSchema =
|
|
10875
|
-
rootId:
|
|
10876
|
-
audience:
|
|
10877
|
-
tokenBudget:
|
|
10878
|
-
includeRelations:
|
|
10879
|
-
includeReadiness:
|
|
10880
|
-
includeRollup:
|
|
10916
|
+
workGraphPlanningDocParamsSchema = z11.object({
|
|
10917
|
+
rootId: z11.string().min(1),
|
|
10918
|
+
audience: z11.enum(["agent", "maintainer"]),
|
|
10919
|
+
tokenBudget: z11.number().int().positive().optional(),
|
|
10920
|
+
includeRelations: z11.boolean().optional(),
|
|
10921
|
+
includeReadiness: z11.boolean().optional(),
|
|
10922
|
+
includeRollup: z11.boolean().optional()
|
|
10881
10923
|
});
|
|
10882
|
-
workGraphPlanningDocSchema =
|
|
10883
|
-
rootId:
|
|
10884
|
-
generatedAt:
|
|
10885
|
-
audience:
|
|
10886
|
-
title:
|
|
10887
|
-
content:
|
|
10888
|
-
sections:
|
|
10889
|
-
estimatedTokens:
|
|
10890
|
-
budget:
|
|
10891
|
-
tokenBudget:
|
|
10892
|
-
truncated:
|
|
10924
|
+
workGraphPlanningDocSchema = z11.object({
|
|
10925
|
+
rootId: z11.string().min(1),
|
|
10926
|
+
generatedAt: z11.string().min(1),
|
|
10927
|
+
audience: z11.enum(["agent", "maintainer"]),
|
|
10928
|
+
title: z11.string().min(1),
|
|
10929
|
+
content: z11.string(),
|
|
10930
|
+
sections: z11.array(z11.string().min(1)),
|
|
10931
|
+
estimatedTokens: z11.number().int().nonnegative(),
|
|
10932
|
+
budget: z11.object({
|
|
10933
|
+
tokenBudget: z11.number().int().positive(),
|
|
10934
|
+
truncated: z11.boolean()
|
|
10893
10935
|
}).optional()
|
|
10894
10936
|
});
|
|
10895
10937
|
tasksTraverseParamsSchema = paginationParamsSchema.extend({
|
|
10896
|
-
rootId:
|
|
10938
|
+
rootId: z11.string().min(1),
|
|
10897
10939
|
direction: workGraphTraversalDirectionSchema,
|
|
10898
|
-
maxDepth:
|
|
10899
|
-
includeRelations:
|
|
10940
|
+
maxDepth: z11.number().int().nonnegative().optional(),
|
|
10941
|
+
includeRelations: z11.boolean().optional()
|
|
10900
10942
|
});
|
|
10901
|
-
tasksTraverseResultSchema =
|
|
10902
|
-
rootId:
|
|
10943
|
+
tasksTraverseResultSchema = z11.object({
|
|
10944
|
+
rootId: z11.string().min(1),
|
|
10903
10945
|
direction: workGraphTraversalDirectionSchema,
|
|
10904
|
-
nodes:
|
|
10905
|
-
edges:
|
|
10946
|
+
nodes: z11.array(workGraphNodeSchema),
|
|
10947
|
+
edges: z11.array(workGraphEdgeSchema),
|
|
10906
10948
|
pageInfo: workGraphPageInfoSchema
|
|
10907
10949
|
});
|
|
10908
10950
|
tasksTreeParamsSchema = paginationParamsSchema.extend({
|
|
10909
|
-
rootId:
|
|
10910
|
-
maxDepth:
|
|
10951
|
+
rootId: z11.string().min(1),
|
|
10952
|
+
maxDepth: z11.number().int().nonnegative().optional()
|
|
10911
10953
|
});
|
|
10912
|
-
tasksTreeResultSchema =
|
|
10913
|
-
rootId:
|
|
10914
|
-
nodes:
|
|
10915
|
-
edges:
|
|
10954
|
+
tasksTreeResultSchema = z11.object({
|
|
10955
|
+
rootId: z11.string().min(1),
|
|
10956
|
+
nodes: z11.array(workGraphNodeSchema.extend({ depth: z11.number().int().positive() })),
|
|
10957
|
+
edges: z11.array(workGraphHierarchyEdgeSchema),
|
|
10916
10958
|
pageInfo: workGraphPageInfoSchema
|
|
10917
10959
|
});
|
|
10918
|
-
tasksRollupParamsSchema =
|
|
10919
|
-
rootId:
|
|
10960
|
+
tasksRollupParamsSchema = z11.object({
|
|
10961
|
+
rootId: z11.string().min(1),
|
|
10920
10962
|
expectedDirectRollup: workGraphRollupCountsSchema.optional()
|
|
10921
10963
|
});
|
|
10922
|
-
tasksRollupResultSchema =
|
|
10923
|
-
rootId:
|
|
10964
|
+
tasksRollupResultSchema = z11.object({
|
|
10965
|
+
rootId: z11.string().min(1),
|
|
10924
10966
|
direct: workGraphRollupCountsSchema,
|
|
10925
10967
|
subtree: workGraphRollupCountsSchema,
|
|
10926
|
-
percentDenominator:
|
|
10927
|
-
basis:
|
|
10928
|
-
total:
|
|
10929
|
-
description:
|
|
10968
|
+
percentDenominator: z11.object({
|
|
10969
|
+
basis: z11.literal("subtree-total"),
|
|
10970
|
+
total: z11.number().int().nonnegative(),
|
|
10971
|
+
description: z11.string().min(1)
|
|
10930
10972
|
}),
|
|
10931
10973
|
percentages: workGraphSubtreePercentagesSchema,
|
|
10932
|
-
staleProjection:
|
|
10933
|
-
projectionMismatches:
|
|
10974
|
+
staleProjection: z11.boolean(),
|
|
10975
|
+
projectionMismatches: z11.array(workGraphProjectionMismatchSchema)
|
|
10934
10976
|
});
|
|
10935
|
-
tasksFrontierParamsSchema =
|
|
10936
|
-
rootId:
|
|
10937
|
-
role:
|
|
10977
|
+
tasksFrontierParamsSchema = z11.object({
|
|
10978
|
+
rootId: z11.string().min(1),
|
|
10979
|
+
role: z11.string().min(1).optional()
|
|
10938
10980
|
});
|
|
10939
|
-
tasksFrontierResultSchema =
|
|
10940
|
-
rootId:
|
|
10941
|
-
role:
|
|
10942
|
-
groups:
|
|
10943
|
-
ready:
|
|
10944
|
-
blocked:
|
|
10945
|
-
blockedBy:
|
|
10946
|
-
|
|
10947
|
-
|
|
10948
|
-
kind:
|
|
10949
|
-
blockerId:
|
|
10950
|
-
blocks:
|
|
10981
|
+
tasksFrontierResultSchema = z11.object({
|
|
10982
|
+
rootId: z11.string().min(1),
|
|
10983
|
+
role: z11.string().min(1).optional(),
|
|
10984
|
+
groups: z11.object({
|
|
10985
|
+
ready: z11.array(workGraphReadyFrontierTaskSchema),
|
|
10986
|
+
blocked: z11.array(workGraphReadyFrontierTaskSchema),
|
|
10987
|
+
blockedBy: z11.array(
|
|
10988
|
+
z11.discriminatedUnion("kind", [
|
|
10989
|
+
z11.object({
|
|
10990
|
+
kind: z11.literal("dependency"),
|
|
10991
|
+
blockerId: z11.string().min(1),
|
|
10992
|
+
blocks: z11.array(z11.string().min(1))
|
|
10951
10993
|
}),
|
|
10952
|
-
|
|
10953
|
-
kind:
|
|
10994
|
+
z11.object({
|
|
10995
|
+
kind: z11.literal("gate"),
|
|
10954
10996
|
gate: verificationGateSchema,
|
|
10955
|
-
blocks:
|
|
10997
|
+
blocks: z11.array(z11.string().min(1))
|
|
10956
10998
|
})
|
|
10957
10999
|
])
|
|
10958
11000
|
)
|
|
10959
11001
|
})
|
|
10960
11002
|
});
|
|
10961
11003
|
tasksWorkGraphAuditParamsSchema = paginationParamsSchema.extend({
|
|
10962
|
-
rootId:
|
|
10963
|
-
maxDepth:
|
|
10964
|
-
includeRelations:
|
|
11004
|
+
rootId: z11.string().min(1),
|
|
11005
|
+
maxDepth: z11.number().int().nonnegative().optional(),
|
|
11006
|
+
includeRelations: z11.boolean().optional()
|
|
10965
11007
|
});
|
|
10966
|
-
tasksWorkGraphAuditResultSchema =
|
|
10967
|
-
rootId:
|
|
10968
|
-
hierarchy:
|
|
10969
|
-
valid:
|
|
10970
|
-
violations:
|
|
10971
|
-
|
|
10972
|
-
code:
|
|
10973
|
-
taskId:
|
|
11008
|
+
tasksWorkGraphAuditResultSchema = z11.object({
|
|
11009
|
+
rootId: z11.string().min(1),
|
|
11010
|
+
hierarchy: z11.object({
|
|
11011
|
+
valid: z11.boolean(),
|
|
11012
|
+
violations: z11.array(
|
|
11013
|
+
z11.object({
|
|
11014
|
+
code: z11.literal(E_WORKGRAPH_PARENT_TYPE_MATRIX),
|
|
11015
|
+
taskId: z11.string().min(1),
|
|
10974
11016
|
taskType: taskTypeSchema,
|
|
10975
|
-
parentId:
|
|
11017
|
+
parentId: z11.string().min(1).nullable(),
|
|
10976
11018
|
parentType: taskTypeSchema.optional(),
|
|
10977
|
-
message:
|
|
11019
|
+
message: z11.string().min(1)
|
|
10978
11020
|
})
|
|
10979
11021
|
)
|
|
10980
11022
|
}),
|
|
10981
11023
|
traversal: tasksTraverseResultSchema,
|
|
10982
11024
|
frontier: tasksFrontierResultSchema,
|
|
10983
11025
|
rollup: tasksRollupResultSchema,
|
|
10984
|
-
relationEdges:
|
|
10985
|
-
rootId:
|
|
11026
|
+
relationEdges: z11.object({
|
|
11027
|
+
rootId: z11.string().min(1),
|
|
10986
11028
|
direction: workGraphEdgeDirectionSchema,
|
|
10987
|
-
edges:
|
|
10988
|
-
|
|
11029
|
+
edges: z11.array(
|
|
11030
|
+
z11.discriminatedUnion("source", [
|
|
10989
11031
|
workGraphRelationEdgeSchema,
|
|
10990
11032
|
workGraphDependencyEdgeSchema
|
|
10991
11033
|
])
|
|
@@ -11340,31 +11382,31 @@ var init_peer = __esm({
|
|
|
11340
11382
|
});
|
|
11341
11383
|
|
|
11342
11384
|
// packages/contracts/src/release/evidence-atoms.ts
|
|
11343
|
-
import { z as
|
|
11385
|
+
import { z as z12 } from "zod";
|
|
11344
11386
|
var parsedPrEvidenceAtomSchema, prEvidenceStateModifierSchema, ghPrViewSchema, PR_REQUIRED_WORKFLOWS;
|
|
11345
11387
|
var init_evidence_atoms = __esm({
|
|
11346
11388
|
"packages/contracts/src/release/evidence-atoms.ts"() {
|
|
11347
11389
|
"use strict";
|
|
11348
|
-
parsedPrEvidenceAtomSchema =
|
|
11349
|
-
kind:
|
|
11350
|
-
prNumber:
|
|
11390
|
+
parsedPrEvidenceAtomSchema = z12.object({
|
|
11391
|
+
kind: z12.literal("pr"),
|
|
11392
|
+
prNumber: z12.number().int().positive()
|
|
11351
11393
|
});
|
|
11352
|
-
prEvidenceStateModifierSchema =
|
|
11353
|
-
kind:
|
|
11354
|
-
value:
|
|
11394
|
+
prEvidenceStateModifierSchema = z12.object({
|
|
11395
|
+
kind: z12.literal("state"),
|
|
11396
|
+
value: z12.literal("MERGED")
|
|
11355
11397
|
});
|
|
11356
|
-
ghPrViewSchema =
|
|
11357
|
-
state:
|
|
11358
|
-
mergedAt:
|
|
11359
|
-
headRefOid:
|
|
11360
|
-
mergeable:
|
|
11361
|
-
statusCheckRollup:
|
|
11362
|
-
|
|
11363
|
-
__typename:
|
|
11364
|
-
name:
|
|
11365
|
-
workflowName:
|
|
11366
|
-
conclusion:
|
|
11367
|
-
status:
|
|
11398
|
+
ghPrViewSchema = z12.object({
|
|
11399
|
+
state: z12.enum(["OPEN", "CLOSED", "MERGED"]),
|
|
11400
|
+
mergedAt: z12.string().nullable(),
|
|
11401
|
+
headRefOid: z12.string().optional(),
|
|
11402
|
+
mergeable: z12.string().optional(),
|
|
11403
|
+
statusCheckRollup: z12.array(
|
|
11404
|
+
z12.object({
|
|
11405
|
+
__typename: z12.string().optional(),
|
|
11406
|
+
name: z12.string().optional(),
|
|
11407
|
+
workflowName: z12.string().optional(),
|
|
11408
|
+
conclusion: z12.string().nullable().optional(),
|
|
11409
|
+
status: z12.string().optional()
|
|
11368
11410
|
}).passthrough()
|
|
11369
11411
|
).optional().default([])
|
|
11370
11412
|
}).passthrough();
|
|
@@ -11377,7 +11419,7 @@ var init_evidence_atoms = __esm({
|
|
|
11377
11419
|
});
|
|
11378
11420
|
|
|
11379
11421
|
// packages/contracts/src/release/plan.ts
|
|
11380
|
-
import { z as
|
|
11422
|
+
import { z as z13 } from "zod";
|
|
11381
11423
|
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;
|
|
11382
11424
|
var init_plan = __esm({
|
|
11383
11425
|
"packages/contracts/src/release/plan.ts"() {
|
|
@@ -11420,20 +11462,20 @@ var init_plan = __esm({
|
|
|
11420
11462
|
];
|
|
11421
11463
|
IMPACT = ["major", "minor", "patch"];
|
|
11422
11464
|
RESOLVED_SOURCE = ["project-context", "language-default", "legacy-alias"];
|
|
11423
|
-
ReleaseChannelSchema =
|
|
11424
|
-
ReleaseSchemeSchema =
|
|
11425
|
-
ReleaseKindSchema =
|
|
11426
|
-
ReleaseStatusSchema =
|
|
11427
|
-
GateStatusSchema =
|
|
11428
|
-
GateNameSchema =
|
|
11429
|
-
PlatformTupleSchema =
|
|
11430
|
-
PublisherSchema =
|
|
11431
|
-
TaskKindSchema =
|
|
11432
|
-
ImpactSchema =
|
|
11433
|
-
ResolvedSourceSchema =
|
|
11434
|
-
Iso8601 =
|
|
11435
|
-
NonEmptyString =
|
|
11436
|
-
ReleasePlanTaskSchema =
|
|
11465
|
+
ReleaseChannelSchema = z13.enum(RELEASE_CHANNEL);
|
|
11466
|
+
ReleaseSchemeSchema = z13.enum(RELEASE_SCHEME);
|
|
11467
|
+
ReleaseKindSchema = z13.enum(RELEASE_KIND);
|
|
11468
|
+
ReleaseStatusSchema = z13.enum(RELEASE_STATUS);
|
|
11469
|
+
GateStatusSchema = z13.enum(GATE_STATUS);
|
|
11470
|
+
GateNameSchema = z13.enum(GATE_NAME);
|
|
11471
|
+
PlatformTupleSchema = z13.enum(PLATFORM_TUPLE);
|
|
11472
|
+
PublisherSchema = z13.enum(PUBLISHER);
|
|
11473
|
+
TaskKindSchema = z13.enum(TASK_KIND);
|
|
11474
|
+
ImpactSchema = z13.enum(IMPACT);
|
|
11475
|
+
ResolvedSourceSchema = z13.enum(RESOLVED_SOURCE);
|
|
11476
|
+
Iso8601 = z13.iso.datetime({ offset: true });
|
|
11477
|
+
NonEmptyString = z13.string().min(1);
|
|
11478
|
+
ReleasePlanTaskSchema = z13.object({
|
|
11437
11479
|
/** Task ID (e.g. "T10001"). Format intentionally loose so historical IDs validate. */
|
|
11438
11480
|
id: NonEmptyString,
|
|
11439
11481
|
/** Conventional-commit-aligned task classification. */
|
|
@@ -11441,20 +11483,20 @@ var init_plan = __esm({
|
|
|
11441
11483
|
/** SemVer impact classification. */
|
|
11442
11484
|
impact: ImpactSchema,
|
|
11443
11485
|
/** Human-readable changelog line for this task. */
|
|
11444
|
-
userFacingSummary:
|
|
11486
|
+
userFacingSummary: z13.string(),
|
|
11445
11487
|
/**
|
|
11446
11488
|
* ADR-051 evidence atoms attesting the task's gate results. Format is
|
|
11447
11489
|
* `kind:value` (e.g. `commit:abc123`, `test-run:vitest.json`). The contract
|
|
11448
11490
|
* accepts empty arrays so legacy plans validate; `cleo release plan`
|
|
11449
11491
|
* enforces non-empty via R-301.
|
|
11450
11492
|
*/
|
|
11451
|
-
evidenceAtoms:
|
|
11493
|
+
evidenceAtoms: z13.array(NonEmptyString),
|
|
11452
11494
|
/** IVTR phase at plan time — informational only per R-316. */
|
|
11453
|
-
ivtrPhaseAtPlan:
|
|
11495
|
+
ivtrPhaseAtPlan: z13.string().optional(),
|
|
11454
11496
|
/** Epic this task rolls up to, locked at plan time per R-303. */
|
|
11455
11497
|
epicAncestor: NonEmptyString
|
|
11456
11498
|
});
|
|
11457
|
-
ReleaseGateSchema =
|
|
11499
|
+
ReleaseGateSchema = z13.object({
|
|
11458
11500
|
/** Canonical gate name. */
|
|
11459
11501
|
name: GateNameSchema,
|
|
11460
11502
|
/** ADR-051 atom string identifying the resolved tool (e.g. `tool:test`). */
|
|
@@ -11464,11 +11506,11 @@ var init_plan = __esm({
|
|
|
11464
11506
|
/** ISO-8601 timestamp the gate was last verified. */
|
|
11465
11507
|
lastVerifiedAt: Iso8601,
|
|
11466
11508
|
/** Resolved shell command (e.g. `pnpm run test`). Optional for unresolved gates. */
|
|
11467
|
-
resolvedCommand:
|
|
11509
|
+
resolvedCommand: z13.string().optional(),
|
|
11468
11510
|
/** Provenance of the resolved command. Optional for unresolved gates. */
|
|
11469
11511
|
resolvedSource: ResolvedSourceSchema.optional()
|
|
11470
11512
|
});
|
|
11471
|
-
ReleasePlatformMatrixEntrySchema =
|
|
11513
|
+
ReleasePlatformMatrixEntrySchema = z13.object({
|
|
11472
11514
|
/** Target platform tuple. */
|
|
11473
11515
|
platform: PlatformTupleSchema,
|
|
11474
11516
|
/** Distribution backend. */
|
|
@@ -11476,47 +11518,47 @@ var init_plan = __esm({
|
|
|
11476
11518
|
/** Package identifier on the target backend (e.g. `@cleocode/cleo`). */
|
|
11477
11519
|
package: NonEmptyString,
|
|
11478
11520
|
/** Whether to run the GHA smoke job for this matrix entry. */
|
|
11479
|
-
smoke:
|
|
11521
|
+
smoke: z13.boolean().default(true).optional()
|
|
11480
11522
|
});
|
|
11481
|
-
ReleasePreflightSummarySchema =
|
|
11523
|
+
ReleasePreflightSummarySchema = z13.object({
|
|
11482
11524
|
/** True if esbuild externals are out of sync with package.json. */
|
|
11483
|
-
esbuildExternalsDrift:
|
|
11525
|
+
esbuildExternalsDrift: z13.boolean(),
|
|
11484
11526
|
/** True if `pnpm-lock.yaml` diverges from the workspace manifest. */
|
|
11485
|
-
lockfileDrift:
|
|
11527
|
+
lockfileDrift: z13.boolean(),
|
|
11486
11528
|
/** True if all epic children are in terminal lifecycle states. */
|
|
11487
|
-
epicCompletenessClean:
|
|
11529
|
+
epicCompletenessClean: z13.boolean(),
|
|
11488
11530
|
/** True if no task appears in multiple in-flight release plans. */
|
|
11489
|
-
doubleListingClean:
|
|
11531
|
+
doubleListingClean: z13.boolean(),
|
|
11490
11532
|
/** Non-fatal preflight warnings (e.g. unresolved tools per R-024). */
|
|
11491
|
-
preflightWarnings:
|
|
11533
|
+
preflightWarnings: z13.array(z13.string()).default([]).optional()
|
|
11492
11534
|
});
|
|
11493
|
-
ReleasePlanChangelogSchema =
|
|
11535
|
+
ReleasePlanChangelogSchema = z13.object({
|
|
11494
11536
|
/** `kind=feat` tasks. */
|
|
11495
|
-
features:
|
|
11537
|
+
features: z13.array(NonEmptyString).default([]),
|
|
11496
11538
|
/** `kind=fix` or `kind=hotfix` tasks. */
|
|
11497
|
-
fixes:
|
|
11539
|
+
fixes: z13.array(NonEmptyString).default([]),
|
|
11498
11540
|
/** `kind=chore`, `docs`, `refactor`, `test`, `perf` tasks. */
|
|
11499
|
-
chores:
|
|
11541
|
+
chores: z13.array(NonEmptyString).default([]),
|
|
11500
11542
|
/** `kind=breaking` or `kind=revert` tasks. */
|
|
11501
|
-
breaking:
|
|
11543
|
+
breaking: z13.array(NonEmptyString).default([])
|
|
11502
11544
|
});
|
|
11503
|
-
ReleasePlanMetaSchema =
|
|
11545
|
+
ReleasePlanMetaSchema = z13.object({
|
|
11504
11546
|
/** True if this is the project's first ever release. */
|
|
11505
|
-
firstEverRelease:
|
|
11547
|
+
firstEverRelease: z13.boolean().optional(),
|
|
11506
11548
|
/** Canonical tool names that could not be resolved at plan time. */
|
|
11507
|
-
unresolvedTools:
|
|
11549
|
+
unresolvedTools: z13.array(z13.string()).optional(),
|
|
11508
11550
|
/** Project archetype detected at plan time. */
|
|
11509
|
-
archetype:
|
|
11510
|
-
}).catchall(
|
|
11511
|
-
ReleasePlanSchema =
|
|
11551
|
+
archetype: z13.string().optional()
|
|
11552
|
+
}).catchall(z13.unknown());
|
|
11553
|
+
ReleasePlanSchema = z13.object({
|
|
11512
11554
|
/** Schema URL for this plan version. */
|
|
11513
|
-
$schema:
|
|
11555
|
+
$schema: z13.string().optional(),
|
|
11514
11556
|
/** Requested version string (e.g. "v2026.6.0"). Includes the leading `v`. */
|
|
11515
11557
|
version: NonEmptyString,
|
|
11516
11558
|
/** Resolved version string after suffix application (e.g. "v2026.6.0.2"). */
|
|
11517
11559
|
resolvedVersion: NonEmptyString,
|
|
11518
11560
|
/** True if a `calver-suffix` was applied to disambiguate a same-day hotfix. */
|
|
11519
|
-
suffixApplied:
|
|
11561
|
+
suffixApplied: z13.boolean(),
|
|
11520
11562
|
/** Versioning scheme governing `version` / `resolvedVersion`. */
|
|
11521
11563
|
scheme: ReleaseSchemeSchema,
|
|
11522
11564
|
/** npm dist-tag channel for this release. */
|
|
@@ -11533,27 +11575,27 @@ var init_plan = __esm({
|
|
|
11533
11575
|
* Version of the previous release on the same channel. MUST be `null` only
|
|
11534
11576
|
* for first-ever releases (R-300, enforced at the verb layer).
|
|
11535
11577
|
*/
|
|
11536
|
-
previousVersion:
|
|
11578
|
+
previousVersion: z13.string().nullable(),
|
|
11537
11579
|
/** Git tag of the previous release (typically `previousVersion` prefixed). */
|
|
11538
|
-
previousTag:
|
|
11580
|
+
previousTag: z13.string().nullable(),
|
|
11539
11581
|
/** ISO-8601 timestamp the previous release was published. */
|
|
11540
11582
|
previousShippedAt: Iso8601.nullable(),
|
|
11541
11583
|
/** Tasks rolled into this release. */
|
|
11542
|
-
tasks:
|
|
11584
|
+
tasks: z13.array(ReleasePlanTaskSchema),
|
|
11543
11585
|
/** Bucketed changelog. */
|
|
11544
11586
|
changelog: ReleasePlanChangelogSchema,
|
|
11545
11587
|
/** Per-gate verification status. */
|
|
11546
|
-
gates:
|
|
11588
|
+
gates: z13.array(ReleaseGateSchema),
|
|
11547
11589
|
/** Platform / publisher matrix. */
|
|
11548
|
-
platformMatrix:
|
|
11590
|
+
platformMatrix: z13.array(ReleasePlatformMatrixEntrySchema),
|
|
11549
11591
|
/** Preflight summary from `cleo release plan`. */
|
|
11550
11592
|
preflightSummary: ReleasePreflightSummarySchema,
|
|
11551
11593
|
/** URL of the GHA workflow run (populated by `release-prepare.yml`). */
|
|
11552
|
-
workflowRunUrl:
|
|
11594
|
+
workflowRunUrl: z13.string().nullable(),
|
|
11553
11595
|
/** URL of the bump PR (populated by `cleo release open`). */
|
|
11554
|
-
prUrl:
|
|
11596
|
+
prUrl: z13.string().nullable(),
|
|
11555
11597
|
/** Merge commit SHA on `main` (populated by `release-publish.yml`). */
|
|
11556
|
-
mergeCommitSha:
|
|
11598
|
+
mergeCommitSha: z13.string().nullable(),
|
|
11557
11599
|
/** Current FSM state per R-302. */
|
|
11558
11600
|
status: ReleaseStatusSchema,
|
|
11559
11601
|
/** Informational / forward-compat metadata. */
|
|
@@ -11609,52 +11651,52 @@ var init_session2 = __esm({
|
|
|
11609
11651
|
});
|
|
11610
11652
|
|
|
11611
11653
|
// packages/contracts/src/session-journal.ts
|
|
11612
|
-
import { z as
|
|
11654
|
+
import { z as z14 } from "zod";
|
|
11613
11655
|
var SESSION_JOURNAL_SCHEMA_VERSION, sessionJournalDoctorSummarySchema, sessionJournalDebriefSummarySchema, sessionJournalEntrySchema;
|
|
11614
11656
|
var init_session_journal = __esm({
|
|
11615
11657
|
"packages/contracts/src/session-journal.ts"() {
|
|
11616
11658
|
"use strict";
|
|
11617
11659
|
SESSION_JOURNAL_SCHEMA_VERSION = "1.0";
|
|
11618
|
-
sessionJournalDoctorSummarySchema =
|
|
11660
|
+
sessionJournalDoctorSummarySchema = z14.object({
|
|
11619
11661
|
/** `true` when zero noise patterns were detected. */
|
|
11620
|
-
isClean:
|
|
11662
|
+
isClean: z14.boolean(),
|
|
11621
11663
|
/** Total number of noise findings across all patterns. */
|
|
11622
|
-
findingsCount:
|
|
11664
|
+
findingsCount: z14.number().int().nonnegative(),
|
|
11623
11665
|
/** Pattern names that were detected (empty when isClean). */
|
|
11624
|
-
patterns:
|
|
11666
|
+
patterns: z14.array(z14.string()),
|
|
11625
11667
|
/** Total brain entries scanned. `0` = empty or unavailable. */
|
|
11626
|
-
totalScanned:
|
|
11668
|
+
totalScanned: z14.number().int().nonnegative()
|
|
11627
11669
|
});
|
|
11628
|
-
sessionJournalDebriefSummarySchema =
|
|
11670
|
+
sessionJournalDebriefSummarySchema = z14.object({
|
|
11629
11671
|
/** First 200 characters of the session end note (if provided). */
|
|
11630
|
-
noteExcerpt:
|
|
11672
|
+
noteExcerpt: z14.string().max(200).optional(),
|
|
11631
11673
|
/** Number of tasks completed during the session. */
|
|
11632
|
-
tasksCompletedCount:
|
|
11674
|
+
tasksCompletedCount: z14.number().int().nonnegative(),
|
|
11633
11675
|
/** Up to 5 task IDs (not titles) that were the focus of the session. */
|
|
11634
|
-
tasksFocused:
|
|
11676
|
+
tasksFocused: z14.array(z14.string()).max(5).optional()
|
|
11635
11677
|
});
|
|
11636
|
-
sessionJournalEntrySchema =
|
|
11678
|
+
sessionJournalEntrySchema = z14.object({
|
|
11637
11679
|
// Identity
|
|
11638
11680
|
/** Schema version for forward-compatibility. Always `'1.0'` in this release. */
|
|
11639
|
-
schemaVersion:
|
|
11681
|
+
schemaVersion: z14.literal(SESSION_JOURNAL_SCHEMA_VERSION),
|
|
11640
11682
|
/** ISO 8601 timestamp when the entry was written. */
|
|
11641
|
-
timestamp:
|
|
11683
|
+
timestamp: z14.string(),
|
|
11642
11684
|
/** CLEO session ID (e.g. `ses_20260424055456_ede571`). */
|
|
11643
|
-
sessionId:
|
|
11685
|
+
sessionId: z14.string(),
|
|
11644
11686
|
/** Event type that triggered this journal entry. */
|
|
11645
|
-
eventType:
|
|
11687
|
+
eventType: z14.enum(["session_start", "session_end", "observation", "decision", "error"]),
|
|
11646
11688
|
// Session metadata (set on session_start / session_end)
|
|
11647
11689
|
/** Agent identifier (e.g. `cleo-prime`, `claude-code`). */
|
|
11648
|
-
agentIdentifier:
|
|
11690
|
+
agentIdentifier: z14.string().optional(),
|
|
11649
11691
|
/** Provider adapter ID active for this session. */
|
|
11650
|
-
providerId:
|
|
11692
|
+
providerId: z14.string().optional(),
|
|
11651
11693
|
/** Session scope string (e.g. `'global'` or `'epic:T1263'`). */
|
|
11652
|
-
scope:
|
|
11694
|
+
scope: z14.string().optional(),
|
|
11653
11695
|
// Session-end fields
|
|
11654
11696
|
/** Duration of the session in seconds (session_end only). */
|
|
11655
|
-
duration:
|
|
11697
|
+
duration: z14.number().int().nonnegative().optional(),
|
|
11656
11698
|
/** Task IDs (not titles) completed during the session. */
|
|
11657
|
-
tasksCompleted:
|
|
11699
|
+
tasksCompleted: z14.array(z14.string()).optional(),
|
|
11658
11700
|
// Doctor summary (T1262 absorbed)
|
|
11659
11701
|
/** Compact result of `scanBrainNoise` run at session-end. */
|
|
11660
11702
|
doctorSummary: sessionJournalDoctorSummarySchema.optional(),
|
|
@@ -11663,7 +11705,7 @@ var init_session_journal = __esm({
|
|
|
11663
11705
|
debriefSummary: sessionJournalDebriefSummarySchema.optional(),
|
|
11664
11706
|
// Optional hash chain
|
|
11665
11707
|
/** SHA-256 hex of the previous entry's raw JSON string (for integrity chain). */
|
|
11666
|
-
prevEntryHash:
|
|
11708
|
+
prevEntryHash: z14.string().optional()
|
|
11667
11709
|
});
|
|
11668
11710
|
}
|
|
11669
11711
|
});
|
|
@@ -11676,52 +11718,52 @@ var init_task = __esm({
|
|
|
11676
11718
|
});
|
|
11677
11719
|
|
|
11678
11720
|
// packages/contracts/src/task-evidence.ts
|
|
11679
|
-
import { z as
|
|
11721
|
+
import { z as z15 } from "zod";
|
|
11680
11722
|
var fileEvidenceSchema, logEvidenceSchema, screenshotEvidenceSchema, testOutputEvidenceSchema, commandOutputEvidenceSchema, taskEvidenceSchema;
|
|
11681
11723
|
var init_task_evidence = __esm({
|
|
11682
11724
|
"packages/contracts/src/task-evidence.ts"() {
|
|
11683
11725
|
"use strict";
|
|
11684
|
-
fileEvidenceSchema =
|
|
11685
|
-
kind:
|
|
11686
|
-
sha256:
|
|
11687
|
-
timestamp:
|
|
11688
|
-
path:
|
|
11689
|
-
mime:
|
|
11690
|
-
description:
|
|
11726
|
+
fileEvidenceSchema = z15.object({
|
|
11727
|
+
kind: z15.literal("file"),
|
|
11728
|
+
sha256: z15.string().length(64),
|
|
11729
|
+
timestamp: z15.string().datetime(),
|
|
11730
|
+
path: z15.string().min(1),
|
|
11731
|
+
mime: z15.string().optional(),
|
|
11732
|
+
description: z15.string().optional()
|
|
11691
11733
|
});
|
|
11692
|
-
logEvidenceSchema =
|
|
11693
|
-
kind:
|
|
11694
|
-
sha256:
|
|
11695
|
-
timestamp:
|
|
11696
|
-
source:
|
|
11697
|
-
description:
|
|
11734
|
+
logEvidenceSchema = z15.object({
|
|
11735
|
+
kind: z15.literal("log"),
|
|
11736
|
+
sha256: z15.string().length(64),
|
|
11737
|
+
timestamp: z15.string().datetime(),
|
|
11738
|
+
source: z15.string().min(1),
|
|
11739
|
+
description: z15.string().optional()
|
|
11698
11740
|
});
|
|
11699
|
-
screenshotEvidenceSchema =
|
|
11700
|
-
kind:
|
|
11701
|
-
sha256:
|
|
11702
|
-
timestamp:
|
|
11703
|
-
mime:
|
|
11704
|
-
description:
|
|
11741
|
+
screenshotEvidenceSchema = z15.object({
|
|
11742
|
+
kind: z15.literal("screenshot"),
|
|
11743
|
+
sha256: z15.string().length(64),
|
|
11744
|
+
timestamp: z15.string().datetime(),
|
|
11745
|
+
mime: z15.enum(["image/png", "image/jpeg", "image/webp"]).optional(),
|
|
11746
|
+
description: z15.string().optional()
|
|
11705
11747
|
});
|
|
11706
|
-
testOutputEvidenceSchema =
|
|
11707
|
-
kind:
|
|
11708
|
-
sha256:
|
|
11709
|
-
timestamp:
|
|
11710
|
-
passed:
|
|
11711
|
-
failed:
|
|
11712
|
-
skipped:
|
|
11713
|
-
exitCode:
|
|
11714
|
-
description:
|
|
11748
|
+
testOutputEvidenceSchema = z15.object({
|
|
11749
|
+
kind: z15.literal("test-output"),
|
|
11750
|
+
sha256: z15.string().length(64),
|
|
11751
|
+
timestamp: z15.string().datetime(),
|
|
11752
|
+
passed: z15.number().int().nonnegative(),
|
|
11753
|
+
failed: z15.number().int().nonnegative(),
|
|
11754
|
+
skipped: z15.number().int().nonnegative(),
|
|
11755
|
+
exitCode: z15.number().int(),
|
|
11756
|
+
description: z15.string().optional()
|
|
11715
11757
|
});
|
|
11716
|
-
commandOutputEvidenceSchema =
|
|
11717
|
-
kind:
|
|
11718
|
-
sha256:
|
|
11719
|
-
timestamp:
|
|
11720
|
-
cmd:
|
|
11721
|
-
exitCode:
|
|
11722
|
-
description:
|
|
11758
|
+
commandOutputEvidenceSchema = z15.object({
|
|
11759
|
+
kind: z15.literal("command-output"),
|
|
11760
|
+
sha256: z15.string().length(64),
|
|
11761
|
+
timestamp: z15.string().datetime(),
|
|
11762
|
+
cmd: z15.string().min(1),
|
|
11763
|
+
exitCode: z15.number().int(),
|
|
11764
|
+
description: z15.string().optional()
|
|
11723
11765
|
});
|
|
11724
|
-
taskEvidenceSchema =
|
|
11766
|
+
taskEvidenceSchema = z15.discriminatedUnion("kind", [
|
|
11725
11767
|
fileEvidenceSchema,
|
|
11726
11768
|
logEvidenceSchema,
|
|
11727
11769
|
screenshotEvidenceSchema,
|
|
@@ -11732,12 +11774,12 @@ var init_task_evidence = __esm({
|
|
|
11732
11774
|
});
|
|
11733
11775
|
|
|
11734
11776
|
// packages/contracts/src/tasks/archive.ts
|
|
11735
|
-
import { z as
|
|
11777
|
+
import { z as z16 } from "zod";
|
|
11736
11778
|
var ArchiveReason, ARCHIVE_REASON_VALUES, ARCHIVE_REASON_TOMBSTONE;
|
|
11737
11779
|
var init_archive = __esm({
|
|
11738
11780
|
"packages/contracts/src/tasks/archive.ts"() {
|
|
11739
11781
|
"use strict";
|
|
11740
|
-
ArchiveReason =
|
|
11782
|
+
ArchiveReason = z16.enum([
|
|
11741
11783
|
"verified",
|
|
11742
11784
|
"reconciled",
|
|
11743
11785
|
"superseded",
|
|
@@ -11751,47 +11793,47 @@ var init_archive = __esm({
|
|
|
11751
11793
|
});
|
|
11752
11794
|
|
|
11753
11795
|
// packages/contracts/src/tasks.ts
|
|
11754
|
-
import { z as
|
|
11796
|
+
import { z as z17 } from "zod";
|
|
11755
11797
|
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;
|
|
11756
11798
|
var init_tasks2 = __esm({
|
|
11757
11799
|
"packages/contracts/src/tasks.ts"() {
|
|
11758
11800
|
"use strict";
|
|
11759
11801
|
init_status_registry();
|
|
11760
|
-
taskMutationWarningSeveritySchema =
|
|
11761
|
-
taskMutationWarningSchema =
|
|
11762
|
-
code:
|
|
11763
|
-
message:
|
|
11802
|
+
taskMutationWarningSeveritySchema = z17.enum(["info", "warning"]);
|
|
11803
|
+
taskMutationWarningSchema = z17.object({
|
|
11804
|
+
code: z17.string().min(1),
|
|
11805
|
+
message: z17.string().min(1),
|
|
11764
11806
|
severity: taskMutationWarningSeveritySchema.optional(),
|
|
11765
|
-
taskId:
|
|
11766
|
-
field:
|
|
11767
|
-
index:
|
|
11807
|
+
taskId: z17.string().min(1).optional(),
|
|
11808
|
+
field: z17.string().min(1).optional(),
|
|
11809
|
+
index: z17.number().int().nonnegative().optional()
|
|
11768
11810
|
});
|
|
11769
|
-
taskMutationDryRunSummarySchema =
|
|
11770
|
-
dryRun:
|
|
11771
|
-
wouldCreate:
|
|
11772
|
-
wouldUpdate:
|
|
11773
|
-
wouldDelete:
|
|
11774
|
-
wouldAffect:
|
|
11775
|
-
validatedCount:
|
|
11776
|
-
insertedCount:
|
|
11777
|
-
updatedCount:
|
|
11778
|
-
deletedCount:
|
|
11779
|
-
warnings:
|
|
11811
|
+
taskMutationDryRunSummarySchema = z17.object({
|
|
11812
|
+
dryRun: z17.literal(true),
|
|
11813
|
+
wouldCreate: z17.number().int().nonnegative(),
|
|
11814
|
+
wouldUpdate: z17.number().int().nonnegative(),
|
|
11815
|
+
wouldDelete: z17.number().int().nonnegative(),
|
|
11816
|
+
wouldAffect: z17.number().int().nonnegative(),
|
|
11817
|
+
validatedCount: z17.number().int().nonnegative(),
|
|
11818
|
+
insertedCount: z17.literal(0),
|
|
11819
|
+
updatedCount: z17.literal(0),
|
|
11820
|
+
deletedCount: z17.literal(0),
|
|
11821
|
+
warnings: z17.array(taskMutationWarningSchema)
|
|
11780
11822
|
});
|
|
11781
|
-
taskMutationTaskRecordSchema =
|
|
11782
|
-
taskMutationEnvelopeSchema =
|
|
11783
|
-
dryRun:
|
|
11784
|
-
created:
|
|
11785
|
-
updated:
|
|
11786
|
-
deleted:
|
|
11787
|
-
affectedCount:
|
|
11788
|
-
mutationWarnings:
|
|
11823
|
+
taskMutationTaskRecordSchema = z17.object({ id: z17.string().min(1) }).passthrough();
|
|
11824
|
+
taskMutationEnvelopeSchema = z17.object({
|
|
11825
|
+
dryRun: z17.boolean().optional(),
|
|
11826
|
+
created: z17.array(taskMutationTaskRecordSchema),
|
|
11827
|
+
updated: z17.array(taskMutationTaskRecordSchema),
|
|
11828
|
+
deleted: z17.array(taskMutationTaskRecordSchema),
|
|
11829
|
+
affectedCount: z17.number().int().nonnegative(),
|
|
11830
|
+
mutationWarnings: z17.array(taskMutationWarningSchema),
|
|
11789
11831
|
dryRunSummary: taskMutationDryRunSummarySchema.optional()
|
|
11790
11832
|
});
|
|
11791
|
-
completionTaskStatusSchema =
|
|
11792
|
-
completionCriterionKindSchema =
|
|
11793
|
-
completionCriterionStatusSchema =
|
|
11794
|
-
completionBlockerReasonSchema =
|
|
11833
|
+
completionTaskStatusSchema = z17.enum(TASK_STATUSES);
|
|
11834
|
+
completionCriterionKindSchema = z17.enum(["text", "evidence_bound", "child_task"]);
|
|
11835
|
+
completionCriterionStatusSchema = z17.enum(["satisfied", "unsatisfied", "waived", "replaced"]);
|
|
11836
|
+
completionBlockerReasonSchema = z17.enum([
|
|
11795
11837
|
"missing_evidence_binding",
|
|
11796
11838
|
"child_not_done",
|
|
11797
11839
|
"child_cancelled_requires_waiver",
|
|
@@ -11799,68 +11841,68 @@ var init_tasks2 = __esm({
|
|
|
11799
11841
|
"child_missing",
|
|
11800
11842
|
"done_parent_stale"
|
|
11801
11843
|
]);
|
|
11802
|
-
completionStaleReasonSchema =
|
|
11803
|
-
completionProjectionRepairErrorCodeSchema =
|
|
11844
|
+
completionStaleReasonSchema = z17.enum(["done_parent_has_unsatisfied_criteria"]);
|
|
11845
|
+
completionProjectionRepairErrorCodeSchema = z17.enum([
|
|
11804
11846
|
"projection_not_stale",
|
|
11805
11847
|
"criteria_missing",
|
|
11806
11848
|
"binding_target_missing",
|
|
11807
11849
|
"repair_conflict"
|
|
11808
11850
|
]);
|
|
11809
|
-
completionCriterionWaiverSchema =
|
|
11810
|
-
criterionAcId:
|
|
11811
|
-
childTaskId:
|
|
11812
|
-
reason:
|
|
11813
|
-
actor:
|
|
11814
|
-
waivedAt:
|
|
11851
|
+
completionCriterionWaiverSchema = z17.object({
|
|
11852
|
+
criterionAcId: z17.string().min(1),
|
|
11853
|
+
childTaskId: z17.string().min(1),
|
|
11854
|
+
reason: z17.string().min(1),
|
|
11855
|
+
actor: z17.string().min(1),
|
|
11856
|
+
waivedAt: z17.string().min(1)
|
|
11815
11857
|
});
|
|
11816
|
-
completionCriterionReplacementSchema =
|
|
11817
|
-
criterionAcId:
|
|
11818
|
-
originalChildTaskId:
|
|
11819
|
-
replacementChildTaskId:
|
|
11820
|
-
reason:
|
|
11821
|
-
actor:
|
|
11822
|
-
replacedAt:
|
|
11858
|
+
completionCriterionReplacementSchema = z17.object({
|
|
11859
|
+
criterionAcId: z17.string().min(1),
|
|
11860
|
+
originalChildTaskId: z17.string().min(1),
|
|
11861
|
+
replacementChildTaskId: z17.string().min(1),
|
|
11862
|
+
reason: z17.string().min(1),
|
|
11863
|
+
actor: z17.string().min(1),
|
|
11864
|
+
replacedAt: z17.string().min(1)
|
|
11823
11865
|
});
|
|
11824
|
-
completionCriterionEvaluationSchema =
|
|
11825
|
-
acId:
|
|
11826
|
-
alias:
|
|
11827
|
-
text:
|
|
11866
|
+
completionCriterionEvaluationSchema = z17.object({
|
|
11867
|
+
acId: z17.string().min(1),
|
|
11868
|
+
alias: z17.string().min(1),
|
|
11869
|
+
text: z17.string(),
|
|
11828
11870
|
kind: completionCriterionKindSchema,
|
|
11829
11871
|
status: completionCriterionStatusSchema,
|
|
11830
11872
|
reason: completionBlockerReasonSchema.optional(),
|
|
11831
|
-
targetTaskId:
|
|
11873
|
+
targetTaskId: z17.string().min(1).optional(),
|
|
11832
11874
|
targetTaskStatus: completionTaskStatusSchema.optional(),
|
|
11833
11875
|
waiver: completionCriterionWaiverSchema.optional(),
|
|
11834
11876
|
replacement: completionCriterionReplacementSchema.optional(),
|
|
11835
11877
|
replacementTaskStatus: completionTaskStatusSchema.optional(),
|
|
11836
|
-
evidenceBindings:
|
|
11878
|
+
evidenceBindings: z17.number().int().nonnegative()
|
|
11837
11879
|
});
|
|
11838
11880
|
unsatisfiedCompletionCriterionSchema = completionCriterionEvaluationSchema.extend({
|
|
11839
|
-
status:
|
|
11881
|
+
status: z17.literal("unsatisfied"),
|
|
11840
11882
|
reason: completionBlockerReasonSchema
|
|
11841
11883
|
});
|
|
11842
|
-
completionTotalsSchema =
|
|
11843
|
-
criteria:
|
|
11844
|
-
satisfied:
|
|
11845
|
-
unsatisfied:
|
|
11846
|
-
waived:
|
|
11847
|
-
replaced:
|
|
11884
|
+
completionTotalsSchema = z17.object({
|
|
11885
|
+
criteria: z17.number().int().nonnegative(),
|
|
11886
|
+
satisfied: z17.number().int().nonnegative(),
|
|
11887
|
+
unsatisfied: z17.number().int().nonnegative(),
|
|
11888
|
+
waived: z17.number().int().nonnegative(),
|
|
11889
|
+
replaced: z17.number().int().nonnegative()
|
|
11848
11890
|
});
|
|
11849
|
-
completionContextPackSchema =
|
|
11850
|
-
taskId:
|
|
11851
|
-
generatedAt:
|
|
11852
|
-
source:
|
|
11853
|
-
window:
|
|
11854
|
-
limit:
|
|
11855
|
-
since:
|
|
11856
|
-
relationDepth:
|
|
11857
|
-
relatedTaskIds:
|
|
11891
|
+
completionContextPackSchema = z17.object({
|
|
11892
|
+
taskId: z17.string().min(1),
|
|
11893
|
+
generatedAt: z17.string().min(1),
|
|
11894
|
+
source: z17.literal("audit_log"),
|
|
11895
|
+
window: z17.object({
|
|
11896
|
+
limit: z17.number().int().positive(),
|
|
11897
|
+
since: z17.string().min(1).optional(),
|
|
11898
|
+
relationDepth: z17.number().int().nonnegative(),
|
|
11899
|
+
relatedTaskIds: z17.array(z17.string().min(1))
|
|
11858
11900
|
}),
|
|
11859
|
-
events:
|
|
11860
|
-
|
|
11861
|
-
id:
|
|
11862
|
-
timestamp:
|
|
11863
|
-
action:
|
|
11901
|
+
events: z17.array(
|
|
11902
|
+
z17.object({
|
|
11903
|
+
id: z17.string().min(1),
|
|
11904
|
+
timestamp: z17.string().min(1),
|
|
11905
|
+
action: z17.enum([
|
|
11864
11906
|
"task_completed",
|
|
11865
11907
|
"task_reopened",
|
|
11866
11908
|
"task_cancelled",
|
|
@@ -11868,77 +11910,77 @@ var init_tasks2 = __esm({
|
|
|
11868
11910
|
"task_reparented",
|
|
11869
11911
|
"ac_projection_rebuilt"
|
|
11870
11912
|
]),
|
|
11871
|
-
taskId:
|
|
11872
|
-
relation:
|
|
11873
|
-
actor:
|
|
11874
|
-
details:
|
|
11875
|
-
before:
|
|
11876
|
-
after:
|
|
11913
|
+
taskId: z17.string().min(1),
|
|
11914
|
+
relation: z17.enum(["self", "parent", "child", "sibling", "related"]),
|
|
11915
|
+
actor: z17.string().min(1),
|
|
11916
|
+
details: z17.record(z17.string(), z17.unknown()).optional(),
|
|
11917
|
+
before: z17.record(z17.string(), z17.unknown()).optional(),
|
|
11918
|
+
after: z17.record(z17.string(), z17.unknown()).optional()
|
|
11877
11919
|
})
|
|
11878
11920
|
),
|
|
11879
|
-
summary:
|
|
11880
|
-
totalEvents:
|
|
11881
|
-
byAction:
|
|
11882
|
-
byRelation:
|
|
11883
|
-
latestEventAt:
|
|
11921
|
+
summary: z17.object({
|
|
11922
|
+
totalEvents: z17.number().int().nonnegative(),
|
|
11923
|
+
byAction: z17.record(z17.string(), z17.number().int().nonnegative()),
|
|
11924
|
+
byRelation: z17.record(z17.string(), z17.number().int().nonnegative()),
|
|
11925
|
+
latestEventAt: z17.string().nullable()
|
|
11884
11926
|
})
|
|
11885
11927
|
});
|
|
11886
|
-
completionEvaluationSchema =
|
|
11887
|
-
taskId:
|
|
11928
|
+
completionEvaluationSchema = z17.object({
|
|
11929
|
+
taskId: z17.string().min(1),
|
|
11888
11930
|
taskStatus: completionTaskStatusSchema,
|
|
11889
|
-
ready:
|
|
11890
|
-
stale:
|
|
11891
|
-
staleReasons:
|
|
11931
|
+
ready: z17.boolean(),
|
|
11932
|
+
stale: z17.boolean(),
|
|
11933
|
+
staleReasons: z17.array(completionStaleReasonSchema),
|
|
11892
11934
|
contextPack: completionContextPackSchema.optional(),
|
|
11893
|
-
satisfied:
|
|
11894
|
-
unsatisfied:
|
|
11895
|
-
waived:
|
|
11896
|
-
replaced:
|
|
11935
|
+
satisfied: z17.array(completionCriterionEvaluationSchema),
|
|
11936
|
+
unsatisfied: z17.array(unsatisfiedCompletionCriterionSchema),
|
|
11937
|
+
waived: z17.array(completionCriterionEvaluationSchema),
|
|
11938
|
+
replaced: z17.array(completionCriterionEvaluationSchema),
|
|
11897
11939
|
totals: completionTotalsSchema
|
|
11898
11940
|
});
|
|
11899
|
-
completionExplanationSchema =
|
|
11900
|
-
taskId:
|
|
11901
|
-
ready:
|
|
11902
|
-
stale:
|
|
11903
|
-
summary:
|
|
11941
|
+
completionExplanationSchema = z17.object({
|
|
11942
|
+
taskId: z17.string().min(1),
|
|
11943
|
+
ready: z17.boolean(),
|
|
11944
|
+
stale: z17.boolean(),
|
|
11945
|
+
summary: z17.string(),
|
|
11904
11946
|
contextPack: completionContextPackSchema.optional(),
|
|
11905
|
-
blockers:
|
|
11947
|
+
blockers: z17.array(completionCriterionEvaluationSchema)
|
|
11906
11948
|
});
|
|
11907
|
-
completionListParamsSchema =
|
|
11908
|
-
taskId:
|
|
11949
|
+
completionListParamsSchema = z17.object({
|
|
11950
|
+
taskId: z17.string().min(1),
|
|
11909
11951
|
status: completionCriterionStatusSchema.optional(),
|
|
11910
11952
|
kind: completionCriterionKindSchema.optional()
|
|
11911
11953
|
});
|
|
11912
|
-
completionListResultSchema =
|
|
11913
|
-
taskId:
|
|
11914
|
-
criteria:
|
|
11954
|
+
completionListResultSchema = z17.object({
|
|
11955
|
+
taskId: z17.string().min(1),
|
|
11956
|
+
criteria: z17.array(completionCriterionEvaluationSchema),
|
|
11915
11957
|
totals: completionTotalsSchema
|
|
11916
11958
|
});
|
|
11917
|
-
completionEvaluateParamsSchema =
|
|
11918
|
-
taskId:
|
|
11919
|
-
includeContext:
|
|
11920
|
-
limit:
|
|
11921
|
-
since:
|
|
11922
|
-
relationDepth:
|
|
11959
|
+
completionEvaluateParamsSchema = z17.object({
|
|
11960
|
+
taskId: z17.string().min(1),
|
|
11961
|
+
includeContext: z17.boolean().optional(),
|
|
11962
|
+
limit: z17.number().int().positive().optional(),
|
|
11963
|
+
since: z17.string().min(1).optional(),
|
|
11964
|
+
relationDepth: z17.number().int().nonnegative().optional()
|
|
11923
11965
|
});
|
|
11924
|
-
completionProjectionRepairErrorSchema =
|
|
11966
|
+
completionProjectionRepairErrorSchema = z17.object({
|
|
11925
11967
|
code: completionProjectionRepairErrorCodeSchema,
|
|
11926
|
-
message:
|
|
11927
|
-
taskId:
|
|
11928
|
-
acId:
|
|
11929
|
-
evidenceAtomId:
|
|
11968
|
+
message: z17.string().min(1),
|
|
11969
|
+
taskId: z17.string().min(1),
|
|
11970
|
+
acId: z17.string().min(1).optional(),
|
|
11971
|
+
evidenceAtomId: z17.string().min(1).optional()
|
|
11930
11972
|
});
|
|
11931
|
-
completionProjectionRepairParamsSchema =
|
|
11932
|
-
taskId:
|
|
11933
|
-
dryRun:
|
|
11973
|
+
completionProjectionRepairParamsSchema = z17.object({
|
|
11974
|
+
taskId: z17.string().min(1),
|
|
11975
|
+
dryRun: z17.boolean().optional()
|
|
11934
11976
|
});
|
|
11935
|
-
completionProjectionRepairResultSchema =
|
|
11936
|
-
taskId:
|
|
11937
|
-
repaired:
|
|
11938
|
-
dryRun:
|
|
11939
|
-
staleBefore:
|
|
11940
|
-
staleAfter:
|
|
11941
|
-
errors:
|
|
11977
|
+
completionProjectionRepairResultSchema = z17.object({
|
|
11978
|
+
taskId: z17.string().min(1),
|
|
11979
|
+
repaired: z17.boolean(),
|
|
11980
|
+
dryRun: z17.boolean(),
|
|
11981
|
+
staleBefore: z17.boolean(),
|
|
11982
|
+
staleAfter: z17.boolean(),
|
|
11983
|
+
errors: z17.array(completionProjectionRepairErrorSchema)
|
|
11942
11984
|
});
|
|
11943
11985
|
}
|
|
11944
11986
|
});
|
|
@@ -12449,7 +12491,7 @@ var init_taxonomy = __esm({
|
|
|
12449
12491
|
});
|
|
12450
12492
|
|
|
12451
12493
|
// packages/contracts/src/templates/manifest.ts
|
|
12452
|
-
import { z as
|
|
12494
|
+
import { z as z18 } from "zod";
|
|
12453
12495
|
var TEMPLATE_KINDS, TEMPLATE_SUBSTITUTIONS, TEMPLATE_UPDATE_STRATEGIES, PLACEHOLDER_SOURCES, PlaceholderSpecSchema, TemplateManifestEntrySchema;
|
|
12454
12496
|
var init_manifest2 = __esm({
|
|
12455
12497
|
"packages/contracts/src/templates/manifest.ts"() {
|
|
@@ -12470,85 +12512,85 @@ var init_manifest2 = __esm({
|
|
|
12470
12512
|
"tool-resolver",
|
|
12471
12513
|
"literal"
|
|
12472
12514
|
];
|
|
12473
|
-
PlaceholderSpecSchema =
|
|
12515
|
+
PlaceholderSpecSchema = z18.object({
|
|
12474
12516
|
/**
|
|
12475
12517
|
* Placeholder identifier as it appears in the template body
|
|
12476
12518
|
* (e.g. `NODE_VERSION` matches `{{NODE_VERSION}}`).
|
|
12477
12519
|
*/
|
|
12478
|
-
name:
|
|
12520
|
+
name: z18.string().min(1, "placeholder name must be non-empty"),
|
|
12479
12521
|
/** Resolver source the installer consults for this placeholder. */
|
|
12480
|
-
source:
|
|
12522
|
+
source: z18.enum(PLACEHOLDER_SOURCES),
|
|
12481
12523
|
/**
|
|
12482
12524
|
* Path expression evaluated against `source` (e.g. `engines.node` against
|
|
12483
12525
|
* `project-context`, `defaults.branchModel` against `.cleo/config`).
|
|
12484
12526
|
* For `literal` source, this MAY be the literal value's identifier.
|
|
12485
12527
|
*/
|
|
12486
|
-
sourcePath:
|
|
12528
|
+
sourcePath: z18.string().min(1, "placeholder sourcePath must be non-empty"),
|
|
12487
12529
|
/**
|
|
12488
12530
|
* Fallback value used when `source[sourcePath]` resolves to `undefined`.
|
|
12489
12531
|
* `null` is permitted to explicitly mark "no default — failure required".
|
|
12490
12532
|
*/
|
|
12491
|
-
defaultValue:
|
|
12533
|
+
defaultValue: z18.union([z18.string(), z18.number(), z18.boolean(), z18.null()]).optional()
|
|
12492
12534
|
});
|
|
12493
|
-
TemplateManifestEntrySchema =
|
|
12535
|
+
TemplateManifestEntrySchema = z18.object({
|
|
12494
12536
|
/** Stable identifier for this template entry. */
|
|
12495
|
-
id:
|
|
12537
|
+
id: z18.string().min(1, "id must be non-empty"),
|
|
12496
12538
|
/** Category of file this template represents. */
|
|
12497
|
-
kind:
|
|
12539
|
+
kind: z18.enum(TEMPLATE_KINDS),
|
|
12498
12540
|
/** Repo-relative path of the template source file. */
|
|
12499
|
-
sourcePath:
|
|
12541
|
+
sourcePath: z18.string().min(1, "sourcePath must be non-empty"),
|
|
12500
12542
|
/** Project-relative path where the rendered template installs. */
|
|
12501
|
-
installPath:
|
|
12543
|
+
installPath: z18.string().min(1, "installPath must be non-empty"),
|
|
12502
12544
|
/** Substitution strategy the installer applies to `sourcePath`. */
|
|
12503
|
-
substitution:
|
|
12545
|
+
substitution: z18.enum(TEMPLATE_SUBSTITUTIONS),
|
|
12504
12546
|
/** Declared placeholders this template requires. May be empty. */
|
|
12505
|
-
placeholders:
|
|
12547
|
+
placeholders: z18.array(PlaceholderSpecSchema),
|
|
12506
12548
|
/** Reconciliation policy on upgrade. */
|
|
12507
|
-
updateStrategy:
|
|
12549
|
+
updateStrategy: z18.enum(TEMPLATE_UPDATE_STRATEGIES)
|
|
12508
12550
|
});
|
|
12509
12551
|
}
|
|
12510
12552
|
});
|
|
12511
12553
|
|
|
12512
12554
|
// packages/contracts/src/validator/index.ts
|
|
12513
|
-
import { z as
|
|
12555
|
+
import { z as z19 } from "zod";
|
|
12514
12556
|
var VALIDATOR_ID_REGEX, validatorFindingSchema, validatorAttestationSchema, validatorRejectionSchema, validatorVerdictSchema;
|
|
12515
12557
|
var init_validator = __esm({
|
|
12516
12558
|
"packages/contracts/src/validator/index.ts"() {
|
|
12517
12559
|
"use strict";
|
|
12518
12560
|
VALIDATOR_ID_REGEX = /^validator-[a-z0-9][a-z0-9-]*$/;
|
|
12519
|
-
validatorFindingSchema =
|
|
12520
|
-
acId:
|
|
12521
|
-
status:
|
|
12522
|
-
reasoning:
|
|
12523
|
-
evidenceRefs:
|
|
12524
|
-
checkedAt:
|
|
12561
|
+
validatorFindingSchema = z19.object({
|
|
12562
|
+
acId: z19.string().min(1, "acId must be non-empty"),
|
|
12563
|
+
status: z19.enum(["pass", "fail", "inconclusive"]),
|
|
12564
|
+
reasoning: z19.string().min(1, "reasoning must be non-empty"),
|
|
12565
|
+
evidenceRefs: z19.array(z19.string()).optional(),
|
|
12566
|
+
checkedAt: z19.string().min(1, "checkedAt must be a non-empty ISO-8601 string")
|
|
12525
12567
|
});
|
|
12526
|
-
validatorAttestationSchema =
|
|
12527
|
-
verdict:
|
|
12528
|
-
taskId:
|
|
12529
|
-
validatorId:
|
|
12530
|
-
findings:
|
|
12568
|
+
validatorAttestationSchema = z19.object({
|
|
12569
|
+
verdict: z19.literal("attest"),
|
|
12570
|
+
taskId: z19.string().min(1),
|
|
12571
|
+
validatorId: z19.string().regex(VALIDATOR_ID_REGEX, "validatorId must match the pattern validator-<discriminator>"),
|
|
12572
|
+
findings: z19.array(validatorFindingSchema).min(1, "attestation must contain at least one finding").refine(
|
|
12531
12573
|
(findings) => findings.every((f) => f.status === "pass"),
|
|
12532
12574
|
'attestation requires every finding to have status="pass"'
|
|
12533
12575
|
),
|
|
12534
|
-
summary:
|
|
12535
|
-
attestedAt:
|
|
12536
|
-
schemaVersion:
|
|
12576
|
+
summary: z19.string().optional(),
|
|
12577
|
+
attestedAt: z19.string().min(1),
|
|
12578
|
+
schemaVersion: z19.literal("1")
|
|
12537
12579
|
});
|
|
12538
|
-
validatorRejectionSchema =
|
|
12539
|
-
verdict:
|
|
12540
|
-
taskId:
|
|
12541
|
-
validatorId:
|
|
12542
|
-
findings:
|
|
12580
|
+
validatorRejectionSchema = z19.object({
|
|
12581
|
+
verdict: z19.literal("reject"),
|
|
12582
|
+
taskId: z19.string().min(1),
|
|
12583
|
+
validatorId: z19.string().regex(VALIDATOR_ID_REGEX, "validatorId must match the pattern validator-<discriminator>"),
|
|
12584
|
+
findings: z19.array(validatorFindingSchema).min(1, "rejection must contain at least one finding").refine(
|
|
12543
12585
|
(findings) => findings.some((f) => f.status !== "pass"),
|
|
12544
12586
|
'rejection requires at least one finding with status "fail" or "inconclusive"'
|
|
12545
12587
|
),
|
|
12546
|
-
summary:
|
|
12547
|
-
remediationHints:
|
|
12548
|
-
rejectedAt:
|
|
12549
|
-
schemaVersion:
|
|
12588
|
+
summary: z19.string().min(1, "rejection summary must be non-empty"),
|
|
12589
|
+
remediationHints: z19.array(z19.string()).optional(),
|
|
12590
|
+
rejectedAt: z19.string().min(1),
|
|
12591
|
+
schemaVersion: z19.literal("1")
|
|
12550
12592
|
});
|
|
12551
|
-
validatorVerdictSchema =
|
|
12593
|
+
validatorVerdictSchema = z19.discriminatedUnion("verdict", [
|
|
12552
12594
|
validatorAttestationSchema,
|
|
12553
12595
|
validatorRejectionSchema
|
|
12554
12596
|
]);
|
|
@@ -12572,6 +12614,7 @@ var init_src = __esm({
|
|
|
12572
12614
|
init_identity();
|
|
12573
12615
|
init_operations_registry();
|
|
12574
12616
|
init_provenance();
|
|
12617
|
+
init_read();
|
|
12575
12618
|
init_docs_taxonomy();
|
|
12576
12619
|
init_engine_result();
|
|
12577
12620
|
init_enums();
|
|
@@ -13970,10 +14013,10 @@ var init_subquery = __esm({
|
|
|
13970
14013
|
init_entity();
|
|
13971
14014
|
Subquery = class {
|
|
13972
14015
|
static [entityKind] = "Subquery";
|
|
13973
|
-
constructor(
|
|
14016
|
+
constructor(sql39, fields, alias, isWith = false, usedTables = []) {
|
|
13974
14017
|
this._ = {
|
|
13975
14018
|
brand: "Subquery",
|
|
13976
|
-
sql:
|
|
14019
|
+
sql: sql39,
|
|
13977
14020
|
selectedFields: fields,
|
|
13978
14021
|
alias,
|
|
13979
14022
|
isWith,
|
|
@@ -14587,8 +14630,8 @@ var init_sql = __esm({
|
|
|
14587
14630
|
isSelectionField = false;
|
|
14588
14631
|
/** @internal */
|
|
14589
14632
|
origin;
|
|
14590
|
-
constructor(
|
|
14591
|
-
this.sql =
|
|
14633
|
+
constructor(sql39, fieldAlias) {
|
|
14634
|
+
this.sql = sql39;
|
|
14592
14635
|
this.fieldAlias = fieldAlias;
|
|
14593
14636
|
}
|
|
14594
14637
|
getSQL() {
|
|
@@ -16157,17 +16200,17 @@ var init_custom = __esm({
|
|
|
16157
16200
|
mapFromJsonValue(value) {
|
|
16158
16201
|
return typeof this.mapJson === "function" ? this.mapJson(value) : this.mapFromDriverValue(value);
|
|
16159
16202
|
}
|
|
16160
|
-
jsonSelectIdentifier(identifier,
|
|
16161
|
-
if (typeof this.forJsonSelect === "function") return this.forJsonSelect(identifier,
|
|
16203
|
+
jsonSelectIdentifier(identifier, sql39) {
|
|
16204
|
+
if (typeof this.forJsonSelect === "function") return this.forJsonSelect(identifier, sql39);
|
|
16162
16205
|
const rawType = this.getSQLType().toLowerCase();
|
|
16163
16206
|
const parenPos = rawType.indexOf("(");
|
|
16164
16207
|
switch (parenPos + 1 ? rawType.slice(0, parenPos) : rawType) {
|
|
16165
16208
|
case "numeric":
|
|
16166
16209
|
case "decimal":
|
|
16167
16210
|
case "bigint":
|
|
16168
|
-
return
|
|
16211
|
+
return sql39`cast(${identifier} as text)`;
|
|
16169
16212
|
case "blob":
|
|
16170
|
-
return
|
|
16213
|
+
return sql39`hex(${identifier})`;
|
|
16171
16214
|
default:
|
|
16172
16215
|
return identifier;
|
|
16173
16216
|
}
|
|
@@ -20455,8 +20498,8 @@ var init_dialect = __esm({
|
|
|
20455
20498
|
const returningSql = returning ? sql` returning ${this.buildSelection(returning, { isSingleTable: true })}` : void 0;
|
|
20456
20499
|
return sql`${withSql}insert into ${table} ${insertOrder} ${valuesSql}${onConflict?.length ? sql.join(onConflict) : void 0}${returningSql}`;
|
|
20457
20500
|
}
|
|
20458
|
-
sqlToQuery(
|
|
20459
|
-
return
|
|
20501
|
+
sqlToQuery(sql39, invokeSource) {
|
|
20502
|
+
return sql39.toQuery({
|
|
20460
20503
|
escapeName: this.escapeName,
|
|
20461
20504
|
escapeParam: this.escapeParam,
|
|
20462
20505
|
escapeString: this.escapeString,
|
|
@@ -21973,8 +22016,8 @@ var init_db = __esm({
|
|
|
21973
22016
|
});
|
|
21974
22017
|
|
|
21975
22018
|
// 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
|
|
21976
|
-
async function hashQuery(
|
|
21977
|
-
const dataToHash = `${
|
|
22019
|
+
async function hashQuery(sql39, params) {
|
|
22020
|
+
const dataToHash = `${sql39}-${JSON.stringify(params, (_, v) => typeof v === "bigint" ? `${v}n` : v)}`;
|
|
21978
22021
|
const data = new TextEncoder().encode(dataToHash);
|
|
21979
22022
|
const hashBuffer = await crypto.subtle.digest("SHA-256", data);
|
|
21980
22023
|
return [...new Uint8Array(hashBuffer)].map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
@@ -22153,8 +22196,8 @@ var init_session3 = __esm({
|
|
|
22153
22196
|
values(query) {
|
|
22154
22197
|
return this.prepareOneTimeQuery(this.dialect.sqlToQuery(query), void 0, "run").values();
|
|
22155
22198
|
}
|
|
22156
|
-
async count(
|
|
22157
|
-
return (await this.values(
|
|
22199
|
+
async count(sql39) {
|
|
22200
|
+
return (await this.values(sql39))[0][0];
|
|
22158
22201
|
}
|
|
22159
22202
|
/** @internal */
|
|
22160
22203
|
extractRawValuesValueFromBatchResult(_result) {
|
|
@@ -22424,6 +22467,48 @@ var init_logger2 = __esm({
|
|
|
22424
22467
|
}
|
|
22425
22468
|
});
|
|
22426
22469
|
|
|
22470
|
+
// packages/core/src/store/exodus/abort-events.ts
|
|
22471
|
+
var abort_events_exports = {};
|
|
22472
|
+
__export(abort_events_exports, {
|
|
22473
|
+
clearExodusAborts: () => clearExodusAborts,
|
|
22474
|
+
emitExodusAbort: () => emitExodusAbort,
|
|
22475
|
+
exodusAbortEvents: () => exodusAbortEvents,
|
|
22476
|
+
getRecordedExodusAbort: () => getRecordedExodusAbort
|
|
22477
|
+
});
|
|
22478
|
+
import { EventEmitter } from "node:events";
|
|
22479
|
+
function emitExodusAbort(detail) {
|
|
22480
|
+
_abortedScopes.set(detail.scope, detail);
|
|
22481
|
+
try {
|
|
22482
|
+
return exodusAbortEvents.emit("abort", detail);
|
|
22483
|
+
} catch {
|
|
22484
|
+
return false;
|
|
22485
|
+
}
|
|
22486
|
+
}
|
|
22487
|
+
function getRecordedExodusAbort(scope) {
|
|
22488
|
+
if (scope !== void 0) return _abortedScopes.get(scope);
|
|
22489
|
+
let latest;
|
|
22490
|
+
for (const detail of _abortedScopes.values()) {
|
|
22491
|
+
if (!latest || detail.at >= latest.at) latest = detail;
|
|
22492
|
+
}
|
|
22493
|
+
return latest;
|
|
22494
|
+
}
|
|
22495
|
+
function clearExodusAborts(scope) {
|
|
22496
|
+
if (scope !== void 0) {
|
|
22497
|
+
_abortedScopes.delete(scope);
|
|
22498
|
+
return;
|
|
22499
|
+
}
|
|
22500
|
+
_abortedScopes.clear();
|
|
22501
|
+
}
|
|
22502
|
+
var exodusAbortEvents, _abortedScopes;
|
|
22503
|
+
var init_abort_events = __esm({
|
|
22504
|
+
"packages/core/src/store/exodus/abort-events.ts"() {
|
|
22505
|
+
"use strict";
|
|
22506
|
+
exodusAbortEvents = new EventEmitter();
|
|
22507
|
+
exodusAbortEvents.setMaxListeners(50);
|
|
22508
|
+
_abortedScopes = /* @__PURE__ */ new Map();
|
|
22509
|
+
}
|
|
22510
|
+
});
|
|
22511
|
+
|
|
22427
22512
|
// 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
|
|
22428
22513
|
import crypto2 from "node:crypto";
|
|
22429
22514
|
import fs, { existsSync, readdirSync } from "node:fs";
|
|
@@ -22798,7 +22883,7 @@ function reconcileBrainMigrationsForConsolidatedDb(nativeDb, migrationsFolder) {
|
|
|
22798
22883
|
const cols = nativeDb.prepare(`PRAGMA table_info("${table}")`).all();
|
|
22799
22884
|
return cols.some((c) => c.name === column);
|
|
22800
22885
|
};
|
|
22801
|
-
const stripSqlComments = (
|
|
22886
|
+
const stripSqlComments = (sql39) => sql39.replace(/--[^\n]*/g, "").replace(/\/\*[\s\S]*?\*\//g, "");
|
|
22802
22887
|
let marked = 0;
|
|
22803
22888
|
let applied = 0;
|
|
22804
22889
|
for (const m of localMigrations) {
|
|
@@ -27214,7 +27299,8 @@ var init_conduit2 = __esm({
|
|
|
27214
27299
|
});
|
|
27215
27300
|
|
|
27216
27301
|
// packages/core/src/store/schema/attachments.ts
|
|
27217
|
-
|
|
27302
|
+
import { sql as sql11 } from "drizzle-orm";
|
|
27303
|
+
var ATTACHMENT_OWNER_TYPES, ATTACHMENT_LIFECYCLE_STATUSES, attachments, attachmentRefs, DOCS_WIKILINK_RELATIONS, docsWikilinks;
|
|
27218
27304
|
var init_attachments = __esm({
|
|
27219
27305
|
"packages/core/src/store/schema/attachments.ts"() {
|
|
27220
27306
|
"use strict";
|
|
@@ -27353,12 +27439,42 @@ var init_attachments = __esm({
|
|
|
27353
27439
|
*
|
|
27354
27440
|
* @task T11181 (Epic T10518 / Saga T10516)
|
|
27355
27441
|
*/
|
|
27356
|
-
docVersion: integer("doc_version").notNull().default(1)
|
|
27442
|
+
docVersion: integer("doc_version").notNull().default(1),
|
|
27443
|
+
/**
|
|
27444
|
+
* Optional explicit display-alias NUMBER for the doc, DECOUPLED from the
|
|
27445
|
+
* slug string.
|
|
27446
|
+
*
|
|
27447
|
+
* Background (T11875 · ADR reconcile T11676): under the ratified
|
|
27448
|
+
* slug-primary model the kebab `slug` is the canonical handle and the
|
|
27449
|
+
* displayed number (e.g. ADR "051") is a DISPLAY ALIAS only. Previously
|
|
27450
|
+
* that number was DERIVED by parsing the digits out of the slug
|
|
27451
|
+
* (`adr-051-*` → 051), so three distinct ADRs that all slug as `adr-051-*`
|
|
27452
|
+
* collided on the rendered number with no way to disambiguate.
|
|
27453
|
+
*
|
|
27454
|
+
* When non-null, this column is the authoritative display number and is
|
|
27455
|
+
* PREFERRED over the slug-derived number by
|
|
27456
|
+
* {@link import('../../docs/numbering.js').resolveDisplayNumber}. When null,
|
|
27457
|
+
* rendering falls back to the slug-derived number unchanged — so docs that
|
|
27458
|
+
* never had an alias assigned keep their historical behaviour.
|
|
27459
|
+
*
|
|
27460
|
+
* Uniqueness among `type='adr'` docs is enforced at the dispatch layer (not
|
|
27461
|
+
* via a SQL UNIQUE constraint) by
|
|
27462
|
+
* {@link import('../../docs/display-alias.js').setDisplayAlias}, mirroring
|
|
27463
|
+
* the dispatch-validated discipline used for `lifecycle_status` /
|
|
27464
|
+
* `relation` so future taxonomy changes never require a schema migration.
|
|
27465
|
+
*
|
|
27466
|
+
* @task T11875 (Epic T11781 / Saga T11778)
|
|
27467
|
+
*/
|
|
27468
|
+
displayAlias: integer("display_alias")
|
|
27357
27469
|
},
|
|
27358
27470
|
(table) => [
|
|
27359
27471
|
index("idx_attachments_sha256").on(table.sha256),
|
|
27360
27472
|
index("idx_attachments_lifecycle_status").on(table.lifecycleStatus),
|
|
27361
|
-
index("idx_attachments_supersedes").on(table.supersedes)
|
|
27473
|
+
index("idx_attachments_supersedes").on(table.supersedes),
|
|
27474
|
+
// Speeds the per-type uniqueness scan in `setDisplayAlias` (T11875). Not a
|
|
27475
|
+
// UNIQUE index — uniqueness is scoped to `type='adr'` and enforced at the
|
|
27476
|
+
// dispatch layer so non-adr kinds may reuse numbers freely.
|
|
27477
|
+
index("idx_attachments_display_alias").on(table.displayAlias)
|
|
27362
27478
|
]
|
|
27363
27479
|
);
|
|
27364
27480
|
attachmentRefs = sqliteTable(
|
|
@@ -27383,11 +27499,38 @@ var init_attachments = __esm({
|
|
|
27383
27499
|
index("idx_attachment_refs_owner").on(table.ownerType, table.ownerId)
|
|
27384
27500
|
]
|
|
27385
27501
|
);
|
|
27502
|
+
DOCS_WIKILINK_RELATIONS = [
|
|
27503
|
+
"supersedes",
|
|
27504
|
+
"superseded-by",
|
|
27505
|
+
"related-task",
|
|
27506
|
+
"topic"
|
|
27507
|
+
];
|
|
27508
|
+
docsWikilinks = sqliteTable(
|
|
27509
|
+
"docs_wikilinks",
|
|
27510
|
+
{
|
|
27511
|
+
/** Source doc slug (→ `attachments.slug`). Always a doc. */
|
|
27512
|
+
fromSlug: text("from_slug").notNull(),
|
|
27513
|
+
/** Target slug — a doc slug, or a `T####` task id when `toIsTask = 1`. */
|
|
27514
|
+
toSlug: text("to_slug").notNull(),
|
|
27515
|
+
/** Which provenance column produced this edge — dispatch-validated, no SQL CHECK. */
|
|
27516
|
+
relation: text("relation", { enum: DOCS_WIKILINK_RELATIONS }).notNull(),
|
|
27517
|
+
/** 1 when `to_slug` is a task id (`related-task` edges); 0 for doc→doc edges. */
|
|
27518
|
+
toIsTask: integer("to_is_task", { mode: "boolean" }).notNull().default(false),
|
|
27519
|
+
/** ISO-8601 UTC instant this edge was last (re)derived. */
|
|
27520
|
+
derivedAt: text("derived_at").notNull().default(sql11`(datetime('now'))`)
|
|
27521
|
+
},
|
|
27522
|
+
(table) => [
|
|
27523
|
+
primaryKey({ columns: [table.fromSlug, table.toSlug, table.relation] }),
|
|
27524
|
+
index("idx_docs_wikilinks_from").on(table.fromSlug),
|
|
27525
|
+
index("idx_docs_wikilinks_to").on(table.toSlug),
|
|
27526
|
+
index("idx_docs_wikilinks_relation").on(table.relation)
|
|
27527
|
+
]
|
|
27528
|
+
);
|
|
27386
27529
|
}
|
|
27387
27530
|
});
|
|
27388
27531
|
|
|
27389
27532
|
// packages/core/src/store/schema/cleo-project/docs.ts
|
|
27390
|
-
import { sql as
|
|
27533
|
+
import { sql as sql12 } from "drizzle-orm";
|
|
27391
27534
|
var docsAttachments, docsAttachmentRefs, docsManifestEntries, docsPipelineManifest;
|
|
27392
27535
|
var init_docs2 = __esm({
|
|
27393
27536
|
"packages/core/src/store/schema/cleo-project/docs.ts"() {
|
|
@@ -27410,7 +27553,7 @@ var init_docs2 = __esm({
|
|
|
27410
27553
|
*/
|
|
27411
27554
|
attachmentJson: text("attachment_json").notNull(),
|
|
27412
27555
|
/** ISO-8601 UTC creation instant (canonical TEXT timestamp, §4). */
|
|
27413
|
-
createdAt: text("created_at").notNull().default(
|
|
27556
|
+
createdAt: text("created_at").notNull().default(sql12`(datetime('now'))`),
|
|
27414
27557
|
/** Number of `docs_attachment_refs` rows pointing here; GC-eligible at 0. */
|
|
27415
27558
|
refCount: integer("ref_count").notNull().default(0),
|
|
27416
27559
|
/** Optional human-friendly slug, unique per project. */
|
|
@@ -27495,7 +27638,7 @@ var init_docs2 = __esm({
|
|
|
27495
27638
|
/** Agent identity (or `"human"`) that created the entry. */
|
|
27496
27639
|
createdBy: text("created_by"),
|
|
27497
27640
|
/** ISO-8601 UTC creation instant (canonical TEXT timestamp, §4). */
|
|
27498
|
-
createdAt: text("created_at").notNull().default(
|
|
27641
|
+
createdAt: text("created_at").notNull().default(sql12`(datetime('now'))`)
|
|
27499
27642
|
},
|
|
27500
27643
|
(table) => [
|
|
27501
27644
|
index("idx_docs_manifest_entries_pipeline_id").on(table.pipelineId),
|
|
@@ -27542,7 +27685,7 @@ var init_docs2 = __esm({
|
|
|
27542
27685
|
/** Optional serialized metadata (TEXT per JSON audit). */
|
|
27543
27686
|
metadataJson: text("metadata_json"),
|
|
27544
27687
|
/** ISO-8601 UTC creation instant (canonical TEXT timestamp, §4). */
|
|
27545
|
-
createdAt: text("created_at").notNull().default(
|
|
27688
|
+
createdAt: text("created_at").notNull().default(sql12`(datetime('now'))`),
|
|
27546
27689
|
/** ISO-8601 UTC archival instant; NULL while active (canonical TEXT, §4). */
|
|
27547
27690
|
archivedAt: text("archived_at")
|
|
27548
27691
|
},
|
|
@@ -27558,7 +27701,7 @@ var init_docs2 = __esm({
|
|
|
27558
27701
|
});
|
|
27559
27702
|
|
|
27560
27703
|
// packages/core/src/store/schema/cleo-project/lifecycle.ts
|
|
27561
|
-
import { sql as
|
|
27704
|
+
import { sql as sql13 } from "drizzle-orm";
|
|
27562
27705
|
var LIFECYCLE_VALIDATION_STATUSES, tasksLifecyclePipelines, tasksLifecycleStages, tasksLifecycleGateResults, tasksLifecycleEvidence, tasksLifecycleTransitions;
|
|
27563
27706
|
var init_lifecycle3 = __esm({
|
|
27564
27707
|
"packages/core/src/store/schema/cleo-project/lifecycle.ts"() {
|
|
@@ -27585,11 +27728,11 @@ var init_lifecycle3 = __esm({
|
|
|
27585
27728
|
/** Current stage id pointer. */
|
|
27586
27729
|
currentStageId: text("current_stage_id"),
|
|
27587
27730
|
/** ISO-8601 UTC start instant (canonical TEXT, §4). */
|
|
27588
|
-
startedAt: text("started_at").notNull().default(
|
|
27731
|
+
startedAt: text("started_at").notNull().default(sql13`(datetime('now'))`),
|
|
27589
27732
|
/** ISO-8601 UTC completion instant; NULL while active (canonical TEXT, §4). */
|
|
27590
27733
|
completedAt: text("completed_at"),
|
|
27591
27734
|
/** ISO-8601 UTC last-update instant (canonical TEXT, §4). */
|
|
27592
|
-
updatedAt: text("updated_at").default(
|
|
27735
|
+
updatedAt: text("updated_at").default(sql13`(datetime('now'))`),
|
|
27593
27736
|
/** Optimistic-concurrency version counter. */
|
|
27594
27737
|
version: integer("version").notNull().default(1)
|
|
27595
27738
|
},
|
|
@@ -27659,7 +27802,7 @@ var init_lifecycle3 = __esm({
|
|
|
27659
27802
|
/** Result — CHECK-backed via {@link LIFECYCLE_GATE_RESULTS}. */
|
|
27660
27803
|
result: text("result", { enum: LIFECYCLE_GATE_RESULTS }).notNull(),
|
|
27661
27804
|
/** ISO-8601 UTC check instant (canonical TEXT, §4). */
|
|
27662
|
-
checkedAt: text("checked_at").notNull().default(
|
|
27805
|
+
checkedAt: text("checked_at").notNull().default(sql13`(datetime('now'))`),
|
|
27663
27806
|
/** Checker identity. */
|
|
27664
27807
|
checkedBy: text("checked_by").notNull(),
|
|
27665
27808
|
/** Optional detail payload. */
|
|
@@ -27681,7 +27824,7 @@ var init_lifecycle3 = __esm({
|
|
|
27681
27824
|
/** Evidence type — CHECK-backed via {@link LIFECYCLE_EVIDENCE_TYPES}. */
|
|
27682
27825
|
type: text("type", { enum: LIFECYCLE_EVIDENCE_TYPES }).notNull(),
|
|
27683
27826
|
/** ISO-8601 UTC record instant (canonical TEXT, §4). */
|
|
27684
|
-
recordedAt: text("recorded_at").notNull().default(
|
|
27827
|
+
recordedAt: text("recorded_at").notNull().default(sql13`(datetime('now'))`),
|
|
27685
27828
|
/** Recorder identity. */
|
|
27686
27829
|
recordedBy: text("recorded_by"),
|
|
27687
27830
|
/** Optional description. */
|
|
@@ -27705,7 +27848,7 @@ var init_lifecycle3 = __esm({
|
|
|
27705
27848
|
/** Actor identity. */
|
|
27706
27849
|
transitionedBy: text("transitioned_by"),
|
|
27707
27850
|
/** ISO-8601 UTC creation instant (canonical TEXT, §4). */
|
|
27708
|
-
createdAt: text("created_at").notNull().default(
|
|
27851
|
+
createdAt: text("created_at").notNull().default(sql13`(datetime('now'))`)
|
|
27709
27852
|
},
|
|
27710
27853
|
(table) => [index("idx_tasks_lifecycle_transitions_pipeline_id").on(table.pipelineId)]
|
|
27711
27854
|
);
|
|
@@ -27713,7 +27856,7 @@ var init_lifecycle3 = __esm({
|
|
|
27713
27856
|
});
|
|
27714
27857
|
|
|
27715
27858
|
// packages/core/src/store/schema/cleo-project/nexus-graph.ts
|
|
27716
|
-
import { sql as
|
|
27859
|
+
import { sql as sql14 } from "drizzle-orm";
|
|
27717
27860
|
var NEXUS_NODE_KINDS, NEXUS_RELATION_TYPES, NEXUS_CONTRACT_TYPES, CODE_INDEX_KINDS, nexusNodes, nexusRelations, nexusRelationWeights, nexusContracts, nexusCodeIndex;
|
|
27718
27861
|
var init_nexus_graph = __esm({
|
|
27719
27862
|
"packages/core/src/store/schema/cleo-project/nexus-graph.ts"() {
|
|
@@ -27853,7 +27996,7 @@ var init_nexus_graph = __esm({
|
|
|
27853
27996
|
/** Whether this node is an external/unresolved module (E10 §3a — typed boolean). */
|
|
27854
27997
|
isExternal: integer("is_external", { mode: "boolean" }).notNull().default(false),
|
|
27855
27998
|
/** ISO-8601 UTC last-indexed instant (canonical TEXT, §4). */
|
|
27856
|
-
indexedAt: text("indexed_at").notNull().default(
|
|
27999
|
+
indexedAt: text("indexed_at").notNull().default(sql14`(datetime('now'))`)
|
|
27857
28000
|
},
|
|
27858
28001
|
(table) => [
|
|
27859
28002
|
index("idx_nexus_nodes_kind").on(table.kind),
|
|
@@ -27883,7 +28026,7 @@ var init_nexus_graph = __esm({
|
|
|
27883
28026
|
/** Step index within an execution flow (for step_in_process relations). */
|
|
27884
28027
|
step: integer("step"),
|
|
27885
28028
|
/** ISO-8601 UTC last-indexed instant (canonical TEXT, §4). */
|
|
27886
|
-
indexedAt: text("indexed_at").notNull().default(
|
|
28029
|
+
indexedAt: text("indexed_at").notNull().default(sql14`(datetime('now'))`)
|
|
27887
28030
|
// T998 plasticity columns (`weight`, `last_accessed_at`, `co_accessed_count`)
|
|
27888
28031
|
// PARTITIONED out into the sibling `nexus_relation_weights` table by T11545
|
|
27889
28032
|
// (ADR-090 §5.3). See {@link nexusRelationWeights}.
|
|
@@ -27938,9 +28081,9 @@ var init_nexus_graph = __esm({
|
|
|
27938
28081
|
/** Human-readable description. */
|
|
27939
28082
|
description: text("description"),
|
|
27940
28083
|
/** ISO-8601 UTC creation instant (canonical TEXT, §4). */
|
|
27941
|
-
createdAt: text("created_at").notNull().default(
|
|
28084
|
+
createdAt: text("created_at").notNull().default(sql14`(datetime('now'))`),
|
|
27942
28085
|
/** ISO-8601 UTC last-update instant (canonical TEXT, §4). */
|
|
27943
|
-
updatedAt: text("updated_at").notNull().default(
|
|
28086
|
+
updatedAt: text("updated_at").notNull().default(sql14`(datetime('now'))`)
|
|
27944
28087
|
},
|
|
27945
28088
|
(table) => [
|
|
27946
28089
|
index("idx_nexus_contracts_type").on(table.type),
|
|
@@ -27988,7 +28131,7 @@ var init_nexus_graph = __esm({
|
|
|
27988
28131
|
});
|
|
27989
28132
|
|
|
27990
28133
|
// packages/core/src/store/schema/provenance/commits.ts
|
|
27991
|
-
import { sql as
|
|
28134
|
+
import { sql as sql15 } from "drizzle-orm";
|
|
27992
28135
|
var COMMIT_CONVENTIONAL_TYPES, COMMIT_LINK_KINDS, COMMIT_LINK_SOURCES, COMMIT_FILE_CHANGE_TYPES, commits, taskCommits, commitFiles;
|
|
27993
28136
|
var init_commits = __esm({
|
|
27994
28137
|
"packages/core/src/store/schema/provenance/commits.ts"() {
|
|
@@ -28070,7 +28213,7 @@ var init_commits = __esm({
|
|
|
28070
28213
|
*/
|
|
28071
28214
|
projectHash: text("project_hash"),
|
|
28072
28215
|
/** ISO-8601 timestamp when this row was inserted into tasks.db. */
|
|
28073
|
-
createdAt: text("created_at").notNull().default(
|
|
28216
|
+
createdAt: text("created_at").notNull().default(sql15`(datetime('now'))`)
|
|
28074
28217
|
},
|
|
28075
28218
|
(table) => [
|
|
28076
28219
|
index("idx_commits_short_sha").on(table.shortSha),
|
|
@@ -28102,7 +28245,7 @@ var init_commits = __esm({
|
|
|
28102
28245
|
*/
|
|
28103
28246
|
linkSource: text("link_source").notNull(),
|
|
28104
28247
|
/** ISO-8601 timestamp when this link was created. */
|
|
28105
|
-
createdAt: text("created_at").notNull().default(
|
|
28248
|
+
createdAt: text("created_at").notNull().default(sql15`(datetime('now'))`)
|
|
28106
28249
|
},
|
|
28107
28250
|
(table) => [
|
|
28108
28251
|
primaryKey({ columns: [table.taskId, table.commitSha, table.linkKind] }),
|
|
@@ -28145,7 +28288,7 @@ var init_commits = __esm({
|
|
|
28145
28288
|
});
|
|
28146
28289
|
|
|
28147
28290
|
// packages/core/src/store/schema/cleo-project/provenance-commits.ts
|
|
28148
|
-
import { sql as
|
|
28291
|
+
import { sql as sql16 } from "drizzle-orm";
|
|
28149
28292
|
var tasksCommits, tasksTaskCommits, tasksCommitFiles;
|
|
28150
28293
|
var init_provenance_commits = __esm({
|
|
28151
28294
|
"packages/core/src/store/schema/cleo-project/provenance-commits.ts"() {
|
|
@@ -28203,7 +28346,7 @@ var init_provenance_commits = __esm({
|
|
|
28203
28346
|
/** Project hash correlating commits to a specific CLEO project. */
|
|
28204
28347
|
projectHash: text("project_hash"),
|
|
28205
28348
|
/** ISO-8601 UTC insertion instant (canonical TEXT timestamp, §4). */
|
|
28206
|
-
createdAt: text("created_at").notNull().default(
|
|
28349
|
+
createdAt: text("created_at").notNull().default(sql16`(datetime('now'))`)
|
|
28207
28350
|
},
|
|
28208
28351
|
(table) => [
|
|
28209
28352
|
index("idx_tasks_commits_short_sha").on(table.shortSha),
|
|
@@ -28226,7 +28369,7 @@ var init_provenance_commits = __esm({
|
|
|
28226
28369
|
/** How this link was discovered — E10 §5b CHECK-backed. */
|
|
28227
28370
|
linkSource: text("link_source", { enum: COMMIT_LINK_SOURCES }).notNull(),
|
|
28228
28371
|
/** ISO-8601 UTC link-creation instant (canonical TEXT timestamp, §4). */
|
|
28229
|
-
createdAt: text("created_at").notNull().default(
|
|
28372
|
+
createdAt: text("created_at").notNull().default(sql16`(datetime('now'))`)
|
|
28230
28373
|
},
|
|
28231
28374
|
(table) => [
|
|
28232
28375
|
primaryKey({ columns: [table.taskId, table.commitSha, table.linkKind] }),
|
|
@@ -28263,7 +28406,7 @@ var init_provenance_commits = __esm({
|
|
|
28263
28406
|
});
|
|
28264
28407
|
|
|
28265
28408
|
// packages/core/src/store/schema/cleo-project/provenance-orphans.ts
|
|
28266
|
-
import { sql as
|
|
28409
|
+
import { sql as sql17 } from "drizzle-orm";
|
|
28267
28410
|
var BRAIN_RELEASE_LINK_TYPES_CONSOLIDATED, tasksAgentCredentials, tasksBrainReleaseLinks;
|
|
28268
28411
|
var init_provenance_orphans = __esm({
|
|
28269
28412
|
"packages/core/src/store/schema/cleo-project/provenance-orphans.ts"() {
|
|
@@ -28301,9 +28444,9 @@ var init_provenance_orphans = __esm({
|
|
|
28301
28444
|
/** Unix epoch of most recent use (milliseconds). Null = never used. */
|
|
28302
28445
|
lastUsedAt: integer("last_used_at"),
|
|
28303
28446
|
/** Unix epoch when this credential was created (milliseconds). */
|
|
28304
|
-
createdAt: integer("created_at").notNull().default(
|
|
28447
|
+
createdAt: integer("created_at").notNull().default(sql17`(unixepoch())`),
|
|
28305
28448
|
/** Unix epoch when this credential was last updated (milliseconds). */
|
|
28306
|
-
updatedAt: integer("updated_at").notNull().default(
|
|
28449
|
+
updatedAt: integer("updated_at").notNull().default(sql17`(unixepoch())`)
|
|
28307
28450
|
},
|
|
28308
28451
|
(table) => [
|
|
28309
28452
|
index("idx_tasks_agent_cred_active").on(table.isActive),
|
|
@@ -28323,7 +28466,7 @@ var init_provenance_orphans = __esm({
|
|
|
28323
28466
|
/** Semantic relationship type. */
|
|
28324
28467
|
linkType: text("link_type", { enum: BRAIN_RELEASE_LINK_TYPES_CONSOLIDATED }).notNull(),
|
|
28325
28468
|
/** ISO-8601 timestamp when this link was created. */
|
|
28326
|
-
createdAt: text("created_at").notNull().default(
|
|
28469
|
+
createdAt: text("created_at").notNull().default(sql17`(datetime('now'))`),
|
|
28327
28470
|
/** Identity of the agent or user that created this link. */
|
|
28328
28471
|
createdBy: text("created_by")
|
|
28329
28472
|
},
|
|
@@ -28338,7 +28481,7 @@ var init_provenance_orphans = __esm({
|
|
|
28338
28481
|
});
|
|
28339
28482
|
|
|
28340
28483
|
// packages/core/src/store/schema/provenance/pull-requests.ts
|
|
28341
|
-
import { sql as
|
|
28484
|
+
import { sql as sql18 } from "drizzle-orm";
|
|
28342
28485
|
var PR_STATES, PR_LINK_SOURCES, PR_LINK_KINDS, pullRequests, prCommits, prTasks;
|
|
28343
28486
|
var init_pull_requests = __esm({
|
|
28344
28487
|
"packages/core/src/store/schema/provenance/pull-requests.ts"() {
|
|
@@ -28417,9 +28560,9 @@ var init_pull_requests = __esm({
|
|
|
28417
28560
|
*/
|
|
28418
28561
|
projectHash: text("project_hash"),
|
|
28419
28562
|
/** ISO-8601 timestamp when this row was first inserted into tasks.db. */
|
|
28420
|
-
createdAt: text("created_at").notNull().default(
|
|
28563
|
+
createdAt: text("created_at").notNull().default(sql18`(datetime('now'))`),
|
|
28421
28564
|
/** ISO-8601 timestamp of the last update to this row. */
|
|
28422
|
-
updatedAt: text("updated_at").notNull().default(
|
|
28565
|
+
updatedAt: text("updated_at").notNull().default(sql18`(datetime('now'))`)
|
|
28423
28566
|
},
|
|
28424
28567
|
(table) => [
|
|
28425
28568
|
index("idx_pr_number").on(table.prNumber),
|
|
@@ -28466,7 +28609,7 @@ var init_pull_requests = __esm({
|
|
|
28466
28609
|
*/
|
|
28467
28610
|
linkKind: text("link_kind").notNull(),
|
|
28468
28611
|
/** ISO-8601 timestamp when this link was created. */
|
|
28469
|
-
createdAt: text("created_at").notNull().default(
|
|
28612
|
+
createdAt: text("created_at").notNull().default(sql18`(datetime('now'))`)
|
|
28470
28613
|
},
|
|
28471
28614
|
(table) => [
|
|
28472
28615
|
primaryKey({ columns: [table.prId, table.taskId, table.linkKind] }),
|
|
@@ -28479,7 +28622,7 @@ var init_pull_requests = __esm({
|
|
|
28479
28622
|
});
|
|
28480
28623
|
|
|
28481
28624
|
// packages/core/src/store/schema/provenance/releases.ts
|
|
28482
|
-
import { sql as
|
|
28625
|
+
import { sql as sql19 } from "drizzle-orm";
|
|
28483
28626
|
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;
|
|
28484
28627
|
var init_releases = __esm({
|
|
28485
28628
|
"packages/core/src/store/schema/provenance/releases.ts"() {
|
|
@@ -28589,7 +28732,7 @@ var init_releases = __esm({
|
|
|
28589
28732
|
/** URL of the GitHub Actions workflow run that built and published this release. */
|
|
28590
28733
|
workflowRunUrl: text("workflow_run_url"),
|
|
28591
28734
|
/** ISO-8601 timestamp when this row was inserted. */
|
|
28592
|
-
createdAt: text("created_at").notNull().default(
|
|
28735
|
+
createdAt: text("created_at").notNull().default(sql19`(datetime('now'))`),
|
|
28593
28736
|
/** ISO-8601 timestamp when `cleo release plan` created the plan (new pipeline). */
|
|
28594
28737
|
plannedAt: text("planned_at"),
|
|
28595
28738
|
/** ISO-8601 timestamp when the bump-PR was opened (new pipeline). */
|
|
@@ -28711,7 +28854,7 @@ var init_releases = __esm({
|
|
|
28711
28854
|
*/
|
|
28712
28855
|
classifiedBy: text("classified_by", { enum: RELEASE_CLASSIFIED_BY }).notNull().default("auto"),
|
|
28713
28856
|
/** ISO-8601 timestamp when this change was classified. */
|
|
28714
|
-
classifiedAt: text("classified_at").notNull().default(
|
|
28857
|
+
classifiedAt: text("classified_at").notNull().default(sql19`(datetime('now'))`)
|
|
28715
28858
|
},
|
|
28716
28859
|
(table) => [
|
|
28717
28860
|
index("idx_release_changes_release_id").on(table.releaseId),
|
|
@@ -28742,7 +28885,7 @@ var init_releases = __esm({
|
|
|
28742
28885
|
/** Migration note when `kind = 'breaking'`, nullable. */
|
|
28743
28886
|
breaking: text("breaking"),
|
|
28744
28887
|
/** ISO-8601 timestamp when this row was inserted. */
|
|
28745
|
-
createdAt: text("created_at").notNull().default(
|
|
28888
|
+
createdAt: text("created_at").notNull().default(sql19`(datetime('now'))`)
|
|
28746
28889
|
},
|
|
28747
28890
|
(table) => [
|
|
28748
28891
|
index("release_changesets_release_id_idx").on(table.releaseId),
|
|
@@ -28797,7 +28940,7 @@ var init_releases = __esm({
|
|
|
28797
28940
|
*/
|
|
28798
28941
|
linkType: text("link_type", { enum: BRAIN_RELEASE_LINK_TYPES }).notNull(),
|
|
28799
28942
|
/** ISO-8601 timestamp when this link was created. */
|
|
28800
|
-
createdAt: text("created_at").notNull().default(
|
|
28943
|
+
createdAt: text("created_at").notNull().default(sql19`(datetime('now'))`),
|
|
28801
28944
|
/** Identifier of the agent or user that created this link. Nullable. */
|
|
28802
28945
|
createdBy: text("created_by")
|
|
28803
28946
|
},
|
|
@@ -28812,7 +28955,7 @@ var init_releases = __esm({
|
|
|
28812
28955
|
});
|
|
28813
28956
|
|
|
28814
28957
|
// packages/core/src/store/schema/cleo-project/provenance-rest.ts
|
|
28815
|
-
import { sql as
|
|
28958
|
+
import { sql as sql20 } from "drizzle-orm";
|
|
28816
28959
|
var tasksPullRequests, tasksPrCommits, tasksPrTasks, tasksReleases, tasksReleaseCommits, tasksReleaseChanges, tasksReleaseChangesets, tasksReleaseArtifacts;
|
|
28817
28960
|
var init_provenance_rest = __esm({
|
|
28818
28961
|
"packages/core/src/store/schema/cleo-project/provenance-rest.ts"() {
|
|
@@ -28861,9 +29004,9 @@ var init_provenance_rest = __esm({
|
|
|
28861
29004
|
/** Project correlation hash. */
|
|
28862
29005
|
projectHash: text("project_hash"),
|
|
28863
29006
|
/** ISO-8601 UTC creation instant (canonical TEXT, §4). */
|
|
28864
|
-
createdAt: text("created_at").notNull().default(
|
|
29007
|
+
createdAt: text("created_at").notNull().default(sql20`(datetime('now'))`),
|
|
28865
29008
|
/** ISO-8601 UTC last-update instant (canonical TEXT, §4). */
|
|
28866
|
-
updatedAt: text("updated_at").notNull().default(
|
|
29009
|
+
updatedAt: text("updated_at").notNull().default(sql20`(datetime('now'))`)
|
|
28867
29010
|
},
|
|
28868
29011
|
(table) => [
|
|
28869
29012
|
index("idx_tasks_pull_requests_pr_number").on(table.prNumber),
|
|
@@ -28903,7 +29046,7 @@ var init_provenance_rest = __esm({
|
|
|
28903
29046
|
/** Relationship classification — E10 §5b CHECK-backed via {@link PR_LINK_KINDS}. */
|
|
28904
29047
|
linkKind: text("link_kind", { enum: PR_LINK_KINDS }).notNull(),
|
|
28905
29048
|
/** ISO-8601 UTC creation instant (canonical TEXT, §4). */
|
|
28906
|
-
createdAt: text("created_at").notNull().default(
|
|
29049
|
+
createdAt: text("created_at").notNull().default(sql20`(datetime('now'))`)
|
|
28907
29050
|
},
|
|
28908
29051
|
(table) => [
|
|
28909
29052
|
primaryKey({ columns: [table.prId, table.taskId, table.linkKind] }),
|
|
@@ -28938,7 +29081,7 @@ var init_provenance_rest = __esm({
|
|
|
28938
29081
|
/** GitHub Actions workflow run URL. */
|
|
28939
29082
|
workflowRunUrl: text("workflow_run_url"),
|
|
28940
29083
|
/** ISO-8601 UTC creation instant (canonical TEXT, §4). */
|
|
28941
|
-
createdAt: text("created_at").notNull().default(
|
|
29084
|
+
createdAt: text("created_at").notNull().default(sql20`(datetime('now'))`),
|
|
28942
29085
|
/** ISO-8601 UTC planned instant (canonical TEXT, §4). */
|
|
28943
29086
|
plannedAt: text("planned_at"),
|
|
28944
29087
|
/** ISO-8601 UTC PR-opened instant (canonical TEXT, §4). */
|
|
@@ -29032,7 +29175,7 @@ var init_provenance_rest = __esm({
|
|
|
29032
29175
|
/** Classification provenance — CHECK-backed via {@link RELEASE_CLASSIFIED_BY}. */
|
|
29033
29176
|
classifiedBy: text("classified_by", { enum: RELEASE_CLASSIFIED_BY }).notNull().default("auto"),
|
|
29034
29177
|
/** ISO-8601 UTC classification instant (canonical TEXT, §4). */
|
|
29035
|
-
classifiedAt: text("classified_at").notNull().default(
|
|
29178
|
+
classifiedAt: text("classified_at").notNull().default(sql20`(datetime('now'))`)
|
|
29036
29179
|
},
|
|
29037
29180
|
(table) => [
|
|
29038
29181
|
index("idx_tasks_release_changes_release_id").on(table.releaseId),
|
|
@@ -29063,7 +29206,7 @@ var init_provenance_rest = __esm({
|
|
|
29063
29206
|
/** Breaking-change migration note. */
|
|
29064
29207
|
breaking: text("breaking"),
|
|
29065
29208
|
/** ISO-8601 UTC creation instant (canonical TEXT, §4). */
|
|
29066
|
-
createdAt: text("created_at").notNull().default(
|
|
29209
|
+
createdAt: text("created_at").notNull().default(sql20`(datetime('now'))`)
|
|
29067
29210
|
},
|
|
29068
29211
|
(table) => [
|
|
29069
29212
|
index("idx_tasks_release_changesets_release_id").on(table.releaseId),
|
|
@@ -29100,7 +29243,7 @@ var init_provenance_rest = __esm({
|
|
|
29100
29243
|
});
|
|
29101
29244
|
|
|
29102
29245
|
// packages/core/src/store/schema/agent-schema.ts
|
|
29103
|
-
import { sql as
|
|
29246
|
+
import { sql as sql21 } from "drizzle-orm";
|
|
29104
29247
|
var AGENT_INSTANCE_STATUSES2, AGENT_TYPES2, agentInstances, agentErrorLog;
|
|
29105
29248
|
var init_agent_schema = __esm({
|
|
29106
29249
|
"packages/core/src/store/schema/agent-schema.ts"() {
|
|
@@ -29137,8 +29280,8 @@ var init_agent_schema = __esm({
|
|
|
29137
29280
|
// cross-db-annotation-ok: intra-DB FK to tasks.sessions.id (no .references() because the row may pre-date the session being created)
|
|
29138
29281
|
taskId: text("task_id"),
|
|
29139
29282
|
// cross-db-annotation-ok: intra-DB FK to tasks.tasks.id (no .references() because agent may not be bound to any task)
|
|
29140
|
-
startedAt: text("started_at").notNull().default(
|
|
29141
|
-
lastHeartbeat: text("last_heartbeat").notNull().default(
|
|
29283
|
+
startedAt: text("started_at").notNull().default(sql21`(datetime('now'))`),
|
|
29284
|
+
lastHeartbeat: text("last_heartbeat").notNull().default(sql21`(datetime('now'))`),
|
|
29142
29285
|
stoppedAt: text("stopped_at"),
|
|
29143
29286
|
errorCount: integer("error_count").notNull().default(0),
|
|
29144
29287
|
totalTasksCompleted: integer("total_tasks_completed").notNull().default(0),
|
|
@@ -29167,7 +29310,7 @@ var init_agent_schema = __esm({
|
|
|
29167
29310
|
}).notNull(),
|
|
29168
29311
|
message: text("message").notNull(),
|
|
29169
29312
|
stack: text("stack"),
|
|
29170
|
-
occurredAt: text("occurred_at").notNull().default(
|
|
29313
|
+
occurredAt: text("occurred_at").notNull().default(sql21`(datetime('now'))`),
|
|
29171
29314
|
resolved: integer("resolved", { mode: "boolean" }).notNull().default(false)
|
|
29172
29315
|
},
|
|
29173
29316
|
(table) => [
|
|
@@ -29180,7 +29323,7 @@ var init_agent_schema = __esm({
|
|
|
29180
29323
|
});
|
|
29181
29324
|
|
|
29182
29325
|
// packages/core/src/store/schema/chain-schema.ts
|
|
29183
|
-
import { sql as
|
|
29326
|
+
import { sql as sql22 } from "drizzle-orm";
|
|
29184
29327
|
var WARP_CHAIN_INSTANCE_STATUSES, warpChains, warpChainInstances;
|
|
29185
29328
|
var init_chain_schema = __esm({
|
|
29186
29329
|
"packages/core/src/store/schema/chain-schema.ts"() {
|
|
@@ -29203,8 +29346,8 @@ var init_chain_schema = __esm({
|
|
|
29203
29346
|
definition: text("definition").notNull(),
|
|
29204
29347
|
// JSON-serialized WarpChain
|
|
29205
29348
|
validated: integer("validated", { mode: "boolean" }).default(false),
|
|
29206
|
-
createdAt: text("created_at").default(
|
|
29207
|
-
updatedAt: text("updated_at").default(
|
|
29349
|
+
createdAt: text("created_at").default(sql22`(datetime('now'))`),
|
|
29350
|
+
updatedAt: text("updated_at").default(sql22`(datetime('now'))`)
|
|
29208
29351
|
},
|
|
29209
29352
|
(table) => [index("idx_warp_chains_name").on(table.name)]
|
|
29210
29353
|
);
|
|
@@ -29222,8 +29365,8 @@ var init_chain_schema = __esm({
|
|
|
29222
29365
|
currentStage: text("current_stage"),
|
|
29223
29366
|
gateResults: text("gate_results"),
|
|
29224
29367
|
// JSON array of GateResult
|
|
29225
|
-
createdAt: text("created_at").default(
|
|
29226
|
-
updatedAt: text("updated_at").default(
|
|
29368
|
+
createdAt: text("created_at").default(sql22`(datetime('now'))`),
|
|
29369
|
+
updatedAt: text("updated_at").default(sql22`(datetime('now'))`)
|
|
29227
29370
|
},
|
|
29228
29371
|
(table) => [
|
|
29229
29372
|
index("idx_warp_instances_chain").on(table.chainId),
|
|
@@ -29235,7 +29378,7 @@ var init_chain_schema = __esm({
|
|
|
29235
29378
|
});
|
|
29236
29379
|
|
|
29237
29380
|
// packages/core/src/store/schema/cleo-project/runtime.ts
|
|
29238
|
-
import { sql as
|
|
29381
|
+
import { sql as sql23 } from "drizzle-orm";
|
|
29239
29382
|
var AGENT_ERROR_TYPES, PLAYBOOK_RUN_STATUSES, PLAYBOOK_APPROVAL_STATUSES, tasksWarpChains, tasksWarpChainInstances, tasksAgentInstances, tasksAgentErrorLog, tasksPlaybookRuns, tasksPlaybookApprovals;
|
|
29240
29383
|
var init_runtime = __esm({
|
|
29241
29384
|
"packages/core/src/store/schema/cleo-project/runtime.ts"() {
|
|
@@ -29272,9 +29415,9 @@ var init_runtime = __esm({
|
|
|
29272
29415
|
/** Whether the definition validated. §3a boolean — already typed, preserved. */
|
|
29273
29416
|
validated: integer("validated", { mode: "boolean" }).default(false),
|
|
29274
29417
|
/** ISO-8601 UTC creation instant (canonical TEXT, §4). */
|
|
29275
|
-
createdAt: text("created_at").default(
|
|
29418
|
+
createdAt: text("created_at").default(sql23`(datetime('now'))`),
|
|
29276
29419
|
/** ISO-8601 UTC last-update instant (canonical TEXT, §4). */
|
|
29277
|
-
updatedAt: text("updated_at").default(
|
|
29420
|
+
updatedAt: text("updated_at").default(sql23`(datetime('now'))`)
|
|
29278
29421
|
},
|
|
29279
29422
|
(table) => [index("idx_tasks_warp_chains_name").on(table.name)]
|
|
29280
29423
|
);
|
|
@@ -29298,9 +29441,9 @@ var init_runtime = __esm({
|
|
|
29298
29441
|
/** JSON array of gate results (TEXT per JSON audit). */
|
|
29299
29442
|
gateResults: text("gate_results"),
|
|
29300
29443
|
/** ISO-8601 UTC creation instant (canonical TEXT, §4). */
|
|
29301
|
-
createdAt: text("created_at").default(
|
|
29444
|
+
createdAt: text("created_at").default(sql23`(datetime('now'))`),
|
|
29302
29445
|
/** ISO-8601 UTC last-update instant (canonical TEXT, §4). */
|
|
29303
|
-
updatedAt: text("updated_at").default(
|
|
29446
|
+
updatedAt: text("updated_at").default(sql23`(datetime('now'))`)
|
|
29304
29447
|
},
|
|
29305
29448
|
(table) => [
|
|
29306
29449
|
index("idx_tasks_warp_chain_instances_chain").on(table.chainId),
|
|
@@ -29322,9 +29465,9 @@ var init_runtime = __esm({
|
|
|
29322
29465
|
/** Intra-DB soft ref → `tasks_tasks.id`. */
|
|
29323
29466
|
taskId: text("task_id"),
|
|
29324
29467
|
/** ISO-8601 UTC start instant (canonical TEXT, §4). */
|
|
29325
|
-
startedAt: text("started_at").notNull().default(
|
|
29468
|
+
startedAt: text("started_at").notNull().default(sql23`(datetime('now'))`),
|
|
29326
29469
|
/** ISO-8601 UTC last-heartbeat instant (canonical TEXT, §4). */
|
|
29327
|
-
lastHeartbeat: text("last_heartbeat").notNull().default(
|
|
29470
|
+
lastHeartbeat: text("last_heartbeat").notNull().default(sql23`(datetime('now'))`),
|
|
29328
29471
|
/** ISO-8601 UTC stop instant (canonical TEXT, §4). */
|
|
29329
29472
|
stoppedAt: text("stopped_at"),
|
|
29330
29473
|
/** Error count. */
|
|
@@ -29361,7 +29504,7 @@ var init_runtime = __esm({
|
|
|
29361
29504
|
/** Optional stack trace. */
|
|
29362
29505
|
stack: text("stack"),
|
|
29363
29506
|
/** ISO-8601 UTC occurrence instant (canonical TEXT, §4). */
|
|
29364
|
-
occurredAt: text("occurred_at").notNull().default(
|
|
29507
|
+
occurredAt: text("occurred_at").notNull().default(sql23`(datetime('now'))`),
|
|
29365
29508
|
/** Whether the error was resolved. §3a boolean — already typed, preserved. */
|
|
29366
29509
|
resolved: integer("resolved", { mode: "boolean" }).notNull().default(false)
|
|
29367
29510
|
},
|
|
@@ -29393,7 +29536,7 @@ var init_runtime = __esm({
|
|
|
29393
29536
|
/** Optional session id (cross-table soft ref → `tasks_sessions.id`). */
|
|
29394
29537
|
sessionId: text("session_id"),
|
|
29395
29538
|
/** ISO-8601 UTC start instant (canonical TEXT, §4). */
|
|
29396
|
-
startedAt: text("started_at").notNull().default(
|
|
29539
|
+
startedAt: text("started_at").notNull().default(sql23`(datetime('now'))`),
|
|
29397
29540
|
/** ISO-8601 UTC completion instant (canonical TEXT, §4). */
|
|
29398
29541
|
completedAt: text("completed_at")
|
|
29399
29542
|
});
|
|
@@ -29407,7 +29550,7 @@ var init_runtime = __esm({
|
|
|
29407
29550
|
/** HMAC resume token (unique). */
|
|
29408
29551
|
token: text("token").notNull().unique(),
|
|
29409
29552
|
/** ISO-8601 UTC request instant (canonical TEXT, §4). */
|
|
29410
|
-
requestedAt: text("requested_at").notNull().default(
|
|
29553
|
+
requestedAt: text("requested_at").notNull().default(sql23`(datetime('now'))`),
|
|
29411
29554
|
/** ISO-8601 UTC approval instant (canonical TEXT, §4). */
|
|
29412
29555
|
approvedAt: text("approved_at"),
|
|
29413
29556
|
/** Approver identity. */
|
|
@@ -29431,7 +29574,7 @@ import {
|
|
|
29431
29574
|
TASK_SEVERITIES as TASK_SEVERITIES3,
|
|
29432
29575
|
TASK_SIZES as TASK_SIZES3
|
|
29433
29576
|
} from "@cleocode/contracts/enums";
|
|
29434
|
-
import { sql as
|
|
29577
|
+
import { sql as sql24 } from "drizzle-orm";
|
|
29435
29578
|
var TASK_AC_KINDS, tasksTasks, tasksTaskAcceptanceCriteria, tasksAcceptanceProjectionState, tasksAcceptanceProjectionDirty, tasksTaskDependencies, tasksTaskRelations, tasksSessions, tasksSessionHandoffEntries, tasksTaskWorkHistory, tasksTaskAcceptanceCriteriaHistory, tasksExternalTaskLinks;
|
|
29436
29579
|
var init_tasks_core = __esm({
|
|
29437
29580
|
"packages/core/src/store/schema/cleo-project/tasks-core.ts"() {
|
|
@@ -29490,7 +29633,7 @@ var init_tasks_core = __esm({
|
|
|
29490
29633
|
/** Whether auto-complete is suppressed. §3a boolean — already typed, preserved. */
|
|
29491
29634
|
noAutoComplete: integer("no_auto_complete", { mode: "boolean" }),
|
|
29492
29635
|
/** ISO-8601 UTC creation instant (canonical TEXT, §4). */
|
|
29493
|
-
createdAt: text("created_at").notNull().default(
|
|
29636
|
+
createdAt: text("created_at").notNull().default(sql24`(datetime('now'))`),
|
|
29494
29637
|
/** ISO-8601 UTC last-update instant (canonical TEXT, §4). */
|
|
29495
29638
|
updatedAt: text("updated_at"),
|
|
29496
29639
|
/** ISO-8601 UTC completion instant (canonical TEXT, §4). */
|
|
@@ -29546,7 +29689,7 @@ var init_tasks_core = __esm({
|
|
|
29546
29689
|
index("idx_tasks_tasks_role").on(table.kind),
|
|
29547
29690
|
index("idx_tasks_tasks_scope").on(table.scope),
|
|
29548
29691
|
index("idx_tasks_tasks_role_status").on(table.kind, table.status),
|
|
29549
|
-
index("idx_tasks_tasks_created_date").on(
|
|
29692
|
+
index("idx_tasks_tasks_created_date").on(sql24`date(${table.createdAt})`),
|
|
29550
29693
|
unique("uq_tasks_tasks_idempotency_key").on(table.idempotencyKey)
|
|
29551
29694
|
]
|
|
29552
29695
|
);
|
|
@@ -29572,7 +29715,7 @@ var init_tasks_core = __esm({
|
|
|
29572
29715
|
/** The AC statement. */
|
|
29573
29716
|
text: text("text").notNull(),
|
|
29574
29717
|
/** ISO-8601 UTC creation instant (canonical TEXT, §4). */
|
|
29575
|
-
createdAt: text("created_at").notNull().default(
|
|
29718
|
+
createdAt: text("created_at").notNull().default(sql24`(CURRENT_TIMESTAMP)`),
|
|
29576
29719
|
/** ISO-8601 UTC last-edit instant (canonical TEXT, §4). */
|
|
29577
29720
|
updatedAt: text("updated_at"),
|
|
29578
29721
|
/** Optional sha256(text) drift snapshot. */
|
|
@@ -29601,7 +29744,7 @@ var init_tasks_core = __esm({
|
|
|
29601
29744
|
/** Source frontier fingerprint. */
|
|
29602
29745
|
sourceFingerprint: text("source_fingerprint"),
|
|
29603
29746
|
/** ISO-8601 UTC creation instant (canonical TEXT, §4). */
|
|
29604
|
-
createdAt: text("created_at").notNull().default(
|
|
29747
|
+
createdAt: text("created_at").notNull().default(sql24`(CURRENT_TIMESTAMP)`),
|
|
29605
29748
|
/** ISO-8601 UTC last-update instant (canonical TEXT, §4). */
|
|
29606
29749
|
updatedAt: text("updated_at")
|
|
29607
29750
|
},
|
|
@@ -29625,7 +29768,7 @@ var init_tasks_core = __esm({
|
|
|
29625
29768
|
/** ISO-8601 UTC source-update that triggered this (canonical TEXT, §4). */
|
|
29626
29769
|
sourceUpdatedAt: text("source_updated_at"),
|
|
29627
29770
|
/** ISO-8601 UTC queue-insertion instant (canonical TEXT, §4). */
|
|
29628
|
-
queuedAt: text("queued_at").notNull().default(
|
|
29771
|
+
queuedAt: text("queued_at").notNull().default(sql24`(CURRENT_TIMESTAMP)`),
|
|
29629
29772
|
/** JSON producer context (TEXT per JSON audit). */
|
|
29630
29773
|
payloadJson: text("payload_json")
|
|
29631
29774
|
},
|
|
@@ -29698,7 +29841,7 @@ var init_tasks_core = __esm({
|
|
|
29698
29841
|
/** JSON handoff payload (TEXT per JSON audit). */
|
|
29699
29842
|
handoffJson: text("handoff_json"),
|
|
29700
29843
|
/** ISO-8601 UTC start instant (canonical TEXT, §4). */
|
|
29701
|
-
startedAt: text("started_at").notNull().default(
|
|
29844
|
+
startedAt: text("started_at").notNull().default(sql24`(datetime('now'))`),
|
|
29702
29845
|
/** ISO-8601 UTC end instant (canonical TEXT, §4). */
|
|
29703
29846
|
endedAt: text("ended_at"),
|
|
29704
29847
|
/** Previous session pointer (self-FK). */
|
|
@@ -29760,7 +29903,7 @@ var init_tasks_core = __esm({
|
|
|
29760
29903
|
/** Serialised handoff/debrief JSON (TEXT per JSON audit). */
|
|
29761
29904
|
handoffJson: text("handoff_json").notNull(),
|
|
29762
29905
|
/** ISO-8601 UTC creation instant (canonical TEXT, §4). */
|
|
29763
|
-
createdAt: text("created_at").notNull().default(
|
|
29906
|
+
createdAt: text("created_at").notNull().default(sql24`(datetime('now'))`)
|
|
29764
29907
|
},
|
|
29765
29908
|
(table) => [index("idx_tasks_session_handoff_entries_session_id").on(table.sessionId)]
|
|
29766
29909
|
);
|
|
@@ -29774,7 +29917,7 @@ var init_tasks_core = __esm({
|
|
|
29774
29917
|
/** FK → `tasks_tasks.id`. ON DELETE CASCADE. */
|
|
29775
29918
|
taskId: text("task_id").notNull().references(() => tasksTasks.id, { onDelete: "cascade" }),
|
|
29776
29919
|
/** ISO-8601 UTC set instant (canonical TEXT, §4). */
|
|
29777
|
-
setAt: text("set_at").notNull().default(
|
|
29920
|
+
setAt: text("set_at").notNull().default(sql24`(datetime('now'))`),
|
|
29778
29921
|
/** ISO-8601 UTC cleared instant (canonical TEXT, §4). */
|
|
29779
29922
|
clearedAt: text("cleared_at")
|
|
29780
29923
|
},
|
|
@@ -29788,7 +29931,7 @@ var init_tasks_core = __esm({
|
|
|
29788
29931
|
/** AC id this row records (NOT an FK — survives AC deletion). */
|
|
29789
29932
|
acId: text("ac_id").notNull(),
|
|
29790
29933
|
/** ISO-8601 UTC record instant (canonical TEXT, §4). */
|
|
29791
|
-
recordedAt: text("recorded_at").notNull().default(
|
|
29934
|
+
recordedAt: text("recorded_at").notNull().default(sql24`(datetime('now'))`),
|
|
29792
29935
|
/** AC text BEFORE this change. */
|
|
29793
29936
|
previousText: text("previous_text").notNull(),
|
|
29794
29937
|
/**
|
|
@@ -29802,7 +29945,7 @@ var init_tasks_core = __esm({
|
|
|
29802
29945
|
(table) => [
|
|
29803
29946
|
index("idx_tasks_task_acceptance_criteria_history_ac_id_recorded_at").on(
|
|
29804
29947
|
table.acId,
|
|
29805
|
-
|
|
29948
|
+
sql24`${table.recordedAt} desc`
|
|
29806
29949
|
)
|
|
29807
29950
|
]
|
|
29808
29951
|
);
|
|
@@ -29828,7 +29971,7 @@ var init_tasks_core = __esm({
|
|
|
29828
29971
|
/** JSON provider metadata (TEXT per JSON audit; empty-object default). */
|
|
29829
29972
|
metadataJson: text("metadata_json").default("{}"),
|
|
29830
29973
|
/** ISO-8601 UTC link-creation instant (canonical TEXT, §4). */
|
|
29831
|
-
linkedAt: text("linked_at").notNull().default(
|
|
29974
|
+
linkedAt: text("linked_at").notNull().default(sql24`(datetime('now'))`),
|
|
29832
29975
|
/** ISO-8601 UTC last-sync instant (canonical TEXT, §4). */
|
|
29833
29976
|
lastSyncAt: text("last_sync_at")
|
|
29834
29977
|
},
|
|
@@ -29895,7 +30038,7 @@ var init_background_jobs = __esm({
|
|
|
29895
30038
|
});
|
|
29896
30039
|
|
|
29897
30040
|
// packages/core/src/store/schema/evidence-bindings.ts
|
|
29898
|
-
import { sql as
|
|
30041
|
+
import { sql as sql25 } from "drizzle-orm";
|
|
29899
30042
|
var EVIDENCE_BINDING_TYPES, evidenceAcBindings;
|
|
29900
30043
|
var init_evidence_bindings = __esm({
|
|
29901
30044
|
"packages/core/src/store/schema/evidence-bindings.ts"() {
|
|
@@ -29920,7 +30063,7 @@ var init_evidence_bindings = __esm({
|
|
|
29920
30063
|
enum: EVIDENCE_BINDING_TYPES
|
|
29921
30064
|
}).notNull(),
|
|
29922
30065
|
/** ISO-8601 timestamp of binding creation. */
|
|
29923
|
-
createdAt: text("created_at").notNull().default(
|
|
30066
|
+
createdAt: text("created_at").notNull().default(sql25`(datetime('now'))`)
|
|
29924
30067
|
},
|
|
29925
30068
|
(table) => [
|
|
29926
30069
|
// One binding per atom/ac/type triple — idempotent re-inserts collapse.
|
|
@@ -29939,7 +30082,7 @@ var init_evidence_bindings = __esm({
|
|
|
29939
30082
|
});
|
|
29940
30083
|
|
|
29941
30084
|
// packages/core/src/store/schema/cleo-project/tasks-core-batch2.ts
|
|
29942
|
-
import { sql as
|
|
30085
|
+
import { sql as sql26 } from "drizzle-orm";
|
|
29943
30086
|
var tasksBackgroundJobs, tasksExperiments, tasksEvidenceAcBindings, tasksTaskLabels;
|
|
29944
30087
|
var init_tasks_core_batch2 = __esm({
|
|
29945
30088
|
"packages/core/src/store/schema/cleo-project/tasks-core-batch2.ts"() {
|
|
@@ -29957,7 +30100,7 @@ var init_tasks_core_batch2 = __esm({
|
|
|
29957
30100
|
/** Current lifecycle status — CHECK-backed via {@link BACKGROUND_JOB_STATUSES}. */
|
|
29958
30101
|
status: text("status", { enum: BACKGROUND_JOB_STATUSES }).notNull().default("pending"),
|
|
29959
30102
|
/** ISO-8601 UTC creation instant (was ms epoch, §4 / §8.1). */
|
|
29960
|
-
startedAt: text("started_at").notNull().default(
|
|
30103
|
+
startedAt: text("started_at").notNull().default(sql26`(datetime('now'))`),
|
|
29961
30104
|
/** ISO-8601 UTC completion instant; NULL while running (was ms epoch, §4). */
|
|
29962
30105
|
completedAt: text("completed_at"),
|
|
29963
30106
|
/** JSON-serialised result payload; NULL on failure or while running (TEXT). */
|
|
@@ -29967,7 +30110,7 @@ var init_tasks_core_batch2 = __esm({
|
|
|
29967
30110
|
/** Execution progress 0-100; NULL until progress is reported. */
|
|
29968
30111
|
progress: integer("progress"),
|
|
29969
30112
|
/** ISO-8601 UTC last-heartbeat instant (was ms epoch, §4 / §8.1). */
|
|
29970
|
-
heartbeatAt: text("heartbeat_at").notNull().default(
|
|
30113
|
+
heartbeatAt: text("heartbeat_at").notNull().default(sql26`(datetime('now'))`),
|
|
29971
30114
|
/** Agent or session ID that claimed this job; NULL if unclaimed. */
|
|
29972
30115
|
claimedBy: text("claimed_by"),
|
|
29973
30116
|
/**
|
|
@@ -30019,7 +30162,7 @@ var init_tasks_core_batch2 = __esm({
|
|
|
30019
30162
|
/** One of {direct, satisfies, coverage} — CHECK-backed via {@link EVIDENCE_BINDING_TYPES}. */
|
|
30020
30163
|
bindingType: text("binding_type", { enum: EVIDENCE_BINDING_TYPES }).notNull(),
|
|
30021
30164
|
/** ISO-8601 UTC binding-creation instant (already canonical TEXT, §4). */
|
|
30022
|
-
createdAt: text("created_at").notNull().default(
|
|
30165
|
+
createdAt: text("created_at").notNull().default(sql26`(datetime('now'))`)
|
|
30023
30166
|
},
|
|
30024
30167
|
(table) => [
|
|
30025
30168
|
uniqueIndex("uq_tasks_evidence_ac_bindings_atom_ac_type").on(
|
|
@@ -30205,7 +30348,7 @@ __export(agent_registry_exports, {
|
|
|
30205
30348
|
agentRegistryUsers: () => agentRegistryUsers,
|
|
30206
30349
|
agentRegistryVerifications: () => agentRegistryVerifications
|
|
30207
30350
|
});
|
|
30208
|
-
import { sql as
|
|
30351
|
+
import { sql as sql27 } from "drizzle-orm";
|
|
30209
30352
|
var AGENT_REGISTRY_USER_ROLES, AGENT_REGISTRY_AGENT_STATUSES, agentRegistryUsers, agentRegistryOrganization, agentRegistryAgents, agentRegistryClaimCodes, agentRegistryCapabilities, agentRegistrySkills, agentRegistryAgentCapabilities, agentRegistryAgentSkills, agentRegistryAgentConnections, agentRegistryAccounts, agentRegistrySessions, agentRegistryVerifications, agentRegistryOrgAgentKeys;
|
|
30210
30353
|
var init_agent_registry = __esm({
|
|
30211
30354
|
"packages/core/src/store/schema/cleo-global/agent-registry.ts"() {
|
|
@@ -30271,9 +30414,9 @@ var init_agent_registry = __esm({
|
|
|
30271
30414
|
/** Owner user id (soft FK → agent_registry_users.id). */
|
|
30272
30415
|
ownerId: text("owner_id"),
|
|
30273
30416
|
/** ISO-8601 UTC creation instant (E10 §4: epoch → TEXT ISO8601). */
|
|
30274
|
-
createdAt: text("created_at").notNull().default(
|
|
30417
|
+
createdAt: text("created_at").notNull().default(sql27`(datetime('now'))`),
|
|
30275
30418
|
/** ISO-8601 UTC last-update instant (E10 §4: epoch → TEXT ISO8601). */
|
|
30276
|
-
updatedAt: text("updated_at").notNull().default(
|
|
30419
|
+
updatedAt: text("updated_at").notNull().default(sql27`(datetime('now'))`)
|
|
30277
30420
|
},
|
|
30278
30421
|
(table) => [index("idx_agent_registry_organization_slug").on(table.slug)]
|
|
30279
30422
|
);
|
|
@@ -30446,7 +30589,7 @@ var init_agent_registry = __esm({
|
|
|
30446
30589
|
/** Skill-attachment provenance (cant / manual / computed). */
|
|
30447
30590
|
source: text("source").notNull().default("manual"),
|
|
30448
30591
|
/** ISO-8601 UTC attachment instant (already canonical TEXT, §4). */
|
|
30449
|
-
attachedAt: text("attached_at").notNull().default(
|
|
30592
|
+
attachedAt: text("attached_at").notNull().default(sql27`(datetime('now'))`)
|
|
30450
30593
|
},
|
|
30451
30594
|
(table) => [
|
|
30452
30595
|
primaryKey({ columns: [table.agentId, table.skillId] }),
|
|
@@ -30584,7 +30727,7 @@ var init_agent_registry = __esm({
|
|
|
30584
30727
|
});
|
|
30585
30728
|
|
|
30586
30729
|
// packages/core/src/store/schema/cleo-global/nexus.ts
|
|
30587
|
-
import { sql as
|
|
30730
|
+
import { sql as sql28 } from "drizzle-orm";
|
|
30588
30731
|
var SIGIL_ROLES, nexusProjectRegistry, nexusProjectIdAliases, nexusAuditLog, nexusSchemaMeta, nexusUserProfile, nexusSigils;
|
|
30589
30732
|
var init_nexus2 = __esm({
|
|
30590
30733
|
"packages/core/src/store/schema/cleo-global/nexus.ts"() {
|
|
@@ -30612,9 +30755,9 @@ var init_nexus2 = __esm({
|
|
|
30612
30755
|
/** Human-readable project name. */
|
|
30613
30756
|
name: text("name").notNull(),
|
|
30614
30757
|
/** ISO-8601 UTC registration instant (canonical TEXT, §4). */
|
|
30615
|
-
registeredAt: text("registered_at").notNull().default(
|
|
30758
|
+
registeredAt: text("registered_at").notNull().default(sql28`(datetime('now'))`),
|
|
30616
30759
|
/** ISO-8601 UTC last-seen instant (canonical TEXT, §4). */
|
|
30617
|
-
lastSeen: text("last_seen").notNull().default(
|
|
30760
|
+
lastSeen: text("last_seen").notNull().default(sql28`(datetime('now'))`),
|
|
30618
30761
|
/** Health status string (e.g. "healthy", "warning", "unknown"). */
|
|
30619
30762
|
healthStatus: text("health_status").notNull().default("unknown"),
|
|
30620
30763
|
/** ISO-8601 UTC last health-check instant; NULL until first check. */
|
|
@@ -30622,7 +30765,7 @@ var init_nexus2 = __esm({
|
|
|
30622
30765
|
/** Permission level ("read" / "write"). */
|
|
30623
30766
|
permissions: text("permissions").notNull().default("read"),
|
|
30624
30767
|
/** ISO-8601 UTC last-sync instant (canonical TEXT, §4). */
|
|
30625
|
-
lastSync: text("last_sync").notNull().default(
|
|
30768
|
+
lastSync: text("last_sync").notNull().default(sql28`(datetime('now'))`),
|
|
30626
30769
|
/** Cached task count for the project. */
|
|
30627
30770
|
taskCount: integer("task_count").notNull().default(0),
|
|
30628
30771
|
/** JSON array of project labels (serialized TEXT per JSON-Column Audit). */
|
|
@@ -30651,7 +30794,7 @@ var init_nexus2 = __esm({
|
|
|
30651
30794
|
/** Canonical 12-hex-char ID this alias maps to (soft FK → nexus_project_registry). */
|
|
30652
30795
|
canonicalId: text("canonical_id").notNull(),
|
|
30653
30796
|
/** ISO-8601 UTC creation instant (canonical TEXT, §4). */
|
|
30654
|
-
createdAt: text("created_at").notNull().default(
|
|
30797
|
+
createdAt: text("created_at").notNull().default(sql28`(datetime('now'))`)
|
|
30655
30798
|
},
|
|
30656
30799
|
(table) => [index("idx_nexus_project_id_aliases_canonical").on(table.canonicalId)]
|
|
30657
30800
|
);
|
|
@@ -30661,7 +30804,7 @@ var init_nexus2 = __esm({
|
|
|
30661
30804
|
/** UUID primary key. */
|
|
30662
30805
|
id: text("id").primaryKey(),
|
|
30663
30806
|
/** ISO-8601 UTC instant of the audited operation (canonical TEXT, §4). */
|
|
30664
|
-
timestamp: text("timestamp").notNull().default(
|
|
30807
|
+
timestamp: text("timestamp").notNull().default(sql28`(datetime('now'))`),
|
|
30665
30808
|
/** Audited action name. */
|
|
30666
30809
|
action: text("action").notNull(),
|
|
30667
30810
|
/** Project hash context; NULL for global operations. */
|
|
@@ -30756,9 +30899,9 @@ var init_nexus2 = __esm({
|
|
|
30756
30899
|
/** JSON-encoded capability flags object (serialized TEXT); NULL until set. */
|
|
30757
30900
|
capabilityFlags: text("capability_flags"),
|
|
30758
30901
|
/** ISO-8601 UTC creation instant (E10 §4: Drizzle-Date → TEXT ISO8601). */
|
|
30759
|
-
createdAt: text("created_at").notNull().default(
|
|
30902
|
+
createdAt: text("created_at").notNull().default(sql28`(datetime('now'))`),
|
|
30760
30903
|
/** ISO-8601 UTC last-update instant (E10 §4: Drizzle-Date → TEXT ISO8601). */
|
|
30761
|
-
updatedAt: text("updated_at").notNull().default(
|
|
30904
|
+
updatedAt: text("updated_at").notNull().default(sql28`(datetime('now'))`)
|
|
30762
30905
|
},
|
|
30763
30906
|
(table) => [
|
|
30764
30907
|
index("idx_nexus_sigils_display_name").on(table.displayName),
|
|
@@ -30769,7 +30912,7 @@ var init_nexus2 = __esm({
|
|
|
30769
30912
|
});
|
|
30770
30913
|
|
|
30771
30914
|
// packages/core/src/store/schema/cleo-global/skills.ts
|
|
30772
|
-
import { sql as
|
|
30915
|
+
import { sql as sql29 } from "drizzle-orm";
|
|
30773
30916
|
var SKILL_SOURCE_TYPES, SKILL_LIFECYCLE_STATES, SKILL_REVIEW_OUTCOMES, SKILL_PATCH_STATUSES, skillsSkills, skillsSkillUsage, skillsSkillReviews, skillsSkillPatches;
|
|
30774
30917
|
var init_skills2 = __esm({
|
|
30775
30918
|
"packages/core/src/store/schema/cleo-global/skills.ts"() {
|
|
@@ -30824,7 +30967,7 @@ var init_skills2 = __esm({
|
|
|
30824
30967
|
/** Logical FK to {@link skillsSkills}.name — denormalised for query speed. */
|
|
30825
30968
|
skillName: text("skill_name").notNull(),
|
|
30826
30969
|
/** ISO-8601 wall-clock timestamp of the load/invoke event (canonical TEXT, §4). */
|
|
30827
|
-
observedAt: text("observed_at").notNull().default(
|
|
30970
|
+
observedAt: text("observed_at").notNull().default(sql29`(datetime('now'))`),
|
|
30828
30971
|
/** Event kind — `load`, `invoke`, `error`, etc. */
|
|
30829
30972
|
eventKind: text("event_kind").notNull(),
|
|
30830
30973
|
/**
|
|
@@ -30864,7 +31007,7 @@ var init_skills2 = __esm({
|
|
|
30864
31007
|
/** Logical FK to {@link skillsSkills}.name. */
|
|
30865
31008
|
skillName: text("skill_name").notNull(),
|
|
30866
31009
|
/** ISO-8601 timestamp of the review (canonical TEXT, §4). */
|
|
30867
|
-
reviewedAt: text("reviewed_at").notNull().default(
|
|
31010
|
+
reviewedAt: text("reviewed_at").notNull().default(sql29`(datetime('now'))`),
|
|
30868
31011
|
/** Outcome verdict from {@link SKILL_REVIEW_OUTCOMES} (E10 §5a). */
|
|
30869
31012
|
outcome: text("outcome", { enum: SKILL_REVIEW_OUTCOMES }).notNull(),
|
|
30870
31013
|
/** Numeric grade (0-100); NULL if review was council-only. */
|
|
@@ -30887,7 +31030,7 @@ var init_skills2 = __esm({
|
|
|
30887
31030
|
/** Logical FK to {@link skillsSkills}.name. */
|
|
30888
31031
|
skillName: text("skill_name").notNull(),
|
|
30889
31032
|
/** ISO-8601 timestamp the patch was proposed (canonical TEXT, §4). */
|
|
30890
|
-
proposedAt: text("proposed_at").notNull().default(
|
|
31033
|
+
proposedAt: text("proposed_at").notNull().default(sql29`(datetime('now'))`),
|
|
30891
31034
|
/** ISO-8601 timestamp the patch was applied; NULL while proposed (canonical TEXT, §4). */
|
|
30892
31035
|
appliedAt: text("applied_at"),
|
|
30893
31036
|
/** Logical FK to {@link skillsSkillReviews}.id that gated this patch. */
|
|
@@ -30908,7 +31051,7 @@ var init_skills2 = __esm({
|
|
|
30908
31051
|
});
|
|
30909
31052
|
|
|
30910
31053
|
// packages/core/src/store/schema/cleo-global/telemetry.ts
|
|
30911
|
-
import { sql as
|
|
31054
|
+
import { sql as sql30 } from "drizzle-orm";
|
|
30912
31055
|
var telemetryEvents, telemetrySchemaMeta;
|
|
30913
31056
|
var init_telemetry = __esm({
|
|
30914
31057
|
"packages/core/src/store/schema/cleo-global/telemetry.ts"() {
|
|
@@ -30937,7 +31080,7 @@ var init_telemetry = __esm({
|
|
|
30937
31080
|
/** Machine-readable error code when exit_code != 0. NULL on success. */
|
|
30938
31081
|
errorCode: text("error_code"),
|
|
30939
31082
|
/** ISO-8601 UTC instant of the invocation (canonical TEXT timestamp, §4). */
|
|
30940
|
-
timestamp: text("timestamp").notNull().default(
|
|
31083
|
+
timestamp: text("timestamp").notNull().default(sql30`(datetime('now'))`)
|
|
30941
31084
|
},
|
|
30942
31085
|
(table) => [
|
|
30943
31086
|
index("idx_telemetry_command").on(table.command),
|
|
@@ -33806,12 +33949,16 @@ __export(exodus_exports, {
|
|
|
33806
33949
|
archiveStrandedResidue: () => archiveStrandedResidue,
|
|
33807
33950
|
buildExodusHealth: () => buildExodusHealth,
|
|
33808
33951
|
buildExodusPlan: () => buildExodusPlan,
|
|
33952
|
+
clearExodusAborts: () => clearExodusAborts,
|
|
33809
33953
|
clearExodusJournal: () => clearExodusJournal,
|
|
33810
33954
|
computeCountParity: () => computeCountParity,
|
|
33811
33955
|
deriveStagingDirName: () => deriveStagingDirName,
|
|
33812
33956
|
detectStrandedResidue: () => detectStrandedResidue,
|
|
33957
|
+
emitExodusAbort: () => emitExodusAbort,
|
|
33958
|
+
exodusAbortEvents: () => exodusAbortEvents,
|
|
33813
33959
|
exodusArchiveDir: () => exodusArchiveDir,
|
|
33814
33960
|
exodusMarkerPath: () => exodusMarkerPath,
|
|
33961
|
+
getRecordedExodusAbort: () => getRecordedExodusAbort,
|
|
33815
33962
|
hasExodusCompleteMarker: () => hasExodusCompleteMarker,
|
|
33816
33963
|
isDerivedOrInternalTable: () => isDerivedOrInternalTable,
|
|
33817
33964
|
resolveConsolidatedTableName: () => resolveConsolidatedTableName,
|
|
@@ -33827,6 +33974,7 @@ __export(exodus_exports, {
|
|
|
33827
33974
|
var init_exodus = __esm({
|
|
33828
33975
|
"packages/core/src/store/exodus/index.ts"() {
|
|
33829
33976
|
"use strict";
|
|
33977
|
+
init_abort_events();
|
|
33830
33978
|
init_archive2();
|
|
33831
33979
|
init_count_parity();
|
|
33832
33980
|
init_health2();
|
|
@@ -34084,7 +34232,9 @@ var init_on_open = __esm({
|
|
|
34084
34232
|
// packages/core/src/store/dual-scope-db.ts
|
|
34085
34233
|
var dual_scope_db_exports = {};
|
|
34086
34234
|
__export(dual_scope_db_exports, {
|
|
34235
|
+
ExodusAbortWriteUnsafeError: () => ExodusAbortWriteUnsafeError,
|
|
34087
34236
|
_resetDualScopeDbCache: () => _resetDualScopeDbCache,
|
|
34237
|
+
assertWriteDurable: () => assertWriteDurable,
|
|
34088
34238
|
insertIdempotent: () => insertIdempotent,
|
|
34089
34239
|
openDualScopeDb: () => openDualScopeDb,
|
|
34090
34240
|
openDualScopeDbAtPath: () => openDualScopeDbAtPath,
|
|
@@ -34094,6 +34244,17 @@ __export(dual_scope_db_exports, {
|
|
|
34094
34244
|
import { existsSync as existsSync14, mkdirSync as mkdirSync3 } from "node:fs";
|
|
34095
34245
|
import { createRequire as createRequire4 } from "node:module";
|
|
34096
34246
|
import { dirname as dirname5, join as join12 } from "node:path";
|
|
34247
|
+
function assertWriteDurable(handle) {
|
|
34248
|
+
if (handle.exodusAbort) {
|
|
34249
|
+
throw new ExodusAbortWriteUnsafeError(handle.exodusAbort);
|
|
34250
|
+
}
|
|
34251
|
+
}
|
|
34252
|
+
function assertNoRecordedExodusAbort() {
|
|
34253
|
+
const detail = getRecordedExodusAbort();
|
|
34254
|
+
if (detail) {
|
|
34255
|
+
throw new ExodusAbortWriteUnsafeError(detail);
|
|
34256
|
+
}
|
|
34257
|
+
}
|
|
34097
34258
|
function cacheKey(scope, dbPath) {
|
|
34098
34259
|
return `${scope}::${dbPath}`;
|
|
34099
34260
|
}
|
|
@@ -34233,13 +34394,25 @@ async function openDualScopeDbAtPath(scope, dbPath, exodusCwd, options) {
|
|
|
34233
34394
|
const { maybeRunExodusOnOpen: maybeRunExodusOnOpen2 } = await Promise.resolve().then(() => (init_on_open(), on_open_exports));
|
|
34234
34395
|
const result = await maybeRunExodusOnOpen2(scope, dbPath, nativeDb, exodusCwd);
|
|
34235
34396
|
if (result.outcome === "migrated" || result.outcome === "aborted") {
|
|
34397
|
+
const reopened = scope === "project" ? await openDualScopeDbAtPath("project", dbPath) : await openDualScopeDbAtPath("global", dbPath);
|
|
34236
34398
|
if (result.outcome === "aborted") {
|
|
34399
|
+
const abort = {
|
|
34400
|
+
scope,
|
|
34401
|
+
dbPath,
|
|
34402
|
+
reason: result.reason,
|
|
34403
|
+
at: Date.now()
|
|
34404
|
+
};
|
|
34237
34405
|
log10.warn(
|
|
34238
34406
|
{ scope, reason: result.reason },
|
|
34239
|
-
"exodus-on-open aborted; consolidated cleo.db left empty, legacy kept as source"
|
|
34407
|
+
"exodus-on-open aborted; consolidated cleo.db left empty, legacy kept as source \u2014 mutating callers must check handle.exodusAbort / call assertWriteDurable (T11828)"
|
|
34240
34408
|
);
|
|
34409
|
+
const { emitExodusAbort: emitExodusAbort2 } = await Promise.resolve().then(() => (init_abort_events(), abort_events_exports));
|
|
34410
|
+
emitExodusAbort2(abort);
|
|
34411
|
+
return { ...reopened, exodusAbort: abort };
|
|
34241
34412
|
}
|
|
34242
|
-
|
|
34413
|
+
const { clearExodusAborts: clearExodusAborts2 } = await Promise.resolve().then(() => (init_abort_events(), abort_events_exports));
|
|
34414
|
+
clearExodusAborts2(scope);
|
|
34415
|
+
return reopened;
|
|
34243
34416
|
}
|
|
34244
34417
|
} catch (err) {
|
|
34245
34418
|
log10.warn(
|
|
@@ -34277,10 +34450,12 @@ function _resetDualScopeDbCache(scope) {
|
|
|
34277
34450
|
}
|
|
34278
34451
|
}
|
|
34279
34452
|
async function insertIdempotent(db, table, row, _keyColumn) {
|
|
34453
|
+
assertNoRecordedExodusAbort();
|
|
34280
34454
|
const result = await db.insert(table).values(row).onConflictDoNothing().returning();
|
|
34281
34455
|
return result.length;
|
|
34282
34456
|
}
|
|
34283
34457
|
async function upsertIdempotent(db, table, row, _keyColumn, conflictTarget, set) {
|
|
34458
|
+
assertNoRecordedExodusAbort();
|
|
34284
34459
|
const updateSet = set ?? row;
|
|
34285
34460
|
const result = await db.insert(table).values(row).onConflictDoUpdate({
|
|
34286
34461
|
target: conflictTarget,
|
|
@@ -34289,15 +34464,35 @@ async function upsertIdempotent(db, table, row, _keyColumn, conflictTarget, set)
|
|
|
34289
34464
|
}).returning();
|
|
34290
34465
|
return result.length;
|
|
34291
34466
|
}
|
|
34292
|
-
var _cache, _require2, _drizzle, _DatabaseSyncCtor, _projectSchema, _globalSchema;
|
|
34467
|
+
var ExodusAbortWriteUnsafeError, _cache, _require2, _drizzle, _DatabaseSyncCtor, _projectSchema, _globalSchema;
|
|
34293
34468
|
var init_dual_scope_db = __esm({
|
|
34294
34469
|
"packages/core/src/store/dual-scope-db.ts"() {
|
|
34295
34470
|
"use strict";
|
|
34296
34471
|
init_logger2();
|
|
34297
34472
|
init_paths();
|
|
34473
|
+
init_abort_events();
|
|
34298
34474
|
init_migration_manager();
|
|
34299
34475
|
init_resolve_migrations_folder();
|
|
34300
34476
|
init_sqlite_pragmas();
|
|
34477
|
+
ExodusAbortWriteUnsafeError = class extends Error {
|
|
34478
|
+
/** Stable string error code for envelope `codeName` / log correlation. */
|
|
34479
|
+
codeName = "E_EXODUS_ABORT_WRITE_UNSAFE";
|
|
34480
|
+
/** The structured abort detail carried by the handle. */
|
|
34481
|
+
detail;
|
|
34482
|
+
/** Remediation hint surfaced to the operator. */
|
|
34483
|
+
fix;
|
|
34484
|
+
/**
|
|
34485
|
+
* @param detail - The {@link ExodusAbortDetail} stamped on the handle.
|
|
34486
|
+
*/
|
|
34487
|
+
constructor(detail) {
|
|
34488
|
+
super(
|
|
34489
|
+
`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.`
|
|
34490
|
+
);
|
|
34491
|
+
this.name = "ExodusAbortWriteUnsafeError";
|
|
34492
|
+
this.detail = detail;
|
|
34493
|
+
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.";
|
|
34494
|
+
}
|
|
34495
|
+
};
|
|
34301
34496
|
_cache = /* @__PURE__ */ new Map();
|
|
34302
34497
|
_require2 = createRequire4(import.meta.url);
|
|
34303
34498
|
_drizzle = null;
|
|
@@ -34325,7 +34520,7 @@ __export(nexus_schema_exports, {
|
|
|
34325
34520
|
sigils: () => sigils,
|
|
34326
34521
|
userProfile: () => userProfile
|
|
34327
34522
|
});
|
|
34328
|
-
import { sql as
|
|
34523
|
+
import { sql as sql31 } from "drizzle-orm";
|
|
34329
34524
|
var projectRegistry, projectIdAliases, nexusAuditLog2, nexusSchemaMeta2, NEXUS_NODE_KINDS2, nexusNodes2, NEXUS_RELATION_TYPES2, nexusRelations2, nexusRelationWeights2, NEXUS_CONTRACT_TYPES2, nexusContracts2, userProfile, SIGIL_ROLES2, sigils;
|
|
34330
34525
|
var init_nexus_schema = __esm({
|
|
34331
34526
|
"packages/core/src/store/schema/nexus-schema.ts"() {
|
|
@@ -34353,12 +34548,12 @@ var init_nexus_schema = __esm({
|
|
|
34353
34548
|
*/
|
|
34354
34549
|
projectPath: text("project_path").notNull().unique(),
|
|
34355
34550
|
name: text("name").notNull(),
|
|
34356
|
-
registeredAt: text("registered_at").notNull().default(
|
|
34357
|
-
lastSeen: text("last_seen").notNull().default(
|
|
34551
|
+
registeredAt: text("registered_at").notNull().default(sql31`(datetime('now'))`),
|
|
34552
|
+
lastSeen: text("last_seen").notNull().default(sql31`(datetime('now'))`),
|
|
34358
34553
|
healthStatus: text("health_status").notNull().default("unknown"),
|
|
34359
34554
|
healthLastCheck: text("health_last_check"),
|
|
34360
34555
|
permissions: text("permissions").notNull().default("read"),
|
|
34361
|
-
lastSync: text("last_sync").notNull().default(
|
|
34556
|
+
lastSync: text("last_sync").notNull().default(sql31`(datetime('now'))`),
|
|
34362
34557
|
taskCount: integer("task_count").notNull().default(0),
|
|
34363
34558
|
labelsJson: text("labels_json").notNull().default("[]"),
|
|
34364
34559
|
/**
|
|
@@ -34397,7 +34592,7 @@ var init_nexus_schema = __esm({
|
|
|
34397
34592
|
/** The canonical 12-hex-char ID this alias maps to. */
|
|
34398
34593
|
canonicalId: text("canonical_id").notNull(),
|
|
34399
34594
|
/** ISO 8601 timestamp when this alias was recorded. */
|
|
34400
|
-
createdAt: text("created_at").notNull().default(
|
|
34595
|
+
createdAt: text("created_at").notNull().default(sql31`(datetime('now'))`)
|
|
34401
34596
|
},
|
|
34402
34597
|
(table) => [index("idx_nexus_project_id_aliases_canonical").on(table.canonicalId)]
|
|
34403
34598
|
);
|
|
@@ -34405,7 +34600,7 @@ var init_nexus_schema = __esm({
|
|
|
34405
34600
|
"nexus_audit_log",
|
|
34406
34601
|
{
|
|
34407
34602
|
id: text("id").primaryKey(),
|
|
34408
|
-
timestamp: text("timestamp").notNull().default(
|
|
34603
|
+
timestamp: text("timestamp").notNull().default(sql31`(datetime('now'))`),
|
|
34409
34604
|
action: text("action").notNull(),
|
|
34410
34605
|
projectHash: text("project_hash"),
|
|
34411
34606
|
/** @cross-db nexus.project_registry.project_id — intra-DB soft FK (kept here for symmetry with the audit-log shape). */
|
|
@@ -34532,7 +34727,7 @@ var init_nexus_schema = __esm({
|
|
|
34532
34727
|
* an import specifier cannot be resolved to a local file. */
|
|
34533
34728
|
isExternal: integer("is_external", { mode: "boolean" }).notNull().default(false),
|
|
34534
34729
|
/** ISO 8601 timestamp when this node was last indexed. */
|
|
34535
|
-
indexedAt: text("indexed_at").notNull().default(
|
|
34730
|
+
indexedAt: text("indexed_at").notNull().default(sql31`(datetime('now'))`)
|
|
34536
34731
|
},
|
|
34537
34732
|
(table) => [
|
|
34538
34733
|
// `idx_nexus_nodes_project` + the two `project_id`-leading composite indexes
|
|
@@ -34615,7 +34810,7 @@ var init_nexus_schema = __esm({
|
|
|
34615
34810
|
/** Step index within an execution flow (for step_in_process relations). */
|
|
34616
34811
|
step: integer("step"),
|
|
34617
34812
|
/** ISO 8601 timestamp when this relation was last indexed. */
|
|
34618
|
-
indexedAt: text("indexed_at").notNull().default(
|
|
34813
|
+
indexedAt: text("indexed_at").notNull().default(sql31`(datetime('now'))`)
|
|
34619
34814
|
// T998 plasticity columns (`weight`, `last_accessed_at`, `co_accessed_count`)
|
|
34620
34815
|
// were PARTITIONED out into the sibling `nexus_relation_weights` table by
|
|
34621
34816
|
// T11545 (ADR-090 §5.3) to keep the read-mostly structural graph row narrow
|
|
@@ -34678,9 +34873,9 @@ var init_nexus_schema = __esm({
|
|
|
34678
34873
|
/** Human-readable description. */
|
|
34679
34874
|
description: text("description"),
|
|
34680
34875
|
/** ISO 8601 timestamp when contract was extracted. */
|
|
34681
|
-
createdAt: text("created_at").notNull().default(
|
|
34876
|
+
createdAt: text("created_at").notNull().default(sql31`(datetime('now'))`),
|
|
34682
34877
|
/** ISO 8601 timestamp of last update. */
|
|
34683
|
-
updatedAt: text("updated_at").notNull().default(
|
|
34878
|
+
updatedAt: text("updated_at").notNull().default(sql31`(datetime('now'))`)
|
|
34684
34879
|
},
|
|
34685
34880
|
(table) => [
|
|
34686
34881
|
// `idx_nexus_contracts_project` + `idx_nexus_contracts_project_type` DROPPED
|
|
@@ -36526,7 +36721,7 @@ var init_experiments = __esm({
|
|
|
36526
36721
|
});
|
|
36527
36722
|
|
|
36528
36723
|
// packages/core/src/store/schema/goal.ts
|
|
36529
|
-
import { sql as
|
|
36724
|
+
import { sql as sql32 } from "drizzle-orm";
|
|
36530
36725
|
var tasksGoal;
|
|
36531
36726
|
var init_goal2 = __esm({
|
|
36532
36727
|
"packages/core/src/store/schema/goal.ts"() {
|
|
@@ -36564,7 +36759,7 @@ var init_goal2 = __esm({
|
|
|
36564
36759
|
* Append-only acceptance criteria (JSONB array of strings). Appended via
|
|
36565
36760
|
* the store's `appendCriteria`; read whole via `json(col)`.
|
|
36566
36761
|
*/
|
|
36567
|
-
criteria: jsonb2("criteria").notNull().default(
|
|
36762
|
+
criteria: jsonb2("criteria").notNull().default(sql32`jsonb('[]')`),
|
|
36568
36763
|
/** Current lifecycle status (GoalStatus). */
|
|
36569
36764
|
status: text("status").notNull().default("active"),
|
|
36570
36765
|
/** Hard turn cap before the loop abandons the goal. */
|
|
@@ -36760,6 +36955,7 @@ __export(tasks_schema_exports, {
|
|
|
36760
36955
|
COMMIT_FILE_CHANGE_TYPES: () => COMMIT_FILE_CHANGE_TYPES,
|
|
36761
36956
|
COMMIT_LINK_KINDS: () => COMMIT_LINK_KINDS,
|
|
36762
36957
|
COMMIT_LINK_SOURCES: () => COMMIT_LINK_SOURCES,
|
|
36958
|
+
DOCS_WIKILINK_RELATIONS: () => DOCS_WIKILINK_RELATIONS,
|
|
36763
36959
|
EVIDENCE_BINDING_TYPES: () => EVIDENCE_BINDING_TYPES,
|
|
36764
36960
|
EXTERNAL_LINK_TYPES: () => EXTERNAL_LINK_TYPES,
|
|
36765
36961
|
GATE_STATUSES: () => GATE_STATUSES,
|
|
@@ -36810,6 +37006,7 @@ __export(tasks_schema_exports, {
|
|
|
36810
37006
|
brainReleaseLinks: () => brainReleaseLinks,
|
|
36811
37007
|
commitFiles: () => commitFiles,
|
|
36812
37008
|
commits: () => commits,
|
|
37009
|
+
docsWikilinks: () => docsWikilinks,
|
|
36813
37010
|
evidenceAcBindings: () => tasksEvidenceAcBindings,
|
|
36814
37011
|
experiments: () => experiments,
|
|
36815
37012
|
externalTaskLinks: () => tasksExternalTaskLinks,
|
|
@@ -36863,7 +37060,7 @@ var init_tasks_schema = __esm({
|
|
|
36863
37060
|
});
|
|
36864
37061
|
|
|
36865
37062
|
// packages/core/src/store/db-helpers.ts
|
|
36866
|
-
import { eq as eq3, inArray as inArray2, sql as
|
|
37063
|
+
import { eq as eq3, inArray as inArray2, sql as sql33 } from "drizzle-orm";
|
|
36867
37064
|
async function upsertTask(db, row, archiveFields, allowOrphanParent = false) {
|
|
36868
37065
|
if (row.parentId) {
|
|
36869
37066
|
const parent = await db.select({ id: tasksTasks.id }).from(tasksTasks).where(eq3(tasksTasks.id, row.parentId)).limit(1).all();
|
|
@@ -37070,7 +37267,7 @@ __export(telemetry_schema_exports, {
|
|
|
37070
37267
|
telemetryEvents: () => telemetryEvents2,
|
|
37071
37268
|
telemetrySchemaMeta: () => telemetrySchemaMeta2
|
|
37072
37269
|
});
|
|
37073
|
-
import { sql as
|
|
37270
|
+
import { sql as sql34 } from "drizzle-orm";
|
|
37074
37271
|
var telemetryEvents2, telemetrySchemaMeta2;
|
|
37075
37272
|
var init_telemetry_schema = __esm({
|
|
37076
37273
|
"packages/core/src/store/schema/telemetry-schema.ts"() {
|
|
@@ -37098,7 +37295,7 @@ var init_telemetry_schema = __esm({
|
|
|
37098
37295
|
/** Machine-readable error code when exit_code != 0. NULL on success. */
|
|
37099
37296
|
errorCode: text("error_code"),
|
|
37100
37297
|
/** ISO-8601 timestamp of the invocation. */
|
|
37101
|
-
timestamp: text("timestamp").notNull().default(
|
|
37298
|
+
timestamp: text("timestamp").notNull().default(sql34`(datetime('now'))`)
|
|
37102
37299
|
},
|
|
37103
37300
|
(table) => [
|
|
37104
37301
|
index("idx_telemetry_command").on(table.command),
|
|
@@ -37403,7 +37600,7 @@ __export(skills_schema_exports, {
|
|
|
37403
37600
|
skillUsage: () => skillUsage,
|
|
37404
37601
|
skills: () => skills
|
|
37405
37602
|
});
|
|
37406
|
-
import { sql as
|
|
37603
|
+
import { sql as sql35 } from "drizzle-orm";
|
|
37407
37604
|
var skills, skillUsage, skillReviews, skillPatches;
|
|
37408
37605
|
var init_skills_schema = __esm({
|
|
37409
37606
|
"packages/core/src/store/schema/skills-schema.ts"() {
|
|
@@ -37458,7 +37655,7 @@ var init_skills_schema = __esm({
|
|
|
37458
37655
|
/** Foreign key (logical) to {@link skills}.name — denormalised for query speed. */
|
|
37459
37656
|
skillName: text("skill_name").notNull(),
|
|
37460
37657
|
/** ISO-8601 wall-clock timestamp of the load/invoke event. */
|
|
37461
|
-
observedAt: text("observed_at").notNull().default(
|
|
37658
|
+
observedAt: text("observed_at").notNull().default(sql35`(datetime('now'))`),
|
|
37462
37659
|
/** Event kind — `load`, `invoke`, `error`, etc. (free-form for now). */
|
|
37463
37660
|
eventKind: text("event_kind").notNull(),
|
|
37464
37661
|
/**
|
|
@@ -37499,7 +37696,7 @@ var init_skills_schema = __esm({
|
|
|
37499
37696
|
/** Foreign key (logical) to {@link skills}.name. */
|
|
37500
37697
|
skillName: text("skill_name").notNull(),
|
|
37501
37698
|
/** ISO-8601 timestamp of the review. */
|
|
37502
|
-
reviewedAt: text("reviewed_at").notNull().default(
|
|
37699
|
+
reviewedAt: text("reviewed_at").notNull().default(sql35`(datetime('now'))`),
|
|
37503
37700
|
/** Outcome verdict — see {@link SkillReviewOutcome}. */
|
|
37504
37701
|
outcome: text("outcome", {
|
|
37505
37702
|
enum: ["approved", "rejected", "needs-changes"]
|
|
@@ -37524,7 +37721,7 @@ var init_skills_schema = __esm({
|
|
|
37524
37721
|
/** Foreign key (logical) to {@link skills}.name. */
|
|
37525
37722
|
skillName: text("skill_name").notNull(),
|
|
37526
37723
|
/** ISO-8601 timestamp the patch was proposed. */
|
|
37527
|
-
proposedAt: text("proposed_at").notNull().default(
|
|
37724
|
+
proposedAt: text("proposed_at").notNull().default(sql35`(datetime('now'))`),
|
|
37528
37725
|
/** ISO-8601 timestamp the patch was applied (null while `status='proposed'`). */
|
|
37529
37726
|
appliedAt: text("applied_at"),
|
|
37530
37727
|
/** Optional foreign key (logical) to {@link skillReviews}.id that gated this patch. */
|
|
@@ -38304,7 +38501,7 @@ __export(registry_exports2, {
|
|
|
38304
38501
|
updateAgentStatus: () => updateAgentStatus
|
|
38305
38502
|
});
|
|
38306
38503
|
import { randomBytes } from "node:crypto";
|
|
38307
|
-
import { and as and4, eq as eq6, inArray as inArray3, lt as lt2, sql as
|
|
38504
|
+
import { and as and4, eq as eq6, inArray as inArray3, lt as lt2, sql as sql36 } from "drizzle-orm";
|
|
38308
38505
|
function generateAgentId() {
|
|
38309
38506
|
const now = /* @__PURE__ */ new Date();
|
|
38310
38507
|
const ts = now.toISOString().replace(/[-:T]/g, "").substring(0, 14);
|
|
@@ -38386,7 +38583,7 @@ async function updateAgentStatus(id, opts, cwd) {
|
|
|
38386
38583
|
}
|
|
38387
38584
|
async function incrementTasksCompleted(id, cwd) {
|
|
38388
38585
|
const db = await getDb(cwd);
|
|
38389
|
-
await db.update(agentInstances).set({ totalTasksCompleted:
|
|
38586
|
+
await db.update(agentInstances).set({ totalTasksCompleted: sql36`${agentInstances.totalTasksCompleted} + 1` }).where(eq6(agentInstances.id, id));
|
|
38390
38587
|
}
|
|
38391
38588
|
async function listAgentInstances(filters, cwd) {
|
|
38392
38589
|
const db = await getDb(cwd);
|
|
@@ -38532,7 +38729,7 @@ __export(sqlite_data_accessor_exports, {
|
|
|
38532
38729
|
createSqliteDataAccessor: () => createSqliteDataAccessor,
|
|
38533
38730
|
setMetaValue: () => setMetaValue
|
|
38534
38731
|
});
|
|
38535
|
-
import { and as and5, eq as eq7, inArray as inArray4, isNull as isNull2, like as like2, ne as ne2, notInArray as notInArray2, or as or3, sql as
|
|
38732
|
+
import { and as and5, eq as eq7, inArray as inArray4, isNull as isNull2, like as like2, ne as ne2, notInArray as notInArray2, or as or3, sql as sql37 } from "drizzle-orm";
|
|
38536
38733
|
function generateAuditLogId() {
|
|
38537
38734
|
const epoch = Math.floor(Date.now() / 1e3);
|
|
38538
38735
|
const rand = Math.random().toString(36).slice(2, 8);
|
|
@@ -38689,7 +38886,7 @@ async function createSqliteDataAccessor(cwd) {
|
|
|
38689
38886
|
conditions.push(inArray4(auditLog.action, [...query.actions]));
|
|
38690
38887
|
}
|
|
38691
38888
|
if (query.since) {
|
|
38692
|
-
conditions.push(
|
|
38889
|
+
conditions.push(sql37`${auditLog.timestamp} >= ${query.since}`);
|
|
38693
38890
|
}
|
|
38694
38891
|
const limit = Math.max(1, Math.floor(query.limit ?? 100));
|
|
38695
38892
|
const rows = await db.select({
|
|
@@ -38701,7 +38898,7 @@ async function createSqliteDataAccessor(cwd) {
|
|
|
38701
38898
|
detailsJson: auditLog.detailsJson,
|
|
38702
38899
|
beforeJson: auditLog.beforeJson,
|
|
38703
38900
|
afterJson: auditLog.afterJson
|
|
38704
|
-
}).from(auditLog).where(conditions.length > 0 ? and5(...conditions) : void 0).orderBy(
|
|
38901
|
+
}).from(auditLog).where(conditions.length > 0 ? and5(...conditions) : void 0).orderBy(sql37`${auditLog.timestamp} DESC`).limit(limit).all();
|
|
38705
38902
|
return rows.map((row) => ({
|
|
38706
38903
|
id: row.id,
|
|
38707
38904
|
timestamp: row.timestamp,
|
|
@@ -38864,7 +39061,7 @@ async function createSqliteDataAccessor(cwd) {
|
|
|
38864
39061
|
},
|
|
38865
39062
|
async getActiveSession() {
|
|
38866
39063
|
const db = await getDb(cwd);
|
|
38867
|
-
const rows = await db.select().from(tasksSessions).where(eq7(tasksSessions.status, "active")).orderBy(
|
|
39064
|
+
const rows = await db.select().from(tasksSessions).where(eq7(tasksSessions.status, "active")).orderBy(sql37`${tasksSessions.startedAt} DESC`).limit(1).all();
|
|
38868
39065
|
if (rows.length === 0 || !rows[0]) return null;
|
|
38869
39066
|
return rowToSession(rows[0]);
|
|
38870
39067
|
},
|
|
@@ -38920,24 +39117,24 @@ async function createSqliteDataAccessor(cwd) {
|
|
|
38920
39117
|
conditions.push(inArray4(tasksTasks.id, labelMatchIds));
|
|
38921
39118
|
}
|
|
38922
39119
|
const where = conditions.length > 0 ? and5(...conditions) : void 0;
|
|
38923
|
-
const countResult = await db.select({ count:
|
|
39120
|
+
const countResult = await db.select({ count: sql37`count(*)` }).from(tasksTasks).where(where).get();
|
|
38924
39121
|
const total = countResult?.count ?? 0;
|
|
38925
39122
|
let orderClause;
|
|
38926
39123
|
switch (filters.orderBy) {
|
|
38927
39124
|
case "createdAt":
|
|
38928
|
-
orderClause =
|
|
39125
|
+
orderClause = sql37`${tasksTasks.createdAt} ASC`;
|
|
38929
39126
|
break;
|
|
38930
39127
|
case "updatedAt":
|
|
38931
|
-
orderClause =
|
|
39128
|
+
orderClause = sql37`${tasksTasks.updatedAt} DESC NULLS LAST`;
|
|
38932
39129
|
break;
|
|
38933
39130
|
case "priority": {
|
|
38934
|
-
orderClause =
|
|
39131
|
+
orderClause = sql37`CASE ${tasksTasks.priority}
|
|
38935
39132
|
WHEN 'critical' THEN 0 WHEN 'high' THEN 1
|
|
38936
39133
|
WHEN 'medium' THEN 2 WHEN 'low' THEN 3 ELSE 4 END ASC`;
|
|
38937
39134
|
break;
|
|
38938
39135
|
}
|
|
38939
39136
|
default:
|
|
38940
|
-
orderClause =
|
|
39137
|
+
orderClause = sql37`${tasksTasks.position} ASC, ${tasksTasks.createdAt} ASC`;
|
|
38941
39138
|
}
|
|
38942
39139
|
let query = db.select().from(tasksTasks).where(where).orderBy(orderClause);
|
|
38943
39140
|
if (filters.limit !== void 0) {
|
|
@@ -38968,12 +39165,12 @@ async function createSqliteDataAccessor(cwd) {
|
|
|
38968
39165
|
conditions.push(eq7(tasksTasks.parentId, filters.parentId));
|
|
38969
39166
|
}
|
|
38970
39167
|
const where = conditions.length > 0 ? and5(...conditions) : void 0;
|
|
38971
|
-
const result = await db.select({ count:
|
|
39168
|
+
const result = await db.select({ count: sql37`count(*)` }).from(tasksTasks).where(where).get();
|
|
38972
39169
|
return result?.count ?? 0;
|
|
38973
39170
|
},
|
|
38974
39171
|
async getChildren(parentId) {
|
|
38975
39172
|
const db = await getDb(cwd);
|
|
38976
|
-
const rows = await db.select().from(tasksTasks).where(and5(eq7(tasksTasks.parentId, parentId), ne2(tasksTasks.status, "archived"))).orderBy(
|
|
39173
|
+
const rows = await db.select().from(tasksTasks).where(and5(eq7(tasksTasks.parentId, parentId), ne2(tasksTasks.status, "archived"))).orderBy(sql37`${tasksTasks.position} ASC, ${tasksTasks.createdAt} ASC`).all();
|
|
38977
39174
|
const tasks2 = rows.map(rowToTask);
|
|
38978
39175
|
if (tasks2.length > 0) {
|
|
38979
39176
|
const allIds = await getAllTaskIds();
|
|
@@ -38984,12 +39181,12 @@ async function createSqliteDataAccessor(cwd) {
|
|
|
38984
39181
|
},
|
|
38985
39182
|
async countChildren(parentId) {
|
|
38986
39183
|
const db = await getDb(cwd);
|
|
38987
|
-
const result = await db.select({ count:
|
|
39184
|
+
const result = await db.select({ count: sql37`count(*)` }).from(tasksTasks).where(and5(eq7(tasksTasks.parentId, parentId), ne2(tasksTasks.status, "archived"))).get();
|
|
38988
39185
|
return result?.count ?? 0;
|
|
38989
39186
|
},
|
|
38990
39187
|
async countActiveChildren(parentId) {
|
|
38991
39188
|
const db = await getDb(cwd);
|
|
38992
|
-
const result = await db.select({ count:
|
|
39189
|
+
const result = await db.select({ count: sql37`count(*)` }).from(tasksTasks).where(
|
|
38993
39190
|
and5(
|
|
38994
39191
|
eq7(tasksTasks.parentId, parentId),
|
|
38995
39192
|
notInArray2(tasksTasks.status, [...TERMINAL_TASK_STATUSES])
|
|
@@ -39207,7 +39404,7 @@ async function createSqliteDataAccessor(cwd) {
|
|
|
39207
39404
|
await accessor.updateTaskFields(taskId, flds);
|
|
39208
39405
|
},
|
|
39209
39406
|
async getChildren(parentId) {
|
|
39210
|
-
const rows = await db.select().from(tasksTasks).where(and5(eq7(tasksTasks.parentId, parentId), ne2(tasksTasks.status, "archived"))).orderBy(
|
|
39407
|
+
const rows = await db.select().from(tasksTasks).where(and5(eq7(tasksTasks.parentId, parentId), ne2(tasksTasks.status, "archived"))).orderBy(sql37`${tasksTasks.position} ASC, ${tasksTasks.createdAt} ASC`).all();
|
|
39211
39408
|
return rows.map(rowToTask);
|
|
39212
39409
|
},
|
|
39213
39410
|
async appendLog(entry) {
|
|
@@ -40252,7 +40449,7 @@ __export(memory_accessor_exports, {
|
|
|
40252
40449
|
logConsolidationComplete: () => logConsolidationComplete,
|
|
40253
40450
|
logConsolidationStart: () => logConsolidationStart
|
|
40254
40451
|
});
|
|
40255
|
-
import { and as and6, asc as asc2, desc as desc2, eq as eq9, gt as gt2, gte as gte2, inArray as inArray5, isNull as isNull3, lt as lt3, ne as ne3, or as or4, sql as
|
|
40452
|
+
import { and as and6, asc as asc2, desc as desc2, eq as eq9, gt as gt2, gte as gte2, inArray as inArray5, isNull as isNull3, lt as lt3, ne as ne3, or as or4, sql as sql38 } from "drizzle-orm";
|
|
40256
40453
|
async function getBrainAccessor(cwd) {
|
|
40257
40454
|
const db = await getBrainDb(cwd);
|
|
40258
40455
|
return new BrainDataAccessor(db);
|
|
@@ -40339,7 +40536,7 @@ var init_memory_accessor = __esm({
|
|
|
40339
40536
|
* @task T11552
|
|
40340
40537
|
*/
|
|
40341
40538
|
async addDecisionWithSequentialId(row) {
|
|
40342
|
-
const nextId =
|
|
40539
|
+
const nextId = sql38`'D' || printf('%03d', COALESCE((SELECT MAX(CAST(substr(${brainDecisions.id}, 2) AS INTEGER)) FROM ${brainDecisions} WHERE ${brainDecisions.id} GLOB 'D[0-9]*'), 0) + 1)`;
|
|
40343
40540
|
const inserted = await this.db.insert(brainDecisions).values({ ...row, id: nextId }).returning();
|
|
40344
40541
|
return inserted[0];
|
|
40345
40542
|
}
|
|
@@ -40585,7 +40782,7 @@ var init_memory_accessor = __esm({
|
|
|
40585
40782
|
}
|
|
40586
40783
|
if (params.tags && params.tags.length > 0) {
|
|
40587
40784
|
const wantedTags = [...new Set(params.tags)];
|
|
40588
|
-
const matchingIds = this.db.select({ stickyId: stickyTags.stickyId }).from(stickyTags).where(inArray5(stickyTags.tag, wantedTags)).groupBy(stickyTags.stickyId).having(
|
|
40785
|
+
const matchingIds = this.db.select({ stickyId: stickyTags.stickyId }).from(stickyTags).where(inArray5(stickyTags.tag, wantedTags)).groupBy(stickyTags.stickyId).having(sql38`count(distinct ${stickyTags.tag}) = ${wantedTags.length}`);
|
|
40589
40786
|
conditions.push(inArray5(brainStickyNotes.id, matchingIds));
|
|
40590
40787
|
}
|
|
40591
40788
|
let query = this.db.select().from(brainStickyNotes).orderBy(desc2(brainStickyNotes.createdAt));
|
|
@@ -40683,7 +40880,7 @@ var init_memory_accessor = __esm({
|
|
|
40683
40880
|
}
|
|
40684
40881
|
if (params.tags && params.tags.length > 0) {
|
|
40685
40882
|
const wanted = [...new Set(params.tags)];
|
|
40686
|
-
const matchingIds = this.db.select({ id:
|
|
40883
|
+
const matchingIds = this.db.select({ id: sql38`a.id` }).from(sql38`${t} AS a, json_each(a.tags) AS je`).where(inArray5(sql38`je.value`, wanted)).groupBy(sql38`a.id`).having(sql38`count(distinct je.value) = ${wanted.length}`);
|
|
40687
40884
|
conditions.push(inArray5(t.id, matchingIds));
|
|
40688
40885
|
}
|
|
40689
40886
|
const where = conditions.length > 0 ? and6(...conditions) : void 0;
|
|
@@ -40711,9 +40908,9 @@ var init_memory_accessor = __esm({
|
|
|
40711
40908
|
if (decayed) clauses.push(decayed);
|
|
40712
40909
|
}
|
|
40713
40910
|
const where = clauses.length === 1 ? clauses[0] : or4(...clauses);
|
|
40714
|
-
const before = await this.db.select({ id: t.id }).from(t).where(where ??
|
|
40911
|
+
const before = await this.db.select({ id: t.id }).from(t).where(where ?? sql38`0`);
|
|
40715
40912
|
if (before.length === 0) return 0;
|
|
40716
|
-
await this.db.update(t).set({ status: "discarded" }).where(where ??
|
|
40913
|
+
await this.db.update(t).set({ status: "discarded" }).where(where ?? sql38`0`);
|
|
40717
40914
|
return before.length;
|
|
40718
40915
|
}
|
|
40719
40916
|
/**
|
|
@@ -40744,7 +40941,7 @@ var init_memory_accessor = __esm({
|
|
|
40744
40941
|
// Whole-value JSONB read — emits canonical TEXT, parsed to string[].
|
|
40745
40942
|
// Wrap the column in `sql` so the jsonbText helper receives an SQL
|
|
40746
40943
|
// expression (its param type is SQL | SQL.Aliased, not a column).
|
|
40747
|
-
tags: jsonbText(
|
|
40944
|
+
tags: jsonbText(sql38`${t.tags}`),
|
|
40748
40945
|
createdAt: t.createdAt,
|
|
40749
40946
|
expiresAt: t.expiresAt,
|
|
40750
40947
|
decayScore: t.decayScore,
|