@cleocode/adapters 2026.11.1-canary.9 → 2026.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/.source-stamp.json +1 -1
  2. package/dist/index.js +1691 -1354
  3. package/dist/index.js.map +3 -3
  4. package/dist/orca-execution.d.ts +90 -0
  5. package/dist/orca-execution.d.ts.map +1 -0
  6. package/dist/orca-execution.js +843 -0
  7. package/dist/orca-execution.js.map +6 -0
  8. package/dist/providers/claude-code/index.js +1689 -1357
  9. package/dist/providers/claude-code/index.js.map +3 -3
  10. package/dist/providers/claude-code/lead-session.d.ts +8 -5
  11. package/dist/providers/claude-code/lead-session.d.ts.map +1 -1
  12. package/dist/providers/claude-sdk/index.js +1674 -1352
  13. package/dist/providers/claude-sdk/index.js.map +3 -3
  14. package/dist/providers/claude-sdk/spawn.d.ts.map +1 -1
  15. package/dist/providers/codex/index.js +1540 -1233
  16. package/dist/providers/codex/index.js.map +3 -3
  17. package/dist/providers/gemini-cli/index.js +1540 -1233
  18. package/dist/providers/gemini-cli/index.js.map +3 -3
  19. package/dist/providers/kimi/index.js +1540 -1233
  20. package/dist/providers/kimi/index.js.map +3 -3
  21. package/dist/providers/openai-sdk/index.js +1660 -1353
  22. package/dist/providers/openai-sdk/index.js.map +3 -3
  23. package/dist/providers/opencode/index.js +1540 -1233
  24. package/dist/providers/opencode/index.js.map +3 -3
  25. package/dist/providers/pi/index.js +1540 -1233
  26. package/dist/providers/pi/index.js.map +3 -3
  27. package/package.json +10 -6
  28. package/src/__tests__/orca-execution-fixture.ts +422 -0
  29. package/src/__tests__/orca-execution.test.ts +1357 -0
  30. package/src/__tests__/orca-plugin-panel.test.ts +661 -0
  31. package/src/__tests__/orca-plugin.test.ts +660 -0
  32. package/src/orca-execution.ts +1193 -0
  33. package/src/providers/claude-code/__tests__/lead-mcp.test.ts +27 -2
  34. package/src/providers/claude-code/lead-session.ts +21 -8
  35. package/src/providers/claude-sdk/__tests__/spawn.test.ts +19 -0
  36. package/src/providers/claude-sdk/spawn.ts +14 -0
  37. package/src/providers/shared/__tests__/lead-tool-strip.test.ts +1 -1
package/dist/index.js CHANGED
@@ -1125,19 +1125,329 @@ var init_code_symbol = __esm({
1125
1125
  }
1126
1126
  });
1127
1127
 
1128
- // packages/contracts/src/config/worker-policy.ts
1128
+ // packages/contracts/src/orca-execution.ts
1129
1129
  import { z as z4 } from "zod";
1130
+ var identifier, orcaAgentSchema, DEFAULT_ORCA_AGENTS, orchestrateOrcaConfigSchema, orcaContextSchema, orcaRoutingRunSchema, orcaLaunchSchema, orcaStartBindingSchema, orcaAttemptSchema, orcaWorkerDoneSchema, orcaWorkerReportSchema, orcaReportDeliverySchema, orcaWorkerSettlementSchema, orcaReportMessageSchema, orcaReportSourceSchema, orcaWorkerDonePayloadSchema, orcaWorkerRequestSchema, effectSchema, selectionSchema, orcaReplySchema, orcaCommandRegistrySchema, accountProviderSchema, orcaAccountReplySchema;
1131
+ var init_orca_execution = __esm({
1132
+ "packages/contracts/src/orca-execution.ts"() {
1133
+ "use strict";
1134
+ identifier = z4.string().min(1);
1135
+ orcaAgentSchema = z4.enum(["codex", "opencode2", "claude", "grok"]);
1136
+ DEFAULT_ORCA_AGENTS = ["codex", "opencode2", "claude"];
1137
+ orchestrateOrcaConfigSchema = z4.object({
1138
+ agents: z4.array(orcaAgentSchema).min(1).refine((agents) => new Set(agents).size === agents.length, "Agent ids must be unique.").default(DEFAULT_ORCA_AGENTS)
1139
+ });
1140
+ orcaContextSchema = z4.object({
1141
+ runtimeId: identifier,
1142
+ coordinatorHandle: identifier,
1143
+ executionHostId: z4.literal("local")
1144
+ });
1145
+ orcaRoutingRunSchema = z4.object({
1146
+ runId: identifier.nullable(),
1147
+ unconfiguredAgents: z4.array(orcaAgentSchema)
1148
+ });
1149
+ orcaLaunchSchema = z4.object({
1150
+ projectId: identifier,
1151
+ projectRoot: identifier,
1152
+ taskId: identifier,
1153
+ instanceId: identifier,
1154
+ workerSessionId: identifier,
1155
+ agentId: identifier,
1156
+ role: z4.enum(["worker", "lead"]),
1157
+ protocol: identifier,
1158
+ worktreePath: identifier,
1159
+ worktreeBranch: identifier,
1160
+ projectHash: identifier,
1161
+ lockToken: identifier,
1162
+ prompt: identifier,
1163
+ harness: z4.enum(["claude-code", "codex", "opencode", "grok", "kimi"]),
1164
+ leadMailbox: identifier.nullable(),
1165
+ model: identifier.optional(),
1166
+ effort: identifier.optional(),
1167
+ accountId: identifier.optional()
1168
+ });
1169
+ orcaStartBindingSchema = z4.object({
1170
+ runId: identifier.nullable(),
1171
+ orcaTaskId: identifier.nullable(),
1172
+ retryOf: identifier.nullable()
1173
+ });
1174
+ orcaAttemptSchema = z4.object({
1175
+ backend: z4.literal("orca"),
1176
+ version: z4.literal(1),
1177
+ /** Monotonic local CAS revision; repeated identical observations still serialize. */
1178
+ revision: z4.number().int().nonnegative(),
1179
+ context: orcaContextSchema,
1180
+ launch: orcaLaunchSchema,
1181
+ promptDigest: z4.string().regex(/^[a-f0-9]{64}$/),
1182
+ workspaceId: identifier,
1183
+ workspaceSelector: identifier,
1184
+ state: z4.enum([
1185
+ "prepared",
1186
+ "launching",
1187
+ "ready",
1188
+ "turn_unobserved",
1189
+ "outcome_unknown",
1190
+ "stop_pending",
1191
+ "stop_unknown",
1192
+ "stopped",
1193
+ "failed",
1194
+ "circuit_broken"
1195
+ ]),
1196
+ runId: identifier.nullable(),
1197
+ orcaTaskId: identifier.nullable(),
1198
+ dispatchId: identifier.nullable(),
1199
+ retryOf: identifier.nullable(),
1200
+ /** Absent on legacy records, whose original argv cannot safely be reconstructed. */
1201
+ startBinding: orcaStartBindingSchema.optional(),
1202
+ /** UUID reserved before committing a retry; its first send and every replay use this key. */
1203
+ startRequestKey: z4.string().uuid().optional(),
1204
+ startRequestId: identifier.nullable(),
1205
+ /** UUID reserved before committing a stop; its first send and every replay use this key. */
1206
+ stopRequestKey: z4.string().uuid().optional(),
1207
+ /** Orca-issued stop request id, retained only when the stop receipt was received. */
1208
+ stopRequestId: identifier.nullable(),
1209
+ /**
1210
+ * Set when the worker-stop reply came from a runtime that proved it enumerates
1211
+ * every helper it stopped, so an omitted helper list means the worker had none.
1212
+ */
1213
+ stopHelperEvidence: z4.literal("enumerated").optional(),
1214
+ failureCount: z4.number().int().nonnegative(),
1215
+ resourceState: z4.string(),
1216
+ /** Full receipts retain effects, residual resources and recovery advice. */
1217
+ lastReceipt: z4.string().nullable(),
1218
+ lastError: z4.string().nullable(),
1219
+ /** Confirmed pre-dispatch refusal; never inferred from a process exit. */
1220
+ startRefusal: z4.literal("agent_unconfigured").optional(),
1221
+ observedAt: z4.string()
1222
+ });
1223
+ orcaWorkerDoneSchema = z4.object({
1224
+ messageId: identifier,
1225
+ runtimeId: identifier,
1226
+ runId: identifier,
1227
+ orcaTaskId: identifier,
1228
+ dispatchId: identifier,
1229
+ senderHandle: identifier,
1230
+ outcome: z4.enum(["succeeded", "failed"]),
1231
+ body: z4.string(),
1232
+ reportPath: identifier
1233
+ });
1234
+ orcaWorkerReportSchema = z4.object({
1235
+ event: orcaWorkerDoneSchema,
1236
+ manifestId: identifier,
1237
+ manifestDigest: z4.string().regex(/^[a-f0-9]{64}$/),
1238
+ reportText: z4.string().min(1).max(65536),
1239
+ reportDigest: z4.string().regex(/^[a-f0-9]{64}$/),
1240
+ ingestedAt: z4.string().datetime()
1241
+ });
1242
+ orcaReportDeliverySchema = z4.object({
1243
+ key: identifier,
1244
+ mailbox: identifier.nullable(),
1245
+ state: z4.enum(["pending", "delivered"]),
1246
+ messageId: identifier.nullable(),
1247
+ deliveredAt: z4.string().datetime().nullable(),
1248
+ lastError: z4.string().nullable()
1249
+ });
1250
+ orcaWorkerSettlementSchema = z4.object({
1251
+ resourceRelease: z4.object({
1252
+ dispatchId: identifier,
1253
+ releasedAt: z4.string().datetime(),
1254
+ receiptDigest: z4.string().regex(/^[a-f0-9]{64}$/),
1255
+ receipt: identifier
1256
+ }).optional(),
1257
+ retiredAt: z4.string().datetime().optional(),
1258
+ reportDelivery: orcaReportDeliverySchema.optional()
1259
+ });
1260
+ orcaReportMessageSchema = z4.object({
1261
+ id: identifier,
1262
+ run_id: z4.string().nullable(),
1263
+ delivery_contract: z4.string(),
1264
+ from_handle: z4.string(),
1265
+ to_handle: z4.string(),
1266
+ type: z4.string(),
1267
+ body: z4.string(),
1268
+ payload: z4.string().nullable(),
1269
+ sender_pane_key: z4.string().nullable()
1270
+ });
1271
+ orcaReportSourceSchema = z4.object({
1272
+ ok: z4.literal(true),
1273
+ _meta: z4.object({ runtimeId: identifier }),
1274
+ result: z4.object({
1275
+ messages: z4.array(z4.json()).optional(),
1276
+ dispatch: z4.object({
1277
+ id: identifier,
1278
+ run_id: identifier,
1279
+ task_id: identifier,
1280
+ assignee_handle: identifier,
1281
+ assignee_pane_key: z4.string().nullable(),
1282
+ status: z4.string()
1283
+ }).optional()
1284
+ })
1285
+ });
1286
+ orcaWorkerDonePayloadSchema = z4.object({
1287
+ taskId: identifier,
1288
+ dispatchId: identifier,
1289
+ outcome: z4.enum(["succeeded", "failed"]),
1290
+ reportPath: identifier
1291
+ });
1292
+ orcaWorkerRequestSchema = z4.object({
1293
+ action: z4.enum([
1294
+ "show",
1295
+ "read",
1296
+ "recover-start",
1297
+ "recover-stop",
1298
+ "retry",
1299
+ "stop",
1300
+ "ingest-report",
1301
+ "relay-report"
1302
+ ]),
1303
+ recordId: identifier,
1304
+ cursor: identifier.optional(),
1305
+ messageId: identifier.optional()
1306
+ }).refine(({ action, cursor }) => cursor === void 0 || action === "read", {
1307
+ message: "A source-pinned cursor is accepted only for read.",
1308
+ path: ["cursor"]
1309
+ }).refine(({ action, messageId }) => action === "ingest-report" === (messageId !== void 0), {
1310
+ message: "ingest-report requires an exact message id; other actions do not accept one.",
1311
+ path: ["messageId"]
1312
+ });
1313
+ effectSchema = z4.object({
1314
+ kind: z4.string(),
1315
+ role: z4.string().optional(),
1316
+ action: z4.string().optional(),
1317
+ id: z4.string().optional()
1318
+ });
1319
+ selectionSchema = z4.object({
1320
+ agent: z4.string().nullable().optional(),
1321
+ model: z4.string().nullable().optional(),
1322
+ effort: z4.string().nullable().optional()
1323
+ });
1324
+ orcaReplySchema = z4.object({
1325
+ ok: z4.boolean(),
1326
+ _meta: z4.object({ runtimeId: z4.string().nullable() }).optional(),
1327
+ error: z4.object({
1328
+ code: z4.string(),
1329
+ message: z4.string(),
1330
+ data: z4.object({
1331
+ requestId: identifier.optional(),
1332
+ orchestrationRequestId: identifier.optional(),
1333
+ dispatchId: identifier.optional()
1334
+ }).optional()
1335
+ }).optional(),
1336
+ result: z4.object({
1337
+ state: z4.string().optional(),
1338
+ requestId: identifier.optional(),
1339
+ /**
1340
+ * Mutation ledger identity Orca stamps on every successful mutation result.
1341
+ * @remarks Installed Orca 1.4.255 attaches `{ requestId, replayed }` to the
1342
+ * result it records (`Jy` in the retained source), so a successful stop can
1343
+ * be bound to the request key this attempt issued.
1344
+ */
1345
+ mutation: z4.object({
1346
+ requestId: identifier.optional(),
1347
+ replayed: z4.boolean().optional()
1348
+ }).optional(),
1349
+ stage: z4.string().optional(),
1350
+ turnStart: z4.string().optional(),
1351
+ runId: identifier.optional(),
1352
+ run: z4.object({ id: identifier }).nullable().optional(),
1353
+ taskId: identifier.optional(),
1354
+ dispatchId: identifier.optional(),
1355
+ failureCount: z4.number().int().nonnegative().optional(),
1356
+ effects: z4.array(effectSchema).optional(),
1357
+ residualResources: z4.array(effectSchema).optional(),
1358
+ launch: z4.object({ effective: selectionSchema.optional() }).optional(),
1359
+ lastError: z4.string().nullable().optional(),
1360
+ processAction: z4.string().optional(),
1361
+ helpers: z4.array(
1362
+ z4.object({
1363
+ dispatchId: identifier.optional(),
1364
+ creatorDispatchId: identifier.optional(),
1365
+ outcome: z4.string(),
1366
+ keptOpenBy: identifier.optional(),
1367
+ state: z4.string().optional(),
1368
+ lastError: z4.string().nullable().optional()
1369
+ })
1370
+ ).optional(),
1371
+ helperStopError: z4.string().nullable().optional(),
1372
+ status: z4.string().optional(),
1373
+ terminal: z4.object({
1374
+ handle: identifier,
1375
+ connected: z4.boolean(),
1376
+ writable: z4.boolean(),
1377
+ executionHostId: identifier
1378
+ }).optional(),
1379
+ runtime: z4.object({
1380
+ runtimeId: identifier,
1381
+ reachable: z4.boolean(),
1382
+ state: z4.string(),
1383
+ capabilities: z4.array(z4.string())
1384
+ }).optional(),
1385
+ worktree: z4.object({
1386
+ id: identifier,
1387
+ path: identifier,
1388
+ branch: identifier,
1389
+ hostId: identifier,
1390
+ address: z4.object({ worktree: identifier }).optional()
1391
+ }).optional(),
1392
+ dispatch: z4.object({
1393
+ id: identifier,
1394
+ runId: identifier,
1395
+ taskId: identifier,
1396
+ /** Direct creator Dispatch that started this one; null for a Run root. */
1397
+ creatorDispatchId: identifier.nullable().optional(),
1398
+ failureCount: z4.number().int().nonnegative()
1399
+ }).optional(),
1400
+ worker: z4.object({
1401
+ dispatchId: identifier,
1402
+ runtimeEpoch: identifier,
1403
+ state: z4.string(),
1404
+ stage: z4.string(),
1405
+ worktreeId: identifier.nullable()
1406
+ }).optional(),
1407
+ observation: z4.object({ status: z4.string(), exactWorker: z4.boolean().optional() }).optional(),
1408
+ projection: z4.object({
1409
+ resource: z4.object({
1410
+ state: z4.string(),
1411
+ terminalState: z4.string(),
1412
+ ownerDispatchId: identifier.optional(),
1413
+ releaseState: z4.string().optional()
1414
+ }).optional()
1415
+ }).optional()
1416
+ }).optional()
1417
+ });
1418
+ orcaCommandRegistrySchema = z4.object({
1419
+ schemaVersion: z4.number().int().positive(),
1420
+ commands: z4.array(z4.object({ command: identifier, flags: z4.array(z4.string()) }))
1421
+ });
1422
+ accountProviderSchema = z4.object({
1423
+ accounts: z4.array(z4.object({})),
1424
+ activeAccountId: identifier.nullable()
1425
+ });
1426
+ orcaAccountReplySchema = z4.object({
1427
+ ok: z4.literal(true),
1428
+ _meta: z4.object({ runtimeId: identifier }),
1429
+ result: z4.object({
1430
+ codex: accountProviderSchema,
1431
+ opencode: accountProviderSchema,
1432
+ claude: accountProviderSchema
1433
+ })
1434
+ });
1435
+ }
1436
+ });
1437
+
1438
+ // packages/contracts/src/config/worker-policy.ts
1439
+ import { z as z5 } from "zod";
1130
1440
  var projectWorkerPolicySchema;
