@cleocode/core 2026.6.7 → 2026.6.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/docs-read-model.d.ts +40 -0
- package/dist/docs/docs-read-model.d.ts.map +1 -1
- package/dist/docs/docs-read-model.js +29 -0
- package/dist/docs/docs-read-model.js.map +1 -1
- package/dist/docs/export-document.js +897 -730
- package/dist/docs/export-document.js.map +3 -3
- package/dist/docs/index.d.ts +4 -0
- package/dist/docs/index.d.ts.map +1 -1
- package/dist/docs/index.js +2 -0
- package/dist/docs/index.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/llm/plugin-facade.js +941 -776
- package/dist/llm/plugin-facade.js.map +3 -3
- 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 +133 -0
- package/dist/store/schema/attachments.d.ts.map +1 -1
- package/dist/store/schema/attachments.js +63 -0
- package/dist/store/schema/attachments.js.map +1 -1
- package/migrations/drizzle-tasks/20260605000001_t11826-docs-wikilinks/migration.sql +110 -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";
|
|
@@ -27383,11 +27469,38 @@ var init_attachments = __esm({
|
|
|
27383
27469
|
index("idx_attachment_refs_owner").on(table.ownerType, table.ownerId)
|
|
27384
27470
|
]
|
|
27385
27471
|
);
|
|
27472
|
+
DOCS_WIKILINK_RELATIONS = [
|
|
27473
|
+
"supersedes",
|
|
27474
|
+
"superseded-by",
|
|
27475
|
+
"related-task",
|
|
27476
|
+
"topic"
|
|
27477
|
+
];
|
|
27478
|
+
docsWikilinks = sqliteTable(
|
|
27479
|
+
"docs_wikilinks",
|
|
27480
|
+
{
|
|
27481
|
+
/** Source doc slug (→ `attachments.slug`). Always a doc. */
|
|
27482
|
+
fromSlug: text("from_slug").notNull(),
|
|
27483
|
+
/** Target slug — a doc slug, or a `T####` task id when `toIsTask = 1`. */
|
|
27484
|
+
toSlug: text("to_slug").notNull(),
|
|
27485
|
+
/** Which provenance column produced this edge — dispatch-validated, no SQL CHECK. */
|
|
27486
|
+
relation: text("relation", { enum: DOCS_WIKILINK_RELATIONS }).notNull(),
|
|
27487
|
+
/** 1 when `to_slug` is a task id (`related-task` edges); 0 for doc→doc edges. */
|
|
27488
|
+
toIsTask: integer("to_is_task", { mode: "boolean" }).notNull().default(false),
|
|
27489
|
+
/** ISO-8601 UTC instant this edge was last (re)derived. */
|
|
27490
|
+
derivedAt: text("derived_at").notNull().default(sql11`(datetime('now'))`)
|
|
27491
|
+
},
|
|
27492
|
+
(table) => [
|
|
27493
|
+
primaryKey({ columns: [table.fromSlug, table.toSlug, table.relation] }),
|
|
27494
|
+
index("idx_docs_wikilinks_from").on(table.fromSlug),
|
|
27495
|
+
index("idx_docs_wikilinks_to").on(table.toSlug),
|
|
27496
|
+
index("idx_docs_wikilinks_relation").on(table.relation)
|
|
27497
|
+
]
|
|
27498
|
+
);
|
|
27386
27499
|
}
|
|
27387
27500
|
});
|
|
27388
27501
|
|
|
27389
27502
|
// packages/core/src/store/schema/cleo-project/docs.ts
|
|
27390
|
-
import { sql as
|
|
27503
|
+
import { sql as sql12 } from "drizzle-orm";
|
|
27391
27504
|
var docsAttachments, docsAttachmentRefs, docsManifestEntries, docsPipelineManifest;
|
|
27392
27505
|
var init_docs2 = __esm({
|
|
27393
27506
|
"packages/core/src/store/schema/cleo-project/docs.ts"() {
|
|
@@ -27410,7 +27523,7 @@ var init_docs2 = __esm({
|
|
|
27410
27523
|
*/
|
|
27411
27524
|
attachmentJson: text("attachment_json").notNull(),
|
|
27412
27525
|
/** ISO-8601 UTC creation instant (canonical TEXT timestamp, §4). */
|
|
27413
|
-
createdAt: text("created_at").notNull().default(
|
|
27526
|
+
createdAt: text("created_at").notNull().default(sql12`(datetime('now'))`),
|
|
27414
27527
|
/** Number of `docs_attachment_refs` rows pointing here; GC-eligible at 0. */
|
|
27415
27528
|
refCount: integer("ref_count").notNull().default(0),
|
|
27416
27529
|
/** Optional human-friendly slug, unique per project. */
|
|
@@ -27495,7 +27608,7 @@ var init_docs2 = __esm({
|
|
|
27495
27608
|
/** Agent identity (or `"human"`) that created the entry. */
|
|
27496
27609
|
createdBy: text("created_by"),
|
|
27497
27610
|
/** ISO-8601 UTC creation instant (canonical TEXT timestamp, §4). */
|
|
27498
|
-
createdAt: text("created_at").notNull().default(
|
|
27611
|
+
createdAt: text("created_at").notNull().default(sql12`(datetime('now'))`)
|
|
27499
27612
|
},
|
|
27500
27613
|
(table) => [
|
|
27501
27614
|
index("idx_docs_manifest_entries_pipeline_id").on(table.pipelineId),
|
|
@@ -27542,7 +27655,7 @@ var init_docs2 = __esm({
|
|
|
27542
27655
|
/** Optional serialized metadata (TEXT per JSON audit). */
|
|
27543
27656
|
metadataJson: text("metadata_json"),
|
|
27544
27657
|
/** ISO-8601 UTC creation instant (canonical TEXT timestamp, §4). */
|
|
27545
|
-
createdAt: text("created_at").notNull().default(
|
|
27658
|
+
createdAt: text("created_at").notNull().default(sql12`(datetime('now'))`),
|
|
27546
27659
|
/** ISO-8601 UTC archival instant; NULL while active (canonical TEXT, §4). */
|
|
27547
27660
|
archivedAt: text("archived_at")
|
|
27548
27661
|
},
|
|
@@ -27558,7 +27671,7 @@ var init_docs2 = __esm({
|
|
|
27558
27671
|
});
|
|
27559
27672
|
|
|
27560
27673
|
// packages/core/src/store/schema/cleo-project/lifecycle.ts
|
|
27561
|
-
import { sql as
|
|
27674
|
+
import { sql as sql13 } from "drizzle-orm";
|
|
27562
27675
|
var LIFECYCLE_VALIDATION_STATUSES, tasksLifecyclePipelines, tasksLifecycleStages, tasksLifecycleGateResults, tasksLifecycleEvidence, tasksLifecycleTransitions;
|
|
27563
27676
|
var init_lifecycle3 = __esm({
|
|
27564
27677
|
"packages/core/src/store/schema/cleo-project/lifecycle.ts"() {
|
|
@@ -27585,11 +27698,11 @@ var init_lifecycle3 = __esm({
|
|
|
27585
27698
|
/** Current stage id pointer. */
|
|
27586
27699
|
currentStageId: text("current_stage_id"),
|
|
27587
27700
|
/** ISO-8601 UTC start instant (canonical TEXT, §4). */
|
|
27588
|
-
startedAt: text("started_at").notNull().default(
|
|
27701
|
+
startedAt: text("started_at").notNull().default(sql13`(datetime('now'))`),
|
|
27589
27702
|
/** ISO-8601 UTC completion instant; NULL while active (canonical TEXT, §4). */
|
|
27590
27703
|
completedAt: text("completed_at"),
|
|
27591
27704
|
/** ISO-8601 UTC last-update instant (canonical TEXT, §4). */
|
|
27592
|
-
updatedAt: text("updated_at").default(
|
|
27705
|
+
updatedAt: text("updated_at").default(sql13`(datetime('now'))`),
|
|
27593
27706
|
/** Optimistic-concurrency version counter. */
|
|
27594
27707
|
version: integer("version").notNull().default(1)
|
|
27595
27708
|
},
|
|
@@ -27659,7 +27772,7 @@ var init_lifecycle3 = __esm({
|
|
|
27659
27772
|
/** Result — CHECK-backed via {@link LIFECYCLE_GATE_RESULTS}. */
|
|
27660
27773
|
result: text("result", { enum: LIFECYCLE_GATE_RESULTS }).notNull(),
|
|
27661
27774
|
/** ISO-8601 UTC check instant (canonical TEXT, §4). */
|
|
27662
|
-
checkedAt: text("checked_at").notNull().default(
|
|
27775
|
+
checkedAt: text("checked_at").notNull().default(sql13`(datetime('now'))`),
|
|
27663
27776
|
/** Checker identity. */
|
|
27664
27777
|
checkedBy: text("checked_by").notNull(),
|
|
27665
27778
|
/** Optional detail payload. */
|
|
@@ -27681,7 +27794,7 @@ var init_lifecycle3 = __esm({
|
|
|
27681
27794
|
/** Evidence type — CHECK-backed via {@link LIFECYCLE_EVIDENCE_TYPES}. */
|
|
27682
27795
|
type: text("type", { enum: LIFECYCLE_EVIDENCE_TYPES }).notNull(),
|
|
27683
27796
|
/** ISO-8601 UTC record instant (canonical TEXT, §4). */
|
|
27684
|
-
recordedAt: text("recorded_at").notNull().default(
|
|
27797
|
+
recordedAt: text("recorded_at").notNull().default(sql13`(datetime('now'))`),
|
|
27685
27798
|
/** Recorder identity. */
|
|
27686
27799
|
recordedBy: text("recorded_by"),
|
|
27687
27800
|
/** Optional description. */
|
|
@@ -27705,7 +27818,7 @@ var init_lifecycle3 = __esm({
|
|
|
27705
27818
|
/** Actor identity. */
|
|
27706
27819
|
transitionedBy: text("transitioned_by"),
|
|
27707
27820
|
/** ISO-8601 UTC creation instant (canonical TEXT, §4). */
|
|
27708
|
-
createdAt: text("created_at").notNull().default(
|
|
27821
|
+
createdAt: text("created_at").notNull().default(sql13`(datetime('now'))`)
|
|
27709
27822
|
},
|
|
27710
27823
|
(table) => [index("idx_tasks_lifecycle_transitions_pipeline_id").on(table.pipelineId)]
|
|
27711
27824
|
);
|
|
@@ -27713,7 +27826,7 @@ var init_lifecycle3 = __esm({
|
|
|
27713
27826
|
});
|
|
27714
27827
|
|
|
27715
27828
|
// packages/core/src/store/schema/cleo-project/nexus-graph.ts
|
|
27716
|
-
import { sql as
|
|
27829
|
+
import { sql as sql14 } from "drizzle-orm";
|
|
27717
27830
|
var NEXUS_NODE_KINDS, NEXUS_RELATION_TYPES, NEXUS_CONTRACT_TYPES, CODE_INDEX_KINDS, nexusNodes, nexusRelations, nexusRelationWeights, nexusContracts, nexusCodeIndex;
|
|
27718
27831
|
var init_nexus_graph = __esm({
|
|
27719
27832
|
"packages/core/src/store/schema/cleo-project/nexus-graph.ts"() {
|
|
@@ -27853,7 +27966,7 @@ var init_nexus_graph = __esm({
|
|
|
27853
27966
|
/** Whether this node is an external/unresolved module (E10 §3a — typed boolean). */
|
|
27854
27967
|
isExternal: integer("is_external", { mode: "boolean" }).notNull().default(false),
|
|
27855
27968
|
/** ISO-8601 UTC last-indexed instant (canonical TEXT, §4). */
|
|
27856
|
-
indexedAt: text("indexed_at").notNull().default(
|
|
27969
|
+
indexedAt: text("indexed_at").notNull().default(sql14`(datetime('now'))`)
|
|
27857
27970
|
},
|
|
27858
27971
|
(table) => [
|
|
27859
27972
|
index("idx_nexus_nodes_kind").on(table.kind),
|
|
@@ -27883,7 +27996,7 @@ var init_nexus_graph = __esm({
|
|
|
27883
27996
|
/** Step index within an execution flow (for step_in_process relations). */
|
|
27884
27997
|
step: integer("step"),
|
|
27885
27998
|
/** ISO-8601 UTC last-indexed instant (canonical TEXT, §4). */
|
|
27886
|
-
indexedAt: text("indexed_at").notNull().default(
|
|
27999
|
+
indexedAt: text("indexed_at").notNull().default(sql14`(datetime('now'))`)
|
|
27887
28000
|
// T998 plasticity columns (`weight`, `last_accessed_at`, `co_accessed_count`)
|
|
27888
28001
|
// PARTITIONED out into the sibling `nexus_relation_weights` table by T11545
|
|
27889
28002
|
// (ADR-090 §5.3). See {@link nexusRelationWeights}.
|
|
@@ -27938,9 +28051,9 @@ var init_nexus_graph = __esm({
|
|
|
27938
28051
|
/** Human-readable description. */
|
|
27939
28052
|
description: text("description"),
|
|
27940
28053
|
/** ISO-8601 UTC creation instant (canonical TEXT, §4). */
|
|
27941
|
-
createdAt: text("created_at").notNull().default(
|
|
28054
|
+
createdAt: text("created_at").notNull().default(sql14`(datetime('now'))`),
|
|
27942
28055
|
/** ISO-8601 UTC last-update instant (canonical TEXT, §4). */
|
|
27943
|
-
updatedAt: text("updated_at").notNull().default(
|
|
28056
|
+
updatedAt: text("updated_at").notNull().default(sql14`(datetime('now'))`)
|
|
27944
28057
|
},
|
|
27945
28058
|
(table) => [
|
|
27946
28059
|
index("idx_nexus_contracts_type").on(table.type),
|
|
@@ -27988,7 +28101,7 @@ var init_nexus_graph = __esm({
|
|
|
27988
28101
|
});
|
|
27989
28102
|
|
|
27990
28103
|
// packages/core/src/store/schema/provenance/commits.ts
|
|
27991
|
-
import { sql as
|
|
28104
|
+
import { sql as sql15 } from "drizzle-orm";
|
|
27992
28105
|
var COMMIT_CONVENTIONAL_TYPES, COMMIT_LINK_KINDS, COMMIT_LINK_SOURCES, COMMIT_FILE_CHANGE_TYPES, commits, taskCommits, commitFiles;
|
|
27993
28106
|
var init_commits = __esm({
|
|
27994
28107
|
"packages/core/src/store/schema/provenance/commits.ts"() {
|
|
@@ -28070,7 +28183,7 @@ var init_commits = __esm({
|
|
|
28070
28183
|
*/
|
|
28071
28184
|
projectHash: text("project_hash"),
|
|
28072
28185
|
/** ISO-8601 timestamp when this row was inserted into tasks.db. */
|
|
28073
|
-
createdAt: text("created_at").notNull().default(
|
|
28186
|
+
createdAt: text("created_at").notNull().default(sql15`(datetime('now'))`)
|
|
28074
28187
|
},
|
|
28075
28188
|
(table) => [
|
|
28076
28189
|
index("idx_commits_short_sha").on(table.shortSha),
|
|
@@ -28102,7 +28215,7 @@ var init_commits = __esm({
|
|
|
28102
28215
|
*/
|
|
28103
28216
|
linkSource: text("link_source").notNull(),
|
|
28104
28217
|
/** ISO-8601 timestamp when this link was created. */
|
|
28105
|
-
createdAt: text("created_at").notNull().default(
|
|
28218
|
+
createdAt: text("created_at").notNull().default(sql15`(datetime('now'))`)
|
|
28106
28219
|
},
|
|
28107
28220
|
(table) => [
|
|
28108
28221
|
primaryKey({ columns: [table.taskId, table.commitSha, table.linkKind] }),
|
|
@@ -28145,7 +28258,7 @@ var init_commits = __esm({
|
|
|
28145
28258
|
});
|
|
28146
28259
|
|
|
28147
28260
|
// packages/core/src/store/schema/cleo-project/provenance-commits.ts
|
|
28148
|
-
import { sql as
|
|
28261
|
+
import { sql as sql16 } from "drizzle-orm";
|
|
28149
28262
|
var tasksCommits, tasksTaskCommits, tasksCommitFiles;
|
|
28150
28263
|
var init_provenance_commits = __esm({
|
|
28151
28264
|
"packages/core/src/store/schema/cleo-project/provenance-commits.ts"() {
|
|
@@ -28203,7 +28316,7 @@ var init_provenance_commits = __esm({
|
|
|
28203
28316
|
/** Project hash correlating commits to a specific CLEO project. */
|
|
28204
28317
|
projectHash: text("project_hash"),
|
|
28205
28318
|
/** ISO-8601 UTC insertion instant (canonical TEXT timestamp, §4). */
|
|
28206
|
-
createdAt: text("created_at").notNull().default(
|
|
28319
|
+
createdAt: text("created_at").notNull().default(sql16`(datetime('now'))`)
|
|
28207
28320
|
},
|
|
28208
28321
|
(table) => [
|
|
28209
28322
|
index("idx_tasks_commits_short_sha").on(table.shortSha),
|
|
@@ -28226,7 +28339,7 @@ var init_provenance_commits = __esm({
|
|
|
28226
28339
|
/** How this link was discovered — E10 §5b CHECK-backed. */
|
|
28227
28340
|
linkSource: text("link_source", { enum: COMMIT_LINK_SOURCES }).notNull(),
|
|
28228
28341
|
/** ISO-8601 UTC link-creation instant (canonical TEXT timestamp, §4). */
|
|
28229
|
-
createdAt: text("created_at").notNull().default(
|
|
28342
|
+
createdAt: text("created_at").notNull().default(sql16`(datetime('now'))`)
|
|
28230
28343
|
},
|
|
28231
28344
|
(table) => [
|
|
28232
28345
|
primaryKey({ columns: [table.taskId, table.commitSha, table.linkKind] }),
|
|
@@ -28263,7 +28376,7 @@ var init_provenance_commits = __esm({
|
|
|
28263
28376
|
});
|
|
28264
28377
|
|
|
28265
28378
|
// packages/core/src/store/schema/cleo-project/provenance-orphans.ts
|
|
28266
|
-
import { sql as
|
|
28379
|
+
import { sql as sql17 } from "drizzle-orm";
|
|
28267
28380
|
var BRAIN_RELEASE_LINK_TYPES_CONSOLIDATED, tasksAgentCredentials, tasksBrainReleaseLinks;
|
|
28268
28381
|
var init_provenance_orphans = __esm({
|
|
28269
28382
|
"packages/core/src/store/schema/cleo-project/provenance-orphans.ts"() {
|
|
@@ -28301,9 +28414,9 @@ var init_provenance_orphans = __esm({
|
|
|
28301
28414
|
/** Unix epoch of most recent use (milliseconds). Null = never used. */
|
|
28302
28415
|
lastUsedAt: integer("last_used_at"),
|
|
28303
28416
|
/** Unix epoch when this credential was created (milliseconds). */
|
|
28304
|
-
createdAt: integer("created_at").notNull().default(
|
|
28417
|
+
createdAt: integer("created_at").notNull().default(sql17`(unixepoch())`),
|
|
28305
28418
|
/** Unix epoch when this credential was last updated (milliseconds). */
|
|
28306
|
-
updatedAt: integer("updated_at").notNull().default(
|
|
28419
|
+
updatedAt: integer("updated_at").notNull().default(sql17`(unixepoch())`)
|
|
28307
28420
|
},
|
|
28308
28421
|
(table) => [
|
|
28309
28422
|
index("idx_tasks_agent_cred_active").on(table.isActive),
|
|
@@ -28323,7 +28436,7 @@ var init_provenance_orphans = __esm({
|
|
|
28323
28436
|
/** Semantic relationship type. */
|
|
28324
28437
|
linkType: text("link_type", { enum: BRAIN_RELEASE_LINK_TYPES_CONSOLIDATED }).notNull(),
|
|
28325
28438
|
/** ISO-8601 timestamp when this link was created. */
|
|
28326
|
-
createdAt: text("created_at").notNull().default(
|
|
28439
|
+
createdAt: text("created_at").notNull().default(sql17`(datetime('now'))`),
|
|
28327
28440
|
/** Identity of the agent or user that created this link. */
|
|
28328
28441
|
createdBy: text("created_by")
|
|
28329
28442
|
},
|
|
@@ -28338,7 +28451,7 @@ var init_provenance_orphans = __esm({
|
|
|
28338
28451
|
});
|
|
28339
28452
|
|
|
28340
28453
|
// packages/core/src/store/schema/provenance/pull-requests.ts
|
|
28341
|
-
import { sql as
|
|
28454
|
+
import { sql as sql18 } from "drizzle-orm";
|
|
28342
28455
|
var PR_STATES, PR_LINK_SOURCES, PR_LINK_KINDS, pullRequests, prCommits, prTasks;
|
|
28343
28456
|
var init_pull_requests = __esm({
|
|
28344
28457
|
"packages/core/src/store/schema/provenance/pull-requests.ts"() {
|
|
@@ -28417,9 +28530,9 @@ var init_pull_requests = __esm({
|
|
|
28417
28530
|
*/
|
|
28418
28531
|
projectHash: text("project_hash"),
|
|
28419
28532
|
/** ISO-8601 timestamp when this row was first inserted into tasks.db. */
|
|
28420
|
-
createdAt: text("created_at").notNull().default(
|
|
28533
|
+
createdAt: text("created_at").notNull().default(sql18`(datetime('now'))`),
|
|
28421
28534
|
/** ISO-8601 timestamp of the last update to this row. */
|
|
28422
|
-
updatedAt: text("updated_at").notNull().default(
|
|
28535
|
+
updatedAt: text("updated_at").notNull().default(sql18`(datetime('now'))`)
|
|
28423
28536
|
},
|
|
28424
28537
|
(table) => [
|
|
28425
28538
|
index("idx_pr_number").on(table.prNumber),
|
|
@@ -28466,7 +28579,7 @@ var init_pull_requests = __esm({
|
|
|
28466
28579
|
*/
|
|
28467
28580
|
linkKind: text("link_kind").notNull(),
|
|
28468
28581
|
/** ISO-8601 timestamp when this link was created. */
|
|
28469
|
-
createdAt: text("created_at").notNull().default(
|
|
28582
|
+
createdAt: text("created_at").notNull().default(sql18`(datetime('now'))`)
|
|
28470
28583
|
},
|
|
28471
28584
|
(table) => [
|
|
28472
28585
|
primaryKey({ columns: [table.prId, table.taskId, table.linkKind] }),
|
|
@@ -28479,7 +28592,7 @@ var init_pull_requests = __esm({
|
|
|
28479
28592
|
});
|
|
28480
28593
|
|
|
28481
28594
|
// packages/core/src/store/schema/provenance/releases.ts
|
|
28482
|
-
import { sql as
|
|
28595
|
+
import { sql as sql19 } from "drizzle-orm";
|
|
28483
28596
|
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
28597
|
var init_releases = __esm({
|
|
28485
28598
|
"packages/core/src/store/schema/provenance/releases.ts"() {
|
|
@@ -28589,7 +28702,7 @@ var init_releases = __esm({
|
|
|
28589
28702
|
/** URL of the GitHub Actions workflow run that built and published this release. */
|
|
28590
28703
|
workflowRunUrl: text("workflow_run_url"),
|
|
28591
28704
|
/** ISO-8601 timestamp when this row was inserted. */
|
|
28592
|
-
createdAt: text("created_at").notNull().default(
|
|
28705
|
+
createdAt: text("created_at").notNull().default(sql19`(datetime('now'))`),
|
|
28593
28706
|
/** ISO-8601 timestamp when `cleo release plan` created the plan (new pipeline). */
|
|
28594
28707
|
plannedAt: text("planned_at"),
|
|
28595
28708
|
/** ISO-8601 timestamp when the bump-PR was opened (new pipeline). */
|
|
@@ -28711,7 +28824,7 @@ var init_releases = __esm({
|
|
|
28711
28824
|
*/
|
|
28712
28825
|
classifiedBy: text("classified_by", { enum: RELEASE_CLASSIFIED_BY }).notNull().default("auto"),
|
|
28713
28826
|
/** ISO-8601 timestamp when this change was classified. */
|
|
28714
|
-
classifiedAt: text("classified_at").notNull().default(
|
|
28827
|
+
classifiedAt: text("classified_at").notNull().default(sql19`(datetime('now'))`)
|
|
28715
28828
|
},
|
|
28716
28829
|
(table) => [
|
|
28717
28830
|
index("idx_release_changes_release_id").on(table.releaseId),
|
|
@@ -28742,7 +28855,7 @@ var init_releases = __esm({
|
|
|
28742
28855
|
/** Migration note when `kind = 'breaking'`, nullable. */
|
|
28743
28856
|
breaking: text("breaking"),
|
|
28744
28857
|
/** ISO-8601 timestamp when this row was inserted. */
|
|
28745
|
-
createdAt: text("created_at").notNull().default(
|
|
28858
|
+
createdAt: text("created_at").notNull().default(sql19`(datetime('now'))`)
|
|
28746
28859
|
},
|
|
28747
28860
|
(table) => [
|
|
28748
28861
|
index("release_changesets_release_id_idx").on(table.releaseId),
|
|
@@ -28797,7 +28910,7 @@ var init_releases = __esm({
|
|
|
28797
28910
|
*/
|
|
28798
28911
|
linkType: text("link_type", { enum: BRAIN_RELEASE_LINK_TYPES }).notNull(),
|
|
28799
28912
|
/** ISO-8601 timestamp when this link was created. */
|
|
28800
|
-
createdAt: text("created_at").notNull().default(
|
|
28913
|
+
createdAt: text("created_at").notNull().default(sql19`(datetime('now'))`),
|
|
28801
28914
|
/** Identifier of the agent or user that created this link. Nullable. */
|
|
28802
28915
|
createdBy: text("created_by")
|
|
28803
28916
|
},
|
|
@@ -28812,7 +28925,7 @@ var init_releases = __esm({
|
|
|
28812
28925
|
});
|
|
28813
28926
|
|
|
28814
28927
|
// packages/core/src/store/schema/cleo-project/provenance-rest.ts
|
|
28815
|
-
import { sql as
|
|
28928
|
+
import { sql as sql20 } from "drizzle-orm";
|
|
28816
28929
|
var tasksPullRequests, tasksPrCommits, tasksPrTasks, tasksReleases, tasksReleaseCommits, tasksReleaseChanges, tasksReleaseChangesets, tasksReleaseArtifacts;
|
|
28817
28930
|
var init_provenance_rest = __esm({
|
|
28818
28931
|
"packages/core/src/store/schema/cleo-project/provenance-rest.ts"() {
|
|
@@ -28861,9 +28974,9 @@ var init_provenance_rest = __esm({
|
|
|
28861
28974
|
/** Project correlation hash. */
|
|
28862
28975
|
projectHash: text("project_hash"),
|
|
28863
28976
|
/** ISO-8601 UTC creation instant (canonical TEXT, §4). */
|
|
28864
|
-
createdAt: text("created_at").notNull().default(
|
|
28977
|
+
createdAt: text("created_at").notNull().default(sql20`(datetime('now'))`),
|
|
28865
28978
|
/** ISO-8601 UTC last-update instant (canonical TEXT, §4). */
|
|
28866
|
-
updatedAt: text("updated_at").notNull().default(
|
|
28979
|
+
updatedAt: text("updated_at").notNull().default(sql20`(datetime('now'))`)
|
|
28867
28980
|
},
|
|
28868
28981
|
(table) => [
|
|
28869
28982
|
index("idx_tasks_pull_requests_pr_number").on(table.prNumber),
|
|
@@ -28903,7 +29016,7 @@ var init_provenance_rest = __esm({
|
|
|
28903
29016
|
/** Relationship classification — E10 §5b CHECK-backed via {@link PR_LINK_KINDS}. */
|
|
28904
29017
|
linkKind: text("link_kind", { enum: PR_LINK_KINDS }).notNull(),
|
|
28905
29018
|
/** ISO-8601 UTC creation instant (canonical TEXT, §4). */
|
|
28906
|
-
createdAt: text("created_at").notNull().default(
|
|
29019
|
+
createdAt: text("created_at").notNull().default(sql20`(datetime('now'))`)
|
|
28907
29020
|
},
|
|
28908
29021
|
(table) => [
|
|
28909
29022
|
primaryKey({ columns: [table.prId, table.taskId, table.linkKind] }),
|
|
@@ -28938,7 +29051,7 @@ var init_provenance_rest = __esm({
|
|
|
28938
29051
|
/** GitHub Actions workflow run URL. */
|
|
28939
29052
|
workflowRunUrl: text("workflow_run_url"),
|
|
28940
29053
|
/** ISO-8601 UTC creation instant (canonical TEXT, §4). */
|
|
28941
|
-
createdAt: text("created_at").notNull().default(
|
|
29054
|
+
createdAt: text("created_at").notNull().default(sql20`(datetime('now'))`),
|
|
28942
29055
|
/** ISO-8601 UTC planned instant (canonical TEXT, §4). */
|
|
28943
29056
|
plannedAt: text("planned_at"),
|
|
28944
29057
|
/** ISO-8601 UTC PR-opened instant (canonical TEXT, §4). */
|
|
@@ -29032,7 +29145,7 @@ var init_provenance_rest = __esm({
|
|
|
29032
29145
|
/** Classification provenance — CHECK-backed via {@link RELEASE_CLASSIFIED_BY}. */
|
|
29033
29146
|
classifiedBy: text("classified_by", { enum: RELEASE_CLASSIFIED_BY }).notNull().default("auto"),
|
|
29034
29147
|
/** ISO-8601 UTC classification instant (canonical TEXT, §4). */
|
|
29035
|
-
classifiedAt: text("classified_at").notNull().default(
|
|
29148
|
+
classifiedAt: text("classified_at").notNull().default(sql20`(datetime('now'))`)
|
|
29036
29149
|
},
|
|
29037
29150
|
(table) => [
|
|
29038
29151
|
index("idx_tasks_release_changes_release_id").on(table.releaseId),
|
|
@@ -29063,7 +29176,7 @@ var init_provenance_rest = __esm({
|
|
|
29063
29176
|
/** Breaking-change migration note. */
|
|
29064
29177
|
breaking: text("breaking"),
|
|
29065
29178
|
/** ISO-8601 UTC creation instant (canonical TEXT, §4). */
|
|
29066
|
-
createdAt: text("created_at").notNull().default(
|
|
29179
|
+
createdAt: text("created_at").notNull().default(sql20`(datetime('now'))`)
|
|
29067
29180
|
},
|
|
29068
29181
|
(table) => [
|
|
29069
29182
|
index("idx_tasks_release_changesets_release_id").on(table.releaseId),
|
|
@@ -29100,7 +29213,7 @@ var init_provenance_rest = __esm({
|
|
|
29100
29213
|
});
|
|
29101
29214
|
|
|
29102
29215
|
// packages/core/src/store/schema/agent-schema.ts
|
|
29103
|
-
import { sql as
|
|
29216
|
+
import { sql as sql21 } from "drizzle-orm";
|
|
29104
29217
|
var AGENT_INSTANCE_STATUSES2, AGENT_TYPES2, agentInstances, agentErrorLog;
|
|
29105
29218
|
var init_agent_schema = __esm({
|
|
29106
29219
|
"packages/core/src/store/schema/agent-schema.ts"() {
|
|
@@ -29137,8 +29250,8 @@ var init_agent_schema = __esm({
|
|
|
29137
29250
|
// cross-db-annotation-ok: intra-DB FK to tasks.sessions.id (no .references() because the row may pre-date the session being created)
|
|
29138
29251
|
taskId: text("task_id"),
|
|
29139
29252
|
// 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(
|
|
29253
|
+
startedAt: text("started_at").notNull().default(sql21`(datetime('now'))`),
|
|
29254
|
+
lastHeartbeat: text("last_heartbeat").notNull().default(sql21`(datetime('now'))`),
|
|
29142
29255
|
stoppedAt: text("stopped_at"),
|
|
29143
29256
|
errorCount: integer("error_count").notNull().default(0),
|
|
29144
29257
|
totalTasksCompleted: integer("total_tasks_completed").notNull().default(0),
|
|
@@ -29167,7 +29280,7 @@ var init_agent_schema = __esm({
|
|
|
29167
29280
|
}).notNull(),
|
|
29168
29281
|
message: text("message").notNull(),
|
|
29169
29282
|
stack: text("stack"),
|
|
29170
|
-
occurredAt: text("occurred_at").notNull().default(
|
|
29283
|
+
occurredAt: text("occurred_at").notNull().default(sql21`(datetime('now'))`),
|
|
29171
29284
|
resolved: integer("resolved", { mode: "boolean" }).notNull().default(false)
|
|
29172
29285
|
},
|
|
29173
29286
|
(table) => [
|
|
@@ -29180,7 +29293,7 @@ var init_agent_schema = __esm({
|
|
|
29180
29293
|
});
|
|
29181
29294
|
|
|
29182
29295
|
// packages/core/src/store/schema/chain-schema.ts
|
|
29183
|
-
import { sql as
|
|
29296
|
+
import { sql as sql22 } from "drizzle-orm";
|
|
29184
29297
|
var WARP_CHAIN_INSTANCE_STATUSES, warpChains, warpChainInstances;
|
|
29185
29298
|
var init_chain_schema = __esm({
|
|
29186
29299
|
"packages/core/src/store/schema/chain-schema.ts"() {
|
|
@@ -29203,8 +29316,8 @@ var init_chain_schema = __esm({
|
|
|
29203
29316
|
definition: text("definition").notNull(),
|
|
29204
29317
|
// JSON-serialized WarpChain
|
|
29205
29318
|
validated: integer("validated", { mode: "boolean" }).default(false),
|
|
29206
|
-
createdAt: text("created_at").default(
|
|
29207
|
-
updatedAt: text("updated_at").default(
|
|
29319
|
+
createdAt: text("created_at").default(sql22`(datetime('now'))`),
|
|
29320
|
+
updatedAt: text("updated_at").default(sql22`(datetime('now'))`)
|
|
29208
29321
|
},
|
|
29209
29322
|
(table) => [index("idx_warp_chains_name").on(table.name)]
|
|
29210
29323
|
);
|
|
@@ -29222,8 +29335,8 @@ var init_chain_schema = __esm({
|
|
|
29222
29335
|
currentStage: text("current_stage"),
|
|
29223
29336
|
gateResults: text("gate_results"),
|
|
29224
29337
|
// JSON array of GateResult
|
|
29225
|
-
createdAt: text("created_at").default(
|
|
29226
|
-
updatedAt: text("updated_at").default(
|
|
29338
|
+
createdAt: text("created_at").default(sql22`(datetime('now'))`),
|
|
29339
|
+
updatedAt: text("updated_at").default(sql22`(datetime('now'))`)
|
|
29227
29340
|
},
|
|
29228
29341
|
(table) => [
|
|
29229
29342
|
index("idx_warp_instances_chain").on(table.chainId),
|
|
@@ -29235,7 +29348,7 @@ var init_chain_schema = __esm({
|
|
|
29235
29348
|
});
|
|
29236
29349
|
|
|
29237
29350
|
// packages/core/src/store/schema/cleo-project/runtime.ts
|
|
29238
|
-
import { sql as
|
|
29351
|
+
import { sql as sql23 } from "drizzle-orm";
|
|
29239
29352
|
var AGENT_ERROR_TYPES, PLAYBOOK_RUN_STATUSES, PLAYBOOK_APPROVAL_STATUSES, tasksWarpChains, tasksWarpChainInstances, tasksAgentInstances, tasksAgentErrorLog, tasksPlaybookRuns, tasksPlaybookApprovals;
|
|
29240
29353
|
var init_runtime = __esm({
|
|
29241
29354
|
"packages/core/src/store/schema/cleo-project/runtime.ts"() {
|
|
@@ -29272,9 +29385,9 @@ var init_runtime = __esm({
|
|
|
29272
29385
|
/** Whether the definition validated. §3a boolean — already typed, preserved. */
|
|
29273
29386
|
validated: integer("validated", { mode: "boolean" }).default(false),
|
|
29274
29387
|
/** ISO-8601 UTC creation instant (canonical TEXT, §4). */
|
|
29275
|
-
createdAt: text("created_at").default(
|
|
29388
|
+
createdAt: text("created_at").default(sql23`(datetime('now'))`),
|
|
29276
29389
|
/** ISO-8601 UTC last-update instant (canonical TEXT, §4). */
|
|
29277
|
-
updatedAt: text("updated_at").default(
|
|
29390
|
+
updatedAt: text("updated_at").default(sql23`(datetime('now'))`)
|
|
29278
29391
|
},
|
|
29279
29392
|
(table) => [index("idx_tasks_warp_chains_name").on(table.name)]
|
|
29280
29393
|
);
|
|
@@ -29298,9 +29411,9 @@ var init_runtime = __esm({
|
|
|
29298
29411
|
/** JSON array of gate results (TEXT per JSON audit). */
|
|
29299
29412
|
gateResults: text("gate_results"),
|
|
29300
29413
|
/** ISO-8601 UTC creation instant (canonical TEXT, §4). */
|
|
29301
|
-
createdAt: text("created_at").default(
|
|
29414
|
+
createdAt: text("created_at").default(sql23`(datetime('now'))`),
|
|
29302
29415
|
/** ISO-8601 UTC last-update instant (canonical TEXT, §4). */
|
|
29303
|
-
updatedAt: text("updated_at").default(
|
|
29416
|
+
updatedAt: text("updated_at").default(sql23`(datetime('now'))`)
|
|
29304
29417
|
},
|
|
29305
29418
|
(table) => [
|
|
29306
29419
|
index("idx_tasks_warp_chain_instances_chain").on(table.chainId),
|
|
@@ -29322,9 +29435,9 @@ var init_runtime = __esm({
|
|
|
29322
29435
|
/** Intra-DB soft ref → `tasks_tasks.id`. */
|
|
29323
29436
|
taskId: text("task_id"),
|
|
29324
29437
|
/** ISO-8601 UTC start instant (canonical TEXT, §4). */
|
|
29325
|
-
startedAt: text("started_at").notNull().default(
|
|
29438
|
+
startedAt: text("started_at").notNull().default(sql23`(datetime('now'))`),
|
|
29326
29439
|
/** ISO-8601 UTC last-heartbeat instant (canonical TEXT, §4). */
|
|
29327
|
-
lastHeartbeat: text("last_heartbeat").notNull().default(
|
|
29440
|
+
lastHeartbeat: text("last_heartbeat").notNull().default(sql23`(datetime('now'))`),
|
|
29328
29441
|
/** ISO-8601 UTC stop instant (canonical TEXT, §4). */
|
|
29329
29442
|
stoppedAt: text("stopped_at"),
|
|
29330
29443
|
/** Error count. */
|
|
@@ -29361,7 +29474,7 @@ var init_runtime = __esm({
|
|
|
29361
29474
|
/** Optional stack trace. */
|
|
29362
29475
|
stack: text("stack"),
|
|
29363
29476
|
/** ISO-8601 UTC occurrence instant (canonical TEXT, §4). */
|
|
29364
|
-
occurredAt: text("occurred_at").notNull().default(
|
|
29477
|
+
occurredAt: text("occurred_at").notNull().default(sql23`(datetime('now'))`),
|
|
29365
29478
|
/** Whether the error was resolved. §3a boolean — already typed, preserved. */
|
|
29366
29479
|
resolved: integer("resolved", { mode: "boolean" }).notNull().default(false)
|
|
29367
29480
|
},
|
|
@@ -29393,7 +29506,7 @@ var init_runtime = __esm({
|
|
|
29393
29506
|
/** Optional session id (cross-table soft ref → `tasks_sessions.id`). */
|
|
29394
29507
|
sessionId: text("session_id"),
|
|
29395
29508
|
/** ISO-8601 UTC start instant (canonical TEXT, §4). */
|
|
29396
|
-
startedAt: text("started_at").notNull().default(
|
|
29509
|
+
startedAt: text("started_at").notNull().default(sql23`(datetime('now'))`),
|
|
29397
29510
|
/** ISO-8601 UTC completion instant (canonical TEXT, §4). */
|
|
29398
29511
|
completedAt: text("completed_at")
|
|
29399
29512
|
});
|
|
@@ -29407,7 +29520,7 @@ var init_runtime = __esm({
|
|
|
29407
29520
|
/** HMAC resume token (unique). */
|
|
29408
29521
|
token: text("token").notNull().unique(),
|
|
29409
29522
|
/** ISO-8601 UTC request instant (canonical TEXT, §4). */
|
|
29410
|
-
requestedAt: text("requested_at").notNull().default(
|
|
29523
|
+
requestedAt: text("requested_at").notNull().default(sql23`(datetime('now'))`),
|
|
29411
29524
|
/** ISO-8601 UTC approval instant (canonical TEXT, §4). */
|
|
29412
29525
|
approvedAt: text("approved_at"),
|
|
29413
29526
|
/** Approver identity. */
|
|
@@ -29431,7 +29544,7 @@ import {
|
|
|
29431
29544
|
TASK_SEVERITIES as TASK_SEVERITIES3,
|
|
29432
29545
|
TASK_SIZES as TASK_SIZES3
|
|
29433
29546
|
} from "@cleocode/contracts/enums";
|
|
29434
|
-
import { sql as
|
|
29547
|
+
import { sql as sql24 } from "drizzle-orm";
|
|
29435
29548
|
var TASK_AC_KINDS, tasksTasks, tasksTaskAcceptanceCriteria, tasksAcceptanceProjectionState, tasksAcceptanceProjectionDirty, tasksTaskDependencies, tasksTaskRelations, tasksSessions, tasksSessionHandoffEntries, tasksTaskWorkHistory, tasksTaskAcceptanceCriteriaHistory, tasksExternalTaskLinks;
|
|
29436
29549
|
var init_tasks_core = __esm({
|
|
29437
29550
|
"packages/core/src/store/schema/cleo-project/tasks-core.ts"() {
|
|
@@ -29490,7 +29603,7 @@ var init_tasks_core = __esm({
|
|
|
29490
29603
|
/** Whether auto-complete is suppressed. §3a boolean — already typed, preserved. */
|
|
29491
29604
|
noAutoComplete: integer("no_auto_complete", { mode: "boolean" }),
|
|
29492
29605
|
/** ISO-8601 UTC creation instant (canonical TEXT, §4). */
|
|
29493
|
-
createdAt: text("created_at").notNull().default(
|
|
29606
|
+
createdAt: text("created_at").notNull().default(sql24`(datetime('now'))`),
|
|
29494
29607
|
/** ISO-8601 UTC last-update instant (canonical TEXT, §4). */
|
|
29495
29608
|
updatedAt: text("updated_at"),
|
|
29496
29609
|
/** ISO-8601 UTC completion instant (canonical TEXT, §4). */
|
|
@@ -29546,7 +29659,7 @@ var init_tasks_core = __esm({
|
|
|
29546
29659
|
index("idx_tasks_tasks_role").on(table.kind),
|
|
29547
29660
|
index("idx_tasks_tasks_scope").on(table.scope),
|
|
29548
29661
|
index("idx_tasks_tasks_role_status").on(table.kind, table.status),
|
|
29549
|
-
index("idx_tasks_tasks_created_date").on(
|
|
29662
|
+
index("idx_tasks_tasks_created_date").on(sql24`date(${table.createdAt})`),
|
|
29550
29663
|
unique("uq_tasks_tasks_idempotency_key").on(table.idempotencyKey)
|
|
29551
29664
|
]
|
|
29552
29665
|
);
|
|
@@ -29572,7 +29685,7 @@ var init_tasks_core = __esm({
|
|
|
29572
29685
|
/** The AC statement. */
|
|
29573
29686
|
text: text("text").notNull(),
|
|
29574
29687
|
/** ISO-8601 UTC creation instant (canonical TEXT, §4). */
|
|
29575
|
-
createdAt: text("created_at").notNull().default(
|
|
29688
|
+
createdAt: text("created_at").notNull().default(sql24`(CURRENT_TIMESTAMP)`),
|
|
29576
29689
|
/** ISO-8601 UTC last-edit instant (canonical TEXT, §4). */
|
|
29577
29690
|
updatedAt: text("updated_at"),
|
|
29578
29691
|
/** Optional sha256(text) drift snapshot. */
|
|
@@ -29601,7 +29714,7 @@ var init_tasks_core = __esm({
|
|
|
29601
29714
|
/** Source frontier fingerprint. */
|
|
29602
29715
|
sourceFingerprint: text("source_fingerprint"),
|
|
29603
29716
|
/** ISO-8601 UTC creation instant (canonical TEXT, §4). */
|
|
29604
|
-
createdAt: text("created_at").notNull().default(
|
|
29717
|
+
createdAt: text("created_at").notNull().default(sql24`(CURRENT_TIMESTAMP)`),
|
|
29605
29718
|
/** ISO-8601 UTC last-update instant (canonical TEXT, §4). */
|
|
29606
29719
|
updatedAt: text("updated_at")
|
|
29607
29720
|
},
|
|
@@ -29625,7 +29738,7 @@ var init_tasks_core = __esm({
|
|
|
29625
29738
|
/** ISO-8601 UTC source-update that triggered this (canonical TEXT, §4). */
|
|
29626
29739
|
sourceUpdatedAt: text("source_updated_at"),
|
|
29627
29740
|
/** ISO-8601 UTC queue-insertion instant (canonical TEXT, §4). */
|
|
29628
|
-
queuedAt: text("queued_at").notNull().default(
|
|
29741
|
+
queuedAt: text("queued_at").notNull().default(sql24`(CURRENT_TIMESTAMP)`),
|
|
29629
29742
|
/** JSON producer context (TEXT per JSON audit). */
|
|
29630
29743
|
payloadJson: text("payload_json")
|
|
29631
29744
|
},
|
|
@@ -29698,7 +29811,7 @@ var init_tasks_core = __esm({
|
|
|
29698
29811
|
/** JSON handoff payload (TEXT per JSON audit). */
|
|
29699
29812
|
handoffJson: text("handoff_json"),
|
|
29700
29813
|
/** ISO-8601 UTC start instant (canonical TEXT, §4). */
|
|
29701
|
-
startedAt: text("started_at").notNull().default(
|
|
29814
|
+
startedAt: text("started_at").notNull().default(sql24`(datetime('now'))`),
|
|
29702
29815
|
/** ISO-8601 UTC end instant (canonical TEXT, §4). */
|
|
29703
29816
|
endedAt: text("ended_at"),
|
|
29704
29817
|
/** Previous session pointer (self-FK). */
|
|
@@ -29760,7 +29873,7 @@ var init_tasks_core = __esm({
|
|
|
29760
29873
|
/** Serialised handoff/debrief JSON (TEXT per JSON audit). */
|
|
29761
29874
|
handoffJson: text("handoff_json").notNull(),
|
|
29762
29875
|
/** ISO-8601 UTC creation instant (canonical TEXT, §4). */
|
|
29763
|
-
createdAt: text("created_at").notNull().default(
|
|
29876
|
+
createdAt: text("created_at").notNull().default(sql24`(datetime('now'))`)
|
|
29764
29877
|
},
|
|
29765
29878
|
(table) => [index("idx_tasks_session_handoff_entries_session_id").on(table.sessionId)]
|
|
29766
29879
|
);
|
|
@@ -29774,7 +29887,7 @@ var init_tasks_core = __esm({
|
|
|
29774
29887
|
/** FK → `tasks_tasks.id`. ON DELETE CASCADE. */
|
|
29775
29888
|
taskId: text("task_id").notNull().references(() => tasksTasks.id, { onDelete: "cascade" }),
|
|
29776
29889
|
/** ISO-8601 UTC set instant (canonical TEXT, §4). */
|
|
29777
|
-
setAt: text("set_at").notNull().default(
|
|
29890
|
+
setAt: text("set_at").notNull().default(sql24`(datetime('now'))`),
|
|
29778
29891
|
/** ISO-8601 UTC cleared instant (canonical TEXT, §4). */
|
|
29779
29892
|
clearedAt: text("cleared_at")
|
|
29780
29893
|
},
|
|
@@ -29788,7 +29901,7 @@ var init_tasks_core = __esm({
|
|
|
29788
29901
|
/** AC id this row records (NOT an FK — survives AC deletion). */
|
|
29789
29902
|
acId: text("ac_id").notNull(),
|
|
29790
29903
|
/** ISO-8601 UTC record instant (canonical TEXT, §4). */
|
|
29791
|
-
recordedAt: text("recorded_at").notNull().default(
|
|
29904
|
+
recordedAt: text("recorded_at").notNull().default(sql24`(datetime('now'))`),
|
|
29792
29905
|
/** AC text BEFORE this change. */
|
|
29793
29906
|
previousText: text("previous_text").notNull(),
|
|
29794
29907
|
/**
|
|
@@ -29802,7 +29915,7 @@ var init_tasks_core = __esm({
|
|
|
29802
29915
|
(table) => [
|
|
29803
29916
|
index("idx_tasks_task_acceptance_criteria_history_ac_id_recorded_at").on(
|
|
29804
29917
|
table.acId,
|
|
29805
|
-
|
|
29918
|
+
sql24`${table.recordedAt} desc`
|
|
29806
29919
|
)
|
|
29807
29920
|
]
|
|
29808
29921
|
);
|
|
@@ -29828,7 +29941,7 @@ var init_tasks_core = __esm({
|
|
|
29828
29941
|
/** JSON provider metadata (TEXT per JSON audit; empty-object default). */
|
|
29829
29942
|
metadataJson: text("metadata_json").default("{}"),
|
|
29830
29943
|
/** ISO-8601 UTC link-creation instant (canonical TEXT, §4). */
|
|
29831
|
-
linkedAt: text("linked_at").notNull().default(
|
|
29944
|
+
linkedAt: text("linked_at").notNull().default(sql24`(datetime('now'))`),
|
|
29832
29945
|
/** ISO-8601 UTC last-sync instant (canonical TEXT, §4). */
|
|
29833
29946
|
lastSyncAt: text("last_sync_at")
|
|
29834
29947
|
},
|
|
@@ -29895,7 +30008,7 @@ var init_background_jobs = __esm({
|
|
|
29895
30008
|
});
|
|
29896
30009
|
|
|
29897
30010
|
// packages/core/src/store/schema/evidence-bindings.ts
|
|
29898
|
-
import { sql as
|
|
30011
|
+
import { sql as sql25 } from "drizzle-orm";
|
|
29899
30012
|
var EVIDENCE_BINDING_TYPES, evidenceAcBindings;
|
|
29900
30013
|
var init_evidence_bindings = __esm({
|
|
29901
30014
|
"packages/core/src/store/schema/evidence-bindings.ts"() {
|
|
@@ -29920,7 +30033,7 @@ var init_evidence_bindings = __esm({
|
|
|
29920
30033
|
enum: EVIDENCE_BINDING_TYPES
|
|
29921
30034
|
}).notNull(),
|
|
29922
30035
|
/** ISO-8601 timestamp of binding creation. */
|
|
29923
|
-
createdAt: text("created_at").notNull().default(
|
|
30036
|
+
createdAt: text("created_at").notNull().default(sql25`(datetime('now'))`)
|
|
29924
30037
|
},
|
|
29925
30038
|
(table) => [
|
|
29926
30039
|
// One binding per atom/ac/type triple — idempotent re-inserts collapse.
|
|
@@ -29939,7 +30052,7 @@ var init_evidence_bindings = __esm({
|
|
|
29939
30052
|
});
|
|
29940
30053
|
|
|
29941
30054
|
// packages/core/src/store/schema/cleo-project/tasks-core-batch2.ts
|
|
29942
|
-
import { sql as
|
|
30055
|
+
import { sql as sql26 } from "drizzle-orm";
|
|
29943
30056
|
var tasksBackgroundJobs, tasksExperiments, tasksEvidenceAcBindings, tasksTaskLabels;
|
|
29944
30057
|
var init_tasks_core_batch2 = __esm({
|
|
29945
30058
|
"packages/core/src/store/schema/cleo-project/tasks-core-batch2.ts"() {
|
|
@@ -29957,7 +30070,7 @@ var init_tasks_core_batch2 = __esm({
|
|
|
29957
30070
|
/** Current lifecycle status — CHECK-backed via {@link BACKGROUND_JOB_STATUSES}. */
|
|
29958
30071
|
status: text("status", { enum: BACKGROUND_JOB_STATUSES }).notNull().default("pending"),
|
|
29959
30072
|
/** ISO-8601 UTC creation instant (was ms epoch, §4 / §8.1). */
|
|
29960
|
-
startedAt: text("started_at").notNull().default(
|
|
30073
|
+
startedAt: text("started_at").notNull().default(sql26`(datetime('now'))`),
|
|
29961
30074
|
/** ISO-8601 UTC completion instant; NULL while running (was ms epoch, §4). */
|
|
29962
30075
|
completedAt: text("completed_at"),
|
|
29963
30076
|
/** JSON-serialised result payload; NULL on failure or while running (TEXT). */
|
|
@@ -29967,7 +30080,7 @@ var init_tasks_core_batch2 = __esm({
|
|
|
29967
30080
|
/** Execution progress 0-100; NULL until progress is reported. */
|
|
29968
30081
|
progress: integer("progress"),
|
|
29969
30082
|
/** ISO-8601 UTC last-heartbeat instant (was ms epoch, §4 / §8.1). */
|
|
29970
|
-
heartbeatAt: text("heartbeat_at").notNull().default(
|
|
30083
|
+
heartbeatAt: text("heartbeat_at").notNull().default(sql26`(datetime('now'))`),
|
|
29971
30084
|
/** Agent or session ID that claimed this job; NULL if unclaimed. */
|
|
29972
30085
|
claimedBy: text("claimed_by"),
|
|
29973
30086
|
/**
|
|
@@ -30019,7 +30132,7 @@ var init_tasks_core_batch2 = __esm({
|
|
|
30019
30132
|
/** One of {direct, satisfies, coverage} — CHECK-backed via {@link EVIDENCE_BINDING_TYPES}. */
|
|
30020
30133
|
bindingType: text("binding_type", { enum: EVIDENCE_BINDING_TYPES }).notNull(),
|
|
30021
30134
|
/** ISO-8601 UTC binding-creation instant (already canonical TEXT, §4). */
|
|
30022
|
-
createdAt: text("created_at").notNull().default(
|
|
30135
|
+
createdAt: text("created_at").notNull().default(sql26`(datetime('now'))`)
|
|
30023
30136
|
},
|
|
30024
30137
|
(table) => [
|
|
30025
30138
|
uniqueIndex("uq_tasks_evidence_ac_bindings_atom_ac_type").on(
|
|
@@ -30205,7 +30318,7 @@ __export(agent_registry_exports, {
|
|
|
30205
30318
|
agentRegistryUsers: () => agentRegistryUsers,
|
|
30206
30319
|
agentRegistryVerifications: () => agentRegistryVerifications
|
|
30207
30320
|
});
|
|
30208
|
-
import { sql as
|
|
30321
|
+
import { sql as sql27 } from "drizzle-orm";
|
|
30209
30322
|
var AGENT_REGISTRY_USER_ROLES, AGENT_REGISTRY_AGENT_STATUSES, agentRegistryUsers, agentRegistryOrganization, agentRegistryAgents, agentRegistryClaimCodes, agentRegistryCapabilities, agentRegistrySkills, agentRegistryAgentCapabilities, agentRegistryAgentSkills, agentRegistryAgentConnections, agentRegistryAccounts, agentRegistrySessions, agentRegistryVerifications, agentRegistryOrgAgentKeys;
|
|
30210
30323
|
var init_agent_registry = __esm({
|
|
30211
30324
|
"packages/core/src/store/schema/cleo-global/agent-registry.ts"() {
|
|
@@ -30271,9 +30384,9 @@ var init_agent_registry = __esm({
|
|
|
30271
30384
|
/** Owner user id (soft FK → agent_registry_users.id). */
|
|
30272
30385
|
ownerId: text("owner_id"),
|
|
30273
30386
|
/** ISO-8601 UTC creation instant (E10 §4: epoch → TEXT ISO8601). */
|
|
30274
|
-
createdAt: text("created_at").notNull().default(
|
|
30387
|
+
createdAt: text("created_at").notNull().default(sql27`(datetime('now'))`),
|
|
30275
30388
|
/** ISO-8601 UTC last-update instant (E10 §4: epoch → TEXT ISO8601). */
|
|
30276
|
-
updatedAt: text("updated_at").notNull().default(
|
|
30389
|
+
updatedAt: text("updated_at").notNull().default(sql27`(datetime('now'))`)
|
|
30277
30390
|
},
|
|
30278
30391
|
(table) => [index("idx_agent_registry_organization_slug").on(table.slug)]
|
|
30279
30392
|
);
|
|
@@ -30446,7 +30559,7 @@ var init_agent_registry = __esm({
|
|
|
30446
30559
|
/** Skill-attachment provenance (cant / manual / computed). */
|
|
30447
30560
|
source: text("source").notNull().default("manual"),
|
|
30448
30561
|
/** ISO-8601 UTC attachment instant (already canonical TEXT, §4). */
|
|
30449
|
-
attachedAt: text("attached_at").notNull().default(
|
|
30562
|
+
attachedAt: text("attached_at").notNull().default(sql27`(datetime('now'))`)
|
|
30450
30563
|
},
|
|
30451
30564
|
(table) => [
|
|
30452
30565
|
primaryKey({ columns: [table.agentId, table.skillId] }),
|
|
@@ -30584,7 +30697,7 @@ var init_agent_registry = __esm({
|
|
|
30584
30697
|
});
|
|
30585
30698
|
|
|
30586
30699
|
// packages/core/src/store/schema/cleo-global/nexus.ts
|
|
30587
|
-
import { sql as
|
|
30700
|
+
import { sql as sql28 } from "drizzle-orm";
|
|
30588
30701
|
var SIGIL_ROLES, nexusProjectRegistry, nexusProjectIdAliases, nexusAuditLog, nexusSchemaMeta, nexusUserProfile, nexusSigils;
|
|
30589
30702
|
var init_nexus2 = __esm({
|
|
30590
30703
|
"packages/core/src/store/schema/cleo-global/nexus.ts"() {
|
|
@@ -30612,9 +30725,9 @@ var init_nexus2 = __esm({
|
|
|
30612
30725
|
/** Human-readable project name. */
|
|
30613
30726
|
name: text("name").notNull(),
|
|
30614
30727
|
/** ISO-8601 UTC registration instant (canonical TEXT, §4). */
|
|
30615
|
-
registeredAt: text("registered_at").notNull().default(
|
|
30728
|
+
registeredAt: text("registered_at").notNull().default(sql28`(datetime('now'))`),
|
|
30616
30729
|
/** ISO-8601 UTC last-seen instant (canonical TEXT, §4). */
|
|
30617
|
-
lastSeen: text("last_seen").notNull().default(
|
|
30730
|
+
lastSeen: text("last_seen").notNull().default(sql28`(datetime('now'))`),
|
|
30618
30731
|
/** Health status string (e.g. "healthy", "warning", "unknown"). */
|
|
30619
30732
|
healthStatus: text("health_status").notNull().default("unknown"),
|
|
30620
30733
|
/** ISO-8601 UTC last health-check instant; NULL until first check. */
|
|
@@ -30622,7 +30735,7 @@ var init_nexus2 = __esm({
|
|
|
30622
30735
|
/** Permission level ("read" / "write"). */
|
|
30623
30736
|
permissions: text("permissions").notNull().default("read"),
|
|
30624
30737
|
/** ISO-8601 UTC last-sync instant (canonical TEXT, §4). */
|
|
30625
|
-
lastSync: text("last_sync").notNull().default(
|
|
30738
|
+
lastSync: text("last_sync").notNull().default(sql28`(datetime('now'))`),
|
|
30626
30739
|
/** Cached task count for the project. */
|
|
30627
30740
|
taskCount: integer("task_count").notNull().default(0),
|
|
30628
30741
|
/** JSON array of project labels (serialized TEXT per JSON-Column Audit). */
|
|
@@ -30651,7 +30764,7 @@ var init_nexus2 = __esm({
|
|
|
30651
30764
|
/** Canonical 12-hex-char ID this alias maps to (soft FK → nexus_project_registry). */
|
|
30652
30765
|
canonicalId: text("canonical_id").notNull(),
|
|
30653
30766
|
/** ISO-8601 UTC creation instant (canonical TEXT, §4). */
|
|
30654
|
-
createdAt: text("created_at").notNull().default(
|
|
30767
|
+
createdAt: text("created_at").notNull().default(sql28`(datetime('now'))`)
|
|
30655
30768
|
},
|
|
30656
30769
|
(table) => [index("idx_nexus_project_id_aliases_canonical").on(table.canonicalId)]
|
|
30657
30770
|
);
|
|
@@ -30661,7 +30774,7 @@ var init_nexus2 = __esm({
|
|
|
30661
30774
|
/** UUID primary key. */
|
|
30662
30775
|
id: text("id").primaryKey(),
|
|
30663
30776
|
/** ISO-8601 UTC instant of the audited operation (canonical TEXT, §4). */
|
|
30664
|
-
timestamp: text("timestamp").notNull().default(
|
|
30777
|
+
timestamp: text("timestamp").notNull().default(sql28`(datetime('now'))`),
|
|
30665
30778
|
/** Audited action name. */
|
|
30666
30779
|
action: text("action").notNull(),
|
|
30667
30780
|
/** Project hash context; NULL for global operations. */
|
|
@@ -30756,9 +30869,9 @@ var init_nexus2 = __esm({
|
|
|
30756
30869
|
/** JSON-encoded capability flags object (serialized TEXT); NULL until set. */
|
|
30757
30870
|
capabilityFlags: text("capability_flags"),
|
|
30758
30871
|
/** ISO-8601 UTC creation instant (E10 §4: Drizzle-Date → TEXT ISO8601). */
|
|
30759
|
-
createdAt: text("created_at").notNull().default(
|
|
30872
|
+
createdAt: text("created_at").notNull().default(sql28`(datetime('now'))`),
|
|
30760
30873
|
/** ISO-8601 UTC last-update instant (E10 §4: Drizzle-Date → TEXT ISO8601). */
|
|
30761
|
-
updatedAt: text("updated_at").notNull().default(
|
|
30874
|
+
updatedAt: text("updated_at").notNull().default(sql28`(datetime('now'))`)
|
|
30762
30875
|
},
|
|
30763
30876
|
(table) => [
|
|
30764
30877
|
index("idx_nexus_sigils_display_name").on(table.displayName),
|
|
@@ -30769,7 +30882,7 @@ var init_nexus2 = __esm({
|
|
|
30769
30882
|
});
|
|
30770
30883
|
|
|
30771
30884
|
// packages/core/src/store/schema/cleo-global/skills.ts
|
|
30772
|
-
import { sql as
|
|
30885
|
+
import { sql as sql29 } from "drizzle-orm";
|
|
30773
30886
|
var SKILL_SOURCE_TYPES, SKILL_LIFECYCLE_STATES, SKILL_REVIEW_OUTCOMES, SKILL_PATCH_STATUSES, skillsSkills, skillsSkillUsage, skillsSkillReviews, skillsSkillPatches;
|
|
30774
30887
|
var init_skills2 = __esm({
|
|
30775
30888
|
"packages/core/src/store/schema/cleo-global/skills.ts"() {
|
|
@@ -30824,7 +30937,7 @@ var init_skills2 = __esm({
|
|
|
30824
30937
|
/** Logical FK to {@link skillsSkills}.name — denormalised for query speed. */
|
|
30825
30938
|
skillName: text("skill_name").notNull(),
|
|
30826
30939
|
/** ISO-8601 wall-clock timestamp of the load/invoke event (canonical TEXT, §4). */
|
|
30827
|
-
observedAt: text("observed_at").notNull().default(
|
|
30940
|
+
observedAt: text("observed_at").notNull().default(sql29`(datetime('now'))`),
|
|
30828
30941
|
/** Event kind — `load`, `invoke`, `error`, etc. */
|
|
30829
30942
|
eventKind: text("event_kind").notNull(),
|
|
30830
30943
|
/**
|
|
@@ -30864,7 +30977,7 @@ var init_skills2 = __esm({
|
|
|
30864
30977
|
/** Logical FK to {@link skillsSkills}.name. */
|
|
30865
30978
|
skillName: text("skill_name").notNull(),
|
|
30866
30979
|
/** ISO-8601 timestamp of the review (canonical TEXT, §4). */
|
|
30867
|
-
reviewedAt: text("reviewed_at").notNull().default(
|
|
30980
|
+
reviewedAt: text("reviewed_at").notNull().default(sql29`(datetime('now'))`),
|
|
30868
30981
|
/** Outcome verdict from {@link SKILL_REVIEW_OUTCOMES} (E10 §5a). */
|
|
30869
30982
|
outcome: text("outcome", { enum: SKILL_REVIEW_OUTCOMES }).notNull(),
|
|
30870
30983
|
/** Numeric grade (0-100); NULL if review was council-only. */
|
|
@@ -30887,7 +31000,7 @@ var init_skills2 = __esm({
|
|
|
30887
31000
|
/** Logical FK to {@link skillsSkills}.name. */
|
|
30888
31001
|
skillName: text("skill_name").notNull(),
|
|
30889
31002
|
/** ISO-8601 timestamp the patch was proposed (canonical TEXT, §4). */
|
|
30890
|
-
proposedAt: text("proposed_at").notNull().default(
|
|
31003
|
+
proposedAt: text("proposed_at").notNull().default(sql29`(datetime('now'))`),
|
|
30891
31004
|
/** ISO-8601 timestamp the patch was applied; NULL while proposed (canonical TEXT, §4). */
|
|
30892
31005
|
appliedAt: text("applied_at"),
|
|
30893
31006
|
/** Logical FK to {@link skillsSkillReviews}.id that gated this patch. */
|
|
@@ -30908,7 +31021,7 @@ var init_skills2 = __esm({
|
|
|
30908
31021
|
});
|
|
30909
31022
|
|
|
30910
31023
|
// packages/core/src/store/schema/cleo-global/telemetry.ts
|
|
30911
|
-
import { sql as
|
|
31024
|
+
import { sql as sql30 } from "drizzle-orm";
|
|
30912
31025
|
var telemetryEvents, telemetrySchemaMeta;
|
|
30913
31026
|
var init_telemetry = __esm({
|
|
30914
31027
|
"packages/core/src/store/schema/cleo-global/telemetry.ts"() {
|
|
@@ -30937,7 +31050,7 @@ var init_telemetry = __esm({
|
|
|
30937
31050
|
/** Machine-readable error code when exit_code != 0. NULL on success. */
|
|
30938
31051
|
errorCode: text("error_code"),
|
|
30939
31052
|
/** ISO-8601 UTC instant of the invocation (canonical TEXT timestamp, §4). */
|
|
30940
|
-
timestamp: text("timestamp").notNull().default(
|
|
31053
|
+
timestamp: text("timestamp").notNull().default(sql30`(datetime('now'))`)
|
|
30941
31054
|
},
|
|
30942
31055
|
(table) => [
|
|
30943
31056
|
index("idx_telemetry_command").on(table.command),
|
|
@@ -33806,12 +33919,16 @@ __export(exodus_exports, {
|
|
|
33806
33919
|
archiveStrandedResidue: () => archiveStrandedResidue,
|
|
33807
33920
|
buildExodusHealth: () => buildExodusHealth,
|
|
33808
33921
|
buildExodusPlan: () => buildExodusPlan,
|
|
33922
|
+
clearExodusAborts: () => clearExodusAborts,
|
|
33809
33923
|
clearExodusJournal: () => clearExodusJournal,
|
|
33810
33924
|
computeCountParity: () => computeCountParity,
|
|
33811
33925
|
deriveStagingDirName: () => deriveStagingDirName,
|
|
33812
33926
|
detectStrandedResidue: () => detectStrandedResidue,
|
|
33927
|
+
emitExodusAbort: () => emitExodusAbort,
|
|
33928
|
+
exodusAbortEvents: () => exodusAbortEvents,
|
|
33813
33929
|
exodusArchiveDir: () => exodusArchiveDir,
|
|
33814
33930
|
exodusMarkerPath: () => exodusMarkerPath,
|
|
33931
|
+
getRecordedExodusAbort: () => getRecordedExodusAbort,
|
|
33815
33932
|
hasExodusCompleteMarker: () => hasExodusCompleteMarker,
|
|
33816
33933
|
isDerivedOrInternalTable: () => isDerivedOrInternalTable,
|
|
33817
33934
|
resolveConsolidatedTableName: () => resolveConsolidatedTableName,
|
|
@@ -33827,6 +33944,7 @@ __export(exodus_exports, {
|
|
|
33827
33944
|
var init_exodus = __esm({
|
|
33828
33945
|
"packages/core/src/store/exodus/index.ts"() {
|
|
33829
33946
|
"use strict";
|
|
33947
|
+
init_abort_events();
|
|
33830
33948
|
init_archive2();
|
|
33831
33949
|
init_count_parity();
|
|
33832
33950
|
init_health2();
|
|
@@ -34084,7 +34202,9 @@ var init_on_open = __esm({
|
|
|
34084
34202
|
// packages/core/src/store/dual-scope-db.ts
|
|
34085
34203
|
var dual_scope_db_exports = {};
|
|
34086
34204
|
__export(dual_scope_db_exports, {
|
|
34205
|
+
ExodusAbortWriteUnsafeError: () => ExodusAbortWriteUnsafeError,
|
|
34087
34206
|
_resetDualScopeDbCache: () => _resetDualScopeDbCache,
|
|
34207
|
+
assertWriteDurable: () => assertWriteDurable,
|
|
34088
34208
|
insertIdempotent: () => insertIdempotent,
|
|
34089
34209
|
openDualScopeDb: () => openDualScopeDb,
|
|
34090
34210
|
openDualScopeDbAtPath: () => openDualScopeDbAtPath,
|
|
@@ -34094,6 +34214,17 @@ __export(dual_scope_db_exports, {
|
|
|
34094
34214
|
import { existsSync as existsSync14, mkdirSync as mkdirSync3 } from "node:fs";
|
|
34095
34215
|
import { createRequire as createRequire4 } from "node:module";
|
|
34096
34216
|
import { dirname as dirname5, join as join12 } from "node:path";
|
|
34217
|
+
function assertWriteDurable(handle) {
|
|
34218
|
+
if (handle.exodusAbort) {
|
|
34219
|
+
throw new ExodusAbortWriteUnsafeError(handle.exodusAbort);
|
|
34220
|
+
}
|
|
34221
|
+
}
|
|
34222
|
+
function assertNoRecordedExodusAbort() {
|
|
34223
|
+
const detail = getRecordedExodusAbort();
|
|
34224
|
+
if (detail) {
|
|
34225
|
+
throw new ExodusAbortWriteUnsafeError(detail);
|
|
34226
|
+
}
|
|
34227
|
+
}
|
|
34097
34228
|
function cacheKey(scope, dbPath) {
|
|
34098
34229
|
return `${scope}::${dbPath}`;
|
|
34099
34230
|
}
|
|
@@ -34233,13 +34364,25 @@ async function openDualScopeDbAtPath(scope, dbPath, exodusCwd, options) {
|
|
|
34233
34364
|
const { maybeRunExodusOnOpen: maybeRunExodusOnOpen2 } = await Promise.resolve().then(() => (init_on_open(), on_open_exports));
|
|
34234
34365
|
const result = await maybeRunExodusOnOpen2(scope, dbPath, nativeDb, exodusCwd);
|
|
34235
34366
|
if (result.outcome === "migrated" || result.outcome === "aborted") {
|
|
34367
|
+
const reopened = scope === "project" ? await openDualScopeDbAtPath("project", dbPath) : await openDualScopeDbAtPath("global", dbPath);
|
|
34236
34368
|
if (result.outcome === "aborted") {
|
|
34369
|
+
const abort = {
|
|
34370
|
+
scope,
|
|
34371
|
+
dbPath,
|
|
34372
|
+
reason: result.reason,
|
|
34373
|
+
at: Date.now()
|
|
34374
|
+
};
|
|
34237
34375
|
log10.warn(
|
|
34238
34376
|
{ scope, reason: result.reason },
|
|
34239
|
-
"exodus-on-open aborted; consolidated cleo.db left empty, legacy kept as source"
|
|
34377
|
+
"exodus-on-open aborted; consolidated cleo.db left empty, legacy kept as source \u2014 mutating callers must check handle.exodusAbort / call assertWriteDurable (T11828)"
|
|
34240
34378
|
);
|
|
34379
|
+
const { emitExodusAbort: emitExodusAbort2 } = await Promise.resolve().then(() => (init_abort_events(), abort_events_exports));
|
|
34380
|
+
emitExodusAbort2(abort);
|
|
34381
|
+
return { ...reopened, exodusAbort: abort };
|
|
34241
34382
|
}
|
|
34242
|
-
|
|
34383
|
+
const { clearExodusAborts: clearExodusAborts2 } = await Promise.resolve().then(() => (init_abort_events(), abort_events_exports));
|
|
34384
|
+
clearExodusAborts2(scope);
|
|
34385
|
+
return reopened;
|
|
34243
34386
|
}
|
|
34244
34387
|
} catch (err) {
|
|
34245
34388
|
log10.warn(
|
|
@@ -34277,10 +34420,12 @@ function _resetDualScopeDbCache(scope) {
|
|
|
34277
34420
|
}
|
|
34278
34421
|
}
|
|
34279
34422
|
async function insertIdempotent(db, table, row, _keyColumn) {
|
|
34423
|
+
assertNoRecordedExodusAbort();
|
|
34280
34424
|
const result = await db.insert(table).values(row).onConflictDoNothing().returning();
|
|
34281
34425
|
return result.length;
|
|
34282
34426
|
}
|
|
34283
34427
|
async function upsertIdempotent(db, table, row, _keyColumn, conflictTarget, set) {
|
|
34428
|
+
assertNoRecordedExodusAbort();
|
|
34284
34429
|
const updateSet = set ?? row;
|
|
34285
34430
|
const result = await db.insert(table).values(row).onConflictDoUpdate({
|
|
34286
34431
|
target: conflictTarget,
|
|
@@ -34289,15 +34434,35 @@ async function upsertIdempotent(db, table, row, _keyColumn, conflictTarget, set)
|
|
|
34289
34434
|
}).returning();
|
|
34290
34435
|
return result.length;
|
|
34291
34436
|
}
|
|
34292
|
-
var _cache, _require2, _drizzle, _DatabaseSyncCtor, _projectSchema, _globalSchema;
|
|
34437
|
+
var ExodusAbortWriteUnsafeError, _cache, _require2, _drizzle, _DatabaseSyncCtor, _projectSchema, _globalSchema;
|
|
34293
34438
|
var init_dual_scope_db = __esm({
|
|
34294
34439
|
"packages/core/src/store/dual-scope-db.ts"() {
|
|
34295
34440
|
"use strict";
|
|
34296
34441
|
init_logger2();
|
|
34297
34442
|
init_paths();
|
|
34443
|
+
init_abort_events();
|
|
34298
34444
|
init_migration_manager();
|
|
34299
34445
|
init_resolve_migrations_folder();
|
|
34300
34446
|
init_sqlite_pragmas();
|
|
34447
|
+
ExodusAbortWriteUnsafeError = class extends Error {
|
|
34448
|
+
/** Stable string error code for envelope `codeName` / log correlation. */
|
|
34449
|
+
codeName = "E_EXODUS_ABORT_WRITE_UNSAFE";
|
|
34450
|
+
/** The structured abort detail carried by the handle. */
|
|
34451
|
+
detail;
|
|
34452
|
+
/** Remediation hint surfaced to the operator. */
|
|
34453
|
+
fix;
|
|
34454
|
+
/**
|
|
34455
|
+
* @param detail - The {@link ExodusAbortDetail} stamped on the handle.
|
|
34456
|
+
*/
|
|
34457
|
+
constructor(detail) {
|
|
34458
|
+
super(
|
|
34459
|
+
`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.`
|
|
34460
|
+
);
|
|
34461
|
+
this.name = "ExodusAbortWriteUnsafeError";
|
|
34462
|
+
this.detail = detail;
|
|
34463
|
+
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.";
|
|
34464
|
+
}
|
|
34465
|
+
};
|
|
34301
34466
|
_cache = /* @__PURE__ */ new Map();
|
|
34302
34467
|
_require2 = createRequire4(import.meta.url);
|
|
34303
34468
|
_drizzle = null;
|
|
@@ -34325,7 +34490,7 @@ __export(nexus_schema_exports, {
|
|
|
34325
34490
|
sigils: () => sigils,
|
|
34326
34491
|
userProfile: () => userProfile
|
|
34327
34492
|
});
|
|
34328
|
-
import { sql as
|
|
34493
|
+
import { sql as sql31 } from "drizzle-orm";
|
|
34329
34494
|
var projectRegistry, projectIdAliases, nexusAuditLog2, nexusSchemaMeta2, NEXUS_NODE_KINDS2, nexusNodes2, NEXUS_RELATION_TYPES2, nexusRelations2, nexusRelationWeights2, NEXUS_CONTRACT_TYPES2, nexusContracts2, userProfile, SIGIL_ROLES2, sigils;
|
|
34330
34495
|
var init_nexus_schema = __esm({
|
|
34331
34496
|
"packages/core/src/store/schema/nexus-schema.ts"() {
|
|
@@ -34353,12 +34518,12 @@ var init_nexus_schema = __esm({
|
|
|
34353
34518
|
*/
|
|
34354
34519
|
projectPath: text("project_path").notNull().unique(),
|
|
34355
34520
|
name: text("name").notNull(),
|
|
34356
|
-
registeredAt: text("registered_at").notNull().default(
|
|
34357
|
-
lastSeen: text("last_seen").notNull().default(
|
|
34521
|
+
registeredAt: text("registered_at").notNull().default(sql31`(datetime('now'))`),
|
|
34522
|
+
lastSeen: text("last_seen").notNull().default(sql31`(datetime('now'))`),
|
|
34358
34523
|
healthStatus: text("health_status").notNull().default("unknown"),
|
|
34359
34524
|
healthLastCheck: text("health_last_check"),
|
|
34360
34525
|
permissions: text("permissions").notNull().default("read"),
|
|
34361
|
-
lastSync: text("last_sync").notNull().default(
|
|
34526
|
+
lastSync: text("last_sync").notNull().default(sql31`(datetime('now'))`),
|
|
34362
34527
|
taskCount: integer("task_count").notNull().default(0),
|
|
34363
34528
|
labelsJson: text("labels_json").notNull().default("[]"),
|
|
34364
34529
|
/**
|
|
@@ -34397,7 +34562,7 @@ var init_nexus_schema = __esm({
|
|
|
34397
34562
|
/** The canonical 12-hex-char ID this alias maps to. */
|
|
34398
34563
|
canonicalId: text("canonical_id").notNull(),
|
|
34399
34564
|
/** ISO 8601 timestamp when this alias was recorded. */
|
|
34400
|
-
createdAt: text("created_at").notNull().default(
|
|
34565
|
+
createdAt: text("created_at").notNull().default(sql31`(datetime('now'))`)
|
|
34401
34566
|
},
|
|
34402
34567
|
(table) => [index("idx_nexus_project_id_aliases_canonical").on(table.canonicalId)]
|
|
34403
34568
|
);
|
|
@@ -34405,7 +34570,7 @@ var init_nexus_schema = __esm({
|
|
|
34405
34570
|
"nexus_audit_log",
|
|
34406
34571
|
{
|
|
34407
34572
|
id: text("id").primaryKey(),
|
|
34408
|
-
timestamp: text("timestamp").notNull().default(
|
|
34573
|
+
timestamp: text("timestamp").notNull().default(sql31`(datetime('now'))`),
|
|
34409
34574
|
action: text("action").notNull(),
|
|
34410
34575
|
projectHash: text("project_hash"),
|
|
34411
34576
|
/** @cross-db nexus.project_registry.project_id — intra-DB soft FK (kept here for symmetry with the audit-log shape). */
|
|
@@ -34532,7 +34697,7 @@ var init_nexus_schema = __esm({
|
|
|
34532
34697
|
* an import specifier cannot be resolved to a local file. */
|
|
34533
34698
|
isExternal: integer("is_external", { mode: "boolean" }).notNull().default(false),
|
|
34534
34699
|
/** ISO 8601 timestamp when this node was last indexed. */
|
|
34535
|
-
indexedAt: text("indexed_at").notNull().default(
|
|
34700
|
+
indexedAt: text("indexed_at").notNull().default(sql31`(datetime('now'))`)
|
|
34536
34701
|
},
|
|
34537
34702
|
(table) => [
|
|
34538
34703
|
// `idx_nexus_nodes_project` + the two `project_id`-leading composite indexes
|
|
@@ -34615,7 +34780,7 @@ var init_nexus_schema = __esm({
|
|
|
34615
34780
|
/** Step index within an execution flow (for step_in_process relations). */
|
|
34616
34781
|
step: integer("step"),
|
|
34617
34782
|
/** ISO 8601 timestamp when this relation was last indexed. */
|
|
34618
|
-
indexedAt: text("indexed_at").notNull().default(
|
|
34783
|
+
indexedAt: text("indexed_at").notNull().default(sql31`(datetime('now'))`)
|
|
34619
34784
|
// T998 plasticity columns (`weight`, `last_accessed_at`, `co_accessed_count`)
|
|
34620
34785
|
// were PARTITIONED out into the sibling `nexus_relation_weights` table by
|
|
34621
34786
|
// T11545 (ADR-090 §5.3) to keep the read-mostly structural graph row narrow
|
|
@@ -34678,9 +34843,9 @@ var init_nexus_schema = __esm({
|
|
|
34678
34843
|
/** Human-readable description. */
|
|
34679
34844
|
description: text("description"),
|
|
34680
34845
|
/** ISO 8601 timestamp when contract was extracted. */
|
|
34681
|
-
createdAt: text("created_at").notNull().default(
|
|
34846
|
+
createdAt: text("created_at").notNull().default(sql31`(datetime('now'))`),
|
|
34682
34847
|
/** ISO 8601 timestamp of last update. */
|
|
34683
|
-
updatedAt: text("updated_at").notNull().default(
|
|
34848
|
+
updatedAt: text("updated_at").notNull().default(sql31`(datetime('now'))`)
|
|
34684
34849
|
},
|
|
34685
34850
|
(table) => [
|
|
34686
34851
|
// `idx_nexus_contracts_project` + `idx_nexus_contracts_project_type` DROPPED
|
|
@@ -36526,7 +36691,7 @@ var init_experiments = __esm({
|
|
|
36526
36691
|
});
|
|
36527
36692
|
|
|
36528
36693
|
// packages/core/src/store/schema/goal.ts
|
|
36529
|
-
import { sql as
|
|
36694
|
+
import { sql as sql32 } from "drizzle-orm";
|
|
36530
36695
|
var tasksGoal;
|
|
36531
36696
|
var init_goal2 = __esm({
|
|
36532
36697
|
"packages/core/src/store/schema/goal.ts"() {
|
|
@@ -36564,7 +36729,7 @@ var init_goal2 = __esm({
|
|
|
36564
36729
|
* Append-only acceptance criteria (JSONB array of strings). Appended via
|
|
36565
36730
|
* the store's `appendCriteria`; read whole via `json(col)`.
|
|
36566
36731
|
*/
|
|
36567
|
-
criteria: jsonb2("criteria").notNull().default(
|
|
36732
|
+
criteria: jsonb2("criteria").notNull().default(sql32`jsonb('[]')`),
|
|
36568
36733
|
/** Current lifecycle status (GoalStatus). */
|
|
36569
36734
|
status: text("status").notNull().default("active"),
|
|
36570
36735
|
/** Hard turn cap before the loop abandons the goal. */
|
|
@@ -36760,6 +36925,7 @@ __export(tasks_schema_exports, {
|
|
|
36760
36925
|
COMMIT_FILE_CHANGE_TYPES: () => COMMIT_FILE_CHANGE_TYPES,
|
|
36761
36926
|
COMMIT_LINK_KINDS: () => COMMIT_LINK_KINDS,
|
|
36762
36927
|
COMMIT_LINK_SOURCES: () => COMMIT_LINK_SOURCES,
|
|
36928
|
+
DOCS_WIKILINK_RELATIONS: () => DOCS_WIKILINK_RELATIONS,
|
|
36763
36929
|
EVIDENCE_BINDING_TYPES: () => EVIDENCE_BINDING_TYPES,
|
|
36764
36930
|
EXTERNAL_LINK_TYPES: () => EXTERNAL_LINK_TYPES,
|
|
36765
36931
|
GATE_STATUSES: () => GATE_STATUSES,
|
|
@@ -36810,6 +36976,7 @@ __export(tasks_schema_exports, {
|
|
|
36810
36976
|
brainReleaseLinks: () => brainReleaseLinks,
|
|
36811
36977
|
commitFiles: () => commitFiles,
|
|
36812
36978
|
commits: () => commits,
|
|
36979
|
+
docsWikilinks: () => docsWikilinks,
|
|
36813
36980
|
evidenceAcBindings: () => tasksEvidenceAcBindings,
|
|
36814
36981
|
experiments: () => experiments,
|
|
36815
36982
|
externalTaskLinks: () => tasksExternalTaskLinks,
|
|
@@ -36863,7 +37030,7 @@ var init_tasks_schema = __esm({
|
|
|
36863
37030
|
});
|
|
36864
37031
|
|
|
36865
37032
|
// packages/core/src/store/db-helpers.ts
|
|
36866
|
-
import { eq as eq3, inArray as inArray2, sql as
|
|
37033
|
+
import { eq as eq3, inArray as inArray2, sql as sql33 } from "drizzle-orm";
|
|
36867
37034
|
async function upsertTask(db, row, archiveFields, allowOrphanParent = false) {
|
|
36868
37035
|
if (row.parentId) {
|
|
36869
37036
|
const parent = await db.select({ id: tasksTasks.id }).from(tasksTasks).where(eq3(tasksTasks.id, row.parentId)).limit(1).all();
|
|
@@ -37070,7 +37237,7 @@ __export(telemetry_schema_exports, {
|
|
|
37070
37237
|
telemetryEvents: () => telemetryEvents2,
|
|
37071
37238
|
telemetrySchemaMeta: () => telemetrySchemaMeta2
|
|
37072
37239
|
});
|
|
37073
|
-
import { sql as
|
|
37240
|
+
import { sql as sql34 } from "drizzle-orm";
|
|
37074
37241
|
var telemetryEvents2, telemetrySchemaMeta2;
|
|
37075
37242
|
var init_telemetry_schema = __esm({
|
|
37076
37243
|
"packages/core/src/store/schema/telemetry-schema.ts"() {
|
|
@@ -37098,7 +37265,7 @@ var init_telemetry_schema = __esm({
|
|
|
37098
37265
|
/** Machine-readable error code when exit_code != 0. NULL on success. */
|
|
37099
37266
|
errorCode: text("error_code"),
|
|
37100
37267
|
/** ISO-8601 timestamp of the invocation. */
|
|
37101
|
-
timestamp: text("timestamp").notNull().default(
|
|
37268
|
+
timestamp: text("timestamp").notNull().default(sql34`(datetime('now'))`)
|
|
37102
37269
|
},
|
|
37103
37270
|
(table) => [
|
|
37104
37271
|
index("idx_telemetry_command").on(table.command),
|
|
@@ -37403,7 +37570,7 @@ __export(skills_schema_exports, {
|
|
|
37403
37570
|
skillUsage: () => skillUsage,
|
|
37404
37571
|
skills: () => skills
|
|
37405
37572
|
});
|
|
37406
|
-
import { sql as
|
|
37573
|
+
import { sql as sql35 } from "drizzle-orm";
|
|
37407
37574
|
var skills, skillUsage, skillReviews, skillPatches;
|
|
37408
37575
|
var init_skills_schema = __esm({
|
|
37409
37576
|
"packages/core/src/store/schema/skills-schema.ts"() {
|
|
@@ -37458,7 +37625,7 @@ var init_skills_schema = __esm({
|
|
|
37458
37625
|
/** Foreign key (logical) to {@link skills}.name — denormalised for query speed. */
|
|
37459
37626
|
skillName: text("skill_name").notNull(),
|
|
37460
37627
|
/** ISO-8601 wall-clock timestamp of the load/invoke event. */
|
|
37461
|
-
observedAt: text("observed_at").notNull().default(
|
|
37628
|
+
observedAt: text("observed_at").notNull().default(sql35`(datetime('now'))`),
|
|
37462
37629
|
/** Event kind — `load`, `invoke`, `error`, etc. (free-form for now). */
|
|
37463
37630
|
eventKind: text("event_kind").notNull(),
|
|
37464
37631
|
/**
|
|
@@ -37499,7 +37666,7 @@ var init_skills_schema = __esm({
|
|
|
37499
37666
|
/** Foreign key (logical) to {@link skills}.name. */
|
|
37500
37667
|
skillName: text("skill_name").notNull(),
|
|
37501
37668
|
/** ISO-8601 timestamp of the review. */
|
|
37502
|
-
reviewedAt: text("reviewed_at").notNull().default(
|
|
37669
|
+
reviewedAt: text("reviewed_at").notNull().default(sql35`(datetime('now'))`),
|
|
37503
37670
|
/** Outcome verdict — see {@link SkillReviewOutcome}. */
|
|
37504
37671
|
outcome: text("outcome", {
|
|
37505
37672
|
enum: ["approved", "rejected", "needs-changes"]
|
|
@@ -37524,7 +37691,7 @@ var init_skills_schema = __esm({
|
|
|
37524
37691
|
/** Foreign key (logical) to {@link skills}.name. */
|
|
37525
37692
|
skillName: text("skill_name").notNull(),
|
|
37526
37693
|
/** ISO-8601 timestamp the patch was proposed. */
|
|
37527
|
-
proposedAt: text("proposed_at").notNull().default(
|
|
37694
|
+
proposedAt: text("proposed_at").notNull().default(sql35`(datetime('now'))`),
|
|
37528
37695
|
/** ISO-8601 timestamp the patch was applied (null while `status='proposed'`). */
|
|
37529
37696
|
appliedAt: text("applied_at"),
|
|
37530
37697
|
/** Optional foreign key (logical) to {@link skillReviews}.id that gated this patch. */
|
|
@@ -38304,7 +38471,7 @@ __export(registry_exports2, {
|
|
|
38304
38471
|
updateAgentStatus: () => updateAgentStatus
|
|
38305
38472
|
});
|
|
38306
38473
|
import { randomBytes } from "node:crypto";
|
|
38307
|
-
import { and as and4, eq as eq6, inArray as inArray3, lt as lt2, sql as
|
|
38474
|
+
import { and as and4, eq as eq6, inArray as inArray3, lt as lt2, sql as sql36 } from "drizzle-orm";
|
|
38308
38475
|
function generateAgentId() {
|
|
38309
38476
|
const now = /* @__PURE__ */ new Date();
|
|
38310
38477
|
const ts = now.toISOString().replace(/[-:T]/g, "").substring(0, 14);
|
|
@@ -38386,7 +38553,7 @@ async function updateAgentStatus(id, opts, cwd) {
|
|
|
38386
38553
|
}
|
|
38387
38554
|
async function incrementTasksCompleted(id, cwd) {
|
|
38388
38555
|
const db = await getDb(cwd);
|
|
38389
|
-
await db.update(agentInstances).set({ totalTasksCompleted:
|
|
38556
|
+
await db.update(agentInstances).set({ totalTasksCompleted: sql36`${agentInstances.totalTasksCompleted} + 1` }).where(eq6(agentInstances.id, id));
|
|
38390
38557
|
}
|
|
38391
38558
|
async function listAgentInstances(filters, cwd) {
|
|
38392
38559
|
const db = await getDb(cwd);
|
|
@@ -38532,7 +38699,7 @@ __export(sqlite_data_accessor_exports, {
|
|
|
38532
38699
|
createSqliteDataAccessor: () => createSqliteDataAccessor,
|
|
38533
38700
|
setMetaValue: () => setMetaValue
|
|
38534
38701
|
});
|
|
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
|
|
38702
|
+
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
38703
|
function generateAuditLogId() {
|
|
38537
38704
|
const epoch = Math.floor(Date.now() / 1e3);
|
|
38538
38705
|
const rand = Math.random().toString(36).slice(2, 8);
|
|
@@ -38689,7 +38856,7 @@ async function createSqliteDataAccessor(cwd) {
|
|
|
38689
38856
|
conditions.push(inArray4(auditLog.action, [...query.actions]));
|
|
38690
38857
|
}
|
|
38691
38858
|
if (query.since) {
|
|
38692
|
-
conditions.push(
|
|
38859
|
+
conditions.push(sql37`${auditLog.timestamp} >= ${query.since}`);
|
|
38693
38860
|
}
|
|
38694
38861
|
const limit = Math.max(1, Math.floor(query.limit ?? 100));
|
|
38695
38862
|
const rows = await db.select({
|
|
@@ -38701,7 +38868,7 @@ async function createSqliteDataAccessor(cwd) {
|
|
|
38701
38868
|
detailsJson: auditLog.detailsJson,
|
|
38702
38869
|
beforeJson: auditLog.beforeJson,
|
|
38703
38870
|
afterJson: auditLog.afterJson
|
|
38704
|
-
}).from(auditLog).where(conditions.length > 0 ? and5(...conditions) : void 0).orderBy(
|
|
38871
|
+
}).from(auditLog).where(conditions.length > 0 ? and5(...conditions) : void 0).orderBy(sql37`${auditLog.timestamp} DESC`).limit(limit).all();
|
|
38705
38872
|
return rows.map((row) => ({
|
|
38706
38873
|
id: row.id,
|
|
38707
38874
|
timestamp: row.timestamp,
|
|
@@ -38864,7 +39031,7 @@ async function createSqliteDataAccessor(cwd) {
|
|
|
38864
39031
|
},
|
|
38865
39032
|
async getActiveSession() {
|
|
38866
39033
|
const db = await getDb(cwd);
|
|
38867
|
-
const rows = await db.select().from(tasksSessions).where(eq7(tasksSessions.status, "active")).orderBy(
|
|
39034
|
+
const rows = await db.select().from(tasksSessions).where(eq7(tasksSessions.status, "active")).orderBy(sql37`${tasksSessions.startedAt} DESC`).limit(1).all();
|
|
38868
39035
|
if (rows.length === 0 || !rows[0]) return null;
|
|
38869
39036
|
return rowToSession(rows[0]);
|
|
38870
39037
|
},
|
|
@@ -38920,24 +39087,24 @@ async function createSqliteDataAccessor(cwd) {
|
|
|
38920
39087
|
conditions.push(inArray4(tasksTasks.id, labelMatchIds));
|
|
38921
39088
|
}
|
|
38922
39089
|
const where = conditions.length > 0 ? and5(...conditions) : void 0;
|
|
38923
|
-
const countResult = await db.select({ count:
|
|
39090
|
+
const countResult = await db.select({ count: sql37`count(*)` }).from(tasksTasks).where(where).get();
|
|
38924
39091
|
const total = countResult?.count ?? 0;
|
|
38925
39092
|
let orderClause;
|
|
38926
39093
|
switch (filters.orderBy) {
|
|
38927
39094
|
case "createdAt":
|
|
38928
|
-
orderClause =
|
|
39095
|
+
orderClause = sql37`${tasksTasks.createdAt} ASC`;
|
|
38929
39096
|
break;
|
|
38930
39097
|
case "updatedAt":
|
|
38931
|
-
orderClause =
|
|
39098
|
+
orderClause = sql37`${tasksTasks.updatedAt} DESC NULLS LAST`;
|
|
38932
39099
|
break;
|
|
38933
39100
|
case "priority": {
|
|
38934
|
-
orderClause =
|
|
39101
|
+
orderClause = sql37`CASE ${tasksTasks.priority}
|
|
38935
39102
|
WHEN 'critical' THEN 0 WHEN 'high' THEN 1
|
|
38936
39103
|
WHEN 'medium' THEN 2 WHEN 'low' THEN 3 ELSE 4 END ASC`;
|
|
38937
39104
|
break;
|
|
38938
39105
|
}
|
|
38939
39106
|
default:
|
|
38940
|
-
orderClause =
|
|
39107
|
+
orderClause = sql37`${tasksTasks.position} ASC, ${tasksTasks.createdAt} ASC`;
|
|
38941
39108
|
}
|
|
38942
39109
|
let query = db.select().from(tasksTasks).where(where).orderBy(orderClause);
|
|
38943
39110
|
if (filters.limit !== void 0) {
|
|
@@ -38968,12 +39135,12 @@ async function createSqliteDataAccessor(cwd) {
|
|
|
38968
39135
|
conditions.push(eq7(tasksTasks.parentId, filters.parentId));
|
|
38969
39136
|
}
|
|
38970
39137
|
const where = conditions.length > 0 ? and5(...conditions) : void 0;
|
|
38971
|
-
const result = await db.select({ count:
|
|
39138
|
+
const result = await db.select({ count: sql37`count(*)` }).from(tasksTasks).where(where).get();
|
|
38972
39139
|
return result?.count ?? 0;
|
|
38973
39140
|
},
|
|
38974
39141
|
async getChildren(parentId) {
|
|
38975
39142
|
const db = await getDb(cwd);
|
|
38976
|
-
const rows = await db.select().from(tasksTasks).where(and5(eq7(tasksTasks.parentId, parentId), ne2(tasksTasks.status, "archived"))).orderBy(
|
|
39143
|
+
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
39144
|
const tasks2 = rows.map(rowToTask);
|
|
38978
39145
|
if (tasks2.length > 0) {
|
|
38979
39146
|
const allIds = await getAllTaskIds();
|
|
@@ -38984,12 +39151,12 @@ async function createSqliteDataAccessor(cwd) {
|
|
|
38984
39151
|
},
|
|
38985
39152
|
async countChildren(parentId) {
|
|
38986
39153
|
const db = await getDb(cwd);
|
|
38987
|
-
const result = await db.select({ count:
|
|
39154
|
+
const result = await db.select({ count: sql37`count(*)` }).from(tasksTasks).where(and5(eq7(tasksTasks.parentId, parentId), ne2(tasksTasks.status, "archived"))).get();
|
|
38988
39155
|
return result?.count ?? 0;
|
|
38989
39156
|
},
|
|
38990
39157
|
async countActiveChildren(parentId) {
|
|
38991
39158
|
const db = await getDb(cwd);
|
|
38992
|
-
const result = await db.select({ count:
|
|
39159
|
+
const result = await db.select({ count: sql37`count(*)` }).from(tasksTasks).where(
|
|
38993
39160
|
and5(
|
|
38994
39161
|
eq7(tasksTasks.parentId, parentId),
|
|
38995
39162
|
notInArray2(tasksTasks.status, [...TERMINAL_TASK_STATUSES])
|
|
@@ -39207,7 +39374,7 @@ async function createSqliteDataAccessor(cwd) {
|
|
|
39207
39374
|
await accessor.updateTaskFields(taskId, flds);
|
|
39208
39375
|
},
|
|
39209
39376
|
async getChildren(parentId) {
|
|
39210
|
-
const rows = await db.select().from(tasksTasks).where(and5(eq7(tasksTasks.parentId, parentId), ne2(tasksTasks.status, "archived"))).orderBy(
|
|
39377
|
+
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
39378
|
return rows.map(rowToTask);
|
|
39212
39379
|
},
|
|
39213
39380
|
async appendLog(entry) {
|
|
@@ -40252,7 +40419,7 @@ __export(memory_accessor_exports, {
|
|
|
40252
40419
|
logConsolidationComplete: () => logConsolidationComplete,
|
|
40253
40420
|
logConsolidationStart: () => logConsolidationStart
|
|
40254
40421
|
});
|
|
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
|
|
40422
|
+
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
40423
|
async function getBrainAccessor(cwd) {
|
|
40257
40424
|
const db = await getBrainDb(cwd);
|
|
40258
40425
|
return new BrainDataAccessor(db);
|
|
@@ -40339,7 +40506,7 @@ var init_memory_accessor = __esm({
|
|
|
40339
40506
|
* @task T11552
|
|
40340
40507
|
*/
|
|
40341
40508
|
async addDecisionWithSequentialId(row) {
|
|
40342
|
-
const nextId =
|
|
40509
|
+
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
40510
|
const inserted = await this.db.insert(brainDecisions).values({ ...row, id: nextId }).returning();
|
|
40344
40511
|
return inserted[0];
|
|
40345
40512
|
}
|
|
@@ -40585,7 +40752,7 @@ var init_memory_accessor = __esm({
|
|
|
40585
40752
|
}
|
|
40586
40753
|
if (params.tags && params.tags.length > 0) {
|
|
40587
40754
|
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(
|
|
40755
|
+
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
40756
|
conditions.push(inArray5(brainStickyNotes.id, matchingIds));
|
|
40590
40757
|
}
|
|
40591
40758
|
let query = this.db.select().from(brainStickyNotes).orderBy(desc2(brainStickyNotes.createdAt));
|
|
@@ -40683,7 +40850,7 @@ var init_memory_accessor = __esm({
|
|
|
40683
40850
|
}
|
|
40684
40851
|
if (params.tags && params.tags.length > 0) {
|
|
40685
40852
|
const wanted = [...new Set(params.tags)];
|
|
40686
|
-
const matchingIds = this.db.select({ id:
|
|
40853
|
+
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
40854
|
conditions.push(inArray5(t.id, matchingIds));
|
|
40688
40855
|
}
|
|
40689
40856
|
const where = conditions.length > 0 ? and6(...conditions) : void 0;
|
|
@@ -40711,9 +40878,9 @@ var init_memory_accessor = __esm({
|
|
|
40711
40878
|
if (decayed) clauses.push(decayed);
|
|
40712
40879
|
}
|
|
40713
40880
|
const where = clauses.length === 1 ? clauses[0] : or4(...clauses);
|
|
40714
|
-
const before = await this.db.select({ id: t.id }).from(t).where(where ??
|
|
40881
|
+
const before = await this.db.select({ id: t.id }).from(t).where(where ?? sql38`0`);
|
|
40715
40882
|
if (before.length === 0) return 0;
|
|
40716
|
-
await this.db.update(t).set({ status: "discarded" }).where(where ??
|
|
40883
|
+
await this.db.update(t).set({ status: "discarded" }).where(where ?? sql38`0`);
|
|
40717
40884
|
return before.length;
|
|
40718
40885
|
}
|
|
40719
40886
|
/**
|
|
@@ -40744,7 +40911,7 @@ var init_memory_accessor = __esm({
|
|
|
40744
40911
|
// Whole-value JSONB read — emits canonical TEXT, parsed to string[].
|
|
40745
40912
|
// Wrap the column in `sql` so the jsonbText helper receives an SQL
|
|
40746
40913
|
// expression (its param type is SQL | SQL.Aliased, not a column).
|
|
40747
|
-
tags: jsonbText(
|
|
40914
|
+
tags: jsonbText(sql38`${t.tags}`),
|
|
40748
40915
|
createdAt: t.createdAt,
|
|
40749
40916
|
expiresAt: t.expiresAt,
|
|
40750
40917
|
decayScore: t.decayScore,
|