@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
@@ -14363,7 +14363,7 @@ function resolveRef(ref, ctx) {
14363
14363
  function convertBaseSchema(schema, ctx) {
14364
14364
  if (schema.not !== void 0) {
14365
14365
  if (typeof schema.not === "object" && Object.keys(schema.not).length === 0) {
14366
- return z30.never();
14366
+ return z31.never();
14367
14367
  }
14368
14368
  throw new Error("not is not supported in Zod (except { not: {} } for never)");
14369
14369
  }
@@ -14385,7 +14385,7 @@ function convertBaseSchema(schema, ctx) {
14385
14385
  return ctx.refs.get(refPath);
14386
14386
  }
14387
14387
  if (ctx.processing.has(refPath)) {
14388
- return z30.lazy(() => {
14388
+ return z31.lazy(() => {
14389
14389
  if (!ctx.refs.has(refPath)) {
14390
14390
  throw new Error(`Circular reference not resolved: ${refPath}`);
14391
14391
  }
@@ -14402,25 +14402,25 @@ function convertBaseSchema(schema, ctx) {
14402
14402
  if (schema.enum !== void 0) {
14403
14403
  const enumValues = schema.enum;
14404
14404
  if (ctx.version === "openapi-3.0" && schema.nullable === true && enumValues.length === 1 && enumValues[0] === null) {
14405
- return z30.null();
14405
+ return z31.null();
14406
14406
  }
14407
14407
  if (enumValues.length === 0) {
14408
- return z30.never();
14408
+ return z31.never();
14409
14409
  }
14410
14410
  if (enumValues.length === 1) {
14411
- return z30.literal(enumValues[0]);
14411
+ return z31.literal(enumValues[0]);
14412
14412
  }
14413
14413
  if (enumValues.every((v) => typeof v === "string")) {
14414
- return z30.enum(enumValues);
14414
+ return z31.enum(enumValues);
14415
14415
  }
14416
- const literalSchemas = enumValues.map((v) => z30.literal(v));
14416
+ const literalSchemas = enumValues.map((v) => z31.literal(v));
14417
14417
  if (literalSchemas.length < 2) {
14418
14418
  return literalSchemas[0];
14419
14419
  }
14420
- return z30.union([literalSchemas[0], literalSchemas[1], ...literalSchemas.slice(2)]);
14420
+ return z31.union([literalSchemas[0], literalSchemas[1], ...literalSchemas.slice(2)]);
14421
14421
  }
14422
14422
  if (schema.const !== void 0) {
14423
- return z30.literal(schema.const);
14423
+ return z31.literal(schema.const);
14424
14424
  }
14425
14425
  const type = schema.type;
14426
14426
  if (Array.isArray(type)) {
@@ -14429,68 +14429,68 @@ function convertBaseSchema(schema, ctx) {
14429
14429
  return convertBaseSchema(typeSchema, ctx);
14430
14430
  });
14431
14431
  if (typeSchemas.length === 0) {
14432
- return z30.never();
14432
+ return z31.never();
14433
14433
  }
14434
14434
  if (typeSchemas.length === 1) {
14435
14435
  return typeSchemas[0];
14436
14436
  }
14437
- return z30.union(typeSchemas);
14437
+ return z31.union(typeSchemas);
14438
14438
  }
14439
14439
  if (!type) {
14440
- return z30.any();
14440
+ return z31.any();
14441
14441
  }
14442
14442
  let zodSchema2;
14443
14443
  switch (type) {
14444
14444
  case "string": {
14445
- let stringSchema = z30.string();
14445
+ let stringSchema = z31.string();
14446
14446
  if (schema.format) {
14447
14447
  const format = schema.format;
14448
14448
  if (format === "email") {
14449
- stringSchema = stringSchema.check(z30.email());
14449
+ stringSchema = stringSchema.check(z31.email());
14450
14450
  } else if (format === "uri" || format === "uri-reference") {
14451
- stringSchema = stringSchema.check(z30.url());
14451
+ stringSchema = stringSchema.check(z31.url());
14452
14452
  } else if (format === "uuid" || format === "guid") {
14453
- stringSchema = stringSchema.check(z30.uuid());
14453
+ stringSchema = stringSchema.check(z31.uuid());
14454
14454
  } else if (format === "date-time") {
14455
- stringSchema = stringSchema.check(z30.iso.datetime());
14455
+ stringSchema = stringSchema.check(z31.iso.datetime());
14456
14456
  } else if (format === "date") {
14457
- stringSchema = stringSchema.check(z30.iso.date());
14457
+ stringSchema = stringSchema.check(z31.iso.date());
14458
14458
  } else if (format === "time") {
14459
- stringSchema = stringSchema.check(z30.iso.time());
14459
+ stringSchema = stringSchema.check(z31.iso.time());
14460
14460
  } else if (format === "duration") {
14461
- stringSchema = stringSchema.check(z30.iso.duration());
14461
+ stringSchema = stringSchema.check(z31.iso.duration());
14462
14462
  } else if (format === "ipv4") {
14463
- stringSchema = stringSchema.check(z30.ipv4());
14463
+ stringSchema = stringSchema.check(z31.ipv4());
14464
14464
  } else if (format === "ipv6") {
14465
- stringSchema = stringSchema.check(z30.ipv6());
14465
+ stringSchema = stringSchema.check(z31.ipv6());
14466
14466
  } else if (format === "mac") {
14467
- stringSchema = stringSchema.check(z30.mac());
14467
+ stringSchema = stringSchema.check(z31.mac());
14468
14468
  } else if (format === "cidr") {
14469
- stringSchema = stringSchema.check(z30.cidrv4());
14469
+ stringSchema = stringSchema.check(z31.cidrv4());
14470
14470
  } else if (format === "cidr-v6") {
14471
- stringSchema = stringSchema.check(z30.cidrv6());
14471
+ stringSchema = stringSchema.check(z31.cidrv6());
14472
14472
  } else if (format === "base64") {
14473
- stringSchema = stringSchema.check(z30.base64());
14473
+ stringSchema = stringSchema.check(z31.base64());
14474
14474
  } else if (format === "base64url") {
14475
- stringSchema = stringSchema.check(z30.base64url());
14475
+ stringSchema = stringSchema.check(z31.base64url());
14476
14476
  } else if (format === "e164") {
14477
- stringSchema = stringSchema.check(z30.e164());
14477
+ stringSchema = stringSchema.check(z31.e164());
14478
14478
  } else if (format === "jwt") {
14479
- stringSchema = stringSchema.check(z30.jwt());
14479
+ stringSchema = stringSchema.check(z31.jwt());
14480
14480
  } else if (format === "emoji") {
14481
- stringSchema = stringSchema.check(z30.emoji());
14481
+ stringSchema = stringSchema.check(z31.emoji());
14482
14482
  } else if (format === "nanoid") {
14483
- stringSchema = stringSchema.check(z30.nanoid());
14483
+ stringSchema = stringSchema.check(z31.nanoid());
14484
14484
  } else if (format === "cuid") {
14485
- stringSchema = stringSchema.check(z30.cuid());
14485
+ stringSchema = stringSchema.check(z31.cuid());
14486
14486
  } else if (format === "cuid2") {
14487
- stringSchema = stringSchema.check(z30.cuid2());
14487
+ stringSchema = stringSchema.check(z31.cuid2());
14488
14488
  } else if (format === "ulid") {
14489
- stringSchema = stringSchema.check(z30.ulid());
14489
+ stringSchema = stringSchema.check(z31.ulid());
14490
14490
  } else if (format === "xid") {
14491
- stringSchema = stringSchema.check(z30.xid());
14491
+ stringSchema = stringSchema.check(z31.xid());
14492
14492
  } else if (format === "ksuid") {
14493
- stringSchema = stringSchema.check(z30.ksuid());
14493
+ stringSchema = stringSchema.check(z31.ksuid());
14494
14494
  }
14495
14495
  }
14496
14496
  if (typeof schema.minLength === "number") {
@@ -14507,7 +14507,7 @@ function convertBaseSchema(schema, ctx) {
14507
14507
  }
14508
14508
  case "number":
14509
14509
  case "integer": {
14510
- let numberSchema = type === "integer" ? z30.number().int() : z30.number();
14510
+ let numberSchema = type === "integer" ? z31.number().int() : z31.number();
14511
14511
  if (typeof schema.minimum === "number") {
14512
14512
  numberSchema = numberSchema.min(schema.minimum);
14513
14513
  }
@@ -14531,11 +14531,11 @@ function convertBaseSchema(schema, ctx) {
14531
14531
  break;
14532
14532
  }
14533
14533
  case "boolean": {
14534
- zodSchema2 = z30.boolean();
14534
+ zodSchema2 = z31.boolean();
14535
14535
  break;
14536
14536
  }
14537
14537
  case "null": {
14538
- zodSchema2 = z30.null();
14538
+ zodSchema2 = z31.null();
14539
14539
  break;
14540
14540
  }
14541
14541
  case "object": {
@@ -14548,14 +14548,14 @@ function convertBaseSchema(schema, ctx) {
14548
14548
  }
14549
14549
  if (schema.propertyNames) {
14550
14550
  const keySchema = convertSchema(schema.propertyNames, ctx);
14551
- const valueSchema = schema.additionalProperties && typeof schema.additionalProperties === "object" ? convertSchema(schema.additionalProperties, ctx) : z30.any();
14551
+ const valueSchema = schema.additionalProperties && typeof schema.additionalProperties === "object" ? convertSchema(schema.additionalProperties, ctx) : z31.any();
14552
14552
  if (Object.keys(shape).length === 0) {
14553
- zodSchema2 = z30.record(keySchema, valueSchema);
14553
+ zodSchema2 = z31.record(keySchema, valueSchema);
14554
14554
  break;
14555
14555
  }
14556
- const objectSchema2 = z30.object(shape).passthrough();
14557
- const recordSchema = z30.looseRecord(keySchema, valueSchema);
14558
- zodSchema2 = z30.intersection(objectSchema2, recordSchema);
14556
+ const objectSchema2 = z31.object(shape).passthrough();
14557
+ const recordSchema = z31.looseRecord(keySchema, valueSchema);
14558
+ zodSchema2 = z31.intersection(objectSchema2, recordSchema);
14559
14559
  break;
14560
14560
  }
14561
14561
  if (schema.patternProperties) {
@@ -14564,28 +14564,28 @@ function convertBaseSchema(schema, ctx) {
14564
14564
  const looseRecords = [];
14565
14565
  for (const pattern of patternKeys) {
14566
14566
  const patternValue = convertSchema(patternProps[pattern], ctx);
14567
- const keySchema = z30.string().regex(new RegExp(pattern));
14568
- looseRecords.push(z30.looseRecord(keySchema, patternValue));
14567
+ const keySchema = z31.string().regex(new RegExp(pattern));
14568
+ looseRecords.push(z31.looseRecord(keySchema, patternValue));
14569
14569
  }
14570
14570
  const schemasToIntersect = [];
14571
14571
  if (Object.keys(shape).length > 0) {
14572
- schemasToIntersect.push(z30.object(shape).passthrough());
14572
+ schemasToIntersect.push(z31.object(shape).passthrough());
14573
14573
  }
14574
14574
  schemasToIntersect.push(...looseRecords);
14575
14575
  if (schemasToIntersect.length === 0) {
14576
- zodSchema2 = z30.object({}).passthrough();
14576
+ zodSchema2 = z31.object({}).passthrough();
14577
14577
  } else if (schemasToIntersect.length === 1) {
14578
14578
  zodSchema2 = schemasToIntersect[0];
14579
14579
  } else {
14580
- let result = z30.intersection(schemasToIntersect[0], schemasToIntersect[1]);
14580
+ let result = z31.intersection(schemasToIntersect[0], schemasToIntersect[1]);
14581
14581
  for (let i = 2; i < schemasToIntersect.length; i++) {
14582
- result = z30.intersection(result, schemasToIntersect[i]);
14582
+ result = z31.intersection(result, schemasToIntersect[i]);
14583
14583
  }
14584
14584
  zodSchema2 = result;
14585
14585
  }
14586
14586
  break;
14587
14587
  }
14588
- const objectSchema = z30.object(shape);
14588
+ const objectSchema = z31.object(shape);
14589
14589
  if (schema.additionalProperties === false) {
14590
14590
  zodSchema2 = objectSchema.strict();
14591
14591
  } else if (typeof schema.additionalProperties === "object") {
@@ -14602,33 +14602,33 @@ function convertBaseSchema(schema, ctx) {
14602
14602
  const tupleItems = prefixItems.map((item) => convertSchema(item, ctx));
14603
14603
  const rest = items && typeof items === "object" && !Array.isArray(items) ? convertSchema(items, ctx) : void 0;
14604
14604
  if (rest) {
14605
- zodSchema2 = z30.tuple(tupleItems).rest(rest);
14605
+ zodSchema2 = z31.tuple(tupleItems).rest(rest);
14606
14606
  } else {
14607
- zodSchema2 = z30.tuple(tupleItems);
14607
+ zodSchema2 = z31.tuple(tupleItems);
14608
14608
  }
14609
14609
  if (typeof schema.minItems === "number") {
14610
- zodSchema2 = zodSchema2.check(z30.minLength(schema.minItems));
14610
+ zodSchema2 = zodSchema2.check(z31.minLength(schema.minItems));
14611
14611
  }
14612
14612
  if (typeof schema.maxItems === "number") {
14613
- zodSchema2 = zodSchema2.check(z30.maxLength(schema.maxItems));
14613
+ zodSchema2 = zodSchema2.check(z31.maxLength(schema.maxItems));
14614
14614
  }
14615
14615
  } else if (Array.isArray(items)) {
14616
14616
  const tupleItems = items.map((item) => convertSchema(item, ctx));
14617
14617
  const rest = schema.additionalItems && typeof schema.additionalItems === "object" ? convertSchema(schema.additionalItems, ctx) : void 0;
14618
14618
  if (rest) {
14619
- zodSchema2 = z30.tuple(tupleItems).rest(rest);
14619
+ zodSchema2 = z31.tuple(tupleItems).rest(rest);
14620
14620
  } else {
14621
- zodSchema2 = z30.tuple(tupleItems);
14621
+ zodSchema2 = z31.tuple(tupleItems);
14622
14622
  }
14623
14623
  if (typeof schema.minItems === "number") {
14624
- zodSchema2 = zodSchema2.check(z30.minLength(schema.minItems));
14624
+ zodSchema2 = zodSchema2.check(z31.minLength(schema.minItems));
14625
14625
  }
14626
14626
  if (typeof schema.maxItems === "number") {
14627
- zodSchema2 = zodSchema2.check(z30.maxLength(schema.maxItems));
14627
+ zodSchema2 = zodSchema2.check(z31.maxLength(schema.maxItems));
14628
14628
  }
14629
14629
  } else if (items !== void 0) {
14630
14630
  const element = convertSchema(items, ctx);
14631
- let arraySchema = z30.array(element);
14631
+ let arraySchema = z31.array(element);
14632
14632
  if (typeof schema.minItems === "number") {
14633
14633
  arraySchema = arraySchema.min(schema.minItems);
14634
14634
  }
@@ -14637,7 +14637,7 @@ function convertBaseSchema(schema, ctx) {
14637
14637
  }
14638
14638
  zodSchema2 = arraySchema;
14639
14639
  } else {
14640
- zodSchema2 = z30.array(z30.any());
14640
+ zodSchema2 = z31.array(z31.any());
14641
14641
  }
14642
14642
  break;
14643
14643
  }
@@ -14654,37 +14654,37 @@ function convertBaseSchema(schema, ctx) {
14654
14654
  }
14655
14655
  function convertSchema(schema, ctx) {
14656
14656
  if (typeof schema === "boolean") {
14657
- return schema ? z30.any() : z30.never();
14657
+ return schema ? z31.any() : z31.never();
14658
14658
  }
14659
14659
  let baseSchema = convertBaseSchema(schema, ctx);
14660
14660
  const hasExplicitType = schema.type || schema.enum !== void 0 || schema.const !== void 0;
14661
14661
  if (schema.anyOf && Array.isArray(schema.anyOf)) {
14662
14662
  const options = schema.anyOf.map((s) => convertSchema(s, ctx));
14663
- const anyOfUnion = z30.union(options);
14664
- baseSchema = hasExplicitType ? z30.intersection(baseSchema, anyOfUnion) : anyOfUnion;
14663
+ const anyOfUnion = z31.union(options);
14664
+ baseSchema = hasExplicitType ? z31.intersection(baseSchema, anyOfUnion) : anyOfUnion;
14665
14665
  }
14666
14666
  if (schema.oneOf && Array.isArray(schema.oneOf)) {
14667
14667
  const options = schema.oneOf.map((s) => convertSchema(s, ctx));
14668
- const oneOfUnion = z30.xor(options);
14669
- baseSchema = hasExplicitType ? z30.intersection(baseSchema, oneOfUnion) : oneOfUnion;
14668
+ const oneOfUnion = z31.xor(options);
14669
+ baseSchema = hasExplicitType ? z31.intersection(baseSchema, oneOfUnion) : oneOfUnion;
14670
14670
  }
14671
14671
  if (schema.allOf && Array.isArray(schema.allOf)) {
14672
14672
  if (schema.allOf.length === 0) {
14673
- baseSchema = hasExplicitType ? baseSchema : z30.any();
14673
+ baseSchema = hasExplicitType ? baseSchema : z31.any();
14674
14674
  } else {
14675
14675
  let result = hasExplicitType ? baseSchema : convertSchema(schema.allOf[0], ctx);
14676
14676
  const startIdx = hasExplicitType ? 0 : 1;
14677
14677
  for (let i = startIdx; i < schema.allOf.length; i++) {
14678
- result = z30.intersection(result, convertSchema(schema.allOf[i], ctx));
14678
+ result = z31.intersection(result, convertSchema(schema.allOf[i], ctx));
14679
14679
  }
14680
14680
  baseSchema = result;
14681
14681
  }
14682
14682
  }
14683
14683
  if (schema.nullable === true && ctx.version === "openapi-3.0") {
14684
- baseSchema = z30.nullable(baseSchema);
14684
+ baseSchema = z31.nullable(baseSchema);
14685
14685
  }
14686
14686
  if (schema.readOnly === true) {
14687
- baseSchema = z30.readonly(baseSchema);
14687
+ baseSchema = z31.readonly(baseSchema);
14688
14688
  }
14689
14689
  const extraMeta = {};
14690
14690
  const coreMetadataKeys = ["$id", "id", "$comment", "$anchor", "$vocabulary", "$dynamicRef", "$dynamicAnchor"];
@@ -14711,7 +14711,7 @@ function convertSchema(schema, ctx) {
14711
14711
  }
14712
14712
  function fromJSONSchema(schema, params) {
14713
14713
  if (typeof schema === "boolean") {
14714
- return schema ? z30.any() : z30.never();
14714
+ return schema ? z31.any() : z31.never();
14715
14715
  }
14716
14716
  const version2 = detectVersion(schema, params?.defaultTarget);
14717
14717
  const defs = schema.$defs || schema.definitions || {};
@@ -14725,14 +14725,14 @@ function fromJSONSchema(schema, params) {
14725
14725
  };
14726
14726
  return convertSchema(schema, ctx);
14727
14727
  }
14728
- var z30, RECOGNIZED_KEYS;
14728
+ var z31, RECOGNIZED_KEYS;
14729
14729
  var init_from_json_schema = __esm({
14730
14730
  "node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/from-json-schema.js"() {
14731
14731
  init_registries();
14732
14732
  init_checks2();
14733
14733
  init_iso();
14734
14734
  init_schemas2();
14735
- z30 = {
14735
+ z31 = {
14736
14736
  ...schemas_exports2,
14737
14737
  ...checks_exports2,
14738
14738
  iso: iso_exports
@@ -26836,17 +26836,321 @@ var ChangesetEntrySchema = z3.object({
26836
26836
  });
26837
26837
 
26838
26838
  // packages/contracts/src/config/manifest.ts
26839
- import { z as z5 } from "zod";
26839
+ import { z as z6 } from "zod";
26840
26840
 
26841
- // packages/contracts/src/config/worker-policy.ts
26841
+ // packages/contracts/src/orca-execution.ts
26842
26842
  import { z as z4 } from "zod";
26843
- var projectWorkerPolicySchema = z4.object({
26844
- verification: z4.object({
26845
- full: z4.enum(["local", "ci"]),
26846
- local: z4.enum(["single-file", "affected"])
26843
+ var identifier = z4.string().min(1);
26844
+ var orcaAgentSchema = z4.enum(["codex", "opencode2", "claude", "grok"]);
26845
+ var DEFAULT_ORCA_AGENTS = ["codex", "opencode2", "claude"];
26846
+ var orchestrateOrcaConfigSchema = z4.object({
26847
+ agents: z4.array(orcaAgentSchema).min(1).refine((agents) => new Set(agents).size === agents.length, "Agent ids must be unique.").default(DEFAULT_ORCA_AGENTS)
26848
+ });
26849
+ var orcaContextSchema = z4.object({
26850
+ runtimeId: identifier,
26851
+ coordinatorHandle: identifier,
26852
+ executionHostId: z4.literal("local")
26853
+ });
26854
+ var orcaRoutingRunSchema = z4.object({
26855
+ runId: identifier.nullable(),
26856
+ unconfiguredAgents: z4.array(orcaAgentSchema)
26857
+ });
26858
+ var orcaLaunchSchema = z4.object({
26859
+ projectId: identifier,
26860
+ projectRoot: identifier,
26861
+ taskId: identifier,
26862
+ instanceId: identifier,
26863
+ workerSessionId: identifier,
26864
+ agentId: identifier,
26865
+ role: z4.enum(["worker", "lead"]),
26866
+ protocol: identifier,
26867
+ worktreePath: identifier,
26868
+ worktreeBranch: identifier,
26869
+ projectHash: identifier,
26870
+ lockToken: identifier,
26871
+ prompt: identifier,
26872
+ harness: z4.enum(["claude-code", "codex", "opencode", "grok", "kimi"]),
26873
+ leadMailbox: identifier.nullable(),
26874
+ model: identifier.optional(),
26875
+ effort: identifier.optional(),
26876
+ accountId: identifier.optional()
26877
+ });
26878
+ var orcaStartBindingSchema = z4.object({
26879
+ runId: identifier.nullable(),
26880
+ orcaTaskId: identifier.nullable(),
26881
+ retryOf: identifier.nullable()
26882
+ });
26883
+ var orcaAttemptSchema = z4.object({
26884
+ backend: z4.literal("orca"),
26885
+ version: z4.literal(1),
26886
+ /** Monotonic local CAS revision; repeated identical observations still serialize. */
26887
+ revision: z4.number().int().nonnegative(),
26888
+ context: orcaContextSchema,
26889
+ launch: orcaLaunchSchema,
26890
+ promptDigest: z4.string().regex(/^[a-f0-9]{64}$/),
26891
+ workspaceId: identifier,
26892
+ workspaceSelector: identifier,
26893
+ state: z4.enum([
26894
+ "prepared",
26895
+ "launching",
26896
+ "ready",
26897
+ "turn_unobserved",
26898
+ "outcome_unknown",
26899
+ "stop_pending",
26900
+ "stop_unknown",
26901
+ "stopped",
26902
+ "failed",
26903
+ "circuit_broken"
26904
+ ]),
26905
+ runId: identifier.nullable(),
26906
+ orcaTaskId: identifier.nullable(),
26907
+ dispatchId: identifier.nullable(),
26908
+ retryOf: identifier.nullable(),
26909
+ /** Absent on legacy records, whose original argv cannot safely be reconstructed. */
26910
+ startBinding: orcaStartBindingSchema.optional(),
26911
+ /** UUID reserved before committing a retry; its first send and every replay use this key. */
26912
+ startRequestKey: z4.string().uuid().optional(),
26913
+ startRequestId: identifier.nullable(),
26914
+ /** UUID reserved before committing a stop; its first send and every replay use this key. */
26915
+ stopRequestKey: z4.string().uuid().optional(),
26916
+ /** Orca-issued stop request id, retained only when the stop receipt was received. */
26917
+ stopRequestId: identifier.nullable(),
26918
+ /**
26919
+ * Set when the worker-stop reply came from a runtime that proved it enumerates
26920
+ * every helper it stopped, so an omitted helper list means the worker had none.
26921
+ */
26922
+ stopHelperEvidence: z4.literal("enumerated").optional(),
26923
+ failureCount: z4.number().int().nonnegative(),
26924
+ resourceState: z4.string(),
26925
+ /** Full receipts retain effects, residual resources and recovery advice. */
26926
+ lastReceipt: z4.string().nullable(),
26927
+ lastError: z4.string().nullable(),
26928
+ /** Confirmed pre-dispatch refusal; never inferred from a process exit. */
26929
+ startRefusal: z4.literal("agent_unconfigured").optional(),
26930
+ observedAt: z4.string()
26931
+ });
26932
+ var orcaWorkerDoneSchema = z4.object({
26933
+ messageId: identifier,
26934
+ runtimeId: identifier,
26935
+ runId: identifier,
26936
+ orcaTaskId: identifier,
26937
+ dispatchId: identifier,
26938
+ senderHandle: identifier,
26939
+ outcome: z4.enum(["succeeded", "failed"]),
26940
+ body: z4.string(),
26941
+ reportPath: identifier
26942
+ });
26943
+ var orcaWorkerReportSchema = z4.object({
26944
+ event: orcaWorkerDoneSchema,
26945
+ manifestId: identifier,
26946
+ manifestDigest: z4.string().regex(/^[a-f0-9]{64}$/),
26947
+ reportText: z4.string().min(1).max(65536),
26948
+ reportDigest: z4.string().regex(/^[a-f0-9]{64}$/),
26949
+ ingestedAt: z4.string().datetime()
26950
+ });
26951
+ var orcaReportDeliverySchema = z4.object({
26952
+ key: identifier,
26953
+ mailbox: identifier.nullable(),
26954
+ state: z4.enum(["pending", "delivered"]),
26955
+ messageId: identifier.nullable(),
26956
+ deliveredAt: z4.string().datetime().nullable(),
26957
+ lastError: z4.string().nullable()
26958
+ });
26959
+ var orcaWorkerSettlementSchema = z4.object({
26960
+ resourceRelease: z4.object({
26961
+ dispatchId: identifier,
26962
+ releasedAt: z4.string().datetime(),
26963
+ receiptDigest: z4.string().regex(/^[a-f0-9]{64}$/),
26964
+ receipt: identifier
26965
+ }).optional(),
26966
+ retiredAt: z4.string().datetime().optional(),
26967
+ reportDelivery: orcaReportDeliverySchema.optional()
26968
+ });
26969
+ var orcaReportMessageSchema = z4.object({
26970
+ id: identifier,
26971
+ run_id: z4.string().nullable(),
26972
+ delivery_contract: z4.string(),
26973
+ from_handle: z4.string(),
26974
+ to_handle: z4.string(),
26975
+ type: z4.string(),
26976
+ body: z4.string(),
26977
+ payload: z4.string().nullable(),
26978
+ sender_pane_key: z4.string().nullable()
26979
+ });
26980
+ var orcaReportSourceSchema = z4.object({
26981
+ ok: z4.literal(true),
26982
+ _meta: z4.object({ runtimeId: identifier }),
26983
+ result: z4.object({
26984
+ messages: z4.array(z4.json()).optional(),
26985
+ dispatch: z4.object({
26986
+ id: identifier,
26987
+ run_id: identifier,
26988
+ task_id: identifier,
26989
+ assignee_handle: identifier,
26990
+ assignee_pane_key: z4.string().nullable(),
26991
+ status: z4.string()
26992
+ }).optional()
26993
+ })
26994
+ });
26995
+ var orcaWorkerDonePayloadSchema = z4.object({
26996
+ taskId: identifier,
26997
+ dispatchId: identifier,
26998
+ outcome: z4.enum(["succeeded", "failed"]),
26999
+ reportPath: identifier
27000
+ });
27001
+ var orcaWorkerRequestSchema = z4.object({
27002
+ action: z4.enum([
27003
+ "show",
27004
+ "read",
27005
+ "recover-start",
27006
+ "recover-stop",
27007
+ "retry",
27008
+ "stop",
27009
+ "ingest-report",
27010
+ "relay-report"
27011
+ ]),
27012
+ recordId: identifier,
27013
+ cursor: identifier.optional(),
27014
+ messageId: identifier.optional()
27015
+ }).refine(({ action, cursor }) => cursor === void 0 || action === "read", {
27016
+ message: "A source-pinned cursor is accepted only for read.",
27017
+ path: ["cursor"]
27018
+ }).refine(({ action, messageId }) => action === "ingest-report" === (messageId !== void 0), {
27019
+ message: "ingest-report requires an exact message id; other actions do not accept one.",
27020
+ path: ["messageId"]
27021
+ });
27022
+ var effectSchema = z4.object({
27023
+ kind: z4.string(),
27024
+ role: z4.string().optional(),
27025
+ action: z4.string().optional(),
27026
+ id: z4.string().optional()
27027
+ });
27028
+ var selectionSchema = z4.object({
27029
+ agent: z4.string().nullable().optional(),
27030
+ model: z4.string().nullable().optional(),
27031
+ effort: z4.string().nullable().optional()
27032
+ });
27033
+ var orcaReplySchema = z4.object({
27034
+ ok: z4.boolean(),
27035
+ _meta: z4.object({ runtimeId: z4.string().nullable() }).optional(),
27036
+ error: z4.object({
27037
+ code: z4.string(),
27038
+ message: z4.string(),
27039
+ data: z4.object({
27040
+ requestId: identifier.optional(),
27041
+ orchestrationRequestId: identifier.optional(),
27042
+ dispatchId: identifier.optional()
27043
+ }).optional()
27044
+ }).optional(),
27045
+ result: z4.object({
27046
+ state: z4.string().optional(),
27047
+ requestId: identifier.optional(),
27048
+ /**
27049
+ * Mutation ledger identity Orca stamps on every successful mutation result.
27050
+ * @remarks Installed Orca 1.4.255 attaches `{ requestId, replayed }` to the
27051
+ * result it records (`Jy` in the retained source), so a successful stop can
27052
+ * be bound to the request key this attempt issued.
27053
+ */
27054
+ mutation: z4.object({
27055
+ requestId: identifier.optional(),
27056
+ replayed: z4.boolean().optional()
27057
+ }).optional(),
27058
+ stage: z4.string().optional(),
27059
+ turnStart: z4.string().optional(),
27060
+ runId: identifier.optional(),
27061
+ run: z4.object({ id: identifier }).nullable().optional(),
27062
+ taskId: identifier.optional(),
27063
+ dispatchId: identifier.optional(),
27064
+ failureCount: z4.number().int().nonnegative().optional(),
27065
+ effects: z4.array(effectSchema).optional(),
27066
+ residualResources: z4.array(effectSchema).optional(),
27067
+ launch: z4.object({ effective: selectionSchema.optional() }).optional(),
27068
+ lastError: z4.string().nullable().optional(),
27069
+ processAction: z4.string().optional(),
27070
+ helpers: z4.array(
27071
+ z4.object({
27072
+ dispatchId: identifier.optional(),
27073
+ creatorDispatchId: identifier.optional(),
27074
+ outcome: z4.string(),
27075
+ keptOpenBy: identifier.optional(),
27076
+ state: z4.string().optional(),
27077
+ lastError: z4.string().nullable().optional()
27078
+ })
27079
+ ).optional(),
27080
+ helperStopError: z4.string().nullable().optional(),
27081
+ status: z4.string().optional(),
27082
+ terminal: z4.object({
27083
+ handle: identifier,
27084
+ connected: z4.boolean(),
27085
+ writable: z4.boolean(),
27086
+ executionHostId: identifier
27087
+ }).optional(),
27088
+ runtime: z4.object({
27089
+ runtimeId: identifier,
27090
+ reachable: z4.boolean(),
27091
+ state: z4.string(),
27092
+ capabilities: z4.array(z4.string())
27093
+ }).optional(),
27094
+ worktree: z4.object({
27095
+ id: identifier,
27096
+ path: identifier,
27097
+ branch: identifier,
27098
+ hostId: identifier,
27099
+ address: z4.object({ worktree: identifier }).optional()
27100
+ }).optional(),
27101
+ dispatch: z4.object({
27102
+ id: identifier,
27103
+ runId: identifier,
27104
+ taskId: identifier,
27105
+ /** Direct creator Dispatch that started this one; null for a Run root. */
27106
+ creatorDispatchId: identifier.nullable().optional(),
27107
+ failureCount: z4.number().int().nonnegative()
27108
+ }).optional(),
27109
+ worker: z4.object({
27110
+ dispatchId: identifier,
27111
+ runtimeEpoch: identifier,
27112
+ state: z4.string(),
27113
+ stage: z4.string(),
27114
+ worktreeId: identifier.nullable()
27115
+ }).optional(),
27116
+ observation: z4.object({ status: z4.string(), exactWorker: z4.boolean().optional() }).optional(),
27117
+ projection: z4.object({
27118
+ resource: z4.object({
27119
+ state: z4.string(),
27120
+ terminalState: z4.string(),
27121
+ ownerDispatchId: identifier.optional(),
27122
+ releaseState: z4.string().optional()
27123
+ }).optional()
27124
+ }).optional()
27125
+ }).optional()
27126
+ });
27127
+ var orcaCommandRegistrySchema = z4.object({
27128
+ schemaVersion: z4.number().int().positive(),
27129
+ commands: z4.array(z4.object({ command: identifier, flags: z4.array(z4.string()) }))
27130
+ });
27131
+ var accountProviderSchema = z4.object({
27132
+ accounts: z4.array(z4.object({})),
27133
+ activeAccountId: identifier.nullable()
27134
+ });
27135
+ var orcaAccountReplySchema = z4.object({
27136
+ ok: z4.literal(true),
27137
+ _meta: z4.object({ runtimeId: identifier }),
27138
+ result: z4.object({
27139
+ codex: accountProviderSchema,
27140
+ opencode: accountProviderSchema,
27141
+ claude: accountProviderSchema
27142
+ })
27143
+ });
27144
+
27145
+ // packages/contracts/src/config/worker-policy.ts
27146
+ import { z as z5 } from "zod";
27147
+ var projectWorkerPolicySchema = z5.object({
27148
+ verification: z5.object({
27149
+ full: z5.enum(["local", "ci"]),
27150
+ local: z5.enum(["single-file", "affected"])
26847
27151
  }).strict().optional(),
26848
- instructions: z4.array(
26849
- z4.string().min(1).max(512).regex(/\S/).regex(
27152
+ instructions: z5.array(
27153
+ z5.string().min(1).max(512).regex(/\S/).regex(
26850
27154
  /^(?!\s*#)[^\p{Cc}\p{Cf}\p{Zl}\p{Zp}]+$/u,
26851
27155
  "Instructions must be single-line text without control characters or a leading #"
26852
27156
  )
@@ -26874,8 +27178,11 @@ var CLEO_CONFIG_MANIFEST = {
26874
27178
  path: ".cleo/config.json",
26875
27179
  mergePrecedence: 20,
26876
27180
  driftDetection: "schema-validate",
26877
- schema: z5.object({
26878
- orchestrate: z5.object({ workerPolicy: projectWorkerPolicySchema.optional() }).passthrough().optional()
27181
+ schema: z6.object({
27182
+ orchestrate: z6.object({
27183
+ workerPolicy: projectWorkerPolicySchema.optional(),
27184
+ orca: orchestrateOrcaConfigSchema.optional()
27185
+ }).passthrough().optional()
26879
27186
  }).passthrough()
26880
27187
  };
26881
27188
  var GLOBAL_CLEO_CONFIG_MANIFEST = {
@@ -26891,19 +27198,19 @@ var CONFIG_MANIFEST_ENTRIES = Object.freeze([
26891
27198
  GLOBAL_CLEO_CONFIG_MANIFEST,
26892
27199
  CLEO_CONFIG_MANIFEST
26893
27200
  ]);
26894
- var configManifestEntrySchema = z5.object({
26895
- id: z5.string().min(1),
26896
- scope: z5.union([z5.literal("global"), z5.literal("project"), z5.literal("metadata")]),
26897
- path: z5.string().min(1),
26898
- schema: z5.unknown().optional(),
26899
- mergePrecedence: z5.number().int().nonnegative(),
26900
- driftDetection: z5.union([
26901
- z5.literal("schema-validate"),
26902
- z5.literal("staleness-gate"),
26903
- z5.literal("value-diff"),
26904
- z5.literal("none")
27201
+ var configManifestEntrySchema = z6.object({
27202
+ id: z6.string().min(1),
27203
+ scope: z6.union([z6.literal("global"), z6.literal("project"), z6.literal("metadata")]),
27204
+ path: z6.string().min(1),
27205
+ schema: z6.unknown().optional(),
27206
+ mergePrecedence: z6.number().int().nonnegative(),
27207
+ driftDetection: z6.union([
27208
+ z6.literal("schema-validate"),
27209
+ z6.literal("staleness-gate"),
27210
+ z6.literal("value-diff"),
27211
+ z6.literal("none")
26905
27212
  ]),
26906
- defaults: z5.record(z5.string(), z5.unknown()).optional()
27213
+ defaults: z6.record(z6.string(), z6.unknown()).optional()
26907
27214
  });
26908
27215
 
26909
27216
  // packages/contracts/src/credentials.ts
@@ -26933,123 +27240,123 @@ function parseClaudeCodeCredentials(buf) {
26933
27240
  }
26934
27241
 
26935
27242
  // packages/contracts/src/daemon/health.ts
26936
- import { z as z7 } from "zod";
27243
+ import { z as z8 } from "zod";
26937
27244
 
26938
27245
  // packages/contracts/src/supervisor-ipc/messages.ts
26939
- import { z as z6 } from "zod";
26940
- var EnvPairSchema = z6.object({
27246
+ import { z as z7 } from "zod";
27247
+ var EnvPairSchema = z7.object({
26941
27248
  /** Environment variable name. */
26942
- key: z6.string().min(1),
27249
+ key: z7.string().min(1),
26943
27250
  /** Environment variable value. */
26944
- value: z6.string()
27251
+ value: z7.string()
26945
27252
  }).strict();
26946
- var ChildStateSchema = z6.enum(["running", "restarting", "stopped"]);
26947
- var ChildStatusSchema = z6.object({
27253
+ var ChildStateSchema = z7.enum(["running", "restarting", "stopped"]);
27254
+ var ChildStatusSchema = z7.object({
26948
27255
  /** Logical id of the child (stable across restarts). */
26949
- child_id: z6.string().min(1),
27256
+ child_id: z7.string().min(1),
26950
27257
  /** Current OS pid (0 when not currently running). */
26951
- pid: z6.number().int().nonnegative(),
27258
+ pid: z7.number().int().nonnegative(),
26952
27259
  /** Current liveness state. */
26953
27260
  state: ChildStateSchema,
26954
27261
  /** Total restarts observed for this child. */
26955
- restart_count: z6.number().int().nonnegative()
27262
+ restart_count: z7.number().int().nonnegative()
26956
27263
  }).strict();
26957
- var SpawnRequestSchema = z6.object({
27264
+ var SpawnRequestSchema = z7.object({
26958
27265
  /** Tag discriminating this request variant. */
26959
- kind: z6.literal("spawn"),
27266
+ kind: z7.literal("spawn"),
26960
27267
  /** Caller-chosen logical id for the child (stable across restarts). */
26961
- child_id: z6.string().min(1),
27268
+ child_id: z7.string().min(1),
26962
27269
  /** Absolute path to the program to execute. */
26963
- program: z6.string().min(1),
27270
+ program: z7.string().min(1),
26964
27271
  /** Arguments passed to the program. */
26965
- args: z6.array(z6.string()).default([]),
27272
+ args: z7.array(z7.string()).default([]),
26966
27273
  /** Environment overrides applied on top of the supervisor's environment. */
26967
- env: z6.array(EnvPairSchema).default([]),
27274
+ env: z7.array(EnvPairSchema).default([]),
26968
27275
  /** Optional working directory for the child. */
26969
- cwd: z6.string().optional()
27276
+ cwd: z7.string().optional()
26970
27277
  }).strict();
26971
- var RestartRequestSchema = z6.object({
27278
+ var RestartRequestSchema = z7.object({
26972
27279
  /** Tag discriminating this request variant. */
26973
- kind: z6.literal("restart"),
27280
+ kind: z7.literal("restart"),
26974
27281
  /** Logical id of the child to restart. */
26975
- child_id: z6.string().min(1)
27282
+ child_id: z7.string().min(1)
26976
27283
  }).strict();
26977
- var MonitorRequestSchema = z6.object({
27284
+ var MonitorRequestSchema = z7.object({
26978
27285
  /** Tag discriminating this request variant. */
26979
- kind: z6.literal("monitor"),
27286
+ kind: z7.literal("monitor"),
26980
27287
  /** Specific child id to monitor; omit to request all children. */
26981
- child_id: z6.string().optional()
27288
+ child_id: z7.string().optional()
26982
27289
  }).strict();
26983
- var HealthRequestSchema = z6.object({
27290
+ var HealthRequestSchema = z7.object({
26984
27291
  /** Tag discriminating this request variant. */
26985
- kind: z6.literal("health")
27292
+ kind: z7.literal("health")
26986
27293
  }).strict();
26987
- var SupervisorIpcRequestSchema = z6.discriminatedUnion("kind", [
27294
+ var SupervisorIpcRequestSchema = z7.discriminatedUnion("kind", [
26988
27295
  SpawnRequestSchema,
26989
27296
  RestartRequestSchema,
26990
27297
  MonitorRequestSchema,
26991
27298
  HealthRequestSchema
26992
27299
  ]);
26993
- var SpawnedResponseSchema = z6.object({
27300
+ var SpawnedResponseSchema = z7.object({
26994
27301
  /** Tag discriminating this response variant. */
26995
- kind: z6.literal("spawned"),
27302
+ kind: z7.literal("spawned"),
26996
27303
  /** Logical id of the spawned child. */
26997
- child_id: z6.string().min(1),
27304
+ child_id: z7.string().min(1),
26998
27305
  /** OS pid assigned to the spawned child. */
26999
- pid: z6.number().int().nonnegative()
27306
+ pid: z7.number().int().nonnegative()
27000
27307
  }).strict();
27001
- var RestartedResponseSchema = z6.object({
27308
+ var RestartedResponseSchema = z7.object({
27002
27309
  /** Tag discriminating this response variant. */
27003
- kind: z6.literal("restarted"),
27310
+ kind: z7.literal("restarted"),
27004
27311
  /** Logical id of the restarted child. */
27005
- child_id: z6.string().min(1),
27312
+ child_id: z7.string().min(1),
27006
27313
  /** New OS pid after the restart. */
27007
- pid: z6.number().int().nonnegative(),
27314
+ pid: z7.number().int().nonnegative(),
27008
27315
  /** Number of times this child has been restarted in total. */
27009
- restart_count: z6.number().int().nonnegative()
27316
+ restart_count: z7.number().int().nonnegative()
27010
27317
  }).strict();
27011
- var MonitorResponseSchema = z6.object({
27318
+ var MonitorResponseSchema = z7.object({
27012
27319
  /** Tag discriminating this response variant. */
27013
- kind: z6.literal("monitor"),
27320
+ kind: z7.literal("monitor"),
27014
27321
  /** One row per monitored child. */
27015
- children: z6.array(ChildStatusSchema)
27322
+ children: z7.array(ChildStatusSchema)
27016
27323
  }).strict();
27017
- var HealthResponseSchema = z6.object({
27324
+ var HealthResponseSchema = z7.object({
27018
27325
  /** Tag discriminating this response variant. */
27019
- kind: z6.literal("health"),
27326
+ kind: z7.literal("health"),
27020
27327
  /** Supervisor process pid. */
27021
- pid: z6.number().int().nonnegative(),
27328
+ pid: z7.number().int().nonnegative(),
27022
27329
  /** Number of children currently tracked. */
27023
- child_count: z6.number().int().nonnegative(),
27330
+ child_count: z7.number().int().nonnegative(),
27024
27331
  /** Seconds the supervisor has been running. */
27025
- uptime_secs: z6.number().int().nonnegative(),
27332
+ uptime_secs: z7.number().int().nonnegative(),
27026
27333
  /** Frozen protocol version the supervisor speaks. */
27027
- protocol_version: z6.string()
27334
+ protocol_version: z7.string()
27028
27335
  }).strict();
27029
- var LifecycleEventKindSchema = z6.enum(["child_exited", "child_restarted"]);
27030
- var LifecycleEventResponseSchema = z6.object({
27336
+ var LifecycleEventKindSchema = z7.enum(["child_exited", "child_restarted"]);
27337
+ var LifecycleEventResponseSchema = z7.object({
27031
27338
  /** Tag discriminating this response variant. */
27032
- kind: z6.literal("event"),
27339
+ kind: z7.literal("event"),
27033
27340
  /** What happened. */
27034
27341
  event: LifecycleEventKindSchema,
27035
27342
  /** Logical id of the affected child. */
27036
- child_id: z6.string().min(1),
27343
+ child_id: z7.string().min(1),
27037
27344
  /** Exit code, when the OS reported one. */
27038
- exit_code: z6.number().int().optional(),
27345
+ exit_code: z7.number().int().optional(),
27039
27346
  /** Terminating signal name, when the child was signalled (Unix). */
27040
- signal: z6.string().optional(),
27347
+ signal: z7.string().optional(),
27041
27348
  /** Backoff delay (ms) before the pending restart, when applicable. */
27042
- restart_delay_ms: z6.number().int().nonnegative().optional()
27349
+ restart_delay_ms: z7.number().int().nonnegative().optional()
27043
27350
  }).strict();
27044
- var ErrorResponseSchema = z6.object({
27351
+ var ErrorResponseSchema = z7.object({
27045
27352
  /** Tag discriminating this response variant. */
27046
- kind: z6.literal("error"),
27353
+ kind: z7.literal("error"),
27047
27354
  /** Machine-readable error code (e.g. `E_UNKNOWN_CHILD`). */
27048
- code: z6.string().min(1),
27355
+ code: z7.string().min(1),
27049
27356
  /** Human-readable error message. */
27050
- message: z6.string()
27357
+ message: z7.string()
27051
27358
  }).strict();
27052
- var SupervisorIpcResponseSchema = z6.discriminatedUnion("kind", [
27359
+ var SupervisorIpcResponseSchema = z7.discriminatedUnion("kind", [
27053
27360
  SpawnedResponseSchema,
27054
27361
  RestartedResponseSchema,
27055
27362
  MonitorResponseSchema,
@@ -27057,27 +27364,27 @@ var SupervisorIpcResponseSchema = z6.discriminatedUnion("kind", [
27057
27364
  LifecycleEventResponseSchema,
27058
27365
  ErrorResponseSchema
27059
27366
  ]);
27060
- var SupervisorIpcRequestEnvelopeSchema = z6.object({
27367
+ var SupervisorIpcRequestEnvelopeSchema = z7.object({
27061
27368
  /** Frozen protocol version. */
27062
- protocol_version: z6.string(),
27369
+ protocol_version: z7.string(),
27063
27370
  /** Correlation id echoed back on the matching response. */
27064
- id: z6.string().min(1),
27371
+ id: z7.string().min(1),
27065
27372
  /** Direction discriminator. */
27066
- direction: z6.literal("request"),
27373
+ direction: z7.literal("request"),
27067
27374
  /** The request body. */
27068
27375
  request: SupervisorIpcRequestSchema
27069
27376
  }).strict();
27070
- var SupervisorIpcResponseEnvelopeSchema = z6.object({
27377
+ var SupervisorIpcResponseEnvelopeSchema = z7.object({
27071
27378
  /** Frozen protocol version. */
27072
- protocol_version: z6.string(),
27379
+ protocol_version: z7.string(),
27073
27380
  /** Correlation id echoed from the originating request (or a fresh id for events). */
27074
- id: z6.string().min(1),
27381
+ id: z7.string().min(1),
27075
27382
  /** Direction discriminator. */
27076
- direction: z6.literal("response"),
27383
+ direction: z7.literal("response"),
27077
27384
  /** The response body. */
27078
27385
  response: SupervisorIpcResponseSchema
27079
27386
  }).strict();
27080
- var SupervisorIpcEnvelopeSchema = z6.discriminatedUnion("direction", [
27387
+ var SupervisorIpcEnvelopeSchema = z7.discriminatedUnion("direction", [
27081
27388
  SupervisorIpcRequestEnvelopeSchema,
27082
27389
  SupervisorIpcResponseEnvelopeSchema
27083
27390
  ]);
@@ -27101,17 +27408,17 @@ var SubsystemHealthSchema = ChildStatusSchema.extend({
27101
27408
  * Optional human-readable detail (e.g. last error message, queue depth).
27102
27409
  * Diagnostic only — not part of the supervisor wire contract.
27103
27410
  */
27104
- detail: z7.string().optional()
27411
+ detail: z8.string().optional()
27105
27412
  }).strict();
27106
- var HealthStatusSchema = z7.object({
27413
+ var HealthStatusSchema = z8.object({
27107
27414
  /** One health row per registered subsystem. */
27108
- subsystems: z7.array(SubsystemHealthSchema),
27415
+ subsystems: z8.array(SubsystemHealthSchema),
27109
27416
  /**
27110
27417
  * `true` iff every subsystem is in the `running` state. A convenience roll-up
27111
27418
  * derived from {@link HealthStatusSchema.shape.subsystems}; recomputed by
27112
27419
  * {@link summarizeHealth} so producers cannot desync it.
27113
27420
  */
27114
- allHealthy: z7.boolean()
27421
+ allHealthy: z8.boolean()
27115
27422
  }).strict();
27116
27423
 
27117
27424
  // packages/contracts/src/db-inventory.json
@@ -39040,7 +39347,7 @@ var OPERATIONS = [
39040
39347
  ];
39041
39348
 
39042
39349
  // packages/contracts/src/docs/modernize.ts
39043
- import { z as z8 } from "zod";
39350
+ import { z as z9 } from "zod";
39044
39351
  var DOCS_MODERNIZE_DISPOSITIONS = ["keep", "rename", "merge-into", "delete"];
39045
39352
  var DOCS_MODERNIZE_OPS = [
39046
39353
  "ingest",
@@ -39054,105 +39361,105 @@ var DOCS_MODERNIZE_OPS = [
39054
39361
  "reslug",
39055
39362
  "link-task"
39056
39363
  ];
39057
- var judgmentSchema = z8.object({
39058
- question: z8.enum(["classify", "merge"]),
39059
- site: z8.string(),
39060
- mode: z8.enum(["off", "shadow", "on"]),
39061
- ruleAnswer: z8.string(),
39062
- decidedAnswer: z8.string().nullable(),
39063
- decidedConfidence: z8.number().nullable(),
39064
- source: z8.enum(["provider", "cache", "fallback"]),
39065
- acted: z8.string()
39066
- });
39067
- var relPath = z8.string().min(1).max(1024);
39068
- var docsModernizePlanSchema = z8.object({
39069
- root: z8.string().min(1),
39070
- generatedAt: z8.string(),
39071
- mode: z8.enum(["tree", "store-only"]),
39072
- counts: z8.record(z8.enum(DOCS_MODERNIZE_DISPOSITIONS), z8.number()),
39073
- rows: z8.array(
39074
- z8.object({
39364
+ var judgmentSchema = z9.object({
39365
+ question: z9.enum(["classify", "merge"]),
39366
+ site: z9.string(),
39367
+ mode: z9.enum(["off", "shadow", "on"]),
39368
+ ruleAnswer: z9.string(),
39369
+ decidedAnswer: z9.string().nullable(),
39370
+ decidedConfidence: z9.number().nullable(),
39371
+ source: z9.enum(["provider", "cache", "fallback"]),
39372
+ acted: z9.string()
39373
+ });
39374
+ var relPath = z9.string().min(1).max(1024);
39375
+ var docsModernizePlanSchema = z9.object({
39376
+ root: z9.string().min(1),
39377
+ generatedAt: z9.string(),
39378
+ mode: z9.enum(["tree", "store-only"]),
39379
+ counts: z9.record(z9.enum(DOCS_MODERNIZE_DISPOSITIONS), z9.number()),
39380
+ rows: z9.array(
39381
+ z9.object({
39075
39382
  path: relPath,
39076
- sha256: z8.string().regex(/^[0-9a-f]{64}$/),
39077
- kind: z8.string().min(1),
39078
- slug: z8.string().regex(/^[a-z0-9][a-z0-9-]*$/),
39079
- title: z8.string(),
39080
- disposition: z8.enum(DOCS_MODERNIZE_DISPOSITIONS),
39081
- target: z8.string().min(1).max(1024).nullable(),
39082
- reasons: z8.array(z8.string()),
39083
- judgments: z8.array(judgmentSchema),
39084
- ownerTasks: z8.array(z8.string().regex(/^[TD]\d+$/)),
39085
- category: z8.string(),
39086
- refs: z8.array(z8.string()),
39087
- overridden: z8.boolean(),
39088
- covers: z8.array(z8.string()),
39089
- baselineRemove: z8.boolean()
39383
+ sha256: z9.string().regex(/^[0-9a-f]{64}$/),
39384
+ kind: z9.string().min(1),
39385
+ slug: z9.string().regex(/^[a-z0-9][a-z0-9-]*$/),
39386
+ title: z9.string(),
39387
+ disposition: z9.enum(DOCS_MODERNIZE_DISPOSITIONS),
39388
+ target: z9.string().min(1).max(1024).nullable(),
39389
+ reasons: z9.array(z9.string()),
39390
+ judgments: z9.array(judgmentSchema),
39391
+ ownerTasks: z9.array(z9.string().regex(/^[TD]\d+$/)),
39392
+ category: z9.string(),
39393
+ refs: z9.array(z9.string()),
39394
+ overridden: z9.boolean(),
39395
+ covers: z9.array(z9.string()),
39396
+ baselineRemove: z9.boolean()
39090
39397
  })
39091
39398
  ),
39092
- linkFixes: z8.array(
39093
- z8.object({
39094
- kind: z8.literal("link-fix"),
39399
+ linkFixes: z9.array(
39400
+ z9.object({
39401
+ kind: z9.literal("link-fix"),
39095
39402
  path: relPath,
39096
- href: z8.string().min(1).max(2048),
39097
- newHref: z8.string().min(1).max(2048),
39098
- base: z8.literal("repo").optional(),
39099
- sha256: z8.string().regex(/^[0-9a-f]{64}$/).optional()
39403
+ href: z9.string().min(1).max(2048),
39404
+ newHref: z9.string().min(1).max(2048),
39405
+ base: z9.literal("repo").optional(),
39406
+ sha256: z9.string().regex(/^[0-9a-f]{64}$/).optional()
39100
39407
  })
39101
39408
  ).optional(),
39102
- repoRoot: z8.string().min(1).optional()
39409
+ repoRoot: z9.string().min(1).optional()
39103
39410
  });
39104
- var docsModernizeOverridesSchema = z8.record(
39411
+ var docsModernizeOverridesSchema = z9.record(
39105
39412
  relPath,
39106
- z8.object({
39107
- disposition: z8.enum(DOCS_MODERNIZE_DISPOSITIONS),
39108
- target: z8.string().min(1).max(1024).nullable().optional(),
39109
- reason: z8.string().min(1),
39110
- kind: z8.string().min(1).optional(),
39111
- slug: z8.string().regex(/^[a-z0-9][a-z0-9-]*$/).optional(),
39112
- covers: z8.array(z8.string()).optional()
39413
+ z9.object({
39414
+ disposition: z9.enum(DOCS_MODERNIZE_DISPOSITIONS),
39415
+ target: z9.string().min(1).max(1024).nullable().optional(),
39416
+ reason: z9.string().min(1),
39417
+ kind: z9.string().min(1).optional(),
39418
+ slug: z9.string().regex(/^[a-z0-9][a-z0-9-]*$/).optional(),
39419
+ covers: z9.array(z9.string()).optional()
39113
39420
  })
39114
39421
  );
39115
- var receiptOpSchema = z8.object({
39116
- op: z8.enum(DOCS_MODERNIZE_OPS),
39117
- state: z8.enum(["pending", "done", "reversed"]),
39118
- slug: z8.string().nullable(),
39422
+ var receiptOpSchema = z9.object({
39423
+ op: z9.enum(DOCS_MODERNIZE_OPS),
39424
+ state: z9.enum(["pending", "done", "reversed"]),
39425
+ slug: z9.string().nullable(),
39119
39426
  path: relPath.nullable(),
39120
- target: z8.string().nullable(),
39121
- attachmentId: z8.string().nullable(),
39122
- ownerId: z8.string().nullable(),
39123
- beforeSha256: z8.string().regex(/^[0-9a-f]{64}$/).nullable(),
39124
- afterSha256: z8.string().regex(/^[0-9a-f]{64}$/).nullable(),
39125
- prior: z8.object({
39126
- lifecycleStatus: z8.string().nullable().optional(),
39127
- supersededBy: z8.string().nullable().optional(),
39128
- supersedes: z8.string().nullable().optional(),
39129
- previousAttachmentId: z8.string().nullable().optional(),
39130
- newAttachmentId: z8.string().nullable().optional(),
39131
- linkTargets: z8.array(z8.string()).optional(),
39132
- kind: z8.string().nullable().optional()
39427
+ target: z9.string().nullable(),
39428
+ attachmentId: z9.string().nullable(),
39429
+ ownerId: z9.string().nullable(),
39430
+ beforeSha256: z9.string().regex(/^[0-9a-f]{64}$/).nullable(),
39431
+ afterSha256: z9.string().regex(/^[0-9a-f]{64}$/).nullable(),
39432
+ prior: z9.object({
39433
+ lifecycleStatus: z9.string().nullable().optional(),
39434
+ supersededBy: z9.string().nullable().optional(),
39435
+ supersedes: z9.string().nullable().optional(),
39436
+ previousAttachmentId: z9.string().nullable().optional(),
39437
+ newAttachmentId: z9.string().nullable().optional(),
39438
+ linkTargets: z9.array(z9.string()).optional(),
39439
+ kind: z9.string().nullable().optional()
39133
39440
  }).optional(),
39134
- base: z8.literal("repo").optional()
39441
+ base: z9.literal("repo").optional()
39135
39442
  });
39136
39443
  var docsModernizeJournalLineSchema = receiptOpSchema.extend({
39137
- i: z8.number().int().min(0)
39138
- });
39139
- var docsModernizeReceiptSchema = z8.object({
39140
- runId: z8.string().regex(/^dm-[\w-]+$/),
39141
- root: z8.string().min(1),
39142
- appliedAt: z8.string(),
39143
- planSha256: z8.string(),
39144
- edgeCount: z8.number(),
39145
- rolledBackAt: z8.string().nullable(),
39146
- blobs: z8.array(z8.object({ path: relPath, sha256: z8.string() })),
39147
- moves: z8.array(z8.object({ from: relPath, to: relPath })),
39148
- deleted: z8.array(relPath),
39149
- ops: z8.array(receiptOpSchema),
39150
- durationMs: z8.number().optional(),
39151
- repoRoot: z8.string().min(1).optional()
39444
+ i: z9.number().int().min(0)
39445
+ });
39446
+ var docsModernizeReceiptSchema = z9.object({
39447
+ runId: z9.string().regex(/^dm-[\w-]+$/),
39448
+ root: z9.string().min(1),
39449
+ appliedAt: z9.string(),
39450
+ planSha256: z9.string(),
39451
+ edgeCount: z9.number(),
39452
+ rolledBackAt: z9.string().nullable(),
39453
+ blobs: z9.array(z9.object({ path: relPath, sha256: z9.string() })),
39454
+ moves: z9.array(z9.object({ from: relPath, to: relPath })),
39455
+ deleted: z9.array(relPath),
39456
+ ops: z9.array(receiptOpSchema),
39457
+ durationMs: z9.number().optional(),
39458
+ repoRoot: z9.string().min(1).optional()
39152
39459
  });
39153
39460
 
39154
39461
  // packages/contracts/src/docs/provenance.ts
39155
- import { z as z9 } from "zod";
39462
+ import { z as z10 } from "zod";
39156
39463
  var PROVENANCE_NODE_KINDS = [
39157
39464
  "doc",
39158
39465
  "task",
@@ -39175,96 +39482,96 @@ var DOC_LIFECYCLE_STATUSES = [
39175
39482
  "archived",
39176
39483
  "draft"
39177
39484
  ];
39178
- var provenanceNodeKindSchema = z9.enum(PROVENANCE_NODE_KINDS);
39179
- var provenanceEdgeRelationSchema = z9.enum(PROVENANCE_EDGE_RELATIONS);
39180
- var docLifecycleStatusSchema = z9.enum(DOC_LIFECYCLE_STATUSES);
39485
+ var provenanceNodeKindSchema = z10.enum(PROVENANCE_NODE_KINDS);
39486
+ var provenanceEdgeRelationSchema = z10.enum(PROVENANCE_EDGE_RELATIONS);
39487
+ var docLifecycleStatusSchema = z10.enum(DOC_LIFECYCLE_STATUSES);
39181
39488
  var provenanceNodeBaseFields = {
39182
- id: z9.string().min(1),
39183
- title: z9.string().min(1),
39184
- metadata: z9.record(z9.string(), z9.unknown()).optional()
39489
+ id: z10.string().min(1),
39490
+ title: z10.string().min(1),
39491
+ metadata: z10.record(z10.string(), z10.unknown()).optional()
39185
39492
  };
39186
- var provenanceDocNodeSchema = z9.object({
39493
+ var provenanceDocNodeSchema = z10.object({
39187
39494
  ...provenanceNodeBaseFields,
39188
- kind: z9.literal("doc"),
39189
- slug: z9.string().min(1),
39190
- docKind: z9.string().min(1),
39495
+ kind: z10.literal("doc"),
39496
+ slug: z10.string().min(1),
39497
+ docKind: z10.string().min(1),
39191
39498
  lifecycleStatus: docLifecycleStatusSchema,
39192
- publishedAt: z9.string().min(1),
39193
- supersededAt: z9.string().min(1).optional(),
39194
- summary: z9.string().optional()
39499
+ publishedAt: z10.string().min(1),
39500
+ supersededAt: z10.string().min(1).optional(),
39501
+ summary: z10.string().optional()
39195
39502
  });
39196
- var provenanceTaskNodeSchema = z9.object({
39503
+ var provenanceTaskNodeSchema = z10.object({
39197
39504
  ...provenanceNodeBaseFields,
39198
- kind: z9.literal("task"),
39199
- taskType: z9.enum(["saga", "epic", "task", "subtask"]),
39200
- status: z9.enum(["pending", "in_progress", "done", "blocked", "cancelled", "archived"])
39505
+ kind: z10.literal("task"),
39506
+ taskType: z10.enum(["saga", "epic", "task", "subtask"]),
39507
+ status: z10.enum(["pending", "in_progress", "done", "blocked", "cancelled", "archived"])
39201
39508
  });
39202
- var provenanceDecisionNodeSchema = z9.object({
39509
+ var provenanceDecisionNodeSchema = z10.object({
39203
39510
  ...provenanceNodeBaseFields,
39204
- kind: z9.literal("decision"),
39205
- outcome: z9.enum(["proposed", "accepted", "rejected", "superseded"]),
39206
- decidedAt: z9.string().min(1)
39511
+ kind: z10.literal("decision"),
39512
+ outcome: z10.enum(["proposed", "accepted", "rejected", "superseded"]),
39513
+ decidedAt: z10.string().min(1)
39207
39514
  });
39208
- var provenanceSessionNodeSchema = z9.object({
39515
+ var provenanceSessionNodeSchema = z10.object({
39209
39516
  ...provenanceNodeBaseFields,
39210
- kind: z9.literal("session"),
39211
- startedAt: z9.string().min(1),
39212
- endedAt: z9.string().min(1).optional()
39517
+ kind: z10.literal("session"),
39518
+ startedAt: z10.string().min(1),
39519
+ endedAt: z10.string().min(1).optional()
39213
39520
  });
39214
- var provenanceMemoryNodeSchema = z9.object({
39521
+ var provenanceMemoryNodeSchema = z10.object({
39215
39522
  ...provenanceNodeBaseFields,
39216
- kind: z9.literal("memory"),
39217
- memoryType: z9.enum(["observation", "pattern", "decision", "diary"]),
39218
- recordedAt: z9.string().min(1)
39523
+ kind: z10.literal("memory"),
39524
+ memoryType: z10.enum(["observation", "pattern", "decision", "diary"]),
39525
+ recordedAt: z10.string().min(1)
39219
39526
  });
39220
- var provenanceNodeSchema = z9.discriminatedUnion("kind", [
39527
+ var provenanceNodeSchema = z10.discriminatedUnion("kind", [
39221
39528
  provenanceDocNodeSchema,
39222
39529
  provenanceTaskNodeSchema,
39223
39530
  provenanceDecisionNodeSchema,
39224
39531
  provenanceSessionNodeSchema,
39225
39532
  provenanceMemoryNodeSchema
39226
39533
  ]);
39227
- var provenanceEdgeSchema = z9.object({
39534
+ var provenanceEdgeSchema = z10.object({
39228
39535
  relation: provenanceEdgeRelationSchema,
39229
- from: z9.string().min(1),
39536
+ from: z10.string().min(1),
39230
39537
  fromKind: provenanceNodeKindSchema,
39231
- to: z9.string().min(1),
39538
+ to: z10.string().min(1),
39232
39539
  toKind: provenanceNodeKindSchema,
39233
- addedAt: z9.string().min(1),
39234
- summary: z9.string().optional()
39540
+ addedAt: z10.string().min(1),
39541
+ summary: z10.string().optional()
39235
39542
  });
39236
- var docProvenanceResponseSchema = z9.object({
39237
- nodes: z9.array(provenanceNodeSchema).readonly(),
39238
- edges: z9.array(provenanceEdgeSchema).readonly(),
39239
- totalNodes: z9.number().int().nonnegative(),
39240
- totalEdges: z9.number().int().nonnegative()
39543
+ var docProvenanceResponseSchema = z10.object({
39544
+ nodes: z10.array(provenanceNodeSchema).readonly(),
39545
+ edges: z10.array(provenanceEdgeSchema).readonly(),
39546
+ totalNodes: z10.number().int().nonnegative(),
39547
+ totalEdges: z10.number().int().nonnegative()
39241
39548
  });
39242
39549
 
39243
39550
  // packages/contracts/src/docs/read.ts
39244
- import { z as z10 } from "zod";
39245
- var docFrontmatterSchema = z10.object({
39246
- slug: z10.string(),
39247
- kind: z10.string().nullable(),
39248
- title: z10.string().nullable(),
39249
- summary: z10.string().nullable(),
39250
- lifecycleStatus: z10.string(),
39251
- docVersion: z10.number().int(),
39252
- ownerVersion: z10.string().nullable(),
39253
- supersedes: z10.string().nullable(),
39254
- supersededBy: z10.string().nullable(),
39255
- topics: z10.array(z10.string()).readonly(),
39256
- relatedTasks: z10.array(z10.string()).readonly(),
39257
- sha256: z10.string(),
39258
- createdAt: z10.string()
39259
- });
39260
- var docBodySchema = z10.object({
39261
- encoding: z10.enum(["utf-8", "base64"]),
39262
- text: z10.string().optional(),
39263
- base64: z10.string().optional(),
39264
- sizeBytes: z10.number().int().nonnegative(),
39265
- mimeType: z10.string().nullable()
39266
- });
39267
- var docReadResponseSchema = z10.object({
39551
+ import { z as z11 } from "zod";
39552
+ var docFrontmatterSchema = z11.object({
39553
+ slug: z11.string(),
39554
+ kind: z11.string().nullable(),
39555
+ title: z11.string().nullable(),
39556
+ summary: z11.string().nullable(),
39557
+ lifecycleStatus: z11.string(),
39558
+ docVersion: z11.number().int(),
39559
+ ownerVersion: z11.string().nullable(),
39560
+ supersedes: z11.string().nullable(),
39561
+ supersededBy: z11.string().nullable(),
39562
+ topics: z11.array(z11.string()).readonly(),
39563
+ relatedTasks: z11.array(z11.string()).readonly(),
39564
+ sha256: z11.string(),
39565
+ createdAt: z11.string()
39566
+ });
39567
+ var docBodySchema = z11.object({
39568
+ encoding: z11.enum(["utf-8", "base64"]),
39569
+ text: z11.string().optional(),
39570
+ base64: z11.string().optional(),
39571
+ sizeBytes: z11.number().int().nonnegative(),
39572
+ mimeType: z11.string().nullable()
39573
+ });
39574
+ var docReadResponseSchema = z11.object({
39268
39575
  frontmatter: docFrontmatterSchema,
39269
39576
  body: docBodySchema
39270
39577
  });
@@ -39434,7 +39741,7 @@ function getErrorMessage(error48, fallback = "Unknown error") {
39434
39741
  }
39435
39742
 
39436
39743
  // packages/contracts/src/evidence-atom-schema.ts
39437
- import { z as z11 } from "zod";
39744
+ import { z as z12 } from "zod";
39438
39745
  var EVIDENCE_ATOM_KINDS = [
39439
39746
  "commit",
39440
39747
  "files",
@@ -39456,96 +39763,96 @@ var PARSER_PREFIXES = [...EVIDENCE_ATOM_KINDS, "state"];
39456
39763
  var KIND_BOUNDARY_REGEX = new RegExp(`;(?=\\s*(?:${PARSER_PREFIXES.join("|")})\\s*:)`, "g");
39457
39764
  var DEPLOY_PROVIDER_REGEX = /^[a-z0-9][a-z0-9._-]*$/;
39458
39765
  var DEPLOY_ID_REGEX = /^[^\s@|]+$/;
39459
- var commitAtomSchema = z11.object({
39460
- kind: z11.literal("commit"),
39461
- sha: z11.string().regex(/^[0-9a-f]{7,40}$/i, "commit sha must be 7-40 hex characters")
39462
- });
39463
- var filesAtomSchema = z11.object({
39464
- kind: z11.literal("files"),
39465
- paths: z11.array(z11.string().min(1)).min(1, "files atom requires at least one path")
39466
- });
39467
- var testRunAtomSchema = z11.object({
39468
- kind: z11.literal("test-run"),
39469
- path: z11.string().min(1, "test-run atom requires a non-empty path")
39470
- });
39471
- var qaRunAtomSchema = z11.object({
39472
- kind: z11.literal("qa-run"),
39473
- path: z11.string().min(1, "qa-run atom requires a non-empty path")
39474
- });
39475
- var toolAtomSchema = z11.object({
39476
- kind: z11.literal("tool"),
39477
- tool: z11.string().min(1, "tool atom requires a non-empty tool name")
39478
- });
39479
- var urlAtomSchema = z11.object({
39480
- kind: z11.literal("url"),
39481
- url: z11.string().min(1).regex(/^https?:\/\//, "url atom must start with http:// or https://")
39482
- });
39483
- var noteAtomSchema = z11.object({
39484
- kind: z11.literal("note"),
39485
- note: z11.string().min(1, "note atom must be non-empty").max(512, "note atom is too long (max 512 chars)")
39486
- });
39487
- var decisionAtomSchema = z11.object({
39488
- kind: z11.literal("decision"),
39489
- decisionId: z11.string().min(1, "decision atom requires a non-empty decision ID")
39490
- });
39491
- var prAtomSchema = z11.object({
39492
- kind: z11.literal("pr"),
39493
- prNumber: z11.number().int().positive("pr atom requires a positive integer PR number"),
39494
- componentPrNumber: z11.number().int().positive().optional(),
39766
+ var commitAtomSchema = z12.object({
39767
+ kind: z12.literal("commit"),
39768
+ sha: z12.string().regex(/^[0-9a-f]{7,40}$/i, "commit sha must be 7-40 hex characters")
39769
+ });
39770
+ var filesAtomSchema = z12.object({
39771
+ kind: z12.literal("files"),
39772
+ paths: z12.array(z12.string().min(1)).min(1, "files atom requires at least one path")
39773
+ });
39774
+ var testRunAtomSchema = z12.object({
39775
+ kind: z12.literal("test-run"),
39776
+ path: z12.string().min(1, "test-run atom requires a non-empty path")
39777
+ });
39778
+ var qaRunAtomSchema = z12.object({
39779
+ kind: z12.literal("qa-run"),
39780
+ path: z12.string().min(1, "qa-run atom requires a non-empty path")
39781
+ });
39782
+ var toolAtomSchema = z12.object({
39783
+ kind: z12.literal("tool"),
39784
+ tool: z12.string().min(1, "tool atom requires a non-empty tool name")
39785
+ });
39786
+ var urlAtomSchema = z12.object({
39787
+ kind: z12.literal("url"),
39788
+ url: z12.string().min(1).regex(/^https?:\/\//, "url atom must start with http:// or https://")
39789
+ });
39790
+ var noteAtomSchema = z12.object({
39791
+ kind: z12.literal("note"),
39792
+ note: z12.string().min(1, "note atom must be non-empty").max(512, "note atom is too long (max 512 chars)")
39793
+ });
39794
+ var decisionAtomSchema = z12.object({
39795
+ kind: z12.literal("decision"),
39796
+ decisionId: z12.string().min(1, "decision atom requires a non-empty decision ID")
39797
+ });
39798
+ var prAtomSchema = z12.object({
39799
+ kind: z12.literal("pr"),
39800
+ prNumber: z12.number().int().positive("pr atom requires a positive integer PR number"),
39801
+ componentPrNumber: z12.number().int().positive().optional(),
39495
39802
  /**
39496
39803
  * `pr:<owner>/<repo>#<n>` (T13912): the GitHub repository the PR number
39497
39804
  * belongs to, lowercased. Validated against the evidence git root's
39498
39805
  * `origin`, since PR numbers are only unique per repository.
39499
39806
  */
39500
- repo: z11.string().regex(/^[a-z0-9._-]+\/[a-z0-9._-]+$/).optional()
39807
+ repo: z12.string().regex(/^[a-z0-9._-]+\/[a-z0-9._-]+$/).optional()
39501
39808
  });
39502
- var ciAtomSchema = z11.object({
39503
- kind: z11.literal("ci"),
39504
- prNumber: z11.number().int().positive("ci atom requires a positive integer PR number"),
39505
- componentPrNumber: z11.number().int().positive().optional(),
39809
+ var ciAtomSchema = z12.object({
39810
+ kind: z12.literal("ci"),
39811
+ prNumber: z12.number().int().positive("ci atom requires a positive integer PR number"),
39812
+ componentPrNumber: z12.number().int().positive().optional(),
39506
39813
  /** `ci:<owner>/<repo>#<n>`, as for `pr:` (T13912). */
39507
- repo: z11.string().regex(/^[a-z0-9._-]+\/[a-z0-9._-]+$/).optional()
39814
+ repo: z12.string().regex(/^[a-z0-9._-]+\/[a-z0-9._-]+$/).optional()
39508
39815
  });
39509
- var ciRunAtomSchema = z11.object({
39510
- kind: z11.literal("ci-run"),
39511
- runId: z11.number().int().positive("ci-run atom requires a positive integer run id")
39816
+ var ciRunAtomSchema = z12.object({
39817
+ kind: z12.literal("ci-run"),
39818
+ runId: z12.number().int().positive("ci-run atom requires a positive integer run id")
39512
39819
  });
39513
- var deployAtomSchema = z11.object({
39514
- kind: z11.literal("deploy"),
39515
- provider: z11.string().regex(DEPLOY_PROVIDER_REGEX, "deploy atom provider must be a lowercase name"),
39516
- deploymentId: z11.string().regex(DEPLOY_ID_REGEX, "deploy atom requires a deployment id"),
39517
- sha: z11.string().regex(/^[0-9a-f]{7,40}$/, "deploy atom sha must be 7-40 lowercase hex chars"),
39518
- probeUrl: z11.string().regex(/^https?:\/\/\S+$/, "deploy atom probe url must start with http:// or https://")
39820
+ var deployAtomSchema = z12.object({
39821
+ kind: z12.literal("deploy"),
39822
+ provider: z12.string().regex(DEPLOY_PROVIDER_REGEX, "deploy atom provider must be a lowercase name"),
39823
+ deploymentId: z12.string().regex(DEPLOY_ID_REGEX, "deploy atom requires a deployment id"),
39824
+ sha: z12.string().regex(/^[0-9a-f]{7,40}$/, "deploy atom sha must be 7-40 lowercase hex chars"),
39825
+ probeUrl: z12.string().regex(/^https?:\/\/\S+$/, "deploy atom probe url must start with http:// or https://")
39519
39826
  });
39520
- var locDropAtomSchema = z11.object({
39521
- kind: z11.literal("loc-drop"),
39522
- fromLines: z11.number().int().nonnegative("loc-drop fromLines must be \u2265 0"),
39523
- toLines: z11.number().int().nonnegative("loc-drop toLines must be \u2265 0")
39827
+ var locDropAtomSchema = z12.object({
39828
+ kind: z12.literal("loc-drop"),
39829
+ fromLines: z12.number().int().nonnegative("loc-drop fromLines must be \u2265 0"),
39830
+ toLines: z12.number().int().nonnegative("loc-drop toLines must be \u2265 0")
39524
39831
  });
39525
- var callsiteCoverageAtomSchema = z11.object({
39526
- kind: z11.literal("callsite-coverage"),
39527
- symbolName: z11.string().min(1, "callsite-coverage atom requires a non-empty symbolName"),
39528
- relativeSourcePath: z11.string().min(1, "callsite-coverage atom requires a non-empty relativeSourcePath")
39832
+ var callsiteCoverageAtomSchema = z12.object({
39833
+ kind: z12.literal("callsite-coverage"),
39834
+ symbolName: z12.string().min(1, "callsite-coverage atom requires a non-empty symbolName"),
39835
+ relativeSourcePath: z12.string().min(1, "callsite-coverage atom requires a non-empty relativeSourcePath")
39529
39836
  });
39530
39837
  var 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}$/;
39531
39838
  var AC_ALIAS_REGEX = /^AC[0-9]{1,4}$/;
39532
39839
  var SATISFIES_TASK_ID_REGEX = /^T[0-9]{1,7}$/;
39533
39840
  var SATISFIES_VERSION_PIN_REGEX = /^[0-9]{14}$/;
39534
- var satisfiesAtomSchema = z11.object({
39535
- kind: z11.literal("satisfies"),
39841
+ var satisfiesAtomSchema = z12.object({
39842
+ kind: z12.literal("satisfies"),
39536
39843
  /** Target task ID — `T<1-7 digits>` per ADR-079-r2 §2.1. */
39537
- targetTaskId: z11.string().regex(SATISFIES_TASK_ID_REGEX, "satisfies atom targetTaskId must match /^T[0-9]{1,7}$/"),
39844
+ targetTaskId: z12.string().regex(SATISFIES_TASK_ID_REGEX, "satisfies atom targetTaskId must match /^T[0-9]{1,7}$/"),
39538
39845
  /** Lowercase UUIDv4/v5 — populated for the canonical form; undefined for alias form. */
39539
- targetAcId: z11.string().regex(AC_UUID_REGEX, "satisfies atom targetAcId must be a lowercase UUIDv4/v5").optional(),
39846
+ targetAcId: z12.string().regex(AC_UUID_REGEX, "satisfies atom targetAcId must be a lowercase UUIDv4/v5").optional(),
39540
39847
  /** Positional alias `AC<1-4 digits>` — populated for alias form; undefined for UUID form. */
39541
- targetAcAlias: z11.string().regex(AC_ALIAS_REGEX, "satisfies atom targetAcAlias must match /^AC[0-9]{1,4}$/").optional(),
39848
+ targetAcAlias: z12.string().regex(AC_ALIAS_REGEX, "satisfies atom targetAcAlias must match /^AC[0-9]{1,4}$/").optional(),
39542
39849
  /** Optional `@<14-digit YYYYMMDDhhmmss>` pin captured at mint time. */
39543
- versionPin: z11.string().regex(
39850
+ versionPin: z12.string().regex(
39544
39851
  SATISFIES_VERSION_PIN_REGEX,
39545
39852
  "satisfies atom versionPin must be 14 digits (YYYYMMDDhhmmss)"
39546
39853
  ).optional()
39547
39854
  });
39548
- var EvidenceAtomSchema = z11.discriminatedUnion("kind", [
39855
+ var EvidenceAtomSchema = z12.discriminatedUnion("kind", [
39549
39856
  commitAtomSchema,
39550
39857
  filesAtomSchema,
39551
39858
  testRunAtomSchema,
@@ -39607,54 +39914,54 @@ var ATOM_EXAMPLES = Object.freeze({
39607
39914
  });
39608
39915
 
39609
39916
  // packages/contracts/src/evidence-record-schema.ts
39610
- import { z as z12 } from "zod";
39611
- var evidenceBaseSchema = z12.object({
39917
+ import { z as z13 } from "zod";
39918
+ var evidenceBaseSchema = z13.object({
39612
39919
  /** Identity string of the agent that produced this record. */
39613
- agentIdentity: z12.string().min(1),
39920
+ agentIdentity: z13.string().min(1),
39614
39921
  /** SHA-256 hex digest (64 chars) of the attached artifact. */
39615
- attachmentSha256: z12.string().length(64),
39922
+ attachmentSha256: z13.string().length(64),
39616
39923
  /** ISO 8601 timestamp at which the action ran. */
39617
- ranAt: z12.string().datetime(),
39924
+ ranAt: z13.string().datetime(),
39618
39925
  /** Wall-clock duration of the action in milliseconds. */
39619
- durationMs: z12.number().nonnegative()
39926
+ durationMs: z13.number().nonnegative()
39620
39927
  });
39621
39928
  var implDiffRecordSchema = evidenceBaseSchema.extend({
39622
- kind: z12.literal("impl-diff"),
39623
- phase: z12.literal("implement"),
39624
- filesChanged: z12.array(z12.string().min(1)).min(1),
39625
- linesAdded: z12.number().int().nonnegative(),
39626
- linesRemoved: z12.number().int().nonnegative()
39929
+ kind: z13.literal("impl-diff"),
39930
+ phase: z13.literal("implement"),
39931
+ filesChanged: z13.array(z13.string().min(1)).min(1),
39932
+ linesAdded: z13.number().int().nonnegative(),
39933
+ linesRemoved: z13.number().int().nonnegative()
39627
39934
  });
39628
39935
  var validateSpecCheckRecordSchema = evidenceBaseSchema.extend({
39629
- kind: z12.literal("validate-spec-check"),
39630
- phase: z12.literal("validate"),
39631
- reqIdsChecked: z12.array(z12.string().min(1)).min(1),
39632
- passed: z12.boolean(),
39633
- details: z12.string().min(1)
39936
+ kind: z13.literal("validate-spec-check"),
39937
+ phase: z13.literal("validate"),
39938
+ reqIdsChecked: z13.array(z13.string().min(1)).min(1),
39939
+ passed: z13.boolean(),
39940
+ details: z13.string().min(1)
39634
39941
  });
39635
39942
  var testOutputRecordSchema = evidenceBaseSchema.extend({
39636
- kind: z12.literal("test-output"),
39637
- phase: z12.literal("test"),
39638
- command: z12.string().min(1),
39639
- exitCode: z12.number().int(),
39640
- testsPassed: z12.number().int().nonnegative(),
39641
- testsFailed: z12.number().int().nonnegative()
39943
+ kind: z13.literal("test-output"),
39944
+ phase: z13.literal("test"),
39945
+ command: z13.string().min(1),
39946
+ exitCode: z13.number().int(),
39947
+ testsPassed: z13.number().int().nonnegative(),
39948
+ testsFailed: z13.number().int().nonnegative()
39642
39949
  });
39643
39950
  var lintReportRecordSchema = evidenceBaseSchema.extend({
39644
- kind: z12.literal("lint-report"),
39645
- phase: z12.enum(["implement", "test"]),
39646
- tool: z12.string().min(1),
39647
- passed: z12.boolean(),
39648
- warnings: z12.number().int().nonnegative(),
39649
- errors: z12.number().int().nonnegative()
39951
+ kind: z13.literal("lint-report"),
39952
+ phase: z13.enum(["implement", "test"]),
39953
+ tool: z13.string().min(1),
39954
+ passed: z13.boolean(),
39955
+ warnings: z13.number().int().nonnegative(),
39956
+ errors: z13.number().int().nonnegative()
39650
39957
  });
39651
39958
  var commandOutputRecordSchema = evidenceBaseSchema.extend({
39652
- kind: z12.literal("command-output"),
39653
- phase: z12.enum(["implement", "validate", "test"]),
39654
- cmd: z12.string().min(1),
39655
- exitCode: z12.number().int()
39959
+ kind: z13.literal("command-output"),
39960
+ phase: z13.enum(["implement", "validate", "test"]),
39961
+ cmd: z13.string().min(1),
39962
+ exitCode: z13.number().int()
39656
39963
  });
39657
- var evidenceRecordSchema = z12.discriminatedUnion("kind", [
39964
+ var evidenceRecordSchema = z13.discriminatedUnion("kind", [
39658
39965
  implDiffRecordSchema,
39659
39966
  validateSpecCheckRecordSchema,
39660
39967
  testOutputRecordSchema,
@@ -40589,107 +40896,107 @@ var KIND_LIFECYCLE_REQUIREMENTS = Object.freeze({
40589
40896
  });
40590
40897
 
40591
40898
  // packages/contracts/src/lease-ipc/messages.ts
40592
- import { z as z13 } from "zod";
40593
- var LeaseScopeSchema = z13.enum(["project", "global"]);
40594
- var LeaseLaneSchema = z13.enum(["tasks", "brain", "bulk"]);
40595
- var LeaseAcquireRequestSchema = z13.object({
40899
+ import { z as z14 } from "zod";
40900
+ var LeaseScopeSchema = z14.enum(["project", "global"]);
40901
+ var LeaseLaneSchema = z14.enum(["tasks", "brain", "bulk"]);
40902
+ var LeaseAcquireRequestSchema = z14.object({
40596
40903
  /** Tag discriminating this request variant. */
40597
- kind: z13.literal("lease_acquire"),
40904
+ kind: z14.literal("lease_acquire"),
40598
40905
  /** The cleo.db scope being arbitrated. */
40599
40906
  scope: LeaseScopeSchema,
40600
40907
  /** The write lane within the scope. */
40601
40908
  lane: LeaseLaneSchema,
40602
40909
  /** Process+lane holder identity. */
40603
- holder_id: z13.string().min(1),
40910
+ holder_id: z14.string().min(1),
40604
40911
  /** Advisory priority — lower acquires sooner. `0` = highest. */
40605
- priority: z13.number().int().min(0).max(255),
40912
+ priority: z14.number().int().min(0).max(255),
40606
40913
  /** Lease time-to-live in milliseconds. */
40607
- ttl_ms: z13.number().int().nonnegative(),
40914
+ ttl_ms: z14.number().int().nonnegative(),
40608
40915
  /** When true, a same-holder acquire re-enters (refcount++) rather than queuing. */
40609
- reentrant: z13.boolean()
40916
+ reentrant: z14.boolean()
40610
40917
  }).strict();
40611
- var LeaseReleaseRequestSchema = z13.object({
40918
+ var LeaseReleaseRequestSchema = z14.object({
40612
40919
  /** Tag discriminating this request variant. */
40613
- kind: z13.literal("lease_release"),
40920
+ kind: z14.literal("lease_release"),
40614
40921
  /** The cleo.db scope being arbitrated. */
40615
40922
  scope: LeaseScopeSchema,
40616
40923
  /** The write lane within the scope. */
40617
40924
  lane: LeaseLaneSchema,
40618
40925
  /** Process+lane holder identity. */
40619
- holder_id: z13.string().min(1),
40926
+ holder_id: z14.string().min(1),
40620
40927
  /** The epoch fence the holder acquired — a stale epoch no-ops. */
40621
- epoch: z13.number().int().nonnegative()
40928
+ epoch: z14.number().int().nonnegative()
40622
40929
  }).strict();
40623
- var LeaseRenewRequestSchema = z13.object({
40930
+ var LeaseRenewRequestSchema = z14.object({
40624
40931
  /** Tag discriminating this request variant. */
40625
- kind: z13.literal("lease_renew"),
40932
+ kind: z14.literal("lease_renew"),
40626
40933
  /** The cleo.db scope being arbitrated. */
40627
40934
  scope: LeaseScopeSchema,
40628
40935
  /** The write lane within the scope. */
40629
40936
  lane: LeaseLaneSchema,
40630
40937
  /** Process+lane holder identity. */
40631
- holder_id: z13.string().min(1),
40938
+ holder_id: z14.string().min(1),
40632
40939
  /** The epoch fence the holder acquired (epoch-guarded renew). */
40633
- epoch: z13.number().int().nonnegative()
40940
+ epoch: z14.number().int().nonnegative()
40634
40941
  }).strict();
40635
- var RateCheckRequestSchema = z13.object({
40942
+ var RateCheckRequestSchema = z14.object({
40636
40943
  /** Tag discriminating this request variant. */
40637
- kind: z13.literal("rate_check"),
40944
+ kind: z14.literal("rate_check"),
40638
40945
  /** The cleo.db scope being checked. */
40639
40946
  scope: LeaseScopeSchema,
40640
40947
  /** The write lane within the scope. */
40641
40948
  lane: LeaseLaneSchema,
40642
40949
  /** Estimated bytes the caller intends to write. */
40643
- est_bytes: z13.number().int().nonnegative()
40950
+ est_bytes: z14.number().int().nonnegative()
40644
40951
  }).strict();
40645
- var ToolGrantRequestSchema = z13.object({
40952
+ var ToolGrantRequestSchema = z14.object({
40646
40953
  /** Tag discriminating this request variant. */
40647
- kind: z13.literal("tool_grant"),
40954
+ kind: z14.literal("tool_grant"),
40648
40955
  /** The tool name being requested. */
40649
- tool: z13.string().min(1),
40956
+ tool: z14.string().min(1),
40650
40957
  /** The requesting holder identity. */
40651
- holder_id: z13.string().min(1)
40958
+ holder_id: z14.string().min(1)
40652
40959
  }).strict();
40653
- var QueuePriorityClassSchema = z13.enum(["lead", "worker", "background"]);
40654
- var QueueAdmitRequestSchema = z13.object({
40960
+ var QueuePriorityClassSchema = z14.enum(["lead", "worker", "background"]);
40961
+ var QueueAdmitRequestSchema = z14.object({
40655
40962
  /** Tag discriminating this request variant. */
40656
- kind: z13.literal("queue_admit"),
40963
+ kind: z14.literal("queue_admit"),
40657
40964
  /** The LLM provider id the call targets (rate budget is per-provider). */
40658
- provider: z13.string().min(1),
40965
+ provider: z14.string().min(1),
40659
40966
  /** The caller's priority class (lead > worker > background). */
40660
40967
  priority_class: QueuePriorityClassSchema,
40661
40968
  /** The caller's estimate of the request's token cost (debited on admit). */
40662
- est_tokens: z13.number().int().nonnegative(),
40969
+ est_tokens: z14.number().int().nonnegative(),
40663
40970
  /** The child the call belongs to (in-flight tracking — the watchdog seam). */
40664
- child_id: z13.string().min(1)
40971
+ child_id: z14.string().min(1)
40665
40972
  }).strict();
40666
- var WorkerHeartbeatRequestSchema = z13.object({
40973
+ var WorkerHeartbeatRequestSchema = z14.object({
40667
40974
  /** Tag discriminating this request variant. */
40668
- kind: z13.literal("worker_heartbeat"),
40975
+ kind: z14.literal("worker_heartbeat"),
40669
40976
  /** The logical id of the heartbeating child (matches the registry key). */
40670
- child_id: z13.string().min(1),
40977
+ child_id: z14.string().min(1),
40671
40978
  /** The worker's own view of whether it is currently inside an LLM call. */
40672
- in_flight_llm: z13.boolean()
40979
+ in_flight_llm: z14.boolean()
40673
40980
  }).strict();
40674
- var ResourceAdmitRequestSchema = z13.object({
40981
+ var ResourceAdmitRequestSchema = z14.object({
40675
40982
  /** Tag discriminating this request variant. */
40676
- kind: z13.literal("resource_admit"),
40983
+ kind: z14.literal("resource_admit"),
40677
40984
  /** The resource class (e.g. `"db-heavy"`, `"full-build"`, `"test-run"`). */
40678
- class: z13.string().min(1),
40985
+ class: z14.string().min(1),
40679
40986
  /** The caller holding the slot — process/worktree-unique; the release key. */
40680
- holder_id: z13.string().min(1),
40987
+ holder_id: z14.string().min(1),
40681
40988
  /** The client-computed budget: the max concurrent holders for this class. */
40682
- budget: z13.number().int().nonnegative()
40989
+ budget: z14.number().int().nonnegative()
40683
40990
  }).strict();
40684
- var ResourceReleaseRequestSchema = z13.object({
40991
+ var ResourceReleaseRequestSchema = z14.object({
40685
40992
  /** Tag discriminating this request variant. */
40686
- kind: z13.literal("resource_release"),
40993
+ kind: z14.literal("resource_release"),
40687
40994
  /** The resource class the slot belongs to. */
40688
- class: z13.string().min(1),
40995
+ class: z14.string().min(1),
40689
40996
  /** The holder that was admitted (matches the admit `holder_id`). */
40690
- holder_id: z13.string().min(1)
40997
+ holder_id: z14.string().min(1)
40691
40998
  }).strict();
40692
- var LeaseIpcRequestSchema = z13.discriminatedUnion("kind", [
40999
+ var LeaseIpcRequestSchema = z14.discriminatedUnion("kind", [
40693
41000
  LeaseAcquireRequestSchema,
40694
41001
  LeaseReleaseRequestSchema,
40695
41002
  LeaseRenewRequestSchema,
@@ -40700,133 +41007,133 @@ var LeaseIpcRequestSchema = z13.discriminatedUnion("kind", [
40700
41007
  ResourceAdmitRequestSchema,
40701
41008
  ResourceReleaseRequestSchema
40702
41009
  ]);
40703
- var LeaseGrantedResponseSchema = z13.object({
41010
+ var LeaseGrantedResponseSchema = z14.object({
40704
41011
  /** Tag discriminating this response variant. */
40705
- kind: z13.literal("lease_granted"),
41012
+ kind: z14.literal("lease_granted"),
40706
41013
  /** The granted cleo.db scope. */
40707
41014
  scope: LeaseScopeSchema,
40708
41015
  /** The granted write lane. */
40709
41016
  lane: LeaseLaneSchema,
40710
41017
  /** The holder the lease was granted to. */
40711
- holder_id: z13.string().min(1),
41018
+ holder_id: z14.string().min(1),
40712
41019
  /** The monotonic epoch fence assigned to this grant. */
40713
- epoch: z13.number().int().nonnegative(),
41020
+ epoch: z14.number().int().nonnegative(),
40714
41021
  /** The lease TTL in milliseconds. */
40715
- ttl_ms: z13.number().int().nonnegative(),
41022
+ ttl_ms: z14.number().int().nonnegative(),
40716
41023
  /** Absolute expiry timestamp (epoch ms) for this grant. */
40717
- expires_at_ms: z13.number().int().nonnegative()
41024
+ expires_at_ms: z14.number().int().nonnegative()
40718
41025
  }).strict();
40719
- var LeaseQueuedResponseSchema = z13.object({
41026
+ var LeaseQueuedResponseSchema = z14.object({
40720
41027
  /** Tag discriminating this response variant. */
40721
- kind: z13.literal("lease_queued"),
41028
+ kind: z14.literal("lease_queued"),
40722
41029
  /** The queued cleo.db scope. */
40723
41030
  scope: LeaseScopeSchema,
40724
41031
  /** The queued write lane. */
40725
41032
  lane: LeaseLaneSchema,
40726
41033
  /** The monotonic ticket assigned for FIFO tiebreak. */
40727
- ticket: z13.number().int().nonnegative(),
41034
+ ticket: z14.number().int().nonnegative(),
40728
41035
  /** Number of waiters ahead of this one. */
40729
- ahead: z13.number().int().nonnegative()
41036
+ ahead: z14.number().int().nonnegative()
40730
41037
  }).strict();
40731
- var LeaseDeniedResponseSchema = z13.object({
41038
+ var LeaseDeniedResponseSchema = z14.object({
40732
41039
  /** Tag discriminating this response variant. */
40733
- kind: z13.literal("lease_denied"),
41040
+ kind: z14.literal("lease_denied"),
40734
41041
  /** The denied cleo.db scope. */
40735
41042
  scope: LeaseScopeSchema,
40736
41043
  /** Machine-readable denial code (e.g. `E_LEASE_UNAVAILABLE`). */
40737
- code: z13.string().min(1),
41044
+ code: z14.string().min(1),
40738
41045
  /** Human-readable denial message. */
40739
- message: z13.string()
41046
+ message: z14.string()
40740
41047
  }).strict();
40741
- var RateResultResponseSchema = z13.object({
41048
+ var RateResultResponseSchema = z14.object({
40742
41049
  /** Tag discriminating this response variant. */
40743
- kind: z13.literal("rate_result"),
41050
+ kind: z14.literal("rate_result"),
40744
41051
  /** The checked cleo.db scope. */
40745
41052
  scope: LeaseScopeSchema,
40746
41053
  /** Whether the write is within budget. */
40747
- ok: z13.boolean(),
41054
+ ok: z14.boolean(),
40748
41055
  /** Suggested back-off in milliseconds when `ok` is false. */
40749
- retry_after_ms: z13.number().int().nonnegative(),
41056
+ retry_after_ms: z14.number().int().nonnegative(),
40750
41057
  /** Remaining token budget for the scope. */
40751
- tokens_remaining: z13.number().int().nonnegative()
41058
+ tokens_remaining: z14.number().int().nonnegative()
40752
41059
  }).strict();
40753
- var ToolGrantedResponseSchema = z13.object({
41060
+ var ToolGrantedResponseSchema = z14.object({
40754
41061
  /** Tag discriminating this response variant. */
40755
- kind: z13.literal("tool_granted"),
41062
+ kind: z14.literal("tool_granted"),
40756
41063
  /** The granted tool name. */
40757
- tool: z13.string().min(1),
41064
+ tool: z14.string().min(1),
40758
41065
  /** The holder the tool grant was issued to. */
40759
- holder_id: z13.string().min(1)
41066
+ holder_id: z14.string().min(1)
40760
41067
  }).strict();
40761
- var LeaseRevokedResponseSchema = z13.object({
41068
+ var LeaseRevokedResponseSchema = z14.object({
40762
41069
  /** Tag discriminating this response variant. */
40763
- kind: z13.literal("lease_revoked"),
41070
+ kind: z14.literal("lease_revoked"),
40764
41071
  /** The revoked cleo.db scope. */
40765
41072
  scope: LeaseScopeSchema,
40766
41073
  /** The revoked write lane. */
40767
41074
  lane: LeaseLaneSchema,
40768
41075
  /** The holder whose lease was revoked. */
40769
- holder_id: z13.string().min(1),
41076
+ holder_id: z14.string().min(1),
40770
41077
  /** Human-readable reason for the revocation. */
40771
- reason: z13.string()
41078
+ reason: z14.string()
40772
41079
  }).strict();
40773
- var ChildKilledUnresponsiveResponseSchema = z13.object({
41080
+ var ChildKilledUnresponsiveResponseSchema = z14.object({
40774
41081
  /** Tag discriminating this response variant. */
40775
- kind: z13.literal("child_killed_unresponsive"),
41082
+ kind: z14.literal("child_killed_unresponsive"),
40776
41083
  /** Logical id of the killed child. */
40777
- child_id: z13.string().min(1),
41084
+ child_id: z14.string().min(1),
40778
41085
  /** The holder identity the killed child held the lease as. */
40779
- holder_id: z13.string().min(1),
41086
+ holder_id: z14.string().min(1),
40780
41087
  /** The cleo.db scope the killed child held the lease in. */
40781
41088
  scope: LeaseScopeSchema,
40782
41089
  /** Human-readable reason for the kill. */
40783
- reason: z13.string()
41090
+ reason: z14.string()
40784
41091
  }).strict();
40785
- var QueueAdmitDispositionSchema = z13.enum(["admitted", "deferred"]);
40786
- var QueueAdmitResultResponseSchema = z13.object({
41092
+ var QueueAdmitDispositionSchema = z14.enum(["admitted", "deferred"]);
41093
+ var QueueAdmitResultResponseSchema = z14.object({
40787
41094
  /** Tag discriminating this response variant. */
40788
- kind: z13.literal("queue_admit_result"),
41095
+ kind: z14.literal("queue_admit_result"),
40789
41096
  /** Whether the LLM call was admitted or deferred. */
40790
41097
  disposition: QueueAdmitDispositionSchema,
40791
41098
  /** Back-off in ms before re-requesting (0 when admitted). */
40792
- retry_after_ms: z13.number().int().nonnegative(),
41099
+ retry_after_ms: z14.number().int().nonnegative(),
40793
41100
  /** Remaining provider token budget after this decision. */
40794
- tokens_remaining: z13.number().int().nonnegative(),
41101
+ tokens_remaining: z14.number().int().nonnegative(),
40795
41102
  /** Number of higher/equal-priority waiters ahead (0 when admitted). */
40796
- queue_position: z13.number().int().nonnegative()
41103
+ queue_position: z14.number().int().nonnegative()
40797
41104
  }).strict();
40798
- var HeartbeatAckResponseSchema = z13.object({
41105
+ var HeartbeatAckResponseSchema = z14.object({
40799
41106
  /** Tag discriminating this response variant. */
40800
- kind: z13.literal("heartbeat_ack")
41107
+ kind: z14.literal("heartbeat_ack")
40801
41108
  }).strict();
40802
- var ResourceAdmitDispositionSchema = z13.enum(["admitted", "deferred"]);
40803
- var ResourceAdmitResultResponseSchema = z13.object({
41109
+ var ResourceAdmitDispositionSchema = z14.enum(["admitted", "deferred"]);
41110
+ var ResourceAdmitResultResponseSchema = z14.object({
40804
41111
  /** Tag discriminating this response variant. */
40805
- kind: z13.literal("resource_admit_result"),
41112
+ kind: z14.literal("resource_admit_result"),
40806
41113
  /** Whether the heavy op was admitted or deferred. */
40807
41114
  disposition: ResourceAdmitDispositionSchema,
40808
41115
  /** Back-off in ms before re-requesting (0 when admitted). */
40809
- retry_after_ms: z13.number().int().nonnegative(),
41116
+ retry_after_ms: z14.number().int().nonnegative(),
40810
41117
  /** Remaining slots for the class after this decision. */
40811
- slots_remaining: z13.number().int().nonnegative()
41118
+ slots_remaining: z14.number().int().nonnegative()
40812
41119
  }).strict();
40813
- var ResourceReleaseResultResponseSchema = z13.object({
41120
+ var ResourceReleaseResultResponseSchema = z14.object({
40814
41121
  /** Tag discriminating this response variant. */
40815
- kind: z13.literal("resource_release_result"),
41122
+ kind: z14.literal("resource_release_result"),
40816
41123
  /** Whether a held slot was actually released (false = no such holder). */
40817
- released: z13.boolean(),
41124
+ released: z14.boolean(),
40818
41125
  /** Remaining in-flight holders for the class after the release. */
40819
- slots_remaining: z13.number().int().nonnegative()
41126
+ slots_remaining: z14.number().int().nonnegative()
40820
41127
  }).strict();
40821
- var LeaseErrorResponseSchema = z13.object({
41128
+ var LeaseErrorResponseSchema = z14.object({
40822
41129
  /** Tag discriminating this response variant. */
40823
- kind: z13.literal("error"),
41130
+ kind: z14.literal("error"),
40824
41131
  /** Machine-readable error code (e.g. `E_LEASE_BAD_VERSION`, `E_LEASE_UNIMPLEMENTED`). */
40825
- code: z13.string().min(1),
41132
+ code: z14.string().min(1),
40826
41133
  /** Human-readable error message. */
40827
- message: z13.string()
41134
+ message: z14.string()
40828
41135
  }).strict();
40829
- var LeaseIpcResponseSchema = z13.discriminatedUnion("kind", [
41136
+ var LeaseIpcResponseSchema = z14.discriminatedUnion("kind", [
40830
41137
  LeaseGrantedResponseSchema,
40831
41138
  LeaseQueuedResponseSchema,
40832
41139
  LeaseDeniedResponseSchema,
@@ -40840,27 +41147,27 @@ var LeaseIpcResponseSchema = z13.discriminatedUnion("kind", [
40840
41147
  ResourceReleaseResultResponseSchema,
40841
41148
  LeaseErrorResponseSchema
40842
41149
  ]);
40843
- var LeaseIpcRequestEnvelopeSchema = z13.object({
41150
+ var LeaseIpcRequestEnvelopeSchema = z14.object({
40844
41151
  /** Parallel protocol version. */
40845
- protocol_version: z13.string(),
41152
+ protocol_version: z14.string(),
40846
41153
  /** Correlation id echoed back on the matching response. */
40847
- id: z13.string().min(1),
41154
+ id: z14.string().min(1),
40848
41155
  /** Direction discriminator. */
40849
- direction: z13.literal("request"),
41156
+ direction: z14.literal("request"),
40850
41157
  /** The request body. */
40851
41158
  request: LeaseIpcRequestSchema
40852
41159
  }).strict();
40853
- var LeaseIpcResponseEnvelopeSchema = z13.object({
41160
+ var LeaseIpcResponseEnvelopeSchema = z14.object({
40854
41161
  /** Parallel protocol version. */
40855
- protocol_version: z13.string(),
41162
+ protocol_version: z14.string(),
40856
41163
  /** Correlation id echoed from the originating request (or a fresh id for events). */
40857
- id: z13.string().min(1),
41164
+ id: z14.string().min(1),
40858
41165
  /** Direction discriminator. */
40859
- direction: z13.literal("response"),
41166
+ direction: z14.literal("response"),
40860
41167
  /** The response body. */
40861
41168
  response: LeaseIpcResponseSchema
40862
41169
  }).strict();
40863
- var LeaseIpcEnvelopeSchema = z13.discriminatedUnion("direction", [
41170
+ var LeaseIpcEnvelopeSchema = z14.discriminatedUnion("direction", [
40864
41171
  LeaseIpcRequestEnvelopeSchema,
40865
41172
  LeaseIpcResponseEnvelopeSchema
40866
41173
  ]);
@@ -40895,7 +41202,7 @@ var LEASE_IPC_MESSAGE_KINDS = [
40895
41202
  ];
40896
41203
 
40897
41204
  // packages/contracts/src/llm/catalog-schema.ts
40898
- import { z as z14 } from "zod";
41205
+ import { z as z15 } from "zod";
40899
41206
  var CATALOG_MODEL_STATUSES = [
40900
41207
  "stable",
40901
41208
  "beta",
@@ -40904,78 +41211,78 @@ var CATALOG_MODEL_STATUSES = [
40904
41211
  "retired"
40905
41212
  ];
40906
41213
  var CATALOG_AUTH_TYPES = ["api_key", "oauth", "bedrock", "vertex"];
40907
- var isoDate = z14.string().regex(/^\d{4}-\d{2}-\d{2}$/, "must be an ISO date (YYYY-MM-DD)");
40908
- var semver = z14.string().regex(/^\d+\.\d+\.\d+$/, "must be semver (MAJOR.MINOR.PATCH)");
40909
- var catalogModalitiesSchema = z14.object({
40910
- input: z14.array(z14.string()),
40911
- output: z14.array(z14.string())
41214
+ var isoDate = z15.string().regex(/^\d{4}-\d{2}-\d{2}$/, "must be an ISO date (YYYY-MM-DD)");
41215
+ var semver = z15.string().regex(/^\d+\.\d+\.\d+$/, "must be semver (MAJOR.MINOR.PATCH)");
41216
+ var catalogModalitiesSchema = z15.object({
41217
+ input: z15.array(z15.string()),
41218
+ output: z15.array(z15.string())
40912
41219
  }).strict();
40913
- var catalogCostSchema = z14.object({
40914
- input: z14.number().optional(),
40915
- output: z14.number().optional(),
40916
- cache_read: z14.number().optional(),
40917
- cache_write: z14.number().optional(),
40918
- context_over_200k: z14.number().optional()
41220
+ var catalogCostSchema = z15.object({
41221
+ input: z15.number().optional(),
41222
+ output: z15.number().optional(),
41223
+ cache_read: z15.number().optional(),
41224
+ cache_write: z15.number().optional(),
41225
+ context_over_200k: z15.number().optional()
40919
41226
  }).strict();
40920
- var catalogLimitSchema = z14.object({
40921
- context: z14.number(),
40922
- output: z14.number()
41227
+ var catalogLimitSchema = z15.object({
41228
+ context: z15.number(),
41229
+ output: z15.number()
40923
41230
  }).strict();
40924
- var catalogModelProviderSchema = z14.object({
40925
- npm: z14.string(),
40926
- api: z14.string()
41231
+ var catalogModelProviderSchema = z15.object({
41232
+ npm: z15.string(),
41233
+ api: z15.string()
40927
41234
  }).strict();
40928
- var catalogModelEntrySchema = z14.object({
40929
- id: z14.string(),
40930
- name: z14.string(),
40931
- family: z14.string(),
40932
- attachment: z14.boolean(),
40933
- reasoning: z14.boolean(),
40934
- temperature: z14.boolean(),
40935
- interleaved: z14.boolean(),
40936
- tool_call: z14.boolean(),
41235
+ var catalogModelEntrySchema = z15.object({
41236
+ id: z15.string(),
41237
+ name: z15.string(),
41238
+ family: z15.string(),
41239
+ attachment: z15.boolean(),
41240
+ reasoning: z15.boolean(),
41241
+ temperature: z15.boolean(),
41242
+ interleaved: z15.boolean(),
41243
+ tool_call: z15.boolean(),
40937
41244
  modalities: catalogModalitiesSchema,
40938
41245
  cost: catalogCostSchema,
40939
41246
  limit: catalogLimitSchema,
40940
- status: z14.enum(CATALOG_MODEL_STATUSES),
41247
+ status: z15.enum(CATALOG_MODEL_STATUSES),
40941
41248
  release_date: isoDate,
40942
41249
  provider: catalogModelProviderSchema
40943
41250
  }).strict();
40944
- var catalogProviderSchema = z14.object({
40945
- id: z14.string(),
40946
- endpoint: z14.string(),
40947
- authTypes: z14.array(z14.enum(CATALOG_AUTH_TYPES)).min(1),
40948
- npm: z14.string().optional()
41251
+ var catalogProviderSchema = z15.object({
41252
+ id: z15.string(),
41253
+ endpoint: z15.string(),
41254
+ authTypes: z15.array(z15.enum(CATALOG_AUTH_TYPES)).min(1),
41255
+ npm: z15.string().optional()
40949
41256
  }).strict();
40950
- var curatedCatalogSchema = z14.object({
40951
- $schema: z14.string().optional(),
41257
+ var curatedCatalogSchema = z15.object({
41258
+ $schema: z15.string().optional(),
40952
41259
  version: semver,
40953
41260
  lastUpdated: isoDate,
40954
- providers: z14.record(z14.string(), catalogProviderSchema),
40955
- models: z14.record(z14.string(), z14.record(z14.string(), catalogModelEntrySchema))
41261
+ providers: z15.record(z15.string(), catalogProviderSchema),
41262
+ models: z15.record(z15.string(), z15.record(z15.string(), catalogModelEntrySchema))
40956
41263
  }).strict();
40957
- var modelsCatalogRowInsertSchema = z14.object({
40958
- id: z14.string(),
40959
- providerId: z14.string(),
40960
- name: z14.string(),
40961
- family: z14.string(),
40962
- attachment: z14.boolean(),
40963
- reasoning: z14.boolean(),
40964
- temperature: z14.boolean(),
40965
- interleaved: z14.boolean(),
40966
- toolCall: z14.boolean(),
40967
- modalities: z14.string(),
40968
- cost: z14.string(),
40969
- contextLimit: z14.number().nullable().optional(),
40970
- outputLimit: z14.number().nullable().optional(),
40971
- status: z14.enum(CATALOG_MODEL_STATUSES),
41264
+ var modelsCatalogRowInsertSchema = z15.object({
41265
+ id: z15.string(),
41266
+ providerId: z15.string(),
41267
+ name: z15.string(),
41268
+ family: z15.string(),
41269
+ attachment: z15.boolean(),
41270
+ reasoning: z15.boolean(),
41271
+ temperature: z15.boolean(),
41272
+ interleaved: z15.boolean(),
41273
+ toolCall: z15.boolean(),
41274
+ modalities: z15.string(),
41275
+ cost: z15.string(),
41276
+ contextLimit: z15.number().nullable().optional(),
41277
+ outputLimit: z15.number().nullable().optional(),
41278
+ status: z15.enum(CATALOG_MODEL_STATUSES),
40972
41279
  releaseDate: isoDate,
40973
- modelsDevId: z14.string(),
40974
- source: z14.string(),
40975
- seededAt: z14.string().optional()
41280
+ modelsDevId: z15.string(),
41281
+ source: z15.string(),
41282
+ seededAt: z15.string().optional()
40976
41283
  }).strict();
40977
41284
  var modelsCatalogRowSelectSchema = modelsCatalogRowInsertSchema.extend({
40978
- seededAt: z14.string()
41285
+ seededAt: z15.string()
40979
41286
  });
40980
41287
 
40981
41288
  // packages/contracts/src/llm/system-of-use.ts
@@ -41023,7 +41330,7 @@ var BUILTIN_SYSTEMS_OF_USE = [
41023
41330
  ];
41024
41331
 
41025
41332
  // packages/contracts/src/workgraph.ts
41026
- import { z as z15 } from "zod";
41333
+ import { z as z16 } from "zod";
41027
41334
 
41028
41335
  // packages/contracts/src/status-registry.ts
41029
41336
  var TASK_STATUSES = [
@@ -41038,10 +41345,10 @@ var TASK_STATUSES = [
41038
41345
 
41039
41346
  // packages/contracts/src/workgraph.ts
41040
41347
  var E_WORKGRAPH_PARENT_TYPE_MATRIX = "E_WORKGRAPH_PARENT_TYPE_MATRIX";
41041
- var taskTypeSchema = z15.enum(["saga", "epic", "task", "subtask"]);
41042
- var taskPrioritySchema = z15.enum(["critical", "high", "medium", "low"]);
41043
- var taskStatusSchema = z15.enum(TASK_STATUSES);
41044
- var verificationGateSchema = z15.enum([
41348
+ var taskTypeSchema = z16.enum(["saga", "epic", "task", "subtask"]);
41349
+ var taskPrioritySchema = z16.enum(["critical", "high", "medium", "low"]);
41350
+ var taskStatusSchema = z16.enum(TASK_STATUSES);
41351
+ var verificationGateSchema = z16.enum([
41045
41352
  "implemented",
41046
41353
  "testsPassed",
41047
41354
  "qaPassed",
@@ -41050,7 +41357,7 @@ var verificationGateSchema = z15.enum([
41050
41357
  "documented",
41051
41358
  "nexusImpact"
41052
41359
  ]);
41053
- var workGraphRelationKindSchema = z15.enum([
41360
+ var workGraphRelationKindSchema = z16.enum([
41054
41361
  "contains",
41055
41362
  "depends_on",
41056
41363
  "blocks",
@@ -41058,317 +41365,317 @@ var workGraphRelationKindSchema = z15.enum([
41058
41365
  "groups",
41059
41366
  "satisfies"
41060
41367
  ]);
41061
- var workGraphTraversalDirectionSchema = z15.enum([
41368
+ var workGraphTraversalDirectionSchema = z16.enum([
41062
41369
  "ancestors",
41063
41370
  "descendants",
41064
41371
  "upstream",
41065
41372
  "downstream"
41066
41373
  ]);
41067
- var workGraphEdgeDirectionSchema = z15.enum(["out", "in", "both"]);
41068
- var paginationParamsSchema = z15.object({
41069
- cursor: z15.string().min(1).optional(),
41070
- limit: z15.number().int().positive().max(500).optional()
41374
+ var workGraphEdgeDirectionSchema = z16.enum(["out", "in", "both"]);
41375
+ var paginationParamsSchema = z16.object({
41376
+ cursor: z16.string().min(1).optional(),
41377
+ limit: z16.number().int().positive().max(500).optional()
41071
41378
  });
41072
- var workGraphNodeSchema = z15.object({
41073
- id: z15.string().min(1),
41379
+ var workGraphNodeSchema = z16.object({
41380
+ id: z16.string().min(1),
41074
41381
  type: taskTypeSchema,
41075
- title: z15.string(),
41382
+ title: z16.string(),
41076
41383
  status: taskStatusSchema,
41077
41384
  priority: taskPrioritySchema,
41078
- parentId: z15.string().min(1).optional()
41385
+ parentId: z16.string().min(1).optional()
41079
41386
  });
41080
- var workGraphEdgeSchema = z15.object({
41081
- fromId: z15.string().min(1),
41082
- toId: z15.string().min(1),
41387
+ var workGraphEdgeSchema = z16.object({
41388
+ fromId: z16.string().min(1),
41389
+ toId: z16.string().min(1),
41083
41390
  kind: workGraphRelationKindSchema
41084
41391
  });
41085
- var workGraphHierarchyEdgeSchema = z15.object({
41086
- fromId: z15.string().min(1),
41087
- toId: z15.string().min(1),
41088
- kind: z15.literal("contains")
41392
+ var workGraphHierarchyEdgeSchema = z16.object({
41393
+ fromId: z16.string().min(1),
41394
+ toId: z16.string().min(1),
41395
+ kind: z16.literal("contains")
41089
41396
  }).strict();
41090
- var workGraphPageInfoSchema = z15.object({
41091
- nextCursor: z15.string().min(1).optional(),
41092
- hasMore: z15.boolean()
41093
- });
41094
- var workGraphRollupCountsSchema = z15.object({
41095
- total: z15.number().int().nonnegative(),
41096
- byStatus: z15.partialRecord(taskStatusSchema, z15.number().int().nonnegative()),
41097
- byType: z15.partialRecord(taskTypeSchema, z15.number().int().nonnegative())
41098
- });
41099
- var workGraphSubtreePercentagesSchema = z15.object({
41100
- done: z15.number().nonnegative(),
41101
- active: z15.number().nonnegative(),
41102
- blocked: z15.number().nonnegative(),
41103
- pending: z15.number().nonnegative(),
41104
- cancelled: z15.number().nonnegative()
41105
- });
41106
- var workGraphProjectionMismatchSchema = z15.object({
41107
- field: z15.string().min(1),
41108
- expected: z15.number().int().nonnegative(),
41109
- actual: z15.number().int().nonnegative()
41397
+ var workGraphPageInfoSchema = z16.object({
41398
+ nextCursor: z16.string().min(1).optional(),
41399
+ hasMore: z16.boolean()
41400
+ });
41401
+ var workGraphRollupCountsSchema = z16.object({
41402
+ total: z16.number().int().nonnegative(),
41403
+ byStatus: z16.partialRecord(taskStatusSchema, z16.number().int().nonnegative()),
41404
+ byType: z16.partialRecord(taskTypeSchema, z16.number().int().nonnegative())
41405
+ });
41406
+ var workGraphSubtreePercentagesSchema = z16.object({
41407
+ done: z16.number().nonnegative(),
41408
+ active: z16.number().nonnegative(),
41409
+ blocked: z16.number().nonnegative(),
41410
+ pending: z16.number().nonnegative(),
41411
+ cancelled: z16.number().nonnegative()
41412
+ });
41413
+ var workGraphProjectionMismatchSchema = z16.object({
41414
+ field: z16.string().min(1),
41415
+ expected: z16.number().int().nonnegative(),
41416
+ actual: z16.number().int().nonnegative()
41110
41417
  });
41111
41418
  var workGraphReadyFrontierTaskSchema = workGraphNodeSchema.extend({
41112
- role: z15.string().min(1).optional(),
41113
- dependencyBlockers: z15.array(z15.object({ taskId: z15.string().min(1), status: taskStatusSchema })),
41114
- gateBlockers: z15.array(z15.object({ gate: verificationGateSchema }))
41419
+ role: z16.string().min(1).optional(),
41420
+ dependencyBlockers: z16.array(z16.object({ taskId: z16.string().min(1), status: taskStatusSchema })),
41421
+ gateBlockers: z16.array(z16.object({ gate: verificationGateSchema }))
41115
41422
  });
41116
41423
  var workGraphRelationEdgeSchema = workGraphEdgeSchema.extend({
41117
- source: z15.literal("relation"),
41118
- relationType: z15.enum(TASK_RELATION_TYPES),
41119
- reason: z15.string().min(1).optional()
41424
+ source: z16.literal("relation"),
41425
+ relationType: z16.enum(TASK_RELATION_TYPES),
41426
+ reason: z16.string().min(1).optional()
41120
41427
  });
41121
41428
  var workGraphDependencyEdgeSchema = workGraphEdgeSchema.extend({
41122
- source: z15.literal("dependency"),
41123
- kind: z15.literal("depends_on")
41429
+ source: z16.literal("dependency"),
41430
+ kind: z16.literal("depends_on")
41124
41431
  });
41125
- var workGraphOmissionReasonSchema = z15.enum([
41432
+ var workGraphOmissionReasonSchema = z16.enum([
41126
41433
  "budget_exceeded",
41127
41434
  "not_requested",
41128
41435
  "not_available",
41129
41436
  "redacted",
41130
41437
  "truncated"
41131
41438
  ]);
41132
- var workGraphContextBudgetSchema = z15.object({
41133
- tokenBudget: z15.number().int().nonnegative(),
41134
- estimatedTokens: z15.number().int().nonnegative(),
41135
- remainingTokens: z15.number().int().nonnegative(),
41136
- truncated: z15.boolean()
41137
- });
41138
- var workGraphOmissionSchema = z15.object({
41139
- path: z15.string().min(1),
41439
+ var workGraphContextBudgetSchema = z16.object({
41440
+ tokenBudget: z16.number().int().nonnegative(),
41441
+ estimatedTokens: z16.number().int().nonnegative(),
41442
+ remainingTokens: z16.number().int().nonnegative(),
41443
+ truncated: z16.boolean()
41444
+ });
41445
+ var workGraphOmissionSchema = z16.object({
41446
+ path: z16.string().min(1),
41140
41447
  reason: workGraphOmissionReasonSchema,
41141
- message: z15.string().min(1),
41142
- estimatedTokens: z15.number().int().nonnegative().optional()
41448
+ message: z16.string().min(1),
41449
+ estimatedTokens: z16.number().int().nonnegative().optional()
41143
41450
  });
41144
- var workGraphDirectEdgeSchema = z15.discriminatedUnion("source", [
41451
+ var workGraphDirectEdgeSchema = z16.discriminatedUnion("source", [
41145
41452
  workGraphRelationEdgeSchema,
41146
41453
  workGraphDependencyEdgeSchema
41147
41454
  ]);
41148
41455
  var workGraphContextPackParamsSchema = paginationParamsSchema.extend({
41149
- rootId: z15.string().min(1),
41150
- tokenBudget: z15.number().int().positive().optional(),
41151
- includeRelations: z15.boolean().optional(),
41152
- includeReadiness: z15.boolean().optional(),
41153
- includeRollup: z15.boolean().optional()
41456
+ rootId: z16.string().min(1),
41457
+ tokenBudget: z16.number().int().positive().optional(),
41458
+ includeRelations: z16.boolean().optional(),
41459
+ includeReadiness: z16.boolean().optional(),
41460
+ includeRollup: z16.boolean().optional()
41154
41461
  });
41155
41462
  var workGraphSliceParamsSchema = paginationParamsSchema.extend({
41156
- rootId: z15.string().min(1),
41463
+ rootId: z16.string().min(1),
41157
41464
  direction: workGraphTraversalDirectionSchema.optional(),
41158
- maxDepth: z15.number().int().nonnegative().optional(),
41159
- includeRelations: z15.boolean().optional()
41465
+ maxDepth: z16.number().int().nonnegative().optional(),
41466
+ includeRelations: z16.boolean().optional()
41160
41467
  });
41161
- var workGraphSliceSchema = z15.object({
41162
- rootId: z15.string().min(1),
41468
+ var workGraphSliceSchema = z16.object({
41469
+ rootId: z16.string().min(1),
41163
41470
  direction: workGraphTraversalDirectionSchema,
41164
- nodes: z15.array(workGraphNodeSchema),
41165
- edges: z15.array(workGraphEdgeSchema),
41471
+ nodes: z16.array(workGraphNodeSchema),
41472
+ edges: z16.array(workGraphEdgeSchema),
41166
41473
  pageInfo: workGraphPageInfoSchema,
41167
- omissions: z15.array(workGraphOmissionSchema).optional()
41168
- });
41169
- var workGraphReadinessParamsSchema = z15.object({
41170
- rootId: z15.string().min(1),
41171
- role: z15.string().min(1).optional(),
41172
- includeGateBlockers: z15.boolean().optional()
41173
- });
41174
- var workGraphReadinessResultSchema = z15.object({
41175
- rootId: z15.string().min(1),
41176
- role: z15.string().min(1).optional(),
41177
- ready: z15.boolean(),
41178
- warnings: z15.array(z15.string()),
41179
- groups: z15.object({
41180
- ready: z15.array(workGraphReadyFrontierTaskSchema),
41181
- blocked: z15.array(workGraphReadyFrontierTaskSchema),
41182
- blockedBy: z15.array(
41183
- z15.discriminatedUnion("kind", [
41184
- z15.object({
41185
- kind: z15.literal("dependency"),
41186
- blockerId: z15.string().min(1),
41187
- blocks: z15.array(z15.string().min(1))
41474
+ omissions: z16.array(workGraphOmissionSchema).optional()
41475
+ });
41476
+ var workGraphReadinessParamsSchema = z16.object({
41477
+ rootId: z16.string().min(1),
41478
+ role: z16.string().min(1).optional(),
41479
+ includeGateBlockers: z16.boolean().optional()
41480
+ });
41481
+ var workGraphReadinessResultSchema = z16.object({
41482
+ rootId: z16.string().min(1),
41483
+ role: z16.string().min(1).optional(),
41484
+ ready: z16.boolean(),
41485
+ warnings: z16.array(z16.string()),
41486
+ groups: z16.object({
41487
+ ready: z16.array(workGraphReadyFrontierTaskSchema),
41488
+ blocked: z16.array(workGraphReadyFrontierTaskSchema),
41489
+ blockedBy: z16.array(
41490
+ z16.discriminatedUnion("kind", [
41491
+ z16.object({
41492
+ kind: z16.literal("dependency"),
41493
+ blockerId: z16.string().min(1),
41494
+ blocks: z16.array(z16.string().min(1))
41188
41495
  }),
41189
- z15.object({
41190
- kind: z15.literal("gate"),
41496
+ z16.object({
41497
+ kind: z16.literal("gate"),
41191
41498
  gate: verificationGateSchema,
41192
- blocks: z15.array(z15.string().min(1))
41499
+ blocks: z16.array(z16.string().min(1))
41193
41500
  })
41194
41501
  ])
41195
41502
  )
41196
41503
  })
41197
41504
  });
41198
- var workGraphContextPackSchema = z15.object({
41199
- rootId: z15.string().min(1),
41200
- generatedAt: z15.string().min(1),
41505
+ var workGraphContextPackSchema = z16.object({
41506
+ rootId: z16.string().min(1),
41507
+ generatedAt: z16.string().min(1),
41201
41508
  budget: workGraphContextBudgetSchema,
41202
41509
  slice: workGraphSliceSchema,
41203
- relationEdges: z15.object({
41204
- rootId: z15.string().min(1),
41510
+ relationEdges: z16.object({
41511
+ rootId: z16.string().min(1),
41205
41512
  direction: workGraphEdgeDirectionSchema,
41206
- edges: z15.array(workGraphDirectEdgeSchema)
41513
+ edges: z16.array(workGraphDirectEdgeSchema)
41207
41514
  }).optional(),
41208
41515
  readiness: workGraphReadinessResultSchema.optional(),
41209
- rollup: z15.lazy(() => tasksRollupResultSchema).optional(),
41210
- omissions: z15.array(workGraphOmissionSchema)
41211
- });
41212
- var workGraphScaffoldValidateParamsSchema = z15.object({
41213
- rootId: z15.string().min(1),
41214
- nodes: z15.array(
41215
- z15.object({
41216
- id: z15.string().min(1),
41516
+ rollup: z16.lazy(() => tasksRollupResultSchema).optional(),
41517
+ omissions: z16.array(workGraphOmissionSchema)
41518
+ });
41519
+ var workGraphScaffoldValidateParamsSchema = z16.object({
41520
+ rootId: z16.string().min(1),
41521
+ nodes: z16.array(
41522
+ z16.object({
41523
+ id: z16.string().min(1),
41217
41524
  type: taskTypeSchema,
41218
- parentId: z15.string().min(1).nullable().optional()
41525
+ parentId: z16.string().min(1).nullable().optional()
41219
41526
  })
41220
41527
  ),
41221
- edges: z15.array(workGraphDirectEdgeSchema).optional(),
41222
- dryRun: z15.boolean().optional()
41223
- });
41224
- var workGraphScaffoldValidationIssueSchema = z15.object({
41225
- code: z15.string().min(1),
41226
- message: z15.string().min(1),
41227
- taskId: z15.string().min(1).optional(),
41228
- severity: z15.enum(["error", "warning"])
41229
- });
41230
- var workGraphScaffoldValidateResultSchema = z15.object({
41231
- rootId: z15.string().min(1),
41232
- valid: z15.boolean(),
41233
- dryRun: z15.boolean(),
41234
- issues: z15.array(workGraphScaffoldValidationIssueSchema),
41235
- hierarchy: z15.object({
41236
- valid: z15.boolean(),
41237
- violations: z15.array(
41238
- z15.object({
41239
- code: z15.literal(E_WORKGRAPH_PARENT_TYPE_MATRIX),
41240
- taskId: z15.string().min(1),
41528
+ edges: z16.array(workGraphDirectEdgeSchema).optional(),
41529
+ dryRun: z16.boolean().optional()
41530
+ });
41531
+ var workGraphScaffoldValidationIssueSchema = z16.object({
41532
+ code: z16.string().min(1),
41533
+ message: z16.string().min(1),
41534
+ taskId: z16.string().min(1).optional(),
41535
+ severity: z16.enum(["error", "warning"])
41536
+ });
41537
+ var workGraphScaffoldValidateResultSchema = z16.object({
41538
+ rootId: z16.string().min(1),
41539
+ valid: z16.boolean(),
41540
+ dryRun: z16.boolean(),
41541
+ issues: z16.array(workGraphScaffoldValidationIssueSchema),
41542
+ hierarchy: z16.object({
41543
+ valid: z16.boolean(),
41544
+ violations: z16.array(
41545
+ z16.object({
41546
+ code: z16.literal(E_WORKGRAPH_PARENT_TYPE_MATRIX),
41547
+ taskId: z16.string().min(1),
41241
41548
  taskType: taskTypeSchema,
41242
- parentId: z15.string().min(1).nullable(),
41549
+ parentId: z16.string().min(1).nullable(),
41243
41550
  parentType: taskTypeSchema.optional(),
41244
- message: z15.string().min(1)
41551
+ message: z16.string().min(1)
41245
41552
  })
41246
41553
  )
41247
41554
  })
41248
41555
  });
41249
41556
  var workGraphScaffoldApplyParamsSchema = workGraphScaffoldValidateParamsSchema.extend({
41250
- apply: z15.boolean().optional()
41557
+ apply: z16.boolean().optional()
41251
41558
  });
41252
41559
  var workGraphScaffoldApplyResultSchema = workGraphScaffoldValidateResultSchema.extend({
41253
- applied: z15.boolean(),
41254
- nodesChanged: z15.number().int().nonnegative(),
41255
- edgesChanged: z15.number().int().nonnegative()
41256
- });
41257
- var workGraphPlanningDocParamsSchema = z15.object({
41258
- rootId: z15.string().min(1),
41259
- audience: z15.enum(["agent", "maintainer"]),
41260
- tokenBudget: z15.number().int().positive().optional(),
41261
- includeRelations: z15.boolean().optional(),
41262
- includeReadiness: z15.boolean().optional(),
41263
- includeRollup: z15.boolean().optional()
41264
- });
41265
- var workGraphPlanningDocSchema = z15.object({
41266
- rootId: z15.string().min(1),
41267
- generatedAt: z15.string().min(1),
41268
- audience: z15.enum(["agent", "maintainer"]),
41269
- title: z15.string().min(1),
41270
- content: z15.string(),
41271
- sections: z15.array(z15.string().min(1)),
41272
- estimatedTokens: z15.number().int().nonnegative(),
41273
- budget: z15.object({
41274
- tokenBudget: z15.number().int().positive(),
41275
- truncated: z15.boolean()
41560
+ applied: z16.boolean(),
41561
+ nodesChanged: z16.number().int().nonnegative(),
41562
+ edgesChanged: z16.number().int().nonnegative()
41563
+ });
41564
+ var workGraphPlanningDocParamsSchema = z16.object({
41565
+ rootId: z16.string().min(1),
41566
+ audience: z16.enum(["agent", "maintainer"]),
41567
+ tokenBudget: z16.number().int().positive().optional(),
41568
+ includeRelations: z16.boolean().optional(),
41569
+ includeReadiness: z16.boolean().optional(),
41570
+ includeRollup: z16.boolean().optional()
41571
+ });
41572
+ var workGraphPlanningDocSchema = z16.object({
41573
+ rootId: z16.string().min(1),
41574
+ generatedAt: z16.string().min(1),
41575
+ audience: z16.enum(["agent", "maintainer"]),
41576
+ title: z16.string().min(1),
41577
+ content: z16.string(),
41578
+ sections: z16.array(z16.string().min(1)),
41579
+ estimatedTokens: z16.number().int().nonnegative(),
41580
+ budget: z16.object({
41581
+ tokenBudget: z16.number().int().positive(),
41582
+ truncated: z16.boolean()
41276
41583
  }).optional()
41277
41584
  });
41278
41585
  var tasksTraverseParamsSchema = paginationParamsSchema.extend({
41279
- rootId: z15.string().min(1),
41586
+ rootId: z16.string().min(1),
41280
41587
  direction: workGraphTraversalDirectionSchema,
41281
- maxDepth: z15.number().int().nonnegative().optional(),
41282
- includeRelations: z15.boolean().optional()
41588
+ maxDepth: z16.number().int().nonnegative().optional(),
41589
+ includeRelations: z16.boolean().optional()
41283
41590
  });
41284
- var tasksTraverseResultSchema = z15.object({
41285
- rootId: z15.string().min(1),
41591
+ var tasksTraverseResultSchema = z16.object({
41592
+ rootId: z16.string().min(1),
41286
41593
  direction: workGraphTraversalDirectionSchema,
41287
- nodes: z15.array(workGraphNodeSchema),
41288
- edges: z15.array(workGraphEdgeSchema),
41594
+ nodes: z16.array(workGraphNodeSchema),
41595
+ edges: z16.array(workGraphEdgeSchema),
41289
41596
  pageInfo: workGraphPageInfoSchema
41290
41597
  });
41291
41598
  var tasksTreeParamsSchema = paginationParamsSchema.extend({
41292
- rootId: z15.string().min(1),
41293
- maxDepth: z15.number().int().nonnegative().optional()
41599
+ rootId: z16.string().min(1),
41600
+ maxDepth: z16.number().int().nonnegative().optional()
41294
41601
  });
41295
- var tasksTreeResultSchema = z15.object({
41296
- rootId: z15.string().min(1),
41297
- nodes: z15.array(workGraphNodeSchema.extend({ depth: z15.number().int().positive() })),
41298
- edges: z15.array(workGraphHierarchyEdgeSchema),
41602
+ var tasksTreeResultSchema = z16.object({
41603
+ rootId: z16.string().min(1),
41604
+ nodes: z16.array(workGraphNodeSchema.extend({ depth: z16.number().int().positive() })),
41605
+ edges: z16.array(workGraphHierarchyEdgeSchema),
41299
41606
  pageInfo: workGraphPageInfoSchema
41300
41607
  });
41301
- var tasksRollupParamsSchema = z15.object({
41302
- rootId: z15.string().min(1),
41608
+ var tasksRollupParamsSchema = z16.object({
41609
+ rootId: z16.string().min(1),
41303
41610
  expectedDirectRollup: workGraphRollupCountsSchema.optional()
41304
41611
  });
41305
- var tasksRollupResultSchema = z15.object({
41306
- rootId: z15.string().min(1),
41612
+ var tasksRollupResultSchema = z16.object({
41613
+ rootId: z16.string().min(1),
41307
41614
  direct: workGraphRollupCountsSchema,
41308
41615
  subtree: workGraphRollupCountsSchema,
41309
- percentDenominator: z15.object({
41310
- basis: z15.literal("subtree-total"),
41311
- total: z15.number().int().nonnegative(),
41312
- description: z15.string().min(1)
41616
+ percentDenominator: z16.object({
41617
+ basis: z16.literal("subtree-total"),
41618
+ total: z16.number().int().nonnegative(),
41619
+ description: z16.string().min(1)
41313
41620
  }),
41314
41621
  percentages: workGraphSubtreePercentagesSchema,
41315
- staleProjection: z15.boolean(),
41316
- projectionMismatches: z15.array(workGraphProjectionMismatchSchema)
41317
- });
41318
- var tasksFrontierParamsSchema = z15.object({
41319
- rootId: z15.string().min(1),
41320
- role: z15.string().min(1).optional()
41321
- });
41322
- var tasksFrontierResultSchema = z15.object({
41323
- rootId: z15.string().min(1),
41324
- role: z15.string().min(1).optional(),
41325
- groups: z15.object({
41326
- ready: z15.array(workGraphReadyFrontierTaskSchema),
41327
- blocked: z15.array(workGraphReadyFrontierTaskSchema),
41328
- blockedBy: z15.array(
41329
- z15.discriminatedUnion("kind", [
41330
- z15.object({
41331
- kind: z15.literal("dependency"),
41332
- blockerId: z15.string().min(1),
41333
- blocks: z15.array(z15.string().min(1))
41622
+ staleProjection: z16.boolean(),
41623
+ projectionMismatches: z16.array(workGraphProjectionMismatchSchema)
41624
+ });
41625
+ var tasksFrontierParamsSchema = z16.object({
41626
+ rootId: z16.string().min(1),
41627
+ role: z16.string().min(1).optional()
41628
+ });
41629
+ var tasksFrontierResultSchema = z16.object({
41630
+ rootId: z16.string().min(1),
41631
+ role: z16.string().min(1).optional(),
41632
+ groups: z16.object({
41633
+ ready: z16.array(workGraphReadyFrontierTaskSchema),
41634
+ blocked: z16.array(workGraphReadyFrontierTaskSchema),
41635
+ blockedBy: z16.array(
41636
+ z16.discriminatedUnion("kind", [
41637
+ z16.object({
41638
+ kind: z16.literal("dependency"),
41639
+ blockerId: z16.string().min(1),
41640
+ blocks: z16.array(z16.string().min(1))
41334
41641
  }),
41335
- z15.object({
41336
- kind: z15.literal("gate"),
41642
+ z16.object({
41643
+ kind: z16.literal("gate"),
41337
41644
  gate: verificationGateSchema,
41338
- blocks: z15.array(z15.string().min(1))
41645
+ blocks: z16.array(z16.string().min(1))
41339
41646
  })
41340
41647
  ])
41341
41648
  )
41342
41649
  })
41343
41650
  });
41344
41651
  var tasksWorkGraphAuditParamsSchema = paginationParamsSchema.extend({
41345
- rootId: z15.string().min(1),
41346
- maxDepth: z15.number().int().nonnegative().optional(),
41347
- includeRelations: z15.boolean().optional()
41348
- });
41349
- var tasksWorkGraphAuditResultSchema = z15.object({
41350
- rootId: z15.string().min(1),
41351
- hierarchy: z15.object({
41352
- valid: z15.boolean(),
41353
- violations: z15.array(
41354
- z15.object({
41355
- code: z15.literal(E_WORKGRAPH_PARENT_TYPE_MATRIX),
41356
- taskId: z15.string().min(1),
41652
+ rootId: z16.string().min(1),
41653
+ maxDepth: z16.number().int().nonnegative().optional(),
41654
+ includeRelations: z16.boolean().optional()
41655
+ });
41656
+ var tasksWorkGraphAuditResultSchema = z16.object({
41657
+ rootId: z16.string().min(1),
41658
+ hierarchy: z16.object({
41659
+ valid: z16.boolean(),
41660
+ violations: z16.array(
41661
+ z16.object({
41662
+ code: z16.literal(E_WORKGRAPH_PARENT_TYPE_MATRIX),
41663
+ taskId: z16.string().min(1),
41357
41664
  taskType: taskTypeSchema,
41358
- parentId: z15.string().min(1).nullable(),
41665
+ parentId: z16.string().min(1).nullable(),
41359
41666
  parentType: taskTypeSchema.optional(),
41360
- message: z15.string().min(1)
41667
+ message: z16.string().min(1)
41361
41668
  })
41362
41669
  )
41363
41670
  }),
41364
41671
  traversal: tasksTraverseResultSchema,
41365
41672
  frontier: tasksFrontierResultSchema,
41366
41673
  rollup: tasksRollupResultSchema,
41367
- relationEdges: z15.object({
41368
- rootId: z15.string().min(1),
41674
+ relationEdges: z16.object({
41675
+ rootId: z16.string().min(1),
41369
41676
  direction: workGraphEdgeDirectionSchema,
41370
- edges: z15.array(
41371
- z15.discriminatedUnion("source", [
41677
+ edges: z16.array(
41678
+ z16.discriminatedUnion("source", [
41372
41679
  workGraphRelationEdgeSchema,
41373
41680
  workGraphDependencyEdgeSchema
41374
41681
  ])
@@ -41377,60 +41684,60 @@ var tasksWorkGraphAuditResultSchema = z15.object({
41377
41684
  });
41378
41685
 
41379
41686
  // packages/contracts/src/operations/docs.ts
41380
- import { z as z16 } from "zod";
41381
- var DOCS_PROJECTION_PROPOSAL_SCHEMA = z16.object({
41382
- version: z16.literal(1),
41383
- operation: z16.literal("docs.projection"),
41384
- identity: z16.object({
41385
- projectId: z16.string().min(1),
41386
- projectRoot: z16.string().min(1),
41387
- actor: z16.string().min(1),
41388
- operation: z16.literal("docs.projection"),
41389
- idempotencyKey: z16.string().min(1)
41687
+ import { z as z17 } from "zod";
41688
+ var DOCS_PROJECTION_PROPOSAL_SCHEMA = z17.object({
41689
+ version: z17.literal(1),
41690
+ operation: z17.literal("docs.projection"),
41691
+ identity: z17.object({
41692
+ projectId: z17.string().min(1),
41693
+ projectRoot: z17.string().min(1),
41694
+ actor: z17.string().min(1),
41695
+ operation: z17.literal("docs.projection"),
41696
+ idempotencyKey: z17.string().min(1)
41390
41697
  }).strict(),
41391
- source: z16.object({
41392
- attachmentId: z16.string().min(1),
41393
- sha256: z16.string().regex(/^[a-f0-9]{64}$/),
41394
- ownerId: z16.string().min(1),
41395
- ownerType: z16.enum(["task", "session", "observation", "decision", "learning", "pattern"]),
41396
- label: z16.string().min(1)
41698
+ source: z17.object({
41699
+ attachmentId: z17.string().min(1),
41700
+ sha256: z17.string().regex(/^[a-f0-9]{64}$/),
41701
+ ownerId: z17.string().min(1),
41702
+ ownerType: z17.enum(["task", "session", "observation", "decision", "learning", "pattern"]),
41703
+ label: z17.string().min(1)
41397
41704
  }).strict(),
41398
- observation: z16.object({
41399
- kind: z16.literal("doc-attachment"),
41400
- attachmentId: z16.string().min(1),
41401
- ownerId: z16.string().min(1),
41402
- addedAt: z16.string().min(1),
41403
- slug: z16.string().optional(),
41404
- type: z16.string().optional()
41705
+ observation: z17.object({
41706
+ kind: z17.literal("doc-attachment"),
41707
+ attachmentId: z17.string().min(1),
41708
+ ownerId: z17.string().min(1),
41709
+ addedAt: z17.string().min(1),
41710
+ slug: z17.string().optional(),
41711
+ type: z17.string().optional()
41405
41712
  }).strict()
41406
41713
  }).strict();
41407
- var DOCS_PROJECTION_RECEIPT_SCHEMA = z16.object({
41408
- version: z16.literal(1),
41409
- sourceHash: z16.string().regex(/^[a-f0-9]{64}$/),
41410
- graph: z16.enum(["completed", "disabled"]),
41714
+ var DOCS_PROJECTION_RECEIPT_SCHEMA = z17.object({
41715
+ version: z17.literal(1),
41716
+ sourceHash: z17.string().regex(/^[a-f0-9]{64}$/),
41717
+ graph: z17.enum(["completed", "disabled"]),
41411
41718
  /** Legacy receipts (before T13985): the "Doc attached" observation the projection wrote. */
41412
- observationId: z16.string().min(1).optional(),
41719
+ observationId: z17.string().min(1).optional(),
41413
41720
  /** T13985 (D11180): the canonical `llmtxt --documents--> owner` edge was written. */
41414
- documents: z16.literal(true).optional(),
41415
- verifiedAt: z16.string().min(1),
41416
- actor: z16.string().min(1)
41721
+ documents: z17.literal(true).optional(),
41722
+ verifiedAt: z17.string().min(1),
41723
+ actor: z17.string().min(1)
41417
41724
  }).strict().refine((receipt) => receipt.observationId !== void 0 || receipt.documents === true, {
41418
41725
  message: "A projection receipt records its documents edge or, for legacy jobs, its observation"
41419
41726
  });
41420
41727
 
41421
41728
  // packages/contracts/src/operations/ensures-schema-registry.ts
41422
- import { z as z17 } from "zod";
41423
- var taskTreeEntrySchema = z17.object({
41424
- 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" }),
41425
- 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), {
41729
+ import { z as z18 } from "zod";
41730
+ var taskTreeEntrySchema = z18.object({
41731
+ 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" }),
41732
+ 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), {
41426
41733
  message: "acceptance array contains no non-empty strings"
41427
41734
  }),
41428
- id: z17.string().optional(),
41429
- parentId: z17.string().optional(),
41430
- depends: z17.array(z17.string()).optional()
41735
+ id: z18.string().optional(),
41736
+ parentId: z18.string().optional(),
41737
+ depends: z18.array(z18.string()).optional()
41431
41738
  });
41432
- var 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" });
41433
- var evidenceSchema = z17.unknown().superRefine((value, ctx) => {
41739
+ var 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" });
41740
+ var evidenceSchema = z18.unknown().superRefine((value, ctx) => {
41434
41741
  if (value === null || value === void 0) {
41435
41742
  ctx.addIssue({
41436
41743
  code: "custom",
@@ -41464,7 +41771,7 @@ var evidenceSchema = z17.unknown().superRefine((value, ctx) => {
41464
41771
  message: `evidence must be a string, array, or object (got ${typeof value})`
41465
41772
  });
41466
41773
  });
41467
- var passthroughSchema = z17.unknown();
41774
+ var passthroughSchema = z18.unknown();
41468
41775
  var LEGACY_PASSTHROUGH_SCHEMA_NAMES = [
41469
41776
  // release.cantbook
41470
41777
  "version_bump_report",
@@ -41497,44 +41804,44 @@ var LEAD_RUNNER_TOOL_NAME = "cleo_run";
41497
41804
  var LEAD_RUNNER_TOOL = `mcp__${LEAD_RUNNER_MCP_SERVER}__${LEAD_RUNNER_TOOL_NAME}`;
41498
41805
 
41499
41806
  // packages/contracts/src/release/evidence-atoms.ts
41500
- import { z as z18 } from "zod";
41501
- var parsedPrEvidenceAtomSchema = z18.object({
41502
- kind: z18.literal("pr"),
41503
- prNumber: z18.number().int().positive()
41504
- });
41505
- var prEvidenceStateModifierSchema = z18.object({
41506
- kind: z18.literal("state"),
41507
- value: z18.literal("MERGED")
41508
- });
41509
- var ghPrViewSchema = z18.object({
41510
- state: z18.enum(["OPEN", "CLOSED", "MERGED"]),
41511
- mergedAt: z18.string().nullable(),
41512
- headRefOid: z18.string().optional(),
41513
- mergeCommit: z18.object({ oid: z18.string() }).nullable().optional(),
41514
- title: z18.string().optional(),
41515
- body: z18.string().optional(),
41516
- headRefName: z18.string().optional(),
41517
- files: z18.array(z18.object({ path: z18.string() })).optional(),
41518
- changedFiles: z18.number().int().nonnegative().optional(),
41519
- mergeable: z18.string().optional(),
41520
- statusCheckRollup: z18.array(
41521
- z18.object({
41522
- __typename: z18.string().optional(),
41523
- name: z18.string().optional(),
41524
- workflowName: z18.string().optional(),
41525
- conclusion: z18.string().nullable().optional(),
41526
- status: z18.string().optional(),
41807
+ import { z as z19 } from "zod";
41808
+ var parsedPrEvidenceAtomSchema = z19.object({
41809
+ kind: z19.literal("pr"),
41810
+ prNumber: z19.number().int().positive()
41811
+ });
41812
+ var prEvidenceStateModifierSchema = z19.object({
41813
+ kind: z19.literal("state"),
41814
+ value: z19.literal("MERGED")
41815
+ });
41816
+ var ghPrViewSchema = z19.object({
41817
+ state: z19.enum(["OPEN", "CLOSED", "MERGED"]),
41818
+ mergedAt: z19.string().nullable(),
41819
+ headRefOid: z19.string().optional(),
41820
+ mergeCommit: z19.object({ oid: z19.string() }).nullable().optional(),
41821
+ title: z19.string().optional(),
41822
+ body: z19.string().optional(),
41823
+ headRefName: z19.string().optional(),
41824
+ files: z19.array(z19.object({ path: z19.string() })).optional(),
41825
+ changedFiles: z19.number().int().nonnegative().optional(),
41826
+ mergeable: z19.string().optional(),
41827
+ statusCheckRollup: z19.array(
41828
+ z19.object({
41829
+ __typename: z19.string().optional(),
41830
+ name: z19.string().optional(),
41831
+ workflowName: z19.string().optional(),
41832
+ conclusion: z19.string().nullable().optional(),
41833
+ status: z19.string().optional(),
41527
41834
  /** ISO start time of a CheckRun; orders re-runs of one check (T13506). */
41528
- startedAt: z18.string().nullable().optional(),
41835
+ startedAt: z19.string().nullable().optional(),
41529
41836
  /** ISO completion time of a CheckRun; orders re-runs of one check (T13506). */
41530
- completedAt: z18.string().nullable().optional()
41837
+ completedAt: z19.string().nullable().optional()
41531
41838
  }).passthrough()
41532
41839
  ).optional().default([])
41533
41840
  }).passthrough();
41534
41841
  var PR_REQUIRED_WORKFLOWS = Object.freeze(["CI", "Contracts Dep Lint"]);
41535
41842
 
41536
41843
  // packages/contracts/src/release/plan.ts
41537
- import { z as z19 } from "zod";
41844
+ import { z as z20 } from "zod";
41538
41845
  var RELEASE_CHANNEL = ["latest", "beta", "alpha", "rc", "canary"];
41539
41846
  var RELEASE_SCHEME = ["calver", "semver", "calver-suffix"];
41540
41847
  var RELEASE_KIND = ["regular", "hotfix", "prerelease"];
@@ -41578,20 +41885,20 @@ var RESOLVED_SOURCE = [
41578
41885
  "language-default",
41579
41886
  "legacy-alias"
41580
41887
  ];
41581
- var ReleaseChannelSchema = z19.enum(RELEASE_CHANNEL);
41582
- var ReleaseSchemeSchema = z19.enum(RELEASE_SCHEME);
41583
- var ReleaseKindSchema = z19.enum(RELEASE_KIND);
41584
- var ReleaseStatusSchema = z19.enum(RELEASE_STATUS);
41585
- var GateStatusSchema = z19.enum(GATE_STATUS);
41586
- var GateNameSchema = z19.enum(GATE_NAME);
41587
- var PlatformTupleSchema = z19.enum(PLATFORM_TUPLE);
41588
- var PublisherSchema = z19.enum(PUBLISHER);
41589
- var TaskKindSchema = z19.enum(TASK_KIND);
41590
- var ImpactSchema = z19.enum(IMPACT);
41591
- var ResolvedSourceSchema = z19.enum(RESOLVED_SOURCE);
41592
- var Iso8601 = z19.iso.datetime({ offset: true });
41593
- var NonEmptyString = z19.string().min(1);
41594
- var ReleasePlanTaskSchema = z19.object({
41888
+ var ReleaseChannelSchema = z20.enum(RELEASE_CHANNEL);
41889
+ var ReleaseSchemeSchema = z20.enum(RELEASE_SCHEME);
41890
+ var ReleaseKindSchema = z20.enum(RELEASE_KIND);
41891
+ var ReleaseStatusSchema = z20.enum(RELEASE_STATUS);
41892
+ var GateStatusSchema = z20.enum(GATE_STATUS);
41893
+ var GateNameSchema = z20.enum(GATE_NAME);
41894
+ var PlatformTupleSchema = z20.enum(PLATFORM_TUPLE);
41895
+ var PublisherSchema = z20.enum(PUBLISHER);
41896
+ var TaskKindSchema = z20.enum(TASK_KIND);
41897
+ var ImpactSchema = z20.enum(IMPACT);
41898
+ var ResolvedSourceSchema = z20.enum(RESOLVED_SOURCE);
41899
+ var Iso8601 = z20.iso.datetime({ offset: true });
41900
+ var NonEmptyString = z20.string().min(1);
41901
+ var ReleasePlanTaskSchema = z20.object({
41595
41902
  /** Task ID (e.g. "T10001"). Format intentionally loose so historical IDs validate. */
41596
41903
  id: NonEmptyString,
41597
41904
  /** Conventional-commit-aligned task classification. */
@@ -41599,20 +41906,20 @@ var ReleasePlanTaskSchema = z19.object({
41599
41906
  /** SemVer impact classification. */
41600
41907
  impact: ImpactSchema,
41601
41908
  /** Human-readable changelog line for this task. */
41602
- userFacingSummary: z19.string(),
41909
+ userFacingSummary: z20.string(),
41603
41910
  /**
41604
41911
  * ADR-051 evidence atoms attesting the task's gate results. Format is
41605
41912
  * `kind:value` (e.g. `commit:abc123`, `test-run:vitest.json`). The contract
41606
41913
  * accepts empty arrays so legacy plans validate; `cleo release plan`
41607
41914
  * enforces non-empty via R-301.
41608
41915
  */
41609
- evidenceAtoms: z19.array(NonEmptyString),
41916
+ evidenceAtoms: z20.array(NonEmptyString),
41610
41917
  /** IVTR phase at plan time — informational only per R-316. */
41611
- ivtrPhaseAtPlan: z19.string().optional(),
41918
+ ivtrPhaseAtPlan: z20.string().optional(),
41612
41919
  /** Epic this task rolls up to, locked at plan time per R-303. */
41613
41920
  epicAncestor: NonEmptyString
41614
41921
  });
41615
- var ReleaseGateSchema = z19.object({
41922
+ var ReleaseGateSchema = z20.object({
41616
41923
  /** Canonical gate name. */
41617
41924
  name: GateNameSchema,
41618
41925
  /** ADR-051 atom string identifying the resolved tool (e.g. `tool:test`). */
@@ -41622,11 +41929,11 @@ var ReleaseGateSchema = z19.object({
41622
41929
  /** ISO-8601 timestamp the gate was last verified. */
41623
41930
  lastVerifiedAt: Iso8601,
41624
41931
  /** Resolved shell command (e.g. `pnpm run test`). Optional for unresolved gates. */
41625
- resolvedCommand: z19.string().optional(),
41932
+ resolvedCommand: z20.string().optional(),
41626
41933
  /** Provenance of the resolved command. Optional for unresolved gates. */
41627
41934
  resolvedSource: ResolvedSourceSchema.optional()
41628
41935
  });
41629
- var ReleasePlatformMatrixEntrySchema = z19.object({
41936
+ var ReleasePlatformMatrixEntrySchema = z20.object({
41630
41937
  /** Target platform tuple. */
41631
41938
  platform: PlatformTupleSchema,
41632
41939
  /** Distribution backend. */
@@ -41634,47 +41941,47 @@ var ReleasePlatformMatrixEntrySchema = z19.object({
41634
41941
  /** Package identifier on the target backend (e.g. `@cleocode/cleo`). */
41635
41942
  package: NonEmptyString,
41636
41943
  /** Whether to run the GHA smoke job for this matrix entry. */
41637
- smoke: z19.boolean().default(true).optional()
41944
+ smoke: z20.boolean().default(true).optional()
41638
41945
  });
41639
- var ReleasePreflightSummarySchema = z19.object({
41946
+ var ReleasePreflightSummarySchema = z20.object({
41640
41947
  /** True if esbuild externals are out of sync with package.json. */
41641
- esbuildExternalsDrift: z19.boolean(),
41948
+ esbuildExternalsDrift: z20.boolean(),
41642
41949
  /** True if `pnpm-lock.yaml` diverges from the workspace manifest. */
41643
- lockfileDrift: z19.boolean(),
41950
+ lockfileDrift: z20.boolean(),
41644
41951
  /** True if all epic children are in terminal lifecycle states. */
41645
- epicCompletenessClean: z19.boolean(),
41952
+ epicCompletenessClean: z20.boolean(),
41646
41953
  /** True if no task appears in multiple in-flight release plans. */
41647
- doubleListingClean: z19.boolean(),
41954
+ doubleListingClean: z20.boolean(),
41648
41955
  /** Non-fatal preflight warnings (e.g. unresolved tools per R-024). */
41649
- preflightWarnings: z19.array(z19.string()).default([]).optional()
41956
+ preflightWarnings: z20.array(z20.string()).default([]).optional()
41650
41957
  });
41651
- var ReleasePlanChangelogSchema = z19.object({
41958
+ var ReleasePlanChangelogSchema = z20.object({
41652
41959
  /** `kind=feat` tasks. */
41653
- features: z19.array(NonEmptyString).default([]),
41960
+ features: z20.array(NonEmptyString).default([]),
41654
41961
  /** `kind=fix` or `kind=hotfix` tasks. */
41655
- fixes: z19.array(NonEmptyString).default([]),
41962
+ fixes: z20.array(NonEmptyString).default([]),
41656
41963
  /** `kind=chore`, `docs`, `refactor`, `test`, `perf` tasks. */
41657
- chores: z19.array(NonEmptyString).default([]),
41964
+ chores: z20.array(NonEmptyString).default([]),
41658
41965
  /** `kind=breaking` or `kind=revert` tasks. */
41659
- breaking: z19.array(NonEmptyString).default([])
41966
+ breaking: z20.array(NonEmptyString).default([])
41660
41967
  });
41661
- var ReleasePlanMetaSchema = z19.object({
41968
+ var ReleasePlanMetaSchema = z20.object({
41662
41969
  /** True if this is the project's first ever release. */
41663
- firstEverRelease: z19.boolean().optional(),
41970
+ firstEverRelease: z20.boolean().optional(),
41664
41971
  /** Canonical tool names that could not be resolved at plan time. */
41665
- unresolvedTools: z19.array(z19.string()).optional(),
41972
+ unresolvedTools: z20.array(z20.string()).optional(),
41666
41973
  /** Project archetype detected at plan time. */
41667
- archetype: z19.string().optional()
41668
- }).catchall(z19.unknown());
41669
- var ReleasePlanSchema = z19.object({
41974
+ archetype: z20.string().optional()
41975
+ }).catchall(z20.unknown());
41976
+ var ReleasePlanSchema = z20.object({
41670
41977
  /** Schema URL for this plan version. */
41671
- $schema: z19.string().optional(),
41978
+ $schema: z20.string().optional(),
41672
41979
  /** Requested version string (e.g. "v2026.6.0"). Includes the leading `v`. */
41673
41980
  version: NonEmptyString,
41674
41981
  /** Resolved version string after suffix application (e.g. "v2026.6.0.2"). */
41675
41982
  resolvedVersion: NonEmptyString,
41676
41983
  /** True if a `calver-suffix` was applied to disambiguate a same-day hotfix. */
41677
- suffixApplied: z19.boolean(),
41984
+ suffixApplied: z20.boolean(),
41678
41985
  /** Versioning scheme governing `version` / `resolvedVersion`. */
41679
41986
  scheme: ReleaseSchemeSchema,
41680
41987
  /** npm dist-tag channel for this release. */
@@ -41688,7 +41995,7 @@ var ReleasePlanSchema = z19.object({
41688
41995
  /** Release-kind classification. */
41689
41996
  releaseKind: ReleaseKindSchema,
41690
41997
  /** Explicit hooks-v1 stable promotion; ordinary and hotfix releases are exempt. */
41691
- hooksV1Promotion: z19.boolean().optional(),
41998
+ hooksV1Promotion: z20.boolean().optional(),
41692
41999
  /** Audited reason for shipping a source change that opens the hooks-v1 gate without the promotion (T13555). */
41693
42000
  hooksV1Waiver: NonEmptyString.optional(),
41694
42001
  /** ISO-8601 timestamp the plan was written. */
@@ -41699,27 +42006,27 @@ var ReleasePlanSchema = z19.object({
41699
42006
  * Version of the previous release on the same channel. MUST be `null` only
41700
42007
  * for first-ever releases (R-300, enforced at the verb layer).
41701
42008
  */
41702
- previousVersion: z19.string().nullable(),
42009
+ previousVersion: z20.string().nullable(),
41703
42010
  /** Git tag of the previous release (typically `previousVersion` prefixed). */
41704
- previousTag: z19.string().nullable(),
42011
+ previousTag: z20.string().nullable(),
41705
42012
  /** ISO-8601 timestamp the previous release was published. */
41706
42013
  previousShippedAt: Iso8601.nullable(),
41707
42014
  /** Tasks rolled into this release. */
41708
- tasks: z19.array(ReleasePlanTaskSchema),
42015
+ tasks: z20.array(ReleasePlanTaskSchema),
41709
42016
  /** Bucketed changelog. */
41710
42017
  changelog: ReleasePlanChangelogSchema,
41711
42018
  /** Per-gate verification status. */
41712
- gates: z19.array(ReleaseGateSchema),
42019
+ gates: z20.array(ReleaseGateSchema),
41713
42020
  /** Platform / publisher matrix. */
41714
- platformMatrix: z19.array(ReleasePlatformMatrixEntrySchema),
42021
+ platformMatrix: z20.array(ReleasePlatformMatrixEntrySchema),
41715
42022
  /** Preflight summary from `cleo release plan`. */
41716
42023
  preflightSummary: ReleasePreflightSummarySchema,
41717
42024
  /** URL of the GHA workflow run (populated by `release-prepare.yml`). */
41718
- workflowRunUrl: z19.string().nullable(),
42025
+ workflowRunUrl: z20.string().nullable(),
41719
42026
  /** URL of the bump PR (populated by `cleo release open`). */
41720
- prUrl: z19.string().nullable(),
42027
+ prUrl: z20.string().nullable(),
41721
42028
  /** Merge commit SHA on `main` (populated by `release-publish.yml`). */
41722
- mergeCommitSha: z19.string().nullable(),
42029
+ mergeCommitSha: z20.string().nullable(),
41723
42030
  /** Current FSM state per R-302. */
41724
42031
  status: ReleaseStatusSchema,
41725
42032
  /** Informational / forward-compat metadata. */
@@ -41749,48 +42056,48 @@ var RESOURCE_CLASSES = Object.freeze([
41749
42056
  ]);
41750
42057
 
41751
42058
  // packages/contracts/src/session-journal.ts
41752
- import { z as z20 } from "zod";
42059
+ import { z as z21 } from "zod";
41753
42060
  var SESSION_JOURNAL_SCHEMA_VERSION = "1.0";
41754
- var sessionJournalDoctorSummarySchema = z20.object({
42061
+ var sessionJournalDoctorSummarySchema = z21.object({
41755
42062
  /** `true` when zero noise patterns were detected. */
41756
- isClean: z20.boolean(),
42063
+ isClean: z21.boolean(),
41757
42064
  /** Total number of noise findings across all patterns. */
41758
- findingsCount: z20.number().int().nonnegative(),
42065
+ findingsCount: z21.number().int().nonnegative(),
41759
42066
  /** Pattern names that were detected (empty when isClean). */
41760
- patterns: z20.array(z20.string()),
42067
+ patterns: z21.array(z21.string()),
41761
42068
  /** Total brain entries scanned. `0` = empty or unavailable. */
41762
- totalScanned: z20.number().int().nonnegative()
42069
+ totalScanned: z21.number().int().nonnegative()
41763
42070
  });
41764
- var sessionJournalDebriefSummarySchema = z20.object({
42071
+ var sessionJournalDebriefSummarySchema = z21.object({
41765
42072
  /** First 200 characters of the session end note (if provided). */
41766
- noteExcerpt: z20.string().max(200).optional(),
42073
+ noteExcerpt: z21.string().max(200).optional(),
41767
42074
  /** Number of tasks completed during the session. */
41768
- tasksCompletedCount: z20.number().int().nonnegative(),
42075
+ tasksCompletedCount: z21.number().int().nonnegative(),
41769
42076
  /** Up to 5 task IDs (not titles) that were the focus of the session. */
41770
- tasksFocused: z20.array(z20.string()).max(5).optional()
42077
+ tasksFocused: z21.array(z21.string()).max(5).optional()
41771
42078
  });
41772
- var sessionJournalEntrySchema = z20.object({
42079
+ var sessionJournalEntrySchema = z21.object({
41773
42080
  // Identity
41774
42081
  /** Schema version for forward-compatibility. Always `'1.0'` in this release. */
41775
- schemaVersion: z20.literal(SESSION_JOURNAL_SCHEMA_VERSION),
42082
+ schemaVersion: z21.literal(SESSION_JOURNAL_SCHEMA_VERSION),
41776
42083
  /** ISO 8601 timestamp when the entry was written. */
41777
- timestamp: z20.string(),
42084
+ timestamp: z21.string(),
41778
42085
  /** CLEO session ID (e.g. `ses_20260424055456_ede571`). */
41779
- sessionId: z20.string(),
42086
+ sessionId: z21.string(),
41780
42087
  /** Event type that triggered this journal entry. */
41781
- eventType: z20.enum(["session_start", "session_end", "observation", "decision", "error"]),
42088
+ eventType: z21.enum(["session_start", "session_end", "observation", "decision", "error"]),
41782
42089
  // Session metadata (set on session_start / session_end)
41783
42090
  /** Agent identifier (e.g. `cleo-prime`, `claude-code`). */
41784
- agentIdentifier: z20.string().optional(),
42091
+ agentIdentifier: z21.string().optional(),
41785
42092
  /** Provider adapter ID active for this session. */
41786
- providerId: z20.string().optional(),
42093
+ providerId: z21.string().optional(),
41787
42094
  /** Session scope string (e.g. `'global'` or `'epic:T1263'`). */
41788
- scope: z20.string().optional(),
42095
+ scope: z21.string().optional(),
41789
42096
  // Session-end fields
41790
42097
  /** Duration of the session in seconds (session_end only). */
41791
- duration: z20.number().int().nonnegative().optional(),
42098
+ duration: z21.number().int().nonnegative().optional(),
41792
42099
  /** Task IDs (not titles) completed during the session. */
41793
- tasksCompleted: z20.array(z20.string()).optional(),
42100
+ tasksCompleted: z21.array(z21.string()).optional(),
41794
42101
  // Doctor summary (T1262 absorbed)
41795
42102
  /**
41796
42103
  * Compact result of `scanBrainNoise` run at session-end.
@@ -41805,52 +42112,52 @@ var sessionJournalEntrySchema = z20.object({
41805
42112
  debriefSummary: sessionJournalDebriefSummarySchema.optional(),
41806
42113
  // Optional hash chain
41807
42114
  /** SHA-256 hex of the previous entry's raw JSON string (for integrity chain). */
41808
- prevEntryHash: z20.string().optional()
42115
+ prevEntryHash: z21.string().optional()
41809
42116
  });
41810
42117
 
41811
42118
  // packages/contracts/src/task-evidence.ts
41812
- import { z as z21 } from "zod";
41813
- var fileEvidenceSchema = z21.object({
41814
- kind: z21.literal("file"),
41815
- sha256: z21.string().length(64),
41816
- timestamp: z21.string().datetime(),
41817
- path: z21.string().min(1),
41818
- mime: z21.string().optional(),
41819
- description: z21.string().optional()
41820
- });
41821
- var logEvidenceSchema = z21.object({
41822
- kind: z21.literal("log"),
41823
- sha256: z21.string().length(64),
41824
- timestamp: z21.string().datetime(),
41825
- source: z21.string().min(1),
41826
- description: z21.string().optional()
41827
- });
41828
- var screenshotEvidenceSchema = z21.object({
41829
- kind: z21.literal("screenshot"),
41830
- sha256: z21.string().length(64),
41831
- timestamp: z21.string().datetime(),
41832
- mime: z21.enum(["image/png", "image/jpeg", "image/webp"]).optional(),
41833
- description: z21.string().optional()
41834
- });
41835
- var testOutputEvidenceSchema = z21.object({
41836
- kind: z21.literal("test-output"),
41837
- sha256: z21.string().length(64),
41838
- timestamp: z21.string().datetime(),
41839
- passed: z21.number().int().nonnegative(),
41840
- failed: z21.number().int().nonnegative(),
41841
- skipped: z21.number().int().nonnegative(),
41842
- exitCode: z21.number().int(),
41843
- description: z21.string().optional()
41844
- });
41845
- var commandOutputEvidenceSchema = z21.object({
41846
- kind: z21.literal("command-output"),
41847
- sha256: z21.string().length(64),
41848
- timestamp: z21.string().datetime(),
41849
- cmd: z21.string().min(1),
41850
- exitCode: z21.number().int(),
41851
- description: z21.string().optional()
41852
- });
41853
- var taskEvidenceSchema = z21.discriminatedUnion("kind", [
42119
+ import { z as z22 } from "zod";
42120
+ var fileEvidenceSchema = z22.object({
42121
+ kind: z22.literal("file"),
42122
+ sha256: z22.string().length(64),
42123
+ timestamp: z22.string().datetime(),
42124
+ path: z22.string().min(1),
42125
+ mime: z22.string().optional(),
42126
+ description: z22.string().optional()
42127
+ });
42128
+ var logEvidenceSchema = z22.object({
42129
+ kind: z22.literal("log"),
42130
+ sha256: z22.string().length(64),
42131
+ timestamp: z22.string().datetime(),
42132
+ source: z22.string().min(1),
42133
+ description: z22.string().optional()
42134
+ });
42135
+ var screenshotEvidenceSchema = z22.object({
42136
+ kind: z22.literal("screenshot"),
42137
+ sha256: z22.string().length(64),
42138
+ timestamp: z22.string().datetime(),
42139
+ mime: z22.enum(["image/png", "image/jpeg", "image/webp"]).optional(),
42140
+ description: z22.string().optional()
42141
+ });
42142
+ var testOutputEvidenceSchema = z22.object({
42143
+ kind: z22.literal("test-output"),
42144
+ sha256: z22.string().length(64),
42145
+ timestamp: z22.string().datetime(),
42146
+ passed: z22.number().int().nonnegative(),
42147
+ failed: z22.number().int().nonnegative(),
42148
+ skipped: z22.number().int().nonnegative(),
42149
+ exitCode: z22.number().int(),
42150
+ description: z22.string().optional()
42151
+ });
42152
+ var commandOutputEvidenceSchema = z22.object({
42153
+ kind: z22.literal("command-output"),
42154
+ sha256: z22.string().length(64),
42155
+ timestamp: z22.string().datetime(),
42156
+ cmd: z22.string().min(1),
42157
+ exitCode: z22.number().int(),
42158
+ description: z22.string().optional()
42159
+ });
42160
+ var taskEvidenceSchema = z22.discriminatedUnion("kind", [
41854
42161
  fileEvidenceSchema,
41855
42162
  logEvidenceSchema,
41856
42163
  screenshotEvidenceSchema,
@@ -41859,8 +42166,8 @@ var taskEvidenceSchema = z21.discriminatedUnion("kind", [
41859
42166
  ]);
41860
42167
 
41861
42168
  // packages/contracts/src/tasks/archive.ts
41862
- import { z as z22 } from "zod";
41863
- var ArchiveReason = z22.enum([
42169
+ import { z as z23 } from "zod";
42170
+ var ArchiveReason = z23.enum([
41864
42171
  "verified",
41865
42172
  "reconciled",
41866
42173
  "superseded",
@@ -41871,42 +42178,42 @@ var ArchiveReason = z22.enum([
41871
42178
  var ARCHIVE_REASON_VALUES = ArchiveReason.options;
41872
42179
 
41873
42180
  // packages/contracts/src/tasks/index.ts
41874
- import { z as z23 } from "zod";
41875
- var taskMutationWarningSeveritySchema = z23.enum(["info", "warning"]);
41876
- var taskMutationWarningSchema = z23.object({
41877
- code: z23.string().min(1),
41878
- message: z23.string().min(1),
42181
+ import { z as z24 } from "zod";
42182
+ var taskMutationWarningSeveritySchema = z24.enum(["info", "warning"]);
42183
+ var taskMutationWarningSchema = z24.object({
42184
+ code: z24.string().min(1),
42185
+ message: z24.string().min(1),
41879
42186
  severity: taskMutationWarningSeveritySchema.optional(),
41880
- taskId: z23.string().min(1).optional(),
41881
- field: z23.string().min(1).optional(),
41882
- index: z23.number().int().nonnegative().optional()
41883
- });
41884
- var taskMutationDryRunSummarySchema = z23.object({
41885
- dryRun: z23.literal(true),
41886
- wouldCreate: z23.number().int().nonnegative(),
41887
- wouldUpdate: z23.number().int().nonnegative(),
41888
- wouldDelete: z23.number().int().nonnegative(),
41889
- wouldAffect: z23.number().int().nonnegative(),
41890
- validatedCount: z23.number().int().nonnegative(),
41891
- insertedCount: z23.literal(0),
41892
- updatedCount: z23.literal(0),
41893
- deletedCount: z23.literal(0),
41894
- warnings: z23.array(taskMutationWarningSchema)
41895
- });
41896
- var taskMutationTaskRecordSchema = z23.object({ id: z23.string().min(1) }).passthrough();
41897
- var taskMutationEnvelopeSchema = z23.object({
41898
- dryRun: z23.boolean().optional(),
41899
- created: z23.array(taskMutationTaskRecordSchema),
41900
- updated: z23.array(taskMutationTaskRecordSchema),
41901
- deleted: z23.array(taskMutationTaskRecordSchema),
41902
- affectedCount: z23.number().int().nonnegative(),
41903
- mutationWarnings: z23.array(taskMutationWarningSchema),
42187
+ taskId: z24.string().min(1).optional(),
42188
+ field: z24.string().min(1).optional(),
42189
+ index: z24.number().int().nonnegative().optional()
42190
+ });
42191
+ var taskMutationDryRunSummarySchema = z24.object({
42192
+ dryRun: z24.literal(true),
42193
+ wouldCreate: z24.number().int().nonnegative(),
42194
+ wouldUpdate: z24.number().int().nonnegative(),
42195
+ wouldDelete: z24.number().int().nonnegative(),
42196
+ wouldAffect: z24.number().int().nonnegative(),
42197
+ validatedCount: z24.number().int().nonnegative(),
42198
+ insertedCount: z24.literal(0),
42199
+ updatedCount: z24.literal(0),
42200
+ deletedCount: z24.literal(0),
42201
+ warnings: z24.array(taskMutationWarningSchema)
42202
+ });
42203
+ var taskMutationTaskRecordSchema = z24.object({ id: z24.string().min(1) }).passthrough();
42204
+ var taskMutationEnvelopeSchema = z24.object({
42205
+ dryRun: z24.boolean().optional(),
42206
+ created: z24.array(taskMutationTaskRecordSchema),
42207
+ updated: z24.array(taskMutationTaskRecordSchema),
42208
+ deleted: z24.array(taskMutationTaskRecordSchema),
42209
+ affectedCount: z24.number().int().nonnegative(),
42210
+ mutationWarnings: z24.array(taskMutationWarningSchema),
41904
42211
  dryRunSummary: taskMutationDryRunSummarySchema.optional()
41905
42212
  });
41906
- var completionTaskStatusSchema = z23.enum(TASK_STATUSES);
41907
- var completionCriterionKindSchema = z23.enum(["text", "evidence_bound", "child_task"]);
41908
- var completionCriterionStatusSchema = z23.enum(["satisfied", "unsatisfied", "waived", "replaced"]);
41909
- var completionBlockerReasonSchema = z23.enum([
42213
+ var completionTaskStatusSchema = z24.enum(TASK_STATUSES);
42214
+ var completionCriterionKindSchema = z24.enum(["text", "evidence_bound", "child_task"]);
42215
+ var completionCriterionStatusSchema = z24.enum(["satisfied", "unsatisfied", "waived", "replaced"]);
42216
+ var completionBlockerReasonSchema = z24.enum([
41910
42217
  "missing_evidence_binding",
41911
42218
  "child_not_done",
41912
42219
  "child_cancelled_requires_waiver",
@@ -41914,68 +42221,68 @@ var completionBlockerReasonSchema = z23.enum([
41914
42221
  "child_missing",
41915
42222
  "done_parent_stale"
41916
42223
  ]);
41917
- var completionStaleReasonSchema = z23.enum(["done_parent_has_unsatisfied_criteria"]);
41918
- var completionProjectionRepairErrorCodeSchema = z23.enum([
42224
+ var completionStaleReasonSchema = z24.enum(["done_parent_has_unsatisfied_criteria"]);
42225
+ var completionProjectionRepairErrorCodeSchema = z24.enum([
41919
42226
  "projection_not_stale",
41920
42227
  "criteria_missing",
41921
42228
  "binding_target_missing",
41922
42229
  "repair_conflict"
41923
42230
  ]);
41924
- var completionCriterionWaiverSchema = z23.object({
41925
- criterionAcId: z23.string().min(1),
41926
- childTaskId: z23.string().min(1),
41927
- reason: z23.string().min(1),
41928
- actor: z23.string().min(1),
41929
- waivedAt: z23.string().min(1)
41930
- });
41931
- var completionCriterionReplacementSchema = z23.object({
41932
- criterionAcId: z23.string().min(1),
41933
- originalChildTaskId: z23.string().min(1),
41934
- replacementChildTaskId: z23.string().min(1),
41935
- reason: z23.string().min(1),
41936
- actor: z23.string().min(1),
41937
- replacedAt: z23.string().min(1)
41938
- });
41939
- var completionCriterionEvaluationSchema = z23.object({
41940
- acId: z23.string().min(1),
41941
- alias: z23.string().min(1),
41942
- text: z23.string(),
42231
+ var completionCriterionWaiverSchema = z24.object({
42232
+ criterionAcId: z24.string().min(1),
42233
+ childTaskId: z24.string().min(1),
42234
+ reason: z24.string().min(1),
42235
+ actor: z24.string().min(1),
42236
+ waivedAt: z24.string().min(1)
42237
+ });
42238
+ var completionCriterionReplacementSchema = z24.object({
42239
+ criterionAcId: z24.string().min(1),
42240
+ originalChildTaskId: z24.string().min(1),
42241
+ replacementChildTaskId: z24.string().min(1),
42242
+ reason: z24.string().min(1),
42243
+ actor: z24.string().min(1),
42244
+ replacedAt: z24.string().min(1)
42245
+ });
42246
+ var completionCriterionEvaluationSchema = z24.object({
42247
+ acId: z24.string().min(1),
42248
+ alias: z24.string().min(1),
42249
+ text: z24.string(),
41943
42250
  kind: completionCriterionKindSchema,
41944
42251
  status: completionCriterionStatusSchema,
41945
42252
  reason: completionBlockerReasonSchema.optional(),
41946
- targetTaskId: z23.string().min(1).optional(),
42253
+ targetTaskId: z24.string().min(1).optional(),
41947
42254
  targetTaskStatus: completionTaskStatusSchema.optional(),
41948
42255
  waiver: completionCriterionWaiverSchema.optional(),
41949
42256
  replacement: completionCriterionReplacementSchema.optional(),
41950
42257
  replacementTaskStatus: completionTaskStatusSchema.optional(),
41951
- evidenceBindings: z23.number().int().nonnegative()
42258
+ evidenceBindings: z24.number().int().nonnegative()
41952
42259
  });
41953
42260
  var unsatisfiedCompletionCriterionSchema = completionCriterionEvaluationSchema.extend({
41954
- status: z23.literal("unsatisfied"),
42261
+ status: z24.literal("unsatisfied"),
41955
42262
  reason: completionBlockerReasonSchema
41956
42263
  });
41957
- var completionTotalsSchema = z23.object({
41958
- criteria: z23.number().int().nonnegative(),
41959
- satisfied: z23.number().int().nonnegative(),
41960
- unsatisfied: z23.number().int().nonnegative(),
41961
- waived: z23.number().int().nonnegative(),
41962
- replaced: z23.number().int().nonnegative()
41963
- });
41964
- var completionContextPackSchema = z23.object({
41965
- taskId: z23.string().min(1),
41966
- generatedAt: z23.string().min(1),
41967
- source: z23.literal("audit_log"),
41968
- window: z23.object({
41969
- limit: z23.number().int().positive(),
41970
- since: z23.string().min(1).optional(),
41971
- relationDepth: z23.number().int().nonnegative(),
41972
- relatedTaskIds: z23.array(z23.string().min(1))
42264
+ var completionTotalsSchema = z24.object({
42265
+ criteria: z24.number().int().nonnegative(),
42266
+ satisfied: z24.number().int().nonnegative(),
42267
+ unsatisfied: z24.number().int().nonnegative(),
42268
+ waived: z24.number().int().nonnegative(),
42269
+ replaced: z24.number().int().nonnegative()
42270
+ });
42271
+ var completionContextPackSchema = z24.object({
42272
+ taskId: z24.string().min(1),
42273
+ generatedAt: z24.string().min(1),
42274
+ source: z24.literal("audit_log"),
42275
+ window: z24.object({
42276
+ limit: z24.number().int().positive(),
42277
+ since: z24.string().min(1).optional(),
42278
+ relationDepth: z24.number().int().nonnegative(),
42279
+ relatedTaskIds: z24.array(z24.string().min(1))
41973
42280
  }),
41974
- events: z23.array(
41975
- z23.object({
41976
- id: z23.string().min(1),
41977
- timestamp: z23.string().min(1),
41978
- action: z23.enum([
42281
+ events: z24.array(
42282
+ z24.object({
42283
+ id: z24.string().min(1),
42284
+ timestamp: z24.string().min(1),
42285
+ action: z24.enum([
41979
42286
  "task_completed",
41980
42287
  "task_reopened",
41981
42288
  "task_cancelled",
@@ -41983,77 +42290,77 @@ var completionContextPackSchema = z23.object({
41983
42290
  "task_reparented",
41984
42291
  "ac_projection_rebuilt"
41985
42292
  ]),
41986
- taskId: z23.string().min(1),
41987
- relation: z23.enum(["self", "parent", "child", "sibling", "related"]),
41988
- actor: z23.string().min(1),
41989
- details: z23.record(z23.string(), z23.unknown()).optional(),
41990
- before: z23.record(z23.string(), z23.unknown()).optional(),
41991
- after: z23.record(z23.string(), z23.unknown()).optional()
42293
+ taskId: z24.string().min(1),
42294
+ relation: z24.enum(["self", "parent", "child", "sibling", "related"]),
42295
+ actor: z24.string().min(1),
42296
+ details: z24.record(z24.string(), z24.unknown()).optional(),
42297
+ before: z24.record(z24.string(), z24.unknown()).optional(),
42298
+ after: z24.record(z24.string(), z24.unknown()).optional()
41992
42299
  })
41993
42300
  ),
41994
- summary: z23.object({
41995
- totalEvents: z23.number().int().nonnegative(),
41996
- byAction: z23.record(z23.string(), z23.number().int().nonnegative()),
41997
- byRelation: z23.record(z23.string(), z23.number().int().nonnegative()),
41998
- latestEventAt: z23.string().nullable()
42301
+ summary: z24.object({
42302
+ totalEvents: z24.number().int().nonnegative(),
42303
+ byAction: z24.record(z24.string(), z24.number().int().nonnegative()),
42304
+ byRelation: z24.record(z24.string(), z24.number().int().nonnegative()),
42305
+ latestEventAt: z24.string().nullable()
41999
42306
  })
42000
42307
  });
42001
- var completionEvaluationSchema = z23.object({
42002
- taskId: z23.string().min(1),
42308
+ var completionEvaluationSchema = z24.object({
42309
+ taskId: z24.string().min(1),
42003
42310
  taskStatus: completionTaskStatusSchema,
42004
- ready: z23.boolean(),
42005
- stale: z23.boolean(),
42006
- staleReasons: z23.array(completionStaleReasonSchema),
42311
+ ready: z24.boolean(),
42312
+ stale: z24.boolean(),
42313
+ staleReasons: z24.array(completionStaleReasonSchema),
42007
42314
  contextPack: completionContextPackSchema.optional(),
42008
- satisfied: z23.array(completionCriterionEvaluationSchema),
42009
- unsatisfied: z23.array(unsatisfiedCompletionCriterionSchema),
42010
- waived: z23.array(completionCriterionEvaluationSchema),
42011
- replaced: z23.array(completionCriterionEvaluationSchema),
42315
+ satisfied: z24.array(completionCriterionEvaluationSchema),
42316
+ unsatisfied: z24.array(unsatisfiedCompletionCriterionSchema),
42317
+ waived: z24.array(completionCriterionEvaluationSchema),
42318
+ replaced: z24.array(completionCriterionEvaluationSchema),
42012
42319
  totals: completionTotalsSchema
42013
42320
  });
42014
- var completionExplanationSchema = z23.object({
42015
- taskId: z23.string().min(1),
42016
- ready: z23.boolean(),
42017
- stale: z23.boolean(),
42018
- summary: z23.string(),
42321
+ var completionExplanationSchema = z24.object({
42322
+ taskId: z24.string().min(1),
42323
+ ready: z24.boolean(),
42324
+ stale: z24.boolean(),
42325
+ summary: z24.string(),
42019
42326
  contextPack: completionContextPackSchema.optional(),
42020
- blockers: z23.array(completionCriterionEvaluationSchema)
42327
+ blockers: z24.array(completionCriterionEvaluationSchema)
42021
42328
  });
42022
- var completionListParamsSchema = z23.object({
42023
- taskId: z23.string().min(1),
42329
+ var completionListParamsSchema = z24.object({
42330
+ taskId: z24.string().min(1),
42024
42331
  status: completionCriterionStatusSchema.optional(),
42025
42332
  kind: completionCriterionKindSchema.optional()
42026
42333
  });
42027
- var completionListResultSchema = z23.object({
42028
- taskId: z23.string().min(1),
42029
- criteria: z23.array(completionCriterionEvaluationSchema),
42334
+ var completionListResultSchema = z24.object({
42335
+ taskId: z24.string().min(1),
42336
+ criteria: z24.array(completionCriterionEvaluationSchema),
42030
42337
  totals: completionTotalsSchema
42031
42338
  });
42032
- var completionEvaluateParamsSchema = z23.object({
42033
- taskId: z23.string().min(1),
42034
- includeContext: z23.boolean().optional(),
42035
- limit: z23.number().int().positive().optional(),
42036
- since: z23.string().min(1).optional(),
42037
- relationDepth: z23.number().int().nonnegative().optional()
42339
+ var completionEvaluateParamsSchema = z24.object({
42340
+ taskId: z24.string().min(1),
42341
+ includeContext: z24.boolean().optional(),
42342
+ limit: z24.number().int().positive().optional(),
42343
+ since: z24.string().min(1).optional(),
42344
+ relationDepth: z24.number().int().nonnegative().optional()
42038
42345
  });
42039
- var completionProjectionRepairErrorSchema = z23.object({
42346
+ var completionProjectionRepairErrorSchema = z24.object({
42040
42347
  code: completionProjectionRepairErrorCodeSchema,
42041
- message: z23.string().min(1),
42042
- taskId: z23.string().min(1),
42043
- acId: z23.string().min(1).optional(),
42044
- evidenceAtomId: z23.string().min(1).optional()
42045
- });
42046
- var completionProjectionRepairParamsSchema = z23.object({
42047
- taskId: z23.string().min(1),
42048
- dryRun: z23.boolean().optional()
42049
- });
42050
- var completionProjectionRepairResultSchema = z23.object({
42051
- taskId: z23.string().min(1),
42052
- repaired: z23.boolean(),
42053
- dryRun: z23.boolean(),
42054
- staleBefore: z23.boolean(),
42055
- staleAfter: z23.boolean(),
42056
- errors: z23.array(completionProjectionRepairErrorSchema)
42348
+ message: z24.string().min(1),
42349
+ taskId: z24.string().min(1),
42350
+ acId: z24.string().min(1).optional(),
42351
+ evidenceAtomId: z24.string().min(1).optional()
42352
+ });
42353
+ var completionProjectionRepairParamsSchema = z24.object({
42354
+ taskId: z24.string().min(1),
42355
+ dryRun: z24.boolean().optional()
42356
+ });
42357
+ var completionProjectionRepairResultSchema = z24.object({
42358
+ taskId: z24.string().min(1),
42359
+ repaired: z24.boolean(),
42360
+ dryRun: z24.boolean(),
42361
+ staleBefore: z24.boolean(),
42362
+ staleAfter: z24.boolean(),
42363
+ errors: z24.array(completionProjectionRepairErrorSchema)
42057
42364
  });
42058
42365
 
42059
42366
  // packages/contracts/src/taxonomy.ts
@@ -42556,7 +42863,7 @@ var TaxonomyRegistry = class _TaxonomyRegistry {
42556
42863
  };
42557
42864
 
42558
42865
  // packages/contracts/src/templates/manifest.ts
42559
- import { z as z24 } from "zod";
42866
+ import { z as z25 } from "zod";
42560
42867
  var TEMPLATE_KINDS = ["workflow", "config", "agent", "skill", "provider", "doc"];
42561
42868
  var TEMPLATE_SUBSTITUTIONS = ["regex-tmpl", "static", "json-merge"];
42562
42869
  var TEMPLATE_UPDATE_STRATEGIES = [
@@ -42573,79 +42880,79 @@ var PLACEHOLDER_SOURCES = [
42573
42880
  "tool-resolver",
42574
42881
  "literal"
42575
42882
  ];
42576
- var PlaceholderSpecSchema = z24.object({
42883
+ var PlaceholderSpecSchema = z25.object({
42577
42884
  /**
42578
42885
  * Placeholder identifier as it appears in the template body
42579
42886
  * (e.g. `NODE_VERSION` matches `{{NODE_VERSION}}`).
42580
42887
  */
42581
- name: z24.string().min(1, "placeholder name must be non-empty"),
42888
+ name: z25.string().min(1, "placeholder name must be non-empty"),
42582
42889
  /** Resolver source the installer consults for this placeholder. */
42583
- source: z24.enum(PLACEHOLDER_SOURCES),
42890
+ source: z25.enum(PLACEHOLDER_SOURCES),
42584
42891
  /**
42585
42892
  * Path expression evaluated against `source` (e.g. `engines.node` against
42586
42893
  * `project-context`, `defaults.branchModel` against `.cleo/config`).
42587
42894
  * For `literal` source, this MAY be the literal value's identifier.
42588
42895
  */
42589
- sourcePath: z24.string().min(1, "placeholder sourcePath must be non-empty"),
42896
+ sourcePath: z25.string().min(1, "placeholder sourcePath must be non-empty"),
42590
42897
  /**
42591
42898
  * Fallback value used when `source[sourcePath]` resolves to `undefined`.
42592
42899
  * `null` is permitted to explicitly mark "no default — failure required".
42593
42900
  */
42594
- defaultValue: z24.union([z24.string(), z24.number(), z24.boolean(), z24.null()]).optional()
42901
+ defaultValue: z25.union([z25.string(), z25.number(), z25.boolean(), z25.null()]).optional()
42595
42902
  });
42596
- var TemplateManifestEntrySchema = z24.object({
42903
+ var TemplateManifestEntrySchema = z25.object({
42597
42904
  /** Stable identifier for this template entry. */
42598
- id: z24.string().min(1, "id must be non-empty"),
42905
+ id: z25.string().min(1, "id must be non-empty"),
42599
42906
  /** Category of file this template represents. */
42600
- kind: z24.enum(TEMPLATE_KINDS),
42907
+ kind: z25.enum(TEMPLATE_KINDS),
42601
42908
  /** Repo-relative path of the template source file. */
42602
- sourcePath: z24.string().min(1, "sourcePath must be non-empty"),
42909
+ sourcePath: z25.string().min(1, "sourcePath must be non-empty"),
42603
42910
  /** Project-relative path where the rendered template installs. */
42604
- installPath: z24.string().min(1, "installPath must be non-empty"),
42911
+ installPath: z25.string().min(1, "installPath must be non-empty"),
42605
42912
  /** Substitution strategy the installer applies to `sourcePath`. */
42606
- substitution: z24.enum(TEMPLATE_SUBSTITUTIONS),
42913
+ substitution: z25.enum(TEMPLATE_SUBSTITUTIONS),
42607
42914
  /** Declared placeholders this template requires. May be empty. */
42608
- placeholders: z24.array(PlaceholderSpecSchema),
42915
+ placeholders: z25.array(PlaceholderSpecSchema),
42609
42916
  /** Reconciliation policy on upgrade. */
42610
- updateStrategy: z24.enum(TEMPLATE_UPDATE_STRATEGIES)
42917
+ updateStrategy: z25.enum(TEMPLATE_UPDATE_STRATEGIES)
42611
42918
  });
42612
42919
 
42613
42920
  // packages/contracts/src/validator/index.ts
42614
- import { z as z25 } from "zod";
42921
+ import { z as z26 } from "zod";
42615
42922
  var VALIDATOR_ID_REGEX = /^validator-[a-z0-9][a-z0-9-]*$/;
42616
- var validatorFindingSchema = z25.object({
42617
- acId: z25.string().min(1, "acId must be non-empty"),
42618
- status: z25.enum(["pass", "fail", "inconclusive"]),
42619
- reasoning: z25.string().min(1, "reasoning must be non-empty"),
42620
- evidenceRefs: z25.array(z25.string()).optional(),
42621
- checkedAt: z25.string().min(1, "checkedAt must be a non-empty ISO-8601 string")
42622
- });
42623
- var validatorAttestationSchema = z25.object({
42624
- verdict: z25.literal("attest"),
42625
- taskId: z25.string().min(1),
42626
- validatorId: z25.string().regex(VALIDATOR_ID_REGEX, "validatorId must match the pattern validator-<discriminator>"),
42627
- findings: z25.array(validatorFindingSchema).min(1, "attestation must contain at least one finding").refine(
42923
+ var validatorFindingSchema = z26.object({
42924
+ acId: z26.string().min(1, "acId must be non-empty"),
42925
+ status: z26.enum(["pass", "fail", "inconclusive"]),
42926
+ reasoning: z26.string().min(1, "reasoning must be non-empty"),
42927
+ evidenceRefs: z26.array(z26.string()).optional(),
42928
+ checkedAt: z26.string().min(1, "checkedAt must be a non-empty ISO-8601 string")
42929
+ });
42930
+ var validatorAttestationSchema = z26.object({
42931
+ verdict: z26.literal("attest"),
42932
+ taskId: z26.string().min(1),
42933
+ validatorId: z26.string().regex(VALIDATOR_ID_REGEX, "validatorId must match the pattern validator-<discriminator>"),
42934
+ findings: z26.array(validatorFindingSchema).min(1, "attestation must contain at least one finding").refine(
42628
42935
  (findings) => findings.every((f) => f.status === "pass"),
42629
42936
  'attestation requires every finding to have status="pass"'
42630
42937
  ),
42631
- summary: z25.string().optional(),
42632
- attestedAt: z25.string().min(1),
42633
- schemaVersion: z25.literal("1")
42634
- });
42635
- var validatorRejectionSchema = z25.object({
42636
- verdict: z25.literal("reject"),
42637
- taskId: z25.string().min(1),
42638
- validatorId: z25.string().regex(VALIDATOR_ID_REGEX, "validatorId must match the pattern validator-<discriminator>"),
42639
- findings: z25.array(validatorFindingSchema).min(1, "rejection must contain at least one finding").refine(
42938
+ summary: z26.string().optional(),
42939
+ attestedAt: z26.string().min(1),
42940
+ schemaVersion: z26.literal("1")
42941
+ });
42942
+ var validatorRejectionSchema = z26.object({
42943
+ verdict: z26.literal("reject"),
42944
+ taskId: z26.string().min(1),
42945
+ validatorId: z26.string().regex(VALIDATOR_ID_REGEX, "validatorId must match the pattern validator-<discriminator>"),
42946
+ findings: z26.array(validatorFindingSchema).min(1, "rejection must contain at least one finding").refine(
42640
42947
  (findings) => findings.some((f) => f.status !== "pass"),
42641
42948
  'rejection requires at least one finding with status "fail" or "inconclusive"'
42642
42949
  ),
42643
- summary: z25.string().min(1, "rejection summary must be non-empty"),
42644
- remediationHints: z25.array(z25.string()).optional(),
42645
- rejectedAt: z25.string().min(1),
42646
- schemaVersion: z25.literal("1")
42950
+ summary: z26.string().min(1, "rejection summary must be non-empty"),
42951
+ remediationHints: z26.array(z26.string()).optional(),
42952
+ rejectedAt: z26.string().min(1),
42953
+ schemaVersion: z26.literal("1")
42647
42954
  });
42648
- var validatorVerdictSchema = z25.discriminatedUnion("verdict", [
42955
+ var validatorVerdictSchema = z26.discriminatedUnion("verdict", [
42649
42956
  validatorAttestationSchema,
42650
42957
  validatorRejectionSchema
42651
42958
  ]);
@@ -43395,7 +43702,7 @@ var CAAMP_DAMAGED_START_PATTERN_SOURCE = damagedMarkerSource("START");
43395
43702
  var CAAMP_DAMAGED_END_PATTERN_SOURCE = damagedMarkerSource("END");
43396
43703
 
43397
43704
  // packages/contracts/src/decide.ts
43398
- import { z as z26 } from "zod";
43705
+ import { z as z27 } from "zod";
43399
43706
  var DECISION_QUESTION_TYPES = ["noul", "choice", "score"];
43400
43707
  var DECISION_OUTCOME_SOURCES = ["provider", "cache", "fallback"];
43401
43708
  var DECISION_REQUEST_LIMITS = {
@@ -43417,11 +43724,11 @@ var DECISION_REQUEST_LIMITS = {
43417
43724
  maxScoreLevels: 10
43418
43725
  };
43419
43726
  var DECISION_PROVIDER_KINDS = ["layahost", "jev"];
43420
- var decisionQuestionTypeSchema = z26.enum(DECISION_QUESTION_TYPES);
43421
- var decisionOutcomeSourceSchema = z26.enum(DECISION_OUTCOME_SOURCES);
43422
- var decisionInstructionsSchema = z26.union([z26.string(), z26.record(z26.string(), z26.json())]);
43423
- var unitIntervalSchema = z26.number().min(0).max(1);
43424
- var decisionStateSchema = z26.union([z26.string(), z26.array(z26.json()), z26.record(z26.string(), z26.json())]).superRefine((state, context) => {
43727
+ var decisionQuestionTypeSchema = z27.enum(DECISION_QUESTION_TYPES);
43728
+ var decisionOutcomeSourceSchema = z27.enum(DECISION_OUTCOME_SOURCES);
43729
+ var decisionInstructionsSchema = z27.union([z27.string(), z27.record(z27.string(), z27.json())]);
43730
+ var unitIntervalSchema = z27.number().min(0).max(1);
43731
+ var decisionStateSchema = z27.union([z27.string(), z27.array(z27.json()), z27.record(z27.string(), z27.json())]).superRefine((state, context) => {
43425
43732
  const size = typeof state === "string" ? state.length : JSON.stringify(state).length;
43426
43733
  if (size > DECISION_REQUEST_LIMITS.maxStateChars) {
43427
43734
  context.addIssue({
@@ -43430,34 +43737,34 @@ var decisionStateSchema = z26.union([z26.string(), z26.array(z26.json()), z26.re
43430
43737
  });
43431
43738
  }
43432
43739
  });
43433
- var noulDecisionQuestionSchema = z26.object({
43434
- type: z26.literal("noul"),
43740
+ var noulDecisionQuestionSchema = z27.object({
43741
+ type: z27.literal("noul"),
43435
43742
  instructions: decisionInstructionsSchema.optional(),
43436
- criteria: z26.string().min(1)
43743
+ criteria: z27.string().min(1)
43437
43744
  });
43438
- var choiceDecisionQuestionSchema = z26.object({
43439
- type: z26.literal("choice"),
43745
+ var choiceDecisionQuestionSchema = z27.object({
43746
+ type: z27.literal("choice"),
43440
43747
  instructions: decisionInstructionsSchema.optional(),
43441
- criteria: z26.record(z26.string().min(1), z26.string()).refine((options) => Object.keys(options).length >= DECISION_REQUEST_LIMITS.minChoiceOptions, {
43748
+ criteria: z27.record(z27.string().min(1), z27.string()).refine((options) => Object.keys(options).length >= DECISION_REQUEST_LIMITS.minChoiceOptions, {
43442
43749
  message: `a choice question needs at least ${DECISION_REQUEST_LIMITS.minChoiceOptions} options`
43443
43750
  })
43444
43751
  });
43445
- var scoreDecisionQuestionSchema = z26.object({
43446
- type: z26.literal("score"),
43752
+ var scoreDecisionQuestionSchema = z27.object({
43753
+ type: z27.literal("score"),
43447
43754
  instructions: decisionInstructionsSchema.optional(),
43448
- criteria: z26.array(z26.string()).min(DECISION_REQUEST_LIMITS.minScoreLevels).max(DECISION_REQUEST_LIMITS.maxScoreLevels)
43755
+ criteria: z27.array(z27.string()).min(DECISION_REQUEST_LIMITS.minScoreLevels).max(DECISION_REQUEST_LIMITS.maxScoreLevels)
43449
43756
  });
43450
- var decisionQuestionSchema = z26.discriminatedUnion("type", [
43757
+ var decisionQuestionSchema = z27.discriminatedUnion("type", [
43451
43758
  noulDecisionQuestionSchema,
43452
43759
  choiceDecisionQuestionSchema,
43453
43760
  scoreDecisionQuestionSchema
43454
43761
  ]);
43455
- var decisionRequestSchema = z26.object({
43456
- model: z26.string().min(1).optional(),
43457
- lang: z26.string().regex(/^[a-z]{2,3}(-[A-Za-z0-9]{2,8})?$/).optional(),
43458
- cache: z26.boolean().optional(),
43762
+ var decisionRequestSchema = z27.object({
43763
+ model: z27.string().min(1).optional(),
43764
+ lang: z27.string().regex(/^[a-z]{2,3}(-[A-Za-z0-9]{2,8})?$/).optional(),
43765
+ cache: z27.boolean().optional(),
43459
43766
  state: decisionStateSchema,
43460
- questions: z26.record(z26.string().min(1), decisionQuestionSchema).refine(
43767
+ questions: z27.record(z27.string().min(1), decisionQuestionSchema).refine(
43461
43768
  (questions) => {
43462
43769
  const count = Object.keys(questions).length;
43463
43770
  return count >= DECISION_REQUEST_LIMITS.minQuestions && count <= DECISION_REQUEST_LIMITS.maxQuestions;
@@ -43467,139 +43774,139 @@ var decisionRequestSchema = z26.object({
43467
43774
  }
43468
43775
  )
43469
43776
  });
43470
- var noulDecisionAnswerSchema = z26.object({
43471
- type: z26.literal("noul"),
43472
- value: z26.boolean(),
43777
+ var noulDecisionAnswerSchema = z27.object({
43778
+ type: z27.literal("noul"),
43779
+ value: z27.boolean(),
43473
43780
  probability: unitIntervalSchema,
43474
43781
  confidence: unitIntervalSchema
43475
43782
  });
43476
- var choiceDecisionAnswerSchema = z26.object({
43477
- type: z26.literal("choice"),
43478
- value: z26.string().min(1),
43479
- probabilities: z26.record(z26.string().min(1), unitIntervalSchema),
43783
+ var choiceDecisionAnswerSchema = z27.object({
43784
+ type: z27.literal("choice"),
43785
+ value: z27.string().min(1),
43786
+ probabilities: z27.record(z27.string().min(1), unitIntervalSchema),
43480
43787
  confidence: unitIntervalSchema
43481
43788
  });
43482
- var scoreDecisionAnswerSchema = z26.object({
43483
- type: z26.literal("score"),
43484
- value: z26.number().int().nonnegative(),
43485
- probabilities: z26.array(unitIntervalSchema).min(DECISION_REQUEST_LIMITS.minScoreLevels).max(DECISION_REQUEST_LIMITS.maxScoreLevels),
43789
+ var scoreDecisionAnswerSchema = z27.object({
43790
+ type: z27.literal("score"),
43791
+ value: z27.number().int().nonnegative(),
43792
+ probabilities: z27.array(unitIntervalSchema).min(DECISION_REQUEST_LIMITS.minScoreLevels).max(DECISION_REQUEST_LIMITS.maxScoreLevels),
43486
43793
  confidence: unitIntervalSchema
43487
43794
  });
43488
- var decisionAnswerSchema = z26.discriminatedUnion("type", [
43795
+ var decisionAnswerSchema = z27.discriminatedUnion("type", [
43489
43796
  noulDecisionAnswerSchema,
43490
43797
  choiceDecisionAnswerSchema,
43491
43798
  scoreDecisionAnswerSchema
43492
43799
  ]);
43493
- var decisionOutcomeSchema = z26.object({
43494
- answers: z26.record(z26.string().min(1), decisionAnswerSchema),
43800
+ var decisionOutcomeSchema = z27.object({
43801
+ answers: z27.record(z27.string().min(1), decisionAnswerSchema),
43495
43802
  source: decisionOutcomeSourceSchema,
43496
- requestId: z26.string().min(1).optional(),
43497
- latencyMs: z26.number().nonnegative(),
43498
- costUsd: z26.number().nonnegative().optional(),
43499
- costMicros: z26.number().int().nonnegative().optional(),
43500
- balanceMicros: z26.number().int().optional(),
43501
- checkpoint: z26.string().min(1).optional(),
43502
- inputTokens: z26.number().int().nonnegative().optional()
43503
- });
43504
- var decisionProviderKindSchema = z26.enum(DECISION_PROVIDER_KINDS);
43505
- var decisionProviderConfigSchema = z26.object({
43506
- baseUrl: z26.url(),
43803
+ requestId: z27.string().min(1).optional(),
43804
+ latencyMs: z27.number().nonnegative(),
43805
+ costUsd: z27.number().nonnegative().optional(),
43806
+ costMicros: z27.number().int().nonnegative().optional(),
43807
+ balanceMicros: z27.number().int().optional(),
43808
+ checkpoint: z27.string().min(1).optional(),
43809
+ inputTokens: z27.number().int().nonnegative().optional()
43810
+ });
43811
+ var decisionProviderKindSchema = z27.enum(DECISION_PROVIDER_KINDS);
43812
+ var decisionProviderConfigSchema = z27.object({
43813
+ baseUrl: z27.url(),
43507
43814
  provider: decisionProviderKindSchema.optional()
43508
43815
  });
43509
43816
 
43510
43817
  // packages/contracts/src/nexus-account.ts
43511
- import { z as z27 } from "zod";
43512
- var nexusAccountUserSchema = z27.object({
43513
- id: z27.string(),
43514
- email: z27.string(),
43515
- name: z27.string().nullable().optional()
43516
- });
43517
- var nexusAccountOrganizationSchema = z27.object({
43518
- id: z27.string(),
43519
- name: z27.string(),
43520
- slug: z27.string().nullable().optional(),
43521
- role: z27.string().optional(),
43818
+ import { z as z28 } from "zod";
43819
+ var nexusAccountUserSchema = z28.object({
43820
+ id: z28.string(),
43821
+ email: z28.string(),
43822
+ name: z28.string().nullable().optional()
43823
+ });
43824
+ var nexusAccountOrganizationSchema = z28.object({
43825
+ id: z28.string(),
43826
+ name: z28.string(),
43827
+ slug: z28.string().nullable().optional(),
43828
+ role: z28.string().optional(),
43522
43829
  /** `true` for the personal organization created at sign-up. */
43523
- personal: z27.boolean().optional()
43830
+ personal: z28.boolean().optional()
43524
43831
  });
43525
- var nexusAccountMeSchema = z27.object({
43832
+ var nexusAccountMeSchema = z28.object({
43526
43833
  user: nexusAccountUserSchema,
43527
- organizations: z27.array(nexusAccountOrganizationSchema).default([])
43834
+ organizations: z28.array(nexusAccountOrganizationSchema).default([])
43528
43835
  });
43529
43836
 
43530
43837
  // packages/contracts/src/nexus-cloud.ts
43531
- import { z as z28 } from "zod";
43838
+ import { z as z29 } from "zod";
43532
43839
  var NEXUS_DEVICE_STATES = ["active", "signed-out", "revoked"];
43533
43840
  var NEXUS_CLOUD_PROFILES = ["device", "read-only"];
43534
43841
  var NEXUS_DEVICE_STATE_UNKNOWN = "unknown";
43535
- var isoTime = z28.iso.datetime({ offset: true });
43536
- var profile = z28.enum(NEXUS_CLOUD_PROFILES).nullable().catch(null);
43537
- var deviceState = z28.enum([...NEXUS_DEVICE_STATES, NEXUS_DEVICE_STATE_UNKNOWN]).catch(NEXUS_DEVICE_STATE_UNKNOWN);
43538
- var nexusCloudCredentialSchema = z28.object({
43539
- kind: z28.enum(["device", "session"]),
43540
- credentialId: z28.string().nullable().optional(),
43842
+ var isoTime = z29.iso.datetime({ offset: true });
43843
+ var profile = z29.enum(NEXUS_CLOUD_PROFILES).nullable().catch(null);
43844
+ var deviceState = z29.enum([...NEXUS_DEVICE_STATES, NEXUS_DEVICE_STATE_UNKNOWN]).catch(NEXUS_DEVICE_STATE_UNKNOWN);
43845
+ var nexusCloudCredentialSchema = z29.object({
43846
+ kind: z29.enum(["device", "session"]),
43847
+ credentialId: z29.string().nullable().optional(),
43541
43848
  profile: profile.optional(),
43542
- scopes: z28.array(z28.string()).default([]),
43849
+ scopes: z29.array(z29.string()).default([]),
43543
43850
  createdAt: isoTime.nullable().optional(),
43544
43851
  lastUsedAt: isoTime.nullable().optional(),
43545
43852
  /** When the credential expires if it is not used again; null for sessions. */
43546
43853
  idleExpiresAt: isoTime.nullable().optional()
43547
43854
  });
43548
- var nexusCloudDeviceSchema = z28.object({
43549
- deviceId: z28.string(),
43550
- name: z28.string(),
43551
- platform: z28.string().optional(),
43552
- arch: z28.string().nullable().optional(),
43553
- cliVersion: z28.string().nullable().optional(),
43855
+ var nexusCloudDeviceSchema = z29.object({
43856
+ deviceId: z29.string(),
43857
+ name: z29.string(),
43858
+ platform: z29.string().optional(),
43859
+ arch: z29.string().nullable().optional(),
43860
+ cliVersion: z29.string().nullable().optional(),
43554
43861
  createdAt: isoTime.optional(),
43555
43862
  lastSeenAt: isoTime.nullable().optional(),
43556
43863
  state: deviceState,
43557
43864
  signedOutAt: isoTime.nullable().optional(),
43558
43865
  /** Base64 device certificate; null until the device holds a key grant. */
43559
- certificate: z28.string().nullable().optional(),
43866
+ certificate: z29.string().nullable().optional(),
43560
43867
  /** The current credential's profile, or null with none (signed out or revoked). */
43561
43868
  profile: profile.optional(),
43562
43869
  /** True for the device whose credential made this request. */
43563
- current: z28.boolean().default(false),
43564
- projects: z28.number().int().nonnegative().optional(),
43565
- replicas: z28.number().int().nonnegative().optional(),
43870
+ current: z29.boolean().default(false),
43871
+ projects: z29.number().int().nonnegative().optional(),
43872
+ replicas: z29.number().int().nonnegative().optional(),
43566
43873
  lastSyncAt: isoTime.nullable().optional(),
43567
43874
  lastPresenceAt: isoTime.nullable().optional()
43568
43875
  });
43569
- var nexusCloudOrganizationSchema = z28.object({
43570
- id: z28.string(),
43571
- name: z28.string(),
43572
- slug: z28.string().nullable().optional(),
43573
- role: z28.string().optional(),
43574
- personal: z28.boolean().optional()
43876
+ var nexusCloudOrganizationSchema = z29.object({
43877
+ id: z29.string(),
43878
+ name: z29.string(),
43879
+ slug: z29.string().nullable().optional(),
43880
+ role: z29.string().optional(),
43881
+ personal: z29.boolean().optional()
43575
43882
  });
43576
- var nexusCloudUserSchema = z28.object({
43577
- id: z28.string(),
43578
- email: z28.string(),
43579
- name: z28.string().nullable().optional()
43883
+ var nexusCloudUserSchema = z29.object({
43884
+ id: z29.string(),
43885
+ email: z29.string(),
43886
+ name: z29.string().nullable().optional()
43580
43887
  });
43581
- var nexusCloudWhoamiSchema = z28.object({
43888
+ var nexusCloudWhoamiSchema = z29.object({
43582
43889
  serverTime: isoTime.optional(),
43583
43890
  user: nexusCloudUserSchema,
43584
- organizations: z28.array(nexusCloudOrganizationSchema).default([]),
43891
+ organizations: z29.array(nexusCloudOrganizationSchema).default([]),
43585
43892
  credential: nexusCloudCredentialSchema,
43586
43893
  /** The calling device; null for a session caller. */
43587
43894
  device: nexusCloudDeviceSchema.nullable()
43588
43895
  });
43589
- var nexusCloudDevicePageSchema = z28.object({
43590
- devices: z28.array(nexusCloudDeviceSchema),
43591
- nextCursor: z28.string().max(512).nullable().default(null),
43592
- truncated: z28.boolean().default(false)
43896
+ var nexusCloudDevicePageSchema = z29.object({
43897
+ devices: z29.array(nexusCloudDeviceSchema),
43898
+ nextCursor: z29.string().max(512).nullable().default(null),
43899
+ truncated: z29.boolean().default(false)
43593
43900
  });
43594
- var nexusCloudPresenceSchema = z28.looseObject({
43901
+ var nexusCloudPresenceSchema = z29.looseObject({
43595
43902
  observedAt: isoTime.optional(),
43596
- sync: z28.object({ enabled: z28.boolean() }).optional()
43903
+ sync: z29.object({ enabled: z29.boolean() }).optional()
43597
43904
  });
43598
- var nexusCloudReplicaSchema = z28.object({
43599
- projectId: z28.string(),
43600
- replicaId: z28.string(),
43601
- deviceId: z28.string(),
43602
- deviceName: z28.string(),
43905
+ var nexusCloudReplicaSchema = z29.object({
43906
+ projectId: z29.string(),
43907
+ replicaId: z29.string(),
43908
+ deviceId: z29.string(),
43909
+ deviceName: z29.string(),
43603
43910
  deviceState: deviceState.optional(),
43604
43911
  attachedAt: isoTime.optional(),
43605
43912
  lastSyncAt: isoTime.nullable(),
@@ -43608,72 +43915,72 @@ var nexusCloudReplicaSchema = z28.object({
43608
43915
  /** When the replica was retired (cleo-nexus T123), else null. Absent from servers older than retirement. */
43609
43916
  retiredAt: isoTime.nullable().optional(),
43610
43917
  /** The retired replica's named successor, else null (not retired, or retired with none). */
43611
- successor: z28.string().nullable().optional()
43918
+ successor: z29.string().nullable().optional()
43612
43919
  });
43613
- var nexusCloudDeviceCountsSchema = z28.object({
43614
- active: z28.number().int().nonnegative(),
43615
- total: z28.number().int().nonnegative()
43920
+ var nexusCloudDeviceCountsSchema = z29.object({
43921
+ active: z29.number().int().nonnegative(),
43922
+ total: z29.number().int().nonnegative()
43616
43923
  });
43617
43924
  var projectFields = {
43618
- projectId: z28.string(),
43619
- label: z28.string().nullable(),
43620
- organizationId: z28.string(),
43621
- organizationName: z28.string().optional(),
43622
- remoteUrl: z28.string().nullable().optional(),
43925
+ projectId: z29.string(),
43926
+ label: z29.string().nullable(),
43927
+ organizationId: z29.string(),
43928
+ organizationName: z29.string().optional(),
43929
+ remoteUrl: z29.string().nullable().optional(),
43623
43930
  createdAt: isoTime.optional()
43624
43931
  };
43625
- var nexusCloudProjectListItemSchema = z28.object({
43932
+ var nexusCloudProjectListItemSchema = z29.object({
43626
43933
  ...projectFields,
43627
- role: z28.string(),
43934
+ role: z29.string(),
43628
43935
  /**
43629
43936
  * The project name sealed with the project data key (`Project.encryptedName`), base64;
43630
43937
  * only a holder of the account key can open it (T13102).
43631
43938
  */
43632
- encryptedName: z28.string().nullable().optional(),
43633
- streamId: z28.string().optional(),
43634
- headSeq: z28.number().int().nonnegative().nullable().optional(),
43939
+ encryptedName: z29.string().nullable().optional(),
43940
+ streamId: z29.string().optional(),
43941
+ headSeq: z29.number().int().nonnegative().nullable().optional(),
43635
43942
  /** The stream's head snapshot; null when nothing was ever pushed (T13102: restorable or not). */
43636
- headCheckpointId: z28.string().nullable().optional(),
43637
- openConflicts: z28.number().int().nonnegative().optional(),
43638
- replicas: z28.array(nexusCloudReplicaSchema).default([]),
43943
+ headCheckpointId: z29.string().nullable().optional(),
43944
+ openConflicts: z29.number().int().nonnegative().optional(),
43945
+ replicas: z29.array(nexusCloudReplicaSchema).default([]),
43639
43946
  devices: nexusCloudDeviceCountsSchema.optional(),
43640
- replicaCount: z28.number().int().nonnegative().optional(),
43947
+ replicaCount: z29.number().int().nonnegative().optional(),
43641
43948
  lastSyncAt: isoTime.nullable().optional(),
43642
43949
  lastPresenceAt: isoTime.nullable().optional(),
43643
43950
  /** This project's replica list was cut at 50 (T12858). */
43644
- replicasTruncated: z28.boolean().default(false)
43951
+ replicasTruncated: z29.boolean().default(false)
43645
43952
  });
43646
- var nexusCloudProjectPageSchema = z28.object({
43647
- projects: z28.array(nexusCloudProjectListItemSchema),
43648
- nextCursor: z28.string().max(512).nullable().default(null),
43953
+ var nexusCloudProjectPageSchema = z29.object({
43954
+ projects: z29.array(nexusCloudProjectListItemSchema),
43955
+ nextCursor: z29.string().max(512).nullable().default(null),
43649
43956
  /** Anything in the page was cut (the project list or a replica list). */
43650
- truncated: z28.boolean().default(false),
43957
+ truncated: z29.boolean().default(false),
43651
43958
  /** The project list itself was cut at 1000 (T12858). */
43652
- projectsTruncated: z28.boolean().default(false)
43959
+ projectsTruncated: z29.boolean().default(false)
43653
43960
  });
43654
- var nexusCloudProjectDetailSchema = z28.object({
43655
- project: z28.object({ ...projectFields, deletedAt: isoTime.nullable().optional() }),
43656
- role: z28.string(),
43657
- canTrash: z28.boolean().optional(),
43658
- openConflicts: z28.number().int().nonnegative(),
43961
+ var nexusCloudProjectDetailSchema = z29.object({
43962
+ project: z29.object({ ...projectFields, deletedAt: isoTime.nullable().optional() }),
43963
+ role: z29.string(),
43964
+ canTrash: z29.boolean().optional(),
43965
+ openConflicts: z29.number().int().nonnegative(),
43659
43966
  /** At most 50, oldest attachment first. */
43660
- replicas: z28.array(nexusCloudReplicaSchema),
43967
+ replicas: z29.array(nexusCloudReplicaSchema),
43661
43968
  devices: nexusCloudDeviceCountsSchema,
43662
- replicaCount: z28.number().int().nonnegative().optional(),
43969
+ replicaCount: z29.number().int().nonnegative().optional(),
43663
43970
  lastSyncAt: isoTime.nullable().optional(),
43664
43971
  /** `replicas` was cut at 50. */
43665
- truncated: z28.boolean().default(false),
43666
- stream: z28.object({
43667
- streamId: z28.string(),
43668
- headSeq: z28.number().int().nonnegative(),
43669
- headCheckpointId: z28.string().nullable()
43972
+ truncated: z29.boolean().default(false),
43973
+ stream: z29.object({
43974
+ streamId: z29.string(),
43975
+ headSeq: z29.number().int().nonnegative(),
43976
+ headCheckpointId: z29.string().nullable()
43670
43977
  }).nullable()
43671
43978
  });
43672
- var nexusCloudReplicaPageSchema = z28.object({
43673
- replicas: z28.array(nexusCloudReplicaSchema),
43979
+ var nexusCloudReplicaPageSchema = z29.object({
43980
+ replicas: z29.array(nexusCloudReplicaSchema),
43674
43981
  devices: nexusCloudDeviceCountsSchema.optional(),
43675
- nextCursor: z28.string().max(512).nullable().default(null),
43676
- truncated: z28.boolean().default(false)
43982
+ nextCursor: z29.string().max(512).nullable().default(null),
43983
+ truncated: z29.boolean().default(false)
43677
43984
  });
43678
43985
  var NEXUS_STATUS_CHECK_IDS = [
43679
43986
  "credential.valid",
@@ -43689,56 +43996,56 @@ var NEXUS_STATUS_CHECK_IDS = [
43689
43996
  ];
43690
43997
  var NEXUS_STATUS_VERDICTS = ["ok", "attention", "not-linked", "not-registered"];
43691
43998
  var CLOUD_STATUS_VERDICTS = [...NEXUS_STATUS_VERDICTS, "not-signed-in"];
43692
- var knownCheckId = z28.enum(NEXUS_STATUS_CHECK_IDS);
43693
- var nexusCloudStatusCheckSchema = z28.object({
43694
- id: z28.enum(NEXUS_STATUS_CHECK_IDS),
43695
- ok: z28.boolean(),
43696
- required: z28.boolean(),
43697
- detail: z28.string()
43698
- });
43699
- var nexusCloudStatusSchema = z28.object({
43999
+ var knownCheckId = z29.enum(NEXUS_STATUS_CHECK_IDS);
44000
+ var nexusCloudStatusCheckSchema = z29.object({
44001
+ id: z29.enum(NEXUS_STATUS_CHECK_IDS),
44002
+ ok: z29.boolean(),
44003
+ required: z29.boolean(),
44004
+ detail: z29.string()
44005
+ });
44006
+ var nexusCloudStatusSchema = z29.object({
43700
44007
  serverTime: isoTime.optional(),
43701
- apiVersion: z28.string().optional(),
44008
+ apiVersion: z29.string().optional(),
43702
44009
  /**
43703
44010
  * Optional server features (e.g. {@link NEXUS_FEATURE_PROJECT_INITIAL_KEY}). Absent from servers older
43704
44011
  * than the list, which therefore support none of them.
43705
44012
  */
43706
- features: z28.array(z28.string()).optional(),
44013
+ features: z29.array(z29.string()).optional(),
43707
44014
  user: nexusCloudUserSchema,
43708
44015
  credential: nexusCloudCredentialSchema,
43709
44016
  device: nexusCloudDeviceSchema.nullable(),
43710
- project: z28.object({
43711
- projectId: z28.string(),
43712
- registered: z28.boolean(),
43713
- organizationId: z28.string().nullable(),
43714
- organizationName: z28.string().nullable(),
43715
- role: z28.string().nullable()
44017
+ project: z29.object({
44018
+ projectId: z29.string(),
44019
+ registered: z29.boolean(),
44020
+ organizationId: z29.string().nullable(),
44021
+ organizationName: z29.string().nullable(),
44022
+ role: z29.string().nullable()
43716
44023
  }).nullable(),
43717
- replica: z28.object({
43718
- replicaId: z28.string(),
43719
- attached: z28.boolean(),
43720
- attachedElsewhere: z28.boolean(),
44024
+ replica: z29.object({
44025
+ replicaId: z29.string(),
44026
+ attached: z29.boolean(),
44027
+ attachedElsewhere: z29.boolean(),
43721
44028
  attachedAt: isoTime.nullable(),
43722
44029
  lastSyncAt: isoTime.nullable(),
43723
44030
  presenceAt: isoTime.nullable(),
43724
- lastReplicaSeq: z28.number().int().nonnegative().nullable().optional()
44031
+ lastReplicaSeq: z29.number().int().nonnegative().nullable().optional()
43725
44032
  }).nullable(),
43726
- stream: z28.object({
43727
- streamId: z28.string(),
43728
- headSeq: z28.number().int().nonnegative(),
43729
- headCheckpointId: z28.string().nullable(),
43730
- openConflicts: z28.number().int().nonnegative(),
44033
+ stream: z29.object({
44034
+ streamId: z29.string(),
44035
+ headSeq: z29.number().int().nonnegative(),
44036
+ headCheckpointId: z29.string().nullable(),
44037
+ openConflicts: z29.number().int().nonnegative(),
43731
44038
  devices: nexusCloudDeviceCountsSchema
43732
44039
  }).nullable(),
43733
44040
  /** Check ids added by a newer server are dropped, never a parse failure. */
43734
- checks: z28.array(nexusCloudStatusCheckSchema.extend({ id: z28.string() })).transform(
44041
+ checks: z29.array(nexusCloudStatusCheckSchema.extend({ id: z29.string() })).transform(
43735
44042
  (list) => list.flatMap((c) => {
43736
44043
  const id = knownCheckId.safeParse(c.id);
43737
44044
  return id.success ? [{ ...c, id: id.data }] : [];
43738
44045
  })
43739
44046
  ),
43740
44047
  /** A verdict added by a newer server reads as `attention`: never `ok` by accident. */
43741
- verdict: z28.enum(NEXUS_STATUS_VERDICTS).catch("attention")
44048
+ verdict: z29.enum(NEXUS_STATUS_VERDICTS).catch("attention")
43742
44049
  });
43743
44050
  var LOGIN = "run `cleo login nexus`";
43744
44051
  var SESSION_EXPIRED_LOGIN = {
@@ -43783,52 +44090,55 @@ var NEXUS_FORBIDDEN_ERRORS = {
43783
44090
  };
43784
44091
 
43785
44092
  // packages/contracts/src/nexus-vault.ts
43786
- import { z as z29 } from "zod";
43787
- var isoTime2 = z29.iso.datetime({ offset: true });
43788
- var 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);
43789
- var nexusUserKeysSchema = z29.looseObject({
43790
- keyVersion: z29.number().int().positive(),
43791
- masterKeyVerifier: z29.string()
43792
- });
43793
- var nexusProjectKeysSchema = z29.looseObject({
43794
- keys: z29.array(
43795
- z29.looseObject({ wrappedProjectKey: z29.string(), keyVersion: z29.number().int().positive() })
44093
+ import { z as z30 } from "zod";
44094
+ var isoTime2 = z30.iso.datetime({ offset: true });
44095
+ var 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);
44096
+ var nexusUserKeysSchema = z30.looseObject({
44097
+ keyVersion: z30.number().int().positive(),
44098
+ masterKeyVerifier: z30.string()
44099
+ });
44100
+ var nexusProjectKeysSchema = z30.looseObject({
44101
+ keys: z30.array(
44102
+ z30.looseObject({ wrappedProjectKey: z30.string(), keyVersion: z30.number().int().positive() })
43796
44103
  )
43797
44104
  });
43798
- var nexusLeaseSchema = z29.looseObject({
43799
- streamId: z29.string(),
43800
- role: z29.string(),
44105
+ var nexusLeaseSchema = z30.looseObject({
44106
+ streamId: z30.string(),
44107
+ role: z30.string(),
43801
44108
  replicaId: uuid,
43802
44109
  expiresAt: isoTime2,
43803
44110
  forkedFromReplicaId: uuid.nullable().optional()
43804
44111
  });
43805
- var nexusLeaseAcquireSchema = z29.looseObject({ lease: nexusLeaseSchema });
43806
- var nexusStreamHeadSchema = z29.looseObject({
43807
- streamId: z29.string(),
43808
- kind: z29.string().optional(),
43809
- headSeq: z29.number().int().nonnegative(),
43810
- headCheckpointId: z29.string().nullable(),
44112
+ var nexusLeaseAcquireSchema = z30.looseObject({ lease: nexusLeaseSchema });
44113
+ var nexusStreamHeadSchema = z30.looseObject({
44114
+ streamId: z30.string(),
44115
+ kind: z30.string().optional(),
44116
+ headSeq: z30.number().int().nonnegative(),
44117
+ headCheckpointId: z30.string().nullable(),
43811
44118
  /**
43812
44119
  * The highest segment `schemaVersion` the stream holds (the server raises it on every append).
43813
44120
  * Absent from an older server.
43814
44121
  */
43815
- maxSchemaVersion: z29.number().int().nonnegative().optional()
44122
+ maxSchemaVersion: z30.number().int().nonnegative().optional()
43816
44123
  });
43817
- var nexusActivityEventSchema = z29.looseObject({
43818
- id: z29.union([z29.string(), z29.number()]),
44124
+ var nexusActivityEventSchema = z30.looseObject({
44125
+ id: z30.union([z30.string(), z30.number()]),
43819
44126
  at: isoTime2,
43820
- actorUserId: z29.string().nullable().optional(),
43821
- actorDeviceId: z29.string().nullable().optional(),
43822
- requestId: z29.string().nullable().optional(),
43823
- action: z29.string(),
43824
- target: z29.string().nullable().optional(),
43825
- detail: z29.unknown().optional()
44127
+ actorUserId: z30.string().nullable().optional(),
44128
+ actorDeviceId: z30.string().nullable().optional(),
44129
+ requestId: z30.string().nullable().optional(),
44130
+ action: z30.string(),
44131
+ target: z30.string().nullable().optional(),
44132
+ detail: z30.unknown().optional()
43826
44133
  });
43827
- var nexusActivityPageSchema = z29.looseObject({
43828
- events: z29.array(nexusActivityEventSchema),
43829
- nextBefore: z29.union([z29.string(), z29.number()]).nullable().optional()
44134
+ var nexusActivityPageSchema = z30.looseObject({
44135
+ events: z30.array(nexusActivityEventSchema),
44136
+ nextBefore: z30.union([z30.string(), z30.number()]).nullable().optional()
43830
44137
  });
43831
44138
 
44139
+ // packages/adapters/src/providers/claude-sdk/spawn.ts
44140
+ import { E_LEAD_NO_OWNER_CHANNEL as E_LEAD_NO_OWNER_CHANNEL2 } from "@cleocode/contracts/operations/orchestrate.js";
44141
+
43832
44142
  // packages/adapters/src/providers/shared/credentials.ts
43833
44143
  import { existsSync, readFileSync } from "node:fs";
43834
44144
  import { homedir } from "node:os";
@@ -43980,6 +44290,18 @@ var ClaudeSDKSpawnProvider = class {
43980
44290
  const instanceId = `sdk-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
43981
44291
  const sessionId = `cleo-${instanceId}`;
43982
44292
  const startTime = (/* @__PURE__ */ new Date()).toISOString();
44293
+ if (leadDeniedTools(context) !== null && context.options?.leadMode !== "detached") {
44294
+ return {
44295
+ instanceId,
44296
+ taskId: context.taskId,
44297
+ providerId: "claude-sdk",
44298
+ status: "failed",
44299
+ startTime,
44300
+ endTime: (/* @__PURE__ */ new Date()).toISOString(),
44301
+ exitCode: 1,
44302
+ 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`
44303
+ };
44304
+ }
43983
44305
  this.sessions.add({
43984
44306
  instanceId,
43985
44307
  sessionId,
@@ -45405,7 +45727,7 @@ var ClaudeCodeInstallProvider = class {
45405
45727
  import { spawn as nodeSpawn2 } from "node:child_process";
45406
45728
  import { writeFile as writeFile3 } from "node:fs/promises";
45407
45729
  import { dirname as dirname7, join as join11 } from "node:path";
45408
- import { E_LEAD_NO_OWNER_CHANNEL as E_LEAD_NO_OWNER_CHANNEL2 } from "@cleocode/contracts/operations/orchestrate.js";
45730
+ import { E_LEAD_NO_OWNER_CHANNEL as E_LEAD_NO_OWNER_CHANNEL4 } from "@cleocode/contracts/operations/orchestrate.js";
45409
45731
  import { findOnPath as findOnPath2 } from "@cleocode/paths";
45410
45732
 
45411
45733
  // packages/adapters/src/providers/shared/agent-spawn-wrapper.ts
@@ -45625,7 +45947,10 @@ async function prepareLeadMcp(dir, projectDir, opts = {}) {
45625
45947
  // packages/adapters/src/providers/claude-code/lead-session.ts
45626
45948
  import { spawn as nodeSpawn } from "node:child_process";
45627
45949
  import { isAbsolute as isAbsolute4 } from "node:path";
45628
- import { LEAD_ASK_TOOL as LEAD_ASK_TOOL2 } from "@cleocode/contracts/operations/orchestrate.js";
45950
+ import {
45951
+ E_LEAD_NO_OWNER_CHANNEL as E_LEAD_NO_OWNER_CHANNEL3,
45952
+ LEAD_ASK_TOOL as LEAD_ASK_TOOL2
45953
+ } from "@cleocode/contracts/operations/orchestrate.js";
45629
45954
  import { findOnPath, pathDelimiterFor, pathEnvKey, splitPathEnv } from "@cleocode/paths";
45630
45955
  var LEAD_KICKOFF_PROMPT = "You are the no-hands lead. Your full instructions are in your system prompt: follow them, using only your allowed tools.";
45631
45956
  function leadSessionId(options) {
@@ -45676,12 +46001,12 @@ function buildLeadArgs(input) {
45676
46001
  "--allowedTools",
45677
46002
  allowed.join(","),
45678
46003
  "--disallowedTools",
45679
- input.denied.join(","),
46004
+ input.denied.filter((tool2) => tool2 !== "MultiEdit").join(","),
45680
46005
  "--mcp-config",
45681
46006
  input.leadMcp.config,
45682
46007
  "--strict-mcp-config",
45683
46008
  "--permission-mode",
45684
- "dontAsk",
46009
+ interactive ? "default" : "dontAsk",
45685
46010
  "--setting-sources",
45686
46011
  "",
45687
46012
  ...input.sessionId !== void 0 ? ["--session-id", input.sessionId] : [],
@@ -45693,6 +46018,13 @@ function buildLeadArgs(input) {
45693
46018
  ];
45694
46019
  }
45695
46020
  function runInteractiveLead(command, args, opts) {
46021
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
46022
+ return Promise.reject(
46023
+ new Error(
46024
+ `${E_LEAD_NO_OWNER_CHANNEL3}: interactive AskUserQuestion needs terminal stdin and stdout; use --detached with --adapter claude-code and a configured mbx MCP server`
46025
+ )
46026
+ );
46027
+ }
45696
46028
  return new Promise((resolve6, reject) => {
45697
46029
  const child = nodeSpawn(command, [...args], {
45698
46030
  stdio: "inherit",
@@ -45914,7 +46246,7 @@ var ClaudeCodeSpawnProvider = class {
45914
46246
  status: "failed",
45915
46247
  startTime,
45916
46248
  endTime: (/* @__PURE__ */ new Date()).toISOString(),
45917
- error: `${E_LEAD_NO_OWNER_CHANNEL2}: a detached lead needs the mbx MCP server to reach the owner (${leadMcp.report.warning ?? "none is configured"})`,
46249
+ error: `${E_LEAD_NO_OWNER_CHANNEL4}: a detached lead needs the mbx MCP server to reach the owner (${leadMcp.report.warning ?? "none is configured"})`,
45918
46250
  leadMcp: leadMcp.report
45919
46251
  };
45920
46252
  }