1131
1441
  var init_worker_policy = __esm({
1132
1442
  "packages/contracts/src/config/worker-policy.ts"() {
1133
1443
  "use strict";
1134
- projectWorkerPolicySchema = z4.object({
1135
- verification: z4.object({
1136
- full: z4.enum(["local", "ci"]),
1137
- local: z4.enum(["single-file", "affected"])
1444
+ projectWorkerPolicySchema = z5.object({
1445
+ verification: z5.object({
1446
+ full: z5.enum(["local", "ci"]),
1447
+ local: z5.enum(["single-file", "affected"])
1138
1448
  }).strict().optional(),
1139
- instructions: z4.array(
1140
- z4.string().min(1).max(512).regex(/\S/).regex(
1449
+ instructions: z5.array(
1450
+ z5.string().min(1).max(512).regex(/\S/).regex(
1141
1451
  /^(?!\s*#)[^\p{Cc}\p{Cf}\p{Zl}\p{Zp}]+$/u,
1142
1452
  "Instructions must be single-line text without control characters or a leading #"
1143
1453
  )
@@ -1147,11 +1457,12 @@ var init_worker_policy = __esm({
1147
1457
  });
1148
1458
 
1149
1459
  // packages/contracts/src/config/manifest.ts
1150
- import { z as z5 } from "zod";
1460
+ import { z as z6 } from "zod";
1151
1461
  var PROJECT_INFO_MANIFEST, PROJECT_CONTEXT_MANIFEST, CLEO_CONFIG_MANIFEST, GLOBAL_CLEO_CONFIG_MANIFEST, CONFIG_MANIFEST_ENTRIES, configManifestEntrySchema;
1152
1462
  var init_manifest = __esm({
1153
1463
  "packages/contracts/src/config/manifest.ts"() {
1154
1464
  "use strict";
1465
+ init_orca_execution();
1155
1466
  init_worker_policy();
1156
1467
  PROJECT_INFO_MANIFEST = {
1157
1468
  id: "project-info",
@@ -1173,8 +1484,11 @@ var init_manifest = __esm({
1173
1484
  path: ".cleo/config.json",
1174
1485
  mergePrecedence: 20,
1175
1486
  driftDetection: "schema-validate",
1176
- schema: z5.object({
1177
- orchestrate: z5.object({ workerPolicy: projectWorkerPolicySchema.optional() }).passthrough().optional()
1487
+ schema: z6.object({
1488
+ orchestrate: z6.object({
1489
+ workerPolicy: projectWorkerPolicySchema.optional(),
1490
+ orca: orchestrateOrcaConfigSchema.optional()
1491
+ }).passthrough().optional()
1178
1492
  }).passthrough()
1179
1493
  };
1180
1494
  GLOBAL_CLEO_CONFIG_MANIFEST = {
@@ -1190,19 +1504,19 @@ var init_manifest = __esm({
1190
1504
  GLOBAL_CLEO_CONFIG_MANIFEST,
1191
1505
  CLEO_CONFIG_MANIFEST
1192
1506
  ]);
1193
- configManifestEntrySchema = z5.object({
1194
- id: z5.string().min(1),
1195
- scope: z5.union([z5.literal("global"), z5.literal("project"), z5.literal("metadata")]),
1196
- path: z5.string().min(1),
1197
- schema: z5.unknown().optional(),
1198
- mergePrecedence: z5.number().int().nonnegative(),
1199
- driftDetection: z5.union([
1200
- z5.literal("schema-validate"),
1201
- z5.literal("staleness-gate"),
1202
- z5.literal("value-diff"),
1203
- z5.literal("none")
1507
+ configManifestEntrySchema = z6.object({
1508
+ id: z6.string().min(1),
1509
+ scope: z6.union([z6.literal("global"), z6.literal("project"), z6.literal("metadata")]),
1510
+ path: z6.string().min(1),
1511
+ schema: z6.unknown().optional(),
1512
+ mergePrecedence: z6.number().int().nonnegative(),
1513
+ driftDetection: z6.union([
1514
+ z6.literal("schema-validate"),
1515
+ z6.literal("staleness-gate"),
1516
+ z6.literal("value-diff"),
1517
+ z6.literal("none")
1204
1518
  ]),
1205
- defaults: z5.record(z5.string(), z5.unknown()).optional()
1519
+ defaults: z6.record(z6.string(), z6.unknown()).optional()
1206
1520
  });
1207
1521
  }
1208
1522
  });
@@ -1239,124 +1553,124 @@ var init_credentials = __esm({
1239
1553
  });
1240
1554
 
1241
1555
  // packages/contracts/src/supervisor-ipc/messages.ts
1242
- import { z as z6 } from "zod";
1556
+ import { z as z7 } from "zod";
1243
1557
  var EnvPairSchema, ChildStateSchema, ChildStatusSchema, SpawnRequestSchema, RestartRequestSchema, MonitorRequestSchema, HealthRequestSchema, SupervisorIpcRequestSchema, SpawnedResponseSchema, RestartedResponseSchema, MonitorResponseSchema, HealthResponseSchema, LifecycleEventKindSchema, LifecycleEventResponseSchema, ErrorResponseSchema, SupervisorIpcResponseSchema, SupervisorIpcRequestEnvelopeSchema, SupervisorIpcResponseEnvelopeSchema, SupervisorIpcEnvelopeSchema, SUPERVISOR_IPC_REQUEST_KINDS, SUPERVISOR_IPC_RESPONSE_KINDS, SUPERVISOR_IPC_MESSAGE_KINDS;
1244
1558
  var init_messages = __esm({
1245
1559
  "packages/contracts/src/supervisor-ipc/messages.ts"() {
1246
1560
  "use strict";
1247
- EnvPairSchema = z6.object({
1561
+ EnvPairSchema = z7.object({
1248
1562
  /** Environment variable name. */
1249
- key: z6.string().min(1),
1563
+ key: z7.string().min(1),
1250
1564
  /** Environment variable value. */
1251
- value: z6.string()
1565
+ value: z7.string()
1252
1566
  }).strict();
1253
- ChildStateSchema = z6.enum(["running", "restarting", "stopped"]);
1254
- ChildStatusSchema = z6.object({
1567
+ ChildStateSchema = z7.enum(["running", "restarting", "stopped"]);
1568
+ ChildStatusSchema = z7.object({
1255
1569
  /** Logical id of the child (stable across restarts). */
1256
- child_id: z6.string().min(1),
1570
+ child_id: z7.string().min(1),
1257
1571
  /** Current OS pid (0 when not currently running). */
1258
- pid: z6.number().int().nonnegative(),
1572
+ pid: z7.number().int().nonnegative(),
1259
1573
  /** Current liveness state. */
1260
1574
  state: ChildStateSchema,
1261
1575
  /** Total restarts observed for this child. */
1262
- restart_count: z6.number().int().nonnegative()
1576
+ restart_count: z7.number().int().nonnegative()
1263
1577
  }).strict();
1264
- SpawnRequestSchema = z6.object({
1578
+ SpawnRequestSchema = z7.object({
1265
1579
  /** Tag discriminating this request variant. */
1266
- kind: z6.literal("spawn"),
1580
+ kind: z7.literal("spawn"),
1267
1581
  /** Caller-chosen logical id for the child (stable across restarts). */
1268
- child_id: z6.string().min(1),
1582
+ child_id: z7.string().min(1),
1269
1583
  /** Absolute path to the program to execute. */
1270
- program: z6.string().min(1),
1584
+ program: z7.string().min(1),
1271
1585
  /** Arguments passed to the program. */
1272
- args: z6.array(z6.string()).default([]),
1586
+ args: z7.array(z7.string()).default([]),
1273
1587
  /** Environment overrides applied on top of the supervisor's environment. */
1274
- env: z6.array(EnvPairSchema).default([]),
1588
+ env: z7.array(EnvPairSchema).default([]),
1275
1589
  /** Optional working directory for the child. */
1276
- cwd: z6.string().optional()
1590
+ cwd: z7.string().optional()
1277
1591
  }).strict();
1278
- RestartRequestSchema = z6.object({
1592
+ RestartRequestSchema = z7.object({
1279
1593
  /** Tag discriminating this request variant. */
1280
- kind: z6.literal("restart"),
1594
+ kind: z7.literal("restart"),
1281
1595
  /** Logical id of the child to restart. */
1282
- child_id: z6.string().min(1)
1596
+ child_id: z7.string().min(1)
1283
1597
  }).strict();
1284
- MonitorRequestSchema = z6.object({
1598
+ MonitorRequestSchema = z7.object({
1285
1599
  /** Tag discriminating this request variant. */
1286
- kind: z6.literal("monitor"),
1600
+ kind: z7.literal("monitor"),
1287
1601
  /** Specific child id to monitor; omit to request all children. */
1288
- child_id: z6.string().optional()
1602
+ child_id: z7.string().optional()
1289
1603
  }).strict();
1290
- HealthRequestSchema = z6.object({
1604
+ HealthRequestSchema = z7.object({
1291
1605
  /** Tag discriminating this request variant. */
1292
- kind: z6.literal("health")
1606
+ kind: z7.literal("health")
1293
1607
  }).strict();
1294
- SupervisorIpcRequestSchema = z6.discriminatedUnion("kind", [
1608
+ SupervisorIpcRequestSchema = z7.discriminatedUnion("kind", [
1295
1609
  SpawnRequestSchema,
1296
1610
  RestartRequestSchema,
1297
1611
  MonitorRequestSchema,
1298
1612
  HealthRequestSchema
1299
1613
  ]);
1300
- SpawnedResponseSchema = z6.object({
1614
+ SpawnedResponseSchema = z7.object({
1301
1615
  /** Tag discriminating this response variant. */
1302
- kind: z6.literal("spawned"),
1616
+ kind: z7.literal("spawned"),
1303
1617
  /** Logical id of the spawned child. */
1304
- child_id: z6.string().min(1),
1618
+ child_id: z7.string().min(1),
1305
1619
  /** OS pid assigned to the spawned child. */
1306
- pid: z6.number().int().nonnegative()
1620
+ pid: z7.number().int().nonnegative()
1307
1621
  }).strict();
1308
- RestartedResponseSchema = z6.object({
1622
+ RestartedResponseSchema = z7.object({
1309
1623
  /** Tag discriminating this response variant. */
1310
- kind: z6.literal("restarted"),
1624
+ kind: z7.literal("restarted"),
1311
1625
  /** Logical id of the restarted child. */
1312
- child_id: z6.string().min(1),
1626
+ child_id: z7.string().min(1),
1313
1627
  /** New OS pid after the restart. */
1314
- pid: z6.number().int().nonnegative(),
1628
+ pid: z7.number().int().nonnegative(),
1315
1629
  /** Number of times this child has been restarted in total. */
1316
- restart_count: z6.number().int().nonnegative()
1630
+ restart_count: z7.number().int().nonnegative()
1317
1631
  }).strict();
1318
- MonitorResponseSchema = z6.object({
1632
+ MonitorResponseSchema = z7.object({
1319
1633
  /** Tag discriminating this response variant. */
1320
- kind: z6.literal("monitor"),
1634
+ kind: z7.literal("monitor"),
1321
1635
  /** One row per monitored child. */
1322
- children: z6.array(ChildStatusSchema)
1636
+ children: z7.array(ChildStatusSchema)
1323
1637
  }).strict();
1324
- HealthResponseSchema = z6.object({
1638
+ HealthResponseSchema = z7.object({
1325
1639
  /** Tag discriminating this response variant. */
1326
- kind: z6.literal("health"),
1640
+ kind: z7.literal("health"),
1327
1641
  /** Supervisor process pid. */
1328
- pid: z6.number().int().nonnegative(),
1642
+ pid: z7.number().int().nonnegative(),
1329
1643
  /** Number of children currently tracked. */
1330
- child_count: z6.number().int().nonnegative(),
1644
+ child_count: z7.number().int().nonnegative(),
1331
1645
  /** Seconds the supervisor has been running. */
1332
- uptime_secs: z6.number().int().nonnegative(),
1646
+ uptime_secs: z7.number().int().nonnegative(),
1333
1647
  /** Frozen protocol version the supervisor speaks. */
1334
- protocol_version: z6.string()
1648
+ protocol_version: z7.string()
1335
1649
  }).strict();
1336
- LifecycleEventKindSchema = z6.enum(["child_exited", "child_restarted"]);
1337
- LifecycleEventResponseSchema = z6.object({
1650
+ LifecycleEventKindSchema = z7.enum(["child_exited", "child_restarted"]);
1651
+ LifecycleEventResponseSchema = z7.object({
1338
1652
  /** Tag discriminating this response variant. */
1339
- kind: z6.literal("event"),
1653
+ kind: z7.literal("event"),
1340
1654
  /** What happened. */
1341
1655
  event: LifecycleEventKindSchema,
1342
1656
  /** Logical id of the affected child. */
1343
- child_id: z6.string().min(1),
1657
+ child_id: z7.string().min(1),
1344
1658
  /** Exit code, when the OS reported one. */
1345
- exit_code: z6.number().int().optional(),
1659
+ exit_code: z7.number().int().optional(),
1346
1660
  /** Terminating signal name, when the child was signalled (Unix). */
1347
- signal: z6.string().optional(),
1661
+ signal: z7.string().optional(),
1348
1662
  /** Backoff delay (ms) before the pending restart, when applicable. */
1349
- restart_delay_ms: z6.number().int().nonnegative().optional()
1663
+ restart_delay_ms: z7.number().int().nonnegative().optional()
1350
1664
  }).strict();
1351
- ErrorResponseSchema = z6.object({
1665
+ ErrorResponseSchema = z7.object({
1352
1666
  /** Tag discriminating this response variant. */
1353
- kind: z6.literal("error"),
1667
+ kind: z7.literal("error"),
1354
1668
  /** Machine-readable error code (e.g. `E_UNKNOWN_CHILD`). */
1355
- code: z6.string().min(1),
1669
+ code: z7.string().min(1),
1356
1670
  /** Human-readable error message. */
1357
- message: z6.string()
1671
+ message: z7.string()
1358
1672
  }).strict();
1359
- SupervisorIpcResponseSchema = z6.discriminatedUnion("kind", [
1673
+ SupervisorIpcResponseSchema = z7.discriminatedUnion("kind", [
1360
1674
  SpawnedResponseSchema,
1361
1675
  RestartedResponseSchema,
1362
1676
  MonitorResponseSchema,
@@ -1364,27 +1678,27 @@ var init_messages = __esm({
1364
1678
  LifecycleEventResponseSchema,
1365
1679
  ErrorResponseSchema
1366
1680
  ]);
1367
- SupervisorIpcRequestEnvelopeSchema = z6.object({
1681
+ SupervisorIpcRequestEnvelopeSchema = z7.object({
1368
1682
  /** Frozen protocol version. */
1369
- protocol_version: z6.string(),
1683
+ protocol_version: z7.string(),
1370
1684
  /** Correlation id echoed back on the matching response. */
1371
- id: z6.string().min(1),
1685
+ id: z7.string().min(1),
1372
1686
  /** Direction discriminator. */
1373
- direction: z6.literal("request"),
1687
+ direction: z7.literal("request"),
1374
1688
  /** The request body. */
1375
1689
  request: SupervisorIpcRequestSchema
1376
1690
  }).strict();
1377
- SupervisorIpcResponseEnvelopeSchema = z6.object({
1691
+ SupervisorIpcResponseEnvelopeSchema = z7.object({
1378
1692
  /** Frozen protocol version. */
1379
- protocol_version: z6.string(),
1693
+ protocol_version: z7.string(),
1380
1694
  /** Correlation id echoed from the originating request (or a fresh id for events). */
1381
- id: z6.string().min(1),
1695
+ id: z7.string().min(1),
1382
1696
  /** Direction discriminator. */
1383
- direction: z6.literal("response"),
1697
+ direction: z7.literal("response"),
1384
1698
  /** The response body. */
1385
1699
  response: SupervisorIpcResponseSchema
1386
1700
  }).strict();
1387
- SupervisorIpcEnvelopeSchema = z6.discriminatedUnion("direction", [
1701
+ SupervisorIpcEnvelopeSchema = z7.discriminatedUnion("direction", [
1388
1702
  SupervisorIpcRequestEnvelopeSchema,
1389
1703
  SupervisorIpcResponseEnvelopeSchema
1390
1704
  ]);
@@ -1405,7 +1719,7 @@ var init_messages = __esm({
1405
1719
  });
1406
1720
 
1407
1721
  // packages/contracts/src/daemon/health.ts
1408
- import { z as z7 } from "zod";
1722
+ import { z as z8 } from "zod";
1409
1723
  var SubsystemHealthSchema, HealthStatusSchema;
1410
1724
  var init_health = __esm({
1411
1725
  "packages/contracts/src/daemon/health.ts"() {
@@ -1416,17 +1730,17 @@ var init_health = __esm({
1416
1730
  * Optional human-readable detail (e.g. last error message, queue depth).
1417
1731
  * Diagnostic only — not part of the supervisor wire contract.
1418
1732
  */
1419
- detail: z7.string().optional()
1733
+ detail: z8.string().optional()
1420
1734
  }).strict();
1421
- HealthStatusSchema = z7.object({
1735
+ HealthStatusSchema = z8.object({
1422
1736
  /** One health row per registered subsystem. */
1423
- subsystems: z7.array(SubsystemHealthSchema),
1737
+ subsystems: z8.array(SubsystemHealthSchema),
1424
1738
  /**
1425
1739
  * `true` iff every subsystem is in the `running` state. A convenience roll-up
1426
1740
  * derived from {@link HealthStatusSchema.shape.subsystems}; recomputed by
1427
1741
  * {@link summarizeHealth} so producers cannot desync it.
1428
1742
  */
1429
- allHealthy: z7.boolean()
1743
+ allHealthy: z8.boolean()
1430
1744
  }).strict();
1431
1745
  }
1432
1746
  });
@@ -13465,7 +13779,7 @@ var init_operations_registry = __esm({
13465
13779
  });
13466
13780
 
13467
13781
  // packages/contracts/src/docs/modernize.ts
13468
- import { z as z8 } from "zod";
13782
+ import { z as z9 } from "zod";
13469
13783
  var DOCS_MODERNIZE_DISPOSITIONS, DOCS_MODERNIZE_OPS, judgmentSchema, relPath, docsModernizePlanSchema, docsModernizeOverridesSchema, receiptOpSchema, docsModernizeJournalLineSchema, docsModernizeReceiptSchema;
13470
13784
  var init_modernize = __esm({
13471
13785
  "packages/contracts/src/docs/modernize.ts"() {
@@ -13483,107 +13797,107 @@ var init_modernize = __esm({
13483
13797
  "reslug",
13484
13798
  "link-task"
13485
13799
  ];
13486
- judgmentSchema = z8.object({
13487
- question: z8.enum(["classify", "merge"]),
13488
- site: z8.string(),
13489
- mode: z8.enum(["off", "shadow", "on"]),
13490
- ruleAnswer: z8.string(),
13491
- decidedAnswer: z8.string().nullable(),
13492
- decidedConfidence: z8.number().nullable(),
13493
- source: z8.enum(["provider", "cache", "fallback"]),
13494
- acted: z8.string()
13495
- });
13496
- relPath = z8.string().min(1).max(1024);
13497
- docsModernizePlanSchema = z8.object({
13498
- root: z8.string().min(1),
13499
- generatedAt: z8.string(),
13500
- mode: z8.enum(["tree", "store-only"]),
13501
- counts: z8.record(z8.enum(DOCS_MODERNIZE_DISPOSITIONS), z8.number()),
13502
- rows: z8.array(
13503
- z8.object({
13800
+ judgmentSchema = z9.object({
13801
+ question: z9.enum(["classify", "merge"]),
13802
+ site: z9.string(),
13803
+ mode: z9.enum(["off", "shadow", "on"]),
13804
+ ruleAnswer: z9.string(),
13805
+ decidedAnswer: z9.string().nullable(),
13806
+ decidedConfidence: z9.number().nullable(),
13807
+ source: z9.enum(["provider", "cache", "fallback"]),
13808
+ acted: z9.string()
13809
+ });
13810
+ relPath = z9.string().min(1).max(1024);
13811
+ docsModernizePlanSchema = z9.object({
13812
+ root: z9.string().min(1),
13813
+ generatedAt: z9.string(),
13814
+ mode: z9.enum(["tree", "store-only"]),
13815
+ counts: z9.record(z9.enum(DOCS_MODERNIZE_DISPOSITIONS), z9.number()),
13816
+ rows: z9.array(
13817
+ z9.object({
13504
13818
  path: relPath,
13505
- sha256: z8.string().regex(/^[0-9a-f]{64}$/),
13506
- kind: z8.string().min(1),
13507
- slug: z8.string().regex(/^[a-z0-9][a-z0-9-]*$/),
13508
- title: z8.string(),
13509
- disposition: z8.enum(DOCS_MODERNIZE_DISPOSITIONS),
13510
- target: z8.string().min(1).max(1024).nullable(),
13511
- reasons: z8.array(z8.string()),
13512
- judgments: z8.array(judgmentSchema),
13513
- ownerTasks: z8.array(z8.string().regex(/^[TD]\d+$/)),
13514
- category: z8.string(),
13515
- refs: z8.array(z8.string()),
13516
- overridden: z8.boolean(),
13517
- covers: z8.array(z8.string()),
13518
- baselineRemove: z8.boolean()
13819
+ sha256: z9.string().regex(/^[0-9a-f]{64}$/),
13820
+ kind: z9.string().min(1),
13821
+ slug: z9.string().regex(/^[a-z0-9][a-z0-9-]*$/),
13822
+ title: z9.string(),
13823
+ disposition: z9.enum(DOCS_MODERNIZE_DISPOSITIONS),
13824
+ target: z9.string().min(1).max(1024).nullable(),
13825
+ reasons: z9.array(z9.string()),
13826
+ judgments: z9.array(judgmentSchema),
13827
+ ownerTasks: z9.array(z9.string().regex(/^[TD]\d+$/)),
13828
+ category: z9.string(),
13829
+ refs: z9.array(z9.string()),
13830
+ overridden: z9.boolean(),
13831
+ covers: z9.array(z9.string()),
13832
+ baselineRemove: z9.boolean()
13519
13833
  })
13520
13834
  ),
13521
- linkFixes: z8.array(
13522
- z8.object({
13523
- kind: z8.literal("link-fix"),
13835
+ linkFixes: z9.array(
13836
+ z9.object({
13837
+ kind: z9.literal("link-fix"),
13524
13838
  path: relPath,
13525
- href: z8.string().min(1).max(2048),
13526
- newHref: z8.string().min(1).max(2048),
13527
- base: z8.literal("repo").optional(),
13528
- sha256: z8.string().regex(/^[0-9a-f]{64}$/).optional()
13839
+ href: z9.string().min(1).max(2048),
13840
+ newHref: z9.string().min(1).max(2048),
13841
+ base: z9.literal("repo").optional(),
13842
+ sha256: z9.string().regex(/^[0-9a-f]{64}$/).optional()
13529
13843
  })
13530
13844
  ).optional(),
13531
- repoRoot: z8.string().min(1).optional()
13845
+ repoRoot: z9.string().min(1).optional()
13532
13846
  });
13533
- docsModernizeOverridesSchema = z8.record(
13847
+ docsModernizeOverridesSchema = z9.record(
13534
13848
  relPath,
13535
- z8.object({
13536
- disposition: z8.enum(DOCS_MODERNIZE_DISPOSITIONS),
13537
- target: z8.string().min(1).max(1024).nullable().optional(),
13538
- reason: z8.string().min(1),
13539
- kind: z8.string().min(1).optional(),
13540
- slug: z8.string().regex(/^[a-z0-9][a-z0-9-]*$/).optional(),
13541
- covers: z8.array(z8.string()).optional()
13849
+ z9.object({
13850
+ disposition: z9.enum(DOCS_MODERNIZE_DISPOSITIONS),
13851
+ target: z9.string().min(1).max(1024).nullable().optional(),
13852
+ reason: z9.string().min(1),
13853
+ kind: z9.string().min(1).optional(),
13854
+ slug: z9.string().regex(/^[a-z0-9][a-z0-9-]*$/).optional(),
13855
+ covers: z9.array(z9.string()).optional()
13542
13856
  })
13543
13857
  );
13544
- receiptOpSchema = z8.object({
13545
- op: z8.enum(DOCS_MODERNIZE_OPS),
13546
- state: z8.enum(["pending", "done", "reversed"]),
13547
- slug: z8.string().nullable(),
13858
+ receiptOpSchema = z9.object({
13859
+ op: z9.enum(DOCS_MODERNIZE_OPS),
13860
+ state: z9.enum(["pending", "done", "reversed"]),
13861
+ slug: z9.string().nullable(),
13548
13862
  path: relPath.nullable(),
13549
- target: z8.string().nullable(),
13550
- attachmentId: z8.string().nullable(),
13551
- ownerId: z8.string().nullable(),
13552
- beforeSha256: z8.string().regex(/^[0-9a-f]{64}$/).nullable(),
13553
- afterSha256: z8.string().regex(/^[0-9a-f]{64}$/).nullable(),
13554
- prior: z8.object({
13555
- lifecycleStatus: z8.string().nullable().optional(),
13556
- supersededBy: z8.string().nullable().optional(),
13557
- supersedes: z8.string().nullable().optional(),
13558
- previousAttachmentId: z8.string().nullable().optional(),
13559
- newAttachmentId: z8.string().nullable().optional(),
13560
- linkTargets: z8.array(z8.string()).optional(),
13561
- kind: z8.string().nullable().optional()
13863
+ target: z9.string().nullable(),
13864
+ attachmentId: z9.string().nullable(),
13865
+ ownerId: z9.string().nullable(),
13866
+ beforeSha256: z9.string().regex(/^[0-9a-f]{64}$/).nullable(),
13867
+ afterSha256: z9.string().regex(/^[0-9a-f]{64}$/).nullable(),
13868
+ prior: z9.object({
13869
+ lifecycleStatus: z9.string().nullable().optional(),
13870
+ supersededBy: z9.string().nullable().optional(),
13871
+ supersedes: z9.string().nullable().optional(),
13872
+ previousAttachmentId: z9.string().nullable().optional(),
13873
+ newAttachmentId: z9.string().nullable().optional(),
13874
+ linkTargets: z9.array(z9.string()).optional(),
13875
+ kind: z9.string().nullable().optional()
13562
13876
  }).optional(),
13563
- base: z8.literal("repo").optional()
13877
+ base: z9.literal("repo").optional()
13564
13878
  });
13565
13879
  docsModernizeJournalLineSchema = receiptOpSchema.extend({
13566
- i: z8.number().int().min(0)
13880
+ i: z9.number().int().min(0)
13567
13881
  });
13568
- docsModernizeReceiptSchema = z8.object({
13569
- runId: z8.string().regex(/^dm-[\w-]+$/),
13570
- root: z8.string().min(1),
13571
- appliedAt: z8.string(),
13572
- planSha256: z8.string(),
13573
- edgeCount: z8.number(),
13574
- rolledBackAt: z8.string().nullable(),
13575
- blobs: z8.array(z8.object({ path: relPath, sha256: z8.string() })),
13576
- moves: z8.array(z8.object({ from: relPath, to: relPath })),
13577
- deleted: z8.array(relPath),
13578
- ops: z8.array(receiptOpSchema),
13579
- durationMs: z8.number().optional(),
13580
- repoRoot: z8.string().min(1).optional()
13882
+ docsModernizeReceiptSchema = z9.object({
13883
+ runId: z9.string().regex(/^dm-[\w-]+$/),
13884
+ root: z9.string().min(1),
13885
+ appliedAt: z9.string(),
13886
+ planSha256: z9.string(),
13887
+ edgeCount: z9.number(),
13888
+ rolledBackAt: z9.string().nullable(),
13889
+ blobs: z9.array(z9.object({ path: relPath, sha256: z9.string() })),
13890
+ moves: z9.array(z9.object({ from: relPath, to: relPath })),
13891
+ deleted: z9.array(relPath),
13892
+ ops: z9.array(receiptOpSchema),
13893
+ durationMs: z9.number().optional(),
13894
+ repoRoot: z9.string().min(1).optional()
13581
13895
  });
13582
13896
  }
13583
13897
  });
13584
13898
 
13585
13899
  // packages/contracts/src/docs/provenance.ts
13586
- import { z as z9 } from "zod";
13900
+ import { z as z10 } from "zod";
13587
13901
  var PROVENANCE_NODE_KINDS, PROVENANCE_EDGE_RELATIONS, DOC_LIFECYCLE_STATUSES, provenanceNodeKindSchema, provenanceEdgeRelationSchema, docLifecycleStatusSchema, provenanceNodeBaseFields, provenanceDocNodeSchema, provenanceTaskNodeSchema, provenanceDecisionNodeSchema, provenanceSessionNodeSchema, provenanceMemoryNodeSchema, provenanceNodeSchema, provenanceEdgeSchema, docProvenanceResponseSchema;
13588
13902
  var init_provenance = __esm({
13589
13903
  "packages/contracts/src/docs/provenance.ts"() {
@@ -13610,102 +13924,102 @@ var init_provenance = __esm({
13610
13924
  "archived",
13611
13925
  "draft"
13612
13926
  ];
13613
- provenanceNodeKindSchema = z9.enum(PROVENANCE_NODE_KINDS);
13614
- provenanceEdgeRelationSchema = z9.enum(PROVENANCE_EDGE_RELATIONS);
13615
- docLifecycleStatusSchema = z9.enum(DOC_LIFECYCLE_STATUSES);
13927
+ provenanceNodeKindSchema = z10.enum(PROVENANCE_NODE_KINDS);
13928
+ provenanceEdgeRelationSchema = z10.enum(PROVENANCE_EDGE_RELATIONS);
13929
+ docLifecycleStatusSchema = z10.enum(DOC_LIFECYCLE_STATUSES);
13616
13930
  provenanceNodeBaseFields = {
13617
- id: z9.string().min(1),
13618
- title: z9.string().min(1),
13619
- metadata: z9.record(z9.string(), z9.unknown()).optional()
13931
+ id: z10.string().min(1),
13932
+ title: z10.string().min(1),
13933
+ metadata: z10.record(z10.string(), z10.unknown()).optional()
13620
13934
  };
13621
- provenanceDocNodeSchema = z9.object({
13935
+ provenanceDocNodeSchema = z10.object({
13622
13936
  ...provenanceNodeBaseFields,
13623
- kind: z9.literal("doc"),
13624
- slug: z9.string().min(1),
13625
- docKind: z9.string().min(1),
13937
+ kind: z10.literal("doc"),
13938
+ slug: z10.string().min(1),
13939
+ docKind: z10.string().min(1),
13626
13940
  lifecycleStatus: docLifecycleStatusSchema,
13627
- publishedAt: z9.string().min(1),
13628
- supersededAt: z9.string().min(1).optional(),
13629
- summary: z9.string().optional()
13941
+ publishedAt: z10.string().min(1),
13942
+ supersededAt: z10.string().min(1).optional(),
13943
+ summary: z10.string().optional()
13630
13944
  });
13631
- provenanceTaskNodeSchema = z9.object({
13945
+ provenanceTaskNodeSchema = z10.object({
13632
13946
  ...provenanceNodeBaseFields,
13633
- kind: z9.literal("task"),
13634
- taskType: z9.enum(["saga", "epic", "task", "subtask"]),
13635
- status: z9.enum(["pending", "in_progress", "done", "blocked", "cancelled", "archived"])
13947
+ kind: z10.literal("task"),
13948
+ taskType: z10.enum(["saga", "epic", "task", "subtask"]),
13949
+ status: z10.enum(["pending", "in_progress", "done", "blocked", "cancelled", "archived"])
13636
13950
  });
13637
- provenanceDecisionNodeSchema = z9.object({
13951
+ provenanceDecisionNodeSchema = z10.object({
13638
13952
  ...provenanceNodeBaseFields,
13639
- kind: z9.literal("decision"),
13640
- outcome: z9.enum(["proposed", "accepted", "rejected", "superseded"]),
13641
- decidedAt: z9.string().min(1)
13953
+ kind: z10.literal("decision"),
13954
+ outcome: z10.enum(["proposed", "accepted", "rejected", "superseded"]),
13955
+ decidedAt: z10.string().min(1)
13642
13956
  });
13643
- provenanceSessionNodeSchema = z9.object({
13957
+ provenanceSessionNodeSchema = z10.object({
13644
13958
  ...provenanceNodeBaseFields,
13645
- kind: z9.literal("session"),
13646
- startedAt: z9.string().min(1),
13647
- endedAt: z9.string().min(1).optional()
13959
+ kind: z10.literal("session"),
13960
+ startedAt: z10.string().min(1),
13961
+ endedAt: z10.string().min(1).optional()
13648
13962
  });
13649
- provenanceMemoryNodeSchema = z9.object({
13963
+ provenanceMemoryNodeSchema = z10.object({
13650
13964
  ...provenanceNodeBaseFields,
13651
- kind: z9.literal("memory"),
13652
- memoryType: z9.enum(["observation", "pattern", "decision", "diary"]),
13653
- recordedAt: z9.string().min(1)
13965
+ kind: z10.literal("memory"),
13966
+ memoryType: z10.enum(["observation", "pattern", "decision", "diary"]),
13967
+ recordedAt: z10.string().min(1)
13654
13968
  });
13655
- provenanceNodeSchema = z9.discriminatedUnion("kind", [
13969
+ provenanceNodeSchema = z10.discriminatedUnion("kind", [
13656
13970
  provenanceDocNodeSchema,
13657
13971
  provenanceTaskNodeSchema,
13658
13972
  provenanceDecisionNodeSchema,
13659
13973
  provenanceSessionNodeSchema,
13660
13974
  provenanceMemoryNodeSchema
13661
13975
  ]);
13662
- provenanceEdgeSchema = z9.object({
13976
+ provenanceEdgeSchema = z10.object({
13663
13977
  relation: provenanceEdgeRelationSchema,
13664
- from: z9.string().min(1),
13978
+ from: z10.string().min(1),
13665
13979
  fromKind: provenanceNodeKindSchema,
13666
- to: z9.string().min(1),
13980
+ to: z10.string().min(1),
13667
13981
  toKind: provenanceNodeKindSchema,
13668
- addedAt: z9.string().min(1),
13669
- summary: z9.string().optional()
13982
+ addedAt: z10.string().min(1),
13983
+ summary: z10.string().optional()
13670
13984
  });
13671
- docProvenanceResponseSchema = z9.object({
13672
- nodes: z9.array(provenanceNodeSchema).readonly(),
13673
- edges: z9.array(provenanceEdgeSchema).readonly(),
13674
- totalNodes: z9.number().int().nonnegative(),
13675
- totalEdges: z9.number().int().nonnegative()
13985
+ docProvenanceResponseSchema = z10.object({
13986
+ nodes: z10.array(provenanceNodeSchema).readonly(),
13987
+ edges: z10.array(provenanceEdgeSchema).readonly(),
13988
+ totalNodes: z10.number().int().nonnegative(),
13989
+ totalEdges: z10.number().int().nonnegative()
13676
13990
  });
13677
13991
  }
13678
13992
  });
13679
13993
 
13680
13994
  // packages/contracts/src/docs/read.ts
13681
- import { z as z10 } from "zod";
13995
+ import { z as z11 } from "zod";
13682
13996
  var docFrontmatterSchema, docBodySchema, docReadResponseSchema;
13683
13997
  var init_read = __esm({
13684
13998
  "packages/contracts/src/docs/read.ts"() {
13685
13999
  "use strict";
13686
- docFrontmatterSchema = z10.object({
13687
- slug: z10.string(),
13688
- kind: z10.string().nullable(),
13689
- title: z10.string().nullable(),
13690
- summary: z10.string().nullable(),
13691
- lifecycleStatus: z10.string(),
13692
- docVersion: z10.number().int(),
13693
- ownerVersion: z10.string().nullable(),
13694
- supersedes: z10.string().nullable(),
13695
- supersededBy: z10.string().nullable(),
13696
- topics: z10.array(z10.string()).readonly(),
13697
- relatedTasks: z10.array(z10.string()).readonly(),
13698
- sha256: z10.string(),
13699
- createdAt: z10.string()
13700
- });
13701
- docBodySchema = z10.object({
13702
- encoding: z10.enum(["utf-8", "base64"]),
13703
- text: z10.string().optional(),
13704
- base64: z10.string().optional(),
13705
- sizeBytes: z10.number().int().nonnegative(),
13706
- mimeType: z10.string().nullable()
13707
- });
13708
- docReadResponseSchema = z10.object({
14000
+ docFrontmatterSchema = z11.object({
14001
+ slug: z11.string(),
14002
+ kind: z11.string().nullable(),
14003
+ title: z11.string().nullable(),
14004
+ summary: z11.string().nullable(),
14005
+ lifecycleStatus: z11.string(),
14006
+ docVersion: z11.number().int(),
14007
+ ownerVersion: z11.string().nullable(),
14008
+ supersedes: z11.string().nullable(),
14009
+ supersededBy: z11.string().nullable(),
14010
+ topics: z11.array(z11.string()).readonly(),
14011
+ relatedTasks: z11.array(z11.string()).readonly(),
14012
+ sha256: z11.string(),
14013
+ createdAt: z11.string()
14014
+ });
14015
+ docBodySchema = z11.object({
14016
+ encoding: z11.enum(["utf-8", "base64"]),
14017
+ text: z11.string().optional(),
14018
+ base64: z11.string().optional(),
14019
+ sizeBytes: z11.number().int().nonnegative(),
14020
+ mimeType: z11.string().nullable()
14021
+ });
14022
+ docReadResponseSchema = z11.object({
13709
14023
  frontmatter: docFrontmatterSchema,
13710
14024
  body: docBodySchema
13711
14025
  });
@@ -13911,7 +14225,7 @@ var init_errors = __esm({
13911
14225
  });
13912
14226
 
13913
14227
  // packages/contracts/src/evidence-atom-schema.ts
13914
- import { z as z11 } from "zod";
14228
+ import { z as z12 } from "zod";
13915
14229
  var EVIDENCE_ATOM_KINDS, PARSER_PREFIXES, KIND_BOUNDARY_REGEX, DEPLOY_PROVIDER_REGEX, DEPLOY_ID_REGEX, commitAtomSchema, filesAtomSchema, testRunAtomSchema, qaRunAtomSchema, toolAtomSchema, urlAtomSchema, noteAtomSchema, decisionAtomSchema, prAtomSchema, ciAtomSchema, ciRunAtomSchema, deployAtomSchema, locDropAtomSchema, callsiteCoverageAtomSchema, AC_UUID_REGEX, AC_ALIAS_REGEX, SATISFIES_TASK_ID_REGEX, SATISFIES_VERSION_PIN_REGEX, satisfiesAtomSchema, EvidenceAtomSchema, GATE_EVIDENCE_REQUIREMENTS, PROFILE_GATE_EVIDENCE, ATOM_EXAMPLES;
13916
14230
  var init_evidence_atom_schema = __esm({
13917
14231
  "packages/contracts/src/evidence-atom-schema.ts"() {
@@ -13937,96 +14251,96 @@ var init_evidence_atom_schema = __esm({
13937
14251
  KIND_BOUNDARY_REGEX = new RegExp(`;(?=\\s*(?:${PARSER_PREFIXES.join("|")})\\s*:)`, "g");
13938
14252
  DEPLOY_PROVIDER_REGEX = /^[a-z0-9][a-z0-9._-]*$/;
13939
14253
  DEPLOY_ID_REGEX = /^[^\s@|]+$/;
13940
- commitAtomSchema = z11.object({
13941
- kind: z11.literal("commit"),
13942
- sha: z11.string().regex(/^[0-9a-f]{7,40}$/i, "commit sha must be 7-40 hex characters")
13943
- });
13944
- filesAtomSchema = z11.object({
13945
- kind: z11.literal("files"),
13946
- paths: z11.array(z11.string().min(1)).min(1, "files atom requires at least one path")
13947
- });
13948
- testRunAtomSchema = z11.object({
13949
- kind: z11.literal("test-run"),
13950
- path: z11.string().min(1, "test-run atom requires a non-empty path")
13951
- });
13952
- qaRunAtomSchema = z11.object({
13953
- kind: z11.literal("qa-run"),
13954
- path: z11.string().min(1, "qa-run atom requires a non-empty path")
13955
- });
13956
- toolAtomSchema = z11.object({
13957
- kind: z11.literal("tool"),
13958
- tool: z11.string().min(1, "tool atom requires a non-empty tool name")
13959
- });
13960
- urlAtomSchema = z11.object({
13961
- kind: z11.literal("url"),
13962
- url: z11.string().min(1).regex(/^https?:\/\//, "url atom must start with http:// or https://")
13963
- });
13964
- noteAtomSchema = z11.object({
13965
- kind: z11.literal("note"),
13966
- note: z11.string().min(1, "note atom must be non-empty").max(512, "note atom is too long (max 512 chars)")
13967
- });
13968
- decisionAtomSchema = z11.object({
13969
- kind: z11.literal("decision"),
13970
- decisionId: z11.string().min(1, "decision atom requires a non-empty decision ID")
13971
- });
13972
- prAtomSchema = z11.object({
13973
- kind: z11.literal("pr"),
13974
- prNumber: z11.number().int().positive("pr atom requires a positive integer PR number"),
13975
- componentPrNumber: z11.number().int().positive().optional(),
14254
+ commitAtomSchema = z12.object({
14255
+ kind: z12.literal("commit"),
14256
+ sha: z12.string().regex(/^[0-9a-f]{7,40}$/i, "commit sha must be 7-40 hex characters")
14257
+ });
14258
+ filesAtomSchema = z12.object({
14259
+ kind: z12.literal("files"),
14260
+ paths: z12.array(z12.string().min(1)).min(1, "files atom requires at least one path")
14261
+ });
14262
+ testRunAtomSchema = z12.object({
14263
+ kind: z12.literal("test-run"),
14264
+ path: z12.string().min(1, "test-run atom requires a non-empty path")
14265
+ });
14266
+ qaRunAtomSchema = z12.object({
14267
+ kind: z12.literal("qa-run"),
14268
+ path: z12.string().min(1, "qa-run atom requires a non-empty path")
14269
+ });
14270
+ toolAtomSchema = z12.object({
14271
+ kind: z12.literal("tool"),
14272
+ tool: z12.string().min(1, "tool atom requires a non-empty tool name")
14273
+ });
14274
+ urlAtomSchema = z12.object({
14275
+ kind: z12.literal("url"),
14276
+ url: z12.string().min(1).regex(/^https?:\/\//, "url atom must start with http:// or https://")
14277
+ });
14278
+ noteAtomSchema = z12.object({
14279
+ kind: z12.literal("note"),
14280
+ note: z12.string().min(1, "note atom must be non-empty").max(512, "note atom is too long (max 512 chars)")
14281
+ });
14282
+ decisionAtomSchema = z12.object({
14283
+ kind: z12.literal("decision"),
14284
+ decisionId: z12.string().min(1, "decision atom requires a non-empty decision ID")
14285
+ });
14286
+ prAtomSchema = z12.object({
14287
+ kind: z12.literal("pr"),
14288
+ prNumber: z12.number().int().positive("pr atom requires a positive integer PR number"),
14289
+ componentPrNumber: z12.number().int().positive().optional(),
13976
14290
  /**
13977
14291
  * `pr:<owner>/<repo>#<n>` (T13912): the GitHub repository the PR number
13978
14292
  * belongs to, lowercased. Validated against the evidence git root's
13979
14293
  * `origin`, since PR numbers are only unique per repository.
13980
14294
  */
13981
- repo: z11.string().regex(/^[a-z0-9._-]+\/[a-z0-9._-]+$/).optional()
14295
+ repo: z12.string().regex(/^[a-z0-9._-]+\/[a-z0-9._-]+$/).optional()
13982
14296
  });
13983
- ciAtomSchema = z11.object({
13984
- kind: z11.literal("ci"),
13985
- prNumber: z11.number().int().positive("ci atom requires a positive integer PR number"),
13986
- componentPrNumber: z11.number().int().positive().optional(),
14297
+ ciAtomSchema = z12.object({
14298
+ kind: z12.literal("ci"),
14299
+ prNumber: z12.number().int().positive("ci atom requires a positive integer PR number"),
14300
+ componentPrNumber: z12.number().int().positive().optional(),
13987
14301
  /** `ci:<owner>/<repo>#<n>`, as for `pr:` (T13912). */
13988
- repo: z11.string().regex(/^[a-z0-9._-]+\/[a-z0-9._-]+$/).optional()
14302
+ repo: z12.string().regex(/^[a-z0-9._-]+\/[a-z0-9._-]+$/).optional()
13989
14303
  });
13990
- ciRunAtomSchema = z11.object({
13991
- kind: z11.literal("ci-run"),
13992
- runId: z11.number().int().positive("ci-run atom requires a positive integer run id")
14304
+ ciRunAtomSchema = z12.object({
14305
+ kind: z12.literal("ci-run"),
14306
+ runId: z12.number().int().positive("ci-run atom requires a positive integer run id")
13993
14307
  });
13994
- deployAtomSchema = z11.object({
13995
- kind: z11.literal("deploy"),
13996
- provider: z11.string().regex(DEPLOY_PROVIDER_REGEX, "deploy atom provider must be a lowercase name"),
13997
- deploymentId: z11.string().regex(DEPLOY_ID_REGEX, "deploy atom requires a deployment id"),
13998
- sha: z11.string().regex(/^[0-9a-f]{7,40}$/, "deploy atom sha must be 7-40 lowercase hex chars"),
13999
- probeUrl: z11.string().regex(/^https?:\/\/\S+$/, "deploy atom probe url must start with http:// or https://")
14308
+ deployAtomSchema = z12.object({
14309
+ kind: z12.literal("deploy"),
14310
+ provider: z12.string().regex(DEPLOY_PROVIDER_REGEX, "deploy atom provider must be a lowercase name"),
14311
+ deploymentId: z12.string().regex(DEPLOY_ID_REGEX, "deploy atom requires a deployment id"),
14312
+ sha: z12.string().regex(/^[0-9a-f]{7,40}$/, "deploy atom sha must be 7-40 lowercase hex chars"),
14313
+ probeUrl: z12.string().regex(/^https?:\/\/\S+$/, "deploy atom probe url must start with http:// or https://")
14000
14314
  });
14001
- locDropAtomSchema = z11.object({
14002
- kind: z11.literal("loc-drop"),
14003
- fromLines: z11.number().int().nonnegative("loc-drop fromLines must be \u2265 0"),
14004
- toLines: z11.number().int().nonnegative("loc-drop toLines must be \u2265 0")
14315
+ locDropAtomSchema = z12.object({
14316
+ kind: z12.literal("loc-drop"),
14317
+ fromLines: z12.number().int().nonnegative("loc-drop fromLines must be \u2265 0"),
14318
+ toLines: z12.number().int().nonnegative("loc-drop toLines must be \u2265 0")
14005
14319
  });
14006
- callsiteCoverageAtomSchema = z11.object({
14007
- kind: z11.literal("callsite-coverage"),
14008
- symbolName: z11.string().min(1, "callsite-coverage atom requires a non-empty symbolName"),
14009
- relativeSourcePath: z11.string().min(1, "callsite-coverage atom requires a non-empty relativeSourcePath")
14320
+ callsiteCoverageAtomSchema = z12.object({
14321
+ kind: z12.literal("callsite-coverage"),
14322
+ symbolName: z12.string().min(1, "callsite-coverage atom requires a non-empty symbolName"),
14323
+ relativeSourcePath: z12.string().min(1, "callsite-coverage atom requires a non-empty relativeSourcePath")
14010
14324
  });
14011
14325
  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}$/;
14012
14326
  AC_ALIAS_REGEX = /^AC[0-9]{1,4}$/;
14013
14327
  SATISFIES_TASK_ID_REGEX = /^T[0-9]{1,7}$/;
14014
14328
  SATISFIES_VERSION_PIN_REGEX = /^[0-9]{14}$/;
14015
- satisfiesAtomSchema = z11.object({
14016
- kind: z11.literal("satisfies"),
14329
+ satisfiesAtomSchema = z12.object({
14330
+ kind: z12.literal("satisfies"),
14017
14331
  /** Target task ID — `T<1-7 digits>` per ADR-079-r2 §2.1. */
14018
- targetTaskId: z11.string().regex(SATISFIES_TASK_ID_REGEX, "satisfies atom targetTaskId must match /^T[0-9]{1,7}$/"),
14332
+ targetTaskId: z12.string().regex(SATISFIES_TASK_ID_REGEX, "satisfies atom targetTaskId must match /^T[0-9]{1,7}$/"),
14019
14333
  /** Lowercase UUIDv4/v5 — populated for the canonical form; undefined for alias form. */
14020
- targetAcId: z11.string().regex(AC_UUID_REGEX, "satisfies atom targetAcId must be a lowercase UUIDv4/v5").optional(),
14334
+ targetAcId: z12.string().regex(AC_UUID_REGEX, "satisfies atom targetAcId must be a lowercase UUIDv4/v5").optional(),
14021
14335
  /** Positional alias `AC<1-4 digits>` — populated for alias form; undefined for UUID form. */
14022
- targetAcAlias: z11.string().regex(AC_ALIAS_REGEX, "satisfies atom targetAcAlias must match /^AC[0-9]{1,4}$/").optional(),
14336
+ targetAcAlias: z12.string().regex(AC_ALIAS_REGEX, "satisfies atom targetAcAlias must match /^AC[0-9]{1,4}$/").optional(),
14023
14337
  /** Optional `@<14-digit YYYYMMDDhhmmss>` pin captured at mint time. */
14024
- versionPin: z11.string().regex(
14338
+ versionPin: z12.string().regex(
14025
14339
  SATISFIES_VERSION_PIN_REGEX,
14026
14340
  "satisfies atom versionPin must be 14 digits (YYYYMMDDhhmmss)"
14027
14341
  ).optional()
14028
14342
  });
14029
- EvidenceAtomSchema = z11.discriminatedUnion("kind", [
14343
+ EvidenceAtomSchema = z12.discriminatedUnion("kind", [
14030
14344
  commitAtomSchema,
14031
14345
  filesAtomSchema,
14032
14346
  testRunAtomSchema,
@@ -14090,58 +14404,58 @@ var init_evidence_atom_schema = __esm({
14090
14404
  });
14091
14405
 
14092
14406
  // packages/contracts/src/evidence-record-schema.ts
14093
- import { z as z12 } from "zod";
14407
+ import { z as z13 } from "zod";
14094
14408
  var evidenceBaseSchema, implDiffRecordSchema, validateSpecCheckRecordSchema, testOutputRecordSchema, lintReportRecordSchema, commandOutputRecordSchema, evidenceRecordSchema;
14095
14409
  var init_evidence_record_schema = __esm({
14096
14410
  "packages/contracts/src/evidence-record-schema.ts"() {
14097
14411
  "use strict";
14098
- evidenceBaseSchema = z12.object({
14412
+ evidenceBaseSchema = z13.object({
14099
14413
  /** Identity string of the agent that produced this record. */
14100
- agentIdentity: z12.string().min(1),
14414
+ agentIdentity: z13.string().min(1),
14101
14415
  /** SHA-256 hex digest (64 chars) of the attached artifact. */
14102
- attachmentSha256: z12.string().length(64),
14416
+ attachmentSha256: z13.string().length(64),
14103
14417
  /** ISO 8601 timestamp at which the action ran. */
14104
- ranAt: z12.string().datetime(),
14418
+ ranAt: z13.string().datetime(),
14105
14419
  /** Wall-clock duration of the action in milliseconds. */
14106
- durationMs: z12.number().nonnegative()
14420
+ durationMs: z13.number().nonnegative()
14107
14421
  });
14108
14422
  implDiffRecordSchema = evidenceBaseSchema.extend({
14109
- kind: z12.literal("impl-diff"),
14110
- phase: z12.literal("implement"),
14111
- filesChanged: z12.array(z12.string().min(1)).min(1),
14112
- linesAdded: z12.number().int().nonnegative(),
14113
- linesRemoved: z12.number().int().nonnegative()
14423
+ kind: z13.literal("impl-diff"),
14424
+ phase: z13.literal("implement"),
14425
+ filesChanged: z13.array(z13.string().min(1)).min(1),
14426
+ linesAdded: z13.number().int().nonnegative(),
14427
+ linesRemoved: z13.number().int().nonnegative()
14114
14428
  });
14115
14429
  validateSpecCheckRecordSchema = evidenceBaseSchema.extend({
14116
- kind: z12.literal("validate-spec-check"),
14117
- phase: z12.literal("validate"),
14118
- reqIdsChecked: z12.array(z12.string().min(1)).min(1),
14119
- passed: z12.boolean(),
14120
- details: z12.string().min(1)
14430
+ kind: z13.literal("validate-spec-check"),
14431
+ phase: z13.literal("validate"),
14432
+ reqIdsChecked: z13.array(z13.string().min(1)).min(1),
14433
+ passed: z13.boolean(),
14434
+ details: z13.string().min(1)
14121
14435
  });
14122
14436
  testOutputRecordSchema = evidenceBaseSchema.extend({
14123
- kind: z12.literal("test-output"),
14124
- phase: z12.literal("test"),
14125
- command: z12.string().min(1),
14126
- exitCode: z12.number().int(),
14127
- testsPassed: z12.number().int().nonnegative(),
14128
- testsFailed: z12.number().int().nonnegative()
14437
+ kind: z13.literal("test-output"),
14438
+ phase: z13.literal("test"),
14439
+ command: z13.string().min(1),
14440
+ exitCode: z13.number().int(),
14441
+ testsPassed: z13.number().int().nonnegative(),
14442
+ testsFailed: z13.number().int().nonnegative()
14129
14443
  });
14130
14444
  lintReportRecordSchema = evidenceBaseSchema.extend({
14131
- kind: z12.literal("lint-report"),
14132
- phase: z12.enum(["implement", "test"]),
14133
- tool: z12.string().min(1),
14134
- passed: z12.boolean(),
14135
- warnings: z12.number().int().nonnegative(),
14136
- errors: z12.number().int().nonnegative()
14445
+ kind: z13.literal("lint-report"),
14446
+ phase: z13.enum(["implement", "test"]),
14447
+ tool: z13.string().min(1),
14448
+ passed: z13.boolean(),
14449
+ warnings: z13.number().int().nonnegative(),
14450
+ errors: z13.number().int().nonnegative()
14137
14451
  });
14138
14452
  commandOutputRecordSchema = evidenceBaseSchema.extend({
14139
- kind: z12.literal("command-output"),
14140
- phase: z12.enum(["implement", "validate", "test"]),
14141
- cmd: z12.string().min(1),
14142
- exitCode: z12.number().int()
14453
+ kind: z13.literal("command-output"),
14454
+ phase: z13.enum(["implement", "validate", "test"]),
14455
+ cmd: z13.string().min(1),
14456
+ exitCode: z13.number().int()
14143
14457
  });
14144
- evidenceRecordSchema = z12.discriminatedUnion("kind", [
14458
+ evidenceRecordSchema = z13.discriminatedUnion("kind", [
14145
14459
  implDiffRecordSchema,
14146
14460
  validateSpecCheckRecordSchema,
14147
14461
  testOutputRecordSchema,
@@ -15162,111 +15476,111 @@ var init_lafs = __esm({
15162
15476
  });
15163
15477
 
15164
15478
  // packages/contracts/src/lease-ipc/messages.ts
15165
- import { z as z13 } from "zod";
15479
+ import { z as z14 } from "zod";
15166
15480
  var LeaseScopeSchema, LeaseLaneSchema, LeaseAcquireRequestSchema, LeaseReleaseRequestSchema, LeaseRenewRequestSchema, RateCheckRequestSchema, ToolGrantRequestSchema, QueuePriorityClassSchema, QueueAdmitRequestSchema, WorkerHeartbeatRequestSchema, ResourceAdmitRequestSchema, ResourceReleaseRequestSchema, LeaseIpcRequestSchema, LeaseGrantedResponseSchema, LeaseQueuedResponseSchema, LeaseDeniedResponseSchema, RateResultResponseSchema, ToolGrantedResponseSchema, LeaseRevokedResponseSchema, ChildKilledUnresponsiveResponseSchema, QueueAdmitDispositionSchema, QueueAdmitResultResponseSchema, HeartbeatAckResponseSchema, ResourceAdmitDispositionSchema, ResourceAdmitResultResponseSchema, ResourceReleaseResultResponseSchema, LeaseErrorResponseSchema, LeaseIpcResponseSchema, LeaseIpcRequestEnvelopeSchema, LeaseIpcResponseEnvelopeSchema, LeaseIpcEnvelopeSchema, LEASE_IPC_REQUEST_KINDS, LEASE_IPC_RESPONSE_KINDS, LEASE_IPC_MESSAGE_KINDS;
15167
15481
  var init_messages2 = __esm({
15168
15482
  "packages/contracts/src/lease-ipc/messages.ts"() {
15169
15483
  "use strict";
15170
- LeaseScopeSchema = z13.enum(["project", "global"]);
15171
- LeaseLaneSchema = z13.enum(["tasks", "brain", "bulk"]);
15172
- LeaseAcquireRequestSchema = z13.object({
15484
+ LeaseScopeSchema = z14.enum(["project", "global"]);
15485
+ LeaseLaneSchema = z14.enum(["tasks", "brain", "bulk"]);
15486
+ LeaseAcquireRequestSchema = z14.object({
15173
15487
  /** Tag discriminating this request variant. */
15174
- kind: z13.literal("lease_acquire"),
15488
+ kind: z14.literal("lease_acquire"),
15175
15489
  /** The cleo.db scope being arbitrated. */
15176
15490
  scope: LeaseScopeSchema,
15177
15491
  /** The write lane within the scope. */
15178
15492
  lane: LeaseLaneSchema,
15179
15493
  /** Process+lane holder identity. */
15180
- holder_id: z13.string().min(1),
15494
+ holder_id: z14.string().min(1),
15181
15495
  /** Advisory priority — lower acquires sooner. `0` = highest. */
15182
- priority: z13.number().int().min(0).max(255),
15496
+ priority: z14.number().int().min(0).max(255),
15183
15497
  /** Lease time-to-live in milliseconds. */
15184
- ttl_ms: z13.number().int().nonnegative(),
15498
+ ttl_ms: z14.number().int().nonnegative(),
15185
15499
  /** When true, a same-holder acquire re-enters (refcount++) rather than queuing. */
15186
- reentrant: z13.boolean()
15500
+ reentrant: z14.boolean()
15187
15501
  }).strict();
15188
- LeaseReleaseRequestSchema = z13.object({
15502
+ LeaseReleaseRequestSchema = z14.object({
15189
15503
  /** Tag discriminating this request variant. */
15190
- kind: z13.literal("lease_release"),
15504
+ kind: z14.literal("lease_release"),
15191
15505
  /** The cleo.db scope being arbitrated. */
15192
15506
  scope: LeaseScopeSchema,
15193
15507
  /** The write lane within the scope. */
15194
15508
  lane: LeaseLaneSchema,
15195
15509
  /** Process+lane holder identity. */
15196
- holder_id: z13.string().min(1),
15510
+ holder_id: z14.string().min(1),
15197
15511
  /** The epoch fence the holder acquired — a stale epoch no-ops. */
15198
- epoch: z13.number().int().nonnegative()
15512
+ epoch: z14.number().int().nonnegative()
15199
15513
  }).strict();
15200
- LeaseRenewRequestSchema = z13.object({
15514
+ LeaseRenewRequestSchema = z14.object({
15201
15515
  /** Tag discriminating this request variant. */
15202
- kind: z13.literal("lease_renew"),
15516
+ kind: z14.literal("lease_renew"),
15203
15517
  /** The cleo.db scope being arbitrated. */
15204
15518
  scope: LeaseScopeSchema,
15205
15519
  /** The write lane within the scope. */
15206
15520
  lane: LeaseLaneSchema,
15207
15521
  /** Process+lane holder identity. */
15208
- holder_id: z13.string().min(1),
15522
+ holder_id: z14.string().min(1),
15209
15523
  /** The epoch fence the holder acquired (epoch-guarded renew). */
15210
- epoch: z13.number().int().nonnegative()
15524
+ epoch: z14.number().int().nonnegative()
15211
15525
  }).strict();
15212
- RateCheckRequestSchema = z13.object({
15526
+ RateCheckRequestSchema = z14.object({
15213
15527
  /** Tag discriminating this request variant. */
15214
- kind: z13.literal("rate_check"),
15528
+ kind: z14.literal("rate_check"),
15215
15529
  /** The cleo.db scope being checked. */
15216
15530
  scope: LeaseScopeSchema,
15217
15531
  /** The write lane within the scope. */
15218
15532
  lane: LeaseLaneSchema,
15219
15533
  /** Estimated bytes the caller intends to write. */
15220
- est_bytes: z13.number().int().nonnegative()
15534
+ est_bytes: z14.number().int().nonnegative()
15221
15535
  }).strict();
15222
- ToolGrantRequestSchema = z13.object({
15536
+ ToolGrantRequestSchema = z14.object({
15223
15537
  /** Tag discriminating this request variant. */
15224
- kind: z13.literal("tool_grant"),
15538
+ kind: z14.literal("tool_grant"),
15225
15539
  /** The tool name being requested. */
15226
- tool: z13.string().min(1),
15540
+ tool: z14.string().min(1),
15227
15541
  /** The requesting holder identity. */
15228
- holder_id: z13.string().min(1)
15542
+ holder_id: z14.string().min(1)
15229
15543
  }).strict();
15230
- QueuePriorityClassSchema = z13.enum(["lead", "worker", "background"]);
15231
- QueueAdmitRequestSchema = z13.object({
15544
+ QueuePriorityClassSchema = z14.enum(["lead", "worker", "background"]);
15545
+ QueueAdmitRequestSchema = z14.object({
15232
15546
  /** Tag discriminating this request variant. */
15233
- kind: z13.literal("queue_admit"),
15547
+ kind: z14.literal("queue_admit"),
15234
15548
  /** The LLM provider id the call targets (rate budget is per-provider). */
15235
- provider: z13.string().min(1),
15549
+ provider: z14.string().min(1),
15236
15550
  /** The caller's priority class (lead > worker > background). */
15237
15551
  priority_class: QueuePriorityClassSchema,
15238
15552
  /** The caller's estimate of the request's token cost (debited on admit). */
15239
- est_tokens: z13.number().int().nonnegative(),
15553
+ est_tokens: z14.number().int().nonnegative(),
15240
15554
  /** The child the call belongs to (in-flight tracking — the watchdog seam). */
15241
- child_id: z13.string().min(1)
15555
+ child_id: z14.string().min(1)
15242
15556
  }).strict();
15243
- WorkerHeartbeatRequestSchema = z13.object({
15557
+ WorkerHeartbeatRequestSchema = z14.object({
15244
15558
  /** Tag discriminating this request variant. */
15245
- kind: z13.literal("worker_heartbeat"),
15559
+ kind: z14.literal("worker_heartbeat"),
15246
15560
  /** The logical id of the heartbeating child (matches the registry key). */
15247
- child_id: z13.string().min(1),
15561
+ child_id: z14.string().min(1),
15248
15562
  /** The worker's own view of whether it is currently inside an LLM call. */
15249
- in_flight_llm: z13.boolean()
15563
+ in_flight_llm: z14.boolean()
15250
15564
  }).strict();
15251
- ResourceAdmitRequestSchema = z13.object({
15565
+ ResourceAdmitRequestSchema = z14.object({
15252
15566
  /** Tag discriminating this request variant. */
15253
- kind: z13.literal("resource_admit"),
15567
+ kind: z14.literal("resource_admit"),
15254
15568
  /** The resource class (e.g. `"db-heavy"`, `"full-build"`, `"test-run"`). */
15255
- class: z13.string().min(1),
15569
+ class: z14.string().min(1),
15256
15570
  /** The caller holding the slot — process/worktree-unique; the release key. */
15257
- holder_id: z13.string().min(1),
15571
+ holder_id: z14.string().min(1),
15258
15572
  /** The client-computed budget: the max concurrent holders for this class. */
15259
- budget: z13.number().int().nonnegative()
15573
+ budget: z14.number().int().nonnegative()
15260
15574
  }).strict();
15261
- ResourceReleaseRequestSchema = z13.object({
15575
+ ResourceReleaseRequestSchema = z14.object({
15262
15576
  /** Tag discriminating this request variant. */
15263
- kind: z13.literal("resource_release"),
15577
+ kind: z14.literal("resource_release"),
15264
15578
  /** The resource class the slot belongs to. */
15265
- class: z13.string().min(1),
15579
+ class: z14.string().min(1),
15266
15580
  /** The holder that was admitted (matches the admit `holder_id`). */
15267
- holder_id: z13.string().min(1)
15581
+ holder_id: z14.string().min(1)
15268
15582
  }).strict();
15269
- LeaseIpcRequestSchema = z13.discriminatedUnion("kind", [
15583
+ LeaseIpcRequestSchema = z14.discriminatedUnion("kind", [
15270
15584
  LeaseAcquireRequestSchema,
15271
15585
  LeaseReleaseRequestSchema,
15272
15586
  LeaseRenewRequestSchema,
@@ -15277,133 +15591,133 @@ var init_messages2 = __esm({
15277
15591
  ResourceAdmitRequestSchema,
15278
15592
  ResourceReleaseRequestSchema
15279
15593
  ]);
15280
- LeaseGrantedResponseSchema = z13.object({
15594
+ LeaseGrantedResponseSchema = z14.object({
15281
15595
  /** Tag discriminating this response variant. */
15282
- kind: z13.literal("lease_granted"),
15596
+ kind: z14.literal("lease_granted"),
15283
15597
  /** The granted cleo.db scope. */
15284
15598
  scope: LeaseScopeSchema,
15285
15599
  /** The granted write lane. */
15286
15600
  lane: LeaseLaneSchema,
15287
15601
  /** The holder the lease was granted to. */
15288
- holder_id: z13.string().min(1),
15602
+ holder_id: z14.string().min(1),
15289
15603
  /** The monotonic epoch fence assigned to this grant. */
15290
- epoch: z13.number().int().nonnegative(),
15604
+ epoch: z14.number().int().nonnegative(),
15291
15605
  /** The lease TTL in milliseconds. */
15292
- ttl_ms: z13.number().int().nonnegative(),
15606
+ ttl_ms: z14.number().int().nonnegative(),
15293
15607
  /** Absolute expiry timestamp (epoch ms) for this grant. */
15294
- expires_at_ms: z13.number().int().nonnegative()
15608
+ expires_at_ms: z14.number().int().nonnegative()
15295
15609
  }).strict();
15296
- LeaseQueuedResponseSchema = z13.object({
15610
+ LeaseQueuedResponseSchema = z14.object({
15297
15611
  /** Tag discriminating this response variant. */
15298
- kind: z13.literal("lease_queued"),
15612
+ kind: z14.literal("lease_queued"),
15299
15613
  /** The queued cleo.db scope. */
15300
15614
  scope: LeaseScopeSchema,
15301
15615
  /** The queued write lane. */
15302
15616
  lane: LeaseLaneSchema,
15303
15617
  /** The monotonic ticket assigned for FIFO tiebreak. */
15304
- ticket: z13.number().int().nonnegative(),
15618
+ ticket: z14.number().int().nonnegative(),
15305
15619
  /** Number of waiters ahead of this one. */
15306
- ahead: z13.number().int().nonnegative()
15620
+ ahead: z14.number().int().nonnegative()
15307
15621
  }).strict();
15308
- LeaseDeniedResponseSchema = z13.object({
15622
+ LeaseDeniedResponseSchema = z14.object({
15309
15623
  /** Tag discriminating this response variant. */
15310
- kind: z13.literal("lease_denied"),
15624
+ kind: z14.literal("lease_denied"),
15311
15625
  /** The denied cleo.db scope. */
15312
15626
  scope: LeaseScopeSchema,
15313
15627
  /** Machine-readable denial code (e.g. `E_LEASE_UNAVAILABLE`). */
15314
- code: z13.string().min(1),
15628
+ code: z14.string().min(1),
15315
15629
  /** Human-readable denial message. */
15316
- message: z13.string()
15630
+ message: z14.string()
15317
15631
  }).strict();
15318
- RateResultResponseSchema = z13.object({
15632
+ RateResultResponseSchema = z14.object({
15319
15633
  /** Tag discriminating this response variant. */
15320
- kind: z13.literal("rate_result"),
15634
+ kind: z14.literal("rate_result"),
15321
15635
  /** The checked cleo.db scope. */
15322
15636
  scope: LeaseScopeSchema,
15323
15637
  /** Whether the write is within budget. */
15324
- ok: z13.boolean(),
15638
+ ok: z14.boolean(),
15325
15639
  /** Suggested back-off in milliseconds when `ok` is false. */
15326
- retry_after_ms: z13.number().int().nonnegative(),
15640
+ retry_after_ms: z14.number().int().nonnegative(),
15327
15641
  /** Remaining token budget for the scope. */
15328
- tokens_remaining: z13.number().int().nonnegative()
15642
+ tokens_remaining: z14.number().int().nonnegative()
15329
15643
  }).strict();
15330
- ToolGrantedResponseSchema = z13.object({
15644
+ ToolGrantedResponseSchema = z14.object({
15331
15645
  /** Tag discriminating this response variant. */
15332
- kind: z13.literal("tool_granted"),
15646
+ kind: z14.literal("tool_granted"),
15333
15647
  /** The granted tool name. */
15334
- tool: z13.string().min(1),
15648
+ tool: z14.string().min(1),
15335
15649
  /** The holder the tool grant was issued to. */
15336
- holder_id: z13.string().min(1)
15650
+ holder_id: z14.string().min(1)
15337
15651
  }).strict();
15338
- LeaseRevokedResponseSchema = z13.object({
15652
+ LeaseRevokedResponseSchema = z14.object({
15339
15653
  /** Tag discriminating this response variant. */
15340
- kind: z13.literal("lease_revoked"),
15654
+ kind: z14.literal("lease_revoked"),
15341
15655
  /** The revoked cleo.db scope. */
15342
15656
  scope: LeaseScopeSchema,
15343
15657
  /** The revoked write lane. */
15344
15658
  lane: LeaseLaneSchema,
15345
15659
  /** The holder whose lease was revoked. */
15346
- holder_id: z13.string().min(1),
15660
+ holder_id: z14.string().min(1),
15347
15661
  /** Human-readable reason for the revocation. */
15348
- reason: z13.string()
15662
+ reason: z14.string()
15349
15663
  }).strict();
15350
- ChildKilledUnresponsiveResponseSchema = z13.object({
15664
+ ChildKilledUnresponsiveResponseSchema = z14.object({
15351
15665
  /** Tag discriminating this response variant. */
15352
- kind: z13.literal("child_killed_unresponsive"),
15666
+ kind: z14.literal("child_killed_unresponsive"),
15353
15667
  /** Logical id of the killed child. */
15354
- child_id: z13.string().min(1),
15668
+ child_id: z14.string().min(1),
15355
15669
  /** The holder identity the killed child held the lease as. */
15356
- holder_id: z13.string().min(1),
15670
+ holder_id: z14.string().min(1),
15357
15671
  /** The cleo.db scope the killed child held the lease in. */
15358
15672
  scope: LeaseScopeSchema,
15359
15673
  /** Human-readable reason for the kill. */
15360
- reason: z13.string()
15674
+ reason: z14.string()
15361
15675
  }).strict();
15362
- QueueAdmitDispositionSchema = z13.enum(["admitted", "deferred"]);
15363
- QueueAdmitResultResponseSchema = z13.object({
15676
+ QueueAdmitDispositionSchema = z14.enum(["admitted", "deferred"]);
15677
+ QueueAdmitResultResponseSchema = z14.object({
15364
15678
  /** Tag discriminating this response variant. */
15365
- kind: z13.literal("queue_admit_result"),
15679
+ kind: z14.literal("queue_admit_result"),
15366
15680
  /** Whether the LLM call was admitted or deferred. */
15367
15681
  disposition: QueueAdmitDispositionSchema,
15368
15682
  /** Back-off in ms before re-requesting (0 when admitted). */
15369
- retry_after_ms: z13.number().int().nonnegative(),
15683
+ retry_after_ms: z14.number().int().nonnegative(),
15370
15684
  /** Remaining provider token budget after this decision. */
15371
- tokens_remaining: z13.number().int().nonnegative(),
15685
+ tokens_remaining: z14.number().int().nonnegative(),
15372
15686
  /** Number of higher/equal-priority waiters ahead (0 when admitted). */
15373
- queue_position: z13.number().int().nonnegative()
15687
+ queue_position: z14.number().int().nonnegative()
15374
15688
  }).strict();
15375
- HeartbeatAckResponseSchema = z13.object({
15689
+ HeartbeatAckResponseSchema = z14.object({
15376
15690
  /** Tag discriminating this response variant. */
15377
- kind: z13.literal("heartbeat_ack")
15691
+ kind: z14.literal("heartbeat_ack")
15378
15692
  }).strict();
15379
- ResourceAdmitDispositionSchema = z13.enum(["admitted", "deferred"]);
15380
- ResourceAdmitResultResponseSchema = z13.object({
15693
+ ResourceAdmitDispositionSchema = z14.enum(["admitted", "deferred"]);
15694
+ ResourceAdmitResultResponseSchema = z14.object({
15381
15695
  /** Tag discriminating this response variant. */
15382
- kind: z13.literal("resource_admit_result"),
15696
+ kind: z14.literal("resource_admit_result"),
15383
15697
  /** Whether the heavy op was admitted or deferred. */
15384
15698
  disposition: ResourceAdmitDispositionSchema,
15385
15699
  /** Back-off in ms before re-requesting (0 when admitted). */
15386
- retry_after_ms: z13.number().int().nonnegative(),
15700
+ retry_after_ms: z14.number().int().nonnegative(),
15387
15701
  /** Remaining slots for the class after this decision. */
15388
- slots_remaining: z13.number().int().nonnegative()
15702
+ slots_remaining: z14.number().int().nonnegative()
15389
15703
  }).strict();
15390
- ResourceReleaseResultResponseSchema = z13.object({
15704
+ ResourceReleaseResultResponseSchema = z14.object({
15391
15705
  /** Tag discriminating this response variant. */
15392
- kind: z13.literal("resource_release_result"),
15706
+ kind: z14.literal("resource_release_result"),
15393
15707
  /** Whether a held slot was actually released (false = no such holder). */
15394
- released: z13.boolean(),
15708
+ released: z14.boolean(),
15395
15709
  /** Remaining in-flight holders for the class after the release. */
15396
- slots_remaining: z13.number().int().nonnegative()
15710
+ slots_remaining: z14.number().int().nonnegative()
15397
15711
  }).strict();
15398
- LeaseErrorResponseSchema = z13.object({
15712
+ LeaseErrorResponseSchema = z14.object({
15399
15713
  /** Tag discriminating this response variant. */
15400
- kind: z13.literal("error"),
15714
+ kind: z14.literal("error"),
15401
15715
  /** Machine-readable error code (e.g. `E_LEASE_BAD_VERSION`, `E_LEASE_UNIMPLEMENTED`). */
15402
- code: z13.string().min(1),
15716
+ code: z14.string().min(1),
15403
15717
  /** Human-readable error message. */
15404
- message: z13.string()
15718
+ message: z14.string()
15405
15719
  }).strict();
15406
- LeaseIpcResponseSchema = z13.discriminatedUnion("kind", [
15720
+ LeaseIpcResponseSchema = z14.discriminatedUnion("kind", [
15407
15721
  LeaseGrantedResponseSchema,
15408
15722
  LeaseQueuedResponseSchema,
15409
15723
  LeaseDeniedResponseSchema,
@@ -15417,27 +15731,27 @@ var init_messages2 = __esm({
15417
15731
  ResourceReleaseResultResponseSchema,
15418
15732
  LeaseErrorResponseSchema
15419
15733
  ]);
15420
- LeaseIpcRequestEnvelopeSchema = z13.object({
15734
+ LeaseIpcRequestEnvelopeSchema = z14.object({
15421
15735
  /** Parallel protocol version. */
15422
- protocol_version: z13.string(),
15736
+ protocol_version: z14.string(),
15423
15737
  /** Correlation id echoed back on the matching response. */
15424
- id: z13.string().min(1),
15738
+ id: z14.string().min(1),
15425
15739
  /** Direction discriminator. */
15426
- direction: z13.literal("request"),
15740
+ direction: z14.literal("request"),
15427
15741
  /** The request body. */
15428
15742
  request: LeaseIpcRequestSchema
15429
15743
  }).strict();
15430
- LeaseIpcResponseEnvelopeSchema = z13.object({
15744
+ LeaseIpcResponseEnvelopeSchema = z14.object({
15431
15745
  /** Parallel protocol version. */
15432
- protocol_version: z13.string(),
15746
+ protocol_version: z14.string(),
15433
15747
  /** Correlation id echoed from the originating request (or a fresh id for events). */
15434
- id: z13.string().min(1),
15748
+ id: z14.string().min(1),
15435
15749
  /** Direction discriminator. */
15436
- direction: z13.literal("response"),
15750
+ direction: z14.literal("response"),
15437
15751
  /** The response body. */
15438
15752
  response: LeaseIpcResponseSchema
15439
15753
  }).strict();
15440
- LeaseIpcEnvelopeSchema = z13.discriminatedUnion("direction", [
15754
+ LeaseIpcEnvelopeSchema = z14.discriminatedUnion("direction", [
15441
15755
  LeaseIpcRequestEnvelopeSchema,
15442
15756
  LeaseIpcResponseEnvelopeSchema
15443
15757
  ]);
@@ -15490,7 +15804,7 @@ var init_lease_ipc = __esm({
15490
15804
  });
15491
15805
 
15492
15806
  // packages/contracts/src/llm/catalog-schema.ts
15493
- import { z as z14 } from "zod";
15807
+ import { z as z15 } from "zod";
15494
15808
  var CATALOG_MODEL_STATUSES, CATALOG_AUTH_TYPES, isoDate, semver, catalogModalitiesSchema, catalogCostSchema, catalogLimitSchema, catalogModelProviderSchema, catalogModelEntrySchema, catalogProviderSchema, curatedCatalogSchema, modelsCatalogRowInsertSchema, modelsCatalogRowSelectSchema;
15495
15809
  var init_catalog_schema = __esm({
15496
15810
  "packages/contracts/src/llm/catalog-schema.ts"() {
@@ -15503,78 +15817,78 @@ var init_catalog_schema = __esm({
15503
15817
  "retired"
15504
15818
  ];
15505
15819
  CATALOG_AUTH_TYPES = ["api_key", "oauth", "bedrock", "vertex"];
15506
- isoDate = z14.string().regex(/^\d{4}-\d{2}-\d{2}$/, "must be an ISO date (YYYY-MM-DD)");
15507
- semver = z14.string().regex(/^\d+\.\d+\.\d+$/, "must be semver (MAJOR.MINOR.PATCH)");
15508
- catalogModalitiesSchema = z14.object({
15509
- input: z14.array(z14.string()),
15510
- output: z14.array(z14.string())
15820
+ isoDate = z15.string().regex(/^\d{4}-\d{2}-\d{2}$/, "must be an ISO date (YYYY-MM-DD)");
15821
+ semver = z15.string().regex(/^\d+\.\d+\.\d+$/, "must be semver (MAJOR.MINOR.PATCH)");
15822
+ catalogModalitiesSchema = z15.object({
15823
+ input: z15.array(z15.string()),
15824
+ output: z15.array(z15.string())
15511
15825
  }).strict();
15512
- catalogCostSchema = z14.object({
15513
- input: z14.number().optional(),
15514
- output: z14.number().optional(),
15515
- cache_read: z14.number().optional(),
15516
- cache_write: z14.number().optional(),
15517
- context_over_200k: z14.number().optional()
15826
+ catalogCostSchema = z15.object({
15827
+ input: z15.number().optional(),
15828
+ output: z15.number().optional(),
15829
+ cache_read: z15.number().optional(),
15830
+ cache_write: z15.number().optional(),
15831
+ context_over_200k: z15.number().optional()
15518
15832
  }).strict();
15519
- catalogLimitSchema = z14.object({
15520
- context: z14.number(),
15521
- output: z14.number()
15833
+ catalogLimitSchema = z15.object({
15834
+ context: z15.number(),
15835
+ output: z15.number()
15522
15836
  }).strict();
15523
- catalogModelProviderSchema = z14.object({
15524
- npm: z14.string(),
15525
- api: z14.string()
15837
+ catalogModelProviderSchema = z15.object({
15838
+ npm: z15.string(),
15839
+ api: z15.string()
15526
15840
  }).strict();
15527
- catalogModelEntrySchema = z14.object({
15528
- id: z14.string(),
15529
- name: z14.string(),
15530
- family: z14.string(),
15531
- attachment: z14.boolean(),
15532
- reasoning: z14.boolean(),
15533
- temperature: z14.boolean(),
15534
- interleaved: z14.boolean(),
15535
- tool_call: z14.boolean(),
15841
+ catalogModelEntrySchema = z15.object({
15842
+ id: z15.string(),
15843
+ name: z15.string(),
15844
+ family: z15.string(),
15845
+ attachment: z15.boolean(),
15846
+ reasoning: z15.boolean(),
15847
+ temperature: z15.boolean(),
15848
+ interleaved: z15.boolean(),
15849
+ tool_call: z15.boolean(),
15536
15850
  modalities: catalogModalitiesSchema,
15537
15851
  cost: catalogCostSchema,
15538
15852
  limit: catalogLimitSchema,
15539
- status: z14.enum(CATALOG_MODEL_STATUSES),
15853
+ status: z15.enum(CATALOG_MODEL_STATUSES),
15540
15854
  release_date: isoDate,
15541
15855
  provider: catalogModelProviderSchema
15542
15856
  }).strict();
15543
- catalogProviderSchema = z14.object({
15544
- id: z14.string(),
15545
- endpoint: z14.string(),
15546
- authTypes: z14.array(z14.enum(CATALOG_AUTH_TYPES)).min(1),
15547
- npm: z14.string().optional()
15857
+ catalogProviderSchema = z15.object({
15858
+ id: z15.string(),
15859
+ endpoint: z15.string(),
15860
+ authTypes: z15.array(z15.enum(CATALOG_AUTH_TYPES)).min(1),
15861
+ npm: z15.string().optional()
15548
15862
  }).strict();
15549
- curatedCatalogSchema = z14.object({
15550
- $schema: z14.string().optional(),
15863
+ curatedCatalogSchema = z15.object({
15864
+ $schema: z15.string().optional(),
15551
15865
  version: semver,
15552
15866
  lastUpdated: isoDate,
15553
- providers: z14.record(z14.string(), catalogProviderSchema),
15554
- models: z14.record(z14.string(), z14.record(z14.string(), catalogModelEntrySchema))
15867
+ providers: z15.record(z15.string(), catalogProviderSchema),
15868
+ models: z15.record(z15.string(), z15.record(z15.string(), catalogModelEntrySchema))
15555
15869
  }).strict();
15556
- modelsCatalogRowInsertSchema = z14.object({
15557
- id: z14.string(),
15558
- providerId: z14.string(),
15559
- name: z14.string(),
15560
- family: z14.string(),
15561
- attachment: z14.boolean(),
15562
- reasoning: z14.boolean(),
15563
- temperature: z14.boolean(),
15564
- interleaved: z14.boolean(),
15565
- toolCall: z14.boolean(),
15566
- modalities: z14.string(),
15567
- cost: z14.string(),
15568
- contextLimit: z14.number().nullable().optional(),
15569
- outputLimit: z14.number().nullable().optional(),
15570
- status: z14.enum(CATALOG_MODEL_STATUSES),
15870
+ modelsCatalogRowInsertSchema = z15.object({
15871
+ id: z15.string(),
15872
+ providerId: z15.string(),
15873
+ name: z15.string(),
15874
+ family: z15.string(),
15875
+ attachment: z15.boolean(),
15876
+ reasoning: z15.boolean(),
15877
+ temperature: z15.boolean(),
15878
+ interleaved: z15.boolean(),
15879
+ toolCall: z15.boolean(),
15880
+ modalities: z15.string(),
15881
+ cost: z15.string(),
15882
+ contextLimit: z15.number().nullable().optional(),
15883
+ outputLimit: z15.number().nullable().optional(),
15884
+ status: z15.enum(CATALOG_MODEL_STATUSES),
15571
15885
  releaseDate: isoDate,
15572
- modelsDevId: z14.string(),
15573
- source: z14.string(),
15574
- seededAt: z14.string().optional()
15886
+ modelsDevId: z15.string(),
15887
+ source: z15.string(),
15888
+ seededAt: z15.string().optional()
15575
15889
  }).strict();
15576
15890
  modelsCatalogRowSelectSchema = modelsCatalogRowInsertSchema.extend({
15577
- seededAt: z14.string()
15891
+ seededAt: z15.string()
15578
15892
  });
15579
15893
  }
15580
15894
  });
@@ -15689,7 +16003,7 @@ var init_status_registry = __esm({
15689
16003
  });
15690
16004
 
15691
16005
  // packages/contracts/src/workgraph.ts
15692
- import { z as z15 } from "zod";
16006
+ import { z as z16 } from "zod";
15693
16007
  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;
15694
16008
  var init_workgraph = __esm({
15695
16009
  "packages/contracts/src/workgraph.ts"() {
@@ -15697,10 +16011,10 @@ var init_workgraph = __esm({
15697
16011
  init_enums();
15698
16012
  init_status_registry();
15699
16013
  E_WORKGRAPH_PARENT_TYPE_MATRIX = "E_WORKGRAPH_PARENT_TYPE_MATRIX";
15700
- taskTypeSchema = z15.enum(["saga", "epic", "task", "subtask"]);
15701
- taskPrioritySchema = z15.enum(["critical", "high", "medium", "low"]);
15702
- taskStatusSchema = z15.enum(TASK_STATUSES);
15703
- verificationGateSchema = z15.enum([
16014
+ taskTypeSchema = z16.enum(["saga", "epic", "task", "subtask"]);
16015
+ taskPrioritySchema = z16.enum(["critical", "high", "medium", "low"]);
16016
+ taskStatusSchema = z16.enum(TASK_STATUSES);
16017
+ verificationGateSchema = z16.enum([
15704
16018
  "implemented",
15705
16019
  "testsPassed",
15706
16020
  "qaPassed",
@@ -15709,7 +16023,7 @@ var init_workgraph = __esm({
15709
16023
  "documented",
15710
16024
  "nexusImpact"
15711
16025
  ]);
15712
- workGraphRelationKindSchema = z15.enum([
16026
+ workGraphRelationKindSchema = z16.enum([
15713
16027
  "contains",
15714
16028
  "depends_on",
15715
16029
  "blocks",
@@ -15717,317 +16031,317 @@ var init_workgraph = __esm({
15717
16031
  "groups",
15718
16032
  "satisfies"
15719
16033
  ]);
15720
- workGraphTraversalDirectionSchema = z15.enum([
16034
+ workGraphTraversalDirectionSchema = z16.enum([
15721
16035
  "ancestors",
15722
16036
  "descendants",
15723
16037
  "upstream",
15724
16038
  "downstream"
15725
16039
  ]);
15726
- workGraphEdgeDirectionSchema = z15.enum(["out", "in", "both"]);
15727
- paginationParamsSchema = z15.object({
15728
- cursor: z15.string().min(1).optional(),
15729
- limit: z15.number().int().positive().max(500).optional()
16040
+ workGraphEdgeDirectionSchema = z16.enum(["out", "in", "both"]);
16041
+ paginationParamsSchema = z16.object({
16042
+ cursor: z16.string().min(1).optional(),
16043
+ limit: z16.number().int().positive().max(500).optional()
15730
16044
  });
15731
- workGraphNodeSchema = z15.object({
15732
- id: z15.string().min(1),
16045
+ workGraphNodeSchema = z16.object({
16046
+ id: z16.string().min(1),
15733
16047
  type: taskTypeSchema,
15734
- title: z15.string(),
16048
+ title: z16.string(),
15735
16049
  status: taskStatusSchema,
15736
16050
  priority: taskPrioritySchema,
15737
- parentId: z15.string().min(1).optional()
16051
+ parentId: z16.string().min(1).optional()
15738
16052
  });
15739
- workGraphEdgeSchema = z15.object({
15740
- fromId: z15.string().min(1),
15741
- toId: z15.string().min(1),
16053
+ workGraphEdgeSchema = z16.object({
16054
+ fromId: z16.string().min(1),
16055
+ toId: z16.string().min(1),
15742
16056
  kind: workGraphRelationKindSchema
15743
16057
  });
15744
- workGraphHierarchyEdgeSchema = z15.object({
15745
- fromId: z15.string().min(1),
15746
- toId: z15.string().min(1),
15747
- kind: z15.literal("contains")
16058
+ workGraphHierarchyEdgeSchema = z16.object({
16059
+ fromId: z16.string().min(1),
16060
+ toId: z16.string().min(1),
16061
+ kind: z16.literal("contains")
15748
16062
  }).strict();
15749
- workGraphPageInfoSchema = z15.object({
15750
- nextCursor: z15.string().min(1).optional(),
15751
- hasMore: z15.boolean()
15752
- });
15753
- workGraphRollupCountsSchema = z15.object({
15754
- total: z15.number().int().nonnegative(),
15755
- byStatus: z15.partialRecord(taskStatusSchema, z15.number().int().nonnegative()),
15756
- byType: z15.partialRecord(taskTypeSchema, z15.number().int().nonnegative())
15757
- });
15758
- workGraphSubtreePercentagesSchema = z15.object({
15759
- done: z15.number().nonnegative(),
15760
- active: z15.number().nonnegative(),
15761
- blocked: z15.number().nonnegative(),
15762
- pending: z15.number().nonnegative(),
15763
- cancelled: z15.number().nonnegative()
15764
- });
15765
- workGraphProjectionMismatchSchema = z15.object({
15766
- field: z15.string().min(1),
15767
- expected: z15.number().int().nonnegative(),
15768
- actual: z15.number().int().nonnegative()
16063
+ workGraphPageInfoSchema = z16.object({
16064
+ nextCursor: z16.string().min(1).optional(),
16065
+ hasMore: z16.boolean()
16066
+ });
16067
+ workGraphRollupCountsSchema = z16.object({
16068
+ total: z16.number().int().nonnegative(),
16069
+ byStatus: z16.partialRecord(taskStatusSchema, z16.number().int().nonnegative()),
16070
+ byType: z16.partialRecord(taskTypeSchema, z16.number().int().nonnegative())
16071
+ });
16072
+ workGraphSubtreePercentagesSchema = z16.object({
16073
+ done: z16.number().nonnegative(),
16074
+ active: z16.number().nonnegative(),
16075
+ blocked: z16.number().nonnegative(),
16076
+ pending: z16.number().nonnegative(),
16077
+ cancelled: z16.number().nonnegative()
16078
+ });
16079
+ workGraphProjectionMismatchSchema = z16.object({
16080
+ field: z16.string().min(1),
16081
+ expected: z16.number().int().nonnegative(),
16082
+ actual: z16.number().int().nonnegative()
15769
16083
  });
15770
16084
  workGraphReadyFrontierTaskSchema = workGraphNodeSchema.extend({
15771
- role: z15.string().min(1).optional(),
15772
- dependencyBlockers: z15.array(z15.object({ taskId: z15.string().min(1), status: taskStatusSchema })),
15773
- gateBlockers: z15.array(z15.object({ gate: verificationGateSchema }))
16085
+ role: z16.string().min(1).optional(),
16086
+ dependencyBlockers: z16.array(z16.object({ taskId: z16.string().min(1), status: taskStatusSchema })),
16087
+ gateBlockers: z16.array(z16.object({ gate: verificationGateSchema }))
15774
16088
  });
15775
16089
  workGraphRelationEdgeSchema = workGraphEdgeSchema.extend({
15776
- source: z15.literal("relation"),
15777
- relationType: z15.enum(TASK_RELATION_TYPES),
15778
- reason: z15.string().min(1).optional()
16090
+ source: z16.literal("relation"),
16091
+ relationType: z16.enum(TASK_RELATION_TYPES),
16092
+ reason: z16.string().min(1).optional()
15779
16093
  });
15780
16094
  workGraphDependencyEdgeSchema = workGraphEdgeSchema.extend({
15781
- source: z15.literal("dependency"),
15782
- kind: z15.literal("depends_on")
16095
+ source: z16.literal("dependency"),
16096
+ kind: z16.literal("depends_on")
15783
16097
  });
15784
- workGraphOmissionReasonSchema = z15.enum([
16098
+ workGraphOmissionReasonSchema = z16.enum([
15785
16099
  "budget_exceeded",
15786
16100
  "not_requested",
15787
16101
  "not_available",
15788
16102
  "redacted",
15789
16103
  "truncated"
15790
16104
  ]);
15791
- workGraphContextBudgetSchema = z15.object({
15792
- tokenBudget: z15.number().int().nonnegative(),
15793
- estimatedTokens: z15.number().int().nonnegative(),
15794
- remainingTokens: z15.number().int().nonnegative(),
15795
- truncated: z15.boolean()
15796
- });
15797
- workGraphOmissionSchema = z15.object({
15798
- path: z15.string().min(1),
16105
+ workGraphContextBudgetSchema = z16.object({
16106
+ tokenBudget: z16.number().int().nonnegative(),
16107
+ estimatedTokens: z16.number().int().nonnegative(),
16108
+ remainingTokens: z16.number().int().nonnegative(),
16109
+ truncated: z16.boolean()
16110
+ });
16111
+ workGraphOmissionSchema = z16.object({
16112
+ path: z16.string().min(1),
15799
16113
  reason: workGraphOmissionReasonSchema,
15800
- message: z15.string().min(1),
15801
- estimatedTokens: z15.number().int().nonnegative().optional()
16114
+ message: z16.string().min(1),
16115
+ estimatedTokens: z16.number().int().nonnegative().optional()
15802
16116
  });
15803
- workGraphDirectEdgeSchema = z15.discriminatedUnion("source", [
16117
+ workGraphDirectEdgeSchema = z16.discriminatedUnion("source", [
15804
16118
  workGraphRelationEdgeSchema,
15805
16119
  workGraphDependencyEdgeSchema
15806
16120
  ]);
15807
16121
  workGraphContextPackParamsSchema = paginationParamsSchema.extend({
15808
- rootId: z15.string().min(1),
15809
- tokenBudget: z15.number().int().positive().optional(),
15810
- includeRelations: z15.boolean().optional(),
15811
- includeReadiness: z15.boolean().optional(),
15812
- includeRollup: z15.boolean().optional()
16122
+ rootId: z16.string().min(1),
16123
+ tokenBudget: z16.number().int().positive().optional(),
16124
+ includeRelations: z16.boolean().optional(),
16125
+ includeReadiness: z16.boolean().optional(),
16126
+ includeRollup: z16.boolean().optional()
15813
16127
  });
15814
16128
  workGraphSliceParamsSchema = paginationParamsSchema.extend({
15815
- rootId: z15.string().min(1),
16129
+ rootId: z16.string().min(1),
15816
16130
  direction: workGraphTraversalDirectionSchema.optional(),
15817
- maxDepth: z15.number().int().nonnegative().optional(),
15818
- includeRelations: z15.boolean().optional()
16131
+ maxDepth: z16.number().int().nonnegative().optional(),
16132
+ includeRelations: z16.boolean().optional()
15819
16133
  });
15820
- workGraphSliceSchema = z15.object({
15821
- rootId: z15.string().min(1),
16134
+ workGraphSliceSchema = z16.object({
16135
+ rootId: z16.string().min(1),
15822
16136
  direction: workGraphTraversalDirectionSchema,
15823
- nodes: z15.array(workGraphNodeSchema),
15824
- edges: z15.array(workGraphEdgeSchema),
16137
+ nodes: z16.array(workGraphNodeSchema),
16138
+ edges: z16.array(workGraphEdgeSchema),
15825
16139
  pageInfo: workGraphPageInfoSchema,
15826
- omissions: z15.array(workGraphOmissionSchema).optional()
15827
- });
15828
- workGraphReadinessParamsSchema = z15.object({
15829
- rootId: z15.string().min(1),
15830
- role: z15.string().min(1).optional(),
15831
- includeGateBlockers: z15.boolean().optional()
15832
- });
15833
- workGraphReadinessResultSchema = z15.object({
15834
- rootId: z15.string().min(1),
15835
- role: z15.string().min(1).optional(),
15836
- ready: z15.boolean(),
15837
- warnings: z15.array(z15.string()),
15838
- groups: z15.object({
15839
- ready: z15.array(workGraphReadyFrontierTaskSchema),
15840
- blocked: z15.array(workGraphReadyFrontierTaskSchema),
15841
- blockedBy: z15.array(
15842
- z15.discriminatedUnion("kind", [
15843
- z15.object({
15844
- kind: z15.literal("dependency"),
15845
- blockerId: z15.string().min(1),
15846
- blocks: z15.array(z15.string().min(1))
16140
+ omissions: z16.array(workGraphOmissionSchema).optional()
16141
+ });
16142
+ workGraphReadinessParamsSchema = z16.object({
16143
+ rootId: z16.string().min(1),
16144
+ role: z16.string().min(1).optional(),
16145
+ includeGateBlockers: z16.boolean().optional()
16146
+ });
16147
+ workGraphReadinessResultSchema = z16.object({
16148
+ rootId: z16.string().min(1),
16149
+ role: z16.string().min(1).optional(),
16150
+ ready: z16.boolean(),
16151
+ warnings: z16.array(z16.string()),
16152
+ groups: z16.object({
16153
+ ready: z16.array(workGraphReadyFrontierTaskSchema),
16154
+ blocked: z16.array(workGraphReadyFrontierTaskSchema),
16155
+ blockedBy: z16.array(
16156
+ z16.discriminatedUnion("kind", [
16157
+ z16.object({
16158
+ kind: z16.literal("dependency"),
16159
+ blockerId: z16.string().min(1),
16160
+ blocks: z16.array(z16.string().min(1))
15847
16161
  }),
15848
- z15.object({
15849
- kind: z15.literal("gate"),
16162
+ z16.object({
16163
+ kind: z16.literal("gate"),
15850
16164
  gate: verificationGateSchema,
15851
- blocks: z15.array(z15.string().min(1))
16165
+ blocks: z16.array(z16.string().min(1))
15852
16166
  })
15853
16167
  ])
15854
16168
  )
15855
16169
  })
15856
16170
  });
15857
- workGraphContextPackSchema = z15.object({
15858
- rootId: z15.string().min(1),
15859
- generatedAt: z15.string().min(1),
16171
+ workGraphContextPackSchema = z16.object({
16172
+ rootId: z16.string().min(1),
16173
+ generatedAt: z16.string().min(1),
15860
16174
  budget: workGraphContextBudgetSchema,
15861
16175
  slice: workGraphSliceSchema,
15862
- relationEdges: z15.object({
15863
- rootId: z15.string().min(1),
16176
+ relationEdges: z16.object({
16177
+ rootId: z16.string().min(1),
15864
16178
  direction: workGraphEdgeDirectionSchema,
15865
- edges: z15.array(workGraphDirectEdgeSchema)
16179
+ edges: z16.array(workGraphDirectEdgeSchema)
15866
16180
  }).optional(),
15867
16181
  readiness: workGraphReadinessResultSchema.optional(),
15868
- rollup: z15.lazy(() => tasksRollupResultSchema).optional(),
15869
- omissions: z15.array(workGraphOmissionSchema)
15870
- });
15871
- workGraphScaffoldValidateParamsSchema = z15.object({
15872
- rootId: z15.string().min(1),
15873
- nodes: z15.array(
15874
- z15.object({
15875
- id: z15.string().min(1),
16182
+ rollup: z16.lazy(() => tasksRollupResultSchema).optional(),
16183
+ omissions: z16.array(workGraphOmissionSchema)
16184
+ });
16185
+ workGraphScaffoldValidateParamsSchema = z16.object({
16186
+ rootId: z16.string().min(1),
16187
+ nodes: z16.array(
16188
+ z16.object({
16189
+ id: z16.string().min(1),
15876
16190
  type: taskTypeSchema,
15877
- parentId: z15.string().min(1).nullable().optional()
16191
+ parentId: z16.string().min(1).nullable().optional()
15878
16192
  })
15879
16193
  ),
15880
- edges: z15.array(workGraphDirectEdgeSchema).optional(),
15881
- dryRun: z15.boolean().optional()
15882
- });
15883
- workGraphScaffoldValidationIssueSchema = z15.object({
15884
- code: z15.string().min(1),
15885
- message: z15.string().min(1),
15886
- taskId: z15.string().min(1).optional(),
15887
- severity: z15.enum(["error", "warning"])
15888
- });
15889
- workGraphScaffoldValidateResultSchema = z15.object({
15890
- rootId: z15.string().min(1),
15891
- valid: z15.boolean(),
15892
- dryRun: z15.boolean(),
15893
- issues: z15.array(workGraphScaffoldValidationIssueSchema),
15894
- hierarchy: z15.object({
15895
- valid: z15.boolean(),
15896
- violations: z15.array(
15897
- z15.object({
15898
- code: z15.literal(E_WORKGRAPH_PARENT_TYPE_MATRIX),
15899
- taskId: z15.string().min(1),
16194
+ edges: z16.array(workGraphDirectEdgeSchema).optional(),
16195
+ dryRun: z16.boolean().optional()
16196
+ });
16197
+ workGraphScaffoldValidationIssueSchema = z16.object({
16198
+ code: z16.string().min(1),
16199
+ message: z16.string().min(1),
16200
+ taskId: z16.string().min(1).optional(),
16201
+ severity: z16.enum(["error", "warning"])
16202
+ });
16203
+ workGraphScaffoldValidateResultSchema = z16.object({
16204
+ rootId: z16.string().min(1),
16205
+ valid: z16.boolean(),
16206
+ dryRun: z16.boolean(),
16207
+ issues: z16.array(workGraphScaffoldValidationIssueSchema),
16208
+ hierarchy: z16.object({
16209
+ valid: z16.boolean(),
16210
+ violations: z16.array(
16211
+ z16.object({
16212
+ code: z16.literal(E_WORKGRAPH_PARENT_TYPE_MATRIX),
16213
+ taskId: z16.string().min(1),
15900
16214
  taskType: taskTypeSchema,
15901
- parentId: z15.string().min(1).nullable(),
16215
+ parentId: z16.string().min(1).nullable(),
15902
16216
  parentType: taskTypeSchema.optional(),
15903
- message: z15.string().min(1)
16217
+ message: z16.string().min(1)
15904
16218
  })
15905
16219
  )
15906
16220
  })
15907
16221
  });
15908
16222
  workGraphScaffoldApplyParamsSchema = workGraphScaffoldValidateParamsSchema.extend({
15909
- apply: z15.boolean().optional()
16223
+ apply: z16.boolean().optional()
15910
16224
  });
15911
16225
  workGraphScaffoldApplyResultSchema = workGraphScaffoldValidateResultSchema.extend({
15912
- applied: z15.boolean(),
15913
- nodesChanged: z15.number().int().nonnegative(),
15914
- edgesChanged: z15.number().int().nonnegative()
15915
- });
15916
- workGraphPlanningDocParamsSchema = z15.object({
15917
- rootId: z15.string().min(1),
15918
- audience: z15.enum(["agent", "maintainer"]),
15919
- tokenBudget: z15.number().int().positive().optional(),
15920
- includeRelations: z15.boolean().optional(),
15921
- includeReadiness: z15.boolean().optional(),
15922
- includeRollup: z15.boolean().optional()
15923
- });
15924
- workGraphPlanningDocSchema = z15.object({
15925
- rootId: z15.string().min(1),
15926
- generatedAt: z15.string().min(1),
15927
- audience: z15.enum(["agent", "maintainer"]),
15928
- title: z15.string().min(1),
15929
- content: z15.string(),
15930
- sections: z15.array(z15.string().min(1)),
15931
- estimatedTokens: z15.number().int().nonnegative(),
15932
- budget: z15.object({
15933
- tokenBudget: z15.number().int().positive(),
15934
- truncated: z15.boolean()
16226
+ applied: z16.boolean(),
16227
+ nodesChanged: z16.number().int().nonnegative(),
16228
+ edgesChanged: z16.number().int().nonnegative()
16229
+ });
16230
+ workGraphPlanningDocParamsSchema = z16.object({
16231
+ rootId: z16.string().min(1),
16232
+ audience: z16.enum(["agent", "maintainer"]),
16233
+ tokenBudget: z16.number().int().positive().optional(),
16234
+ includeRelations: z16.boolean().optional(),
16235
+ includeReadiness: z16.boolean().optional(),
16236
+ includeRollup: z16.boolean().optional()
16237
+ });
16238
+ workGraphPlanningDocSchema = z16.object({
16239
+ rootId: z16.string().min(1),
16240
+ generatedAt: z16.string().min(1),
16241
+ audience: z16.enum(["agent", "maintainer"]),
16242
+ title: z16.string().min(1),
16243
+ content: z16.string(),
16244
+ sections: z16.array(z16.string().min(1)),
16245
+ estimatedTokens: z16.number().int().nonnegative(),
16246
+ budget: z16.object({
16247
+ tokenBudget: z16.number().int().positive(),
16248
+ truncated: z16.boolean()
15935
16249
  }).optional()
15936
16250
  });
15937
16251
  tasksTraverseParamsSchema = paginationParamsSchema.extend({
15938
- rootId: z15.string().min(1),
16252
+ rootId: z16.string().min(1),
15939
16253
  direction: workGraphTraversalDirectionSchema,
15940
- maxDepth: z15.number().int().nonnegative().optional(),
15941
- includeRelations: z15.boolean().optional()
16254
+ maxDepth: z16.number().int().nonnegative().optional(),
16255
+ includeRelations: z16.boolean().optional()
15942
16256
  });
15943
- tasksTraverseResultSchema = z15.object({
15944
- rootId: z15.string().min(1),
16257
+ tasksTraverseResultSchema = z16.object({
16258
+ rootId: z16.string().min(1),
15945
16259
  direction: workGraphTraversalDirectionSchema,
15946
- nodes: z15.array(workGraphNodeSchema),
15947
- edges: z15.array(workGraphEdgeSchema),
16260
+ nodes: z16.array(workGraphNodeSchema),
16261
+ edges: z16.array(workGraphEdgeSchema),
15948
16262
  pageInfo: workGraphPageInfoSchema
15949
16263
  });
15950
16264
  tasksTreeParamsSchema = paginationParamsSchema.extend({
15951
- rootId: z15.string().min(1),
15952
- maxDepth: z15.number().int().nonnegative().optional()
16265
+ rootId: z16.string().min(1),
16266
+ maxDepth: z16.number().int().nonnegative().optional()
15953
16267
  });
15954
- tasksTreeResultSchema = z15.object({
15955
- rootId: z15.string().min(1),
15956
- nodes: z15.array(workGraphNodeSchema.extend({ depth: z15.number().int().positive() })),
15957
- edges: z15.array(workGraphHierarchyEdgeSchema),
16268
+ tasksTreeResultSchema = z16.object({
16269
+ rootId: z16.string().min(1),
16270
+ nodes: z16.array(workGraphNodeSchema.extend({ depth: z16.number().int().positive() })),
16271
+ edges: z16.array(workGraphHierarchyEdgeSchema),
15958
16272
  pageInfo: workGraphPageInfoSchema
15959
16273
  });
15960
- tasksRollupParamsSchema = z15.object({
15961
- rootId: z15.string().min(1),
16274
+ tasksRollupParamsSchema = z16.object({
16275
+ rootId: z16.string().min(1),
15962
16276
  expectedDirectRollup: workGraphRollupCountsSchema.optional()
15963
16277
  });
15964
- tasksRollupResultSchema = z15.object({
15965
- rootId: z15.string().min(1),
16278
+ tasksRollupResultSchema = z16.object({
16279
+ rootId: z16.string().min(1),
15966
16280
  direct: workGraphRollupCountsSchema,
15967
16281
  subtree: workGraphRollupCountsSchema,
15968
- percentDenominator: z15.object({
15969
- basis: z15.literal("subtree-total"),
15970
- total: z15.number().int().nonnegative(),
15971
- description: z15.string().min(1)
16282
+ percentDenominator: z16.object({
16283
+ basis: z16.literal("subtree-total"),
16284
+ total: z16.number().int().nonnegative(),
16285
+ description: z16.string().min(1)
15972
16286
  }),
15973
16287
  percentages: workGraphSubtreePercentagesSchema,
15974
- staleProjection: z15.boolean(),
15975
- projectionMismatches: z15.array(workGraphProjectionMismatchSchema)
15976
- });
15977
- tasksFrontierParamsSchema = z15.object({
15978
- rootId: z15.string().min(1),
15979
- role: z15.string().min(1).optional()
15980
- });
15981
- tasksFrontierResultSchema = z15.object({
15982
- rootId: z15.string().min(1),
15983
- role: z15.string().min(1).optional(),
15984
- groups: z15.object({
15985
- ready: z15.array(workGraphReadyFrontierTaskSchema),
15986
- blocked: z15.array(workGraphReadyFrontierTaskSchema),
15987
- blockedBy: z15.array(
15988
- z15.discriminatedUnion("kind", [
15989
- z15.object({
15990
- kind: z15.literal("dependency"),
15991
- blockerId: z15.string().min(1),
15992
- blocks: z15.array(z15.string().min(1))
16288
+ staleProjection: z16.boolean(),
16289
+ projectionMismatches: z16.array(workGraphProjectionMismatchSchema)
16290
+ });
16291
+ tasksFrontierParamsSchema = z16.object({
16292
+ rootId: z16.string().min(1),
16293
+ role: z16.string().min(1).optional()
16294
+ });
16295
+ tasksFrontierResultSchema = z16.object({
16296
+ rootId: z16.string().min(1),
16297
+ role: z16.string().min(1).optional(),
16298
+ groups: z16.object({
16299
+ ready: z16.array(workGraphReadyFrontierTaskSchema),
16300
+ blocked: z16.array(workGraphReadyFrontierTaskSchema),
16301
+ blockedBy: z16.array(
16302
+ z16.discriminatedUnion("kind", [
16303
+ z16.object({
16304
+ kind: z16.literal("dependency"),
16305
+ blockerId: z16.string().min(1),
16306
+ blocks: z16.array(z16.string().min(1))
15993
16307
  }),
15994
- z15.object({
15995
- kind: z15.literal("gate"),
16308
+ z16.object({
16309
+ kind: z16.literal("gate"),
15996
16310
  gate: verificationGateSchema,
15997
- blocks: z15.array(z15.string().min(1))
16311
+ blocks: z16.array(z16.string().min(1))
15998
16312
  })
15999
16313
  ])
16000
16314
  )
16001
16315
  })
16002
16316
  });
16003
16317
  tasksWorkGraphAuditParamsSchema = paginationParamsSchema.extend({
16004
- rootId: z15.string().min(1),
16005
- maxDepth: z15.number().int().nonnegative().optional(),
16006
- includeRelations: z15.boolean().optional()
16007
- });
16008
- tasksWorkGraphAuditResultSchema = z15.object({
16009
- rootId: z15.string().min(1),
16010
- hierarchy: z15.object({
16011
- valid: z15.boolean(),
16012
- violations: z15.array(
16013
- z15.object({
16014
- code: z15.literal(E_WORKGRAPH_PARENT_TYPE_MATRIX),
16015
- taskId: z15.string().min(1),
16318
+ rootId: z16.string().min(1),
16319
+ maxDepth: z16.number().int().nonnegative().optional(),
16320
+ includeRelations: z16.boolean().optional()
16321
+ });
16322
+ tasksWorkGraphAuditResultSchema = z16.object({
16323
+ rootId: z16.string().min(1),
16324
+ hierarchy: z16.object({
16325
+ valid: z16.boolean(),
16326
+ violations: z16.array(
16327
+ z16.object({
16328
+ code: z16.literal(E_WORKGRAPH_PARENT_TYPE_MATRIX),
16329
+ taskId: z16.string().min(1),
16016
16330
  taskType: taskTypeSchema,
16017
- parentId: z15.string().min(1).nullable(),
16331
+ parentId: z16.string().min(1).nullable(),
16018
16332
  parentType: taskTypeSchema.optional(),
16019
- message: z15.string().min(1)
16333
+ message: z16.string().min(1)
16020
16334
  })
16021
16335
  )
16022
16336
  }),
16023
16337
  traversal: tasksTraverseResultSchema,
16024
16338
  frontier: tasksFrontierResultSchema,
16025
16339
  rollup: tasksRollupResultSchema,
16026
- relationEdges: z15.object({
16027
- rootId: z15.string().min(1),
16340
+ relationEdges: z16.object({
16341
+ rootId: z16.string().min(1),
16028
16342
  direction: workGraphEdgeDirectionSchema,
16029
- edges: z15.array(
16030
- z15.discriminatedUnion("source", [
16343
+ edges: z16.array(
16344
+ z16.discriminatedUnion("source", [
16031
16345
  workGraphRelationEdgeSchema,
16032
16346
  workGraphDependencyEdgeSchema
16033
16347
  ])
@@ -16047,49 +16361,49 @@ var init_operation_envelope_validation = __esm({
16047
16361
  });
16048
16362
 
16049
16363
  // packages/contracts/src/operations/docs.ts
16050
- import { z as z16 } from "zod";
16364
+ import { z as z17 } from "zod";
16051
16365
  var DOCS_PROJECTION_PROPOSAL_SCHEMA, DOCS_PROJECTION_RECEIPT_SCHEMA;
16052
16366
  var init_docs = __esm({
16053
16367
  "packages/contracts/src/operations/docs.ts"() {
16054
16368
  "use strict";
16055
16369
  init_docs_taxonomy();
16056
16370
  init_docs_lifecycle();
16057
- DOCS_PROJECTION_PROPOSAL_SCHEMA = z16.object({
16058
- version: z16.literal(1),
16059
- operation: z16.literal("docs.projection"),
16060
- identity: z16.object({
16061
- projectId: z16.string().min(1),
16062
- projectRoot: z16.string().min(1),
16063
- actor: z16.string().min(1),
16064
- operation: z16.literal("docs.projection"),
16065
- idempotencyKey: z16.string().min(1)
16371
+ DOCS_PROJECTION_PROPOSAL_SCHEMA = z17.object({
16372
+ version: z17.literal(1),
16373
+ operation: z17.literal("docs.projection"),
16374
+ identity: z17.object({
16375
+ projectId: z17.string().min(1),
16376
+ projectRoot: z17.string().min(1),
16377
+ actor: z17.string().min(1),
16378
+ operation: z17.literal("docs.projection"),
16379
+ idempotencyKey: z17.string().min(1)
16066
16380
  }).strict(),
16067
- source: z16.object({
16068
- attachmentId: z16.string().min(1),
16069
- sha256: z16.string().regex(/^[a-f0-9]{64}$/),
16070
- ownerId: z16.string().min(1),
16071
- ownerType: z16.enum(["task", "session", "observation", "decision", "learning", "pattern"]),
16072
- label: z16.string().min(1)
16381
+ source: z17.object({
16382
+ attachmentId: z17.string().min(1),
16383
+ sha256: z17.string().regex(/^[a-f0-9]{64}$/),
16384
+ ownerId: z17.string().min(1),
16385
+ ownerType: z17.enum(["task", "session", "observation", "decision", "learning", "pattern"]),
16386
+ label: z17.string().min(1)
16073
16387
  }).strict(),
16074
- observation: z16.object({
16075
- kind: z16.literal("doc-attachment"),
16076
- attachmentId: z16.string().min(1),
16077
- ownerId: z16.string().min(1),
16078
- addedAt: z16.string().min(1),
16079
- slug: z16.string().optional(),
16080
- type: z16.string().optional()
16388
+ observation: z17.object({
16389
+ kind: z17.literal("doc-attachment"),
16390
+ attachmentId: z17.string().min(1),
16391
+ ownerId: z17.string().min(1),
16392
+ addedAt: z17.string().min(1),
16393
+ slug: z17.string().optional(),
16394
+ type: z17.string().optional()
16081
16395
  }).strict()
16082
16396
  }).strict();
16083
- DOCS_PROJECTION_RECEIPT_SCHEMA = z16.object({
16084
- version: z16.literal(1),
16085
- sourceHash: z16.string().regex(/^[a-f0-9]{64}$/),
16086
- graph: z16.enum(["completed", "disabled"]),
16397
+ DOCS_PROJECTION_RECEIPT_SCHEMA = z17.object({
16398
+ version: z17.literal(1),
16399
+ sourceHash: z17.string().regex(/^[a-f0-9]{64}$/),
16400
+ graph: z17.enum(["completed", "disabled"]),
16087
16401
  /** Legacy receipts (before T13985): the "Doc attached" observation the projection wrote. */
16088
- observationId: z16.string().min(1).optional(),
16402
+ observationId: z17.string().min(1).optional(),
16089
16403
  /** T13985 (D11180): the canonical `llmtxt --documents--> owner` edge was written. */
16090
- documents: z16.literal(true).optional(),
16091
- verifiedAt: z16.string().min(1),
16092
- actor: z16.string().min(1)
16404
+ documents: z17.literal(true).optional(),
16405
+ verifiedAt: z17.string().min(1),
16406
+ actor: z17.string().min(1)
16093
16407
  }).strict().refine((receipt) => receipt.observationId !== void 0 || receipt.documents === true, {
16094
16408
  message: "A projection receipt records its documents edge or, for legacy jobs, its observation"
16095
16409
  });
@@ -16097,22 +16411,22 @@ var init_docs = __esm({
16097
16411
  });
16098
16412
 
16099
16413
  // packages/contracts/src/operations/ensures-schema-registry.ts
16100
- import { z as z17 } from "zod";
16414
+ import { z as z18 } from "zod";
16101
16415
  var taskTreeEntrySchema, taskTreeSchema, evidenceSchema, passthroughSchema, LEGACY_PASSTHROUGH_SCHEMA_NAMES, ENSURES_SCHEMA_REGISTRY;
16102
16416
  var init_ensures_schema_registry = __esm({
16103
16417
  "packages/contracts/src/operations/ensures-schema-registry.ts"() {
16104
16418
  "use strict";
16105
- taskTreeEntrySchema = z17.object({
16106
- title: z17.string({ message: "title must be a non-empty string" }).refine((s) => s.trim().length > 0, { message: "title must be a non-empty string" }),
16107
- acceptance: z17.array(z17.unknown(), { message: "must have a non-empty acceptance array" }).min(1, { message: "must have a non-empty acceptance array" }).refine((arr) => arr.some((s) => typeof s === "string" && s.trim().length > 0), {
16419
+ taskTreeEntrySchema = z18.object({
16420
+ title: z18.string({ message: "title must be a non-empty string" }).refine((s) => s.trim().length > 0, { message: "title must be a non-empty string" }),
16421
+ acceptance: z18.array(z18.unknown(), { message: "must have a non-empty acceptance array" }).min(1, { message: "must have a non-empty acceptance array" }).refine((arr) => arr.some((s) => typeof s === "string" && s.trim().length > 0), {
16108
16422
  message: "acceptance array contains no non-empty strings"
16109
16423
  }),
16110
- id: z17.string().optional(),
16111
- parentId: z17.string().optional(),
16112
- depends: z17.array(z17.string()).optional()
16424
+ id: z18.string().optional(),
16425
+ parentId: z18.string().optional(),
16426
+ depends: z18.array(z18.string()).optional()
16113
16427
  });
16114
- taskTreeSchema = z17.array(taskTreeEntrySchema, { message: "task_tree must be a non-empty array" }).min(1, { message: "task_tree is an empty array \u2014 decomposition produced no tasks" });
16115
- evidenceSchema = z17.unknown().superRefine((value, ctx) => {
16428
+ taskTreeSchema = z18.array(taskTreeEntrySchema, { message: "task_tree must be a non-empty array" }).min(1, { message: "task_tree is an empty array \u2014 decomposition produced no tasks" });
16429
+ evidenceSchema = z18.unknown().superRefine((value, ctx) => {
16116
16430
  if (value === null || value === void 0) {
16117
16431
  ctx.addIssue({
16118
16432
  code: "custom",
@@ -16146,7 +16460,7 @@ var init_ensures_schema_registry = __esm({
16146
16460
  message: `evidence must be a string, array, or object (got ${typeof value})`
16147
16461
  });
16148
16462
  });
16149
- passthroughSchema = z17.unknown();
16463
+ passthroughSchema = z18.unknown();
16150
16464
  LEGACY_PASSTHROUGH_SCHEMA_NAMES = [
16151
16465
  // release.cantbook
16152
16466
  "version_bump_report",
@@ -16427,41 +16741,41 @@ var init_process_probe = __esm({
16427
16741
  });
16428
16742
 
16429
16743
  // packages/contracts/src/release/evidence-atoms.ts
16430
- import { z as z18 } from "zod";
16744
+ import { z as z19 } from "zod";
16431
16745
  var parsedPrEvidenceAtomSchema, prEvidenceStateModifierSchema, ghPrViewSchema, PR_REQUIRED_WORKFLOWS;
16432
16746
  var init_evidence_atoms = __esm({
16433
16747
  "packages/contracts/src/release/evidence-atoms.ts"() {
16434
16748
  "use strict";
16435
- parsedPrEvidenceAtomSchema = z18.object({
16436
- kind: z18.literal("pr"),
16437
- prNumber: z18.number().int().positive()
16438
- });
16439
- prEvidenceStateModifierSchema = z18.object({
16440
- kind: z18.literal("state"),
16441
- value: z18.literal("MERGED")
16442
- });
16443
- ghPrViewSchema = z18.object({
16444
- state: z18.enum(["OPEN", "CLOSED", "MERGED"]),
16445
- mergedAt: z18.string().nullable(),
16446
- headRefOid: z18.string().optional(),
16447
- mergeCommit: z18.object({ oid: z18.string() }).nullable().optional(),
16448
- title: z18.string().optional(),
16449
- body: z18.string().optional(),
16450
- headRefName: z18.string().optional(),
16451
- files: z18.array(z18.object({ path: z18.string() })).optional(),
16452
- changedFiles: z18.number().int().nonnegative().optional(),
16453
- mergeable: z18.string().optional(),
16454
- statusCheckRollup: z18.array(
16455
- z18.object({
16456
- __typename: z18.string().optional(),
16457
- name: z18.string().optional(),
16458
- workflowName: z18.string().optional(),
16459
- conclusion: z18.string().nullable().optional(),
16460
- status: z18.string().optional(),
16749
+ parsedPrEvidenceAtomSchema = z19.object({
16750
+ kind: z19.literal("pr"),
16751
+ prNumber: z19.number().int().positive()
16752
+ });
16753
+ prEvidenceStateModifierSchema = z19.object({
16754
+ kind: z19.literal("state"),
16755
+ value: z19.literal("MERGED")
16756
+ });
16757
+ ghPrViewSchema = z19.object({
16758
+ state: z19.enum(["OPEN", "CLOSED", "MERGED"]),
16759
+ mergedAt: z19.string().nullable(),
16760
+ headRefOid: z19.string().optional(),
16761
+ mergeCommit: z19.object({ oid: z19.string() }).nullable().optional(),
16762
+ title: z19.string().optional(),
16763
+ body: z19.string().optional(),
16764
+ headRefName: z19.string().optional(),
16765
+ files: z19.array(z19.object({ path: z19.string() })).optional(),
16766
+ changedFiles: z19.number().int().nonnegative().optional(),
16767
+ mergeable: z19.string().optional(),
16768
+ statusCheckRollup: z19.array(
16769
+ z19.object({
16770
+ __typename: z19.string().optional(),
16771
+ name: z19.string().optional(),
16772
+ workflowName: z19.string().optional(),
16773
+ conclusion: z19.string().nullable().optional(),
16774
+ status: z19.string().optional(),
16461
16775
  /** ISO start time of a CheckRun; orders re-runs of one check (T13506). */
16462
- startedAt: z18.string().nullable().optional(),
16776
+ startedAt: z19.string().nullable().optional(),
16463
16777
  /** ISO completion time of a CheckRun; orders re-runs of one check (T13506). */
16464
- completedAt: z18.string().nullable().optional()
16778
+ completedAt: z19.string().nullable().optional()
16465
16779
  }).passthrough()
16466
16780
  ).optional().default([])
16467
16781
  }).passthrough();
@@ -16470,7 +16784,7 @@ var init_evidence_atoms = __esm({
16470
16784
  });
16471
16785
 
16472
16786
  // packages/contracts/src/release/plan.ts
16473
- import { z as z19 } from "zod";
16787
+ import { z as z20 } from "zod";
16474
16788
  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;
16475
16789
  var init_plan = __esm({
16476
16790
  "packages/contracts/src/release/plan.ts"() {
@@ -16518,20 +16832,20 @@ var init_plan = __esm({
16518
16832
  "language-default",
16519
16833
  "legacy-alias"
16520
16834
  ];
16521
- ReleaseChannelSchema = z19.enum(RELEASE_CHANNEL);
16522
- ReleaseSchemeSchema = z19.enum(RELEASE_SCHEME);
16523
- ReleaseKindSchema = z19.enum(RELEASE_KIND);
16524
- ReleaseStatusSchema = z19.enum(RELEASE_STATUS);
16525
- GateStatusSchema = z19.enum(GATE_STATUS);
16526
- GateNameSchema = z19.enum(GATE_NAME);
16527
- PlatformTupleSchema = z19.enum(PLATFORM_TUPLE);
16528
- PublisherSchema = z19.enum(PUBLISHER);
16529
- TaskKindSchema = z19.enum(TASK_KIND);
16530
- ImpactSchema = z19.enum(IMPACT);
16531
- ResolvedSourceSchema = z19.enum(RESOLVED_SOURCE);
16532
- Iso8601 = z19.iso.datetime({ offset: true });
16533
- NonEmptyString = z19.string().min(1);
16534
- ReleasePlanTaskSchema = z19.object({
16835
+ ReleaseChannelSchema = z20.enum(RELEASE_CHANNEL);
16836
+ ReleaseSchemeSchema = z20.enum(RELEASE_SCHEME);
16837
+ ReleaseKindSchema = z20.enum(RELEASE_KIND);
16838
+ ReleaseStatusSchema = z20.enum(RELEASE_STATUS);
16839
+ GateStatusSchema = z20.enum(GATE_STATUS);
16840
+ GateNameSchema = z20.enum(GATE_NAME);
16841
+ PlatformTupleSchema = z20.enum(PLATFORM_TUPLE);
16842
+ PublisherSchema = z20.enum(PUBLISHER);
16843
+ TaskKindSchema = z20.enum(TASK_KIND);
16844
+ ImpactSchema = z20.enum(IMPACT);
16845
+ ResolvedSourceSchema = z20.enum(RESOLVED_SOURCE);
16846
+ Iso8601 = z20.iso.datetime({ offset: true });
16847
+ NonEmptyString = z20.string().min(1);
16848
+ ReleasePlanTaskSchema = z20.object({
16535
16849
  /** Task ID (e.g. "T10001"). Format intentionally loose so historical IDs validate. */
16536
16850
  id: NonEmptyString,
16537
16851
  /** Conventional-commit-aligned task classification. */
@@ -16539,20 +16853,20 @@ var init_plan = __esm({
16539
16853
  /** SemVer impact classification. */
16540
16854
  impact: ImpactSchema,
16541
16855
  /** Human-readable changelog line for this task. */
16542
- userFacingSummary: z19.string(),
16856
+ userFacingSummary: z20.string(),
16543
16857
  /**
16544
16858
  * ADR-051 evidence atoms attesting the task's gate results. Format is
16545
16859
  * `kind:value` (e.g. `commit:abc123`, `test-run:vitest.json`). The contract
16546
16860
  * accepts empty arrays so legacy plans validate; `cleo release plan`
16547
16861
  * enforces non-empty via R-301.
16548
16862
  */
16549
- evidenceAtoms: z19.array(NonEmptyString),
16863
+ evidenceAtoms: z20.array(NonEmptyString),
16550
16864
  /** IVTR phase at plan time — informational only per R-316. */
16551
- ivtrPhaseAtPlan: z19.string().optional(),
16865
+ ivtrPhaseAtPlan: z20.string().optional(),
16552
16866
  /** Epic this task rolls up to, locked at plan time per R-303. */
16553
16867
  epicAncestor: NonEmptyString
16554
16868
  });
16555
- ReleaseGateSchema = z19.object({
16869
+ ReleaseGateSchema = z20.object({
16556
16870
  /** Canonical gate name. */
16557
16871
  name: GateNameSchema,
16558
16872
  /** ADR-051 atom string identifying the resolved tool (e.g. `tool:test`). */
@@ -16562,11 +16876,11 @@ var init_plan = __esm({
16562
16876
  /** ISO-8601 timestamp the gate was last verified. */
16563
16877
  lastVerifiedAt: Iso8601,
16564
16878
  /** Resolved shell command (e.g. `pnpm run test`). Optional for unresolved gates. */
16565
- resolvedCommand: z19.string().optional(),
16879
+ resolvedCommand: z20.string().optional(),
16566
16880
  /** Provenance of the resolved command. Optional for unresolved gates. */
16567
16881
  resolvedSource: ResolvedSourceSchema.optional()
16568
16882
  });
16569
- ReleasePlatformMatrixEntrySchema = z19.object({
16883
+ ReleasePlatformMatrixEntrySchema = z20.object({
16570
16884
  /** Target platform tuple. */
16571
16885
  platform: PlatformTupleSchema,
16572
16886
  /** Distribution backend. */
@@ -16574,47 +16888,47 @@ var init_plan = __esm({
16574
16888
  /** Package identifier on the target backend (e.g. `@cleocode/cleo`). */
16575
16889
  package: NonEmptyString,
16576
16890
  /** Whether to run the GHA smoke job for this matrix entry. */
16577
- smoke: z19.boolean().default(true).optional()
16891
+ smoke: z20.boolean().default(true).optional()
16578
16892
  });
16579
- ReleasePreflightSummarySchema = z19.object({
16893
+ ReleasePreflightSummarySchema = z20.object({
16580
16894
  /** True if esbuild externals are out of sync with package.json. */
16581
- esbuildExternalsDrift: z19.boolean(),
16895
+ esbuildExternalsDrift: z20.boolean(),
16582
16896
  /** True if `pnpm-lock.yaml` diverges from the workspace manifest. */
16583
- lockfileDrift: z19.boolean(),
16897
+ lockfileDrift: z20.boolean(),
16584
16898
  /** True if all epic children are in terminal lifecycle states. */
16585
- epicCompletenessClean: z19.boolean(),
16899
+ epicCompletenessClean: z20.boolean(),
16586
16900
  /** True if no task appears in multiple in-flight release plans. */
16587
- doubleListingClean: z19.boolean(),
16901
+ doubleListingClean: z20.boolean(),
16588
16902
  /** Non-fatal preflight warnings (e.g. unresolved tools per R-024). */
16589
- preflightWarnings: z19.array(z19.string()).default([]).optional()
16903
+ preflightWarnings: z20.array(z20.string()).default([]).optional()
16590
16904
  });
16591
- ReleasePlanChangelogSchema = z19.object({
16905
+ ReleasePlanChangelogSchema = z20.object({
16592
16906
  /** `kind=feat` tasks. */
16593
- features: z19.array(NonEmptyString).default([]),
16907
+ features: z20.array(NonEmptyString).default([]),
16594
16908
  /** `kind=fix` or `kind=hotfix` tasks. */
16595
- fixes: z19.array(NonEmptyString).default([]),
16909
+ fixes: z20.array(NonEmptyString).default([]),
16596
16910
  /** `kind=chore`, `docs`, `refactor`, `test`, `perf` tasks. */
16597
- chores: z19.array(NonEmptyString).default([]),
16911
+ chores: z20.array(NonEmptyString).default([]),
16598
16912
  /** `kind=breaking` or `kind=revert` tasks. */
16599
- breaking: z19.array(NonEmptyString).default([])
16913
+ breaking: z20.array(NonEmptyString).default([])
16600
16914
  });
16601
- ReleasePlanMetaSchema = z19.object({
16915
+ ReleasePlanMetaSchema = z20.object({
16602
16916
  /** True if this is the project's first ever release. */
16603
- firstEverRelease: z19.boolean().optional(),
16917
+ firstEverRelease: z20.boolean().optional(),
16604
16918
  /** Canonical tool names that could not be resolved at plan time. */
16605
- unresolvedTools: z19.array(z19.string()).optional(),
16919
+ unresolvedTools: z20.array(z20.string()).optional(),
16606
16920
  /** Project archetype detected at plan time. */
16607
- archetype: z19.string().optional()
16608
- }).catchall(z19.unknown());
16609
- ReleasePlanSchema = z19.object({
16921
+ archetype: z20.string().optional()
16922
+ }).catchall(z20.unknown());
16923
+ ReleasePlanSchema = z20.object({
16610
16924
  /** Schema URL for this plan version. */
16611
- $schema: z19.string().optional(),
16925
+ $schema: z20.string().optional(),
16612
16926
  /** Requested version string (e.g. "v2026.6.0"). Includes the leading `v`. */
16613
16927
  version: NonEmptyString,
16614
16928
  /** Resolved version string after suffix application (e.g. "v2026.6.0.2"). */
16615
16929
  resolvedVersion: NonEmptyString,
16616
16930
  /** True if a `calver-suffix` was applied to disambiguate a same-day hotfix. */
16617
- suffixApplied: z19.boolean(),
16931
+ suffixApplied: z20.boolean(),
16618
16932
  /** Versioning scheme governing `version` / `resolvedVersion`. */
16619
16933
  scheme: ReleaseSchemeSchema,
16620
16934
  /** npm dist-tag channel for this release. */
@@ -16628,7 +16942,7 @@ var init_plan = __esm({
16628
16942
  /** Release-kind classification. */
16629
16943
  releaseKind: ReleaseKindSchema,
16630
16944
  /** Explicit hooks-v1 stable promotion; ordinary and hotfix releases are exempt. */
16631
- hooksV1Promotion: z19.boolean().optional(),
16945
+ hooksV1Promotion: z20.boolean().optional(),
16632
16946
  /** Audited reason for shipping a source change that opens the hooks-v1 gate without the promotion (T13555). */
16633
16947
  hooksV1Waiver: NonEmptyString.optional(),
16634
16948
  /** ISO-8601 timestamp the plan was written. */
@@ -16639,27 +16953,27 @@ var init_plan = __esm({
16639
16953
  * Version of the previous release on the same channel. MUST be `null` only
16640
16954
  * for first-ever releases (R-300, enforced at the verb layer).
16641
16955
  */
16642
- previousVersion: z19.string().nullable(),
16956
+ previousVersion: z20.string().nullable(),
16643
16957
  /** Git tag of the previous release (typically `previousVersion` prefixed). */
16644
- previousTag: z19.string().nullable(),
16958
+ previousTag: z20.string().nullable(),
16645
16959
  /** ISO-8601 timestamp the previous release was published. */
16646
16960
  previousShippedAt: Iso8601.nullable(),
16647
16961
  /** Tasks rolled into this release. */
16648
- tasks: z19.array(ReleasePlanTaskSchema),
16962
+ tasks: z20.array(ReleasePlanTaskSchema),
16649
16963
  /** Bucketed changelog. */
16650
16964
  changelog: ReleasePlanChangelogSchema,
16651
16965
  /** Per-gate verification status. */
16652
- gates: z19.array(ReleaseGateSchema),
16966
+ gates: z20.array(ReleaseGateSchema),
16653
16967
  /** Platform / publisher matrix. */
16654
- platformMatrix: z19.array(ReleasePlatformMatrixEntrySchema),
16968
+ platformMatrix: z20.array(ReleasePlatformMatrixEntrySchema),
16655
16969
  /** Preflight summary from `cleo release plan`. */
16656
16970
  preflightSummary: ReleasePreflightSummarySchema,
16657
16971
  /** URL of the GHA workflow run (populated by `release-prepare.yml`). */
16658
- workflowRunUrl: z19.string().nullable(),
16972
+ workflowRunUrl: z20.string().nullable(),
16659
16973
  /** URL of the bump PR (populated by `cleo release open`). */
16660
- prUrl: z19.string().nullable(),
16974
+ prUrl: z20.string().nullable(),
16661
16975
  /** Merge commit SHA on `main` (populated by `release-publish.yml`). */
16662
- mergeCommitSha: z19.string().nullable(),
16976
+ mergeCommitSha: z20.string().nullable(),
16663
16977
  /** Current FSM state per R-302. */
16664
16978
  status: ReleaseStatusSchema,
16665
16979
  /** Informational / forward-compat metadata. */
@@ -16743,52 +17057,52 @@ var init_session2 = __esm({
16743
17057
  });
16744
17058
 
16745
17059
  // packages/contracts/src/session-journal.ts
16746
- import { z as z20 } from "zod";
17060
+ import { z as z21 } from "zod";
16747
17061
  var SESSION_JOURNAL_SCHEMA_VERSION, sessionJournalDoctorSummarySchema, sessionJournalDebriefSummarySchema, sessionJournalEntrySchema;
16748
17062
  var init_session_journal = __esm({
16749
17063
  "packages/contracts/src/session-journal.ts"() {
16750
17064
  "use strict";
16751
17065
  SESSION_JOURNAL_SCHEMA_VERSION = "1.0";
16752
- sessionJournalDoctorSummarySchema = z20.object({
17066
+ sessionJournalDoctorSummarySchema = z21.object({
16753
17067
  /** `true` when zero noise patterns were detected. */
16754
- isClean: z20.boolean(),
17068
+ isClean: z21.boolean(),
16755
17069
  /** Total number of noise findings across all patterns. */
16756
- findingsCount: z20.number().int().nonnegative(),
17070
+ findingsCount: z21.number().int().nonnegative(),
16757
17071
  /** Pattern names that were detected (empty when isClean). */
16758
- patterns: z20.array(z20.string()),
17072
+ patterns: z21.array(z21.string()),
16759
17073
  /** Total brain entries scanned. `0` = empty or unavailable. */
16760
- totalScanned: z20.number().int().nonnegative()
17074
+ totalScanned: z21.number().int().nonnegative()
16761
17075
  });
16762
- sessionJournalDebriefSummarySchema = z20.object({
17076
+ sessionJournalDebriefSummarySchema = z21.object({
16763
17077
  /** First 200 characters of the session end note (if provided). */
16764
- noteExcerpt: z20.string().max(200).optional(),
17078
+ noteExcerpt: z21.string().max(200).optional(),
16765
17079
  /** Number of tasks completed during the session. */
16766
- tasksCompletedCount: z20.number().int().nonnegative(),
17080
+ tasksCompletedCount: z21.number().int().nonnegative(),
16767
17081
  /** Up to 5 task IDs (not titles) that were the focus of the session. */
16768
- tasksFocused: z20.array(z20.string()).max(5).optional()
17082
+ tasksFocused: z21.array(z21.string()).max(5).optional()
16769
17083
  });
16770
- sessionJournalEntrySchema = z20.object({
17084
+ sessionJournalEntrySchema = z21.object({
16771
17085
  // Identity
16772
17086
  /** Schema version for forward-compatibility. Always `'1.0'` in this release. */
16773
- schemaVersion: z20.literal(SESSION_JOURNAL_SCHEMA_VERSION),
17087
+ schemaVersion: z21.literal(SESSION_JOURNAL_SCHEMA_VERSION),
16774
17088
  /** ISO 8601 timestamp when the entry was written. */
16775
- timestamp: z20.string(),
17089
+ timestamp: z21.string(),
16776
17090
  /** CLEO session ID (e.g. `ses_20260424055456_ede571`). */
16777
- sessionId: z20.string(),
17091
+ sessionId: z21.string(),
16778
17092
  /** Event type that triggered this journal entry. */
16779
- eventType: z20.enum(["session_start", "session_end", "observation", "decision", "error"]),
17093
+ eventType: z21.enum(["session_start", "session_end", "observation", "decision", "error"]),
16780
17094
  // Session metadata (set on session_start / session_end)
16781
17095
  /** Agent identifier (e.g. `cleo-prime`, `claude-code`). */
16782
- agentIdentifier: z20.string().optional(),
17096
+ agentIdentifier: z21.string().optional(),
16783
17097
  /** Provider adapter ID active for this session. */
16784
- providerId: z20.string().optional(),
17098
+ providerId: z21.string().optional(),
16785
17099
  /** Session scope string (e.g. `'global'` or `'epic:T1263'`). */
16786
- scope: z20.string().optional(),
17100
+ scope: z21.string().optional(),
16787
17101
  // Session-end fields
16788
17102
  /** Duration of the session in seconds (session_end only). */
16789
- duration: z20.number().int().nonnegative().optional(),
17103
+ duration: z21.number().int().nonnegative().optional(),
16790
17104
  /** Task IDs (not titles) completed during the session. */
16791
- tasksCompleted: z20.array(z20.string()).optional(),
17105
+ tasksCompleted: z21.array(z21.string()).optional(),
16792
17106
  // Doctor summary (T1262 absorbed)
16793
17107
  /**
16794
17108
  * Compact result of `scanBrainNoise` run at session-end.
@@ -16803,7 +17117,7 @@ var init_session_journal = __esm({
16803
17117
  debriefSummary: sessionJournalDebriefSummarySchema.optional(),
16804
17118
  // Optional hash chain
16805
17119
  /** SHA-256 hex of the previous entry's raw JSON string (for integrity chain). */
16806
- prevEntryHash: z20.string().optional()
17120
+ prevEntryHash: z21.string().optional()
16807
17121
  });
16808
17122
  }
16809
17123
  });
@@ -16816,52 +17130,52 @@ var init_task = __esm({
16816
17130
  });
16817
17131
 
16818
17132
  // packages/contracts/src/task-evidence.ts
16819
- import { z as z21 } from "zod";
17133
+ import { z as z22 } from "zod";
16820
17134
  var fileEvidenceSchema, logEvidenceSchema, screenshotEvidenceSchema, testOutputEvidenceSchema, commandOutputEvidenceSchema, taskEvidenceSchema;
16821
17135
  var init_task_evidence = __esm({
16822
17136
  "packages/contracts/src/task-evidence.ts"() {
16823
17137
  "use strict";
16824
- fileEvidenceSchema = z21.object({
16825
- kind: z21.literal("file"),
16826
- sha256: z21.string().length(64),
16827
- timestamp: z21.string().datetime(),
16828
- path: z21.string().min(1),
16829
- mime: z21.string().optional(),
16830
- description: z21.string().optional()
16831
- });
16832
- logEvidenceSchema = z21.object({
16833
- kind: z21.literal("log"),
16834
- sha256: z21.string().length(64),
16835
- timestamp: z21.string().datetime(),
16836
- source: z21.string().min(1),
16837
- description: z21.string().optional()
16838
- });
16839
- screenshotEvidenceSchema = z21.object({
16840
- kind: z21.literal("screenshot"),
16841
- sha256: z21.string().length(64),
16842
- timestamp: z21.string().datetime(),
16843
- mime: z21.enum(["image/png", "image/jpeg", "image/webp"]).optional(),
16844
- description: z21.string().optional()
16845
- });
16846
- testOutputEvidenceSchema = z21.object({
16847
- kind: z21.literal("test-output"),
16848
- sha256: z21.string().length(64),
16849
- timestamp: z21.string().datetime(),
16850
- passed: z21.number().int().nonnegative(),
16851
- failed: z21.number().int().nonnegative(),
16852
- skipped: z21.number().int().nonnegative(),
16853
- exitCode: z21.number().int(),
16854
- description: z21.string().optional()
16855
- });
16856
- commandOutputEvidenceSchema = z21.object({
16857
- kind: z21.literal("command-output"),
16858
- sha256: z21.string().length(64),
16859
- timestamp: z21.string().datetime(),
16860
- cmd: z21.string().min(1),
16861
- exitCode: z21.number().int(),
16862
- description: z21.string().optional()
16863
- });
16864
- taskEvidenceSchema = z21.discriminatedUnion("kind", [
17138
+ fileEvidenceSchema = z22.object({
17139
+ kind: z22.literal("file"),
17140
+ sha256: z22.string().length(64),
17141
+ timestamp: z22.string().datetime(),
17142
+ path: z22.string().min(1),
17143
+ mime: z22.string().optional(),
17144
+ description: z22.string().optional()
17145
+ });
17146
+ logEvidenceSchema = z22.object({
17147
+ kind: z22.literal("log"),
17148
+ sha256: z22.string().length(64),
17149
+ timestamp: z22.string().datetime(),
17150
+ source: z22.string().min(1),
17151
+ description: z22.string().optional()
17152
+ });
17153
+ screenshotEvidenceSchema = z22.object({
17154
+ kind: z22.literal("screenshot"),
17155
+ sha256: z22.string().length(64),
17156
+ timestamp: z22.string().datetime(),
17157
+ mime: z22.enum(["image/png", "image/jpeg", "image/webp"]).optional(),
17158
+ description: z22.string().optional()
17159
+ });
17160
+ testOutputEvidenceSchema = z22.object({
17161
+ kind: z22.literal("test-output"),
17162
+ sha256: z22.string().length(64),
17163
+ timestamp: z22.string().datetime(),
17164
+ passed: z22.number().int().nonnegative(),
17165
+ failed: z22.number().int().nonnegative(),
17166
+ skipped: z22.number().int().nonnegative(),
17167
+ exitCode: z22.number().int(),
17168
+ description: z22.string().optional()
17169
+ });
17170
+ commandOutputEvidenceSchema = z22.object({
17171
+ kind: z22.literal("command-output"),
17172
+ sha256: z22.string().length(64),
17173
+ timestamp: z22.string().datetime(),
17174
+ cmd: z22.string().min(1),
17175
+ exitCode: z22.number().int(),
17176
+ description: z22.string().optional()
17177
+ });
17178
+ taskEvidenceSchema = z22.discriminatedUnion("kind", [
16865
17179
  fileEvidenceSchema,
16866
17180
  logEvidenceSchema,
16867
17181
  screenshotEvidenceSchema,
@@ -16872,12 +17186,12 @@ var init_task_evidence = __esm({
16872
17186
  });
16873
17187
 
16874
17188
  // packages/contracts/src/tasks/archive.ts
16875
- import { z as z22 } from "zod";
17189
+ import { z as z23 } from "zod";
16876
17190
  var ArchiveReason, ARCHIVE_REASON_VALUES;
16877
17191
  var init_archive = __esm({
16878
17192
  "packages/contracts/src/tasks/archive.ts"() {
16879
17193
  "use strict";
16880
- ArchiveReason = z22.enum([
17194
+ ArchiveReason = z23.enum([
16881
17195
  "verified",
16882
17196
  "reconciled",
16883
17197
  "superseded",
@@ -16890,47 +17204,47 @@ var init_archive = __esm({
16890
17204
  });
16891
17205
 
16892
17206
  // packages/contracts/src/tasks/index.ts
16893
- import { z as z23 } from "zod";
17207
+ import { z as z24 } from "zod";
16894
17208
  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;
16895
17209
  var init_tasks2 = __esm({
16896
17210
  "packages/contracts/src/tasks/index.ts"() {
16897
17211
  "use strict";
16898
17212
  init_status_registry();
16899
- taskMutationWarningSeveritySchema = z23.enum(["info", "warning"]);
16900
- taskMutationWarningSchema = z23.object({
16901
- code: z23.string().min(1),
16902
- message: z23.string().min(1),
17213
+ taskMutationWarningSeveritySchema = z24.enum(["info", "warning"]);
17214
+ taskMutationWarningSchema = z24.object({
17215
+ code: z24.string().min(1),
17216
+ message: z24.string().min(1),
16903
17217
  severity: taskMutationWarningSeveritySchema.optional(),
16904
- taskId: z23.string().min(1).optional(),
16905
- field: z23.string().min(1).optional(),
16906
- index: z23.number().int().nonnegative().optional()
16907
- });
16908
- taskMutationDryRunSummarySchema = z23.object({
16909
- dryRun: z23.literal(true),
16910
- wouldCreate: z23.number().int().nonnegative(),
16911
- wouldUpdate: z23.number().int().nonnegative(),
16912
- wouldDelete: z23.number().int().nonnegative(),
16913
- wouldAffect: z23.number().int().nonnegative(),
16914
- validatedCount: z23.number().int().nonnegative(),
16915
- insertedCount: z23.literal(0),
16916
- updatedCount: z23.literal(0),
16917
- deletedCount: z23.literal(0),
16918
- warnings: z23.array(taskMutationWarningSchema)
16919
- });
16920
- taskMutationTaskRecordSchema = z23.object({ id: z23.string().min(1) }).passthrough();
16921
- taskMutationEnvelopeSchema = z23.object({
16922
- dryRun: z23.boolean().optional(),
16923
- created: z23.array(taskMutationTaskRecordSchema),
16924
- updated: z23.array(taskMutationTaskRecordSchema),
16925
- deleted: z23.array(taskMutationTaskRecordSchema),
16926
- affectedCount: z23.number().int().nonnegative(),
16927
- mutationWarnings: z23.array(taskMutationWarningSchema),
17218
+ taskId: z24.string().min(1).optional(),
17219
+ field: z24.string().min(1).optional(),
17220
+ index: z24.number().int().nonnegative().optional()
17221
+ });
17222
+ taskMutationDryRunSummarySchema = z24.object({
17223
+ dryRun: z24.literal(true),
17224
+ wouldCreate: z24.number().int().nonnegative(),
17225
+ wouldUpdate: z24.number().int().nonnegative(),
17226
+ wouldDelete: z24.number().int().nonnegative(),
17227
+ wouldAffect: z24.number().int().nonnegative(),
17228
+ validatedCount: z24.number().int().nonnegative(),
17229
+ insertedCount: z24.literal(0),
17230
+ updatedCount: z24.literal(0),
17231
+ deletedCount: z24.literal(0),
17232
+ warnings: z24.array(taskMutationWarningSchema)
17233
+ });
17234
+ taskMutationTaskRecordSchema = z24.object({ id: z24.string().min(1) }).passthrough();
17235
+ taskMutationEnvelopeSchema = z24.object({
17236
+ dryRun: z24.boolean().optional(),
17237
+ created: z24.array(taskMutationTaskRecordSchema),
17238
+ updated: z24.array(taskMutationTaskRecordSchema),
17239
+ deleted: z24.array(taskMutationTaskRecordSchema),
17240
+ affectedCount: z24.number().int().nonnegative(),
17241
+ mutationWarnings: z24.array(taskMutationWarningSchema),
16928
17242
  dryRunSummary: taskMutationDryRunSummarySchema.optional()
16929
17243
  });
16930
- completionTaskStatusSchema = z23.enum(TASK_STATUSES);
16931
- completionCriterionKindSchema = z23.enum(["text", "evidence_bound", "child_task"]);
16932
- completionCriterionStatusSchema = z23.enum(["satisfied", "unsatisfied", "waived", "replaced"]);
16933
- completionBlockerReasonSchema = z23.enum([
17244
+ completionTaskStatusSchema = z24.enum(TASK_STATUSES);
17245
+ completionCriterionKindSchema = z24.enum(["text", "evidence_bound", "child_task"]);
17246
+ completionCriterionStatusSchema = z24.enum(["satisfied", "unsatisfied", "waived", "replaced"]);
17247
+ completionBlockerReasonSchema = z24.enum([
16934
17248
  "missing_evidence_binding",
16935
17249
  "child_not_done",
16936
17250
  "child_cancelled_requires_waiver",
@@ -16938,68 +17252,68 @@ var init_tasks2 = __esm({
16938
17252
  "child_missing",
16939
17253
  "done_parent_stale"
16940
17254
  ]);
16941
- completionStaleReasonSchema = z23.enum(["done_parent_has_unsatisfied_criteria"]);
16942
- completionProjectionRepairErrorCodeSchema = z23.enum([
17255
+ completionStaleReasonSchema = z24.enum(["done_parent_has_unsatisfied_criteria"]);
17256
+ completionProjectionRepairErrorCodeSchema = z24.enum([
16943
17257
  "projection_not_stale",
16944
17258
  "criteria_missing",
16945
17259
  "binding_target_missing",
16946
17260
  "repair_conflict"
16947
17261
  ]);
16948
- completionCriterionWaiverSchema = z23.object({
16949
- criterionAcId: z23.string().min(1),
16950
- childTaskId: z23.string().min(1),
16951
- reason: z23.string().min(1),
16952
- actor: z23.string().min(1),
16953
- waivedAt: z23.string().min(1)
16954
- });
16955
- completionCriterionReplacementSchema = z23.object({
16956
- criterionAcId: z23.string().min(1),
16957
- originalChildTaskId: z23.string().min(1),
16958
- replacementChildTaskId: z23.string().min(1),
16959
- reason: z23.string().min(1),
16960
- actor: z23.string().min(1),
16961
- replacedAt: z23.string().min(1)
16962
- });
16963
- completionCriterionEvaluationSchema = z23.object({
16964
- acId: z23.string().min(1),
16965
- alias: z23.string().min(1),
16966
- text: z23.string(),
17262
+ completionCriterionWaiverSchema = z24.object({
17263
+ criterionAcId: z24.string().min(1),
17264
+ childTaskId: z24.string().min(1),
17265
+ reason: z24.string().min(1),
17266
+ actor: z24.string().min(1),
17267
+ waivedAt: z24.string().min(1)
17268
+ });
17269
+ completionCriterionReplacementSchema = z24.object({
17270
+ criterionAcId: z24.string().min(1),
17271
+ originalChildTaskId: z24.string().min(1),
17272
+ replacementChildTaskId: z24.string().min(1),
17273
+ reason: z24.string().min(1),
17274
+ actor: z24.string().min(1),
17275
+ replacedAt: z24.string().min(1)
17276
+ });
17277
+ completionCriterionEvaluationSchema = z24.object({
17278
+ acId: z24.string().min(1),
17279
+ alias: z24.string().min(1),
17280
+ text: z24.string(),
16967
17281
  kind: completionCriterionKindSchema,
16968
17282
  status: completionCriterionStatusSchema,
16969
17283
  reason: completionBlockerReasonSchema.optional(),
16970
- targetTaskId: z23.string().min(1).optional(),
17284
+ targetTaskId: z24.string().min(1).optional(),
16971
17285
  targetTaskStatus: completionTaskStatusSchema.optional(),
16972
17286
  waiver: completionCriterionWaiverSchema.optional(),
16973
17287
  replacement: completionCriterionReplacementSchema.optional(),
16974
17288
  replacementTaskStatus: completionTaskStatusSchema.optional(),
16975
- evidenceBindings: z23.number().int().nonnegative()
17289
+ evidenceBindings: z24.number().int().nonnegative()
16976
17290
  });
16977
17291
  unsatisfiedCompletionCriterionSchema = completionCriterionEvaluationSchema.extend({
16978
- status: z23.literal("unsatisfied"),
17292
+ status: z24.literal("unsatisfied"),
16979
17293
  reason: completionBlockerReasonSchema
16980
17294
  });
16981
- completionTotalsSchema = z23.object({
16982
- criteria: z23.number().int().nonnegative(),
16983
- satisfied: z23.number().int().nonnegative(),
16984
- unsatisfied: z23.number().int().nonnegative(),
16985
- waived: z23.number().int().nonnegative(),
16986
- replaced: z23.number().int().nonnegative()
16987
- });
16988
- completionContextPackSchema = z23.object({
16989
- taskId: z23.string().min(1),
16990
- generatedAt: z23.string().min(1),
16991
- source: z23.literal("audit_log"),
16992
- window: z23.object({
16993
- limit: z23.number().int().positive(),
16994
- since: z23.string().min(1).optional(),
16995
- relationDepth: z23.number().int().nonnegative(),
16996
- relatedTaskIds: z23.array(z23.string().min(1))
17295
+ completionTotalsSchema = z24.object({
17296
+ criteria: z24.number().int().nonnegative(),
17297
+ satisfied: z24.number().int().nonnegative(),
17298
+ unsatisfied: z24.number().int().nonnegative(),
17299
+ waived: z24.number().int().nonnegative(),
17300
+ replaced: z24.number().int().nonnegative()
17301
+ });
17302
+ completionContextPackSchema = z24.object({
17303
+ taskId: z24.string().min(1),
17304
+ generatedAt: z24.string().min(1),
17305
+ source: z24.literal("audit_log"),
17306
+ window: z24.object({
17307
+ limit: z24.number().int().positive(),
17308
+ since: z24.string().min(1).optional(),
17309
+ relationDepth: z24.number().int().nonnegative(),
17310
+ relatedTaskIds: z24.array(z24.string().min(1))
16997
17311
  }),
16998
- events: z23.array(
16999
- z23.object({
17000
- id: z23.string().min(1),
17001
- timestamp: z23.string().min(1),
17002
- action: z23.enum([
17312
+ events: z24.array(
17313
+ z24.object({
17314
+ id: z24.string().min(1),
17315
+ timestamp: z24.string().min(1),
17316
+ action: z24.enum([
17003
17317
  "task_completed",
17004
17318
  "task_reopened",
17005
17319
  "task_cancelled",
@@ -17007,77 +17321,77 @@ var init_tasks2 = __esm({
17007
17321
  "task_reparented",
17008
17322
  "ac_projection_rebuilt"
17009
17323
  ]),
17010
- taskId: z23.string().min(1),
17011
- relation: z23.enum(["self", "parent", "child", "sibling", "related"]),
17012
- actor: z23.string().min(1),
17013
- details: z23.record(z23.string(), z23.unknown()).optional(),
17014
- before: z23.record(z23.string(), z23.unknown()).optional(),
17015
- after: z23.record(z23.string(), z23.unknown()).optional()
17324
+ taskId: z24.string().min(1),
17325
+ relation: z24.enum(["self", "parent", "child", "sibling", "related"]),
17326
+ actor: z24.string().min(1),
17327
+ details: z24.record(z24.string(), z24.unknown()).optional(),
17328
+ before: z24.record(z24.string(), z24.unknown()).optional(),
17329
+ after: z24.record(z24.string(), z24.unknown()).optional()
17016
17330
  })
17017
17331
  ),
17018
- summary: z23.object({
17019
- totalEvents: z23.number().int().nonnegative(),
17020
- byAction: z23.record(z23.string(), z23.number().int().nonnegative()),
17021
- byRelation: z23.record(z23.string(), z23.number().int().nonnegative()),
17022
- latestEventAt: z23.string().nullable()
17332
+ summary: z24.object({
17333
+ totalEvents: z24.number().int().nonnegative(),
17334
+ byAction: z24.record(z24.string(), z24.number().int().nonnegative()),
17335
+ byRelation: z24.record(z24.string(), z24.number().int().nonnegative()),
17336
+ latestEventAt: z24.string().nullable()
17023
17337
  })
17024
17338
  });
17025
- completionEvaluationSchema = z23.object({
17026
- taskId: z23.string().min(1),
17339
+ completionEvaluationSchema = z24.object({
17340
+ taskId: z24.string().min(1),
17027
17341
  taskStatus: completionTaskStatusSchema,
17028
- ready: z23.boolean(),
17029
- stale: z23.boolean(),
17030
- staleReasons: z23.array(completionStaleReasonSchema),
17342
+ ready: z24.boolean(),
17343
+ stale: z24.boolean(),
17344
+ staleReasons: z24.array(completionStaleReasonSchema),
17031
17345
  contextPack: completionContextPackSchema.optional(),
17032
- satisfied: z23.array(completionCriterionEvaluationSchema),
17033
- unsatisfied: z23.array(unsatisfiedCompletionCriterionSchema),
17034
- waived: z23.array(completionCriterionEvaluationSchema),
17035
- replaced: z23.array(completionCriterionEvaluationSchema),
17346
+ satisfied: z24.array(completionCriterionEvaluationSchema),
17347
+ unsatisfied: z24.array(unsatisfiedCompletionCriterionSchema),
17348
+ waived: z24.array(completionCriterionEvaluationSchema),
17349
+ replaced: z24.array(completionCriterionEvaluationSchema),
17036
17350
  totals: completionTotalsSchema
17037
17351
  });
17038
- completionExplanationSchema = z23.object({
17039
- taskId: z23.string().min(1),
17040
- ready: z23.boolean(),
17041
- stale: z23.boolean(),
17042
- summary: z23.string(),
17352
+ completionExplanationSchema = z24.object({
17353
+ taskId: z24.string().min(1),
17354
+ ready: z24.boolean(),
17355
+ stale: z24.boolean(),
17356
+ summary: z24.string(),
17043
17357
  contextPack: completionContextPackSchema.optional(),
17044
- blockers: z23.array(completionCriterionEvaluationSchema)
17358
+ blockers: z24.array(completionCriterionEvaluationSchema)
17045
17359
  });
17046
- completionListParamsSchema = z23.object({
17047
- taskId: z23.string().min(1),
17360
+ completionListParamsSchema = z24.object({
17361
+ taskId: z24.string().min(1),
17048
17362
  status: completionCriterionStatusSchema.optional(),
17049
17363
  kind: completionCriterionKindSchema.optional()
17050
17364
  });
17051
- completionListResultSchema = z23.object({
17052
- taskId: z23.string().min(1),
17053
- criteria: z23.array(completionCriterionEvaluationSchema),
17365
+ completionListResultSchema = z24.object({
17366
+ taskId: z24.string().min(1),
17367
+ criteria: z24.array(completionCriterionEvaluationSchema),
17054
17368
  totals: completionTotalsSchema
17055
17369
  });
17056
- completionEvaluateParamsSchema = z23.object({
17057
- taskId: z23.string().min(1),
17058
- includeContext: z23.boolean().optional(),
17059
- limit: z23.number().int().positive().optional(),
17060
- since: z23.string().min(1).optional(),
17061
- relationDepth: z23.number().int().nonnegative().optional()
17370
+ completionEvaluateParamsSchema = z24.object({
17371
+ taskId: z24.string().min(1),
17372
+ includeContext: z24.boolean().optional(),
17373
+ limit: z24.number().int().positive().optional(),
17374
+ since: z24.string().min(1).optional(),
17375
+ relationDepth: z24.number().int().nonnegative().optional()
17062
17376
  });
17063
- completionProjectionRepairErrorSchema = z23.object({
17377
+ completionProjectionRepairErrorSchema = z24.object({
17064
17378
  code: completionProjectionRepairErrorCodeSchema,
17065
- message: z23.string().min(1),
17066
- taskId: z23.string().min(1),
17067
- acId: z23.string().min(1).optional(),
17068
- evidenceAtomId: z23.string().min(1).optional()
17379
+ message: z24.string().min(1),
17380
+ taskId: z24.string().min(1),
17381
+ acId: z24.string().min(1).optional(),
17382
+ evidenceAtomId: z24.string().min(1).optional()
17069
17383
  });
17070
- completionProjectionRepairParamsSchema = z23.object({
17071
- taskId: z23.string().min(1),
17072
- dryRun: z23.boolean().optional()
17384
+ completionProjectionRepairParamsSchema = z24.object({
17385
+ taskId: z24.string().min(1),
17386
+ dryRun: z24.boolean().optional()
17073
17387
  });
17074
- completionProjectionRepairResultSchema = z23.object({
17075
- taskId: z23.string().min(1),
17076
- repaired: z23.boolean(),
17077
- dryRun: z23.boolean(),
17078
- staleBefore: z23.boolean(),
17079
- staleAfter: z23.boolean(),
17080
- errors: z23.array(completionProjectionRepairErrorSchema)
17388
+ completionProjectionRepairResultSchema = z24.object({
17389
+ taskId: z24.string().min(1),
17390
+ repaired: z24.boolean(),
17391
+ dryRun: z24.boolean(),
17392
+ staleBefore: z24.boolean(),
17393
+ staleAfter: z24.boolean(),
17394
+ errors: z24.array(completionProjectionRepairErrorSchema)
17081
17395
  });
17082
17396
  }
17083
17397
  });
@@ -17588,7 +17902,7 @@ var init_taxonomy = __esm({
17588
17902
  });
17589
17903
 
17590
17904
  // packages/contracts/src/templates/manifest.ts
17591
- import { z as z24 } from "zod";
17905
+ import { z as z25 } from "zod";
17592
17906
  var TEMPLATE_KINDS, TEMPLATE_SUBSTITUTIONS, TEMPLATE_UPDATE_STRATEGIES, PLACEHOLDER_SOURCES, PlaceholderSpecSchema, TemplateManifestEntrySchema;
17593
17907
  var init_manifest2 = __esm({
17594
17908
  "packages/contracts/src/templates/manifest.ts"() {
@@ -17609,85 +17923,85 @@ var init_manifest2 = __esm({
17609
17923
  "tool-resolver",
17610
17924
  "literal"
17611
17925
  ];
17612
- PlaceholderSpecSchema = z24.object({
17926
+ PlaceholderSpecSchema = z25.object({
17613
17927
  /**
17614
17928
  * Placeholder identifier as it appears in the template body
17615
17929
  * (e.g. `NODE_VERSION` matches `{{NODE_VERSION}}`).
17616
17930
  */
17617
- name: z24.string().min(1, "placeholder name must be non-empty"),
17931
+ name: z25.string().min(1, "placeholder name must be non-empty"),
17618
17932
  /** Resolver source the installer consults for this placeholder. */
17619
- source: z24.enum(PLACEHOLDER_SOURCES),
17933
+ source: z25.enum(PLACEHOLDER_SOURCES),
17620
17934
  /**
17621
17935
  * Path expression evaluated against `source` (e.g. `engines.node` against
17622
17936
  * `project-context`, `defaults.branchModel` against `.cleo/config`).
17623
17937
  * For `literal` source, this MAY be the literal value's identifier.
17624
17938
  */
17625
- sourcePath: z24.string().min(1, "placeholder sourcePath must be non-empty"),
17939
+ sourcePath: z25.string().min(1, "placeholder sourcePath must be non-empty"),
17626
17940
  /**
17627
17941
  * Fallback value used when `source[sourcePath]` resolves to `undefined`.
17628
17942
  * `null` is permitted to explicitly mark "no default — failure required".
17629
17943
  */
17630
- defaultValue: z24.union([z24.string(), z24.number(), z24.boolean(), z24.null()]).optional()
17944
+ defaultValue: z25.union([z25.string(), z25.number(), z25.boolean(), z25.null()]).optional()
17631
17945
  });
17632
- TemplateManifestEntrySchema = z24.object({
17946
+ TemplateManifestEntrySchema = z25.object({
17633
17947
  /** Stable identifier for this template entry. */
17634
- id: z24.string().min(1, "id must be non-empty"),
17948
+ id: z25.string().min(1, "id must be non-empty"),
17635
17949
  /** Category of file this template represents. */
17636
- kind: z24.enum(TEMPLATE_KINDS),
17950
+ kind: z25.enum(TEMPLATE_KINDS),
17637
17951
  /** Repo-relative path of the template source file. */
17638
- sourcePath: z24.string().min(1, "sourcePath must be non-empty"),
17952
+ sourcePath: z25.string().min(1, "sourcePath must be non-empty"),
17639
17953
  /** Project-relative path where the rendered template installs. */
17640
- installPath: z24.string().min(1, "installPath must be non-empty"),
17954
+ installPath: z25.string().min(1, "installPath must be non-empty"),
17641
17955
  /** Substitution strategy the installer applies to `sourcePath`. */
17642
- substitution: z24.enum(TEMPLATE_SUBSTITUTIONS),
17956
+ substitution: z25.enum(TEMPLATE_SUBSTITUTIONS),
17643
17957
  /** Declared placeholders this template requires. May be empty. */
17644
- placeholders: z24.array(PlaceholderSpecSchema),
17958
+ placeholders: z25.array(PlaceholderSpecSchema),
17645
17959
  /** Reconciliation policy on upgrade. */
17646
- updateStrategy: z24.enum(TEMPLATE_UPDATE_STRATEGIES)
17960
+ updateStrategy: z25.enum(TEMPLATE_UPDATE_STRATEGIES)
17647
17961
  });
17648
17962
  }
17649
17963
  });
17650
17964
 
17651
17965
  // packages/contracts/src/validator/index.ts
17652
- import { z as z25 } from "zod";
17966
+ import { z as z26 } from "zod";
17653
17967
  var VALIDATOR_ID_REGEX, validatorFindingSchema, validatorAttestationSchema, validatorRejectionSchema, validatorVerdictSchema;
17654
17968
  var init_validator = __esm({
17655
17969
  "packages/contracts/src/validator/index.ts"() {
17656
17970
  "use strict";
17657
17971
  VALIDATOR_ID_REGEX = /^validator-[a-z0-9][a-z0-9-]*$/;
17658
- validatorFindingSchema = z25.object({
17659
- acId: z25.string().min(1, "acId must be non-empty"),
17660
- status: z25.enum(["pass", "fail", "inconclusive"]),
17661
- reasoning: z25.string().min(1, "reasoning must be non-empty"),
17662
- evidenceRefs: z25.array(z25.string()).optional(),
17663
- checkedAt: z25.string().min(1, "checkedAt must be a non-empty ISO-8601 string")
17664
- });
17665
- validatorAttestationSchema = z25.object({
17666
- verdict: z25.literal("attest"),
17667
- taskId: z25.string().min(1),
17668
- validatorId: z25.string().regex(VALIDATOR_ID_REGEX, "validatorId must match the pattern validator-<discriminator>"),
17669
- findings: z25.array(validatorFindingSchema).min(1, "attestation must contain at least one finding").refine(
17972
+ validatorFindingSchema = z26.object({
17973
+ acId: z26.string().min(1, "acId must be non-empty"),
17974
+ status: z26.enum(["pass", "fail", "inconclusive"]),
17975
+ reasoning: z26.string().min(1, "reasoning must be non-empty"),
17976
+ evidenceRefs: z26.array(z26.string()).optional(),
17977
+ checkedAt: z26.string().min(1, "checkedAt must be a non-empty ISO-8601 string")
17978
+ });
17979
+ validatorAttestationSchema = z26.object({
17980
+ verdict: z26.literal("attest"),
17981
+ taskId: z26.string().min(1),
17982
+ validatorId: z26.string().regex(VALIDATOR_ID_REGEX, "validatorId must match the pattern validator-<discriminator>"),
17983
+ findings: z26.array(validatorFindingSchema).min(1, "attestation must contain at least one finding").refine(
17670
17984
  (findings) => findings.every((f) => f.status === "pass"),
17671
17985
  'attestation requires every finding to have status="pass"'
17672
17986
  ),
17673
- summary: z25.string().optional(),
17674
- attestedAt: z25.string().min(1),
17675
- schemaVersion: z25.literal("1")
17676
- });
17677
- validatorRejectionSchema = z25.object({
17678
- verdict: z25.literal("reject"),
17679
- taskId: z25.string().min(1),
17680
- validatorId: z25.string().regex(VALIDATOR_ID_REGEX, "validatorId must match the pattern validator-<discriminator>"),
17681
- findings: z25.array(validatorFindingSchema).min(1, "rejection must contain at least one finding").refine(
17987
+ summary: z26.string().optional(),
17988
+ attestedAt: z26.string().min(1),
17989
+ schemaVersion: z26.literal("1")
17990
+ });
17991
+ validatorRejectionSchema = z26.object({
17992
+ verdict: z26.literal("reject"),
17993
+ taskId: z26.string().min(1),
17994
+ validatorId: z26.string().regex(VALIDATOR_ID_REGEX, "validatorId must match the pattern validator-<discriminator>"),
17995
+ findings: z26.array(validatorFindingSchema).min(1, "rejection must contain at least one finding").refine(
17682
17996
  (findings) => findings.some((f) => f.status !== "pass"),
17683
17997
  'rejection requires at least one finding with status "fail" or "inconclusive"'
17684
17998
  ),
17685
- summary: z25.string().min(1, "rejection summary must be non-empty"),
17686
- remediationHints: z25.array(z25.string()).optional(),
17687
- rejectedAt: z25.string().min(1),
17688
- schemaVersion: z25.literal("1")
17999
+ summary: z26.string().min(1, "rejection summary must be non-empty"),
18000
+ remediationHints: z26.array(z26.string()).optional(),
18001
+ rejectedAt: z26.string().min(1),
18002
+ schemaVersion: z26.literal("1")
17689
18003
  });
17690
- validatorVerdictSchema = z25.discriminatedUnion("verdict", [
18004
+ validatorVerdictSchema = z26.discriminatedUnion("verdict", [
17691
18005
  validatorAttestationSchema,
17692
18006
  validatorRejectionSchema
17693
18007
  ]);
@@ -18458,7 +18772,7 @@ var init_collection_keys = __esm({
18458
18772
  });
18459
18773
 
18460
18774
  // packages/contracts/src/decide.ts
18461
- import { z as z26 } from "zod";
18775
+ import { z as z27 } from "zod";
18462
18776
  var DECISION_QUESTION_TYPES, DECISION_OUTCOME_SOURCES, DECISION_REQUEST_LIMITS, DECISION_PROVIDER_KINDS, decisionQuestionTypeSchema, decisionOutcomeSourceSchema, decisionInstructionsSchema, unitIntervalSchema, decisionStateSchema, noulDecisionQuestionSchema, choiceDecisionQuestionSchema, scoreDecisionQuestionSchema, decisionQuestionSchema, decisionRequestSchema, noulDecisionAnswerSchema, choiceDecisionAnswerSchema, scoreDecisionAnswerSchema, decisionAnswerSchema, decisionOutcomeSchema, decisionProviderKindSchema, decisionProviderConfigSchema;
18463
18777
  var init_decide = __esm({
18464
18778
  "packages/contracts/src/decide.ts"() {
@@ -18484,11 +18798,11 @@ var init_decide = __esm({
18484
18798
  maxScoreLevels: 10
18485
18799
  };
18486
18800
  DECISION_PROVIDER_KINDS = ["layahost", "jev"];
18487
- decisionQuestionTypeSchema = z26.enum(DECISION_QUESTION_TYPES);
18488
- decisionOutcomeSourceSchema = z26.enum(DECISION_OUTCOME_SOURCES);
18489
- decisionInstructionsSchema = z26.union([z26.string(), z26.record(z26.string(), z26.json())]);
18490
- unitIntervalSchema = z26.number().min(0).max(1);
18491
- decisionStateSchema = z26.union([z26.string(), z26.array(z26.json()), z26.record(z26.string(), z26.json())]).superRefine((state, context) => {
18801
+ decisionQuestionTypeSchema = z27.enum(DECISION_QUESTION_TYPES);
18802
+ decisionOutcomeSourceSchema = z27.enum(DECISION_OUTCOME_SOURCES);
18803
+ decisionInstructionsSchema = z27.union([z27.string(), z27.record(z27.string(), z27.json())]);
18804
+ unitIntervalSchema = z27.number().min(0).max(1);
18805
+ decisionStateSchema = z27.union([z27.string(), z27.array(z27.json()), z27.record(z27.string(), z27.json())]).superRefine((state, context) => {
18492
18806
  const size = typeof state === "string" ? state.length : JSON.stringify(state).length;
18493
18807
  if (size > DECISION_REQUEST_LIMITS.maxStateChars) {
18494
18808
  context.addIssue({
@@ -18497,34 +18811,34 @@ var init_decide = __esm({
18497
18811
  });
18498
18812
  }
18499
18813
  });
18500
- noulDecisionQuestionSchema = z26.object({
18501
- type: z26.literal("noul"),
18814
+ noulDecisionQuestionSchema = z27.object({
18815
+ type: z27.literal("noul"),
18502
18816
  instructions: decisionInstructionsSchema.optional(),
18503
- criteria: z26.string().min(1)
18817
+ criteria: z27.string().min(1)
18504
18818
  });
18505
- choiceDecisionQuestionSchema = z26.object({
18506
- type: z26.literal("choice"),
18819
+ choiceDecisionQuestionSchema = z27.object({
18820
+ type: z27.literal("choice"),
18507
18821
  instructions: decisionInstructionsSchema.optional(),
18508
- criteria: z26.record(z26.string().min(1), z26.string()).refine((options) => Object.keys(options).length >= DECISION_REQUEST_LIMITS.minChoiceOptions, {
18822
+ criteria: z27.record(z27.string().min(1), z27.string()).refine((options) => Object.keys(options).length >= DECISION_REQUEST_LIMITS.minChoiceOptions, {
18509
18823
  message: `a choice question needs at least ${DECISION_REQUEST_LIMITS.minChoiceOptions} options`
18510
18824
  })
18511
18825
  });
18512
- scoreDecisionQuestionSchema = z26.object({
18513
- type: z26.literal("score"),
18826
+ scoreDecisionQuestionSchema = z27.object({
18827
+ type: z27.literal("score"),
18514
18828
  instructions: decisionInstructionsSchema.optional(),
18515
- criteria: z26.array(z26.string()).min(DECISION_REQUEST_LIMITS.minScoreLevels).max(DECISION_REQUEST_LIMITS.maxScoreLevels)
18829
+ criteria: z27.array(z27.string()).min(DECISION_REQUEST_LIMITS.minScoreLevels).max(DECISION_REQUEST_LIMITS.maxScoreLevels)
18516
18830
  });
18517
- decisionQuestionSchema = z26.discriminatedUnion("type", [
18831
+ decisionQuestionSchema = z27.discriminatedUnion("type", [
18518
18832
  noulDecisionQuestionSchema,
18519
18833
  choiceDecisionQuestionSchema,
18520
18834
  scoreDecisionQuestionSchema
18521
18835
  ]);
18522
- decisionRequestSchema = z26.object({
18523
- model: z26.string().min(1).optional(),
18524
- lang: z26.string().regex(/^[a-z]{2,3}(-[A-Za-z0-9]{2,8})?$/).optional(),
18525
- cache: z26.boolean().optional(),
18836
+ decisionRequestSchema = z27.object({
18837
+ model: z27.string().min(1).optional(),
18838
+ lang: z27.string().regex(/^[a-z]{2,3}(-[A-Za-z0-9]{2,8})?$/).optional(),
18839
+ cache: z27.boolean().optional(),
18526
18840
  state: decisionStateSchema,
18527
- questions: z26.record(z26.string().min(1), decisionQuestionSchema).refine(
18841
+ questions: z27.record(z27.string().min(1), decisionQuestionSchema).refine(
18528
18842
  (questions) => {
18529
18843
  const count = Object.keys(questions).length;
18530
18844
  return count >= DECISION_REQUEST_LIMITS.minQuestions && count <= DECISION_REQUEST_LIMITS.maxQuestions;
@@ -18534,43 +18848,43 @@ var init_decide = __esm({
18534
18848
  }
18535
18849
  )
18536
18850
  });
18537
- noulDecisionAnswerSchema = z26.object({
18538
- type: z26.literal("noul"),
18539
- value: z26.boolean(),
18851
+ noulDecisionAnswerSchema = z27.object({
18852
+ type: z27.literal("noul"),
18853
+ value: z27.boolean(),
18540
18854
  probability: unitIntervalSchema,
18541
18855
  confidence: unitIntervalSchema
18542
18856
  });
18543
- choiceDecisionAnswerSchema = z26.object({
18544
- type: z26.literal("choice"),
18545
- value: z26.string().min(1),
18546
- probabilities: z26.record(z26.string().min(1), unitIntervalSchema),
18857
+ choiceDecisionAnswerSchema = z27.object({
18858
+ type: z27.literal("choice"),
18859
+ value: z27.string().min(1),
18860
+ probabilities: z27.record(z27.string().min(1), unitIntervalSchema),
18547
18861
  confidence: unitIntervalSchema
18548
18862
  });
18549
- scoreDecisionAnswerSchema = z26.object({
18550
- type: z26.literal("score"),
18551
- value: z26.number().int().nonnegative(),
18552
- probabilities: z26.array(unitIntervalSchema).min(DECISION_REQUEST_LIMITS.minScoreLevels).max(DECISION_REQUEST_LIMITS.maxScoreLevels),
18863
+ scoreDecisionAnswerSchema = z27.object({
18864
+ type: z27.literal("score"),
18865
+ value: z27.number().int().nonnegative(),
18866
+ probabilities: z27.array(unitIntervalSchema).min(DECISION_REQUEST_LIMITS.minScoreLevels).max(DECISION_REQUEST_LIMITS.maxScoreLevels),
18553
18867
  confidence: unitIntervalSchema
18554
18868
  });
18555
- decisionAnswerSchema = z26.discriminatedUnion("type", [
18869
+ decisionAnswerSchema = z27.discriminatedUnion("type", [
18556
18870
  noulDecisionAnswerSchema,
18557
18871
  choiceDecisionAnswerSchema,
18558
18872
  scoreDecisionAnswerSchema
18559
18873
  ]);
18560
- decisionOutcomeSchema = z26.object({
18561
- answers: z26.record(z26.string().min(1), decisionAnswerSchema),
18874
+ decisionOutcomeSchema = z27.object({
18875
+ answers: z27.record(z27.string().min(1), decisionAnswerSchema),
18562
18876
  source: decisionOutcomeSourceSchema,
18563
- requestId: z26.string().min(1).optional(),
18564
- latencyMs: z26.number().nonnegative(),
18565
- costUsd: z26.number().nonnegative().optional(),
18566
- costMicros: z26.number().int().nonnegative().optional(),
18567
- balanceMicros: z26.number().int().optional(),
18568
- checkpoint: z26.string().min(1).optional(),
18569
- inputTokens: z26.number().int().nonnegative().optional()
18570
- });
18571
- decisionProviderKindSchema = z26.enum(DECISION_PROVIDER_KINDS);
18572
- decisionProviderConfigSchema = z26.object({
18573
- baseUrl: z26.url(),
18877
+ requestId: z27.string().min(1).optional(),
18878
+ latencyMs: z27.number().nonnegative(),
18879
+ costUsd: z27.number().nonnegative().optional(),
18880
+ costMicros: z27.number().int().nonnegative().optional(),
18881
+ balanceMicros: z27.number().int().optional(),
18882
+ checkpoint: z27.string().min(1).optional(),
18883
+ inputTokens: z27.number().int().nonnegative().optional()
18884
+ });
18885
+ decisionProviderKindSchema = z27.enum(DECISION_PROVIDER_KINDS);
18886
+ decisionProviderConfigSchema = z27.object({
18887
+ baseUrl: z27.url(),
18574
18888
  provider: decisionProviderKindSchema.optional()
18575
18889
  });
18576
18890
  }
@@ -18584,33 +18898,33 @@ var init_decide_sites = __esm({
18584
18898
  });
18585
18899
 
18586
18900
  // packages/contracts/src/nexus-account.ts
18587
- import { z as z27 } from "zod";
18901
+ import { z as z28 } from "zod";
18588
18902
  var nexusAccountUserSchema, nexusAccountOrganizationSchema, nexusAccountMeSchema;
18589
18903
  var init_nexus_account = __esm({
18590
18904
  "packages/contracts/src/nexus-account.ts"() {
18591
18905
  "use strict";
18592
- nexusAccountUserSchema = z27.object({
18593
- id: z27.string(),
18594
- email: z27.string(),
18595
- name: z27.string().nullable().optional()
18596
- });
18597
- nexusAccountOrganizationSchema = z27.object({
18598
- id: z27.string(),
18599
- name: z27.string(),
18600
- slug: z27.string().nullable().optional(),
18601
- role: z27.string().optional(),
18906
+ nexusAccountUserSchema = z28.object({
18907
+ id: z28.string(),
18908
+ email: z28.string(),
18909
+ name: z28.string().nullable().optional()
18910
+ });
18911
+ nexusAccountOrganizationSchema = z28.object({
18912
+ id: z28.string(),
18913
+ name: z28.string(),
18914
+ slug: z28.string().nullable().optional(),
18915
+ role: z28.string().optional(),
18602
18916
  /** `true` for the personal organization created at sign-up. */
18603
- personal: z27.boolean().optional()
18917
+ personal: z28.boolean().optional()
18604
18918
  });
18605
- nexusAccountMeSchema = z27.object({
18919
+ nexusAccountMeSchema = z28.object({
18606
18920
  user: nexusAccountUserSchema,
18607
- organizations: z27.array(nexusAccountOrganizationSchema).default([])
18921
+ organizations: z28.array(nexusAccountOrganizationSchema).default([])
18608
18922
  });
18609
18923
  }
18610
18924
  });
18611
18925
 
18612
18926
  // packages/contracts/src/nexus-cloud.ts
18613
- import { z as z28 } from "zod";
18927
+ import { z as z29 } from "zod";
18614
18928
  var NEXUS_DEVICE_STATES, NEXUS_CLOUD_PROFILES, NEXUS_DEVICE_STATE_UNKNOWN, isoTime, profile, deviceState, nexusCloudCredentialSchema, nexusCloudDeviceSchema, nexusCloudOrganizationSchema, nexusCloudUserSchema, nexusCloudWhoamiSchema, nexusCloudDevicePageSchema, nexusCloudPresenceSchema, nexusCloudReplicaSchema, nexusCloudDeviceCountsSchema, projectFields, nexusCloudProjectListItemSchema, nexusCloudProjectPageSchema, nexusCloudProjectDetailSchema, nexusCloudReplicaPageSchema, NEXUS_STATUS_CHECK_IDS, NEXUS_STATUS_VERDICTS, CLOUD_STATUS_VERDICTS, knownCheckId, nexusCloudStatusCheckSchema, nexusCloudStatusSchema, LOGIN, SESSION_EXPIRED_LOGIN, SERVER_REFUSED, NEXUS_FORBIDDEN_ERRORS;
18615
18929
  var init_nexus_cloud = __esm({
18616
18930
  "packages/contracts/src/nexus-cloud.ts"() {
@@ -18618,74 +18932,74 @@ var init_nexus_cloud = __esm({
18618
18932
  NEXUS_DEVICE_STATES = ["active", "signed-out", "revoked"];
18619
18933
  NEXUS_CLOUD_PROFILES = ["device", "read-only"];
18620
18934
  NEXUS_DEVICE_STATE_UNKNOWN = "unknown";
18621
- isoTime = z28.iso.datetime({ offset: true });
18622
- profile = z28.enum(NEXUS_CLOUD_PROFILES).nullable().catch(null);
18623
- deviceState = z28.enum([...NEXUS_DEVICE_STATES, NEXUS_DEVICE_STATE_UNKNOWN]).catch(NEXUS_DEVICE_STATE_UNKNOWN);
18624
- nexusCloudCredentialSchema = z28.object({
18625
- kind: z28.enum(["device", "session"]),
18626
- credentialId: z28.string().nullable().optional(),
18935
+ isoTime = z29.iso.datetime({ offset: true });
18936
+ profile = z29.enum(NEXUS_CLOUD_PROFILES).nullable().catch(null);
18937
+ deviceState = z29.enum([...NEXUS_DEVICE_STATES, NEXUS_DEVICE_STATE_UNKNOWN]).catch(NEXUS_DEVICE_STATE_UNKNOWN);
18938
+ nexusCloudCredentialSchema = z29.object({
18939
+ kind: z29.enum(["device", "session"]),
18940
+ credentialId: z29.string().nullable().optional(),
18627
18941
  profile: profile.optional(),
18628
- scopes: z28.array(z28.string()).default([]),
18942
+ scopes: z29.array(z29.string()).default([]),
18629
18943
  createdAt: isoTime.nullable().optional(),
18630
18944
  lastUsedAt: isoTime.nullable().optional(),
18631
18945
  /** When the credential expires if it is not used again; null for sessions. */
18632
18946
  idleExpiresAt: isoTime.nullable().optional()
18633
18947
  });
18634
- nexusCloudDeviceSchema = z28.object({
18635
- deviceId: z28.string(),
18636
- name: z28.string(),
18637
- platform: z28.string().optional(),
18638
- arch: z28.string().nullable().optional(),
18639
- cliVersion: z28.string().nullable().optional(),
18948
+ nexusCloudDeviceSchema = z29.object({
18949
+ deviceId: z29.string(),
18950
+ name: z29.string(),
18951
+ platform: z29.string().optional(),
18952
+ arch: z29.string().nullable().optional(),
18953
+ cliVersion: z29.string().nullable().optional(),
18640
18954
  createdAt: isoTime.optional(),
18641
18955
  lastSeenAt: isoTime.nullable().optional(),
18642
18956
  state: deviceState,
18643
18957
  signedOutAt: isoTime.nullable().optional(),
18644
18958
  /** Base64 device certificate; null until the device holds a key grant. */
18645
- certificate: z28.string().nullable().optional(),
18959
+ certificate: z29.string().nullable().optional(),
18646
18960
  /** The current credential's profile, or null with none (signed out or revoked). */
18647
18961
  profile: profile.optional(),
18648
18962
  /** True for the device whose credential made this request. */
18649
- current: z28.boolean().default(false),
18650
- projects: z28.number().int().nonnegative().optional(),
18651
- replicas: z28.number().int().nonnegative().optional(),
18963
+ current: z29.boolean().default(false),
18964
+ projects: z29.number().int().nonnegative().optional(),
18965
+ replicas: z29.number().int().nonnegative().optional(),
18652
18966
  lastSyncAt: isoTime.nullable().optional(),
18653
18967
  lastPresenceAt: isoTime.nullable().optional()
18654
18968
  });
18655
- nexusCloudOrganizationSchema = z28.object({
18656
- id: z28.string(),
18657
- name: z28.string(),
18658
- slug: z28.string().nullable().optional(),
18659
- role: z28.string().optional(),
18660
- personal: z28.boolean().optional()
18969
+ nexusCloudOrganizationSchema = z29.object({
18970
+ id: z29.string(),
18971
+ name: z29.string(),
18972
+ slug: z29.string().nullable().optional(),
18973
+ role: z29.string().optional(),
18974
+ personal: z29.boolean().optional()
18661
18975
  });
18662
- nexusCloudUserSchema = z28.object({
18663
- id: z28.string(),
18664
- email: z28.string(),
18665
- name: z28.string().nullable().optional()
18976
+ nexusCloudUserSchema = z29.object({
18977
+ id: z29.string(),
18978
+ email: z29.string(),
18979
+ name: z29.string().nullable().optional()
18666
18980
  });
18667
- nexusCloudWhoamiSchema = z28.object({
18981
+ nexusCloudWhoamiSchema = z29.object({
18668
18982
  serverTime: isoTime.optional(),
18669
18983
  user: nexusCloudUserSchema,
18670
- organizations: z28.array(nexusCloudOrganizationSchema).default([]),
18984
+ organizations: z29.array(nexusCloudOrganizationSchema).default([]),
18671
18985
  credential: nexusCloudCredentialSchema,
18672
18986
  /** The calling device; null for a session caller. */
18673
18987
  device: nexusCloudDeviceSchema.nullable()
18674
18988
  });
18675
- nexusCloudDevicePageSchema = z28.object({
18676
- devices: z28.array(nexusCloudDeviceSchema),
18677
- nextCursor: z28.string().max(512).nullable().default(null),
18678
- truncated: z28.boolean().default(false)
18989
+ nexusCloudDevicePageSchema = z29.object({
18990
+ devices: z29.array(nexusCloudDeviceSchema),
18991
+ nextCursor: z29.string().max(512).nullable().default(null),
18992
+ truncated: z29.boolean().default(false)
18679
18993
  });
18680
- nexusCloudPresenceSchema = z28.looseObject({
18994
+ nexusCloudPresenceSchema = z29.looseObject({
18681
18995
  observedAt: isoTime.optional(),
18682
- sync: z28.object({ enabled: z28.boolean() }).optional()
18996
+ sync: z29.object({ enabled: z29.boolean() }).optional()
18683
18997
  });
18684
- nexusCloudReplicaSchema = z28.object({
18685
- projectId: z28.string(),
18686
- replicaId: z28.string(),
18687
- deviceId: z28.string(),
18688
- deviceName: z28.string(),
18998
+ nexusCloudReplicaSchema = z29.object({
18999
+ projectId: z29.string(),
19000
+ replicaId: z29.string(),
19001
+ deviceId: z29.string(),
19002
+ deviceName: z29.string(),
18689
19003
  deviceState: deviceState.optional(),
18690
19004
  attachedAt: isoTime.optional(),
18691
19005
  lastSyncAt: isoTime.nullable(),
@@ -18694,72 +19008,72 @@ var init_nexus_cloud = __esm({
18694
19008
  /** When the replica was retired (cleo-nexus T123), else null. Absent from servers older than retirement. */
18695
19009
  retiredAt: isoTime.nullable().optional(),
18696
19010
  /** The retired replica's named successor, else null (not retired, or retired with none). */
18697
- successor: z28.string().nullable().optional()
19011
+ successor: z29.string().nullable().optional()
18698
19012
  });
18699
- nexusCloudDeviceCountsSchema = z28.object({
18700
- active: z28.number().int().nonnegative(),
18701
- total: z28.number().int().nonnegative()
19013
+ nexusCloudDeviceCountsSchema = z29.object({
19014
+ active: z29.number().int().nonnegative(),
19015
+ total: z29.number().int().nonnegative()
18702
19016
  });
18703
19017
  projectFields = {
18704
- projectId: z28.string(),
18705
- label: z28.string().nullable(),
18706
- organizationId: z28.string(),
18707
- organizationName: z28.string().optional(),
18708
- remoteUrl: z28.string().nullable().optional(),
19018
+ projectId: z29.string(),
19019
+ label: z29.string().nullable(),
19020
+ organizationId: z29.string(),
19021
+ organizationName: z29.string().optional(),
19022
+ remoteUrl: z29.string().nullable().optional(),
18709
19023
  createdAt: isoTime.optional()
18710
19024
  };
18711
- nexusCloudProjectListItemSchema = z28.object({
19025
+ nexusCloudProjectListItemSchema = z29.object({
18712
19026
  ...projectFields,
18713
- role: z28.string(),
19027
+ role: z29.string(),
18714
19028
  /**
18715
19029
  * The project name sealed with the project data key (`Project.encryptedName`), base64;
18716
19030
  * only a holder of the account key can open it (T13102).
18717
19031
  */
18718
- encryptedName: z28.string().nullable().optional(),
18719
- streamId: z28.string().optional(),
18720
- headSeq: z28.number().int().nonnegative().nullable().optional(),
19032
+ encryptedName: z29.string().nullable().optional(),
19033
+ streamId: z29.string().optional(),
19034
+ headSeq: z29.number().int().nonnegative().nullable().optional(),
18721
19035
  /** The stream's head snapshot; null when nothing was ever pushed (T13102: restorable or not). */
18722
- headCheckpointId: z28.string().nullable().optional(),
18723
- openConflicts: z28.number().int().nonnegative().optional(),
18724
- replicas: z28.array(nexusCloudReplicaSchema).default([]),
19036
+ headCheckpointId: z29.string().nullable().optional(),
19037
+ openConflicts: z29.number().int().nonnegative().optional(),
19038
+ replicas: z29.array(nexusCloudReplicaSchema).default([]),
18725
19039
  devices: nexusCloudDeviceCountsSchema.optional(),
18726
- replicaCount: z28.number().int().nonnegative().optional(),
19040
+ replicaCount: z29.number().int().nonnegative().optional(),
18727
19041
  lastSyncAt: isoTime.nullable().optional(),
18728
19042
  lastPresenceAt: isoTime.nullable().optional(),
18729
19043
  /** This project's replica list was cut at 50 (T12858). */
18730
- replicasTruncated: z28.boolean().default(false)
19044
+ replicasTruncated: z29.boolean().default(false)
18731
19045
  });
18732
- nexusCloudProjectPageSchema = z28.object({
18733
- projects: z28.array(nexusCloudProjectListItemSchema),
18734
- nextCursor: z28.string().max(512).nullable().default(null),
19046
+ nexusCloudProjectPageSchema = z29.object({
19047
+ projects: z29.array(nexusCloudProjectListItemSchema),
19048
+ nextCursor: z29.string().max(512).nullable().default(null),
18735
19049
  /** Anything in the page was cut (the project list or a replica list). */
18736
- truncated: z28.boolean().default(false),
19050
+ truncated: z29.boolean().default(false),
18737
19051
  /** The project list itself was cut at 1000 (T12858). */
18738
- projectsTruncated: z28.boolean().default(false)
19052
+ projectsTruncated: z29.boolean().default(false)
18739
19053
  });
18740
- nexusCloudProjectDetailSchema = z28.object({
18741
- project: z28.object({ ...projectFields, deletedAt: isoTime.nullable().optional() }),
18742
- role: z28.string(),
18743
- canTrash: z28.boolean().optional(),
18744
- openConflicts: z28.number().int().nonnegative(),
19054
+ nexusCloudProjectDetailSchema = z29.object({
19055
+ project: z29.object({ ...projectFields, deletedAt: isoTime.nullable().optional() }),
19056
+ role: z29.string(),
19057
+ canTrash: z29.boolean().optional(),
19058
+ openConflicts: z29.number().int().nonnegative(),
18745
19059
  /** At most 50, oldest attachment first. */
18746
- replicas: z28.array(nexusCloudReplicaSchema),
19060
+ replicas: z29.array(nexusCloudReplicaSchema),
18747
19061
  devices: nexusCloudDeviceCountsSchema,
18748
- replicaCount: z28.number().int().nonnegative().optional(),
19062
+ replicaCount: z29.number().int().nonnegative().optional(),
18749
19063
  lastSyncAt: isoTime.nullable().optional(),
18750
19064
  /** `replicas` was cut at 50. */
18751
- truncated: z28.boolean().default(false),
18752
- stream: z28.object({
18753
- streamId: z28.string(),
18754
- headSeq: z28.number().int().nonnegative(),
18755
- headCheckpointId: z28.string().nullable()
19065
+ truncated: z29.boolean().default(false),
19066
+ stream: z29.object({
19067
+ streamId: z29.string(),
19068
+ headSeq: z29.number().int().nonnegative(),
19069
+ headCheckpointId: z29.string().nullable()
18756
19070
  }).nullable()
18757
19071
  });
18758
- nexusCloudReplicaPageSchema = z28.object({
18759
- replicas: z28.array(nexusCloudReplicaSchema),
19072
+ nexusCloudReplicaPageSchema = z29.object({
19073
+ replicas: z29.array(nexusCloudReplicaSchema),
18760
19074
  devices: nexusCloudDeviceCountsSchema.optional(),
18761
- nextCursor: z28.string().max(512).nullable().default(null),
18762
- truncated: z28.boolean().default(false)
19075
+ nextCursor: z29.string().max(512).nullable().default(null),
19076
+ truncated: z29.boolean().default(false)
18763
19077
  });
18764
19078
  NEXUS_STATUS_CHECK_IDS = [
18765
19079
  "credential.valid",
@@ -18775,56 +19089,56 @@ var init_nexus_cloud = __esm({
18775
19089
  ];
18776
19090
  NEXUS_STATUS_VERDICTS = ["ok", "attention", "not-linked", "not-registered"];
18777
19091
  CLOUD_STATUS_VERDICTS = [...NEXUS_STATUS_VERDICTS, "not-signed-in"];
18778
- knownCheckId = z28.enum(NEXUS_STATUS_CHECK_IDS);
18779
- nexusCloudStatusCheckSchema = z28.object({
18780
- id: z28.enum(NEXUS_STATUS_CHECK_IDS),
18781
- ok: z28.boolean(),
18782
- required: z28.boolean(),
18783
- detail: z28.string()
18784
- });
18785
- nexusCloudStatusSchema = z28.object({
19092
+ knownCheckId = z29.enum(NEXUS_STATUS_CHECK_IDS);
19093
+ nexusCloudStatusCheckSchema = z29.object({
19094
+ id: z29.enum(NEXUS_STATUS_CHECK_IDS),
19095
+ ok: z29.boolean(),
19096
+ required: z29.boolean(),
19097
+ detail: z29.string()
19098
+ });
19099
+ nexusCloudStatusSchema = z29.object({
18786
19100
  serverTime: isoTime.optional(),
18787
- apiVersion: z28.string().optional(),
19101
+ apiVersion: z29.string().optional(),
18788
19102
  /**
18789
19103
  * Optional server features (e.g. {@link NEXUS_FEATURE_PROJECT_INITIAL_KEY}). Absent from servers older
18790
19104
  * than the list, which therefore support none of them.
18791
19105
  */
18792
- features: z28.array(z28.string()).optional(),
19106
+ features: z29.array(z29.string()).optional(),
18793
19107
  user: nexusCloudUserSchema,
18794
19108
  credential: nexusCloudCredentialSchema,
18795
19109
  device: nexusCloudDeviceSchema.nullable(),
18796
- project: z28.object({
18797
- projectId: z28.string(),
18798
- registered: z28.boolean(),
18799
- organizationId: z28.string().nullable(),
18800
- organizationName: z28.string().nullable(),
18801
- role: z28.string().nullable()
19110
+ project: z29.object({
19111
+ projectId: z29.string(),
19112
+ registered: z29.boolean(),
19113
+ organizationId: z29.string().nullable(),
19114
+ organizationName: z29.string().nullable(),
19115
+ role: z29.string().nullable()
18802
19116
  }).nullable(),
18803
- replica: z28.object({
18804
- replicaId: z28.string(),
18805
- attached: z28.boolean(),
18806
- attachedElsewhere: z28.boolean(),
19117
+ replica: z29.object({
19118
+ replicaId: z29.string(),
19119
+ attached: z29.boolean(),
19120
+ attachedElsewhere: z29.boolean(),
18807
19121
  attachedAt: isoTime.nullable(),
18808
19122
  lastSyncAt: isoTime.nullable(),
18809
19123
  presenceAt: isoTime.nullable(),
18810
- lastReplicaSeq: z28.number().int().nonnegative().nullable().optional()
19124
+ lastReplicaSeq: z29.number().int().nonnegative().nullable().optional()
18811
19125
  }).nullable(),
18812
- stream: z28.object({
18813
- streamId: z28.string(),
18814
- headSeq: z28.number().int().nonnegative(),
18815
- headCheckpointId: z28.string().nullable(),
18816
- openConflicts: z28.number().int().nonnegative(),
19126
+ stream: z29.object({
19127
+ streamId: z29.string(),
19128
+ headSeq: z29.number().int().nonnegative(),
19129
+ headCheckpointId: z29.string().nullable(),
19130
+ openConflicts: z29.number().int().nonnegative(),
18817
19131
  devices: nexusCloudDeviceCountsSchema
18818
19132
  }).nullable(),
18819
19133
  /** Check ids added by a newer server are dropped, never a parse failure. */
18820
- checks: z28.array(nexusCloudStatusCheckSchema.extend({ id: z28.string() })).transform(
19134
+ checks: z29.array(nexusCloudStatusCheckSchema.extend({ id: z29.string() })).transform(
18821
19135
  (list) => list.flatMap((c) => {
18822
19136
  const id = knownCheckId.safeParse(c.id);
18823
19137
  return id.success ? [{ ...c, id: id.data }] : [];
18824
19138
  })
18825
19139
  ),
18826
19140
  /** A verdict added by a newer server reads as `attention`: never `ok` by accident. */
18827
- verdict: z28.enum(NEXUS_STATUS_VERDICTS).catch("attention")
19141
+ verdict: z29.enum(NEXUS_STATUS_VERDICTS).catch("attention")
18828
19142
  });
18829
19143
  LOGIN = "run `cleo login nexus`";
18830
19144
  SESSION_EXPIRED_LOGIN = {
@@ -18878,54 +19192,54 @@ var init_nexus_first_run = __esm({
18878
19192
  });
18879
19193
 
18880
19194
  // packages/contracts/src/nexus-vault.ts
18881
- import { z as z29 } from "zod";
19195
+ import { z as z30 } from "zod";
18882
19196
  var isoTime2, uuid, nexusUserKeysSchema, nexusProjectKeysSchema, nexusLeaseSchema, nexusLeaseAcquireSchema, nexusStreamHeadSchema, nexusActivityEventSchema, nexusActivityPageSchema;
18883
19197
  var init_nexus_vault = __esm({
18884
19198
  "packages/contracts/src/nexus-vault.ts"() {
18885
19199
  "use strict";
18886
- isoTime2 = z29.iso.datetime({ offset: true });
18887
- uuid = z29.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i);
18888
- nexusUserKeysSchema = z29.looseObject({
18889
- keyVersion: z29.number().int().positive(),
18890
- masterKeyVerifier: z29.string()
18891
- });
18892
- nexusProjectKeysSchema = z29.looseObject({
18893
- keys: z29.array(
18894
- z29.looseObject({ wrappedProjectKey: z29.string(), keyVersion: z29.number().int().positive() })
19200
+ isoTime2 = z30.iso.datetime({ offset: true });
19201
+ uuid = z30.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i);
19202
+ nexusUserKeysSchema = z30.looseObject({
19203
+ keyVersion: z30.number().int().positive(),
19204
+ masterKeyVerifier: z30.string()
19205
+ });
19206
+ nexusProjectKeysSchema = z30.looseObject({
19207
+ keys: z30.array(
19208
+ z30.looseObject({ wrappedProjectKey: z30.string(), keyVersion: z30.number().int().positive() })
18895
19209
  )
18896
19210
  });
18897
- nexusLeaseSchema = z29.looseObject({
18898
- streamId: z29.string(),
18899
- role: z29.string(),
19211
+ nexusLeaseSchema = z30.looseObject({
19212
+ streamId: z30.string(),
19213
+ role: z30.string(),
18900
19214
  replicaId: uuid,
18901
19215
  expiresAt: isoTime2,
18902
19216
  forkedFromReplicaId: uuid.nullable().optional()
18903
19217
  });
18904
- nexusLeaseAcquireSchema = z29.looseObject({ lease: nexusLeaseSchema });
18905
- nexusStreamHeadSchema = z29.looseObject({
18906
- streamId: z29.string(),
18907
- kind: z29.string().optional(),
18908
- headSeq: z29.number().int().nonnegative(),
18909
- headCheckpointId: z29.string().nullable(),
19218
+ nexusLeaseAcquireSchema = z30.looseObject({ lease: nexusLeaseSchema });
19219
+ nexusStreamHeadSchema = z30.looseObject({
19220
+ streamId: z30.string(),
19221
+ kind: z30.string().optional(),
19222
+ headSeq: z30.number().int().nonnegative(),
19223
+ headCheckpointId: z30.string().nullable(),
18910
19224
  /**
18911
19225
  * The highest segment `schemaVersion` the stream holds (the server raises it on every append).
18912
19226
  * Absent from an older server.
18913
19227
  */
18914
- maxSchemaVersion: z29.number().int().nonnegative().optional()
19228
+ maxSchemaVersion: z30.number().int().nonnegative().optional()
18915
19229
  });
18916
- nexusActivityEventSchema = z29.looseObject({
18917
- id: z29.union([z29.string(), z29.number()]),
19230
+ nexusActivityEventSchema = z30.looseObject({
19231
+ id: z30.union([z30.string(), z30.number()]),
18918
19232
  at: isoTime2,
18919
- actorUserId: z29.string().nullable().optional(),
18920
- actorDeviceId: z29.string().nullable().optional(),
18921
- requestId: z29.string().nullable().optional(),
18922
- action: z29.string(),
18923
- target: z29.string().nullable().optional(),
18924
- detail: z29.unknown().optional()
19233
+ actorUserId: z30.string().nullable().optional(),
19234
+ actorDeviceId: z30.string().nullable().optional(),
19235
+ requestId: z30.string().nullable().optional(),
19236
+ action: z30.string(),
19237
+ target: z30.string().nullable().optional(),
19238
+ detail: z30.unknown().optional()
18925
19239
  });
18926
- nexusActivityPageSchema = z29.looseObject({
18927
- events: z29.array(nexusActivityEventSchema),
18928
- nextBefore: z29.union([z29.string(), z29.number()]).nullable().optional()
19240
+ nexusActivityPageSchema = z30.looseObject({
19241
+ events: z30.array(nexusActivityEventSchema),
19242
+ nextBefore: z30.union([z30.string(), z30.number()]).nullable().optional()
18929
19243
  });
18930
19244
  }
18931
19245
  });
@@ -33088,7 +33402,7 @@ function resolveRef(ref, ctx) {
33088
33402
  function convertBaseSchema(schema, ctx) {
33089
33403
  if (schema.not !== void 0) {
33090
33404
  if (typeof schema.not === "object" && Object.keys(schema.not).length === 0) {
33091
- return z30.never();
33405
+ return z31.never();
33092
33406
  }
33093
33407
  throw new Error("not is not supported in Zod (except { not: {} } for never)");
33094
33408
  }
@@ -33110,7 +33424,7 @@ function convertBaseSchema(schema, ctx) {
33110
33424
  return ctx.refs.get(refPath);
33111
33425
  }
33112
33426
  if (ctx.processing.has(refPath)) {
33113
- return z30.lazy(() => {
33427
+ return z31.lazy(() => {
33114
33428
  if (!ctx.refs.has(refPath)) {
33115
33429
  throw new Error(`Circular reference not resolved: ${refPath}`);
33116
33430
  }
@@ -33127,25 +33441,25 @@ function convertBaseSchema(schema, ctx) {
33127
33441
  if (schema.enum !== void 0) {
33128
33442
  const enumValues = schema.enum;
33129
33443
  if (ctx.version === "openapi-3.0" && schema.nullable === true && enumValues.length === 1 && enumValues[0] === null) {
33130
- return z30.null();
33444
+ return z31.null();
33131
33445
  }
33132
33446
  if (enumValues.length === 0) {
33133
- return z30.never();
33447
+ return z31.never();
33134
33448
  }
33135
33449
  if (enumValues.length === 1) {
33136
- return z30.literal(enumValues[0]);
33450
+ return z31.literal(enumValues[0]);
33137
33451
  }
33138
33452
  if (enumValues.every((v) => typeof v === "string")) {
33139
- return z30.enum(enumValues);
33453
+ return z31.enum(enumValues);
33140
33454
  }
33141
- const literalSchemas = enumValues.map((v) => z30.literal(v));
33455
+ const literalSchemas = enumValues.map((v) => z31.literal(v));
33142
33456
  if (literalSchemas.length < 2) {
33143
33457
  return literalSchemas[0];
33144
33458
  }
33145
- return z30.union([literalSchemas[0], literalSchemas[1], ...literalSchemas.slice(2)]);
33459
+ return z31.union([literalSchemas[0], literalSchemas[1], ...literalSchemas.slice(2)]);
33146
33460
  }
33147
33461
  if (schema.const !== void 0) {
33148
- return z30.literal(schema.const);
33462
+ return z31.literal(schema.const);
33149
33463
  }
33150
33464
  const type = schema.type;
33151
33465
  if (Array.isArray(type)) {
@@ -33154,68 +33468,68 @@ function convertBaseSchema(schema, ctx) {
33154
33468
  return convertBaseSchema(typeSchema, ctx);
33155
33469
  });
33156
33470
  if (typeSchemas.length === 0) {
33157
- return z30.never();
33471
+ return z31.never();
33158
33472
  }
33159
33473
  if (typeSchemas.length === 1) {
33160
33474
  return typeSchemas[0];
33161
33475
  }
33162
- return z30.union(typeSchemas);
33476
+ return z31.union(typeSchemas);
33163
33477
  }
33164
33478
  if (!type) {
33165
- return z30.any();
33479
+ return z31.any();
33166
33480
  }
33167
33481
  let zodSchema2;
33168
33482
  switch (type) {
33169
33483
  case "string": {
33170
- let stringSchema = z30.string();
33484
+ let stringSchema = z31.string();
33171
33485
  if (schema.format) {
33172
33486
  const format = schema.format;
33173
33487
  if (format === "email") {
33174
- stringSchema = stringSchema.check(z30.email());
33488
+ stringSchema = stringSchema.check(z31.email());
33175
33489
  } else if (format === "uri" || format === "uri-reference") {
33176
- stringSchema = stringSchema.check(z30.url());
33490
+ stringSchema = stringSchema.check(z31.url());
33177
33491
  } else if (format === "uuid" || format === "guid") {
33178
- stringSchema = stringSchema.check(z30.uuid());
33492
+ stringSchema = stringSchema.check(z31.uuid());
33179
33493
  } else if (format === "date-time") {
33180
- stringSchema = stringSchema.check(z30.iso.datetime());
33494
+ stringSchema = stringSchema.check(z31.iso.datetime());
33181
33495
  } else if (format === "date") {
33182
- stringSchema = stringSchema.check(z30.iso.date());
33496
+ stringSchema = stringSchema.check(z31.iso.date());
33183
33497
  } else if (format === "time") {
33184
- stringSchema = stringSchema.check(z30.iso.time());
33498
+ stringSchema = stringSchema.check(z31.iso.time());
33185
33499
  } else if (format === "duration") {
33186
- stringSchema = stringSchema.check(z30.iso.duration());
33500
+ stringSchema = stringSchema.check(z31.iso.duration());
33187
33501
  } else if (format === "ipv4") {
33188
- stringSchema = stringSchema.check(z30.ipv4());
33502
+ stringSchema = stringSchema.check(z31.ipv4());
33189
33503
  } else if (format === "ipv6") {
33190
- stringSchema = stringSchema.check(z30.ipv6());
33504
+ stringSchema = stringSchema.check(z31.ipv6());
33191
33505
  } else if (format === "mac") {
33192
- stringSchema = stringSchema.check(z30.mac());
33506
+ stringSchema = stringSchema.check(z31.mac());
33193
33507
  } else if (format === "cidr") {
33194
- stringSchema = stringSchema.check(z30.cidrv4());
33508
+ stringSchema = stringSchema.check(z31.cidrv4());
33195
33509
  } else if (format === "cidr-v6") {
33196
- stringSchema = stringSchema.check(z30.cidrv6());
33510
+ stringSchema = stringSchema.check(z31.cidrv6());
33197
33511
  } else if (format === "base64") {
33198
- stringSchema = stringSchema.check(z30.base64());
33512
+ stringSchema = stringSchema.check(z31.base64());
33199
33513
  } else if (format === "base64url") {
33200
- stringSchema = stringSchema.check(z30.base64url());
33514
+ stringSchema = stringSchema.check(z31.base64url());
33201
33515
  } else if (format === "e164") {
33202
- stringSchema = stringSchema.check(z30.e164());
33516
+ stringSchema = stringSchema.check(z31.e164());
33203
33517
  } else if (format === "jwt") {
33204
- stringSchema = stringSchema.check(z30.jwt());
33518
+ stringSchema = stringSchema.check(z31.jwt());
33205
33519
  } else if (format === "emoji") {
33206
- stringSchema = stringSchema.check(z30.emoji());
33520
+ stringSchema = stringSchema.check(z31.emoji());
33207
33521
  } else if (format === "nanoid") {
33208
- stringSchema = stringSchema.check(z30.nanoid());
33522
+ stringSchema = stringSchema.check(z31.nanoid());
33209
33523
  } else if (format === "cuid") {
33210
- stringSchema = stringSchema.check(z30.cuid());
33524
+ stringSchema = stringSchema.check(z31.cuid());
33211
33525
  } else if (format === "cuid2") {
33212
- stringSchema = stringSchema.check(z30.cuid2());
33526
+ stringSchema = stringSchema.check(z31.cuid2());
33213
33527
  } else if (format === "ulid") {
33214
- stringSchema = stringSchema.check(z30.ulid());
33528
+ stringSchema = stringSchema.check(z31.ulid());
33215
33529
  } else if (format === "xid") {
33216
- stringSchema = stringSchema.check(z30.xid());
33530
+ stringSchema = stringSchema.check(z31.xid());
33217
33531
  } else if (format === "ksuid") {
33218
- stringSchema = stringSchema.check(z30.ksuid());
33532
+ stringSchema = stringSchema.check(z31.ksuid());
33219
33533
  }
33220
33534
  }
33221
33535
  if (typeof schema.minLength === "number") {
@@ -33232,7 +33546,7 @@ function convertBaseSchema(schema, ctx) {
33232
33546
  }
33233
33547
  case "number":
33234
33548
  case "integer": {
33235
- let numberSchema = type === "integer" ? z30.number().int() : z30.number();
33549
+ let numberSchema = type === "integer" ? z31.number().int() : z31.number();
33236
33550
  if (typeof schema.minimum === "number") {
33237
33551
  numberSchema = numberSchema.min(schema.minimum);
33238
33552
  }
@@ -33256,11 +33570,11 @@ function convertBaseSchema(schema, ctx) {
33256
33570
  break;
33257
33571
  }
33258
33572
  case "boolean": {
33259
- zodSchema2 = z30.boolean();
33573
+ zodSchema2 = z31.boolean();
33260
33574
  break;
33261
33575
  }
33262
33576
  case "null": {
33263
- zodSchema2 = z30.null();
33577
+ zodSchema2 = z31.null();
33264
33578
  break;
33265
33579
  }
33266
33580
  case "object": {
@@ -33273,14 +33587,14 @@ function convertBaseSchema(schema, ctx) {
33273
33587
  }
33274
33588
  if (schema.propertyNames) {
33275
33589
  const keySchema = convertSchema(schema.propertyNames, ctx);
33276
- const valueSchema = schema.additionalProperties && typeof schema.additionalProperties === "object" ? convertSchema(schema.additionalProperties, ctx) : z30.any();
33590
+ const valueSchema = schema.additionalProperties && typeof schema.additionalProperties === "object" ? convertSchema(schema.additionalProperties, ctx) : z31.any();
33277
33591
  if (Object.keys(shape).length === 0) {
33278
- zodSchema2 = z30.record(keySchema, valueSchema);
33592
+ zodSchema2 = z31.record(keySchema, valueSchema);
33279
33593
  break;
33280
33594
  }
33281
- const objectSchema2 = z30.object(shape).passthrough();
33282
- const recordSchema = z30.looseRecord(keySchema, valueSchema);
33283
- zodSchema2 = z30.intersection(objectSchema2, recordSchema);
33595
+ const objectSchema2 = z31.object(shape).passthrough();
33596
+ const recordSchema = z31.looseRecord(keySchema, valueSchema);
33597
+ zodSchema2 = z31.intersection(objectSchema2, recordSchema);
33284
33598
  break;
33285
33599
  }
33286
33600
  if (schema.patternProperties) {
@@ -33289,28 +33603,28 @@ function convertBaseSchema(schema, ctx) {
33289
33603
  const looseRecords = [];
33290
33604
  for (const pattern of patternKeys) {
33291
33605
  const patternValue = convertSchema(patternProps[pattern], ctx);
33292
- const keySchema = z30.string().regex(new RegExp(pattern));
33293
- looseRecords.push(z30.looseRecord(keySchema, patternValue));
33606
+ const keySchema = z31.string().regex(new RegExp(pattern));
33607
+ looseRecords.push(z31.looseRecord(keySchema, patternValue));
33294
33608
  }
33295
33609
  const schemasToIntersect = [];
33296
33610
  if (Object.keys(shape).length > 0) {
33297
- schemasToIntersect.push(z30.object(shape).passthrough());
33611
+ schemasToIntersect.push(z31.object(shape).passthrough());
33298
33612
  }
33299
33613
  schemasToIntersect.push(...looseRecords);
33300
33614
  if (schemasToIntersect.length === 0) {
33301
- zodSchema2 = z30.object({}).passthrough();
33615
+ zodSchema2 = z31.object({}).passthrough();
33302
33616
  } else if (schemasToIntersect.length === 1) {
33303
33617
  zodSchema2 = schemasToIntersect[0];
33304
33618
  } else {
33305
- let result = z30.intersection(schemasToIntersect[0], schemasToIntersect[1]);
33619
+ let result = z31.intersection(schemasToIntersect[0], schemasToIntersect[1]);
33306
33620
  for (let i = 2; i < schemasToIntersect.length; i++) {
33307
- result = z30.intersection(result, schemasToIntersect[i]);
33621
+ result = z31.intersection(result, schemasToIntersect[i]);
33308
33622
  }
33309
33623
  zodSchema2 = result;
33310
33624
  }
33311
33625
  break;
33312
33626
  }
33313
- const objectSchema = z30.object(shape);
33627
+ const objectSchema = z31.object(shape);
33314
33628
  if (schema.additionalProperties === false) {
33315
33629
  zodSchema2 = objectSchema.strict();
33316
33630
  } else if (typeof schema.additionalProperties === "object") {
@@ -33327,33 +33641,33 @@ function convertBaseSchema(schema, ctx) {
33327
33641
  const tupleItems = prefixItems.map((item) => convertSchema(item, ctx));
33328
33642
  const rest = items && typeof items === "object" && !Array.isArray(items) ? convertSchema(items, ctx) : void 0;
33329
33643
  if (rest) {
33330
- zodSchema2 = z30.tuple(tupleItems).rest(rest);
33644
+ zodSchema2 = z31.tuple(tupleItems).rest(rest);
33331
33645
  } else {
33332
- zodSchema2 = z30.tuple(tupleItems);
33646
+ zodSchema2 = z31.tuple(tupleItems);
33333
33647
  }
33334
33648
  if (typeof schema.minItems === "number") {
33335
- zodSchema2 = zodSchema2.check(z30.minLength(schema.minItems));
33649
+ zodSchema2 = zodSchema2.check(z31.minLength(schema.minItems));
33336
33650
  }
33337
33651
  if (typeof schema.maxItems === "number") {
33338
- zodSchema2 = zodSchema2.check(z30.maxLength(schema.maxItems));
33652
+ zodSchema2 = zodSchema2.check(z31.maxLength(schema.maxItems));
33339
33653
  }
33340
33654
  } else if (Array.isArray(items)) {
33341
33655
  const tupleItems = items.map((item) => convertSchema(item, ctx));
33342
33656
  const rest = schema.additionalItems && typeof schema.additionalItems === "object" ? convertSchema(schema.additionalItems, ctx) : void 0;
33343
33657
  if (rest) {
33344
- zodSchema2 = z30.tuple(tupleItems).rest(rest);
33658
+ zodSchema2 = z31.tuple(tupleItems).rest(rest);
33345
33659
  } else {
33346
- zodSchema2 = z30.tuple(tupleItems);
33660
+ zodSchema2 = z31.tuple(tupleItems);
33347
33661
  }
33348
33662
  if (typeof schema.minItems === "number") {
33349
- zodSchema2 = zodSchema2.check(z30.minLength(schema.minItems));
33663
+ zodSchema2 = zodSchema2.check(z31.minLength(schema.minItems));
33350
33664
  }
33351
33665
  if (typeof schema.maxItems === "number") {
33352
- zodSchema2 = zodSchema2.check(z30.maxLength(schema.maxItems));
33666
+ zodSchema2 = zodSchema2.check(z31.maxLength(schema.maxItems));
33353
33667
  }
33354
33668
  } else if (items !== void 0) {
33355
33669
  const element = convertSchema(items, ctx);
33356
- let arraySchema = z30.array(element);
33670
+ let arraySchema = z31.array(element);
33357
33671
  if (typeof schema.minItems === "number") {
33358
33672
  arraySchema = arraySchema.min(schema.minItems);
33359
33673
  }
@@ -33362,7 +33676,7 @@ function convertBaseSchema(schema, ctx) {
33362
33676
  }
33363
33677
  zodSchema2 = arraySchema;
33364
33678
  } else {
33365
- zodSchema2 = z30.array(z30.any());
33679
+ zodSchema2 = z31.array(z31.any());
33366
33680
  }
33367
33681
  break;
33368
33682
  }
@@ -33379,37 +33693,37 @@ function convertBaseSchema(schema, ctx) {
33379
33693
  }
33380
33694
  function convertSchema(schema, ctx) {
33381
33695
  if (typeof schema === "boolean") {
33382
- return schema ? z30.any() : z30.never();
33696
+ return schema ? z31.any() : z31.never();
33383
33697
  }
33384
33698
  let baseSchema = convertBaseSchema(schema, ctx);
33385
33699
  const hasExplicitType = schema.type || schema.enum !== void 0 || schema.const !== void 0;
33386
33700
  if (schema.anyOf && Array.isArray(schema.anyOf)) {
33387
33701
  const options = schema.anyOf.map((s) => convertSchema(s, ctx));
33388
- const anyOfUnion = z30.union(options);
33389
- baseSchema = hasExplicitType ? z30.intersection(baseSchema, anyOfUnion) : anyOfUnion;
33702
+ const anyOfUnion = z31.union(options);
33703
+ baseSchema = hasExplicitType ? z31.intersection(baseSchema, anyOfUnion) : anyOfUnion;
33390
33704
  }
33391
33705
  if (schema.oneOf && Array.isArray(schema.oneOf)) {
33392
33706
  const options = schema.oneOf.map((s) => convertSchema(s, ctx));
33393
- const oneOfUnion = z30.xor(options);
33394
- baseSchema = hasExplicitType ? z30.intersection(baseSchema, oneOfUnion) : oneOfUnion;
33707
+ const oneOfUnion = z31.xor(options);
33708
+ baseSchema = hasExplicitType ? z31.intersection(baseSchema, oneOfUnion) : oneOfUnion;
33395
33709
  }
33396
33710
  if (schema.allOf && Array.isArray(schema.allOf)) {
33397
33711
  if (schema.allOf.length === 0) {
33398
- baseSchema = hasExplicitType ? baseSchema : z30.any();
33712
+ baseSchema = hasExplicitType ? baseSchema : z31.any();
33399
33713
  } else {
33400
33714
  let result = hasExplicitType ? baseSchema : convertSchema(schema.allOf[0], ctx);
33401
33715
  const startIdx = hasExplicitType ? 0 : 1;
33402
33716
  for (let i = startIdx; i < schema.allOf.length; i++) {
33403
- result = z30.intersection(result, convertSchema(schema.allOf[i], ctx));
33717
+ result = z31.intersection(result, convertSchema(schema.allOf[i], ctx));
33404
33718
  }
33405
33719
  baseSchema = result;
33406
33720
  }
33407
33721
  }
33408
33722
  if (schema.nullable === true && ctx.version === "openapi-3.0") {
33409
- baseSchema = z30.nullable(baseSchema);
33723
+ baseSchema = z31.nullable(baseSchema);
33410
33724
  }
33411
33725
  if (schema.readOnly === true) {
33412
- baseSchema = z30.readonly(baseSchema);
33726
+ baseSchema = z31.readonly(baseSchema);
33413
33727
  }
33414
33728
  const extraMeta = {};
33415
33729
  const coreMetadataKeys = ["$id", "id", "$comment", "$anchor", "$vocabulary", "$dynamicRef", "$dynamicAnchor"];
@@ -33436,7 +33750,7 @@ function convertSchema(schema, ctx) {
33436
33750
  }
33437
33751
  function fromJSONSchema(schema, params) {
33438
33752
  if (typeof schema === "boolean") {
33439
- return schema ? z30.any() : z30.never();
33753
+ return schema ? z31.any() : z31.never();
33440
33754
  }
33441
33755
  const version2 = detectVersion(schema, params?.defaultTarget);
33442
33756
  const defs = schema.$defs || schema.definitions || {};
@@ -33450,14 +33764,14 @@ function fromJSONSchema(schema, params) {
33450
33764
  };
33451
33765
  return convertSchema(schema, ctx);
33452
33766
  }
33453
- var z30, RECOGNIZED_KEYS;
33767
+ var z31, RECOGNIZED_KEYS;
33454
33768
  var init_from_json_schema = __esm({
33455
33769
  "node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/from-json-schema.js"() {
33456
33770
  init_registries();
33457
33771
  init_checks2();
33458
33772
  init_iso();
33459
33773
  init_schemas2();
33460
- z30 = {
33774
+ z31 = {
33461
33775
  ...schemas_exports2,
33462
33776
  ...checks_exports2,
33463
33777
  iso: iso_exports
@@ -44949,6 +45263,7 @@ var init_dist4 = __esm({
44949
45263
  });
44950
45264
 
44951
45265
  // packages/adapters/src/providers/claude-sdk/spawn.ts
45266
+ import { E_LEAD_NO_OWNER_CHANNEL as E_LEAD_NO_OWNER_CHANNEL2 } from "@cleocode/contracts/operations/orchestrate.js";
44952
45267
  var DEFAULT_MODEL, ClaudeSDKSpawnProvider;
44953
45268
  var init_spawn = __esm({
44954
45269
  "packages/adapters/src/providers/claude-sdk/spawn.ts"() {
@@ -44994,6 +45309,18 @@ var init_spawn = __esm({
44994
45309
  const instanceId = `sdk-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
44995
45310
  const sessionId = `cleo-${instanceId}`;
44996
45311
  const startTime = (/* @__PURE__ */ new Date()).toISOString();
45312
+ if (leadDeniedTools(context) !== null && context.options?.leadMode !== "detached") {
45313
+ return {
45314
+ instanceId,
45315
+ taskId: context.taskId,
45316
+ providerId: "claude-sdk",
45317
+ status: "failed",
45318
+ startTime,
45319
+ endTime: (/* @__PURE__ */ new Date()).toISOString(),
45320
+ exitCode: 1,
45321
+ error: `${E_LEAD_NO_OWNER_CHANNEL2}: claude-sdk cannot deliver interactive AskUserQuestion answers; use --detached with --adapter claude-code and a configured mbx MCP server`
45322
+ };
45323
+ }
44997
45324
  this.sessions.add({
44998
45325
  instanceId,
44999
45326
  sessionId,
@@ -46972,7 +47299,10 @@ var init_lead_mcp = __esm({
46972
47299
  // packages/adapters/src/providers/claude-code/lead-session.ts
46973
47300
  import { spawn as nodeSpawn } from "node:child_process";
46974
47301
  import { isAbsolute as isAbsolute4 } from "node:path";
46975
- import { LEAD_ASK_TOOL as LEAD_ASK_TOOL2 } from "@cleocode/contracts/operations/orchestrate.js";
47302
+ import {
47303
+ E_LEAD_NO_OWNER_CHANNEL as E_LEAD_NO_OWNER_CHANNEL3,
47304
+ LEAD_ASK_TOOL as LEAD_ASK_TOOL2
47305
+ } from "@cleocode/contracts/operations/orchestrate.js";
46976
47306
  import { findOnPath, pathDelimiterFor, pathEnvKey, splitPathEnv } from "@cleocode/paths";
46977
47307
  function leadSessionId(options) {
46978
47308
  const id = options?.leadSessionId;
@@ -47022,12 +47352,12 @@ function buildLeadArgs(input) {
47022
47352
  "--allowedTools",
47023
47353
  allowed.join(","),
47024
47354
  "--disallowedTools",
47025
- input.denied.join(","),
47355
+ input.denied.filter((tool2) => tool2 !== "MultiEdit").join(","),
47026
47356
  "--mcp-config",
47027
47357
  input.leadMcp.config,
47028
47358
  "--strict-mcp-config",
47029
47359
  "--permission-mode",
47030
- "dontAsk",
47360
+ interactive ? "default" : "dontAsk",
47031
47361
  "--setting-sources",
47032
47362
  "",
47033
47363
  ...input.sessionId !== void 0 ? ["--session-id", input.sessionId] : [],
@@ -47039,6 +47369,13 @@ function buildLeadArgs(input) {
47039
47369
  ];
47040
47370
  }
47041
47371
  function runInteractiveLead(command, args, opts) {
47372
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
47373
+ return Promise.reject(
47374
+ new Error(
47375
+ `${E_LEAD_NO_OWNER_CHANNEL3}: interactive AskUserQuestion needs terminal stdin and stdout; use --detached with --adapter claude-code and a configured mbx MCP server`
47376
+ )
47377
+ );
47378
+ }
47042
47379
  return new Promise((resolve7, reject) => {
47043
47380
  const child = nodeSpawn(command, [...args], {
47044
47381
  stdio: "inherit",
@@ -47158,7 +47495,7 @@ var init_suite_reaper = __esm({
47158
47495
  import { spawn as nodeSpawn2 } from "node:child_process";
47159
47496
  import { writeFile as writeFile3 } from "node:fs/promises";
47160
47497
  import { dirname as dirname7, join as join11 } from "node:path";
47161
- import { E_LEAD_NO_OWNER_CHANNEL as E_LEAD_NO_OWNER_CHANNEL2 } from "@cleocode/contracts/operations/orchestrate.js";
47498
+ import { E_LEAD_NO_OWNER_CHANNEL as E_LEAD_NO_OWNER_CHANNEL4 } from "@cleocode/contracts/operations/orchestrate.js";
47162
47499
  import { findOnPath as findOnPath2 } from "@cleocode/paths";
47163
47500
  function trackedWorkerInstanceId(options) {
47164
47501
  const id = options?.workerInstanceId;
@@ -47290,7 +47627,7 @@ var init_spawn2 = __esm({
47290
47627
  status: "failed",
47291
47628
  startTime,
47292
47629
  endTime: (/* @__PURE__ */ new Date()).toISOString(),
47293
- error: `${E_LEAD_NO_OWNER_CHANNEL2}: a detached lead needs the mbx MCP server to reach the owner (${leadMcp.report.warning ?? "none is configured"})`,
47630
+ error: `${E_LEAD_NO_OWNER_CHANNEL4}: a detached lead needs the mbx MCP server to reach the owner (${leadMcp.report.warning ?? "none is configured"})`,
47294
47631
  leadMcp: leadMcp.report
47295
47632
  };
47296
47633
  }