@cleocode/adapters 2026.5.112 → 2026.5.114
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +816 -286
- package/dist/index.js.map +3 -3
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -830,6 +830,63 @@ var init_cli_category = __esm({
|
|
|
830
830
|
}
|
|
831
831
|
});
|
|
832
832
|
|
|
833
|
+
// packages/contracts/src/config/manifest.ts
|
|
834
|
+
import { z as z4 } from "zod";
|
|
835
|
+
var PROJECT_INFO_MANIFEST, PROJECT_CONTEXT_MANIFEST, CLEO_CONFIG_MANIFEST, GLOBAL_CLEO_CONFIG_MANIFEST, CONFIG_MANIFEST_ENTRIES, configManifestEntrySchema;
|
|
836
|
+
var init_manifest = __esm({
|
|
837
|
+
"packages/contracts/src/config/manifest.ts"() {
|
|
838
|
+
"use strict";
|
|
839
|
+
PROJECT_INFO_MANIFEST = {
|
|
840
|
+
id: "project-info",
|
|
841
|
+
scope: "metadata",
|
|
842
|
+
path: ".cleo/project-info.json",
|
|
843
|
+
mergePrecedence: 0,
|
|
844
|
+
driftDetection: "schema-validate"
|
|
845
|
+
};
|
|
846
|
+
PROJECT_CONTEXT_MANIFEST = {
|
|
847
|
+
id: "project-context",
|
|
848
|
+
scope: "metadata",
|
|
849
|
+
path: ".cleo/project-context.json",
|
|
850
|
+
mergePrecedence: 0,
|
|
851
|
+
driftDetection: "staleness-gate"
|
|
852
|
+
};
|
|
853
|
+
CLEO_CONFIG_MANIFEST = {
|
|
854
|
+
id: "cleo-config-project",
|
|
855
|
+
scope: "project",
|
|
856
|
+
path: ".cleo/config.json",
|
|
857
|
+
mergePrecedence: 20,
|
|
858
|
+
driftDetection: "schema-validate"
|
|
859
|
+
};
|
|
860
|
+
GLOBAL_CLEO_CONFIG_MANIFEST = {
|
|
861
|
+
id: "cleo-config-global",
|
|
862
|
+
scope: "global",
|
|
863
|
+
path: "~/.cleo/config.json",
|
|
864
|
+
mergePrecedence: 10,
|
|
865
|
+
driftDetection: "schema-validate"
|
|
866
|
+
};
|
|
867
|
+
CONFIG_MANIFEST_ENTRIES = Object.freeze([
|
|
868
|
+
PROJECT_INFO_MANIFEST,
|
|
869
|
+
PROJECT_CONTEXT_MANIFEST,
|
|
870
|
+
GLOBAL_CLEO_CONFIG_MANIFEST,
|
|
871
|
+
CLEO_CONFIG_MANIFEST
|
|
872
|
+
]);
|
|
873
|
+
configManifestEntrySchema = z4.object({
|
|
874
|
+
id: z4.string().min(1),
|
|
875
|
+
scope: z4.union([z4.literal("global"), z4.literal("project"), z4.literal("metadata")]),
|
|
876
|
+
path: z4.string().min(1),
|
|
877
|
+
schema: z4.unknown().optional(),
|
|
878
|
+
mergePrecedence: z4.number().int().nonnegative(),
|
|
879
|
+
driftDetection: z4.union([
|
|
880
|
+
z4.literal("schema-validate"),
|
|
881
|
+
z4.literal("staleness-gate"),
|
|
882
|
+
z4.literal("value-diff"),
|
|
883
|
+
z4.literal("none")
|
|
884
|
+
]),
|
|
885
|
+
defaults: z4.record(z4.string(), z4.unknown()).optional()
|
|
886
|
+
});
|
|
887
|
+
}
|
|
888
|
+
});
|
|
889
|
+
|
|
833
890
|
// packages/contracts/src/credentials.ts
|
|
834
891
|
function parseClaudeCodeCredentials(buf) {
|
|
835
892
|
try {
|
|
@@ -1058,6 +1115,100 @@ var init_operations_registry = __esm({
|
|
|
1058
1115
|
}
|
|
1059
1116
|
});
|
|
1060
1117
|
|
|
1118
|
+
// packages/contracts/src/docs/provenance.ts
|
|
1119
|
+
import { z as z5 } from "zod";
|
|
1120
|
+
var PROVENANCE_NODE_KINDS, PROVENANCE_EDGE_RELATIONS, DOC_LIFECYCLE_STATUSES, provenanceNodeKindSchema, provenanceEdgeRelationSchema, docLifecycleStatusSchema, provenanceNodeBaseFields, provenanceDocNodeSchema, provenanceTaskNodeSchema, provenanceDecisionNodeSchema, provenanceSessionNodeSchema, provenanceMemoryNodeSchema, provenanceNodeSchema, provenanceEdgeSchema, docProvenanceResponseSchema;
|
|
1121
|
+
var init_provenance = __esm({
|
|
1122
|
+
"packages/contracts/src/docs/provenance.ts"() {
|
|
1123
|
+
"use strict";
|
|
1124
|
+
PROVENANCE_NODE_KINDS = [
|
|
1125
|
+
"doc",
|
|
1126
|
+
"task",
|
|
1127
|
+
"decision",
|
|
1128
|
+
"session",
|
|
1129
|
+
"memory"
|
|
1130
|
+
];
|
|
1131
|
+
PROVENANCE_EDGE_RELATIONS = [
|
|
1132
|
+
"attached-to",
|
|
1133
|
+
"supersedes",
|
|
1134
|
+
"superseded-by",
|
|
1135
|
+
"related-task",
|
|
1136
|
+
"linked-decision",
|
|
1137
|
+
"derived-from"
|
|
1138
|
+
];
|
|
1139
|
+
DOC_LIFECYCLE_STATUSES = [
|
|
1140
|
+
"active",
|
|
1141
|
+
"superseded",
|
|
1142
|
+
"archived",
|
|
1143
|
+
"draft"
|
|
1144
|
+
];
|
|
1145
|
+
provenanceNodeKindSchema = z5.enum(PROVENANCE_NODE_KINDS);
|
|
1146
|
+
provenanceEdgeRelationSchema = z5.enum(PROVENANCE_EDGE_RELATIONS);
|
|
1147
|
+
docLifecycleStatusSchema = z5.enum(DOC_LIFECYCLE_STATUSES);
|
|
1148
|
+
provenanceNodeBaseFields = {
|
|
1149
|
+
id: z5.string().min(1),
|
|
1150
|
+
title: z5.string().min(1),
|
|
1151
|
+
metadata: z5.record(z5.string(), z5.unknown()).optional()
|
|
1152
|
+
};
|
|
1153
|
+
provenanceDocNodeSchema = z5.object({
|
|
1154
|
+
...provenanceNodeBaseFields,
|
|
1155
|
+
kind: z5.literal("doc"),
|
|
1156
|
+
slug: z5.string().min(1),
|
|
1157
|
+
docKind: z5.string().min(1),
|
|
1158
|
+
lifecycleStatus: docLifecycleStatusSchema,
|
|
1159
|
+
publishedAt: z5.string().min(1),
|
|
1160
|
+
supersededAt: z5.string().min(1).optional(),
|
|
1161
|
+
summary: z5.string().optional()
|
|
1162
|
+
});
|
|
1163
|
+
provenanceTaskNodeSchema = z5.object({
|
|
1164
|
+
...provenanceNodeBaseFields,
|
|
1165
|
+
kind: z5.literal("task"),
|
|
1166
|
+
taskType: z5.enum(["saga", "epic", "task", "subtask"]),
|
|
1167
|
+
status: z5.enum(["pending", "in_progress", "done", "blocked", "cancelled", "archived"])
|
|
1168
|
+
});
|
|
1169
|
+
provenanceDecisionNodeSchema = z5.object({
|
|
1170
|
+
...provenanceNodeBaseFields,
|
|
1171
|
+
kind: z5.literal("decision"),
|
|
1172
|
+
outcome: z5.enum(["proposed", "accepted", "rejected", "superseded"]),
|
|
1173
|
+
decidedAt: z5.string().min(1)
|
|
1174
|
+
});
|
|
1175
|
+
provenanceSessionNodeSchema = z5.object({
|
|
1176
|
+
...provenanceNodeBaseFields,
|
|
1177
|
+
kind: z5.literal("session"),
|
|
1178
|
+
startedAt: z5.string().min(1),
|
|
1179
|
+
endedAt: z5.string().min(1).optional()
|
|
1180
|
+
});
|
|
1181
|
+
provenanceMemoryNodeSchema = z5.object({
|
|
1182
|
+
...provenanceNodeBaseFields,
|
|
1183
|
+
kind: z5.literal("memory"),
|
|
1184
|
+
memoryType: z5.enum(["observation", "pattern", "decision", "diary"]),
|
|
1185
|
+
recordedAt: z5.string().min(1)
|
|
1186
|
+
});
|
|
1187
|
+
provenanceNodeSchema = z5.discriminatedUnion("kind", [
|
|
1188
|
+
provenanceDocNodeSchema,
|
|
1189
|
+
provenanceTaskNodeSchema,
|
|
1190
|
+
provenanceDecisionNodeSchema,
|
|
1191
|
+
provenanceSessionNodeSchema,
|
|
1192
|
+
provenanceMemoryNodeSchema
|
|
1193
|
+
]);
|
|
1194
|
+
provenanceEdgeSchema = z5.object({
|
|
1195
|
+
relation: provenanceEdgeRelationSchema,
|
|
1196
|
+
from: z5.string().min(1),
|
|
1197
|
+
fromKind: provenanceNodeKindSchema,
|
|
1198
|
+
to: z5.string().min(1),
|
|
1199
|
+
toKind: provenanceNodeKindSchema,
|
|
1200
|
+
addedAt: z5.string().min(1),
|
|
1201
|
+
summary: z5.string().optional()
|
|
1202
|
+
});
|
|
1203
|
+
docProvenanceResponseSchema = z5.object({
|
|
1204
|
+
nodes: z5.array(provenanceNodeSchema).readonly(),
|
|
1205
|
+
edges: z5.array(provenanceEdgeSchema).readonly(),
|
|
1206
|
+
totalNodes: z5.number().int().nonnegative(),
|
|
1207
|
+
totalEdges: z5.number().int().nonnegative()
|
|
1208
|
+
});
|
|
1209
|
+
}
|
|
1210
|
+
});
|
|
1211
|
+
|
|
1061
1212
|
// packages/contracts/src/docs-taxonomy.ts
|
|
1062
1213
|
var BUILTIN_DOC_KINDS, BUILTIN_DOC_KIND_VALUES;
|
|
1063
1214
|
var init_docs_taxonomy = __esm({
|
|
@@ -1071,7 +1222,8 @@ var init_docs_taxonomy = __esm({
|
|
|
1071
1222
|
defaultOwnerKind: "task",
|
|
1072
1223
|
publishDir: "docs/adr",
|
|
1073
1224
|
requiresEntityId: true,
|
|
1074
|
-
entityIdPattern: /^adr-\d{3,4}-[a-z0-9-]
|
|
1225
|
+
entityIdPattern: /^adr-\d{3,4}-[a-z0-9-]+$/,
|
|
1226
|
+
requiredSections: ["Status", "Date", "Context", "Decision", "Consequences"]
|
|
1075
1227
|
},
|
|
1076
1228
|
{
|
|
1077
1229
|
kind: "spec",
|
|
@@ -1079,7 +1231,8 @@ var init_docs_taxonomy = __esm({
|
|
|
1079
1231
|
description: "Technical specification",
|
|
1080
1232
|
defaultOwnerKind: "task",
|
|
1081
1233
|
publishDir: "docs/spec",
|
|
1082
|
-
requiresEntityId: false
|
|
1234
|
+
requiresEntityId: false,
|
|
1235
|
+
requiredSections: ["Goal", "Non-Goals", "Requirements", "Out-of-Scope"]
|
|
1083
1236
|
},
|
|
1084
1237
|
{
|
|
1085
1238
|
kind: "research",
|
|
@@ -1087,7 +1240,8 @@ var init_docs_taxonomy = __esm({
|
|
|
1087
1240
|
description: "Investigation / research note",
|
|
1088
1241
|
defaultOwnerKind: "task",
|
|
1089
1242
|
publishDir: "docs/research",
|
|
1090
|
-
requiresEntityId: false
|
|
1243
|
+
requiresEntityId: false,
|
|
1244
|
+
requiredSections: ["Question", "Findings", "Sources"]
|
|
1091
1245
|
},
|
|
1092
1246
|
{
|
|
1093
1247
|
kind: "handoff",
|
|
@@ -1095,7 +1249,8 @@ var init_docs_taxonomy = __esm({
|
|
|
1095
1249
|
description: "Session / agent handoff",
|
|
1096
1250
|
defaultOwnerKind: "session",
|
|
1097
1251
|
publishDir: "docs/handoff",
|
|
1098
|
-
requiresEntityId: false
|
|
1252
|
+
requiresEntityId: false,
|
|
1253
|
+
requiredSections: ["Context", "State", "Next-Steps"]
|
|
1099
1254
|
},
|
|
1100
1255
|
{
|
|
1101
1256
|
kind: "note",
|
|
@@ -1103,7 +1258,8 @@ var init_docs_taxonomy = __esm({
|
|
|
1103
1258
|
description: "Agent observation / informal note",
|
|
1104
1259
|
defaultOwnerKind: "observation",
|
|
1105
1260
|
publishDir: "docs/note",
|
|
1106
|
-
requiresEntityId: false
|
|
1261
|
+
requiresEntityId: false,
|
|
1262
|
+
requiredSections: []
|
|
1107
1263
|
},
|
|
1108
1264
|
{
|
|
1109
1265
|
kind: "llm-readme",
|
|
@@ -1111,7 +1267,8 @@ var init_docs_taxonomy = __esm({
|
|
|
1111
1267
|
description: "Machine-readable README (llms.txt)",
|
|
1112
1268
|
defaultOwnerKind: "project",
|
|
1113
1269
|
publishDir: ".",
|
|
1114
|
-
requiresEntityId: false
|
|
1270
|
+
requiresEntityId: false,
|
|
1271
|
+
requiredSections: []
|
|
1115
1272
|
},
|
|
1116
1273
|
{
|
|
1117
1274
|
kind: "changeset",
|
|
@@ -1120,7 +1277,8 @@ var init_docs_taxonomy = __esm({
|
|
|
1120
1277
|
defaultOwnerKind: "task",
|
|
1121
1278
|
publishDir: ".changeset",
|
|
1122
1279
|
requiresEntityId: true,
|
|
1123
|
-
entityIdPattern: /^t\d+-[a-z0-9-]
|
|
1280
|
+
entityIdPattern: /^t\d+-[a-z0-9-]+$/,
|
|
1281
|
+
requiredSections: []
|
|
1124
1282
|
},
|
|
1125
1283
|
{
|
|
1126
1284
|
kind: "release-note",
|
|
@@ -1129,7 +1287,8 @@ var init_docs_taxonomy = __esm({
|
|
|
1129
1287
|
defaultOwnerKind: "project",
|
|
1130
1288
|
publishDir: "docs/release",
|
|
1131
1289
|
requiresEntityId: true,
|
|
1132
|
-
entityIdPattern: /^v\d{4}\.\d+\.\d+(-[a-z0-9-]+)
|
|
1290
|
+
entityIdPattern: /^v\d{4}\.\d+\.\d+(-[a-z0-9-]+)?$/,
|
|
1291
|
+
requiredSections: ["Changes", "Migration"]
|
|
1133
1292
|
},
|
|
1134
1293
|
{
|
|
1135
1294
|
kind: "plan",
|
|
@@ -1137,7 +1296,8 @@ var init_docs_taxonomy = __esm({
|
|
|
1137
1296
|
description: "Epic / saga decomposition plan",
|
|
1138
1297
|
defaultOwnerKind: "task",
|
|
1139
1298
|
publishDir: "docs/plan",
|
|
1140
|
-
requiresEntityId: false
|
|
1299
|
+
requiresEntityId: false,
|
|
1300
|
+
requiredSections: ["Goal", "Steps", "Owners"]
|
|
1141
1301
|
},
|
|
1142
1302
|
{
|
|
1143
1303
|
kind: "rcasd",
|
|
@@ -1146,7 +1306,8 @@ var init_docs_taxonomy = __esm({
|
|
|
1146
1306
|
defaultOwnerKind: "task",
|
|
1147
1307
|
publishDir: ".cleo/rcasd",
|
|
1148
1308
|
requiresEntityId: true,
|
|
1149
|
-
entityIdPattern: /^t\d+(-.+)
|
|
1309
|
+
entityIdPattern: /^t\d+(-.+)?$/,
|
|
1310
|
+
requiredSections: ["Root-Cause", "Action", "Schedule", "Detection"]
|
|
1150
1311
|
}
|
|
1151
1312
|
];
|
|
1152
1313
|
BUILTIN_DOC_KIND_VALUES = Object.freeze(
|
|
@@ -1197,54 +1358,54 @@ var init_errors = __esm({
|
|
|
1197
1358
|
});
|
|
1198
1359
|
|
|
1199
1360
|
// packages/contracts/src/evidence-atom-schema.ts
|
|
1200
|
-
import { z as
|
|
1361
|
+
import { z as z6 } from "zod";
|
|
1201
1362
|
var commitAtomSchema, filesAtomSchema, testRunAtomSchema, toolAtomSchema, urlAtomSchema, noteAtomSchema, decisionAtomSchema, prAtomSchema, locDropAtomSchema, callsiteCoverageAtomSchema, EvidenceAtomSchema, GATE_EVIDENCE_REQUIREMENTS;
|
|
1202
1363
|
var init_evidence_atom_schema = __esm({
|
|
1203
1364
|
"packages/contracts/src/evidence-atom-schema.ts"() {
|
|
1204
1365
|
"use strict";
|
|
1205
|
-
commitAtomSchema =
|
|
1206
|
-
kind:
|
|
1207
|
-
sha:
|
|
1366
|
+
commitAtomSchema = z6.object({
|
|
1367
|
+
kind: z6.literal("commit"),
|
|
1368
|
+
sha: z6.string().regex(/^[0-9a-f]{7,40}$/i, "commit sha must be 7-40 hex characters")
|
|
1208
1369
|
});
|
|
1209
|
-
filesAtomSchema =
|
|
1210
|
-
kind:
|
|
1211
|
-
paths:
|
|
1370
|
+
filesAtomSchema = z6.object({
|
|
1371
|
+
kind: z6.literal("files"),
|
|
1372
|
+
paths: z6.array(z6.string().min(1)).min(1, "files atom requires at least one path")
|
|
1212
1373
|
});
|
|
1213
|
-
testRunAtomSchema =
|
|
1214
|
-
kind:
|
|
1215
|
-
path:
|
|
1374
|
+
testRunAtomSchema = z6.object({
|
|
1375
|
+
kind: z6.literal("test-run"),
|
|
1376
|
+
path: z6.string().min(1, "test-run atom requires a non-empty path")
|
|
1216
1377
|
});
|
|
1217
|
-
toolAtomSchema =
|
|
1218
|
-
kind:
|
|
1219
|
-
tool:
|
|
1378
|
+
toolAtomSchema = z6.object({
|
|
1379
|
+
kind: z6.literal("tool"),
|
|
1380
|
+
tool: z6.string().min(1, "tool atom requires a non-empty tool name")
|
|
1220
1381
|
});
|
|
1221
|
-
urlAtomSchema =
|
|
1222
|
-
kind:
|
|
1223
|
-
url:
|
|
1382
|
+
urlAtomSchema = z6.object({
|
|
1383
|
+
kind: z6.literal("url"),
|
|
1384
|
+
url: z6.string().min(1).regex(/^https?:\/\//, "url atom must start with http:// or https://")
|
|
1224
1385
|
});
|
|
1225
|
-
noteAtomSchema =
|
|
1226
|
-
kind:
|
|
1227
|
-
note:
|
|
1386
|
+
noteAtomSchema = z6.object({
|
|
1387
|
+
kind: z6.literal("note"),
|
|
1388
|
+
note: z6.string().min(1, "note atom must be non-empty").max(512, "note atom is too long (max 512 chars)")
|
|
1228
1389
|
});
|
|
1229
|
-
decisionAtomSchema =
|
|
1230
|
-
kind:
|
|
1231
|
-
decisionId:
|
|
1390
|
+
decisionAtomSchema = z6.object({
|
|
1391
|
+
kind: z6.literal("decision"),
|
|
1392
|
+
decisionId: z6.string().min(1, "decision atom requires a non-empty decision ID")
|
|
1232
1393
|
});
|
|
1233
|
-
prAtomSchema =
|
|
1234
|
-
kind:
|
|
1235
|
-
prNumber:
|
|
1394
|
+
prAtomSchema = z6.object({
|
|
1395
|
+
kind: z6.literal("pr"),
|
|
1396
|
+
prNumber: z6.number().int().positive("pr atom requires a positive integer PR number")
|
|
1236
1397
|
});
|
|
1237
|
-
locDropAtomSchema =
|
|
1238
|
-
kind:
|
|
1239
|
-
fromLines:
|
|
1240
|
-
toLines:
|
|
1398
|
+
locDropAtomSchema = z6.object({
|
|
1399
|
+
kind: z6.literal("loc-drop"),
|
|
1400
|
+
fromLines: z6.number().int().nonnegative("loc-drop fromLines must be \u2265 0"),
|
|
1401
|
+
toLines: z6.number().int().nonnegative("loc-drop toLines must be \u2265 0")
|
|
1241
1402
|
});
|
|
1242
|
-
callsiteCoverageAtomSchema =
|
|
1243
|
-
kind:
|
|
1244
|
-
symbolName:
|
|
1245
|
-
relativeSourcePath:
|
|
1403
|
+
callsiteCoverageAtomSchema = z6.object({
|
|
1404
|
+
kind: z6.literal("callsite-coverage"),
|
|
1405
|
+
symbolName: z6.string().min(1, "callsite-coverage atom requires a non-empty symbolName"),
|
|
1406
|
+
relativeSourcePath: z6.string().min(1, "callsite-coverage atom requires a non-empty relativeSourcePath")
|
|
1246
1407
|
});
|
|
1247
|
-
EvidenceAtomSchema =
|
|
1408
|
+
EvidenceAtomSchema = z6.discriminatedUnion("kind", [
|
|
1248
1409
|
commitAtomSchema,
|
|
1249
1410
|
filesAtomSchema,
|
|
1250
1411
|
testRunAtomSchema,
|
|
@@ -1277,58 +1438,58 @@ var init_evidence_atom_schema = __esm({
|
|
|
1277
1438
|
});
|
|
1278
1439
|
|
|
1279
1440
|
// packages/contracts/src/evidence-record-schema.ts
|
|
1280
|
-
import { z as
|
|
1441
|
+
import { z as z7 } from "zod";
|
|
1281
1442
|
var evidenceBaseSchema, implDiffRecordSchema, validateSpecCheckRecordSchema, testOutputRecordSchema, lintReportRecordSchema, commandOutputRecordSchema, evidenceRecordSchema;
|
|
1282
1443
|
var init_evidence_record_schema = __esm({
|
|
1283
1444
|
"packages/contracts/src/evidence-record-schema.ts"() {
|
|
1284
1445
|
"use strict";
|
|
1285
|
-
evidenceBaseSchema =
|
|
1446
|
+
evidenceBaseSchema = z7.object({
|
|
1286
1447
|
/** Identity string of the agent that produced this record. */
|
|
1287
|
-
agentIdentity:
|
|
1448
|
+
agentIdentity: z7.string().min(1),
|
|
1288
1449
|
/** SHA-256 hex digest (64 chars) of the attached artifact. */
|
|
1289
|
-
attachmentSha256:
|
|
1450
|
+
attachmentSha256: z7.string().length(64),
|
|
1290
1451
|
/** ISO 8601 timestamp at which the action ran. */
|
|
1291
|
-
ranAt:
|
|
1452
|
+
ranAt: z7.string().datetime(),
|
|
1292
1453
|
/** Wall-clock duration of the action in milliseconds. */
|
|
1293
|
-
durationMs:
|
|
1454
|
+
durationMs: z7.number().nonnegative()
|
|
1294
1455
|
});
|
|
1295
1456
|
implDiffRecordSchema = evidenceBaseSchema.extend({
|
|
1296
|
-
kind:
|
|
1297
|
-
phase:
|
|
1298
|
-
filesChanged:
|
|
1299
|
-
linesAdded:
|
|
1300
|
-
linesRemoved:
|
|
1457
|
+
kind: z7.literal("impl-diff"),
|
|
1458
|
+
phase: z7.literal("implement"),
|
|
1459
|
+
filesChanged: z7.array(z7.string().min(1)).min(1),
|
|
1460
|
+
linesAdded: z7.number().int().nonnegative(),
|
|
1461
|
+
linesRemoved: z7.number().int().nonnegative()
|
|
1301
1462
|
});
|
|
1302
1463
|
validateSpecCheckRecordSchema = evidenceBaseSchema.extend({
|
|
1303
|
-
kind:
|
|
1304
|
-
phase:
|
|
1305
|
-
reqIdsChecked:
|
|
1306
|
-
passed:
|
|
1307
|
-
details:
|
|
1464
|
+
kind: z7.literal("validate-spec-check"),
|
|
1465
|
+
phase: z7.literal("validate"),
|
|
1466
|
+
reqIdsChecked: z7.array(z7.string().min(1)).min(1),
|
|
1467
|
+
passed: z7.boolean(),
|
|
1468
|
+
details: z7.string().min(1)
|
|
1308
1469
|
});
|
|
1309
1470
|
testOutputRecordSchema = evidenceBaseSchema.extend({
|
|
1310
|
-
kind:
|
|
1311
|
-
phase:
|
|
1312
|
-
command:
|
|
1313
|
-
exitCode:
|
|
1314
|
-
testsPassed:
|
|
1315
|
-
testsFailed:
|
|
1471
|
+
kind: z7.literal("test-output"),
|
|
1472
|
+
phase: z7.literal("test"),
|
|
1473
|
+
command: z7.string().min(1),
|
|
1474
|
+
exitCode: z7.number().int(),
|
|
1475
|
+
testsPassed: z7.number().int().nonnegative(),
|
|
1476
|
+
testsFailed: z7.number().int().nonnegative()
|
|
1316
1477
|
});
|
|
1317
1478
|
lintReportRecordSchema = evidenceBaseSchema.extend({
|
|
1318
|
-
kind:
|
|
1319
|
-
phase:
|
|
1320
|
-
tool:
|
|
1321
|
-
passed:
|
|
1322
|
-
warnings:
|
|
1323
|
-
errors:
|
|
1479
|
+
kind: z7.literal("lint-report"),
|
|
1480
|
+
phase: z7.enum(["implement", "test"]),
|
|
1481
|
+
tool: z7.string().min(1),
|
|
1482
|
+
passed: z7.boolean(),
|
|
1483
|
+
warnings: z7.number().int().nonnegative(),
|
|
1484
|
+
errors: z7.number().int().nonnegative()
|
|
1324
1485
|
});
|
|
1325
1486
|
commandOutputRecordSchema = evidenceBaseSchema.extend({
|
|
1326
|
-
kind:
|
|
1327
|
-
phase:
|
|
1328
|
-
cmd:
|
|
1329
|
-
exitCode:
|
|
1487
|
+
kind: z7.literal("command-output"),
|
|
1488
|
+
phase: z7.enum(["implement", "validate", "test"]),
|
|
1489
|
+
cmd: z7.string().min(1),
|
|
1490
|
+
exitCode: z7.number().int()
|
|
1330
1491
|
});
|
|
1331
|
-
evidenceRecordSchema =
|
|
1492
|
+
evidenceRecordSchema = z7.discriminatedUnion("kind", [
|
|
1332
1493
|
implDiffRecordSchema,
|
|
1333
1494
|
validateSpecCheckRecordSchema,
|
|
1334
1495
|
testOutputRecordSchema,
|
|
@@ -1352,6 +1513,302 @@ var init_graph = __esm({
|
|
|
1352
1513
|
}
|
|
1353
1514
|
});
|
|
1354
1515
|
|
|
1516
|
+
// packages/contracts/src/invariants/adr-056-release.ts
|
|
1517
|
+
var ARCHIVE_REASON_MODULE, RELEASE_INVARIANTS_REGISTRY_MODULE, RELEASE_COMMIT_MSG_HOOK, ADR_056_INVARIANTS;
|
|
1518
|
+
var init_adr_056_release = __esm({
|
|
1519
|
+
"packages/contracts/src/invariants/adr-056-release.ts"() {
|
|
1520
|
+
"use strict";
|
|
1521
|
+
ARCHIVE_REASON_MODULE = "packages/contracts/src/tasks/archive.ts";
|
|
1522
|
+
RELEASE_INVARIANTS_REGISTRY_MODULE = "packages/core/src/release/invariants/registry.ts";
|
|
1523
|
+
RELEASE_COMMIT_MSG_HOOK = "scripts/hooks/commit-msg-release-lint.mjs";
|
|
1524
|
+
ADR_056_INVARIANTS = Object.freeze([
|
|
1525
|
+
{
|
|
1526
|
+
adr: "ADR-056",
|
|
1527
|
+
code: "D1",
|
|
1528
|
+
name: "Database topology: keep per-domain split",
|
|
1529
|
+
description: "CLEO retains the six per-domain SQLite databases (tasks, brain, conduit, nexus, signaldock, telemetry) documented in DATABASE-ERDS.md. Consolidation is rejected to preserve per-DB WAL throughput, per-DB rollback granularity, and avoid single-writer contention during multi-agent waves.",
|
|
1530
|
+
severity: "info",
|
|
1531
|
+
// D1 is a topology decision; the absence of consolidation is its only
|
|
1532
|
+
// enforcement surface. No runtime guard, no lint script.
|
|
1533
|
+
runtimeGate: null,
|
|
1534
|
+
lintRule: null,
|
|
1535
|
+
doctorAudit: null,
|
|
1536
|
+
tests: []
|
|
1537
|
+
},
|
|
1538
|
+
{
|
|
1539
|
+
adr: "ADR-056",
|
|
1540
|
+
code: "D2",
|
|
1541
|
+
name: "Store-layer naming convention",
|
|
1542
|
+
description: "New always-on store-layer domains MUST use the kebab-case pair `packages/core/src/store/<domain>-schema.ts` (Drizzle defs) + `packages/core/src/store/<domain>-sqlite.ts` (open/init/CRUD). Opt-in / isolated domains MAY use the folder variant `packages/core/src/<domain>/{schema,sqlite}.ts` (currently telemetry only).",
|
|
1543
|
+
severity: "info",
|
|
1544
|
+
// D2 is a naming-convention decision; enforced by code review and the
|
|
1545
|
+
// ADR-073/ADR-056 doctor audit. No runtime guard.
|
|
1546
|
+
runtimeGate: null,
|
|
1547
|
+
lintRule: null,
|
|
1548
|
+
doctorAudit: null,
|
|
1549
|
+
tests: []
|
|
1550
|
+
},
|
|
1551
|
+
{
|
|
1552
|
+
adr: "ADR-056",
|
|
1553
|
+
code: "D3",
|
|
1554
|
+
name: "Migration runner SSoT under migration-manager.ts",
|
|
1555
|
+
description: "All six SQLite databases MUST be initialized via `packages/core/src/migration/migration-manager.ts` (`migrateWithRetry()` + `reconcileJournal()`). Per-DB bespoke runners are prohibited for new domains. Rust Diesel migrations for cloud signaldock-storage MUST NOT touch the local SQLite signaldock.db at runtime.",
|
|
1556
|
+
severity: "info",
|
|
1557
|
+
// D3 is enforced by the absence of bespoke runners — every domain's
|
|
1558
|
+
// `<domain>-sqlite.ts` open path delegates to migration-manager. No
|
|
1559
|
+
// single runtime guard; per-DB chokepoints are the enforcement surface.
|
|
1560
|
+
runtimeGate: null,
|
|
1561
|
+
lintRule: null,
|
|
1562
|
+
doctorAudit: null,
|
|
1563
|
+
tests: []
|
|
1564
|
+
},
|
|
1565
|
+
{
|
|
1566
|
+
adr: "ADR-056",
|
|
1567
|
+
code: "D4",
|
|
1568
|
+
name: "archiveReason 6-value enum with tombstone semantics",
|
|
1569
|
+
description: "The tasks.archive_reason column is constrained to exactly six values (verified, reconciled, superseded, shadowed, cancelled, completed-unverified) via SQLite CHECK constraint AND Zod z.enum validation. Writing 'completed-unverified' from non-migration code MUST throw E_ARCHIVE_REASON_TOMBSTONE \u2014 the tombstone is reserved for the T1408 backfill migration only.",
|
|
1570
|
+
severity: "error",
|
|
1571
|
+
runtimeGate: {
|
|
1572
|
+
module: ARCHIVE_REASON_MODULE,
|
|
1573
|
+
functionName: "assertArchiveReason"
|
|
1574
|
+
},
|
|
1575
|
+
lintRule: null,
|
|
1576
|
+
doctorAudit: null,
|
|
1577
|
+
tests: ["packages/contracts/src/tasks/__tests__/archive.test.ts"]
|
|
1578
|
+
},
|
|
1579
|
+
{
|
|
1580
|
+
adr: "ADR-056",
|
|
1581
|
+
code: "D5",
|
|
1582
|
+
name: "Post-release reconciliation: registry-driven cleo verify --release",
|
|
1583
|
+
description: "Post-release reconciliation flows through the executable invariants registry at packages/core/src/release/invariants/registry.ts. Customers register via registerInvariant() and the CLI runs every entry on `cleo verify --release <tag>`. First customer: archive-reason-invariant.ts (stamps verified tasks done; creates follow-up tasks for unverified references).",
|
|
1584
|
+
severity: "warning",
|
|
1585
|
+
runtimeGate: {
|
|
1586
|
+
module: RELEASE_INVARIANTS_REGISTRY_MODULE,
|
|
1587
|
+
functionName: "runInvariants"
|
|
1588
|
+
},
|
|
1589
|
+
lintRule: null,
|
|
1590
|
+
doctorAudit: null,
|
|
1591
|
+
tests: ["packages/core/src/release/invariants/__tests__/archive-reason-invariant.test.ts"]
|
|
1592
|
+
},
|
|
1593
|
+
{
|
|
1594
|
+
adr: "ADR-056",
|
|
1595
|
+
code: "D6",
|
|
1596
|
+
name: "Commit-message lint for release commits",
|
|
1597
|
+
description: "Every commit whose subject matches `^(chore|feat)\\(release\\):` MUST contain at least one `T\\d+` task reference in the commit body. Enforced by scripts/hooks/commit-msg-release-lint.mjs (T1410). Bypass via CLEO_OWNER_OVERRIDE=1 with audited justification.",
|
|
1598
|
+
severity: "info",
|
|
1599
|
+
// D6 is a CI-hook concern. The hook itself is the enforcement surface
|
|
1600
|
+
// — represented here via lintRule for cross-reference rendering.
|
|
1601
|
+
runtimeGate: null,
|
|
1602
|
+
lintRule: {
|
|
1603
|
+
lintScript: RELEASE_COMMIT_MSG_HOOK
|
|
1604
|
+
},
|
|
1605
|
+
doctorAudit: null,
|
|
1606
|
+
tests: []
|
|
1607
|
+
}
|
|
1608
|
+
]);
|
|
1609
|
+
}
|
|
1610
|
+
});
|
|
1611
|
+
|
|
1612
|
+
// packages/contracts/src/invariants/adr-070-orchestration.ts
|
|
1613
|
+
var THIN_AGENT_MODULE, SESSIONS_MODULE, WORKTREE_CREATE_MODULE, CT_ORCHESTRATOR_SKILL, VALIDATE_SPAWN_MODULE, SKILL_VALIDATOR_TESTS, ADR_070_INVARIANTS, ADR_070_INVARIANT_COUNT;
|
|
1614
|
+
var init_adr_070_orchestration = __esm({
|
|
1615
|
+
"packages/contracts/src/invariants/adr-070-orchestration.ts"() {
|
|
1616
|
+
"use strict";
|
|
1617
|
+
THIN_AGENT_MODULE = "packages/core/src/orchestration/thin-agent.ts";
|
|
1618
|
+
SESSIONS_MODULE = "packages/core/src/sessions/index.ts";
|
|
1619
|
+
WORKTREE_CREATE_MODULE = "packages/worktree/src/worktree-create.ts";
|
|
1620
|
+
CT_ORCHESTRATOR_SKILL = "packages/skills/skills/ct-orchestrator/SKILL.md";
|
|
1621
|
+
VALIDATE_SPAWN_MODULE = "packages/core/src/orchestration/validate-spawn.ts";
|
|
1622
|
+
SKILL_VALIDATOR_TESTS = "packages/core/src/skills/orchestrator/__tests__/validator.test.ts";
|
|
1623
|
+
ADR_070_INVARIANTS = Object.freeze([
|
|
1624
|
+
{
|
|
1625
|
+
adr: "ADR-070",
|
|
1626
|
+
code: "ORC-001",
|
|
1627
|
+
name: "Orchestrator is the HITL interface",
|
|
1628
|
+
description: "The Orchestrator (Cleo) is the single subagent that talks to the human operator. It plans, decomposes, and delegates \u2014 it never produces line-level implementation. Source-of-truth lives in ct-orchestrator/SKILL.md row ORC-001 and is injected into the Orchestrator prompt at spawn time. UNENFORCED at the dispatch layer: this is a prompt-time invariant with no runtime guard today.",
|
|
1629
|
+
severity: "warning",
|
|
1630
|
+
runtimeGate: null,
|
|
1631
|
+
lintRule: null,
|
|
1632
|
+
doctorAudit: null,
|
|
1633
|
+
tests: [CT_ORCHESTRATOR_SKILL]
|
|
1634
|
+
},
|
|
1635
|
+
{
|
|
1636
|
+
adr: "ADR-070",
|
|
1637
|
+
code: "ORC-002",
|
|
1638
|
+
name: "Orchestrator MUST NOT write or edit code",
|
|
1639
|
+
description: "Every line of code is written by a spawned subagent. The Orchestrator delegates implementation work via cleo orchestrate spawn / delegate_task. UNENFORCED at the dispatch layer: this is a prompt-time invariant \u2014 there is no runtime gate that blocks the Orchestrator from calling Edit/Write, so the contract is held by the ct-orchestrator skill text.",
|
|
1640
|
+
severity: "warning",
|
|
1641
|
+
runtimeGate: null,
|
|
1642
|
+
lintRule: null,
|
|
1643
|
+
doctorAudit: null,
|
|
1644
|
+
tests: [CT_ORCHESTRATOR_SKILL]
|
|
1645
|
+
},
|
|
1646
|
+
{
|
|
1647
|
+
adr: "ADR-070",
|
|
1648
|
+
code: "ORC-003",
|
|
1649
|
+
name: "Orchestrator MUST NOT read full source files",
|
|
1650
|
+
description: "Orchestrator reads only pipeline manifests, task envelopes, and rolled-up phase summaries returned by Phase Leads. Workers read code; the Orchestrator reads summaries. UNENFORCED at the dispatch layer \u2014 held by the ct-orchestrator skill text and reinforced by ORC-005 budget pressure.",
|
|
1651
|
+
severity: "warning",
|
|
1652
|
+
runtimeGate: null,
|
|
1653
|
+
lintRule: null,
|
|
1654
|
+
doctorAudit: null,
|
|
1655
|
+
tests: [CT_ORCHESTRATOR_SKILL]
|
|
1656
|
+
},
|
|
1657
|
+
{
|
|
1658
|
+
adr: "ADR-070",
|
|
1659
|
+
code: "ORC-004",
|
|
1660
|
+
name: "Dependency-ordered spawning",
|
|
1661
|
+
description: "Spawns within a wave are ordered by task.depends \u2014 a Worker MUST NOT be dispatched until its declared dependencies are status=done. Surfaced by validateSpawnReadiness via V_MISSING_DEP / V_UNMET_DEP codes; surfaced by the skill-orchestrator validator via the ORC-004_DEPENDENCY_ORDER warning emitted from packages/core/src/skills/orchestrator/validator.ts. Tier: warning because the validator surfaces ordering issues but does not throw \u2014 workers can still proceed if the operator overrides.",
|
|
1662
|
+
severity: "warning",
|
|
1663
|
+
runtimeGate: {
|
|
1664
|
+
module: VALIDATE_SPAWN_MODULE,
|
|
1665
|
+
functionName: "validateSpawnReadiness"
|
|
1666
|
+
},
|
|
1667
|
+
lintRule: null,
|
|
1668
|
+
doctorAudit: null,
|
|
1669
|
+
tests: [
|
|
1670
|
+
"packages/core/src/orchestration/__tests__/validate-spawn.test.ts",
|
|
1671
|
+
SKILL_VALIDATOR_TESTS
|
|
1672
|
+
]
|
|
1673
|
+
},
|
|
1674
|
+
{
|
|
1675
|
+
adr: "ADR-070",
|
|
1676
|
+
code: "ORC-005",
|
|
1677
|
+
name: "Orchestrator context budget \u2248 10 K tokens",
|
|
1678
|
+
description: "The Orchestrator MUST keep its working context under ~10 K tokens; delegate at 80 %. Surfaced by cleo orchestrate context (estimateContext) and by the skill-orchestrator validator (ORC-005_NO_MANIFEST / ORC-005_EMPTY_MANIFEST). UNENFORCED as a hard gate \u2014 the budget is advisory, surfaced to the Orchestrator as a warning so the human operator can intervene.",
|
|
1679
|
+
severity: "warning",
|
|
1680
|
+
runtimeGate: {
|
|
1681
|
+
module: "packages/core/src/orchestration/context.ts",
|
|
1682
|
+
functionName: "estimateContext"
|
|
1683
|
+
},
|
|
1684
|
+
lintRule: null,
|
|
1685
|
+
doctorAudit: null,
|
|
1686
|
+
tests: ["packages/core/src/orchestration/__tests__/"]
|
|
1687
|
+
},
|
|
1688
|
+
{
|
|
1689
|
+
adr: "ADR-070",
|
|
1690
|
+
code: "ORC-006",
|
|
1691
|
+
name: "Worker scope \u2264 3 files per spawn",
|
|
1692
|
+
description: "Cross-file reasoning quality degrades beyond ~3 files for a single Worker. Enforced at spawn-time by validateSpawnReadiness \u2014 V_ATOMIC_SCOPE_MISSING when task.files is empty, V_ATOMIC_SCOPE_TOO_LARGE when files.length > MAX_WORKER_FILES (currently 3). Spawn-prompt builder injects a Worker Budget Constraints section so the Worker sees the budget inline. Tier: error because the gate refuses to spawn an over-scoped Worker.",
|
|
1693
|
+
severity: "error",
|
|
1694
|
+
runtimeGate: {
|
|
1695
|
+
module: VALIDATE_SPAWN_MODULE,
|
|
1696
|
+
functionName: "validateSpawnReadiness"
|
|
1697
|
+
},
|
|
1698
|
+
lintRule: null,
|
|
1699
|
+
doctorAudit: null,
|
|
1700
|
+
tests: [
|
|
1701
|
+
"packages/core/src/orchestration/__tests__/validate-spawn.test.ts",
|
|
1702
|
+
"packages/core/src/orchestration/__tests__/spawn-prompt.test.ts"
|
|
1703
|
+
]
|
|
1704
|
+
},
|
|
1705
|
+
{
|
|
1706
|
+
adr: "ADR-070",
|
|
1707
|
+
code: "ORC-007",
|
|
1708
|
+
name: "All work traced to an Epic",
|
|
1709
|
+
description: "Every Task and Subtask MUST attach to a parent Epic (directly or transitively). No orphan work \u2014 orphans are filed against the ADR-066 acceptance-criteria gate and surface via cleo find. UNENFORCED at the dispatch layer; the parent-id requirement is materialised through cleo add validation rather than a single ORC-named guard. R6 doctor audit should walk the task graph to surface orphans.",
|
|
1710
|
+
severity: "warning",
|
|
1711
|
+
runtimeGate: null,
|
|
1712
|
+
lintRule: null,
|
|
1713
|
+
doctorAudit: null,
|
|
1714
|
+
tests: [CT_ORCHESTRATOR_SKILL]
|
|
1715
|
+
},
|
|
1716
|
+
{
|
|
1717
|
+
adr: "ADR-070",
|
|
1718
|
+
code: "ORC-008",
|
|
1719
|
+
name: "Zero architectural decisions during execution",
|
|
1720
|
+
description: "Architectural choices MUST be pre-decided via RCASD consensus or HITL \u2014 never inside a worker session. UNENFORCED at the dispatch layer: this is a behavioural invariant held by the ct-orchestrator skill text plus the ADR-066 acceptance criterion that every task must declare its architecture-relevant decisions before spawn.",
|
|
1721
|
+
severity: "warning",
|
|
1722
|
+
runtimeGate: null,
|
|
1723
|
+
lintRule: null,
|
|
1724
|
+
doctorAudit: null,
|
|
1725
|
+
tests: [CT_ORCHESTRATOR_SKILL]
|
|
1726
|
+
},
|
|
1727
|
+
{
|
|
1728
|
+
adr: "ADR-070",
|
|
1729
|
+
code: "ORC-009",
|
|
1730
|
+
name: "Manifest-mediated handoffs",
|
|
1731
|
+
description: "Orchestrator reads only the key_findings field of pipeline_manifest rows when reconciling worker output. Subagents read the full task description and supporting files. UNENFORCED at the dispatch layer: the contract is held by the ct-orchestrator skill text and reinforced by ORC-003 + ORC-005 budget pressure.",
|
|
1732
|
+
severity: "warning",
|
|
1733
|
+
runtimeGate: null,
|
|
1734
|
+
lintRule: null,
|
|
1735
|
+
doctorAudit: null,
|
|
1736
|
+
tests: [CT_ORCHESTRATOR_SKILL]
|
|
1737
|
+
},
|
|
1738
|
+
{
|
|
1739
|
+
adr: "ADR-070",
|
|
1740
|
+
code: "ORC-010",
|
|
1741
|
+
name: "Lead-interposition required for Epic-child Workers",
|
|
1742
|
+
description: "A Worker spawn against a Task whose parent is type=epic MUST be preceded by a Lead spawn for the same Task (ADR-083 \xA72.4 / \xA76). The intended runtime gate (composeSpawnPayload throwing E_LEAD_REQUIRED_FOR_EPIC_CHILD) is FILED but UNSHIPPED \u2014 tracked under T10278. Registered here as a warning + runtimeGate:null so the gap is visible in the R6 doctor audit.",
|
|
1743
|
+
severity: "warning",
|
|
1744
|
+
runtimeGate: null,
|
|
1745
|
+
lintRule: null,
|
|
1746
|
+
doctorAudit: null,
|
|
1747
|
+
tests: []
|
|
1748
|
+
},
|
|
1749
|
+
{
|
|
1750
|
+
adr: "ADR-070",
|
|
1751
|
+
code: "ORC-011",
|
|
1752
|
+
name: "Orchestrator-depth cap at 3",
|
|
1753
|
+
description: "Recursive Orchestrator spawns (Cleo \u2192 sub-Orchestrator \u2192 sub-Orchestrator \u2192 \u2026) MUST stop at depth 3 (ADR-083 \xA72.2 + \xA72.4). The intended runtime gate (composeSpawnPayload throwing E_ORCHESTRATOR_DEPTH_EXCEEDED) is FILED but UNSHIPPED \u2014 tracked under T10279. Registered here as a warning + runtimeGate:null so the gap is visible in the R6 doctor audit.",
|
|
1754
|
+
severity: "warning",
|
|
1755
|
+
runtimeGate: null,
|
|
1756
|
+
lintRule: null,
|
|
1757
|
+
doctorAudit: null,
|
|
1758
|
+
tests: []
|
|
1759
|
+
},
|
|
1760
|
+
{
|
|
1761
|
+
adr: "ADR-070",
|
|
1762
|
+
code: "ORC-012",
|
|
1763
|
+
name: "Thin-agent inversion-of-control",
|
|
1764
|
+
description: "Workers MUST NOT spawn other subagents. The spawn-capable tools (Agent / Task / TaskCreate) are stripped from the Worker tool list at .cant compile time, and any survivor at spawn time triggers ThinAgentViolationError \u2192 E_THIN_AGENT_VIOLATION (exit 68). The only ORC rule with a hard-enforced dispatch-time gate today.",
|
|
1765
|
+
severity: "error",
|
|
1766
|
+
runtimeGate: {
|
|
1767
|
+
module: THIN_AGENT_MODULE,
|
|
1768
|
+
functionName: "enforceThinAgent"
|
|
1769
|
+
},
|
|
1770
|
+
lintRule: null,
|
|
1771
|
+
doctorAudit: null,
|
|
1772
|
+
tests: [
|
|
1773
|
+
"packages/core/src/orchestration/__tests__/thin-agent.test.ts",
|
|
1774
|
+
"packages/cant/src/__tests__/hierarchy.test.ts"
|
|
1775
|
+
]
|
|
1776
|
+
},
|
|
1777
|
+
{
|
|
1778
|
+
adr: "ADR-070",
|
|
1779
|
+
code: "ORC-013",
|
|
1780
|
+
name: "Worktree provisioning at canonical XDG location",
|
|
1781
|
+
description: "Every agent worktree MUST be created under <cleoHome>/worktrees/<projectHash>/<taskId>/ (ADR-055 + Council D009). createWorktree throws E_WT_LOCATION_FORBIDDEN before any git worktree add call when the computed path falls outside the canonical root. CI gate lint-worktree-location.mjs enforces the same invariant on every PR. The single-most-load-bearing orchestration guard after ORC-012.",
|
|
1782
|
+
severity: "error",
|
|
1783
|
+
runtimeGate: {
|
|
1784
|
+
module: WORKTREE_CREATE_MODULE,
|
|
1785
|
+
functionName: "assertCanonicalWorktreeLocation"
|
|
1786
|
+
},
|
|
1787
|
+
lintRule: {
|
|
1788
|
+
lintScript: "scripts/lint-worktree-location.mjs"
|
|
1789
|
+
},
|
|
1790
|
+
doctorAudit: null,
|
|
1791
|
+
tests: ["packages/worktree/src/__tests__/"]
|
|
1792
|
+
},
|
|
1793
|
+
{
|
|
1794
|
+
adr: "ADR-070",
|
|
1795
|
+
code: "ORC-014",
|
|
1796
|
+
name: "Lead-bypass detection at session end",
|
|
1797
|
+
description: "A Lead session (CLEO_AGENT_ROLE=lead) that ends with tasks_completed > 0 AND delegate_task_count = 0 is rejected with LeadBypassDetectedError \u2192 E_LEAD_BYPASS_DETECTED (exit 107). Leads MUST fan out work to Workers; a Lead that did the work itself defeats the three-tier topology. Override via CLEO_OWNER_OVERRIDE=1 (audited to force-bypass.jsonl).",
|
|
1798
|
+
severity: "error",
|
|
1799
|
+
runtimeGate: {
|
|
1800
|
+
module: SESSIONS_MODULE,
|
|
1801
|
+
functionName: "endSession"
|
|
1802
|
+
},
|
|
1803
|
+
lintRule: null,
|
|
1804
|
+
doctorAudit: null,
|
|
1805
|
+
tests: ["packages/core/src/sessions/__tests__/"]
|
|
1806
|
+
}
|
|
1807
|
+
]);
|
|
1808
|
+
ADR_070_INVARIANT_COUNT = ADR_070_INVARIANTS.length;
|
|
1809
|
+
}
|
|
1810
|
+
});
|
|
1811
|
+
|
|
1355
1812
|
// packages/contracts/src/invariants/adr-073-saga.ts
|
|
1356
1813
|
var SAGA_ENFORCEMENT_MODULE, SAGA_ENFORCEMENT_TESTS, ADR_073_INVARIANTS;
|
|
1357
1814
|
var init_adr_073_saga = __esm({
|
|
@@ -1479,7 +1936,11 @@ function buildKey(invariant) {
|
|
|
1479
1936
|
return `${invariant.adr}.${invariant.code}`;
|
|
1480
1937
|
}
|
|
1481
1938
|
function buildRegistry() {
|
|
1482
|
-
const entries = [
|
|
1939
|
+
const entries = [
|
|
1940
|
+
...ADR_073_INVARIANTS,
|
|
1941
|
+
...ADR_056_INVARIANTS,
|
|
1942
|
+
...ADR_070_INVARIANTS
|
|
1943
|
+
];
|
|
1483
1944
|
const record2 = {};
|
|
1484
1945
|
for (const entry of entries) {
|
|
1485
1946
|
const key = buildKey(entry);
|
|
@@ -1494,7 +1955,11 @@ var INVARIANTS_REGISTRY;
|
|
|
1494
1955
|
var init_invariants = __esm({
|
|
1495
1956
|
"packages/contracts/src/invariants/index.ts"() {
|
|
1496
1957
|
"use strict";
|
|
1958
|
+
init_adr_056_release();
|
|
1959
|
+
init_adr_070_orchestration();
|
|
1497
1960
|
init_adr_073_saga();
|
|
1961
|
+
init_adr_056_release();
|
|
1962
|
+
init_adr_070_orchestration();
|
|
1498
1963
|
init_adr_073_saga();
|
|
1499
1964
|
INVARIANTS_REGISTRY = buildRegistry();
|
|
1500
1965
|
}
|
|
@@ -1768,31 +2233,31 @@ var init_peer = __esm({
|
|
|
1768
2233
|
});
|
|
1769
2234
|
|
|
1770
2235
|
// packages/contracts/src/release/evidence-atoms.ts
|
|
1771
|
-
import { z as
|
|
2236
|
+
import { z as z8 } from "zod";
|
|
1772
2237
|
var parsedPrEvidenceAtomSchema, prEvidenceStateModifierSchema, ghPrViewSchema, PR_REQUIRED_WORKFLOWS;
|
|
1773
2238
|
var init_evidence_atoms = __esm({
|
|
1774
2239
|
"packages/contracts/src/release/evidence-atoms.ts"() {
|
|
1775
2240
|
"use strict";
|
|
1776
|
-
parsedPrEvidenceAtomSchema =
|
|
1777
|
-
kind:
|
|
1778
|
-
prNumber:
|
|
1779
|
-
});
|
|
1780
|
-
prEvidenceStateModifierSchema =
|
|
1781
|
-
kind:
|
|
1782
|
-
value:
|
|
1783
|
-
});
|
|
1784
|
-
ghPrViewSchema =
|
|
1785
|
-
state:
|
|
1786
|
-
mergedAt:
|
|
1787
|
-
headRefOid:
|
|
1788
|
-
mergeable:
|
|
1789
|
-
statusCheckRollup:
|
|
1790
|
-
|
|
1791
|
-
__typename:
|
|
1792
|
-
name:
|
|
1793
|
-
workflowName:
|
|
1794
|
-
conclusion:
|
|
1795
|
-
status:
|
|
2241
|
+
parsedPrEvidenceAtomSchema = z8.object({
|
|
2242
|
+
kind: z8.literal("pr"),
|
|
2243
|
+
prNumber: z8.number().int().positive()
|
|
2244
|
+
});
|
|
2245
|
+
prEvidenceStateModifierSchema = z8.object({
|
|
2246
|
+
kind: z8.literal("state"),
|
|
2247
|
+
value: z8.literal("MERGED")
|
|
2248
|
+
});
|
|
2249
|
+
ghPrViewSchema = z8.object({
|
|
2250
|
+
state: z8.enum(["OPEN", "CLOSED", "MERGED"]),
|
|
2251
|
+
mergedAt: z8.string().nullable(),
|
|
2252
|
+
headRefOid: z8.string().optional(),
|
|
2253
|
+
mergeable: z8.string().optional(),
|
|
2254
|
+
statusCheckRollup: z8.array(
|
|
2255
|
+
z8.object({
|
|
2256
|
+
__typename: z8.string().optional(),
|
|
2257
|
+
name: z8.string().optional(),
|
|
2258
|
+
workflowName: z8.string().optional(),
|
|
2259
|
+
conclusion: z8.string().nullable().optional(),
|
|
2260
|
+
status: z8.string().optional()
|
|
1796
2261
|
}).passthrough()
|
|
1797
2262
|
).optional().default([])
|
|
1798
2263
|
}).passthrough();
|
|
@@ -1805,7 +2270,7 @@ var init_evidence_atoms = __esm({
|
|
|
1805
2270
|
});
|
|
1806
2271
|
|
|
1807
2272
|
// packages/contracts/src/release/plan.ts
|
|
1808
|
-
import { z as
|
|
2273
|
+
import { z as z9 } from "zod";
|
|
1809
2274
|
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;
|
|
1810
2275
|
var init_plan = __esm({
|
|
1811
2276
|
"packages/contracts/src/release/plan.ts"() {
|
|
@@ -1848,20 +2313,20 @@ var init_plan = __esm({
|
|
|
1848
2313
|
];
|
|
1849
2314
|
IMPACT = ["major", "minor", "patch"];
|
|
1850
2315
|
RESOLVED_SOURCE = ["project-context", "language-default", "legacy-alias"];
|
|
1851
|
-
ReleaseChannelSchema =
|
|
1852
|
-
ReleaseSchemeSchema =
|
|
1853
|
-
ReleaseKindSchema =
|
|
1854
|
-
ReleaseStatusSchema =
|
|
1855
|
-
GateStatusSchema =
|
|
1856
|
-
GateNameSchema =
|
|
1857
|
-
PlatformTupleSchema =
|
|
1858
|
-
PublisherSchema =
|
|
1859
|
-
TaskKindSchema =
|
|
1860
|
-
ImpactSchema =
|
|
1861
|
-
ResolvedSourceSchema =
|
|
1862
|
-
Iso8601 =
|
|
1863
|
-
NonEmptyString =
|
|
1864
|
-
ReleasePlanTaskSchema =
|
|
2316
|
+
ReleaseChannelSchema = z9.enum(RELEASE_CHANNEL);
|
|
2317
|
+
ReleaseSchemeSchema = z9.enum(RELEASE_SCHEME);
|
|
2318
|
+
ReleaseKindSchema = z9.enum(RELEASE_KIND);
|
|
2319
|
+
ReleaseStatusSchema = z9.enum(RELEASE_STATUS);
|
|
2320
|
+
GateStatusSchema = z9.enum(GATE_STATUS);
|
|
2321
|
+
GateNameSchema = z9.enum(GATE_NAME);
|
|
2322
|
+
PlatformTupleSchema = z9.enum(PLATFORM_TUPLE);
|
|
2323
|
+
PublisherSchema = z9.enum(PUBLISHER);
|
|
2324
|
+
TaskKindSchema = z9.enum(TASK_KIND);
|
|
2325
|
+
ImpactSchema = z9.enum(IMPACT);
|
|
2326
|
+
ResolvedSourceSchema = z9.enum(RESOLVED_SOURCE);
|
|
2327
|
+
Iso8601 = z9.iso.datetime({ offset: true });
|
|
2328
|
+
NonEmptyString = z9.string().min(1);
|
|
2329
|
+
ReleasePlanTaskSchema = z9.object({
|
|
1865
2330
|
/** Task ID (e.g. "T10001"). Format intentionally loose so historical IDs validate. */
|
|
1866
2331
|
id: NonEmptyString,
|
|
1867
2332
|
/** Conventional-commit-aligned task classification. */
|
|
@@ -1869,20 +2334,20 @@ var init_plan = __esm({
|
|
|
1869
2334
|
/** SemVer impact classification. */
|
|
1870
2335
|
impact: ImpactSchema,
|
|
1871
2336
|
/** Human-readable changelog line for this task. */
|
|
1872
|
-
userFacingSummary:
|
|
2337
|
+
userFacingSummary: z9.string(),
|
|
1873
2338
|
/**
|
|
1874
2339
|
* ADR-051 evidence atoms attesting the task's gate results. Format is
|
|
1875
2340
|
* `kind:value` (e.g. `commit:abc123`, `test-run:vitest.json`). The contract
|
|
1876
2341
|
* accepts empty arrays so legacy plans validate; `cleo release plan`
|
|
1877
2342
|
* enforces non-empty via R-301.
|
|
1878
2343
|
*/
|
|
1879
|
-
evidenceAtoms:
|
|
2344
|
+
evidenceAtoms: z9.array(NonEmptyString),
|
|
1880
2345
|
/** IVTR phase at plan time — informational only per R-316. */
|
|
1881
|
-
ivtrPhaseAtPlan:
|
|
2346
|
+
ivtrPhaseAtPlan: z9.string().optional(),
|
|
1882
2347
|
/** Epic this task rolls up to, locked at plan time per R-303. */
|
|
1883
2348
|
epicAncestor: NonEmptyString
|
|
1884
2349
|
});
|
|
1885
|
-
ReleaseGateSchema =
|
|
2350
|
+
ReleaseGateSchema = z9.object({
|
|
1886
2351
|
/** Canonical gate name. */
|
|
1887
2352
|
name: GateNameSchema,
|
|
1888
2353
|
/** ADR-051 atom string identifying the resolved tool (e.g. `tool:test`). */
|
|
@@ -1892,11 +2357,11 @@ var init_plan = __esm({
|
|
|
1892
2357
|
/** ISO-8601 timestamp the gate was last verified. */
|
|
1893
2358
|
lastVerifiedAt: Iso8601,
|
|
1894
2359
|
/** Resolved shell command (e.g. `pnpm run test`). Optional for unresolved gates. */
|
|
1895
|
-
resolvedCommand:
|
|
2360
|
+
resolvedCommand: z9.string().optional(),
|
|
1896
2361
|
/** Provenance of the resolved command. Optional for unresolved gates. */
|
|
1897
2362
|
resolvedSource: ResolvedSourceSchema.optional()
|
|
1898
2363
|
});
|
|
1899
|
-
ReleasePlatformMatrixEntrySchema =
|
|
2364
|
+
ReleasePlatformMatrixEntrySchema = z9.object({
|
|
1900
2365
|
/** Target platform tuple. */
|
|
1901
2366
|
platform: PlatformTupleSchema,
|
|
1902
2367
|
/** Distribution backend. */
|
|
@@ -1904,47 +2369,47 @@ var init_plan = __esm({
|
|
|
1904
2369
|
/** Package identifier on the target backend (e.g. `@cleocode/cleo`). */
|
|
1905
2370
|
package: NonEmptyString,
|
|
1906
2371
|
/** Whether to run the GHA smoke job for this matrix entry. */
|
|
1907
|
-
smoke:
|
|
2372
|
+
smoke: z9.boolean().default(true).optional()
|
|
1908
2373
|
});
|
|
1909
|
-
ReleasePreflightSummarySchema =
|
|
2374
|
+
ReleasePreflightSummarySchema = z9.object({
|
|
1910
2375
|
/** True if esbuild externals are out of sync with package.json. */
|
|
1911
|
-
esbuildExternalsDrift:
|
|
2376
|
+
esbuildExternalsDrift: z9.boolean(),
|
|
1912
2377
|
/** True if `pnpm-lock.yaml` diverges from the workspace manifest. */
|
|
1913
|
-
lockfileDrift:
|
|
2378
|
+
lockfileDrift: z9.boolean(),
|
|
1914
2379
|
/** True if all epic children are in terminal lifecycle states. */
|
|
1915
|
-
epicCompletenessClean:
|
|
2380
|
+
epicCompletenessClean: z9.boolean(),
|
|
1916
2381
|
/** True if no task appears in multiple in-flight release plans. */
|
|
1917
|
-
doubleListingClean:
|
|
2382
|
+
doubleListingClean: z9.boolean(),
|
|
1918
2383
|
/** Non-fatal preflight warnings (e.g. unresolved tools per R-024). */
|
|
1919
|
-
preflightWarnings:
|
|
2384
|
+
preflightWarnings: z9.array(z9.string()).default([]).optional()
|
|
1920
2385
|
});
|
|
1921
|
-
ReleasePlanChangelogSchema =
|
|
2386
|
+
ReleasePlanChangelogSchema = z9.object({
|
|
1922
2387
|
/** `kind=feat` tasks. */
|
|
1923
|
-
features:
|
|
2388
|
+
features: z9.array(NonEmptyString).default([]),
|
|
1924
2389
|
/** `kind=fix` or `kind=hotfix` tasks. */
|
|
1925
|
-
fixes:
|
|
2390
|
+
fixes: z9.array(NonEmptyString).default([]),
|
|
1926
2391
|
/** `kind=chore`, `docs`, `refactor`, `test`, `perf` tasks. */
|
|
1927
|
-
chores:
|
|
2392
|
+
chores: z9.array(NonEmptyString).default([]),
|
|
1928
2393
|
/** `kind=breaking` or `kind=revert` tasks. */
|
|
1929
|
-
breaking:
|
|
2394
|
+
breaking: z9.array(NonEmptyString).default([])
|
|
1930
2395
|
});
|
|
1931
|
-
ReleasePlanMetaSchema =
|
|
2396
|
+
ReleasePlanMetaSchema = z9.object({
|
|
1932
2397
|
/** True if this is the project's first ever release. */
|
|
1933
|
-
firstEverRelease:
|
|
2398
|
+
firstEverRelease: z9.boolean().optional(),
|
|
1934
2399
|
/** Canonical tool names that could not be resolved at plan time. */
|
|
1935
|
-
unresolvedTools:
|
|
2400
|
+
unresolvedTools: z9.array(z9.string()).optional(),
|
|
1936
2401
|
/** Project archetype detected at plan time. */
|
|
1937
|
-
archetype:
|
|
1938
|
-
}).catchall(
|
|
1939
|
-
ReleasePlanSchema =
|
|
2402
|
+
archetype: z9.string().optional()
|
|
2403
|
+
}).catchall(z9.unknown());
|
|
2404
|
+
ReleasePlanSchema = z9.object({
|
|
1940
2405
|
/** Schema URL for this plan version. */
|
|
1941
|
-
$schema:
|
|
2406
|
+
$schema: z9.string().optional(),
|
|
1942
2407
|
/** Requested version string (e.g. "v2026.6.0"). Includes the leading `v`. */
|
|
1943
2408
|
version: NonEmptyString,
|
|
1944
2409
|
/** Resolved version string after suffix application (e.g. "v2026.6.0.2"). */
|
|
1945
2410
|
resolvedVersion: NonEmptyString,
|
|
1946
2411
|
/** True if a `calver-suffix` was applied to disambiguate a same-day hotfix. */
|
|
1947
|
-
suffixApplied:
|
|
2412
|
+
suffixApplied: z9.boolean(),
|
|
1948
2413
|
/** Versioning scheme governing `version` / `resolvedVersion`. */
|
|
1949
2414
|
scheme: ReleaseSchemeSchema,
|
|
1950
2415
|
/** npm dist-tag channel for this release. */
|
|
@@ -1961,27 +2426,27 @@ var init_plan = __esm({
|
|
|
1961
2426
|
* Version of the previous release on the same channel. MUST be `null` only
|
|
1962
2427
|
* for first-ever releases (R-300, enforced at the verb layer).
|
|
1963
2428
|
*/
|
|
1964
|
-
previousVersion:
|
|
2429
|
+
previousVersion: z9.string().nullable(),
|
|
1965
2430
|
/** Git tag of the previous release (typically `previousVersion` prefixed). */
|
|
1966
|
-
previousTag:
|
|
2431
|
+
previousTag: z9.string().nullable(),
|
|
1967
2432
|
/** ISO-8601 timestamp the previous release was published. */
|
|
1968
2433
|
previousShippedAt: Iso8601.nullable(),
|
|
1969
2434
|
/** Tasks rolled into this release. */
|
|
1970
|
-
tasks:
|
|
2435
|
+
tasks: z9.array(ReleasePlanTaskSchema),
|
|
1971
2436
|
/** Bucketed changelog. */
|
|
1972
2437
|
changelog: ReleasePlanChangelogSchema,
|
|
1973
2438
|
/** Per-gate verification status. */
|
|
1974
|
-
gates:
|
|
2439
|
+
gates: z9.array(ReleaseGateSchema),
|
|
1975
2440
|
/** Platform / publisher matrix. */
|
|
1976
|
-
platformMatrix:
|
|
2441
|
+
platformMatrix: z9.array(ReleasePlatformMatrixEntrySchema),
|
|
1977
2442
|
/** Preflight summary from `cleo release plan`. */
|
|
1978
2443
|
preflightSummary: ReleasePreflightSummarySchema,
|
|
1979
2444
|
/** URL of the GHA workflow run (populated by `release-prepare.yml`). */
|
|
1980
|
-
workflowRunUrl:
|
|
2445
|
+
workflowRunUrl: z9.string().nullable(),
|
|
1981
2446
|
/** URL of the bump PR (populated by `cleo release open`). */
|
|
1982
|
-
prUrl:
|
|
2447
|
+
prUrl: z9.string().nullable(),
|
|
1983
2448
|
/** Merge commit SHA on `main` (populated by `release-publish.yml`). */
|
|
1984
|
-
mergeCommitSha:
|
|
2449
|
+
mergeCommitSha: z9.string().nullable(),
|
|
1985
2450
|
/** Current FSM state per R-302. */
|
|
1986
2451
|
status: ReleaseStatusSchema,
|
|
1987
2452
|
/** Informational / forward-compat metadata. */
|
|
@@ -2037,52 +2502,52 @@ var init_session2 = __esm({
|
|
|
2037
2502
|
});
|
|
2038
2503
|
|
|
2039
2504
|
// packages/contracts/src/session-journal.ts
|
|
2040
|
-
import { z as
|
|
2505
|
+
import { z as z10 } from "zod";
|
|
2041
2506
|
var SESSION_JOURNAL_SCHEMA_VERSION, sessionJournalDoctorSummarySchema, sessionJournalDebriefSummarySchema, sessionJournalEntrySchema;
|
|
2042
2507
|
var init_session_journal = __esm({
|
|
2043
2508
|
"packages/contracts/src/session-journal.ts"() {
|
|
2044
2509
|
"use strict";
|
|
2045
2510
|
SESSION_JOURNAL_SCHEMA_VERSION = "1.0";
|
|
2046
|
-
sessionJournalDoctorSummarySchema =
|
|
2511
|
+
sessionJournalDoctorSummarySchema = z10.object({
|
|
2047
2512
|
/** `true` when zero noise patterns were detected. */
|
|
2048
|
-
isClean:
|
|
2513
|
+
isClean: z10.boolean(),
|
|
2049
2514
|
/** Total number of noise findings across all patterns. */
|
|
2050
|
-
findingsCount:
|
|
2515
|
+
findingsCount: z10.number().int().nonnegative(),
|
|
2051
2516
|
/** Pattern names that were detected (empty when isClean). */
|
|
2052
|
-
patterns:
|
|
2517
|
+
patterns: z10.array(z10.string()),
|
|
2053
2518
|
/** Total brain entries scanned. `0` = empty or unavailable. */
|
|
2054
|
-
totalScanned:
|
|
2519
|
+
totalScanned: z10.number().int().nonnegative()
|
|
2055
2520
|
});
|
|
2056
|
-
sessionJournalDebriefSummarySchema =
|
|
2521
|
+
sessionJournalDebriefSummarySchema = z10.object({
|
|
2057
2522
|
/** First 200 characters of the session end note (if provided). */
|
|
2058
|
-
noteExcerpt:
|
|
2523
|
+
noteExcerpt: z10.string().max(200).optional(),
|
|
2059
2524
|
/** Number of tasks completed during the session. */
|
|
2060
|
-
tasksCompletedCount:
|
|
2525
|
+
tasksCompletedCount: z10.number().int().nonnegative(),
|
|
2061
2526
|
/** Up to 5 task IDs (not titles) that were the focus of the session. */
|
|
2062
|
-
tasksFocused:
|
|
2527
|
+
tasksFocused: z10.array(z10.string()).max(5).optional()
|
|
2063
2528
|
});
|
|
2064
|
-
sessionJournalEntrySchema =
|
|
2529
|
+
sessionJournalEntrySchema = z10.object({
|
|
2065
2530
|
// Identity
|
|
2066
2531
|
/** Schema version for forward-compatibility. Always `'1.0'` in this release. */
|
|
2067
|
-
schemaVersion:
|
|
2532
|
+
schemaVersion: z10.literal(SESSION_JOURNAL_SCHEMA_VERSION),
|
|
2068
2533
|
/** ISO 8601 timestamp when the entry was written. */
|
|
2069
|
-
timestamp:
|
|
2534
|
+
timestamp: z10.string(),
|
|
2070
2535
|
/** CLEO session ID (e.g. `ses_20260424055456_ede571`). */
|
|
2071
|
-
sessionId:
|
|
2536
|
+
sessionId: z10.string(),
|
|
2072
2537
|
/** Event type that triggered this journal entry. */
|
|
2073
|
-
eventType:
|
|
2538
|
+
eventType: z10.enum(["session_start", "session_end", "observation", "decision", "error"]),
|
|
2074
2539
|
// Session metadata (set on session_start / session_end)
|
|
2075
2540
|
/** Agent identifier (e.g. `cleo-prime`, `claude-code`). */
|
|
2076
|
-
agentIdentifier:
|
|
2541
|
+
agentIdentifier: z10.string().optional(),
|
|
2077
2542
|
/** Provider adapter ID active for this session. */
|
|
2078
|
-
providerId:
|
|
2543
|
+
providerId: z10.string().optional(),
|
|
2079
2544
|
/** Session scope string (e.g. `'global'` or `'epic:T1263'`). */
|
|
2080
|
-
scope:
|
|
2545
|
+
scope: z10.string().optional(),
|
|
2081
2546
|
// Session-end fields
|
|
2082
2547
|
/** Duration of the session in seconds (session_end only). */
|
|
2083
|
-
duration:
|
|
2548
|
+
duration: z10.number().int().nonnegative().optional(),
|
|
2084
2549
|
/** Task IDs (not titles) completed during the session. */
|
|
2085
|
-
tasksCompleted:
|
|
2550
|
+
tasksCompleted: z10.array(z10.string()).optional(),
|
|
2086
2551
|
// Doctor summary (T1262 absorbed)
|
|
2087
2552
|
/** Compact result of `scanBrainNoise` run at session-end. */
|
|
2088
2553
|
doctorSummary: sessionJournalDoctorSummarySchema.optional(),
|
|
@@ -2091,7 +2556,7 @@ var init_session_journal = __esm({
|
|
|
2091
2556
|
debriefSummary: sessionJournalDebriefSummarySchema.optional(),
|
|
2092
2557
|
// Optional hash chain
|
|
2093
2558
|
/** SHA-256 hex of the previous entry's raw JSON string (for integrity chain). */
|
|
2094
|
-
prevEntryHash:
|
|
2559
|
+
prevEntryHash: z10.string().optional()
|
|
2095
2560
|
});
|
|
2096
2561
|
}
|
|
2097
2562
|
});
|
|
@@ -2111,52 +2576,52 @@ var init_task = __esm({
|
|
|
2111
2576
|
});
|
|
2112
2577
|
|
|
2113
2578
|
// packages/contracts/src/task-evidence.ts
|
|
2114
|
-
import { z as
|
|
2579
|
+
import { z as z11 } from "zod";
|
|
2115
2580
|
var fileEvidenceSchema, logEvidenceSchema, screenshotEvidenceSchema, testOutputEvidenceSchema, commandOutputEvidenceSchema, taskEvidenceSchema;
|
|
2116
2581
|
var init_task_evidence = __esm({
|
|
2117
2582
|
"packages/contracts/src/task-evidence.ts"() {
|
|
2118
2583
|
"use strict";
|
|
2119
|
-
fileEvidenceSchema =
|
|
2120
|
-
kind:
|
|
2121
|
-
sha256:
|
|
2122
|
-
timestamp:
|
|
2123
|
-
path:
|
|
2124
|
-
mime:
|
|
2125
|
-
description:
|
|
2126
|
-
});
|
|
2127
|
-
logEvidenceSchema =
|
|
2128
|
-
kind:
|
|
2129
|
-
sha256:
|
|
2130
|
-
timestamp:
|
|
2131
|
-
source:
|
|
2132
|
-
description:
|
|
2133
|
-
});
|
|
2134
|
-
screenshotEvidenceSchema =
|
|
2135
|
-
kind:
|
|
2136
|
-
sha256:
|
|
2137
|
-
timestamp:
|
|
2138
|
-
mime:
|
|
2139
|
-
description:
|
|
2140
|
-
});
|
|
2141
|
-
testOutputEvidenceSchema =
|
|
2142
|
-
kind:
|
|
2143
|
-
sha256:
|
|
2144
|
-
timestamp:
|
|
2145
|
-
passed:
|
|
2146
|
-
failed:
|
|
2147
|
-
skipped:
|
|
2148
|
-
exitCode:
|
|
2149
|
-
description:
|
|
2150
|
-
});
|
|
2151
|
-
commandOutputEvidenceSchema =
|
|
2152
|
-
kind:
|
|
2153
|
-
sha256:
|
|
2154
|
-
timestamp:
|
|
2155
|
-
cmd:
|
|
2156
|
-
exitCode:
|
|
2157
|
-
description:
|
|
2158
|
-
});
|
|
2159
|
-
taskEvidenceSchema =
|
|
2584
|
+
fileEvidenceSchema = z11.object({
|
|
2585
|
+
kind: z11.literal("file"),
|
|
2586
|
+
sha256: z11.string().length(64),
|
|
2587
|
+
timestamp: z11.string().datetime(),
|
|
2588
|
+
path: z11.string().min(1),
|
|
2589
|
+
mime: z11.string().optional(),
|
|
2590
|
+
description: z11.string().optional()
|
|
2591
|
+
});
|
|
2592
|
+
logEvidenceSchema = z11.object({
|
|
2593
|
+
kind: z11.literal("log"),
|
|
2594
|
+
sha256: z11.string().length(64),
|
|
2595
|
+
timestamp: z11.string().datetime(),
|
|
2596
|
+
source: z11.string().min(1),
|
|
2597
|
+
description: z11.string().optional()
|
|
2598
|
+
});
|
|
2599
|
+
screenshotEvidenceSchema = z11.object({
|
|
2600
|
+
kind: z11.literal("screenshot"),
|
|
2601
|
+
sha256: z11.string().length(64),
|
|
2602
|
+
timestamp: z11.string().datetime(),
|
|
2603
|
+
mime: z11.enum(["image/png", "image/jpeg", "image/webp"]).optional(),
|
|
2604
|
+
description: z11.string().optional()
|
|
2605
|
+
});
|
|
2606
|
+
testOutputEvidenceSchema = z11.object({
|
|
2607
|
+
kind: z11.literal("test-output"),
|
|
2608
|
+
sha256: z11.string().length(64),
|
|
2609
|
+
timestamp: z11.string().datetime(),
|
|
2610
|
+
passed: z11.number().int().nonnegative(),
|
|
2611
|
+
failed: z11.number().int().nonnegative(),
|
|
2612
|
+
skipped: z11.number().int().nonnegative(),
|
|
2613
|
+
exitCode: z11.number().int(),
|
|
2614
|
+
description: z11.string().optional()
|
|
2615
|
+
});
|
|
2616
|
+
commandOutputEvidenceSchema = z11.object({
|
|
2617
|
+
kind: z11.literal("command-output"),
|
|
2618
|
+
sha256: z11.string().length(64),
|
|
2619
|
+
timestamp: z11.string().datetime(),
|
|
2620
|
+
cmd: z11.string().min(1),
|
|
2621
|
+
exitCode: z11.number().int(),
|
|
2622
|
+
description: z11.string().optional()
|
|
2623
|
+
});
|
|
2624
|
+
taskEvidenceSchema = z11.discriminatedUnion("kind", [
|
|
2160
2625
|
fileEvidenceSchema,
|
|
2161
2626
|
logEvidenceSchema,
|
|
2162
2627
|
screenshotEvidenceSchema,
|
|
@@ -2167,12 +2632,12 @@ var init_task_evidence = __esm({
|
|
|
2167
2632
|
});
|
|
2168
2633
|
|
|
2169
2634
|
// packages/contracts/src/tasks/archive.ts
|
|
2170
|
-
import { z as
|
|
2635
|
+
import { z as z12 } from "zod";
|
|
2171
2636
|
var ArchiveReason, ARCHIVE_REASON_VALUES;
|
|
2172
2637
|
var init_archive = __esm({
|
|
2173
2638
|
"packages/contracts/src/tasks/archive.ts"() {
|
|
2174
2639
|
"use strict";
|
|
2175
|
-
ArchiveReason =
|
|
2640
|
+
ArchiveReason = z12.enum([
|
|
2176
2641
|
"verified",
|
|
2177
2642
|
"reconciled",
|
|
2178
2643
|
"superseded",
|
|
@@ -2184,6 +2649,67 @@ var init_archive = __esm({
|
|
|
2184
2649
|
}
|
|
2185
2650
|
});
|
|
2186
2651
|
|
|
2652
|
+
// packages/contracts/src/templates/manifest.ts
|
|
2653
|
+
import { z as z13 } from "zod";
|
|
2654
|
+
var TEMPLATE_KINDS, TEMPLATE_SUBSTITUTIONS, TEMPLATE_UPDATE_STRATEGIES, PLACEHOLDER_SOURCES, PlaceholderSpecSchema, TemplateManifestEntrySchema;
|
|
2655
|
+
var init_manifest2 = __esm({
|
|
2656
|
+
"packages/contracts/src/templates/manifest.ts"() {
|
|
2657
|
+
"use strict";
|
|
2658
|
+
TEMPLATE_KINDS = ["workflow", "config", "agent", "skill", "provider", "doc"];
|
|
2659
|
+
TEMPLATE_SUBSTITUTIONS = ["regex-tmpl", "static", "json-merge"];
|
|
2660
|
+
TEMPLATE_UPDATE_STRATEGIES = [
|
|
2661
|
+
"overwrite-on-bump",
|
|
2662
|
+
"diff-prompt",
|
|
2663
|
+
"immutable",
|
|
2664
|
+
"manifest-merge"
|
|
2665
|
+
];
|
|
2666
|
+
PLACEHOLDER_SOURCES = [
|
|
2667
|
+
"project-context",
|
|
2668
|
+
"project-info",
|
|
2669
|
+
".cleo/config",
|
|
2670
|
+
"~/.cleo/config",
|
|
2671
|
+
"tool-resolver",
|
|
2672
|
+
"literal"
|
|
2673
|
+
];
|
|
2674
|
+
PlaceholderSpecSchema = z13.object({
|
|
2675
|
+
/**
|
|
2676
|
+
* Placeholder identifier as it appears in the template body
|
|
2677
|
+
* (e.g. `NODE_VERSION` matches `{{NODE_VERSION}}`).
|
|
2678
|
+
*/
|
|
2679
|
+
name: z13.string().min(1, "placeholder name must be non-empty"),
|
|
2680
|
+
/** Resolver source the installer consults for this placeholder. */
|
|
2681
|
+
source: z13.enum(PLACEHOLDER_SOURCES),
|
|
2682
|
+
/**
|
|
2683
|
+
* Path expression evaluated against `source` (e.g. `engines.node` against
|
|
2684
|
+
* `project-context`, `defaults.branchModel` against `.cleo/config`).
|
|
2685
|
+
* For `literal` source, this MAY be the literal value's identifier.
|
|
2686
|
+
*/
|
|
2687
|
+
sourcePath: z13.string().min(1, "placeholder sourcePath must be non-empty"),
|
|
2688
|
+
/**
|
|
2689
|
+
* Fallback value used when `source[sourcePath]` resolves to `undefined`.
|
|
2690
|
+
* `null` is permitted to explicitly mark "no default — failure required".
|
|
2691
|
+
*/
|
|
2692
|
+
defaultValue: z13.union([z13.string(), z13.number(), z13.boolean(), z13.null()]).optional()
|
|
2693
|
+
});
|
|
2694
|
+
TemplateManifestEntrySchema = z13.object({
|
|
2695
|
+
/** Stable identifier for this template entry. */
|
|
2696
|
+
id: z13.string().min(1, "id must be non-empty"),
|
|
2697
|
+
/** Category of file this template represents. */
|
|
2698
|
+
kind: z13.enum(TEMPLATE_KINDS),
|
|
2699
|
+
/** Repo-relative path of the template source file. */
|
|
2700
|
+
sourcePath: z13.string().min(1, "sourcePath must be non-empty"),
|
|
2701
|
+
/** Project-relative path where the rendered template installs. */
|
|
2702
|
+
installPath: z13.string().min(1, "installPath must be non-empty"),
|
|
2703
|
+
/** Substitution strategy the installer applies to `sourcePath`. */
|
|
2704
|
+
substitution: z13.enum(TEMPLATE_SUBSTITUTIONS),
|
|
2705
|
+
/** Declared placeholders this template requires. May be empty. */
|
|
2706
|
+
placeholders: z13.array(PlaceholderSpecSchema),
|
|
2707
|
+
/** Reconciliation policy on upgrade. */
|
|
2708
|
+
updateStrategy: z13.enum(TEMPLATE_UPDATE_STRATEGIES)
|
|
2709
|
+
});
|
|
2710
|
+
}
|
|
2711
|
+
});
|
|
2712
|
+
|
|
2187
2713
|
// packages/contracts/src/index.ts
|
|
2188
2714
|
var init_src = __esm({
|
|
2189
2715
|
"packages/contracts/src/index.ts"() {
|
|
@@ -2193,10 +2719,12 @@ var init_src = __esm({
|
|
|
2193
2719
|
init_branch_lock();
|
|
2194
2720
|
init_changesets();
|
|
2195
2721
|
init_cli_category();
|
|
2722
|
+
init_manifest();
|
|
2196
2723
|
init_credentials();
|
|
2197
2724
|
init_db_inventory2();
|
|
2198
2725
|
init_identity();
|
|
2199
2726
|
init_operations_registry();
|
|
2727
|
+
init_provenance();
|
|
2200
2728
|
init_docs_taxonomy();
|
|
2201
2729
|
init_engine_result();
|
|
2202
2730
|
init_enums();
|
|
@@ -2213,6 +2741,7 @@ var init_src = __esm({
|
|
|
2213
2741
|
init_operations();
|
|
2214
2742
|
init_nexus_scope_map();
|
|
2215
2743
|
init_params();
|
|
2744
|
+
init_tasks();
|
|
2216
2745
|
init_peer();
|
|
2217
2746
|
init_evidence_atoms();
|
|
2218
2747
|
init_plan();
|
|
@@ -2223,6 +2752,7 @@ var init_src = __esm({
|
|
|
2223
2752
|
init_task();
|
|
2224
2753
|
init_task_evidence();
|
|
2225
2754
|
init_archive();
|
|
2755
|
+
init_manifest2();
|
|
2226
2756
|
}
|
|
2227
2757
|
});
|
|
2228
2758
|
|
|
@@ -16242,7 +16772,7 @@ function resolveRef(ref, ctx) {
|
|
|
16242
16772
|
function convertBaseSchema(schema, ctx) {
|
|
16243
16773
|
if (schema.not !== void 0) {
|
|
16244
16774
|
if (typeof schema.not === "object" && Object.keys(schema.not).length === 0) {
|
|
16245
|
-
return
|
|
16775
|
+
return z14.never();
|
|
16246
16776
|
}
|
|
16247
16777
|
throw new Error("not is not supported in Zod (except { not: {} } for never)");
|
|
16248
16778
|
}
|
|
@@ -16264,7 +16794,7 @@ function convertBaseSchema(schema, ctx) {
|
|
|
16264
16794
|
return ctx.refs.get(refPath);
|
|
16265
16795
|
}
|
|
16266
16796
|
if (ctx.processing.has(refPath)) {
|
|
16267
|
-
return
|
|
16797
|
+
return z14.lazy(() => {
|
|
16268
16798
|
if (!ctx.refs.has(refPath)) {
|
|
16269
16799
|
throw new Error(`Circular reference not resolved: ${refPath}`);
|
|
16270
16800
|
}
|
|
@@ -16281,25 +16811,25 @@ function convertBaseSchema(schema, ctx) {
|
|
|
16281
16811
|
if (schema.enum !== void 0) {
|
|
16282
16812
|
const enumValues = schema.enum;
|
|
16283
16813
|
if (ctx.version === "openapi-3.0" && schema.nullable === true && enumValues.length === 1 && enumValues[0] === null) {
|
|
16284
|
-
return
|
|
16814
|
+
return z14.null();
|
|
16285
16815
|
}
|
|
16286
16816
|
if (enumValues.length === 0) {
|
|
16287
|
-
return
|
|
16817
|
+
return z14.never();
|
|
16288
16818
|
}
|
|
16289
16819
|
if (enumValues.length === 1) {
|
|
16290
|
-
return
|
|
16820
|
+
return z14.literal(enumValues[0]);
|
|
16291
16821
|
}
|
|
16292
16822
|
if (enumValues.every((v) => typeof v === "string")) {
|
|
16293
|
-
return
|
|
16823
|
+
return z14.enum(enumValues);
|
|
16294
16824
|
}
|
|
16295
|
-
const literalSchemas = enumValues.map((v) =>
|
|
16825
|
+
const literalSchemas = enumValues.map((v) => z14.literal(v));
|
|
16296
16826
|
if (literalSchemas.length < 2) {
|
|
16297
16827
|
return literalSchemas[0];
|
|
16298
16828
|
}
|
|
16299
|
-
return
|
|
16829
|
+
return z14.union([literalSchemas[0], literalSchemas[1], ...literalSchemas.slice(2)]);
|
|
16300
16830
|
}
|
|
16301
16831
|
if (schema.const !== void 0) {
|
|
16302
|
-
return
|
|
16832
|
+
return z14.literal(schema.const);
|
|
16303
16833
|
}
|
|
16304
16834
|
const type = schema.type;
|
|
16305
16835
|
if (Array.isArray(type)) {
|
|
@@ -16308,68 +16838,68 @@ function convertBaseSchema(schema, ctx) {
|
|
|
16308
16838
|
return convertBaseSchema(typeSchema, ctx);
|
|
16309
16839
|
});
|
|
16310
16840
|
if (typeSchemas.length === 0) {
|
|
16311
|
-
return
|
|
16841
|
+
return z14.never();
|
|
16312
16842
|
}
|
|
16313
16843
|
if (typeSchemas.length === 1) {
|
|
16314
16844
|
return typeSchemas[0];
|
|
16315
16845
|
}
|
|
16316
|
-
return
|
|
16846
|
+
return z14.union(typeSchemas);
|
|
16317
16847
|
}
|
|
16318
16848
|
if (!type) {
|
|
16319
|
-
return
|
|
16849
|
+
return z14.any();
|
|
16320
16850
|
}
|
|
16321
16851
|
let zodSchema2;
|
|
16322
16852
|
switch (type) {
|
|
16323
16853
|
case "string": {
|
|
16324
|
-
let stringSchema =
|
|
16854
|
+
let stringSchema = z14.string();
|
|
16325
16855
|
if (schema.format) {
|
|
16326
16856
|
const format = schema.format;
|
|
16327
16857
|
if (format === "email") {
|
|
16328
|
-
stringSchema = stringSchema.check(
|
|
16858
|
+
stringSchema = stringSchema.check(z14.email());
|
|
16329
16859
|
} else if (format === "uri" || format === "uri-reference") {
|
|
16330
|
-
stringSchema = stringSchema.check(
|
|
16860
|
+
stringSchema = stringSchema.check(z14.url());
|
|
16331
16861
|
} else if (format === "uuid" || format === "guid") {
|
|
16332
|
-
stringSchema = stringSchema.check(
|
|
16862
|
+
stringSchema = stringSchema.check(z14.uuid());
|
|
16333
16863
|
} else if (format === "date-time") {
|
|
16334
|
-
stringSchema = stringSchema.check(
|
|
16864
|
+
stringSchema = stringSchema.check(z14.iso.datetime());
|
|
16335
16865
|
} else if (format === "date") {
|
|
16336
|
-
stringSchema = stringSchema.check(
|
|
16866
|
+
stringSchema = stringSchema.check(z14.iso.date());
|
|
16337
16867
|
} else if (format === "time") {
|
|
16338
|
-
stringSchema = stringSchema.check(
|
|
16868
|
+
stringSchema = stringSchema.check(z14.iso.time());
|
|
16339
16869
|
} else if (format === "duration") {
|
|
16340
|
-
stringSchema = stringSchema.check(
|
|
16870
|
+
stringSchema = stringSchema.check(z14.iso.duration());
|
|
16341
16871
|
} else if (format === "ipv4") {
|
|
16342
|
-
stringSchema = stringSchema.check(
|
|
16872
|
+
stringSchema = stringSchema.check(z14.ipv4());
|
|
16343
16873
|
} else if (format === "ipv6") {
|
|
16344
|
-
stringSchema = stringSchema.check(
|
|
16874
|
+
stringSchema = stringSchema.check(z14.ipv6());
|
|
16345
16875
|
} else if (format === "mac") {
|
|
16346
|
-
stringSchema = stringSchema.check(
|
|
16876
|
+
stringSchema = stringSchema.check(z14.mac());
|
|
16347
16877
|
} else if (format === "cidr") {
|
|
16348
|
-
stringSchema = stringSchema.check(
|
|
16878
|
+
stringSchema = stringSchema.check(z14.cidrv4());
|
|
16349
16879
|
} else if (format === "cidr-v6") {
|
|
16350
|
-
stringSchema = stringSchema.check(
|
|
16880
|
+
stringSchema = stringSchema.check(z14.cidrv6());
|
|
16351
16881
|
} else if (format === "base64") {
|
|
16352
|
-
stringSchema = stringSchema.check(
|
|
16882
|
+
stringSchema = stringSchema.check(z14.base64());
|
|
16353
16883
|
} else if (format === "base64url") {
|
|
16354
|
-
stringSchema = stringSchema.check(
|
|
16884
|
+
stringSchema = stringSchema.check(z14.base64url());
|
|
16355
16885
|
} else if (format === "e164") {
|
|
16356
|
-
stringSchema = stringSchema.check(
|
|
16886
|
+
stringSchema = stringSchema.check(z14.e164());
|
|
16357
16887
|
} else if (format === "jwt") {
|
|
16358
|
-
stringSchema = stringSchema.check(
|
|
16888
|
+
stringSchema = stringSchema.check(z14.jwt());
|
|
16359
16889
|
} else if (format === "emoji") {
|
|
16360
|
-
stringSchema = stringSchema.check(
|
|
16890
|
+
stringSchema = stringSchema.check(z14.emoji());
|
|
16361
16891
|
} else if (format === "nanoid") {
|
|
16362
|
-
stringSchema = stringSchema.check(
|
|
16892
|
+
stringSchema = stringSchema.check(z14.nanoid());
|
|
16363
16893
|
} else if (format === "cuid") {
|
|
16364
|
-
stringSchema = stringSchema.check(
|
|
16894
|
+
stringSchema = stringSchema.check(z14.cuid());
|
|
16365
16895
|
} else if (format === "cuid2") {
|
|
16366
|
-
stringSchema = stringSchema.check(
|
|
16896
|
+
stringSchema = stringSchema.check(z14.cuid2());
|
|
16367
16897
|
} else if (format === "ulid") {
|
|
16368
|
-
stringSchema = stringSchema.check(
|
|
16898
|
+
stringSchema = stringSchema.check(z14.ulid());
|
|
16369
16899
|
} else if (format === "xid") {
|
|
16370
|
-
stringSchema = stringSchema.check(
|
|
16900
|
+
stringSchema = stringSchema.check(z14.xid());
|
|
16371
16901
|
} else if (format === "ksuid") {
|
|
16372
|
-
stringSchema = stringSchema.check(
|
|
16902
|
+
stringSchema = stringSchema.check(z14.ksuid());
|
|
16373
16903
|
}
|
|
16374
16904
|
}
|
|
16375
16905
|
if (typeof schema.minLength === "number") {
|
|
@@ -16386,7 +16916,7 @@ function convertBaseSchema(schema, ctx) {
|
|
|
16386
16916
|
}
|
|
16387
16917
|
case "number":
|
|
16388
16918
|
case "integer": {
|
|
16389
|
-
let numberSchema = type === "integer" ?
|
|
16919
|
+
let numberSchema = type === "integer" ? z14.number().int() : z14.number();
|
|
16390
16920
|
if (typeof schema.minimum === "number") {
|
|
16391
16921
|
numberSchema = numberSchema.min(schema.minimum);
|
|
16392
16922
|
}
|
|
@@ -16410,11 +16940,11 @@ function convertBaseSchema(schema, ctx) {
|
|
|
16410
16940
|
break;
|
|
16411
16941
|
}
|
|
16412
16942
|
case "boolean": {
|
|
16413
|
-
zodSchema2 =
|
|
16943
|
+
zodSchema2 = z14.boolean();
|
|
16414
16944
|
break;
|
|
16415
16945
|
}
|
|
16416
16946
|
case "null": {
|
|
16417
|
-
zodSchema2 =
|
|
16947
|
+
zodSchema2 = z14.null();
|
|
16418
16948
|
break;
|
|
16419
16949
|
}
|
|
16420
16950
|
case "object": {
|
|
@@ -16427,14 +16957,14 @@ function convertBaseSchema(schema, ctx) {
|
|
|
16427
16957
|
}
|
|
16428
16958
|
if (schema.propertyNames) {
|
|
16429
16959
|
const keySchema = convertSchema(schema.propertyNames, ctx);
|
|
16430
|
-
const valueSchema = schema.additionalProperties && typeof schema.additionalProperties === "object" ? convertSchema(schema.additionalProperties, ctx) :
|
|
16960
|
+
const valueSchema = schema.additionalProperties && typeof schema.additionalProperties === "object" ? convertSchema(schema.additionalProperties, ctx) : z14.any();
|
|
16431
16961
|
if (Object.keys(shape).length === 0) {
|
|
16432
|
-
zodSchema2 =
|
|
16962
|
+
zodSchema2 = z14.record(keySchema, valueSchema);
|
|
16433
16963
|
break;
|
|
16434
16964
|
}
|
|
16435
|
-
const objectSchema2 =
|
|
16436
|
-
const recordSchema =
|
|
16437
|
-
zodSchema2 =
|
|
16965
|
+
const objectSchema2 = z14.object(shape).passthrough();
|
|
16966
|
+
const recordSchema = z14.looseRecord(keySchema, valueSchema);
|
|
16967
|
+
zodSchema2 = z14.intersection(objectSchema2, recordSchema);
|
|
16438
16968
|
break;
|
|
16439
16969
|
}
|
|
16440
16970
|
if (schema.patternProperties) {
|
|
@@ -16443,28 +16973,28 @@ function convertBaseSchema(schema, ctx) {
|
|
|
16443
16973
|
const looseRecords = [];
|
|
16444
16974
|
for (const pattern of patternKeys) {
|
|
16445
16975
|
const patternValue = convertSchema(patternProps[pattern], ctx);
|
|
16446
|
-
const keySchema =
|
|
16447
|
-
looseRecords.push(
|
|
16976
|
+
const keySchema = z14.string().regex(new RegExp(pattern));
|
|
16977
|
+
looseRecords.push(z14.looseRecord(keySchema, patternValue));
|
|
16448
16978
|
}
|
|
16449
16979
|
const schemasToIntersect = [];
|
|
16450
16980
|
if (Object.keys(shape).length > 0) {
|
|
16451
|
-
schemasToIntersect.push(
|
|
16981
|
+
schemasToIntersect.push(z14.object(shape).passthrough());
|
|
16452
16982
|
}
|
|
16453
16983
|
schemasToIntersect.push(...looseRecords);
|
|
16454
16984
|
if (schemasToIntersect.length === 0) {
|
|
16455
|
-
zodSchema2 =
|
|
16985
|
+
zodSchema2 = z14.object({}).passthrough();
|
|
16456
16986
|
} else if (schemasToIntersect.length === 1) {
|
|
16457
16987
|
zodSchema2 = schemasToIntersect[0];
|
|
16458
16988
|
} else {
|
|
16459
|
-
let result =
|
|
16989
|
+
let result = z14.intersection(schemasToIntersect[0], schemasToIntersect[1]);
|
|
16460
16990
|
for (let i = 2; i < schemasToIntersect.length; i++) {
|
|
16461
|
-
result =
|
|
16991
|
+
result = z14.intersection(result, schemasToIntersect[i]);
|
|
16462
16992
|
}
|
|
16463
16993
|
zodSchema2 = result;
|
|
16464
16994
|
}
|
|
16465
16995
|
break;
|
|
16466
16996
|
}
|
|
16467
|
-
const objectSchema =
|
|
16997
|
+
const objectSchema = z14.object(shape);
|
|
16468
16998
|
if (schema.additionalProperties === false) {
|
|
16469
16999
|
zodSchema2 = objectSchema.strict();
|
|
16470
17000
|
} else if (typeof schema.additionalProperties === "object") {
|
|
@@ -16481,33 +17011,33 @@ function convertBaseSchema(schema, ctx) {
|
|
|
16481
17011
|
const tupleItems = prefixItems.map((item) => convertSchema(item, ctx));
|
|
16482
17012
|
const rest = items && typeof items === "object" && !Array.isArray(items) ? convertSchema(items, ctx) : void 0;
|
|
16483
17013
|
if (rest) {
|
|
16484
|
-
zodSchema2 =
|
|
17014
|
+
zodSchema2 = z14.tuple(tupleItems).rest(rest);
|
|
16485
17015
|
} else {
|
|
16486
|
-
zodSchema2 =
|
|
17016
|
+
zodSchema2 = z14.tuple(tupleItems);
|
|
16487
17017
|
}
|
|
16488
17018
|
if (typeof schema.minItems === "number") {
|
|
16489
|
-
zodSchema2 = zodSchema2.check(
|
|
17019
|
+
zodSchema2 = zodSchema2.check(z14.minLength(schema.minItems));
|
|
16490
17020
|
}
|
|
16491
17021
|
if (typeof schema.maxItems === "number") {
|
|
16492
|
-
zodSchema2 = zodSchema2.check(
|
|
17022
|
+
zodSchema2 = zodSchema2.check(z14.maxLength(schema.maxItems));
|
|
16493
17023
|
}
|
|
16494
17024
|
} else if (Array.isArray(items)) {
|
|
16495
17025
|
const tupleItems = items.map((item) => convertSchema(item, ctx));
|
|
16496
17026
|
const rest = schema.additionalItems && typeof schema.additionalItems === "object" ? convertSchema(schema.additionalItems, ctx) : void 0;
|
|
16497
17027
|
if (rest) {
|
|
16498
|
-
zodSchema2 =
|
|
17028
|
+
zodSchema2 = z14.tuple(tupleItems).rest(rest);
|
|
16499
17029
|
} else {
|
|
16500
|
-
zodSchema2 =
|
|
17030
|
+
zodSchema2 = z14.tuple(tupleItems);
|
|
16501
17031
|
}
|
|
16502
17032
|
if (typeof schema.minItems === "number") {
|
|
16503
|
-
zodSchema2 = zodSchema2.check(
|
|
17033
|
+
zodSchema2 = zodSchema2.check(z14.minLength(schema.minItems));
|
|
16504
17034
|
}
|
|
16505
17035
|
if (typeof schema.maxItems === "number") {
|
|
16506
|
-
zodSchema2 = zodSchema2.check(
|
|
17036
|
+
zodSchema2 = zodSchema2.check(z14.maxLength(schema.maxItems));
|
|
16507
17037
|
}
|
|
16508
17038
|
} else if (items !== void 0) {
|
|
16509
17039
|
const element = convertSchema(items, ctx);
|
|
16510
|
-
let arraySchema =
|
|
17040
|
+
let arraySchema = z14.array(element);
|
|
16511
17041
|
if (typeof schema.minItems === "number") {
|
|
16512
17042
|
arraySchema = arraySchema.min(schema.minItems);
|
|
16513
17043
|
}
|
|
@@ -16516,7 +17046,7 @@ function convertBaseSchema(schema, ctx) {
|
|
|
16516
17046
|
}
|
|
16517
17047
|
zodSchema2 = arraySchema;
|
|
16518
17048
|
} else {
|
|
16519
|
-
zodSchema2 =
|
|
17049
|
+
zodSchema2 = z14.array(z14.any());
|
|
16520
17050
|
}
|
|
16521
17051
|
break;
|
|
16522
17052
|
}
|
|
@@ -16533,37 +17063,37 @@ function convertBaseSchema(schema, ctx) {
|
|
|
16533
17063
|
}
|
|
16534
17064
|
function convertSchema(schema, ctx) {
|
|
16535
17065
|
if (typeof schema === "boolean") {
|
|
16536
|
-
return schema ?
|
|
17066
|
+
return schema ? z14.any() : z14.never();
|
|
16537
17067
|
}
|
|
16538
17068
|
let baseSchema = convertBaseSchema(schema, ctx);
|
|
16539
17069
|
const hasExplicitType = schema.type || schema.enum !== void 0 || schema.const !== void 0;
|
|
16540
17070
|
if (schema.anyOf && Array.isArray(schema.anyOf)) {
|
|
16541
17071
|
const options = schema.anyOf.map((s) => convertSchema(s, ctx));
|
|
16542
|
-
const anyOfUnion =
|
|
16543
|
-
baseSchema = hasExplicitType ?
|
|
17072
|
+
const anyOfUnion = z14.union(options);
|
|
17073
|
+
baseSchema = hasExplicitType ? z14.intersection(baseSchema, anyOfUnion) : anyOfUnion;
|
|
16544
17074
|
}
|
|
16545
17075
|
if (schema.oneOf && Array.isArray(schema.oneOf)) {
|
|
16546
17076
|
const options = schema.oneOf.map((s) => convertSchema(s, ctx));
|
|
16547
|
-
const oneOfUnion =
|
|
16548
|
-
baseSchema = hasExplicitType ?
|
|
17077
|
+
const oneOfUnion = z14.xor(options);
|
|
17078
|
+
baseSchema = hasExplicitType ? z14.intersection(baseSchema, oneOfUnion) : oneOfUnion;
|
|
16549
17079
|
}
|
|
16550
17080
|
if (schema.allOf && Array.isArray(schema.allOf)) {
|
|
16551
17081
|
if (schema.allOf.length === 0) {
|
|
16552
|
-
baseSchema = hasExplicitType ? baseSchema :
|
|
17082
|
+
baseSchema = hasExplicitType ? baseSchema : z14.any();
|
|
16553
17083
|
} else {
|
|
16554
17084
|
let result = hasExplicitType ? baseSchema : convertSchema(schema.allOf[0], ctx);
|
|
16555
17085
|
const startIdx = hasExplicitType ? 0 : 1;
|
|
16556
17086
|
for (let i = startIdx; i < schema.allOf.length; i++) {
|
|
16557
|
-
result =
|
|
17087
|
+
result = z14.intersection(result, convertSchema(schema.allOf[i], ctx));
|
|
16558
17088
|
}
|
|
16559
17089
|
baseSchema = result;
|
|
16560
17090
|
}
|
|
16561
17091
|
}
|
|
16562
17092
|
if (schema.nullable === true && ctx.version === "openapi-3.0") {
|
|
16563
|
-
baseSchema =
|
|
17093
|
+
baseSchema = z14.nullable(baseSchema);
|
|
16564
17094
|
}
|
|
16565
17095
|
if (schema.readOnly === true) {
|
|
16566
|
-
baseSchema =
|
|
17096
|
+
baseSchema = z14.readonly(baseSchema);
|
|
16567
17097
|
}
|
|
16568
17098
|
const extraMeta = {};
|
|
16569
17099
|
const coreMetadataKeys = ["$id", "id", "$comment", "$anchor", "$vocabulary", "$dynamicRef", "$dynamicAnchor"];
|
|
@@ -16590,7 +17120,7 @@ function convertSchema(schema, ctx) {
|
|
|
16590
17120
|
}
|
|
16591
17121
|
function fromJSONSchema(schema, params) {
|
|
16592
17122
|
if (typeof schema === "boolean") {
|
|
16593
|
-
return schema ?
|
|
17123
|
+
return schema ? z14.any() : z14.never();
|
|
16594
17124
|
}
|
|
16595
17125
|
const version2 = detectVersion(schema, params?.defaultTarget);
|
|
16596
17126
|
const defs = schema.$defs || schema.definitions || {};
|
|
@@ -16604,14 +17134,14 @@ function fromJSONSchema(schema, params) {
|
|
|
16604
17134
|
};
|
|
16605
17135
|
return convertSchema(schema, ctx);
|
|
16606
17136
|
}
|
|
16607
|
-
var
|
|
17137
|
+
var z14, RECOGNIZED_KEYS;
|
|
16608
17138
|
var init_from_json_schema = __esm({
|
|
16609
17139
|
"node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/from-json-schema.js"() {
|
|
16610
17140
|
init_registries();
|
|
16611
17141
|
init_checks2();
|
|
16612
17142
|
init_iso();
|
|
16613
17143
|
init_schemas2();
|
|
16614
|
-
|
|
17144
|
+
z14 = {
|
|
16615
17145
|
...schemas_exports2,
|
|
16616
17146
|
...checks_exports2,
|
|
16617
17147
|
iso: iso_exports
|