@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
@@ -26874,17 +26874,321 @@ var ChangesetEntrySchema = z3.object({
26874
26874
  });
26875
26875
 
26876
26876
  // packages/contracts/src/config/manifest.ts
26877
- import { z as z5 } from "zod";
26877
+ import { z as z6 } from "zod";
26878
26878
 
26879
- // packages/contracts/src/config/worker-policy.ts
26879
+ // packages/contracts/src/orca-execution.ts
26880
26880
  import { z as z4 } from "zod";
26881
- var projectWorkerPolicySchema = z4.object({
26882
- verification: z4.object({
26883
- full: z4.enum(["local", "ci"]),
26884
- local: z4.enum(["single-file", "affected"])
26881
+ var identifier = z4.string().min(1);
26882
+ var orcaAgentSchema = z4.enum(["codex", "opencode2", "claude", "grok"]);
26883
+ var DEFAULT_ORCA_AGENTS = ["codex", "opencode2", "claude"];
26884
+ var orchestrateOrcaConfigSchema = z4.object({
26885
+ agents: z4.array(orcaAgentSchema).min(1).refine((agents) => new Set(agents).size === agents.length, "Agent ids must be unique.").default(DEFAULT_ORCA_AGENTS)
26886
+ });
26887
+ var orcaContextSchema = z4.object({
26888
+ runtimeId: identifier,
26889
+ coordinatorHandle: identifier,
26890
+ executionHostId: z4.literal("local")
26891
+ });
26892
+ var orcaRoutingRunSchema = z4.object({
26893
+ runId: identifier.nullable(),
26894
+ unconfiguredAgents: z4.array(orcaAgentSchema)
26895
+ });
26896
+ var orcaLaunchSchema = z4.object({
26897
+ projectId: identifier,
26898
+ projectRoot: identifier,
26899
+ taskId: identifier,
26900
+ instanceId: identifier,
26901
+ workerSessionId: identifier,
26902
+ agentId: identifier,
26903
+ role: z4.enum(["worker", "lead"]),
26904
+ protocol: identifier,
26905
+ worktreePath: identifier,
26906
+ worktreeBranch: identifier,
26907
+ projectHash: identifier,
26908
+ lockToken: identifier,
26909
+ prompt: identifier,
26910
+ harness: z4.enum(["claude-code", "codex", "opencode", "grok", "kimi"]),
26911
+ leadMailbox: identifier.nullable(),
26912
+ model: identifier.optional(),
26913
+ effort: identifier.optional(),
26914
+ accountId: identifier.optional()
26915
+ });
26916
+ var orcaStartBindingSchema = z4.object({
26917
+ runId: identifier.nullable(),
26918
+ orcaTaskId: identifier.nullable(),
26919
+ retryOf: identifier.nullable()
26920
+ });
26921
+ var orcaAttemptSchema = z4.object({
26922
+ backend: z4.literal("orca"),
26923
+ version: z4.literal(1),
26924
+ /** Monotonic local CAS revision; repeated identical observations still serialize. */
26925
+ revision: z4.number().int().nonnegative(),
26926
+ context: orcaContextSchema,
26927
+ launch: orcaLaunchSchema,
26928
+ promptDigest: z4.string().regex(/^[a-f0-9]{64}$/),
26929
+ workspaceId: identifier,
26930
+ workspaceSelector: identifier,
26931
+ state: z4.enum([
26932
+ "prepared",
26933
+ "launching",
26934
+ "ready",
26935
+ "turn_unobserved",
26936
+ "outcome_unknown",
26937
+ "stop_pending",
26938
+ "stop_unknown",
26939
+ "stopped",
26940
+ "failed",
26941
+ "circuit_broken"
26942
+ ]),
26943
+ runId: identifier.nullable(),
26944
+ orcaTaskId: identifier.nullable(),
26945
+ dispatchId: identifier.nullable(),
26946
+ retryOf: identifier.nullable(),
26947
+ /** Absent on legacy records, whose original argv cannot safely be reconstructed. */
26948
+ startBinding: orcaStartBindingSchema.optional(),
26949
+ /** UUID reserved before committing a retry; its first send and every replay use this key. */
26950
+ startRequestKey: z4.string().uuid().optional(),
26951
+ startRequestId: identifier.nullable(),
26952
+ /** UUID reserved before committing a stop; its first send and every replay use this key. */
26953
+ stopRequestKey: z4.string().uuid().optional(),
26954
+ /** Orca-issued stop request id, retained only when the stop receipt was received. */
26955
+ stopRequestId: identifier.nullable(),
26956
+ /**
26957
+ * Set when the worker-stop reply came from a runtime that proved it enumerates
26958
+ * every helper it stopped, so an omitted helper list means the worker had none.
26959
+ */
26960
+ stopHelperEvidence: z4.literal("enumerated").optional(),
26961
+ failureCount: z4.number().int().nonnegative(),
26962
+ resourceState: z4.string(),
26963
+ /** Full receipts retain effects, residual resources and recovery advice. */
26964
+ lastReceipt: z4.string().nullable(),
26965
+ lastError: z4.string().nullable(),
26966
+ /** Confirmed pre-dispatch refusal; never inferred from a process exit. */
26967
+ startRefusal: z4.literal("agent_unconfigured").optional(),
26968
+ observedAt: z4.string()
26969
+ });
26970
+ var orcaWorkerDoneSchema = z4.object({
26971
+ messageId: identifier,
26972
+ runtimeId: identifier,
26973
+ runId: identifier,
26974
+ orcaTaskId: identifier,
26975
+ dispatchId: identifier,
26976
+ senderHandle: identifier,
26977
+ outcome: z4.enum(["succeeded", "failed"]),
26978
+ body: z4.string(),
26979
+ reportPath: identifier
26980
+ });
26981
+ var orcaWorkerReportSchema = z4.object({
26982
+ event: orcaWorkerDoneSchema,
26983
+ manifestId: identifier,
26984
+ manifestDigest: z4.string().regex(/^[a-f0-9]{64}$/),
26985
+ reportText: z4.string().min(1).max(65536),
26986
+ reportDigest: z4.string().regex(/^[a-f0-9]{64}$/),
26987
+ ingestedAt: z4.string().datetime()
26988
+ });
26989
+ var orcaReportDeliverySchema = z4.object({
26990
+ key: identifier,
26991
+ mailbox: identifier.nullable(),
26992
+ state: z4.enum(["pending", "delivered"]),
26993
+ messageId: identifier.nullable(),
26994
+ deliveredAt: z4.string().datetime().nullable(),
26995
+ lastError: z4.string().nullable()
26996
+ });
26997
+ var orcaWorkerSettlementSchema = z4.object({
26998
+ resourceRelease: z4.object({
26999
+ dispatchId: identifier,
27000
+ releasedAt: z4.string().datetime(),
27001
+ receiptDigest: z4.string().regex(/^[a-f0-9]{64}$/),
27002
+ receipt: identifier
27003
+ }).optional(),
27004
+ retiredAt: z4.string().datetime().optional(),
27005
+ reportDelivery: orcaReportDeliverySchema.optional()
27006
+ });
27007
+ var orcaReportMessageSchema = z4.object({
27008
+ id: identifier,
27009
+ run_id: z4.string().nullable(),
27010
+ delivery_contract: z4.string(),
27011
+ from_handle: z4.string(),
27012
+ to_handle: z4.string(),
27013
+ type: z4.string(),
27014
+ body: z4.string(),
27015
+ payload: z4.string().nullable(),
27016
+ sender_pane_key: z4.string().nullable()
27017
+ });
27018
+ var orcaReportSourceSchema = z4.object({
27019
+ ok: z4.literal(true),
27020
+ _meta: z4.object({ runtimeId: identifier }),
27021
+ result: z4.object({
27022
+ messages: z4.array(z4.json()).optional(),
27023
+ dispatch: z4.object({
27024
+ id: identifier,
27025
+ run_id: identifier,
27026
+ task_id: identifier,
27027
+ assignee_handle: identifier,
27028
+ assignee_pane_key: z4.string().nullable(),
27029
+ status: z4.string()
27030
+ }).optional()
27031
+ })
27032
+ });
27033
+ var orcaWorkerDonePayloadSchema = z4.object({
27034
+ taskId: identifier,
27035
+ dispatchId: identifier,
27036
+ outcome: z4.enum(["succeeded", "failed"]),
27037
+ reportPath: identifier
27038
+ });
27039
+ var orcaWorkerRequestSchema = z4.object({
27040
+ action: z4.enum([
27041
+ "show",
27042
+ "read",
27043
+ "recover-start",
27044
+ "recover-stop",
27045
+ "retry",
27046
+ "stop",
27047
+ "ingest-report",
27048
+ "relay-report"
27049
+ ]),
27050
+ recordId: identifier,
27051
+ cursor: identifier.optional(),
27052
+ messageId: identifier.optional()
27053
+ }).refine(({ action, cursor }) => cursor === void 0 || action === "read", {
27054
+ message: "A source-pinned cursor is accepted only for read.",
27055
+ path: ["cursor"]
27056
+ }).refine(({ action, messageId }) => action === "ingest-report" === (messageId !== void 0), {
27057
+ message: "ingest-report requires an exact message id; other actions do not accept one.",
27058
+ path: ["messageId"]
27059
+ });
27060
+ var effectSchema = z4.object({
27061
+ kind: z4.string(),
27062
+ role: z4.string().optional(),
27063
+ action: z4.string().optional(),
27064
+ id: z4.string().optional()
27065
+ });
27066
+ var selectionSchema = z4.object({
27067
+ agent: z4.string().nullable().optional(),
27068
+ model: z4.string().nullable().optional(),
27069
+ effort: z4.string().nullable().optional()
27070
+ });
27071
+ var orcaReplySchema = z4.object({
27072
+ ok: z4.boolean(),
27073
+ _meta: z4.object({ runtimeId: z4.string().nullable() }).optional(),
27074
+ error: z4.object({
27075
+ code: z4.string(),
27076
+ message: z4.string(),
27077
+ data: z4.object({
27078
+ requestId: identifier.optional(),
27079
+ orchestrationRequestId: identifier.optional(),
27080
+ dispatchId: identifier.optional()
27081
+ }).optional()
27082
+ }).optional(),
27083
+ result: z4.object({
27084
+ state: z4.string().optional(),
27085
+ requestId: identifier.optional(),
27086
+ /**
27087
+ * Mutation ledger identity Orca stamps on every successful mutation result.
27088
+ * @remarks Installed Orca 1.4.255 attaches `{ requestId, replayed }` to the
27089
+ * result it records (`Jy` in the retained source), so a successful stop can
27090
+ * be bound to the request key this attempt issued.
27091
+ */
27092
+ mutation: z4.object({
27093
+ requestId: identifier.optional(),
27094
+ replayed: z4.boolean().optional()
27095
+ }).optional(),
27096
+ stage: z4.string().optional(),
27097
+ turnStart: z4.string().optional(),
27098
+ runId: identifier.optional(),
27099
+ run: z4.object({ id: identifier }).nullable().optional(),
27100
+ taskId: identifier.optional(),
27101
+ dispatchId: identifier.optional(),
27102
+ failureCount: z4.number().int().nonnegative().optional(),
27103
+ effects: z4.array(effectSchema).optional(),
27104
+ residualResources: z4.array(effectSchema).optional(),
27105
+ launch: z4.object({ effective: selectionSchema.optional() }).optional(),
27106
+ lastError: z4.string().nullable().optional(),
27107
+ processAction: z4.string().optional(),
27108
+ helpers: z4.array(
27109
+ z4.object({
27110
+ dispatchId: identifier.optional(),
27111
+ creatorDispatchId: identifier.optional(),
27112
+ outcome: z4.string(),
27113
+ keptOpenBy: identifier.optional(),
27114
+ state: z4.string().optional(),
27115
+ lastError: z4.string().nullable().optional()
27116
+ })
27117
+ ).optional(),
27118
+ helperStopError: z4.string().nullable().optional(),
27119
+ status: z4.string().optional(),
27120
+ terminal: z4.object({
27121
+ handle: identifier,
27122
+ connected: z4.boolean(),
27123
+ writable: z4.boolean(),
27124
+ executionHostId: identifier
27125
+ }).optional(),
27126
+ runtime: z4.object({
27127
+ runtimeId: identifier,
27128
+ reachable: z4.boolean(),
27129
+ state: z4.string(),
27130
+ capabilities: z4.array(z4.string())
27131
+ }).optional(),
27132
+ worktree: z4.object({
27133
+ id: identifier,
27134
+ path: identifier,
27135
+ branch: identifier,
27136
+ hostId: identifier,
27137
+ address: z4.object({ worktree: identifier }).optional()
27138
+ }).optional(),
27139
+ dispatch: z4.object({
27140
+ id: identifier,
27141
+ runId: identifier,
27142
+ taskId: identifier,
27143
+ /** Direct creator Dispatch that started this one; null for a Run root. */
27144
+ creatorDispatchId: identifier.nullable().optional(),
27145
+ failureCount: z4.number().int().nonnegative()
27146
+ }).optional(),
27147
+ worker: z4.object({
27148
+ dispatchId: identifier,
27149
+ runtimeEpoch: identifier,
27150
+ state: z4.string(),
27151
+ stage: z4.string(),
27152
+ worktreeId: identifier.nullable()
27153
+ }).optional(),
27154
+ observation: z4.object({ status: z4.string(), exactWorker: z4.boolean().optional() }).optional(),
27155
+ projection: z4.object({
27156
+ resource: z4.object({
27157
+ state: z4.string(),
27158
+ terminalState: z4.string(),
27159
+ ownerDispatchId: identifier.optional(),
27160
+ releaseState: z4.string().optional()
27161
+ }).optional()
27162
+ }).optional()
27163
+ }).optional()
27164
+ });
27165
+ var orcaCommandRegistrySchema = z4.object({
27166
+ schemaVersion: z4.number().int().positive(),
27167
+ commands: z4.array(z4.object({ command: identifier, flags: z4.array(z4.string()) }))
27168
+ });
27169
+ var accountProviderSchema = z4.object({
27170
+ accounts: z4.array(z4.object({})),
27171
+ activeAccountId: identifier.nullable()
27172
+ });
27173
+ var orcaAccountReplySchema = z4.object({
27174
+ ok: z4.literal(true),
27175
+ _meta: z4.object({ runtimeId: identifier }),
27176
+ result: z4.object({
27177
+ codex: accountProviderSchema,
27178
+ opencode: accountProviderSchema,
27179
+ claude: accountProviderSchema
27180
+ })
27181
+ });
27182
+
27183
+ // packages/contracts/src/config/worker-policy.ts
27184
+ import { z as z5 } from "zod";
27185
+ var projectWorkerPolicySchema = z5.object({
27186
+ verification: z5.object({
27187
+ full: z5.enum(["local", "ci"]),
27188
+ local: z5.enum(["single-file", "affected"])
26885
27189
  }).strict().optional(),
26886
- instructions: z4.array(
26887
- z4.string().min(1).max(512).regex(/\S/).regex(
27190
+ instructions: z5.array(
27191
+ z5.string().min(1).max(512).regex(/\S/).regex(
26888
27192
  /^(?!\s*#)[^\p{Cc}\p{Cf}\p{Zl}\p{Zp}]+$/u,
26889
27193
  "Instructions must be single-line text without control characters or a leading #"
26890
27194
  )
@@ -26912,8 +27216,11 @@ var CLEO_CONFIG_MANIFEST = {
26912
27216
  path: ".cleo/config.json",
26913
27217
  mergePrecedence: 20,
26914
27218
  driftDetection: "schema-validate",
26915
- schema: z5.object({
26916
- orchestrate: z5.object({ workerPolicy: projectWorkerPolicySchema.optional() }).passthrough().optional()
27219
+ schema: z6.object({
27220
+ orchestrate: z6.object({
27221
+ workerPolicy: projectWorkerPolicySchema.optional(),
27222
+ orca: orchestrateOrcaConfigSchema.optional()
27223
+ }).passthrough().optional()
26917
27224
  }).passthrough()
26918
27225
  };
26919
27226
  var GLOBAL_CLEO_CONFIG_MANIFEST = {
@@ -26929,19 +27236,19 @@ var CONFIG_MANIFEST_ENTRIES = Object.freeze([
26929
27236
  GLOBAL_CLEO_CONFIG_MANIFEST,
26930
27237
  CLEO_CONFIG_MANIFEST
26931
27238
  ]);
26932
- var configManifestEntrySchema = z5.object({
26933
- id: z5.string().min(1),
26934
- scope: z5.union([z5.literal("global"), z5.literal("project"), z5.literal("metadata")]),
26935
- path: z5.string().min(1),
26936
- schema: z5.unknown().optional(),
26937
- mergePrecedence: z5.number().int().nonnegative(),
26938
- driftDetection: z5.union([
26939
- z5.literal("schema-validate"),
26940
- z5.literal("staleness-gate"),
26941
- z5.literal("value-diff"),
26942
- z5.literal("none")
27239
+ var configManifestEntrySchema = z6.object({
27240
+ id: z6.string().min(1),
27241
+ scope: z6.union([z6.literal("global"), z6.literal("project"), z6.literal("metadata")]),
27242
+ path: z6.string().min(1),
27243
+ schema: z6.unknown().optional(),
27244
+ mergePrecedence: z6.number().int().nonnegative(),
27245
+ driftDetection: z6.union([
27246
+ z6.literal("schema-validate"),
27247
+ z6.literal("staleness-gate"),
27248
+ z6.literal("value-diff"),
27249
+ z6.literal("none")
26943
27250
  ]),
26944
- defaults: z5.record(z5.string(), z5.unknown()).optional()
27251
+ defaults: z6.record(z6.string(), z6.unknown()).optional()
26945
27252
  });
26946
27253
 
26947
27254
  // packages/contracts/src/credentials.ts
@@ -26971,123 +27278,123 @@ function parseClaudeCodeCredentials(buf) {
26971
27278
  }
26972
27279
 
26973
27280
  // packages/contracts/src/daemon/health.ts
26974
- import { z as z7 } from "zod";
27281
+ import { z as z8 } from "zod";
26975
27282
 
26976
27283
  // packages/contracts/src/supervisor-ipc/messages.ts
26977
- import { z as z6 } from "zod";
26978
- var EnvPairSchema = z6.object({
27284
+ import { z as z7 } from "zod";
27285
+ var EnvPairSchema = z7.object({
26979
27286
  /** Environment variable name. */
26980
- key: z6.string().min(1),
27287
+ key: z7.string().min(1),
26981
27288
  /** Environment variable value. */
26982
- value: z6.string()
27289
+ value: z7.string()
26983
27290
  }).strict();
26984
- var ChildStateSchema = z6.enum(["running", "restarting", "stopped"]);
26985
- var ChildStatusSchema = z6.object({
27291
+ var ChildStateSchema = z7.enum(["running", "restarting", "stopped"]);
27292
+ var ChildStatusSchema = z7.object({
26986
27293
  /** Logical id of the child (stable across restarts). */
26987
- child_id: z6.string().min(1),
27294
+ child_id: z7.string().min(1),
26988
27295
  /** Current OS pid (0 when not currently running). */
26989
- pid: z6.number().int().nonnegative(),
27296
+ pid: z7.number().int().nonnegative(),
26990
27297
  /** Current liveness state. */
26991
27298
  state: ChildStateSchema,
26992
27299
  /** Total restarts observed for this child. */
26993
- restart_count: z6.number().int().nonnegative()
27300
+ restart_count: z7.number().int().nonnegative()
26994
27301
  }).strict();
26995
- var SpawnRequestSchema = z6.object({
27302
+ var SpawnRequestSchema = z7.object({
26996
27303
  /** Tag discriminating this request variant. */
26997
- kind: z6.literal("spawn"),
27304
+ kind: z7.literal("spawn"),
26998
27305
  /** Caller-chosen logical id for the child (stable across restarts). */
26999
- child_id: z6.string().min(1),
27306
+ child_id: z7.string().min(1),
27000
27307
  /** Absolute path to the program to execute. */
27001
- program: z6.string().min(1),
27308
+ program: z7.string().min(1),
27002
27309
  /** Arguments passed to the program. */
27003
- args: z6.array(z6.string()).default([]),
27310
+ args: z7.array(z7.string()).default([]),
27004
27311
  /** Environment overrides applied on top of the supervisor's environment. */
27005
- env: z6.array(EnvPairSchema).default([]),
27312
+ env: z7.array(EnvPairSchema).default([]),
27006
27313
  /** Optional working directory for the child. */
27007
- cwd: z6.string().optional()
27314
+ cwd: z7.string().optional()
27008
27315
  }).strict();
27009
- var RestartRequestSchema = z6.object({
27316
+ var RestartRequestSchema = z7.object({
27010
27317
  /** Tag discriminating this request variant. */
27011
- kind: z6.literal("restart"),
27318
+ kind: z7.literal("restart"),
27012
27319
  /** Logical id of the child to restart. */
27013
- child_id: z6.string().min(1)
27320
+ child_id: z7.string().min(1)
27014
27321
  }).strict();
27015
- var MonitorRequestSchema = z6.object({
27322
+ var MonitorRequestSchema = z7.object({
27016
27323
  /** Tag discriminating this request variant. */
27017
- kind: z6.literal("monitor"),
27324
+ kind: z7.literal("monitor"),
27018
27325
  /** Specific child id to monitor; omit to request all children. */
27019
- child_id: z6.string().optional()
27326
+ child_id: z7.string().optional()
27020
27327
  }).strict();
27021
- var HealthRequestSchema = z6.object({
27328
+ var HealthRequestSchema = z7.object({
27022
27329
  /** Tag discriminating this request variant. */
27023
- kind: z6.literal("health")
27330
+ kind: z7.literal("health")
27024
27331
  }).strict();
27025
- var SupervisorIpcRequestSchema = z6.discriminatedUnion("kind", [
27332
+ var SupervisorIpcRequestSchema = z7.discriminatedUnion("kind", [
27026
27333
  SpawnRequestSchema,
27027
27334
  RestartRequestSchema,
27028
27335
  MonitorRequestSchema,
27029
27336
  HealthRequestSchema
27030
27337
  ]);
27031
- var SpawnedResponseSchema = z6.object({
27338
+ var SpawnedResponseSchema = z7.object({
27032
27339
  /** Tag discriminating this response variant. */
27033
- kind: z6.literal("spawned"),
27340
+ kind: z7.literal("spawned"),
27034
27341
  /** Logical id of the spawned child. */
27035
- child_id: z6.string().min(1),
27342
+ child_id: z7.string().min(1),
27036
27343
  /** OS pid assigned to the spawned child. */
27037
- pid: z6.number().int().nonnegative()
27344
+ pid: z7.number().int().nonnegative()
27038
27345
  }).strict();
27039
- var RestartedResponseSchema = z6.object({
27346
+ var RestartedResponseSchema = z7.object({
27040
27347
  /** Tag discriminating this response variant. */
27041
- kind: z6.literal("restarted"),
27348
+ kind: z7.literal("restarted"),
27042
27349
  /** Logical id of the restarted child. */
27043
- child_id: z6.string().min(1),
27350
+ child_id: z7.string().min(1),
27044
27351
  /** New OS pid after the restart. */
27045
- pid: z6.number().int().nonnegative(),
27352
+ pid: z7.number().int().nonnegative(),
27046
27353
  /** Number of times this child has been restarted in total. */
27047
- restart_count: z6.number().int().nonnegative()
27354
+ restart_count: z7.number().int().nonnegative()
27048
27355
  }).strict();
27049
- var MonitorResponseSchema = z6.object({
27356
+ var MonitorResponseSchema = z7.object({
27050
27357
  /** Tag discriminating this response variant. */
27051
- kind: z6.literal("monitor"),
27358
+ kind: z7.literal("monitor"),
27052
27359
  /** One row per monitored child. */
27053
- children: z6.array(ChildStatusSchema)
27360
+ children: z7.array(ChildStatusSchema)
27054
27361
  }).strict();
27055
- var HealthResponseSchema = z6.object({
27362
+ var HealthResponseSchema = z7.object({
27056
27363
  /** Tag discriminating this response variant. */
27057
- kind: z6.literal("health"),
27364
+ kind: z7.literal("health"),
27058
27365
  /** Supervisor process pid. */
27059
- pid: z6.number().int().nonnegative(),
27366
+ pid: z7.number().int().nonnegative(),
27060
27367
  /** Number of children currently tracked. */
27061
- child_count: z6.number().int().nonnegative(),
27368
+ child_count: z7.number().int().nonnegative(),
27062
27369
  /** Seconds the supervisor has been running. */
27063
- uptime_secs: z6.number().int().nonnegative(),
27370
+ uptime_secs: z7.number().int().nonnegative(),
27064
27371
  /** Frozen protocol version the supervisor speaks. */
27065
- protocol_version: z6.string()
27372
+ protocol_version: z7.string()
27066
27373
  }).strict();
27067
- var LifecycleEventKindSchema = z6.enum(["child_exited", "child_restarted"]);
27068
- var LifecycleEventResponseSchema = z6.object({
27374
+ var LifecycleEventKindSchema = z7.enum(["child_exited", "child_restarted"]);
27375
+ var LifecycleEventResponseSchema = z7.object({
27069
27376
  /** Tag discriminating this response variant. */
27070
- kind: z6.literal("event"),
27377
+ kind: z7.literal("event"),
27071
27378
  /** What happened. */
27072
27379
  event: LifecycleEventKindSchema,
27073
27380
  /** Logical id of the affected child. */
27074
- child_id: z6.string().min(1),
27381
+ child_id: z7.string().min(1),
27075
27382
  /** Exit code, when the OS reported one. */
27076
- exit_code: z6.number().int().optional(),
27383
+ exit_code: z7.number().int().optional(),
27077
27384
  /** Terminating signal name, when the child was signalled (Unix). */
27078
- signal: z6.string().optional(),
27385
+ signal: z7.string().optional(),
27079
27386
  /** Backoff delay (ms) before the pending restart, when applicable. */
27080
- restart_delay_ms: z6.number().int().nonnegative().optional()
27387
+ restart_delay_ms: z7.number().int().nonnegative().optional()
27081
27388
  }).strict();
27082
- var ErrorResponseSchema = z6.object({
27389
+ var ErrorResponseSchema = z7.object({
27083
27390
  /** Tag discriminating this response variant. */
27084
- kind: z6.literal("error"),
27391
+ kind: z7.literal("error"),
27085
27392
  /** Machine-readable error code (e.g. `E_UNKNOWN_CHILD`). */
27086
- code: z6.string().min(1),
27393
+ code: z7.string().min(1),
27087
27394
  /** Human-readable error message. */
27088
- message: z6.string()
27395
+ message: z7.string()
27089
27396
  }).strict();
27090
- var SupervisorIpcResponseSchema = z6.discriminatedUnion("kind", [
27397
+ var SupervisorIpcResponseSchema = z7.discriminatedUnion("kind", [
27091
27398
  SpawnedResponseSchema,
27092
27399
  RestartedResponseSchema,
27093
27400
  MonitorResponseSchema,
@@ -27095,27 +27402,27 @@ var SupervisorIpcResponseSchema = z6.discriminatedUnion("kind", [
27095
27402
  LifecycleEventResponseSchema,
27096
27403
  ErrorResponseSchema
27097
27404
  ]);
27098
- var SupervisorIpcRequestEnvelopeSchema = z6.object({
27405
+ var SupervisorIpcRequestEnvelopeSchema = z7.object({
27099
27406
  /** Frozen protocol version. */
27100
- protocol_version: z6.string(),
27407
+ protocol_version: z7.string(),
27101
27408
  /** Correlation id echoed back on the matching response. */
27102
- id: z6.string().min(1),
27409
+ id: z7.string().min(1),
27103
27410
  /** Direction discriminator. */
27104
- direction: z6.literal("request"),
27411
+ direction: z7.literal("request"),
27105
27412
  /** The request body. */
27106
27413
  request: SupervisorIpcRequestSchema
27107
27414
  }).strict();
27108
- var SupervisorIpcResponseEnvelopeSchema = z6.object({
27415
+ var SupervisorIpcResponseEnvelopeSchema = z7.object({
27109
27416
  /** Frozen protocol version. */
27110
- protocol_version: z6.string(),
27417
+ protocol_version: z7.string(),
27111
27418
  /** Correlation id echoed from the originating request (or a fresh id for events). */
27112
- id: z6.string().min(1),
27419
+ id: z7.string().min(1),
27113
27420
  /** Direction discriminator. */
27114
- direction: z6.literal("response"),
27421
+ direction: z7.literal("response"),
27115
27422
  /** The response body. */
27116
27423
  response: SupervisorIpcResponseSchema
27117
27424
  }).strict();
27118
- var SupervisorIpcEnvelopeSchema = z6.discriminatedUnion("direction", [
27425
+ var SupervisorIpcEnvelopeSchema = z7.discriminatedUnion("direction", [
27119
27426
  SupervisorIpcRequestEnvelopeSchema,
27120
27427
  SupervisorIpcResponseEnvelopeSchema
27121
27428
  ]);
@@ -27139,17 +27446,17 @@ var SubsystemHealthSchema = ChildStatusSchema.extend({
27139
27446
  * Optional human-readable detail (e.g. last error message, queue depth).
27140
27447
  * Diagnostic only — not part of the supervisor wire contract.
27141
27448
  */
27142
- detail: z7.string().optional()
27449
+ detail: z8.string().optional()
27143
27450
  }).strict();
27144
- var HealthStatusSchema = z7.object({
27451
+ var HealthStatusSchema = z8.object({
27145
27452
  /** One health row per registered subsystem. */
27146
- subsystems: z7.array(SubsystemHealthSchema),
27453
+ subsystems: z8.array(SubsystemHealthSchema),
27147
27454
  /**
27148
27455
  * `true` iff every subsystem is in the `running` state. A convenience roll-up
27149
27456
  * derived from {@link HealthStatusSchema.shape.subsystems}; recomputed by
27150
27457
  * {@link summarizeHealth} so producers cannot desync it.
27151
27458
  */
27152
- allHealthy: z7.boolean()
27459
+ allHealthy: z8.boolean()
27153
27460
  }).strict();
27154
27461
 
27155
27462
  // packages/contracts/src/db-inventory.json
@@ -39078,7 +39385,7 @@ var OPERATIONS = [
39078
39385
  ];
39079
39386
 
39080
39387
  // packages/contracts/src/docs/modernize.ts
39081
- import { z as z8 } from "zod";
39388
+ import { z as z9 } from "zod";
39082
39389
  var DOCS_MODERNIZE_DISPOSITIONS = ["keep", "rename", "merge-into", "delete"];
39083
39390
  var DOCS_MODERNIZE_OPS = [
39084
39391
  "ingest",
@@ -39092,105 +39399,105 @@ var DOCS_MODERNIZE_OPS = [
39092
39399
  "reslug",
39093
39400
  "link-task"
39094
39401
  ];
39095
- var judgmentSchema = z8.object({
39096
- question: z8.enum(["classify", "merge"]),
39097
- site: z8.string(),
39098
- mode: z8.enum(["off", "shadow", "on"]),
39099
- ruleAnswer: z8.string(),
39100
- decidedAnswer: z8.string().nullable(),
39101
- decidedConfidence: z8.number().nullable(),
39102
- source: z8.enum(["provider", "cache", "fallback"]),
39103
- acted: z8.string()
39104
- });
39105
- var relPath = z8.string().min(1).max(1024);
39106
- var docsModernizePlanSchema = z8.object({
39107
- root: z8.string().min(1),
39108
- generatedAt: z8.string(),
39109
- mode: z8.enum(["tree", "store-only"]),
39110
- counts: z8.record(z8.enum(DOCS_MODERNIZE_DISPOSITIONS), z8.number()),
39111
- rows: z8.array(
39112
- z8.object({
39402
+ var judgmentSchema = z9.object({
39403
+ question: z9.enum(["classify", "merge"]),
39404
+ site: z9.string(),
39405
+ mode: z9.enum(["off", "shadow", "on"]),
39406
+ ruleAnswer: z9.string(),
39407
+ decidedAnswer: z9.string().nullable(),
39408
+ decidedConfidence: z9.number().nullable(),
39409
+ source: z9.enum(["provider", "cache", "fallback"]),
39410
+ acted: z9.string()
39411
+ });
39412
+ var relPath = z9.string().min(1).max(1024);
39413
+ var docsModernizePlanSchema = z9.object({
39414
+ root: z9.string().min(1),
39415
+ generatedAt: z9.string(),
39416
+ mode: z9.enum(["tree", "store-only"]),
39417
+ counts: z9.record(z9.enum(DOCS_MODERNIZE_DISPOSITIONS), z9.number()),
39418
+ rows: z9.array(
39419
+ z9.object({
39113
39420
  path: relPath,
39114
- sha256: z8.string().regex(/^[0-9a-f]{64}$/),
39115
- kind: z8.string().min(1),
39116
- slug: z8.string().regex(/^[a-z0-9][a-z0-9-]*$/),
39117
- title: z8.string(),
39118
- disposition: z8.enum(DOCS_MODERNIZE_DISPOSITIONS),
39119
- target: z8.string().min(1).max(1024).nullable(),
39120
- reasons: z8.array(z8.string()),
39121
- judgments: z8.array(judgmentSchema),
39122
- ownerTasks: z8.array(z8.string().regex(/^[TD]\d+$/)),
39123
- category: z8.string(),
39124
- refs: z8.array(z8.string()),
39125
- overridden: z8.boolean(),
39126
- covers: z8.array(z8.string()),
39127
- baselineRemove: z8.boolean()
39421
+ sha256: z9.string().regex(/^[0-9a-f]{64}$/),
39422
+ kind: z9.string().min(1),
39423
+ slug: z9.string().regex(/^[a-z0-9][a-z0-9-]*$/),
39424
+ title: z9.string(),
39425
+ disposition: z9.enum(DOCS_MODERNIZE_DISPOSITIONS),
39426
+ target: z9.string().min(1).max(1024).nullable(),
39427
+ reasons: z9.array(z9.string()),
39428
+ judgments: z9.array(judgmentSchema),
39429
+ ownerTasks: z9.array(z9.string().regex(/^[TD]\d+$/)),
39430
+ category: z9.string(),
39431
+ refs: z9.array(z9.string()),
39432
+ overridden: z9.boolean(),
39433
+ covers: z9.array(z9.string()),
39434
+ baselineRemove: z9.boolean()
39128
39435
  })
39129
39436
  ),
39130
- linkFixes: z8.array(
39131
- z8.object({
39132
- kind: z8.literal("link-fix"),
39437
+ linkFixes: z9.array(
39438
+ z9.object({
39439
+ kind: z9.literal("link-fix"),
39133
39440
  path: relPath,
39134
- href: z8.string().min(1).max(2048),
39135
- newHref: z8.string().min(1).max(2048),
39136
- base: z8.literal("repo").optional(),
39137
- sha256: z8.string().regex(/^[0-9a-f]{64}$/).optional()
39441
+ href: z9.string().min(1).max(2048),
39442
+ newHref: z9.string().min(1).max(2048),
39443
+ base: z9.literal("repo").optional(),
39444
+ sha256: z9.string().regex(/^[0-9a-f]{64}$/).optional()
39138
39445
  })
39139
39446
  ).optional(),
39140
- repoRoot: z8.string().min(1).optional()
39447
+ repoRoot: z9.string().min(1).optional()
39141
39448
  });
39142
- var docsModernizeOverridesSchema = z8.record(
39449
+ var docsModernizeOverridesSchema = z9.record(
39143
39450
  relPath,
39144
- z8.object({
39145
- disposition: z8.enum(DOCS_MODERNIZE_DISPOSITIONS),
39146
- target: z8.string().min(1).max(1024).nullable().optional(),
39147
- reason: z8.string().min(1),
39148
- kind: z8.string().min(1).optional(),
39149
- slug: z8.string().regex(/^[a-z0-9][a-z0-9-]*$/).optional(),
39150
- covers: z8.array(z8.string()).optional()
39451
+ z9.object({
39452
+ disposition: z9.enum(DOCS_MODERNIZE_DISPOSITIONS),
39453
+ target: z9.string().min(1).max(1024).nullable().optional(),
39454
+ reason: z9.string().min(1),
39455
+ kind: z9.string().min(1).optional(),
39456
+ slug: z9.string().regex(/^[a-z0-9][a-z0-9-]*$/).optional(),
39457
+ covers: z9.array(z9.string()).optional()
39151
39458
  })
39152
39459
  );
39153
- var receiptOpSchema = z8.object({
39154
- op: z8.enum(DOCS_MODERNIZE_OPS),
39155
- state: z8.enum(["pending", "done", "reversed"]),
39156
- slug: z8.string().nullable(),
39460
+ var receiptOpSchema = z9.object({
39461
+ op: z9.enum(DOCS_MODERNIZE_OPS),
39462
+ state: z9.enum(["pending", "done", "reversed"]),
39463
+ slug: z9.string().nullable(),
39157
39464
  path: relPath.nullable(),
39158
- target: z8.string().nullable(),
39159
- attachmentId: z8.string().nullable(),
39160
- ownerId: z8.string().nullable(),
39161
- beforeSha256: z8.string().regex(/^[0-9a-f]{64}$/).nullable(),
39162
- afterSha256: z8.string().regex(/^[0-9a-f]{64}$/).nullable(),
39163
- prior: z8.object({
39164
- lifecycleStatus: z8.string().nullable().optional(),
39165
- supersededBy: z8.string().nullable().optional(),
39166
- supersedes: z8.string().nullable().optional(),
39167
- previousAttachmentId: z8.string().nullable().optional(),
39168
- newAttachmentId: z8.string().nullable().optional(),
39169
- linkTargets: z8.array(z8.string()).optional(),
39170
- kind: z8.string().nullable().optional()
39465
+ target: z9.string().nullable(),
39466
+ attachmentId: z9.string().nullable(),
39467
+ ownerId: z9.string().nullable(),
39468
+ beforeSha256: z9.string().regex(/^[0-9a-f]{64}$/).nullable(),
39469
+ afterSha256: z9.string().regex(/^[0-9a-f]{64}$/).nullable(),
39470
+ prior: z9.object({
39471
+ lifecycleStatus: z9.string().nullable().optional(),
39472
+ supersededBy: z9.string().nullable().optional(),
39473
+ supersedes: z9.string().nullable().optional(),
39474
+ previousAttachmentId: z9.string().nullable().optional(),
39475
+ newAttachmentId: z9.string().nullable().optional(),
39476
+ linkTargets: z9.array(z9.string()).optional(),
39477
+ kind: z9.string().nullable().optional()
39171
39478
  }).optional(),
39172
- base: z8.literal("repo").optional()
39479
+ base: z9.literal("repo").optional()
39173
39480
  });
39174
39481
  var docsModernizeJournalLineSchema = receiptOpSchema.extend({
39175
- i: z8.number().int().min(0)
39176
- });
39177
- var docsModernizeReceiptSchema = z8.object({
39178
- runId: z8.string().regex(/^dm-[\w-]+$/),
39179
- root: z8.string().min(1),
39180
- appliedAt: z8.string(),
39181
- planSha256: z8.string(),
39182
- edgeCount: z8.number(),
39183
- rolledBackAt: z8.string().nullable(),
39184
- blobs: z8.array(z8.object({ path: relPath, sha256: z8.string() })),
39185
- moves: z8.array(z8.object({ from: relPath, to: relPath })),
39186
- deleted: z8.array(relPath),
39187
- ops: z8.array(receiptOpSchema),
39188
- durationMs: z8.number().optional(),
39189
- repoRoot: z8.string().min(1).optional()
39482
+ i: z9.number().int().min(0)
39483
+ });
39484
+ var docsModernizeReceiptSchema = z9.object({
39485
+ runId: z9.string().regex(/^dm-[\w-]+$/),
39486
+ root: z9.string().min(1),
39487
+ appliedAt: z9.string(),
39488
+ planSha256: z9.string(),
39489
+ edgeCount: z9.number(),
39490
+ rolledBackAt: z9.string().nullable(),
39491
+ blobs: z9.array(z9.object({ path: relPath, sha256: z9.string() })),
39492
+ moves: z9.array(z9.object({ from: relPath, to: relPath })),
39493
+ deleted: z9.array(relPath),
39494
+ ops: z9.array(receiptOpSchema),
39495
+ durationMs: z9.number().optional(),
39496
+ repoRoot: z9.string().min(1).optional()
39190
39497
  });
39191
39498
 
39192
39499
  // packages/contracts/src/docs/provenance.ts
39193
- import { z as z9 } from "zod";
39500
+ import { z as z10 } from "zod";
39194
39501
  var PROVENANCE_NODE_KINDS = [
39195
39502
  "doc",
39196
39503
  "task",
@@ -39213,96 +39520,96 @@ var DOC_LIFECYCLE_STATUSES = [
39213
39520
  "archived",
39214
39521
  "draft"
39215
39522
  ];
39216
- var provenanceNodeKindSchema = z9.enum(PROVENANCE_NODE_KINDS);
39217
- var provenanceEdgeRelationSchema = z9.enum(PROVENANCE_EDGE_RELATIONS);
39218
- var docLifecycleStatusSchema = z9.enum(DOC_LIFECYCLE_STATUSES);
39523
+ var provenanceNodeKindSchema = z10.enum(PROVENANCE_NODE_KINDS);
39524
+ var provenanceEdgeRelationSchema = z10.enum(PROVENANCE_EDGE_RELATIONS);
39525
+ var docLifecycleStatusSchema = z10.enum(DOC_LIFECYCLE_STATUSES);
39219
39526
  var provenanceNodeBaseFields = {
39220
- id: z9.string().min(1),
39221
- title: z9.string().min(1),
39222
- metadata: z9.record(z9.string(), z9.unknown()).optional()
39527
+ id: z10.string().min(1),
39528
+ title: z10.string().min(1),
39529
+ metadata: z10.record(z10.string(), z10.unknown()).optional()
39223
39530
  };
39224
- var provenanceDocNodeSchema = z9.object({
39531
+ var provenanceDocNodeSchema = z10.object({
39225
39532
  ...provenanceNodeBaseFields,
39226
- kind: z9.literal("doc"),
39227
- slug: z9.string().min(1),
39228
- docKind: z9.string().min(1),
39533
+ kind: z10.literal("doc"),
39534
+ slug: z10.string().min(1),
39535
+ docKind: z10.string().min(1),
39229
39536
  lifecycleStatus: docLifecycleStatusSchema,
39230
- publishedAt: z9.string().min(1),
39231
- supersededAt: z9.string().min(1).optional(),
39232
- summary: z9.string().optional()
39537
+ publishedAt: z10.string().min(1),
39538
+ supersededAt: z10.string().min(1).optional(),
39539
+ summary: z10.string().optional()
39233
39540
  });
39234
- var provenanceTaskNodeSchema = z9.object({
39541
+ var provenanceTaskNodeSchema = z10.object({
39235
39542
  ...provenanceNodeBaseFields,
39236
- kind: z9.literal("task"),
39237
- taskType: z9.enum(["saga", "epic", "task", "subtask"]),
39238
- status: z9.enum(["pending", "in_progress", "done", "blocked", "cancelled", "archived"])
39543
+ kind: z10.literal("task"),
39544
+ taskType: z10.enum(["saga", "epic", "task", "subtask"]),
39545
+ status: z10.enum(["pending", "in_progress", "done", "blocked", "cancelled", "archived"])
39239
39546
  });
39240
- var provenanceDecisionNodeSchema = z9.object({
39547
+ var provenanceDecisionNodeSchema = z10.object({
39241
39548
  ...provenanceNodeBaseFields,
39242
- kind: z9.literal("decision"),
39243
- outcome: z9.enum(["proposed", "accepted", "rejected", "superseded"]),
39244
- decidedAt: z9.string().min(1)
39549
+ kind: z10.literal("decision"),
39550
+ outcome: z10.enum(["proposed", "accepted", "rejected", "superseded"]),
39551
+ decidedAt: z10.string().min(1)
39245
39552
  });
39246
- var provenanceSessionNodeSchema = z9.object({
39553
+ var provenanceSessionNodeSchema = z10.object({
39247
39554
  ...provenanceNodeBaseFields,
39248
- kind: z9.literal("session"),
39249
- startedAt: z9.string().min(1),
39250
- endedAt: z9.string().min(1).optional()
39555
+ kind: z10.literal("session"),
39556
+ startedAt: z10.string().min(1),
39557
+ endedAt: z10.string().min(1).optional()
39251
39558
  });
39252
- var provenanceMemoryNodeSchema = z9.object({
39559
+ var provenanceMemoryNodeSchema = z10.object({
39253
39560
  ...provenanceNodeBaseFields,
39254
- kind: z9.literal("memory"),
39255
- memoryType: z9.enum(["observation", "pattern", "decision", "diary"]),
39256
- recordedAt: z9.string().min(1)
39561
+ kind: z10.literal("memory"),
39562
+ memoryType: z10.enum(["observation", "pattern", "decision", "diary"]),
39563
+ recordedAt: z10.string().min(1)
39257
39564
  });
39258
- var provenanceNodeSchema = z9.discriminatedUnion("kind", [
39565
+ var provenanceNodeSchema = z10.discriminatedUnion("kind", [
39259
39566
  provenanceDocNodeSchema,
39260
39567
  provenanceTaskNodeSchema,
39261
39568
  provenanceDecisionNodeSchema,
39262
39569
  provenanceSessionNodeSchema,
39263
39570
  provenanceMemoryNodeSchema
39264
39571
  ]);
39265
- var provenanceEdgeSchema = z9.object({
39572
+ var provenanceEdgeSchema = z10.object({
39266
39573
  relation: provenanceEdgeRelationSchema,
39267
- from: z9.string().min(1),
39574
+ from: z10.string().min(1),
39268
39575
  fromKind: provenanceNodeKindSchema,
39269
- to: z9.string().min(1),
39576
+ to: z10.string().min(1),
39270
39577
  toKind: provenanceNodeKindSchema,
39271
- addedAt: z9.string().min(1),
39272
- summary: z9.string().optional()
39578
+ addedAt: z10.string().min(1),
39579
+ summary: z10.string().optional()
39273
39580
  });
39274
- var docProvenanceResponseSchema = z9.object({
39275
- nodes: z9.array(provenanceNodeSchema).readonly(),
39276
- edges: z9.array(provenanceEdgeSchema).readonly(),
39277
- totalNodes: z9.number().int().nonnegative(),
39278
- totalEdges: z9.number().int().nonnegative()
39581
+ var docProvenanceResponseSchema = z10.object({
39582
+ nodes: z10.array(provenanceNodeSchema).readonly(),
39583
+ edges: z10.array(provenanceEdgeSchema).readonly(),
39584
+ totalNodes: z10.number().int().nonnegative(),
39585
+ totalEdges: z10.number().int().nonnegative()
39279
39586
  });
39280
39587
 
39281
39588
  // packages/contracts/src/docs/read.ts
39282
- import { z as z10 } from "zod";
39283
- var docFrontmatterSchema = z10.object({
39284
- slug: z10.string(),
39285
- kind: z10.string().nullable(),
39286
- title: z10.string().nullable(),
39287
- summary: z10.string().nullable(),
39288
- lifecycleStatus: z10.string(),
39289
- docVersion: z10.number().int(),
39290
- ownerVersion: z10.string().nullable(),
39291
- supersedes: z10.string().nullable(),
39292
- supersededBy: z10.string().nullable(),
39293
- topics: z10.array(z10.string()).readonly(),
39294
- relatedTasks: z10.array(z10.string()).readonly(),
39295
- sha256: z10.string(),
39296
- createdAt: z10.string()
39297
- });
39298
- var docBodySchema = z10.object({
39299
- encoding: z10.enum(["utf-8", "base64"]),
39300
- text: z10.string().optional(),
39301
- base64: z10.string().optional(),
39302
- sizeBytes: z10.number().int().nonnegative(),
39303
- mimeType: z10.string().nullable()
39304
- });
39305
- var docReadResponseSchema = z10.object({
39589
+ import { z as z11 } from "zod";
39590
+ var docFrontmatterSchema = z11.object({
39591
+ slug: z11.string(),
39592
+ kind: z11.string().nullable(),
39593
+ title: z11.string().nullable(),
39594
+ summary: z11.string().nullable(),
39595
+ lifecycleStatus: z11.string(),
39596
+ docVersion: z11.number().int(),
39597
+ ownerVersion: z11.string().nullable(),
39598
+ supersedes: z11.string().nullable(),
39599
+ supersededBy: z11.string().nullable(),
39600
+ topics: z11.array(z11.string()).readonly(),
39601
+ relatedTasks: z11.array(z11.string()).readonly(),
39602
+ sha256: z11.string(),
39603
+ createdAt: z11.string()
39604
+ });
39605
+ var docBodySchema = z11.object({
39606
+ encoding: z11.enum(["utf-8", "base64"]),
39607
+ text: z11.string().optional(),
39608
+ base64: z11.string().optional(),
39609
+ sizeBytes: z11.number().int().nonnegative(),
39610
+ mimeType: z11.string().nullable()
39611
+ });
39612
+ var docReadResponseSchema = z11.object({
39306
39613
  frontmatter: docFrontmatterSchema,
39307
39614
  body: docBodySchema
39308
39615
  });
@@ -39472,7 +39779,7 @@ function getErrorMessage(error48, fallback = "Unknown error") {
39472
39779
  }
39473
39780
 
39474
39781
  // packages/contracts/src/evidence-atom-schema.ts
39475
- import { z as z11 } from "zod";
39782
+ import { z as z12 } from "zod";
39476
39783
  var EVIDENCE_ATOM_KINDS = [
39477
39784
  "commit",
39478
39785
  "files",
@@ -39494,96 +39801,96 @@ var PARSER_PREFIXES = [...EVIDENCE_ATOM_KINDS, "state"];
39494
39801
  var KIND_BOUNDARY_REGEX = new RegExp(`;(?=\\s*(?:${PARSER_PREFIXES.join("|")})\\s*:)`, "g");
39495
39802
  var DEPLOY_PROVIDER_REGEX = /^[a-z0-9][a-z0-9._-]*$/;
39496
39803
  var DEPLOY_ID_REGEX = /^[^\s@|]+$/;
39497
- var commitAtomSchema = z11.object({
39498
- kind: z11.literal("commit"),
39499
- sha: z11.string().regex(/^[0-9a-f]{7,40}$/i, "commit sha must be 7-40 hex characters")
39500
- });
39501
- var filesAtomSchema = z11.object({
39502
- kind: z11.literal("files"),
39503
- paths: z11.array(z11.string().min(1)).min(1, "files atom requires at least one path")
39504
- });
39505
- var testRunAtomSchema = z11.object({
39506
- kind: z11.literal("test-run"),
39507
- path: z11.string().min(1, "test-run atom requires a non-empty path")
39508
- });
39509
- var qaRunAtomSchema = z11.object({
39510
- kind: z11.literal("qa-run"),
39511
- path: z11.string().min(1, "qa-run atom requires a non-empty path")
39512
- });
39513
- var toolAtomSchema = z11.object({
39514
- kind: z11.literal("tool"),
39515
- tool: z11.string().min(1, "tool atom requires a non-empty tool name")
39516
- });
39517
- var urlAtomSchema = z11.object({
39518
- kind: z11.literal("url"),
39519
- url: z11.string().min(1).regex(/^https?:\/\//, "url atom must start with http:// or https://")
39520
- });
39521
- var noteAtomSchema = z11.object({
39522
- kind: z11.literal("note"),
39523
- note: z11.string().min(1, "note atom must be non-empty").max(512, "note atom is too long (max 512 chars)")
39524
- });
39525
- var decisionAtomSchema = z11.object({
39526
- kind: z11.literal("decision"),
39527
- decisionId: z11.string().min(1, "decision atom requires a non-empty decision ID")
39528
- });
39529
- var prAtomSchema = z11.object({
39530
- kind: z11.literal("pr"),
39531
- prNumber: z11.number().int().positive("pr atom requires a positive integer PR number"),
39532
- componentPrNumber: z11.number().int().positive().optional(),
39804
+ var commitAtomSchema = z12.object({
39805
+ kind: z12.literal("commit"),
39806
+ sha: z12.string().regex(/^[0-9a-f]{7,40}$/i, "commit sha must be 7-40 hex characters")
39807
+ });
39808
+ var filesAtomSchema = z12.object({
39809
+ kind: z12.literal("files"),
39810
+ paths: z12.array(z12.string().min(1)).min(1, "files atom requires at least one path")
39811
+ });
39812
+ var testRunAtomSchema = z12.object({
39813
+ kind: z12.literal("test-run"),
39814
+ path: z12.string().min(1, "test-run atom requires a non-empty path")
39815
+ });
39816
+ var qaRunAtomSchema = z12.object({
39817
+ kind: z12.literal("qa-run"),
39818
+ path: z12.string().min(1, "qa-run atom requires a non-empty path")
39819
+ });
39820
+ var toolAtomSchema = z12.object({
39821
+ kind: z12.literal("tool"),
39822
+ tool: z12.string().min(1, "tool atom requires a non-empty tool name")
39823
+ });
39824
+ var urlAtomSchema = z12.object({
39825
+ kind: z12.literal("url"),
39826
+ url: z12.string().min(1).regex(/^https?:\/\//, "url atom must start with http:// or https://")
39827
+ });
39828
+ var noteAtomSchema = z12.object({
39829
+ kind: z12.literal("note"),
39830
+ note: z12.string().min(1, "note atom must be non-empty").max(512, "note atom is too long (max 512 chars)")
39831
+ });
39832
+ var decisionAtomSchema = z12.object({
39833
+ kind: z12.literal("decision"),
39834
+ decisionId: z12.string().min(1, "decision atom requires a non-empty decision ID")
39835
+ });
39836
+ var prAtomSchema = z12.object({
39837
+ kind: z12.literal("pr"),
39838
+ prNumber: z12.number().int().positive("pr atom requires a positive integer PR number"),
39839
+ componentPrNumber: z12.number().int().positive().optional(),
39533
39840
  /**
39534
39841
  * `pr:<owner>/<repo>#<n>` (T13912): the GitHub repository the PR number
39535
39842
  * belongs to, lowercased. Validated against the evidence git root's
39536
39843
  * `origin`, since PR numbers are only unique per repository.
39537
39844
  */
39538
- repo: z11.string().regex(/^[a-z0-9._-]+\/[a-z0-9._-]+$/).optional()
39845
+ repo: z12.string().regex(/^[a-z0-9._-]+\/[a-z0-9._-]+$/).optional()
39539
39846
  });
39540
- var ciAtomSchema = z11.object({
39541
- kind: z11.literal("ci"),
39542
- prNumber: z11.number().int().positive("ci atom requires a positive integer PR number"),
39543
- componentPrNumber: z11.number().int().positive().optional(),
39847
+ var ciAtomSchema = z12.object({
39848
+ kind: z12.literal("ci"),
39849
+ prNumber: z12.number().int().positive("ci atom requires a positive integer PR number"),
39850
+ componentPrNumber: z12.number().int().positive().optional(),
39544
39851
  /** `ci:<owner>/<repo>#<n>`, as for `pr:` (T13912). */
39545
- repo: z11.string().regex(/^[a-z0-9._-]+\/[a-z0-9._-]+$/).optional()
39852
+ repo: z12.string().regex(/^[a-z0-9._-]+\/[a-z0-9._-]+$/).optional()
39546
39853
  });
39547
- var ciRunAtomSchema = z11.object({
39548
- kind: z11.literal("ci-run"),
39549
- runId: z11.number().int().positive("ci-run atom requires a positive integer run id")
39854
+ var ciRunAtomSchema = z12.object({
39855
+ kind: z12.literal("ci-run"),
39856
+ runId: z12.number().int().positive("ci-run atom requires a positive integer run id")
39550
39857
  });
39551
- var deployAtomSchema = z11.object({
39552
- kind: z11.literal("deploy"),
39553
- provider: z11.string().regex(DEPLOY_PROVIDER_REGEX, "deploy atom provider must be a lowercase name"),
39554
- deploymentId: z11.string().regex(DEPLOY_ID_REGEX, "deploy atom requires a deployment id"),
39555
- sha: z11.string().regex(/^[0-9a-f]{7,40}$/, "deploy atom sha must be 7-40 lowercase hex chars"),
39556
- probeUrl: z11.string().regex(/^https?:\/\/\S+$/, "deploy atom probe url must start with http:// or https://")
39858
+ var deployAtomSchema = z12.object({
39859
+ kind: z12.literal("deploy"),
39860
+ provider: z12.string().regex(DEPLOY_PROVIDER_REGEX, "deploy atom provider must be a lowercase name"),
39861
+ deploymentId: z12.string().regex(DEPLOY_ID_REGEX, "deploy atom requires a deployment id"),
39862
+ sha: z12.string().regex(/^[0-9a-f]{7,40}$/, "deploy atom sha must be 7-40 lowercase hex chars"),
39863
+ probeUrl: z12.string().regex(/^https?:\/\/\S+$/, "deploy atom probe url must start with http:// or https://")
39557
39864
  });
39558
- var locDropAtomSchema = z11.object({
39559
- kind: z11.literal("loc-drop"),
39560
- fromLines: z11.number().int().nonnegative("loc-drop fromLines must be \u2265 0"),
39561
- toLines: z11.number().int().nonnegative("loc-drop toLines must be \u2265 0")
39865
+ var locDropAtomSchema = z12.object({
39866
+ kind: z12.literal("loc-drop"),
39867
+ fromLines: z12.number().int().nonnegative("loc-drop fromLines must be \u2265 0"),
39868
+ toLines: z12.number().int().nonnegative("loc-drop toLines must be \u2265 0")
39562
39869
  });
39563
- var callsiteCoverageAtomSchema = z11.object({
39564
- kind: z11.literal("callsite-coverage"),
39565
- symbolName: z11.string().min(1, "callsite-coverage atom requires a non-empty symbolName"),
39566
- relativeSourcePath: z11.string().min(1, "callsite-coverage atom requires a non-empty relativeSourcePath")
39870
+ var callsiteCoverageAtomSchema = z12.object({
39871
+ kind: z12.literal("callsite-coverage"),
39872
+ symbolName: z12.string().min(1, "callsite-coverage atom requires a non-empty symbolName"),
39873
+ relativeSourcePath: z12.string().min(1, "callsite-coverage atom requires a non-empty relativeSourcePath")
39567
39874
  });
39568
39875
  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}$/;
39569
39876
  var AC_ALIAS_REGEX = /^AC[0-9]{1,4}$/;
39570
39877
  var SATISFIES_TASK_ID_REGEX = /^T[0-9]{1,7}$/;
39571
39878
  var SATISFIES_VERSION_PIN_REGEX = /^[0-9]{14}$/;
39572
- var satisfiesAtomSchema = z11.object({
39573
- kind: z11.literal("satisfies"),
39879
+ var satisfiesAtomSchema = z12.object({
39880
+ kind: z12.literal("satisfies"),
39574
39881
  /** Target task ID — `T<1-7 digits>` per ADR-079-r2 §2.1. */
39575
- targetTaskId: z11.string().regex(SATISFIES_TASK_ID_REGEX, "satisfies atom targetTaskId must match /^T[0-9]{1,7}$/"),
39882
+ targetTaskId: z12.string().regex(SATISFIES_TASK_ID_REGEX, "satisfies atom targetTaskId must match /^T[0-9]{1,7}$/"),
39576
39883
  /** Lowercase UUIDv4/v5 — populated for the canonical form; undefined for alias form. */
39577
- targetAcId: z11.string().regex(AC_UUID_REGEX, "satisfies atom targetAcId must be a lowercase UUIDv4/v5").optional(),
39884
+ targetAcId: z12.string().regex(AC_UUID_REGEX, "satisfies atom targetAcId must be a lowercase UUIDv4/v5").optional(),
39578
39885
  /** Positional alias `AC<1-4 digits>` — populated for alias form; undefined for UUID form. */
39579
- targetAcAlias: z11.string().regex(AC_ALIAS_REGEX, "satisfies atom targetAcAlias must match /^AC[0-9]{1,4}$/").optional(),
39886
+ targetAcAlias: z12.string().regex(AC_ALIAS_REGEX, "satisfies atom targetAcAlias must match /^AC[0-9]{1,4}$/").optional(),
39580
39887
  /** Optional `@<14-digit YYYYMMDDhhmmss>` pin captured at mint time. */
39581
- versionPin: z11.string().regex(
39888
+ versionPin: z12.string().regex(
39582
39889
  SATISFIES_VERSION_PIN_REGEX,
39583
39890
  "satisfies atom versionPin must be 14 digits (YYYYMMDDhhmmss)"
39584
39891
  ).optional()
39585
39892
  });
39586
- var EvidenceAtomSchema = z11.discriminatedUnion("kind", [
39893
+ var EvidenceAtomSchema = z12.discriminatedUnion("kind", [
39587
39894
  commitAtomSchema,
39588
39895
  filesAtomSchema,
39589
39896
  testRunAtomSchema,
@@ -39645,54 +39952,54 @@ var ATOM_EXAMPLES = Object.freeze({
39645
39952
  });
39646
39953
 
39647
39954
  // packages/contracts/src/evidence-record-schema.ts
39648
- import { z as z12 } from "zod";
39649
- var evidenceBaseSchema = z12.object({
39955
+ import { z as z13 } from "zod";
39956
+ var evidenceBaseSchema = z13.object({
39650
39957
  /** Identity string of the agent that produced this record. */
39651
- agentIdentity: z12.string().min(1),
39958
+ agentIdentity: z13.string().min(1),
39652
39959
  /** SHA-256 hex digest (64 chars) of the attached artifact. */
39653
- attachmentSha256: z12.string().length(64),
39960
+ attachmentSha256: z13.string().length(64),
39654
39961
  /** ISO 8601 timestamp at which the action ran. */
39655
- ranAt: z12.string().datetime(),
39962
+ ranAt: z13.string().datetime(),
39656
39963
  /** Wall-clock duration of the action in milliseconds. */
39657
- durationMs: z12.number().nonnegative()
39964
+ durationMs: z13.number().nonnegative()
39658
39965
  });
39659
39966
  var implDiffRecordSchema = evidenceBaseSchema.extend({
39660
- kind: z12.literal("impl-diff"),
39661
- phase: z12.literal("implement"),
39662
- filesChanged: z12.array(z12.string().min(1)).min(1),
39663
- linesAdded: z12.number().int().nonnegative(),
39664
- linesRemoved: z12.number().int().nonnegative()
39967
+ kind: z13.literal("impl-diff"),
39968
+ phase: z13.literal("implement"),
39969
+ filesChanged: z13.array(z13.string().min(1)).min(1),
39970
+ linesAdded: z13.number().int().nonnegative(),
39971
+ linesRemoved: z13.number().int().nonnegative()
39665
39972
  });
39666
39973
  var validateSpecCheckRecordSchema = evidenceBaseSchema.extend({
39667
- kind: z12.literal("validate-spec-check"),
39668
- phase: z12.literal("validate"),
39669
- reqIdsChecked: z12.array(z12.string().min(1)).min(1),
39670
- passed: z12.boolean(),
39671
- details: z12.string().min(1)
39974
+ kind: z13.literal("validate-spec-check"),
39975
+ phase: z13.literal("validate"),
39976
+ reqIdsChecked: z13.array(z13.string().min(1)).min(1),
39977
+ passed: z13.boolean(),
39978
+ details: z13.string().min(1)
39672
39979
  });
39673
39980
  var testOutputRecordSchema = evidenceBaseSchema.extend({
39674
- kind: z12.literal("test-output"),
39675
- phase: z12.literal("test"),
39676
- command: z12.string().min(1),
39677
- exitCode: z12.number().int(),
39678
- testsPassed: z12.number().int().nonnegative(),
39679
- testsFailed: z12.number().int().nonnegative()
39981
+ kind: z13.literal("test-output"),
39982
+ phase: z13.literal("test"),
39983
+ command: z13.string().min(1),
39984
+ exitCode: z13.number().int(),
39985
+ testsPassed: z13.number().int().nonnegative(),
39986
+ testsFailed: z13.number().int().nonnegative()
39680
39987
  });
39681
39988
  var lintReportRecordSchema = evidenceBaseSchema.extend({
39682
- kind: z12.literal("lint-report"),
39683
- phase: z12.enum(["implement", "test"]),
39684
- tool: z12.string().min(1),
39685
- passed: z12.boolean(),
39686
- warnings: z12.number().int().nonnegative(),
39687
- errors: z12.number().int().nonnegative()
39989
+ kind: z13.literal("lint-report"),
39990
+ phase: z13.enum(["implement", "test"]),
39991
+ tool: z13.string().min(1),
39992
+ passed: z13.boolean(),
39993
+ warnings: z13.number().int().nonnegative(),
39994
+ errors: z13.number().int().nonnegative()
39688
39995
  });
39689
39996
  var commandOutputRecordSchema = evidenceBaseSchema.extend({
39690
- kind: z12.literal("command-output"),
39691
- phase: z12.enum(["implement", "validate", "test"]),
39692
- cmd: z12.string().min(1),
39693
- exitCode: z12.number().int()
39997
+ kind: z13.literal("command-output"),
39998
+ phase: z13.enum(["implement", "validate", "test"]),
39999
+ cmd: z13.string().min(1),
40000
+ exitCode: z13.number().int()
39694
40001
  });
39695
- var evidenceRecordSchema = z12.discriminatedUnion("kind", [
40002
+ var evidenceRecordSchema = z13.discriminatedUnion("kind", [
39696
40003
  implDiffRecordSchema,
39697
40004
  validateSpecCheckRecordSchema,
39698
40005
  testOutputRecordSchema,
@@ -40627,107 +40934,107 @@ var KIND_LIFECYCLE_REQUIREMENTS = Object.freeze({
40627
40934
  });
40628
40935
 
40629
40936
  // packages/contracts/src/lease-ipc/messages.ts
40630
- import { z as z13 } from "zod";
40631
- var LeaseScopeSchema = z13.enum(["project", "global"]);
40632
- var LeaseLaneSchema = z13.enum(["tasks", "brain", "bulk"]);
40633
- var LeaseAcquireRequestSchema = z13.object({
40937
+ import { z as z14 } from "zod";
40938
+ var LeaseScopeSchema = z14.enum(["project", "global"]);
40939
+ var LeaseLaneSchema = z14.enum(["tasks", "brain", "bulk"]);
40940
+ var LeaseAcquireRequestSchema = z14.object({
40634
40941
  /** Tag discriminating this request variant. */
40635
- kind: z13.literal("lease_acquire"),
40942
+ kind: z14.literal("lease_acquire"),
40636
40943
  /** The cleo.db scope being arbitrated. */
40637
40944
  scope: LeaseScopeSchema,
40638
40945
  /** The write lane within the scope. */
40639
40946
  lane: LeaseLaneSchema,
40640
40947
  /** Process+lane holder identity. */
40641
- holder_id: z13.string().min(1),
40948
+ holder_id: z14.string().min(1),
40642
40949
  /** Advisory priority — lower acquires sooner. `0` = highest. */
40643
- priority: z13.number().int().min(0).max(255),
40950
+ priority: z14.number().int().min(0).max(255),
40644
40951
  /** Lease time-to-live in milliseconds. */
40645
- ttl_ms: z13.number().int().nonnegative(),
40952
+ ttl_ms: z14.number().int().nonnegative(),
40646
40953
  /** When true, a same-holder acquire re-enters (refcount++) rather than queuing. */
40647
- reentrant: z13.boolean()
40954
+ reentrant: z14.boolean()
40648
40955
  }).strict();
40649
- var LeaseReleaseRequestSchema = z13.object({
40956
+ var LeaseReleaseRequestSchema = z14.object({
40650
40957
  /** Tag discriminating this request variant. */
40651
- kind: z13.literal("lease_release"),
40958
+ kind: z14.literal("lease_release"),
40652
40959
  /** The cleo.db scope being arbitrated. */
40653
40960
  scope: LeaseScopeSchema,
40654
40961
  /** The write lane within the scope. */
40655
40962
  lane: LeaseLaneSchema,
40656
40963
  /** Process+lane holder identity. */
40657
- holder_id: z13.string().min(1),
40964
+ holder_id: z14.string().min(1),
40658
40965
  /** The epoch fence the holder acquired — a stale epoch no-ops. */
40659
- epoch: z13.number().int().nonnegative()
40966
+ epoch: z14.number().int().nonnegative()
40660
40967
  }).strict();
40661
- var LeaseRenewRequestSchema = z13.object({
40968
+ var LeaseRenewRequestSchema = z14.object({
40662
40969
  /** Tag discriminating this request variant. */
40663
- kind: z13.literal("lease_renew"),
40970
+ kind: z14.literal("lease_renew"),
40664
40971
  /** The cleo.db scope being arbitrated. */
40665
40972
  scope: LeaseScopeSchema,
40666
40973
  /** The write lane within the scope. */
40667
40974
  lane: LeaseLaneSchema,
40668
40975
  /** Process+lane holder identity. */
40669
- holder_id: z13.string().min(1),
40976
+ holder_id: z14.string().min(1),
40670
40977
  /** The epoch fence the holder acquired (epoch-guarded renew). */
40671
- epoch: z13.number().int().nonnegative()
40978
+ epoch: z14.number().int().nonnegative()
40672
40979
  }).strict();
40673
- var RateCheckRequestSchema = z13.object({
40980
+ var RateCheckRequestSchema = z14.object({
40674
40981
  /** Tag discriminating this request variant. */
40675
- kind: z13.literal("rate_check"),
40982
+ kind: z14.literal("rate_check"),
40676
40983
  /** The cleo.db scope being checked. */
40677
40984
  scope: LeaseScopeSchema,
40678
40985
  /** The write lane within the scope. */
40679
40986
  lane: LeaseLaneSchema,
40680
40987
  /** Estimated bytes the caller intends to write. */
40681
- est_bytes: z13.number().int().nonnegative()
40988
+ est_bytes: z14.number().int().nonnegative()
40682
40989
  }).strict();
40683
- var ToolGrantRequestSchema = z13.object({
40990
+ var ToolGrantRequestSchema = z14.object({
40684
40991
  /** Tag discriminating this request variant. */
40685
- kind: z13.literal("tool_grant"),
40992
+ kind: z14.literal("tool_grant"),
40686
40993
  /** The tool name being requested. */
40687
- tool: z13.string().min(1),
40994
+ tool: z14.string().min(1),
40688
40995
  /** The requesting holder identity. */
40689
- holder_id: z13.string().min(1)
40996
+ holder_id: z14.string().min(1)
40690
40997
  }).strict();
40691
- var QueuePriorityClassSchema = z13.enum(["lead", "worker", "background"]);
40692
- var QueueAdmitRequestSchema = z13.object({
40998
+ var QueuePriorityClassSchema = z14.enum(["lead", "worker", "background"]);
40999
+ var QueueAdmitRequestSchema = z14.object({
40693
41000
  /** Tag discriminating this request variant. */
40694
- kind: z13.literal("queue_admit"),
41001
+ kind: z14.literal("queue_admit"),
40695
41002
  /** The LLM provider id the call targets (rate budget is per-provider). */
40696
- provider: z13.string().min(1),
41003
+ provider: z14.string().min(1),
40697
41004
  /** The caller's priority class (lead > worker > background). */
40698
41005
  priority_class: QueuePriorityClassSchema,
40699
41006
  /** The caller's estimate of the request's token cost (debited on admit). */
40700
- est_tokens: z13.number().int().nonnegative(),
41007
+ est_tokens: z14.number().int().nonnegative(),
40701
41008
  /** The child the call belongs to (in-flight tracking — the watchdog seam). */
40702
- child_id: z13.string().min(1)
41009
+ child_id: z14.string().min(1)
40703
41010
  }).strict();
40704
- var WorkerHeartbeatRequestSchema = z13.object({
41011
+ var WorkerHeartbeatRequestSchema = z14.object({
40705
41012
  /** Tag discriminating this request variant. */
40706
- kind: z13.literal("worker_heartbeat"),
41013
+ kind: z14.literal("worker_heartbeat"),
40707
41014
  /** The logical id of the heartbeating child (matches the registry key). */
40708
- child_id: z13.string().min(1),
41015
+ child_id: z14.string().min(1),
40709
41016
  /** The worker's own view of whether it is currently inside an LLM call. */
40710
- in_flight_llm: z13.boolean()
41017
+ in_flight_llm: z14.boolean()
40711
41018
  }).strict();
40712
- var ResourceAdmitRequestSchema = z13.object({
41019
+ var ResourceAdmitRequestSchema = z14.object({
40713
41020
  /** Tag discriminating this request variant. */
40714
- kind: z13.literal("resource_admit"),
41021
+ kind: z14.literal("resource_admit"),
40715
41022
  /** The resource class (e.g. `"db-heavy"`, `"full-build"`, `"test-run"`). */
40716
- class: z13.string().min(1),
41023
+ class: z14.string().min(1),
40717
41024
  /** The caller holding the slot — process/worktree-unique; the release key. */
40718
- holder_id: z13.string().min(1),
41025
+ holder_id: z14.string().min(1),
40719
41026
  /** The client-computed budget: the max concurrent holders for this class. */
40720
- budget: z13.number().int().nonnegative()
41027
+ budget: z14.number().int().nonnegative()
40721
41028
  }).strict();
40722
- var ResourceReleaseRequestSchema = z13.object({
41029
+ var ResourceReleaseRequestSchema = z14.object({
40723
41030
  /** Tag discriminating this request variant. */
40724
- kind: z13.literal("resource_release"),
41031
+ kind: z14.literal("resource_release"),
40725
41032
  /** The resource class the slot belongs to. */
40726
- class: z13.string().min(1),
41033
+ class: z14.string().min(1),
40727
41034
  /** The holder that was admitted (matches the admit `holder_id`). */
40728
- holder_id: z13.string().min(1)
41035
+ holder_id: z14.string().min(1)
40729
41036
  }).strict();
40730
- var LeaseIpcRequestSchema = z13.discriminatedUnion("kind", [
41037
+ var LeaseIpcRequestSchema = z14.discriminatedUnion("kind", [
40731
41038
  LeaseAcquireRequestSchema,
40732
41039
  LeaseReleaseRequestSchema,
40733
41040
  LeaseRenewRequestSchema,
@@ -40738,133 +41045,133 @@ var LeaseIpcRequestSchema = z13.discriminatedUnion("kind", [
40738
41045
  ResourceAdmitRequestSchema,
40739
41046
  ResourceReleaseRequestSchema
40740
41047
  ]);
40741
- var LeaseGrantedResponseSchema = z13.object({
41048
+ var LeaseGrantedResponseSchema = z14.object({
40742
41049
  /** Tag discriminating this response variant. */
40743
- kind: z13.literal("lease_granted"),
41050
+ kind: z14.literal("lease_granted"),
40744
41051
  /** The granted cleo.db scope. */
40745
41052
  scope: LeaseScopeSchema,
40746
41053
  /** The granted write lane. */
40747
41054
  lane: LeaseLaneSchema,
40748
41055
  /** The holder the lease was granted to. */
40749
- holder_id: z13.string().min(1),
41056
+ holder_id: z14.string().min(1),
40750
41057
  /** The monotonic epoch fence assigned to this grant. */
40751
- epoch: z13.number().int().nonnegative(),
41058
+ epoch: z14.number().int().nonnegative(),
40752
41059
  /** The lease TTL in milliseconds. */
40753
- ttl_ms: z13.number().int().nonnegative(),
41060
+ ttl_ms: z14.number().int().nonnegative(),
40754
41061
  /** Absolute expiry timestamp (epoch ms) for this grant. */
40755
- expires_at_ms: z13.number().int().nonnegative()
41062
+ expires_at_ms: z14.number().int().nonnegative()
40756
41063
  }).strict();
40757
- var LeaseQueuedResponseSchema = z13.object({
41064
+ var LeaseQueuedResponseSchema = z14.object({
40758
41065
  /** Tag discriminating this response variant. */
40759
- kind: z13.literal("lease_queued"),
41066
+ kind: z14.literal("lease_queued"),
40760
41067
  /** The queued cleo.db scope. */
40761
41068
  scope: LeaseScopeSchema,
40762
41069
  /** The queued write lane. */
40763
41070
  lane: LeaseLaneSchema,
40764
41071
  /** The monotonic ticket assigned for FIFO tiebreak. */
40765
- ticket: z13.number().int().nonnegative(),
41072
+ ticket: z14.number().int().nonnegative(),
40766
41073
  /** Number of waiters ahead of this one. */
40767
- ahead: z13.number().int().nonnegative()
41074
+ ahead: z14.number().int().nonnegative()
40768
41075
  }).strict();
40769
- var LeaseDeniedResponseSchema = z13.object({
41076
+ var LeaseDeniedResponseSchema = z14.object({
40770
41077
  /** Tag discriminating this response variant. */
40771
- kind: z13.literal("lease_denied"),
41078
+ kind: z14.literal("lease_denied"),
40772
41079
  /** The denied cleo.db scope. */
40773
41080
  scope: LeaseScopeSchema,
40774
41081
  /** Machine-readable denial code (e.g. `E_LEASE_UNAVAILABLE`). */
40775
- code: z13.string().min(1),
41082
+ code: z14.string().min(1),
40776
41083
  /** Human-readable denial message. */
40777
- message: z13.string()
41084
+ message: z14.string()
40778
41085
  }).strict();
40779
- var RateResultResponseSchema = z13.object({
41086
+ var RateResultResponseSchema = z14.object({
40780
41087
  /** Tag discriminating this response variant. */
40781
- kind: z13.literal("rate_result"),
41088
+ kind: z14.literal("rate_result"),
40782
41089
  /** The checked cleo.db scope. */
40783
41090
  scope: LeaseScopeSchema,
40784
41091
  /** Whether the write is within budget. */
40785
- ok: z13.boolean(),
41092
+ ok: z14.boolean(),
40786
41093
  /** Suggested back-off in milliseconds when `ok` is false. */
40787
- retry_after_ms: z13.number().int().nonnegative(),
41094
+ retry_after_ms: z14.number().int().nonnegative(),
40788
41095
  /** Remaining token budget for the scope. */
40789
- tokens_remaining: z13.number().int().nonnegative()
41096
+ tokens_remaining: z14.number().int().nonnegative()
40790
41097
  }).strict();
40791
- var ToolGrantedResponseSchema = z13.object({
41098
+ var ToolGrantedResponseSchema = z14.object({
40792
41099
  /** Tag discriminating this response variant. */
40793
- kind: z13.literal("tool_granted"),
41100
+ kind: z14.literal("tool_granted"),
40794
41101
  /** The granted tool name. */
40795
- tool: z13.string().min(1),
41102
+ tool: z14.string().min(1),
40796
41103
  /** The holder the tool grant was issued to. */
40797
- holder_id: z13.string().min(1)
41104
+ holder_id: z14.string().min(1)
40798
41105
  }).strict();
40799
- var LeaseRevokedResponseSchema = z13.object({
41106
+ var LeaseRevokedResponseSchema = z14.object({
40800
41107
  /** Tag discriminating this response variant. */
40801
- kind: z13.literal("lease_revoked"),
41108
+ kind: z14.literal("lease_revoked"),
40802
41109
  /** The revoked cleo.db scope. */
40803
41110
  scope: LeaseScopeSchema,
40804
41111
  /** The revoked write lane. */
40805
41112
  lane: LeaseLaneSchema,
40806
41113
  /** The holder whose lease was revoked. */
40807
- holder_id: z13.string().min(1),
41114
+ holder_id: z14.string().min(1),
40808
41115
  /** Human-readable reason for the revocation. */
40809
- reason: z13.string()
41116
+ reason: z14.string()
40810
41117
  }).strict();
40811
- var ChildKilledUnresponsiveResponseSchema = z13.object({
41118
+ var ChildKilledUnresponsiveResponseSchema = z14.object({
40812
41119
  /** Tag discriminating this response variant. */
40813
- kind: z13.literal("child_killed_unresponsive"),
41120
+ kind: z14.literal("child_killed_unresponsive"),
40814
41121
  /** Logical id of the killed child. */
40815
- child_id: z13.string().min(1),
41122
+ child_id: z14.string().min(1),
40816
41123
  /** The holder identity the killed child held the lease as. */
40817
- holder_id: z13.string().min(1),
41124
+ holder_id: z14.string().min(1),
40818
41125
  /** The cleo.db scope the killed child held the lease in. */
40819
41126
  scope: LeaseScopeSchema,
40820
41127
  /** Human-readable reason for the kill. */
40821
- reason: z13.string()
41128
+ reason: z14.string()
40822
41129
  }).strict();
40823
- var QueueAdmitDispositionSchema = z13.enum(["admitted", "deferred"]);
40824
- var QueueAdmitResultResponseSchema = z13.object({
41130
+ var QueueAdmitDispositionSchema = z14.enum(["admitted", "deferred"]);
41131
+ var QueueAdmitResultResponseSchema = z14.object({
40825
41132
  /** Tag discriminating this response variant. */
40826
- kind: z13.literal("queue_admit_result"),
41133
+ kind: z14.literal("queue_admit_result"),
40827
41134
  /** Whether the LLM call was admitted or deferred. */
40828
41135
  disposition: QueueAdmitDispositionSchema,
40829
41136
  /** Back-off in ms before re-requesting (0 when admitted). */
40830
- retry_after_ms: z13.number().int().nonnegative(),
41137
+ retry_after_ms: z14.number().int().nonnegative(),
40831
41138
  /** Remaining provider token budget after this decision. */
40832
- tokens_remaining: z13.number().int().nonnegative(),
41139
+ tokens_remaining: z14.number().int().nonnegative(),
40833
41140
  /** Number of higher/equal-priority waiters ahead (0 when admitted). */
40834
- queue_position: z13.number().int().nonnegative()
41141
+ queue_position: z14.number().int().nonnegative()
40835
41142
  }).strict();
40836
- var HeartbeatAckResponseSchema = z13.object({
41143
+ var HeartbeatAckResponseSchema = z14.object({
40837
41144
  /** Tag discriminating this response variant. */
40838
- kind: z13.literal("heartbeat_ack")
41145
+ kind: z14.literal("heartbeat_ack")
40839
41146
  }).strict();
40840
- var ResourceAdmitDispositionSchema = z13.enum(["admitted", "deferred"]);
40841
- var ResourceAdmitResultResponseSchema = z13.object({
41147
+ var ResourceAdmitDispositionSchema = z14.enum(["admitted", "deferred"]);
41148
+ var ResourceAdmitResultResponseSchema = z14.object({
40842
41149
  /** Tag discriminating this response variant. */
40843
- kind: z13.literal("resource_admit_result"),
41150
+ kind: z14.literal("resource_admit_result"),
40844
41151
  /** Whether the heavy op was admitted or deferred. */
40845
41152
  disposition: ResourceAdmitDispositionSchema,
40846
41153
  /** Back-off in ms before re-requesting (0 when admitted). */
40847
- retry_after_ms: z13.number().int().nonnegative(),
41154
+ retry_after_ms: z14.number().int().nonnegative(),
40848
41155
  /** Remaining slots for the class after this decision. */
40849
- slots_remaining: z13.number().int().nonnegative()
41156
+ slots_remaining: z14.number().int().nonnegative()
40850
41157
  }).strict();
40851
- var ResourceReleaseResultResponseSchema = z13.object({
41158
+ var ResourceReleaseResultResponseSchema = z14.object({
40852
41159
  /** Tag discriminating this response variant. */
40853
- kind: z13.literal("resource_release_result"),
41160
+ kind: z14.literal("resource_release_result"),
40854
41161
  /** Whether a held slot was actually released (false = no such holder). */
40855
- released: z13.boolean(),
41162
+ released: z14.boolean(),
40856
41163
  /** Remaining in-flight holders for the class after the release. */
40857
- slots_remaining: z13.number().int().nonnegative()
41164
+ slots_remaining: z14.number().int().nonnegative()
40858
41165
  }).strict();
40859
- var LeaseErrorResponseSchema = z13.object({
41166
+ var LeaseErrorResponseSchema = z14.object({
40860
41167
  /** Tag discriminating this response variant. */
40861
- kind: z13.literal("error"),
41168
+ kind: z14.literal("error"),
40862
41169
  /** Machine-readable error code (e.g. `E_LEASE_BAD_VERSION`, `E_LEASE_UNIMPLEMENTED`). */
40863
- code: z13.string().min(1),
41170
+ code: z14.string().min(1),
40864
41171
  /** Human-readable error message. */
40865
- message: z13.string()
41172
+ message: z14.string()
40866
41173
  }).strict();
40867
- var LeaseIpcResponseSchema = z13.discriminatedUnion("kind", [
41174
+ var LeaseIpcResponseSchema = z14.discriminatedUnion("kind", [
40868
41175
  LeaseGrantedResponseSchema,
40869
41176
  LeaseQueuedResponseSchema,
40870
41177
  LeaseDeniedResponseSchema,
@@ -40878,27 +41185,27 @@ var LeaseIpcResponseSchema = z13.discriminatedUnion("kind", [
40878
41185
  ResourceReleaseResultResponseSchema,
40879
41186
  LeaseErrorResponseSchema
40880
41187
  ]);
40881
- var LeaseIpcRequestEnvelopeSchema = z13.object({
41188
+ var LeaseIpcRequestEnvelopeSchema = z14.object({
40882
41189
  /** Parallel protocol version. */
40883
- protocol_version: z13.string(),
41190
+ protocol_version: z14.string(),
40884
41191
  /** Correlation id echoed back on the matching response. */
40885
- id: z13.string().min(1),
41192
+ id: z14.string().min(1),
40886
41193
  /** Direction discriminator. */
40887
- direction: z13.literal("request"),
41194
+ direction: z14.literal("request"),
40888
41195
  /** The request body. */
40889
41196
  request: LeaseIpcRequestSchema
40890
41197
  }).strict();
40891
- var LeaseIpcResponseEnvelopeSchema = z13.object({
41198
+ var LeaseIpcResponseEnvelopeSchema = z14.object({
40892
41199
  /** Parallel protocol version. */
40893
- protocol_version: z13.string(),
41200
+ protocol_version: z14.string(),
40894
41201
  /** Correlation id echoed from the originating request (or a fresh id for events). */
40895
- id: z13.string().min(1),
41202
+ id: z14.string().min(1),
40896
41203
  /** Direction discriminator. */
40897
- direction: z13.literal("response"),
41204
+ direction: z14.literal("response"),
40898
41205
  /** The response body. */
40899
41206
  response: LeaseIpcResponseSchema
40900
41207
  }).strict();
40901
- var LeaseIpcEnvelopeSchema = z13.discriminatedUnion("direction", [
41208
+ var LeaseIpcEnvelopeSchema = z14.discriminatedUnion("direction", [
40902
41209
  LeaseIpcRequestEnvelopeSchema,
40903
41210
  LeaseIpcResponseEnvelopeSchema
40904
41211
  ]);
@@ -40933,7 +41240,7 @@ var LEASE_IPC_MESSAGE_KINDS = [
40933
41240
  ];
40934
41241
 
40935
41242
  // packages/contracts/src/llm/catalog-schema.ts
40936
- import { z as z14 } from "zod";
41243
+ import { z as z15 } from "zod";
40937
41244
  var CATALOG_MODEL_STATUSES = [
40938
41245
  "stable",
40939
41246
  "beta",
@@ -40942,78 +41249,78 @@ var CATALOG_MODEL_STATUSES = [
40942
41249
  "retired"
40943
41250
  ];
40944
41251
  var CATALOG_AUTH_TYPES = ["api_key", "oauth", "bedrock", "vertex"];
40945
- var isoDate = z14.string().regex(/^\d{4}-\d{2}-\d{2}$/, "must be an ISO date (YYYY-MM-DD)");
40946
- var semver = z14.string().regex(/^\d+\.\d+\.\d+$/, "must be semver (MAJOR.MINOR.PATCH)");
40947
- var catalogModalitiesSchema = z14.object({
40948
- input: z14.array(z14.string()),
40949
- output: z14.array(z14.string())
41252
+ var isoDate = z15.string().regex(/^\d{4}-\d{2}-\d{2}$/, "must be an ISO date (YYYY-MM-DD)");
41253
+ var semver = z15.string().regex(/^\d+\.\d+\.\d+$/, "must be semver (MAJOR.MINOR.PATCH)");
41254
+ var catalogModalitiesSchema = z15.object({
41255
+ input: z15.array(z15.string()),
41256
+ output: z15.array(z15.string())
40950
41257
  }).strict();
40951
- var catalogCostSchema = z14.object({
40952
- input: z14.number().optional(),
40953
- output: z14.number().optional(),
40954
- cache_read: z14.number().optional(),
40955
- cache_write: z14.number().optional(),
40956
- context_over_200k: z14.number().optional()
41258
+ var catalogCostSchema = z15.object({
41259
+ input: z15.number().optional(),
41260
+ output: z15.number().optional(),
41261
+ cache_read: z15.number().optional(),
41262
+ cache_write: z15.number().optional(),
41263
+ context_over_200k: z15.number().optional()
40957
41264
  }).strict();
40958
- var catalogLimitSchema = z14.object({
40959
- context: z14.number(),
40960
- output: z14.number()
41265
+ var catalogLimitSchema = z15.object({
41266
+ context: z15.number(),
41267
+ output: z15.number()
40961
41268
  }).strict();
40962
- var catalogModelProviderSchema = z14.object({
40963
- npm: z14.string(),
40964
- api: z14.string()
41269
+ var catalogModelProviderSchema = z15.object({
41270
+ npm: z15.string(),
41271
+ api: z15.string()
40965
41272
  }).strict();
40966
- var catalogModelEntrySchema = z14.object({
40967
- id: z14.string(),
40968
- name: z14.string(),
40969
- family: z14.string(),
40970
- attachment: z14.boolean(),
40971
- reasoning: z14.boolean(),
40972
- temperature: z14.boolean(),
40973
- interleaved: z14.boolean(),
40974
- tool_call: z14.boolean(),
41273
+ var catalogModelEntrySchema = z15.object({
41274
+ id: z15.string(),
41275
+ name: z15.string(),
41276
+ family: z15.string(),
41277
+ attachment: z15.boolean(),
41278
+ reasoning: z15.boolean(),
41279
+ temperature: z15.boolean(),
41280
+ interleaved: z15.boolean(),
41281
+ tool_call: z15.boolean(),
40975
41282
  modalities: catalogModalitiesSchema,
40976
41283
  cost: catalogCostSchema,
40977
41284
  limit: catalogLimitSchema,
40978
- status: z14.enum(CATALOG_MODEL_STATUSES),
41285
+ status: z15.enum(CATALOG_MODEL_STATUSES),
40979
41286
  release_date: isoDate,
40980
41287
  provider: catalogModelProviderSchema
40981
41288
  }).strict();
40982
- var catalogProviderSchema = z14.object({
40983
- id: z14.string(),
40984
- endpoint: z14.string(),
40985
- authTypes: z14.array(z14.enum(CATALOG_AUTH_TYPES)).min(1),
40986
- npm: z14.string().optional()
41289
+ var catalogProviderSchema = z15.object({
41290
+ id: z15.string(),
41291
+ endpoint: z15.string(),
41292
+ authTypes: z15.array(z15.enum(CATALOG_AUTH_TYPES)).min(1),
41293
+ npm: z15.string().optional()
40987
41294
  }).strict();
40988
- var curatedCatalogSchema = z14.object({
40989
- $schema: z14.string().optional(),
41295
+ var curatedCatalogSchema = z15.object({
41296
+ $schema: z15.string().optional(),
40990
41297
  version: semver,
40991
41298
  lastUpdated: isoDate,
40992
- providers: z14.record(z14.string(), catalogProviderSchema),
40993
- models: z14.record(z14.string(), z14.record(z14.string(), catalogModelEntrySchema))
41299
+ providers: z15.record(z15.string(), catalogProviderSchema),
41300
+ models: z15.record(z15.string(), z15.record(z15.string(), catalogModelEntrySchema))
40994
41301
  }).strict();
40995
- var modelsCatalogRowInsertSchema = z14.object({
40996
- id: z14.string(),
40997
- providerId: z14.string(),
40998
- name: z14.string(),
40999
- family: z14.string(),
41000
- attachment: z14.boolean(),
41001
- reasoning: z14.boolean(),
41002
- temperature: z14.boolean(),
41003
- interleaved: z14.boolean(),
41004
- toolCall: z14.boolean(),
41005
- modalities: z14.string(),
41006
- cost: z14.string(),
41007
- contextLimit: z14.number().nullable().optional(),
41008
- outputLimit: z14.number().nullable().optional(),
41009
- status: z14.enum(CATALOG_MODEL_STATUSES),
41302
+ var modelsCatalogRowInsertSchema = z15.object({
41303
+ id: z15.string(),
41304
+ providerId: z15.string(),
41305
+ name: z15.string(),
41306
+ family: z15.string(),
41307
+ attachment: z15.boolean(),
41308
+ reasoning: z15.boolean(),
41309
+ temperature: z15.boolean(),
41310
+ interleaved: z15.boolean(),
41311
+ toolCall: z15.boolean(),
41312
+ modalities: z15.string(),
41313
+ cost: z15.string(),
41314
+ contextLimit: z15.number().nullable().optional(),
41315
+ outputLimit: z15.number().nullable().optional(),
41316
+ status: z15.enum(CATALOG_MODEL_STATUSES),
41010
41317
  releaseDate: isoDate,
41011
- modelsDevId: z14.string(),
41012
- source: z14.string(),
41013
- seededAt: z14.string().optional()
41318
+ modelsDevId: z15.string(),
41319
+ source: z15.string(),
41320
+ seededAt: z15.string().optional()
41014
41321
  }).strict();
41015
41322
  var modelsCatalogRowSelectSchema = modelsCatalogRowInsertSchema.extend({
41016
- seededAt: z14.string()
41323
+ seededAt: z15.string()
41017
41324
  });
41018
41325
 
41019
41326
  // packages/contracts/src/llm/system-of-use.ts
@@ -41061,7 +41368,7 @@ var BUILTIN_SYSTEMS_OF_USE = [
41061
41368
  ];
41062
41369
 
41063
41370
  // packages/contracts/src/workgraph.ts
41064
- import { z as z15 } from "zod";
41371
+ import { z as z16 } from "zod";
41065
41372
 
41066
41373
  // packages/contracts/src/status-registry.ts
41067
41374
  var TASK_STATUSES = [
@@ -41076,10 +41383,10 @@ var TASK_STATUSES = [
41076
41383
 
41077
41384
  // packages/contracts/src/workgraph.ts
41078
41385
  var E_WORKGRAPH_PARENT_TYPE_MATRIX = "E_WORKGRAPH_PARENT_TYPE_MATRIX";
41079
- var taskTypeSchema = z15.enum(["saga", "epic", "task", "subtask"]);
41080
- var taskPrioritySchema = z15.enum(["critical", "high", "medium", "low"]);
41081
- var taskStatusSchema = z15.enum(TASK_STATUSES);
41082
- var verificationGateSchema = z15.enum([
41386
+ var taskTypeSchema = z16.enum(["saga", "epic", "task", "subtask"]);
41387
+ var taskPrioritySchema = z16.enum(["critical", "high", "medium", "low"]);
41388
+ var taskStatusSchema = z16.enum(TASK_STATUSES);
41389
+ var verificationGateSchema = z16.enum([
41083
41390
  "implemented",
41084
41391
  "testsPassed",
41085
41392
  "qaPassed",
@@ -41088,7 +41395,7 @@ var verificationGateSchema = z15.enum([
41088
41395
  "documented",
41089
41396
  "nexusImpact"
41090
41397
  ]);
41091
- var workGraphRelationKindSchema = z15.enum([
41398
+ var workGraphRelationKindSchema = z16.enum([
41092
41399
  "contains",
41093
41400
  "depends_on",
41094
41401
  "blocks",
@@ -41096,317 +41403,317 @@ var workGraphRelationKindSchema = z15.enum([
41096
41403
  "groups",
41097
41404
  "satisfies"
41098
41405
  ]);
41099
- var workGraphTraversalDirectionSchema = z15.enum([
41406
+ var workGraphTraversalDirectionSchema = z16.enum([
41100
41407
  "ancestors",
41101
41408
  "descendants",
41102
41409
  "upstream",
41103
41410
  "downstream"
41104
41411
  ]);
41105
- var workGraphEdgeDirectionSchema = z15.enum(["out", "in", "both"]);
41106
- var paginationParamsSchema = z15.object({
41107
- cursor: z15.string().min(1).optional(),
41108
- limit: z15.number().int().positive().max(500).optional()
41412
+ var workGraphEdgeDirectionSchema = z16.enum(["out", "in", "both"]);
41413
+ var paginationParamsSchema = z16.object({
41414
+ cursor: z16.string().min(1).optional(),
41415
+ limit: z16.number().int().positive().max(500).optional()
41109
41416
  });
41110
- var workGraphNodeSchema = z15.object({
41111
- id: z15.string().min(1),
41417
+ var workGraphNodeSchema = z16.object({
41418
+ id: z16.string().min(1),
41112
41419
  type: taskTypeSchema,
41113
- title: z15.string(),
41420
+ title: z16.string(),
41114
41421
  status: taskStatusSchema,
41115
41422
  priority: taskPrioritySchema,
41116
- parentId: z15.string().min(1).optional()
41423
+ parentId: z16.string().min(1).optional()
41117
41424
  });
41118
- var workGraphEdgeSchema = z15.object({
41119
- fromId: z15.string().min(1),
41120
- toId: z15.string().min(1),
41425
+ var workGraphEdgeSchema = z16.object({
41426
+ fromId: z16.string().min(1),
41427
+ toId: z16.string().min(1),
41121
41428
  kind: workGraphRelationKindSchema
41122
41429
  });
41123
- var workGraphHierarchyEdgeSchema = z15.object({
41124
- fromId: z15.string().min(1),
41125
- toId: z15.string().min(1),
41126
- kind: z15.literal("contains")
41430
+ var workGraphHierarchyEdgeSchema = z16.object({
41431
+ fromId: z16.string().min(1),
41432
+ toId: z16.string().min(1),
41433
+ kind: z16.literal("contains")
41127
41434
  }).strict();
41128
- var workGraphPageInfoSchema = z15.object({
41129
- nextCursor: z15.string().min(1).optional(),
41130
- hasMore: z15.boolean()
41131
- });
41132
- var workGraphRollupCountsSchema = z15.object({
41133
- total: z15.number().int().nonnegative(),
41134
- byStatus: z15.partialRecord(taskStatusSchema, z15.number().int().nonnegative()),
41135
- byType: z15.partialRecord(taskTypeSchema, z15.number().int().nonnegative())
41136
- });
41137
- var workGraphSubtreePercentagesSchema = z15.object({
41138
- done: z15.number().nonnegative(),
41139
- active: z15.number().nonnegative(),
41140
- blocked: z15.number().nonnegative(),
41141
- pending: z15.number().nonnegative(),
41142
- cancelled: z15.number().nonnegative()
41143
- });
41144
- var workGraphProjectionMismatchSchema = z15.object({
41145
- field: z15.string().min(1),
41146
- expected: z15.number().int().nonnegative(),
41147
- actual: z15.number().int().nonnegative()
41435
+ var workGraphPageInfoSchema = z16.object({
41436
+ nextCursor: z16.string().min(1).optional(),
41437
+ hasMore: z16.boolean()
41438
+ });
41439
+ var workGraphRollupCountsSchema = z16.object({
41440
+ total: z16.number().int().nonnegative(),
41441
+ byStatus: z16.partialRecord(taskStatusSchema, z16.number().int().nonnegative()),
41442
+ byType: z16.partialRecord(taskTypeSchema, z16.number().int().nonnegative())
41443
+ });
41444
+ var workGraphSubtreePercentagesSchema = z16.object({
41445
+ done: z16.number().nonnegative(),
41446
+ active: z16.number().nonnegative(),
41447
+ blocked: z16.number().nonnegative(),
41448
+ pending: z16.number().nonnegative(),
41449
+ cancelled: z16.number().nonnegative()
41450
+ });
41451
+ var workGraphProjectionMismatchSchema = z16.object({
41452
+ field: z16.string().min(1),
41453
+ expected: z16.number().int().nonnegative(),
41454
+ actual: z16.number().int().nonnegative()
41148
41455
  });
41149
41456
  var workGraphReadyFrontierTaskSchema = workGraphNodeSchema.extend({
41150
- role: z15.string().min(1).optional(),
41151
- dependencyBlockers: z15.array(z15.object({ taskId: z15.string().min(1), status: taskStatusSchema })),
41152
- gateBlockers: z15.array(z15.object({ gate: verificationGateSchema }))
41457
+ role: z16.string().min(1).optional(),
41458
+ dependencyBlockers: z16.array(z16.object({ taskId: z16.string().min(1), status: taskStatusSchema })),
41459
+ gateBlockers: z16.array(z16.object({ gate: verificationGateSchema }))
41153
41460
  });
41154
41461
  var workGraphRelationEdgeSchema = workGraphEdgeSchema.extend({
41155
- source: z15.literal("relation"),
41156
- relationType: z15.enum(TASK_RELATION_TYPES),
41157
- reason: z15.string().min(1).optional()
41462
+ source: z16.literal("relation"),
41463
+ relationType: z16.enum(TASK_RELATION_TYPES),
41464
+ reason: z16.string().min(1).optional()
41158
41465
  });
41159
41466
  var workGraphDependencyEdgeSchema = workGraphEdgeSchema.extend({
41160
- source: z15.literal("dependency"),
41161
- kind: z15.literal("depends_on")
41467
+ source: z16.literal("dependency"),
41468
+ kind: z16.literal("depends_on")
41162
41469
  });
41163
- var workGraphOmissionReasonSchema = z15.enum([
41470
+ var workGraphOmissionReasonSchema = z16.enum([
41164
41471
  "budget_exceeded",
41165
41472
  "not_requested",
41166
41473
  "not_available",
41167
41474
  "redacted",
41168
41475
  "truncated"
41169
41476
  ]);
41170
- var workGraphContextBudgetSchema = z15.object({
41171
- tokenBudget: z15.number().int().nonnegative(),
41172
- estimatedTokens: z15.number().int().nonnegative(),
41173
- remainingTokens: z15.number().int().nonnegative(),
41174
- truncated: z15.boolean()
41175
- });
41176
- var workGraphOmissionSchema = z15.object({
41177
- path: z15.string().min(1),
41477
+ var workGraphContextBudgetSchema = z16.object({
41478
+ tokenBudget: z16.number().int().nonnegative(),
41479
+ estimatedTokens: z16.number().int().nonnegative(),
41480
+ remainingTokens: z16.number().int().nonnegative(),
41481
+ truncated: z16.boolean()
41482
+ });
41483
+ var workGraphOmissionSchema = z16.object({
41484
+ path: z16.string().min(1),
41178
41485
  reason: workGraphOmissionReasonSchema,
41179
- message: z15.string().min(1),
41180
- estimatedTokens: z15.number().int().nonnegative().optional()
41486
+ message: z16.string().min(1),
41487
+ estimatedTokens: z16.number().int().nonnegative().optional()
41181
41488
  });
41182
- var workGraphDirectEdgeSchema = z15.discriminatedUnion("source", [
41489
+ var workGraphDirectEdgeSchema = z16.discriminatedUnion("source", [
41183
41490
  workGraphRelationEdgeSchema,
41184
41491
  workGraphDependencyEdgeSchema
41185
41492
  ]);
41186
41493
  var workGraphContextPackParamsSchema = paginationParamsSchema.extend({
41187
- rootId: z15.string().min(1),
41188
- tokenBudget: z15.number().int().positive().optional(),
41189
- includeRelations: z15.boolean().optional(),
41190
- includeReadiness: z15.boolean().optional(),
41191
- includeRollup: z15.boolean().optional()
41494
+ rootId: z16.string().min(1),
41495
+ tokenBudget: z16.number().int().positive().optional(),
41496
+ includeRelations: z16.boolean().optional(),
41497
+ includeReadiness: z16.boolean().optional(),
41498
+ includeRollup: z16.boolean().optional()
41192
41499
  });
41193
41500
  var workGraphSliceParamsSchema = paginationParamsSchema.extend({
41194
- rootId: z15.string().min(1),
41501
+ rootId: z16.string().min(1),
41195
41502
  direction: workGraphTraversalDirectionSchema.optional(),
41196
- maxDepth: z15.number().int().nonnegative().optional(),
41197
- includeRelations: z15.boolean().optional()
41503
+ maxDepth: z16.number().int().nonnegative().optional(),
41504
+ includeRelations: z16.boolean().optional()
41198
41505
  });
41199
- var workGraphSliceSchema = z15.object({
41200
- rootId: z15.string().min(1),
41506
+ var workGraphSliceSchema = z16.object({
41507
+ rootId: z16.string().min(1),
41201
41508
  direction: workGraphTraversalDirectionSchema,
41202
- nodes: z15.array(workGraphNodeSchema),
41203
- edges: z15.array(workGraphEdgeSchema),
41509
+ nodes: z16.array(workGraphNodeSchema),
41510
+ edges: z16.array(workGraphEdgeSchema),
41204
41511
  pageInfo: workGraphPageInfoSchema,
41205
- omissions: z15.array(workGraphOmissionSchema).optional()
41206
- });
41207
- var workGraphReadinessParamsSchema = z15.object({
41208
- rootId: z15.string().min(1),
41209
- role: z15.string().min(1).optional(),
41210
- includeGateBlockers: z15.boolean().optional()
41211
- });
41212
- var workGraphReadinessResultSchema = z15.object({
41213
- rootId: z15.string().min(1),
41214
- role: z15.string().min(1).optional(),
41215
- ready: z15.boolean(),
41216
- warnings: z15.array(z15.string()),
41217
- groups: z15.object({
41218
- ready: z15.array(workGraphReadyFrontierTaskSchema),
41219
- blocked: z15.array(workGraphReadyFrontierTaskSchema),
41220
- blockedBy: z15.array(
41221
- z15.discriminatedUnion("kind", [
41222
- z15.object({
41223
- kind: z15.literal("dependency"),
41224
- blockerId: z15.string().min(1),
41225
- blocks: z15.array(z15.string().min(1))
41512
+ omissions: z16.array(workGraphOmissionSchema).optional()
41513
+ });
41514
+ var workGraphReadinessParamsSchema = z16.object({
41515
+ rootId: z16.string().min(1),
41516
+ role: z16.string().min(1).optional(),
41517
+ includeGateBlockers: z16.boolean().optional()
41518
+ });
41519
+ var workGraphReadinessResultSchema = z16.object({
41520
+ rootId: z16.string().min(1),
41521
+ role: z16.string().min(1).optional(),
41522
+ ready: z16.boolean(),
41523
+ warnings: z16.array(z16.string()),
41524
+ groups: z16.object({
41525
+ ready: z16.array(workGraphReadyFrontierTaskSchema),
41526
+ blocked: z16.array(workGraphReadyFrontierTaskSchema),
41527
+ blockedBy: z16.array(
41528
+ z16.discriminatedUnion("kind", [
41529
+ z16.object({
41530
+ kind: z16.literal("dependency"),
41531
+ blockerId: z16.string().min(1),
41532
+ blocks: z16.array(z16.string().min(1))
41226
41533
  }),
41227
- z15.object({
41228
- kind: z15.literal("gate"),
41534
+ z16.object({
41535
+ kind: z16.literal("gate"),
41229
41536
  gate: verificationGateSchema,
41230
- blocks: z15.array(z15.string().min(1))
41537
+ blocks: z16.array(z16.string().min(1))
41231
41538
  })
41232
41539
  ])
41233
41540
  )
41234
41541
  })
41235
41542
  });
41236
- var workGraphContextPackSchema = z15.object({
41237
- rootId: z15.string().min(1),
41238
- generatedAt: z15.string().min(1),
41543
+ var workGraphContextPackSchema = z16.object({
41544
+ rootId: z16.string().min(1),
41545
+ generatedAt: z16.string().min(1),
41239
41546
  budget: workGraphContextBudgetSchema,
41240
41547
  slice: workGraphSliceSchema,
41241
- relationEdges: z15.object({
41242
- rootId: z15.string().min(1),
41548
+ relationEdges: z16.object({
41549
+ rootId: z16.string().min(1),
41243
41550
  direction: workGraphEdgeDirectionSchema,
41244
- edges: z15.array(workGraphDirectEdgeSchema)
41551
+ edges: z16.array(workGraphDirectEdgeSchema)
41245
41552
  }).optional(),
41246
41553
  readiness: workGraphReadinessResultSchema.optional(),
41247
- rollup: z15.lazy(() => tasksRollupResultSchema).optional(),
41248
- omissions: z15.array(workGraphOmissionSchema)
41249
- });
41250
- var workGraphScaffoldValidateParamsSchema = z15.object({
41251
- rootId: z15.string().min(1),
41252
- nodes: z15.array(
41253
- z15.object({
41254
- id: z15.string().min(1),
41554
+ rollup: z16.lazy(() => tasksRollupResultSchema).optional(),
41555
+ omissions: z16.array(workGraphOmissionSchema)
41556
+ });
41557
+ var workGraphScaffoldValidateParamsSchema = z16.object({
41558
+ rootId: z16.string().min(1),
41559
+ nodes: z16.array(
41560
+ z16.object({
41561
+ id: z16.string().min(1),
41255
41562
  type: taskTypeSchema,
41256
- parentId: z15.string().min(1).nullable().optional()
41563
+ parentId: z16.string().min(1).nullable().optional()
41257
41564
  })
41258
41565
  ),
41259
- edges: z15.array(workGraphDirectEdgeSchema).optional(),
41260
- dryRun: z15.boolean().optional()
41261
- });
41262
- var workGraphScaffoldValidationIssueSchema = z15.object({
41263
- code: z15.string().min(1),
41264
- message: z15.string().min(1),
41265
- taskId: z15.string().min(1).optional(),
41266
- severity: z15.enum(["error", "warning"])
41267
- });
41268
- var workGraphScaffoldValidateResultSchema = z15.object({
41269
- rootId: z15.string().min(1),
41270
- valid: z15.boolean(),
41271
- dryRun: z15.boolean(),
41272
- issues: z15.array(workGraphScaffoldValidationIssueSchema),
41273
- hierarchy: z15.object({
41274
- valid: z15.boolean(),
41275
- violations: z15.array(
41276
- z15.object({
41277
- code: z15.literal(E_WORKGRAPH_PARENT_TYPE_MATRIX),
41278
- taskId: z15.string().min(1),
41566
+ edges: z16.array(workGraphDirectEdgeSchema).optional(),
41567
+ dryRun: z16.boolean().optional()
41568
+ });
41569
+ var workGraphScaffoldValidationIssueSchema = z16.object({
41570
+ code: z16.string().min(1),
41571
+ message: z16.string().min(1),
41572
+ taskId: z16.string().min(1).optional(),
41573
+ severity: z16.enum(["error", "warning"])
41574
+ });
41575
+ var workGraphScaffoldValidateResultSchema = z16.object({
41576
+ rootId: z16.string().min(1),
41577
+ valid: z16.boolean(),
41578
+ dryRun: z16.boolean(),
41579
+ issues: z16.array(workGraphScaffoldValidationIssueSchema),
41580
+ hierarchy: z16.object({
41581
+ valid: z16.boolean(),
41582
+ violations: z16.array(
41583
+ z16.object({
41584
+ code: z16.literal(E_WORKGRAPH_PARENT_TYPE_MATRIX),
41585
+ taskId: z16.string().min(1),
41279
41586
  taskType: taskTypeSchema,
41280
- parentId: z15.string().min(1).nullable(),
41587
+ parentId: z16.string().min(1).nullable(),
41281
41588
  parentType: taskTypeSchema.optional(),
41282
- message: z15.string().min(1)
41589
+ message: z16.string().min(1)
41283
41590
  })
41284
41591
  )
41285
41592
  })
41286
41593
  });
41287
41594
  var workGraphScaffoldApplyParamsSchema = workGraphScaffoldValidateParamsSchema.extend({
41288
- apply: z15.boolean().optional()
41595
+ apply: z16.boolean().optional()
41289
41596
  });
41290
41597
  var workGraphScaffoldApplyResultSchema = workGraphScaffoldValidateResultSchema.extend({
41291
- applied: z15.boolean(),
41292
- nodesChanged: z15.number().int().nonnegative(),
41293
- edgesChanged: z15.number().int().nonnegative()
41294
- });
41295
- var workGraphPlanningDocParamsSchema = z15.object({
41296
- rootId: z15.string().min(1),
41297
- audience: z15.enum(["agent", "maintainer"]),
41298
- tokenBudget: z15.number().int().positive().optional(),
41299
- includeRelations: z15.boolean().optional(),
41300
- includeReadiness: z15.boolean().optional(),
41301
- includeRollup: z15.boolean().optional()
41302
- });
41303
- var workGraphPlanningDocSchema = z15.object({
41304
- rootId: z15.string().min(1),
41305
- generatedAt: z15.string().min(1),
41306
- audience: z15.enum(["agent", "maintainer"]),
41307
- title: z15.string().min(1),
41308
- content: z15.string(),
41309
- sections: z15.array(z15.string().min(1)),
41310
- estimatedTokens: z15.number().int().nonnegative(),
41311
- budget: z15.object({
41312
- tokenBudget: z15.number().int().positive(),
41313
- truncated: z15.boolean()
41598
+ applied: z16.boolean(),
41599
+ nodesChanged: z16.number().int().nonnegative(),
41600
+ edgesChanged: z16.number().int().nonnegative()
41601
+ });
41602
+ var workGraphPlanningDocParamsSchema = z16.object({
41603
+ rootId: z16.string().min(1),
41604
+ audience: z16.enum(["agent", "maintainer"]),
41605
+ tokenBudget: z16.number().int().positive().optional(),
41606
+ includeRelations: z16.boolean().optional(),
41607
+ includeReadiness: z16.boolean().optional(),
41608
+ includeRollup: z16.boolean().optional()
41609
+ });
41610
+ var workGraphPlanningDocSchema = z16.object({
41611
+ rootId: z16.string().min(1),
41612
+ generatedAt: z16.string().min(1),
41613
+ audience: z16.enum(["agent", "maintainer"]),
41614
+ title: z16.string().min(1),
41615
+ content: z16.string(),
41616
+ sections: z16.array(z16.string().min(1)),
41617
+ estimatedTokens: z16.number().int().nonnegative(),
41618
+ budget: z16.object({
41619
+ tokenBudget: z16.number().int().positive(),
41620
+ truncated: z16.boolean()
41314
41621
  }).optional()
41315
41622
  });
41316
41623
  var tasksTraverseParamsSchema = paginationParamsSchema.extend({
41317
- rootId: z15.string().min(1),
41624
+ rootId: z16.string().min(1),
41318
41625
  direction: workGraphTraversalDirectionSchema,
41319
- maxDepth: z15.number().int().nonnegative().optional(),
41320
- includeRelations: z15.boolean().optional()
41626
+ maxDepth: z16.number().int().nonnegative().optional(),
41627
+ includeRelations: z16.boolean().optional()
41321
41628
  });
41322
- var tasksTraverseResultSchema = z15.object({
41323
- rootId: z15.string().min(1),
41629
+ var tasksTraverseResultSchema = z16.object({
41630
+ rootId: z16.string().min(1),
41324
41631
  direction: workGraphTraversalDirectionSchema,
41325
- nodes: z15.array(workGraphNodeSchema),
41326
- edges: z15.array(workGraphEdgeSchema),
41632
+ nodes: z16.array(workGraphNodeSchema),
41633
+ edges: z16.array(workGraphEdgeSchema),
41327
41634
  pageInfo: workGraphPageInfoSchema
41328
41635
  });
41329
41636
  var tasksTreeParamsSchema = paginationParamsSchema.extend({
41330
- rootId: z15.string().min(1),
41331
- maxDepth: z15.number().int().nonnegative().optional()
41637
+ rootId: z16.string().min(1),
41638
+ maxDepth: z16.number().int().nonnegative().optional()
41332
41639
  });
41333
- var tasksTreeResultSchema = z15.object({
41334
- rootId: z15.string().min(1),
41335
- nodes: z15.array(workGraphNodeSchema.extend({ depth: z15.number().int().positive() })),
41336
- edges: z15.array(workGraphHierarchyEdgeSchema),
41640
+ var tasksTreeResultSchema = z16.object({
41641
+ rootId: z16.string().min(1),
41642
+ nodes: z16.array(workGraphNodeSchema.extend({ depth: z16.number().int().positive() })),
41643
+ edges: z16.array(workGraphHierarchyEdgeSchema),
41337
41644
  pageInfo: workGraphPageInfoSchema
41338
41645
  });
41339
- var tasksRollupParamsSchema = z15.object({
41340
- rootId: z15.string().min(1),
41646
+ var tasksRollupParamsSchema = z16.object({
41647
+ rootId: z16.string().min(1),
41341
41648
  expectedDirectRollup: workGraphRollupCountsSchema.optional()
41342
41649
  });
41343
- var tasksRollupResultSchema = z15.object({
41344
- rootId: z15.string().min(1),
41650
+ var tasksRollupResultSchema = z16.object({
41651
+ rootId: z16.string().min(1),
41345
41652
  direct: workGraphRollupCountsSchema,
41346
41653
  subtree: workGraphRollupCountsSchema,
41347
- percentDenominator: z15.object({
41348
- basis: z15.literal("subtree-total"),
41349
- total: z15.number().int().nonnegative(),
41350
- description: z15.string().min(1)
41654
+ percentDenominator: z16.object({
41655
+ basis: z16.literal("subtree-total"),
41656
+ total: z16.number().int().nonnegative(),
41657
+ description: z16.string().min(1)
41351
41658
  }),
41352
41659
  percentages: workGraphSubtreePercentagesSchema,
41353
- staleProjection: z15.boolean(),
41354
- projectionMismatches: z15.array(workGraphProjectionMismatchSchema)
41355
- });
41356
- var tasksFrontierParamsSchema = z15.object({
41357
- rootId: z15.string().min(1),
41358
- role: z15.string().min(1).optional()
41359
- });
41360
- var tasksFrontierResultSchema = z15.object({
41361
- rootId: z15.string().min(1),
41362
- role: z15.string().min(1).optional(),
41363
- groups: z15.object({
41364
- ready: z15.array(workGraphReadyFrontierTaskSchema),
41365
- blocked: z15.array(workGraphReadyFrontierTaskSchema),
41366
- blockedBy: z15.array(
41367
- z15.discriminatedUnion("kind", [
41368
- z15.object({
41369
- kind: z15.literal("dependency"),
41370
- blockerId: z15.string().min(1),
41371
- blocks: z15.array(z15.string().min(1))
41660
+ staleProjection: z16.boolean(),
41661
+ projectionMismatches: z16.array(workGraphProjectionMismatchSchema)
41662
+ });
41663
+ var tasksFrontierParamsSchema = z16.object({
41664
+ rootId: z16.string().min(1),
41665
+ role: z16.string().min(1).optional()
41666
+ });
41667
+ var tasksFrontierResultSchema = z16.object({
41668
+ rootId: z16.string().min(1),
41669
+ role: z16.string().min(1).optional(),
41670
+ groups: z16.object({
41671
+ ready: z16.array(workGraphReadyFrontierTaskSchema),
41672
+ blocked: z16.array(workGraphReadyFrontierTaskSchema),
41673
+ blockedBy: z16.array(
41674
+ z16.discriminatedUnion("kind", [
41675
+ z16.object({
41676
+ kind: z16.literal("dependency"),
41677
+ blockerId: z16.string().min(1),
41678
+ blocks: z16.array(z16.string().min(1))
41372
41679
  }),
41373
- z15.object({
41374
- kind: z15.literal("gate"),
41680
+ z16.object({
41681
+ kind: z16.literal("gate"),
41375
41682
  gate: verificationGateSchema,
41376
- blocks: z15.array(z15.string().min(1))
41683
+ blocks: z16.array(z16.string().min(1))
41377
41684
  })
41378
41685
  ])
41379
41686
  )
41380
41687
  })
41381
41688
  });
41382
41689
  var tasksWorkGraphAuditParamsSchema = paginationParamsSchema.extend({
41383
- rootId: z15.string().min(1),
41384
- maxDepth: z15.number().int().nonnegative().optional(),
41385
- includeRelations: z15.boolean().optional()
41386
- });
41387
- var tasksWorkGraphAuditResultSchema = z15.object({
41388
- rootId: z15.string().min(1),
41389
- hierarchy: z15.object({
41390
- valid: z15.boolean(),
41391
- violations: z15.array(
41392
- z15.object({
41393
- code: z15.literal(E_WORKGRAPH_PARENT_TYPE_MATRIX),
41394
- taskId: z15.string().min(1),
41690
+ rootId: z16.string().min(1),
41691
+ maxDepth: z16.number().int().nonnegative().optional(),
41692
+ includeRelations: z16.boolean().optional()
41693
+ });
41694
+ var tasksWorkGraphAuditResultSchema = z16.object({
41695
+ rootId: z16.string().min(1),
41696
+ hierarchy: z16.object({
41697
+ valid: z16.boolean(),
41698
+ violations: z16.array(
41699
+ z16.object({
41700
+ code: z16.literal(E_WORKGRAPH_PARENT_TYPE_MATRIX),
41701
+ taskId: z16.string().min(1),
41395
41702
  taskType: taskTypeSchema,
41396
- parentId: z15.string().min(1).nullable(),
41703
+ parentId: z16.string().min(1).nullable(),
41397
41704
  parentType: taskTypeSchema.optional(),
41398
- message: z15.string().min(1)
41705
+ message: z16.string().min(1)
41399
41706
  })
41400
41707
  )
41401
41708
  }),
41402
41709
  traversal: tasksTraverseResultSchema,
41403
41710
  frontier: tasksFrontierResultSchema,
41404
41711
  rollup: tasksRollupResultSchema,
41405
- relationEdges: z15.object({
41406
- rootId: z15.string().min(1),
41712
+ relationEdges: z16.object({
41713
+ rootId: z16.string().min(1),
41407
41714
  direction: workGraphEdgeDirectionSchema,
41408
- edges: z15.array(
41409
- z15.discriminatedUnion("source", [
41715
+ edges: z16.array(
41716
+ z16.discriminatedUnion("source", [
41410
41717
  workGraphRelationEdgeSchema,
41411
41718
  workGraphDependencyEdgeSchema
41412
41719
  ])
@@ -41415,60 +41722,60 @@ var tasksWorkGraphAuditResultSchema = z15.object({
41415
41722
  });
41416
41723
 
41417
41724
  // packages/contracts/src/operations/docs.ts
41418
- import { z as z16 } from "zod";
41419
- var DOCS_PROJECTION_PROPOSAL_SCHEMA = z16.object({
41420
- version: z16.literal(1),
41421
- operation: z16.literal("docs.projection"),
41422
- identity: z16.object({
41423
- projectId: z16.string().min(1),
41424
- projectRoot: z16.string().min(1),
41425
- actor: z16.string().min(1),
41426
- operation: z16.literal("docs.projection"),
41427
- idempotencyKey: z16.string().min(1)
41725
+ import { z as z17 } from "zod";
41726
+ var DOCS_PROJECTION_PROPOSAL_SCHEMA = z17.object({
41727
+ version: z17.literal(1),
41728
+ operation: z17.literal("docs.projection"),
41729
+ identity: z17.object({
41730
+ projectId: z17.string().min(1),
41731
+ projectRoot: z17.string().min(1),
41732
+ actor: z17.string().min(1),
41733
+ operation: z17.literal("docs.projection"),
41734
+ idempotencyKey: z17.string().min(1)
41428
41735
  }).strict(),
41429
- source: z16.object({
41430
- attachmentId: z16.string().min(1),
41431
- sha256: z16.string().regex(/^[a-f0-9]{64}$/),
41432
- ownerId: z16.string().min(1),
41433
- ownerType: z16.enum(["task", "session", "observation", "decision", "learning", "pattern"]),
41434
- label: z16.string().min(1)
41736
+ source: z17.object({
41737
+ attachmentId: z17.string().min(1),
41738
+ sha256: z17.string().regex(/^[a-f0-9]{64}$/),
41739
+ ownerId: z17.string().min(1),
41740
+ ownerType: z17.enum(["task", "session", "observation", "decision", "learning", "pattern"]),
41741
+ label: z17.string().min(1)
41435
41742
  }).strict(),
41436
- observation: z16.object({
41437
- kind: z16.literal("doc-attachment"),
41438
- attachmentId: z16.string().min(1),
41439
- ownerId: z16.string().min(1),
41440
- addedAt: z16.string().min(1),
41441
- slug: z16.string().optional(),
41442
- type: z16.string().optional()
41743
+ observation: z17.object({
41744
+ kind: z17.literal("doc-attachment"),
41745
+ attachmentId: z17.string().min(1),
41746
+ ownerId: z17.string().min(1),
41747
+ addedAt: z17.string().min(1),
41748
+ slug: z17.string().optional(),
41749
+ type: z17.string().optional()
41443
41750
  }).strict()
41444
41751
  }).strict();
41445
- var DOCS_PROJECTION_RECEIPT_SCHEMA = z16.object({
41446
- version: z16.literal(1),
41447
- sourceHash: z16.string().regex(/^[a-f0-9]{64}$/),
41448
- graph: z16.enum(["completed", "disabled"]),
41752
+ var DOCS_PROJECTION_RECEIPT_SCHEMA = z17.object({
41753
+ version: z17.literal(1),
41754
+ sourceHash: z17.string().regex(/^[a-f0-9]{64}$/),
41755
+ graph: z17.enum(["completed", "disabled"]),
41449
41756
  /** Legacy receipts (before T13985): the "Doc attached" observation the projection wrote. */
41450
- observationId: z16.string().min(1).optional(),
41757
+ observationId: z17.string().min(1).optional(),
41451
41758
  /** T13985 (D11180): the canonical `llmtxt --documents--> owner` edge was written. */
41452
- documents: z16.literal(true).optional(),
41453
- verifiedAt: z16.string().min(1),
41454
- actor: z16.string().min(1)
41759
+ documents: z17.literal(true).optional(),
41760
+ verifiedAt: z17.string().min(1),
41761
+ actor: z17.string().min(1)
41455
41762
  }).strict().refine((receipt) => receipt.observationId !== void 0 || receipt.documents === true, {
41456
41763
  message: "A projection receipt records its documents edge or, for legacy jobs, its observation"
41457
41764
  });
41458
41765
 
41459
41766
  // packages/contracts/src/operations/ensures-schema-registry.ts
41460
- import { z as z17 } from "zod";
41461
- var taskTreeEntrySchema = z17.object({
41462
- 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" }),
41463
- 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), {
41767
+ import { z as z18 } from "zod";
41768
+ var taskTreeEntrySchema = z18.object({
41769
+ 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" }),
41770
+ 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), {
41464
41771
  message: "acceptance array contains no non-empty strings"
41465
41772
  }),
41466
- id: z17.string().optional(),
41467
- parentId: z17.string().optional(),
41468
- depends: z17.array(z17.string()).optional()
41773
+ id: z18.string().optional(),
41774
+ parentId: z18.string().optional(),
41775
+ depends: z18.array(z18.string()).optional()
41469
41776
  });
41470
- 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" });
41471
- var evidenceSchema = z17.unknown().superRefine((value, ctx) => {
41777
+ 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" });
41778
+ var evidenceSchema = z18.unknown().superRefine((value, ctx) => {
41472
41779
  if (value === null || value === void 0) {
41473
41780
  ctx.addIssue({
41474
41781
  code: "custom",
@@ -41502,7 +41809,7 @@ var evidenceSchema = z17.unknown().superRefine((value, ctx) => {
41502
41809
  message: `evidence must be a string, array, or object (got ${typeof value})`
41503
41810
  });
41504
41811
  });
41505
- var passthroughSchema = z17.unknown();
41812
+ var passthroughSchema = z18.unknown();
41506
41813
  var LEGACY_PASSTHROUGH_SCHEMA_NAMES = [
41507
41814
  // release.cantbook
41508
41815
  "version_bump_report",
@@ -41535,44 +41842,44 @@ var LEAD_RUNNER_TOOL_NAME = "cleo_run";
41535
41842
  var LEAD_RUNNER_TOOL = `mcp__${LEAD_RUNNER_MCP_SERVER}__${LEAD_RUNNER_TOOL_NAME}`;
41536
41843
 
41537
41844
  // packages/contracts/src/release/evidence-atoms.ts
41538
- import { z as z18 } from "zod";
41539
- var parsedPrEvidenceAtomSchema = z18.object({
41540
- kind: z18.literal("pr"),
41541
- prNumber: z18.number().int().positive()
41542
- });
41543
- var prEvidenceStateModifierSchema = z18.object({
41544
- kind: z18.literal("state"),
41545
- value: z18.literal("MERGED")
41546
- });
41547
- var ghPrViewSchema = z18.object({
41548
- state: z18.enum(["OPEN", "CLOSED", "MERGED"]),
41549
- mergedAt: z18.string().nullable(),
41550
- headRefOid: z18.string().optional(),
41551
- mergeCommit: z18.object({ oid: z18.string() }).nullable().optional(),
41552
- title: z18.string().optional(),
41553
- body: z18.string().optional(),
41554
- headRefName: z18.string().optional(),
41555
- files: z18.array(z18.object({ path: z18.string() })).optional(),
41556
- changedFiles: z18.number().int().nonnegative().optional(),
41557
- mergeable: z18.string().optional(),
41558
- statusCheckRollup: z18.array(
41559
- z18.object({
41560
- __typename: z18.string().optional(),
41561
- name: z18.string().optional(),
41562
- workflowName: z18.string().optional(),
41563
- conclusion: z18.string().nullable().optional(),
41564
- status: z18.string().optional(),
41845
+ import { z as z19 } from "zod";
41846
+ var parsedPrEvidenceAtomSchema = z19.object({
41847
+ kind: z19.literal("pr"),
41848
+ prNumber: z19.number().int().positive()
41849
+ });
41850
+ var prEvidenceStateModifierSchema = z19.object({
41851
+ kind: z19.literal("state"),
41852
+ value: z19.literal("MERGED")
41853
+ });
41854
+ var ghPrViewSchema = z19.object({
41855
+ state: z19.enum(["OPEN", "CLOSED", "MERGED"]),
41856
+ mergedAt: z19.string().nullable(),
41857
+ headRefOid: z19.string().optional(),
41858
+ mergeCommit: z19.object({ oid: z19.string() }).nullable().optional(),
41859
+ title: z19.string().optional(),
41860
+ body: z19.string().optional(),
41861
+ headRefName: z19.string().optional(),
41862
+ files: z19.array(z19.object({ path: z19.string() })).optional(),
41863
+ changedFiles: z19.number().int().nonnegative().optional(),
41864
+ mergeable: z19.string().optional(),
41865
+ statusCheckRollup: z19.array(
41866
+ z19.object({
41867
+ __typename: z19.string().optional(),
41868
+ name: z19.string().optional(),
41869
+ workflowName: z19.string().optional(),
41870
+ conclusion: z19.string().nullable().optional(),
41871
+ status: z19.string().optional(),
41565
41872
  /** ISO start time of a CheckRun; orders re-runs of one check (T13506). */
41566
- startedAt: z18.string().nullable().optional(),
41873
+ startedAt: z19.string().nullable().optional(),
41567
41874
  /** ISO completion time of a CheckRun; orders re-runs of one check (T13506). */
41568
- completedAt: z18.string().nullable().optional()
41875
+ completedAt: z19.string().nullable().optional()
41569
41876
  }).passthrough()
41570
41877
  ).optional().default([])
41571
41878
  }).passthrough();
41572
41879
  var PR_REQUIRED_WORKFLOWS = Object.freeze(["CI", "Contracts Dep Lint"]);
41573
41880
 
41574
41881
  // packages/contracts/src/release/plan.ts
41575
- import { z as z19 } from "zod";
41882
+ import { z as z20 } from "zod";
41576
41883
  var RELEASE_CHANNEL = ["latest", "beta", "alpha", "rc", "canary"];
41577
41884
  var RELEASE_SCHEME = ["calver", "semver", "calver-suffix"];
41578
41885
  var RELEASE_KIND = ["regular", "hotfix", "prerelease"];
@@ -41616,20 +41923,20 @@ var RESOLVED_SOURCE = [
41616
41923
  "language-default",
41617
41924
  "legacy-alias"
41618
41925
  ];
41619
- var ReleaseChannelSchema = z19.enum(RELEASE_CHANNEL);
41620
- var ReleaseSchemeSchema = z19.enum(RELEASE_SCHEME);
41621
- var ReleaseKindSchema = z19.enum(RELEASE_KIND);
41622
- var ReleaseStatusSchema = z19.enum(RELEASE_STATUS);
41623
- var GateStatusSchema = z19.enum(GATE_STATUS);
41624
- var GateNameSchema = z19.enum(GATE_NAME);
41625
- var PlatformTupleSchema = z19.enum(PLATFORM_TUPLE);
41626
- var PublisherSchema = z19.enum(PUBLISHER);
41627
- var TaskKindSchema = z19.enum(TASK_KIND);
41628
- var ImpactSchema = z19.enum(IMPACT);
41629
- var ResolvedSourceSchema = z19.enum(RESOLVED_SOURCE);
41630
- var Iso8601 = z19.iso.datetime({ offset: true });
41631
- var NonEmptyString = z19.string().min(1);
41632
- var ReleasePlanTaskSchema = z19.object({
41926
+ var ReleaseChannelSchema = z20.enum(RELEASE_CHANNEL);
41927
+ var ReleaseSchemeSchema = z20.enum(RELEASE_SCHEME);
41928
+ var ReleaseKindSchema = z20.enum(RELEASE_KIND);
41929
+ var ReleaseStatusSchema = z20.enum(RELEASE_STATUS);
41930
+ var GateStatusSchema = z20.enum(GATE_STATUS);
41931
+ var GateNameSchema = z20.enum(GATE_NAME);
41932
+ var PlatformTupleSchema = z20.enum(PLATFORM_TUPLE);
41933
+ var PublisherSchema = z20.enum(PUBLISHER);
41934
+ var TaskKindSchema = z20.enum(TASK_KIND);
41935
+ var ImpactSchema = z20.enum(IMPACT);
41936
+ var ResolvedSourceSchema = z20.enum(RESOLVED_SOURCE);
41937
+ var Iso8601 = z20.iso.datetime({ offset: true });
41938
+ var NonEmptyString = z20.string().min(1);
41939
+ var ReleasePlanTaskSchema = z20.object({
41633
41940
  /** Task ID (e.g. "T10001"). Format intentionally loose so historical IDs validate. */
41634
41941
  id: NonEmptyString,
41635
41942
  /** Conventional-commit-aligned task classification. */
@@ -41637,20 +41944,20 @@ var ReleasePlanTaskSchema = z19.object({
41637
41944
  /** SemVer impact classification. */
41638
41945
  impact: ImpactSchema,
41639
41946
  /** Human-readable changelog line for this task. */
41640
- userFacingSummary: z19.string(),
41947
+ userFacingSummary: z20.string(),
41641
41948
  /**
41642
41949
  * ADR-051 evidence atoms attesting the task's gate results. Format is
41643
41950
  * `kind:value` (e.g. `commit:abc123`, `test-run:vitest.json`). The contract
41644
41951
  * accepts empty arrays so legacy plans validate; `cleo release plan`
41645
41952
  * enforces non-empty via R-301.
41646
41953
  */
41647
- evidenceAtoms: z19.array(NonEmptyString),
41954
+ evidenceAtoms: z20.array(NonEmptyString),
41648
41955
  /** IVTR phase at plan time — informational only per R-316. */
41649
- ivtrPhaseAtPlan: z19.string().optional(),
41956
+ ivtrPhaseAtPlan: z20.string().optional(),
41650
41957
  /** Epic this task rolls up to, locked at plan time per R-303. */
41651
41958
  epicAncestor: NonEmptyString
41652
41959
  });
41653
- var ReleaseGateSchema = z19.object({
41960
+ var ReleaseGateSchema = z20.object({
41654
41961
  /** Canonical gate name. */
41655
41962
  name: GateNameSchema,
41656
41963
  /** ADR-051 atom string identifying the resolved tool (e.g. `tool:test`). */
@@ -41660,11 +41967,11 @@ var ReleaseGateSchema = z19.object({
41660
41967
  /** ISO-8601 timestamp the gate was last verified. */
41661
41968
  lastVerifiedAt: Iso8601,
41662
41969
  /** Resolved shell command (e.g. `pnpm run test`). Optional for unresolved gates. */
41663
- resolvedCommand: z19.string().optional(),
41970
+ resolvedCommand: z20.string().optional(),
41664
41971
  /** Provenance of the resolved command. Optional for unresolved gates. */
41665
41972
  resolvedSource: ResolvedSourceSchema.optional()
41666
41973
  });
41667
- var ReleasePlatformMatrixEntrySchema = z19.object({
41974
+ var ReleasePlatformMatrixEntrySchema = z20.object({
41668
41975
  /** Target platform tuple. */
41669
41976
  platform: PlatformTupleSchema,
41670
41977
  /** Distribution backend. */
@@ -41672,47 +41979,47 @@ var ReleasePlatformMatrixEntrySchema = z19.object({
41672
41979
  /** Package identifier on the target backend (e.g. `@cleocode/cleo`). */
41673
41980
  package: NonEmptyString,
41674
41981
  /** Whether to run the GHA smoke job for this matrix entry. */
41675
- smoke: z19.boolean().default(true).optional()
41982
+ smoke: z20.boolean().default(true).optional()
41676
41983
  });
41677
- var ReleasePreflightSummarySchema = z19.object({
41984
+ var ReleasePreflightSummarySchema = z20.object({
41678
41985
  /** True if esbuild externals are out of sync with package.json. */
41679
- esbuildExternalsDrift: z19.boolean(),
41986
+ esbuildExternalsDrift: z20.boolean(),
41680
41987
  /** True if `pnpm-lock.yaml` diverges from the workspace manifest. */
41681
- lockfileDrift: z19.boolean(),
41988
+ lockfileDrift: z20.boolean(),
41682
41989
  /** True if all epic children are in terminal lifecycle states. */
41683
- epicCompletenessClean: z19.boolean(),
41990
+ epicCompletenessClean: z20.boolean(),
41684
41991
  /** True if no task appears in multiple in-flight release plans. */
41685
- doubleListingClean: z19.boolean(),
41992
+ doubleListingClean: z20.boolean(),
41686
41993
  /** Non-fatal preflight warnings (e.g. unresolved tools per R-024). */
41687
- preflightWarnings: z19.array(z19.string()).default([]).optional()
41994
+ preflightWarnings: z20.array(z20.string()).default([]).optional()
41688
41995
  });
41689
- var ReleasePlanChangelogSchema = z19.object({
41996
+ var ReleasePlanChangelogSchema = z20.object({
41690
41997
  /** `kind=feat` tasks. */
41691
- features: z19.array(NonEmptyString).default([]),
41998
+ features: z20.array(NonEmptyString).default([]),
41692
41999
  /** `kind=fix` or `kind=hotfix` tasks. */
41693
- fixes: z19.array(NonEmptyString).default([]),
42000
+ fixes: z20.array(NonEmptyString).default([]),
41694
42001
  /** `kind=chore`, `docs`, `refactor`, `test`, `perf` tasks. */
41695
- chores: z19.array(NonEmptyString).default([]),
42002
+ chores: z20.array(NonEmptyString).default([]),
41696
42003
  /** `kind=breaking` or `kind=revert` tasks. */
41697
- breaking: z19.array(NonEmptyString).default([])
42004
+ breaking: z20.array(NonEmptyString).default([])
41698
42005
  });
41699
- var ReleasePlanMetaSchema = z19.object({
42006
+ var ReleasePlanMetaSchema = z20.object({
41700
42007
  /** True if this is the project's first ever release. */
41701
- firstEverRelease: z19.boolean().optional(),
42008
+ firstEverRelease: z20.boolean().optional(),
41702
42009
  /** Canonical tool names that could not be resolved at plan time. */
41703
- unresolvedTools: z19.array(z19.string()).optional(),
42010
+ unresolvedTools: z20.array(z20.string()).optional(),
41704
42011
  /** Project archetype detected at plan time. */
41705
- archetype: z19.string().optional()
41706
- }).catchall(z19.unknown());
41707
- var ReleasePlanSchema = z19.object({
42012
+ archetype: z20.string().optional()
42013
+ }).catchall(z20.unknown());
42014
+ var ReleasePlanSchema = z20.object({
41708
42015
  /** Schema URL for this plan version. */
41709
- $schema: z19.string().optional(),
42016
+ $schema: z20.string().optional(),
41710
42017
  /** Requested version string (e.g. "v2026.6.0"). Includes the leading `v`. */
41711
42018
  version: NonEmptyString,
41712
42019
  /** Resolved version string after suffix application (e.g. "v2026.6.0.2"). */
41713
42020
  resolvedVersion: NonEmptyString,
41714
42021
  /** True if a `calver-suffix` was applied to disambiguate a same-day hotfix. */
41715
- suffixApplied: z19.boolean(),
42022
+ suffixApplied: z20.boolean(),
41716
42023
  /** Versioning scheme governing `version` / `resolvedVersion`. */
41717
42024
  scheme: ReleaseSchemeSchema,
41718
42025
  /** npm dist-tag channel for this release. */
@@ -41726,7 +42033,7 @@ var ReleasePlanSchema = z19.object({
41726
42033
  /** Release-kind classification. */
41727
42034
  releaseKind: ReleaseKindSchema,
41728
42035
  /** Explicit hooks-v1 stable promotion; ordinary and hotfix releases are exempt. */
41729
- hooksV1Promotion: z19.boolean().optional(),
42036
+ hooksV1Promotion: z20.boolean().optional(),
41730
42037
  /** Audited reason for shipping a source change that opens the hooks-v1 gate without the promotion (T13555). */
41731
42038
  hooksV1Waiver: NonEmptyString.optional(),
41732
42039
  /** ISO-8601 timestamp the plan was written. */
@@ -41737,27 +42044,27 @@ var ReleasePlanSchema = z19.object({
41737
42044
  * Version of the previous release on the same channel. MUST be `null` only
41738
42045
  * for first-ever releases (R-300, enforced at the verb layer).
41739
42046
  */
41740
- previousVersion: z19.string().nullable(),
42047
+ previousVersion: z20.string().nullable(),
41741
42048
  /** Git tag of the previous release (typically `previousVersion` prefixed). */
41742
- previousTag: z19.string().nullable(),
42049
+ previousTag: z20.string().nullable(),
41743
42050
  /** ISO-8601 timestamp the previous release was published. */
41744
42051
  previousShippedAt: Iso8601.nullable(),
41745
42052
  /** Tasks rolled into this release. */
41746
- tasks: z19.array(ReleasePlanTaskSchema),
42053
+ tasks: z20.array(ReleasePlanTaskSchema),
41747
42054
  /** Bucketed changelog. */
41748
42055
  changelog: ReleasePlanChangelogSchema,
41749
42056
  /** Per-gate verification status. */
41750
- gates: z19.array(ReleaseGateSchema),
42057
+ gates: z20.array(ReleaseGateSchema),
41751
42058
  /** Platform / publisher matrix. */
41752
- platformMatrix: z19.array(ReleasePlatformMatrixEntrySchema),
42059
+ platformMatrix: z20.array(ReleasePlatformMatrixEntrySchema),
41753
42060
  /** Preflight summary from `cleo release plan`. */
41754
42061
  preflightSummary: ReleasePreflightSummarySchema,
41755
42062
  /** URL of the GHA workflow run (populated by `release-prepare.yml`). */
41756
- workflowRunUrl: z19.string().nullable(),
42063
+ workflowRunUrl: z20.string().nullable(),
41757
42064
  /** URL of the bump PR (populated by `cleo release open`). */
41758
- prUrl: z19.string().nullable(),
42065
+ prUrl: z20.string().nullable(),
41759
42066
  /** Merge commit SHA on `main` (populated by `release-publish.yml`). */
41760
- mergeCommitSha: z19.string().nullable(),
42067
+ mergeCommitSha: z20.string().nullable(),
41761
42068
  /** Current FSM state per R-302. */
41762
42069
  status: ReleaseStatusSchema,
41763
42070
  /** Informational / forward-compat metadata. */
@@ -41787,48 +42094,48 @@ var RESOURCE_CLASSES = Object.freeze([
41787
42094
  ]);
41788
42095
 
41789
42096
  // packages/contracts/src/session-journal.ts
41790
- import { z as z20 } from "zod";
42097
+ import { z as z21 } from "zod";
41791
42098
  var SESSION_JOURNAL_SCHEMA_VERSION = "1.0";
41792
- var sessionJournalDoctorSummarySchema = z20.object({
42099
+ var sessionJournalDoctorSummarySchema = z21.object({
41793
42100
  /** `true` when zero noise patterns were detected. */
41794
- isClean: z20.boolean(),
42101
+ isClean: z21.boolean(),
41795
42102
  /** Total number of noise findings across all patterns. */
41796
- findingsCount: z20.number().int().nonnegative(),
42103
+ findingsCount: z21.number().int().nonnegative(),
41797
42104
  /** Pattern names that were detected (empty when isClean). */
41798
- patterns: z20.array(z20.string()),
42105
+ patterns: z21.array(z21.string()),
41799
42106
  /** Total brain entries scanned. `0` = empty or unavailable. */
41800
- totalScanned: z20.number().int().nonnegative()
42107
+ totalScanned: z21.number().int().nonnegative()
41801
42108
  });
41802
- var sessionJournalDebriefSummarySchema = z20.object({
42109
+ var sessionJournalDebriefSummarySchema = z21.object({
41803
42110
  /** First 200 characters of the session end note (if provided). */
41804
- noteExcerpt: z20.string().max(200).optional(),
42111
+ noteExcerpt: z21.string().max(200).optional(),
41805
42112
  /** Number of tasks completed during the session. */
41806
- tasksCompletedCount: z20.number().int().nonnegative(),
42113
+ tasksCompletedCount: z21.number().int().nonnegative(),
41807
42114
  /** Up to 5 task IDs (not titles) that were the focus of the session. */
41808
- tasksFocused: z20.array(z20.string()).max(5).optional()
42115
+ tasksFocused: z21.array(z21.string()).max(5).optional()
41809
42116
  });
41810
- var sessionJournalEntrySchema = z20.object({
42117
+ var sessionJournalEntrySchema = z21.object({
41811
42118
  // Identity
41812
42119
  /** Schema version for forward-compatibility. Always `'1.0'` in this release. */
41813
- schemaVersion: z20.literal(SESSION_JOURNAL_SCHEMA_VERSION),
42120
+ schemaVersion: z21.literal(SESSION_JOURNAL_SCHEMA_VERSION),
41814
42121
  /** ISO 8601 timestamp when the entry was written. */
41815
- timestamp: z20.string(),
42122
+ timestamp: z21.string(),
41816
42123
  /** CLEO session ID (e.g. `ses_20260424055456_ede571`). */
41817
- sessionId: z20.string(),
42124
+ sessionId: z21.string(),
41818
42125
  /** Event type that triggered this journal entry. */
41819
- eventType: z20.enum(["session_start", "session_end", "observation", "decision", "error"]),
42126
+ eventType: z21.enum(["session_start", "session_end", "observation", "decision", "error"]),
41820
42127
  // Session metadata (set on session_start / session_end)
41821
42128
  /** Agent identifier (e.g. `cleo-prime`, `claude-code`). */
41822
- agentIdentifier: z20.string().optional(),
42129
+ agentIdentifier: z21.string().optional(),
41823
42130
  /** Provider adapter ID active for this session. */
41824
- providerId: z20.string().optional(),
42131
+ providerId: z21.string().optional(),
41825
42132
  /** Session scope string (e.g. `'global'` or `'epic:T1263'`). */
41826
- scope: z20.string().optional(),
42133
+ scope: z21.string().optional(),
41827
42134
  // Session-end fields
41828
42135
  /** Duration of the session in seconds (session_end only). */
41829
- duration: z20.number().int().nonnegative().optional(),
42136
+ duration: z21.number().int().nonnegative().optional(),
41830
42137
  /** Task IDs (not titles) completed during the session. */
41831
- tasksCompleted: z20.array(z20.string()).optional(),
42138
+ tasksCompleted: z21.array(z21.string()).optional(),
41832
42139
  // Doctor summary (T1262 absorbed)
41833
42140
  /**
41834
42141
  * Compact result of `scanBrainNoise` run at session-end.
@@ -41843,52 +42150,52 @@ var sessionJournalEntrySchema = z20.object({
41843
42150
  debriefSummary: sessionJournalDebriefSummarySchema.optional(),
41844
42151
  // Optional hash chain
41845
42152
  /** SHA-256 hex of the previous entry's raw JSON string (for integrity chain). */
41846
- prevEntryHash: z20.string().optional()
42153
+ prevEntryHash: z21.string().optional()
41847
42154
  });
41848
42155
 
41849
42156
  // packages/contracts/src/task-evidence.ts
41850
- import { z as z21 } from "zod";
41851
- var fileEvidenceSchema = z21.object({
41852
- kind: z21.literal("file"),
41853
- sha256: z21.string().length(64),
41854
- timestamp: z21.string().datetime(),
41855
- path: z21.string().min(1),
41856
- mime: z21.string().optional(),
41857
- description: z21.string().optional()
41858
- });
41859
- var logEvidenceSchema = z21.object({
41860
- kind: z21.literal("log"),
41861
- sha256: z21.string().length(64),
41862
- timestamp: z21.string().datetime(),
41863
- source: z21.string().min(1),
41864
- description: z21.string().optional()
41865
- });
41866
- var screenshotEvidenceSchema = z21.object({
41867
- kind: z21.literal("screenshot"),
41868
- sha256: z21.string().length(64),
41869
- timestamp: z21.string().datetime(),
41870
- mime: z21.enum(["image/png", "image/jpeg", "image/webp"]).optional(),
41871
- description: z21.string().optional()
41872
- });
41873
- var testOutputEvidenceSchema = z21.object({
41874
- kind: z21.literal("test-output"),
41875
- sha256: z21.string().length(64),
41876
- timestamp: z21.string().datetime(),
41877
- passed: z21.number().int().nonnegative(),
41878
- failed: z21.number().int().nonnegative(),
41879
- skipped: z21.number().int().nonnegative(),
41880
- exitCode: z21.number().int(),
41881
- description: z21.string().optional()
41882
- });
41883
- var commandOutputEvidenceSchema = z21.object({
41884
- kind: z21.literal("command-output"),
41885
- sha256: z21.string().length(64),
41886
- timestamp: z21.string().datetime(),
41887
- cmd: z21.string().min(1),
41888
- exitCode: z21.number().int(),
41889
- description: z21.string().optional()
41890
- });
41891
- var taskEvidenceSchema = z21.discriminatedUnion("kind", [
42157
+ import { z as z22 } from "zod";
42158
+ var fileEvidenceSchema = z22.object({
42159
+ kind: z22.literal("file"),
42160
+ sha256: z22.string().length(64),
42161
+ timestamp: z22.string().datetime(),
42162
+ path: z22.string().min(1),
42163
+ mime: z22.string().optional(),
42164
+ description: z22.string().optional()
42165
+ });
42166
+ var logEvidenceSchema = z22.object({
42167
+ kind: z22.literal("log"),
42168
+ sha256: z22.string().length(64),
42169
+ timestamp: z22.string().datetime(),
42170
+ source: z22.string().min(1),
42171
+ description: z22.string().optional()
42172
+ });
42173
+ var screenshotEvidenceSchema = z22.object({
42174
+ kind: z22.literal("screenshot"),
42175
+ sha256: z22.string().length(64),
42176
+ timestamp: z22.string().datetime(),
42177
+ mime: z22.enum(["image/png", "image/jpeg", "image/webp"]).optional(),
42178
+ description: z22.string().optional()
42179
+ });
42180
+ var testOutputEvidenceSchema = z22.object({
42181
+ kind: z22.literal("test-output"),
42182
+ sha256: z22.string().length(64),
42183
+ timestamp: z22.string().datetime(),
42184
+ passed: z22.number().int().nonnegative(),
42185
+ failed: z22.number().int().nonnegative(),
42186
+ skipped: z22.number().int().nonnegative(),
42187
+ exitCode: z22.number().int(),
42188
+ description: z22.string().optional()
42189
+ });
42190
+ var commandOutputEvidenceSchema = z22.object({
42191
+ kind: z22.literal("command-output"),
42192
+ sha256: z22.string().length(64),
42193
+ timestamp: z22.string().datetime(),
42194
+ cmd: z22.string().min(1),
42195
+ exitCode: z22.number().int(),
42196
+ description: z22.string().optional()
42197
+ });
42198
+ var taskEvidenceSchema = z22.discriminatedUnion("kind", [
41892
42199
  fileEvidenceSchema,
41893
42200
  logEvidenceSchema,
41894
42201
  screenshotEvidenceSchema,
@@ -41897,8 +42204,8 @@ var taskEvidenceSchema = z21.discriminatedUnion("kind", [
41897
42204
  ]);
41898
42205
 
41899
42206
  // packages/contracts/src/tasks/archive.ts
41900
- import { z as z22 } from "zod";
41901
- var ArchiveReason = z22.enum([
42207
+ import { z as z23 } from "zod";
42208
+ var ArchiveReason = z23.enum([
41902
42209
  "verified",
41903
42210
  "reconciled",
41904
42211
  "superseded",
@@ -41909,42 +42216,42 @@ var ArchiveReason = z22.enum([
41909
42216
  var ARCHIVE_REASON_VALUES = ArchiveReason.options;
41910
42217
 
41911
42218
  // packages/contracts/src/tasks/index.ts
41912
- import { z as z23 } from "zod";
41913
- var taskMutationWarningSeveritySchema = z23.enum(["info", "warning"]);
41914
- var taskMutationWarningSchema = z23.object({
41915
- code: z23.string().min(1),
41916
- message: z23.string().min(1),
42219
+ import { z as z24 } from "zod";
42220
+ var taskMutationWarningSeveritySchema = z24.enum(["info", "warning"]);
42221
+ var taskMutationWarningSchema = z24.object({
42222
+ code: z24.string().min(1),
42223
+ message: z24.string().min(1),
41917
42224
  severity: taskMutationWarningSeveritySchema.optional(),
41918
- taskId: z23.string().min(1).optional(),
41919
- field: z23.string().min(1).optional(),
41920
- index: z23.number().int().nonnegative().optional()
41921
- });
41922
- var taskMutationDryRunSummarySchema = z23.object({
41923
- dryRun: z23.literal(true),
41924
- wouldCreate: z23.number().int().nonnegative(),
41925
- wouldUpdate: z23.number().int().nonnegative(),
41926
- wouldDelete: z23.number().int().nonnegative(),
41927
- wouldAffect: z23.number().int().nonnegative(),
41928
- validatedCount: z23.number().int().nonnegative(),
41929
- insertedCount: z23.literal(0),
41930
- updatedCount: z23.literal(0),
41931
- deletedCount: z23.literal(0),
41932
- warnings: z23.array(taskMutationWarningSchema)
41933
- });
41934
- var taskMutationTaskRecordSchema = z23.object({ id: z23.string().min(1) }).passthrough();
41935
- var taskMutationEnvelopeSchema = z23.object({
41936
- dryRun: z23.boolean().optional(),
41937
- created: z23.array(taskMutationTaskRecordSchema),
41938
- updated: z23.array(taskMutationTaskRecordSchema),
41939
- deleted: z23.array(taskMutationTaskRecordSchema),
41940
- affectedCount: z23.number().int().nonnegative(),
41941
- mutationWarnings: z23.array(taskMutationWarningSchema),
42225
+ taskId: z24.string().min(1).optional(),
42226
+ field: z24.string().min(1).optional(),
42227
+ index: z24.number().int().nonnegative().optional()
42228
+ });
42229
+ var taskMutationDryRunSummarySchema = z24.object({
42230
+ dryRun: z24.literal(true),
42231
+ wouldCreate: z24.number().int().nonnegative(),
42232
+ wouldUpdate: z24.number().int().nonnegative(),
42233
+ wouldDelete: z24.number().int().nonnegative(),
42234
+ wouldAffect: z24.number().int().nonnegative(),
42235
+ validatedCount: z24.number().int().nonnegative(),
42236
+ insertedCount: z24.literal(0),
42237
+ updatedCount: z24.literal(0),
42238
+ deletedCount: z24.literal(0),
42239
+ warnings: z24.array(taskMutationWarningSchema)
42240
+ });
42241
+ var taskMutationTaskRecordSchema = z24.object({ id: z24.string().min(1) }).passthrough();
42242
+ var taskMutationEnvelopeSchema = z24.object({
42243
+ dryRun: z24.boolean().optional(),
42244
+ created: z24.array(taskMutationTaskRecordSchema),
42245
+ updated: z24.array(taskMutationTaskRecordSchema),
42246
+ deleted: z24.array(taskMutationTaskRecordSchema),
42247
+ affectedCount: z24.number().int().nonnegative(),
42248
+ mutationWarnings: z24.array(taskMutationWarningSchema),
41942
42249
  dryRunSummary: taskMutationDryRunSummarySchema.optional()
41943
42250
  });
41944
- var completionTaskStatusSchema = z23.enum(TASK_STATUSES);
41945
- var completionCriterionKindSchema = z23.enum(["text", "evidence_bound", "child_task"]);
41946
- var completionCriterionStatusSchema = z23.enum(["satisfied", "unsatisfied", "waived", "replaced"]);
41947
- var completionBlockerReasonSchema = z23.enum([
42251
+ var completionTaskStatusSchema = z24.enum(TASK_STATUSES);
42252
+ var completionCriterionKindSchema = z24.enum(["text", "evidence_bound", "child_task"]);
42253
+ var completionCriterionStatusSchema = z24.enum(["satisfied", "unsatisfied", "waived", "replaced"]);
42254
+ var completionBlockerReasonSchema = z24.enum([
41948
42255
  "missing_evidence_binding",
41949
42256
  "child_not_done",
41950
42257
  "child_cancelled_requires_waiver",
@@ -41952,68 +42259,68 @@ var completionBlockerReasonSchema = z23.enum([
41952
42259
  "child_missing",
41953
42260
  "done_parent_stale"
41954
42261
  ]);
41955
- var completionStaleReasonSchema = z23.enum(["done_parent_has_unsatisfied_criteria"]);
41956
- var completionProjectionRepairErrorCodeSchema = z23.enum([
42262
+ var completionStaleReasonSchema = z24.enum(["done_parent_has_unsatisfied_criteria"]);
42263
+ var completionProjectionRepairErrorCodeSchema = z24.enum([
41957
42264
  "projection_not_stale",
41958
42265
  "criteria_missing",
41959
42266
  "binding_target_missing",
41960
42267
  "repair_conflict"
41961
42268
  ]);
41962
- var completionCriterionWaiverSchema = z23.object({
41963
- criterionAcId: z23.string().min(1),
41964
- childTaskId: z23.string().min(1),
41965
- reason: z23.string().min(1),
41966
- actor: z23.string().min(1),
41967
- waivedAt: z23.string().min(1)
41968
- });
41969
- var completionCriterionReplacementSchema = z23.object({
41970
- criterionAcId: z23.string().min(1),
41971
- originalChildTaskId: z23.string().min(1),
41972
- replacementChildTaskId: z23.string().min(1),
41973
- reason: z23.string().min(1),
41974
- actor: z23.string().min(1),
41975
- replacedAt: z23.string().min(1)
41976
- });
41977
- var completionCriterionEvaluationSchema = z23.object({
41978
- acId: z23.string().min(1),
41979
- alias: z23.string().min(1),
41980
- text: z23.string(),
42269
+ var completionCriterionWaiverSchema = z24.object({
42270
+ criterionAcId: z24.string().min(1),
42271
+ childTaskId: z24.string().min(1),
42272
+ reason: z24.string().min(1),
42273
+ actor: z24.string().min(1),
42274
+ waivedAt: z24.string().min(1)
42275
+ });
42276
+ var completionCriterionReplacementSchema = z24.object({
42277
+ criterionAcId: z24.string().min(1),
42278
+ originalChildTaskId: z24.string().min(1),
42279
+ replacementChildTaskId: z24.string().min(1),
42280
+ reason: z24.string().min(1),
42281
+ actor: z24.string().min(1),
42282
+ replacedAt: z24.string().min(1)
42283
+ });
42284
+ var completionCriterionEvaluationSchema = z24.object({
42285
+ acId: z24.string().min(1),
42286
+ alias: z24.string().min(1),
42287
+ text: z24.string(),
41981
42288
  kind: completionCriterionKindSchema,
41982
42289
  status: completionCriterionStatusSchema,
41983
42290
  reason: completionBlockerReasonSchema.optional(),
41984
- targetTaskId: z23.string().min(1).optional(),
42291
+ targetTaskId: z24.string().min(1).optional(),
41985
42292
  targetTaskStatus: completionTaskStatusSchema.optional(),
41986
42293
  waiver: completionCriterionWaiverSchema.optional(),
41987
42294
  replacement: completionCriterionReplacementSchema.optional(),
41988
42295
  replacementTaskStatus: completionTaskStatusSchema.optional(),
41989
- evidenceBindings: z23.number().int().nonnegative()
42296
+ evidenceBindings: z24.number().int().nonnegative()
41990
42297
  });
41991
42298
  var unsatisfiedCompletionCriterionSchema = completionCriterionEvaluationSchema.extend({
41992
- status: z23.literal("unsatisfied"),
42299
+ status: z24.literal("unsatisfied"),
41993
42300
  reason: completionBlockerReasonSchema
41994
42301
  });
41995
- var completionTotalsSchema = z23.object({
41996
- criteria: z23.number().int().nonnegative(),
41997
- satisfied: z23.number().int().nonnegative(),
41998
- unsatisfied: z23.number().int().nonnegative(),
41999
- waived: z23.number().int().nonnegative(),
42000
- replaced: z23.number().int().nonnegative()
42001
- });
42002
- var completionContextPackSchema = z23.object({
42003
- taskId: z23.string().min(1),
42004
- generatedAt: z23.string().min(1),
42005
- source: z23.literal("audit_log"),
42006
- window: z23.object({
42007
- limit: z23.number().int().positive(),
42008
- since: z23.string().min(1).optional(),
42009
- relationDepth: z23.number().int().nonnegative(),
42010
- relatedTaskIds: z23.array(z23.string().min(1))
42302
+ var completionTotalsSchema = z24.object({
42303
+ criteria: z24.number().int().nonnegative(),
42304
+ satisfied: z24.number().int().nonnegative(),
42305
+ unsatisfied: z24.number().int().nonnegative(),
42306
+ waived: z24.number().int().nonnegative(),
42307
+ replaced: z24.number().int().nonnegative()
42308
+ });
42309
+ var completionContextPackSchema = z24.object({
42310
+ taskId: z24.string().min(1),
42311
+ generatedAt: z24.string().min(1),
42312
+ source: z24.literal("audit_log"),
42313
+ window: z24.object({
42314
+ limit: z24.number().int().positive(),
42315
+ since: z24.string().min(1).optional(),
42316
+ relationDepth: z24.number().int().nonnegative(),
42317
+ relatedTaskIds: z24.array(z24.string().min(1))
42011
42318
  }),
42012
- events: z23.array(
42013
- z23.object({
42014
- id: z23.string().min(1),
42015
- timestamp: z23.string().min(1),
42016
- action: z23.enum([
42319
+ events: z24.array(
42320
+ z24.object({
42321
+ id: z24.string().min(1),
42322
+ timestamp: z24.string().min(1),
42323
+ action: z24.enum([
42017
42324
  "task_completed",
42018
42325
  "task_reopened",
42019
42326
  "task_cancelled",
@@ -42021,77 +42328,77 @@ var completionContextPackSchema = z23.object({
42021
42328
  "task_reparented",
42022
42329
  "ac_projection_rebuilt"
42023
42330
  ]),
42024
- taskId: z23.string().min(1),
42025
- relation: z23.enum(["self", "parent", "child", "sibling", "related"]),
42026
- actor: z23.string().min(1),
42027
- details: z23.record(z23.string(), z23.unknown()).optional(),
42028
- before: z23.record(z23.string(), z23.unknown()).optional(),
42029
- after: z23.record(z23.string(), z23.unknown()).optional()
42331
+ taskId: z24.string().min(1),
42332
+ relation: z24.enum(["self", "parent", "child", "sibling", "related"]),
42333
+ actor: z24.string().min(1),
42334
+ details: z24.record(z24.string(), z24.unknown()).optional(),
42335
+ before: z24.record(z24.string(), z24.unknown()).optional(),
42336
+ after: z24.record(z24.string(), z24.unknown()).optional()
42030
42337
  })
42031
42338
  ),
42032
- summary: z23.object({
42033
- totalEvents: z23.number().int().nonnegative(),
42034
- byAction: z23.record(z23.string(), z23.number().int().nonnegative()),
42035
- byRelation: z23.record(z23.string(), z23.number().int().nonnegative()),
42036
- latestEventAt: z23.string().nullable()
42339
+ summary: z24.object({
42340
+ totalEvents: z24.number().int().nonnegative(),
42341
+ byAction: z24.record(z24.string(), z24.number().int().nonnegative()),
42342
+ byRelation: z24.record(z24.string(), z24.number().int().nonnegative()),
42343
+ latestEventAt: z24.string().nullable()
42037
42344
  })
42038
42345
  });
42039
- var completionEvaluationSchema = z23.object({
42040
- taskId: z23.string().min(1),
42346
+ var completionEvaluationSchema = z24.object({
42347
+ taskId: z24.string().min(1),
42041
42348
  taskStatus: completionTaskStatusSchema,
42042
- ready: z23.boolean(),
42043
- stale: z23.boolean(),
42044
- staleReasons: z23.array(completionStaleReasonSchema),
42349
+ ready: z24.boolean(),
42350
+ stale: z24.boolean(),
42351
+ staleReasons: z24.array(completionStaleReasonSchema),
42045
42352
  contextPack: completionContextPackSchema.optional(),
42046
- satisfied: z23.array(completionCriterionEvaluationSchema),
42047
- unsatisfied: z23.array(unsatisfiedCompletionCriterionSchema),
42048
- waived: z23.array(completionCriterionEvaluationSchema),
42049
- replaced: z23.array(completionCriterionEvaluationSchema),
42353
+ satisfied: z24.array(completionCriterionEvaluationSchema),
42354
+ unsatisfied: z24.array(unsatisfiedCompletionCriterionSchema),
42355
+ waived: z24.array(completionCriterionEvaluationSchema),
42356
+ replaced: z24.array(completionCriterionEvaluationSchema),
42050
42357
  totals: completionTotalsSchema
42051
42358
  });
42052
- var completionExplanationSchema = z23.object({
42053
- taskId: z23.string().min(1),
42054
- ready: z23.boolean(),
42055
- stale: z23.boolean(),
42056
- summary: z23.string(),
42359
+ var completionExplanationSchema = z24.object({
42360
+ taskId: z24.string().min(1),
42361
+ ready: z24.boolean(),
42362
+ stale: z24.boolean(),
42363
+ summary: z24.string(),
42057
42364
  contextPack: completionContextPackSchema.optional(),
42058
- blockers: z23.array(completionCriterionEvaluationSchema)
42365
+ blockers: z24.array(completionCriterionEvaluationSchema)
42059
42366
  });
42060
- var completionListParamsSchema = z23.object({
42061
- taskId: z23.string().min(1),
42367
+ var completionListParamsSchema = z24.object({
42368
+ taskId: z24.string().min(1),
42062
42369
  status: completionCriterionStatusSchema.optional(),
42063
42370
  kind: completionCriterionKindSchema.optional()
42064
42371
  });
42065
- var completionListResultSchema = z23.object({
42066
- taskId: z23.string().min(1),
42067
- criteria: z23.array(completionCriterionEvaluationSchema),
42372
+ var completionListResultSchema = z24.object({
42373
+ taskId: z24.string().min(1),
42374
+ criteria: z24.array(completionCriterionEvaluationSchema),
42068
42375
  totals: completionTotalsSchema
42069
42376
  });
42070
- var completionEvaluateParamsSchema = z23.object({
42071
- taskId: z23.string().min(1),
42072
- includeContext: z23.boolean().optional(),
42073
- limit: z23.number().int().positive().optional(),
42074
- since: z23.string().min(1).optional(),
42075
- relationDepth: z23.number().int().nonnegative().optional()
42377
+ var completionEvaluateParamsSchema = z24.object({
42378
+ taskId: z24.string().min(1),
42379
+ includeContext: z24.boolean().optional(),
42380
+ limit: z24.number().int().positive().optional(),
42381
+ since: z24.string().min(1).optional(),
42382
+ relationDepth: z24.number().int().nonnegative().optional()
42076
42383
  });
42077
- var completionProjectionRepairErrorSchema = z23.object({
42384
+ var completionProjectionRepairErrorSchema = z24.object({
42078
42385
  code: completionProjectionRepairErrorCodeSchema,
42079
- message: z23.string().min(1),
42080
- taskId: z23.string().min(1),
42081
- acId: z23.string().min(1).optional(),
42082
- evidenceAtomId: z23.string().min(1).optional()
42083
- });
42084
- var completionProjectionRepairParamsSchema = z23.object({
42085
- taskId: z23.string().min(1),
42086
- dryRun: z23.boolean().optional()
42087
- });
42088
- var completionProjectionRepairResultSchema = z23.object({
42089
- taskId: z23.string().min(1),
42090
- repaired: z23.boolean(),
42091
- dryRun: z23.boolean(),
42092
- staleBefore: z23.boolean(),
42093
- staleAfter: z23.boolean(),
42094
- errors: z23.array(completionProjectionRepairErrorSchema)
42386
+ message: z24.string().min(1),
42387
+ taskId: z24.string().min(1),
42388
+ acId: z24.string().min(1).optional(),
42389
+ evidenceAtomId: z24.string().min(1).optional()
42390
+ });
42391
+ var completionProjectionRepairParamsSchema = z24.object({
42392
+ taskId: z24.string().min(1),
42393
+ dryRun: z24.boolean().optional()
42394
+ });
42395
+ var completionProjectionRepairResultSchema = z24.object({
42396
+ taskId: z24.string().min(1),
42397
+ repaired: z24.boolean(),
42398
+ dryRun: z24.boolean(),
42399
+ staleBefore: z24.boolean(),
42400
+ staleAfter: z24.boolean(),
42401
+ errors: z24.array(completionProjectionRepairErrorSchema)
42095
42402
  });
42096
42403
 
42097
42404
  // packages/contracts/src/taxonomy.ts
@@ -42594,7 +42901,7 @@ var TaxonomyRegistry = class _TaxonomyRegistry {
42594
42901
  };
42595
42902
 
42596
42903
  // packages/contracts/src/templates/manifest.ts
42597
- import { z as z24 } from "zod";
42904
+ import { z as z25 } from "zod";
42598
42905
  var TEMPLATE_KINDS = ["workflow", "config", "agent", "skill", "provider", "doc"];
42599
42906
  var TEMPLATE_SUBSTITUTIONS = ["regex-tmpl", "static", "json-merge"];
42600
42907
  var TEMPLATE_UPDATE_STRATEGIES = [
@@ -42611,79 +42918,79 @@ var PLACEHOLDER_SOURCES = [
42611
42918
  "tool-resolver",
42612
42919
  "literal"
42613
42920
  ];
42614
- var PlaceholderSpecSchema = z24.object({
42921
+ var PlaceholderSpecSchema = z25.object({
42615
42922
  /**
42616
42923
  * Placeholder identifier as it appears in the template body
42617
42924
  * (e.g. `NODE_VERSION` matches `{{NODE_VERSION}}`).
42618
42925
  */
42619
- name: z24.string().min(1, "placeholder name must be non-empty"),
42926
+ name: z25.string().min(1, "placeholder name must be non-empty"),
42620
42927
  /** Resolver source the installer consults for this placeholder. */
42621
- source: z24.enum(PLACEHOLDER_SOURCES),
42928
+ source: z25.enum(PLACEHOLDER_SOURCES),
42622
42929
  /**
42623
42930
  * Path expression evaluated against `source` (e.g. `engines.node` against
42624
42931
  * `project-context`, `defaults.branchModel` against `.cleo/config`).
42625
42932
  * For `literal` source, this MAY be the literal value's identifier.
42626
42933
  */
42627
- sourcePath: z24.string().min(1, "placeholder sourcePath must be non-empty"),
42934
+ sourcePath: z25.string().min(1, "placeholder sourcePath must be non-empty"),
42628
42935
  /**
42629
42936
  * Fallback value used when `source[sourcePath]` resolves to `undefined`.
42630
42937
  * `null` is permitted to explicitly mark "no default — failure required".
42631
42938
  */
42632
- defaultValue: z24.union([z24.string(), z24.number(), z24.boolean(), z24.null()]).optional()
42939
+ defaultValue: z25.union([z25.string(), z25.number(), z25.boolean(), z25.null()]).optional()
42633
42940
  });
42634
- var TemplateManifestEntrySchema = z24.object({
42941
+ var TemplateManifestEntrySchema = z25.object({
42635
42942
  /** Stable identifier for this template entry. */
42636
- id: z24.string().min(1, "id must be non-empty"),
42943
+ id: z25.string().min(1, "id must be non-empty"),
42637
42944
  /** Category of file this template represents. */
42638
- kind: z24.enum(TEMPLATE_KINDS),
42945
+ kind: z25.enum(TEMPLATE_KINDS),
42639
42946
  /** Repo-relative path of the template source file. */
42640
- sourcePath: z24.string().min(1, "sourcePath must be non-empty"),
42947
+ sourcePath: z25.string().min(1, "sourcePath must be non-empty"),
42641
42948
  /** Project-relative path where the rendered template installs. */
42642
- installPath: z24.string().min(1, "installPath must be non-empty"),
42949
+ installPath: z25.string().min(1, "installPath must be non-empty"),
42643
42950
  /** Substitution strategy the installer applies to `sourcePath`. */
42644
- substitution: z24.enum(TEMPLATE_SUBSTITUTIONS),
42951
+ substitution: z25.enum(TEMPLATE_SUBSTITUTIONS),
42645
42952
  /** Declared placeholders this template requires. May be empty. */
42646
- placeholders: z24.array(PlaceholderSpecSchema),
42953
+ placeholders: z25.array(PlaceholderSpecSchema),
42647
42954
  /** Reconciliation policy on upgrade. */
42648
- updateStrategy: z24.enum(TEMPLATE_UPDATE_STRATEGIES)
42955
+ updateStrategy: z25.enum(TEMPLATE_UPDATE_STRATEGIES)
42649
42956
  });
42650
42957
 
42651
42958
  // packages/contracts/src/validator/index.ts
42652
- import { z as z25 } from "zod";
42959
+ import { z as z26 } from "zod";
42653
42960
  var VALIDATOR_ID_REGEX = /^validator-[a-z0-9][a-z0-9-]*$/;
42654
- var validatorFindingSchema = z25.object({
42655
- acId: z25.string().min(1, "acId must be non-empty"),
42656
- status: z25.enum(["pass", "fail", "inconclusive"]),
42657
- reasoning: z25.string().min(1, "reasoning must be non-empty"),
42658
- evidenceRefs: z25.array(z25.string()).optional(),
42659
- checkedAt: z25.string().min(1, "checkedAt must be a non-empty ISO-8601 string")
42660
- });
42661
- var validatorAttestationSchema = z25.object({
42662
- verdict: z25.literal("attest"),
42663
- taskId: z25.string().min(1),
42664
- validatorId: z25.string().regex(VALIDATOR_ID_REGEX, "validatorId must match the pattern validator-<discriminator>"),
42665
- findings: z25.array(validatorFindingSchema).min(1, "attestation must contain at least one finding").refine(
42961
+ var validatorFindingSchema = z26.object({
42962
+ acId: z26.string().min(1, "acId must be non-empty"),
42963
+ status: z26.enum(["pass", "fail", "inconclusive"]),
42964
+ reasoning: z26.string().min(1, "reasoning must be non-empty"),
42965
+ evidenceRefs: z26.array(z26.string()).optional(),
42966
+ checkedAt: z26.string().min(1, "checkedAt must be a non-empty ISO-8601 string")
42967
+ });
42968
+ var validatorAttestationSchema = z26.object({
42969
+ verdict: z26.literal("attest"),
42970
+ taskId: z26.string().min(1),
42971
+ validatorId: z26.string().regex(VALIDATOR_ID_REGEX, "validatorId must match the pattern validator-<discriminator>"),
42972
+ findings: z26.array(validatorFindingSchema).min(1, "attestation must contain at least one finding").refine(
42666
42973
  (findings) => findings.every((f) => f.status === "pass"),
42667
42974
  'attestation requires every finding to have status="pass"'
42668
42975
  ),
42669
- summary: z25.string().optional(),
42670
- attestedAt: z25.string().min(1),
42671
- schemaVersion: z25.literal("1")
42672
- });
42673
- var validatorRejectionSchema = z25.object({
42674
- verdict: z25.literal("reject"),
42675
- taskId: z25.string().min(1),
42676
- validatorId: z25.string().regex(VALIDATOR_ID_REGEX, "validatorId must match the pattern validator-<discriminator>"),
42677
- findings: z25.array(validatorFindingSchema).min(1, "rejection must contain at least one finding").refine(
42976
+ summary: z26.string().optional(),
42977
+ attestedAt: z26.string().min(1),
42978
+ schemaVersion: z26.literal("1")
42979
+ });
42980
+ var validatorRejectionSchema = z26.object({
42981
+ verdict: z26.literal("reject"),
42982
+ taskId: z26.string().min(1),
42983
+ validatorId: z26.string().regex(VALIDATOR_ID_REGEX, "validatorId must match the pattern validator-<discriminator>"),
42984
+ findings: z26.array(validatorFindingSchema).min(1, "rejection must contain at least one finding").refine(
42678
42985
  (findings) => findings.some((f) => f.status !== "pass"),
42679
42986
  'rejection requires at least one finding with status "fail" or "inconclusive"'
42680
42987
  ),
42681
- summary: z25.string().min(1, "rejection summary must be non-empty"),
42682
- remediationHints: z25.array(z25.string()).optional(),
42683
- rejectedAt: z25.string().min(1),
42684
- schemaVersion: z25.literal("1")
42988
+ summary: z26.string().min(1, "rejection summary must be non-empty"),
42989
+ remediationHints: z26.array(z26.string()).optional(),
42990
+ rejectedAt: z26.string().min(1),
42991
+ schemaVersion: z26.literal("1")
42685
42992
  });
42686
- var validatorVerdictSchema = z25.discriminatedUnion("verdict", [
42993
+ var validatorVerdictSchema = z26.discriminatedUnion("verdict", [
42687
42994
  validatorAttestationSchema,
42688
42995
  validatorRejectionSchema
42689
42996
  ]);
@@ -43433,7 +43740,7 @@ var CAAMP_DAMAGED_START_PATTERN_SOURCE = damagedMarkerSource("START");
43433
43740
  var CAAMP_DAMAGED_END_PATTERN_SOURCE = damagedMarkerSource("END");
43434
43741
 
43435
43742
  // packages/contracts/src/decide.ts
43436
- import { z as z26 } from "zod";
43743
+ import { z as z27 } from "zod";
43437
43744
  var DECISION_QUESTION_TYPES = ["noul", "choice", "score"];
43438
43745
  var DECISION_OUTCOME_SOURCES = ["provider", "cache", "fallback"];
43439
43746
  var DECISION_REQUEST_LIMITS = {
@@ -43455,11 +43762,11 @@ var DECISION_REQUEST_LIMITS = {
43455
43762
  maxScoreLevels: 10
43456
43763
  };
43457
43764
  var DECISION_PROVIDER_KINDS = ["layahost", "jev"];
43458
- var decisionQuestionTypeSchema = z26.enum(DECISION_QUESTION_TYPES);
43459
- var decisionOutcomeSourceSchema = z26.enum(DECISION_OUTCOME_SOURCES);
43460
- var decisionInstructionsSchema = z26.union([z26.string(), z26.record(z26.string(), z26.json())]);
43461
- var unitIntervalSchema = z26.number().min(0).max(1);
43462
- var decisionStateSchema = z26.union([z26.string(), z26.array(z26.json()), z26.record(z26.string(), z26.json())]).superRefine((state, context) => {
43765
+ var decisionQuestionTypeSchema = z27.enum(DECISION_QUESTION_TYPES);
43766
+ var decisionOutcomeSourceSchema = z27.enum(DECISION_OUTCOME_SOURCES);
43767
+ var decisionInstructionsSchema = z27.union([z27.string(), z27.record(z27.string(), z27.json())]);
43768
+ var unitIntervalSchema = z27.number().min(0).max(1);
43769
+ var decisionStateSchema = z27.union([z27.string(), z27.array(z27.json()), z27.record(z27.string(), z27.json())]).superRefine((state, context) => {
43463
43770
  const size = typeof state === "string" ? state.length : JSON.stringify(state).length;
43464
43771
  if (size > DECISION_REQUEST_LIMITS.maxStateChars) {
43465
43772
  context.addIssue({
@@ -43468,34 +43775,34 @@ var decisionStateSchema = z26.union([z26.string(), z26.array(z26.json()), z26.re
43468
43775
  });
43469
43776
  }
43470
43777
  });
43471
- var noulDecisionQuestionSchema = z26.object({
43472
- type: z26.literal("noul"),
43778
+ var noulDecisionQuestionSchema = z27.object({
43779
+ type: z27.literal("noul"),
43473
43780
  instructions: decisionInstructionsSchema.optional(),
43474
- criteria: z26.string().min(1)
43781
+ criteria: z27.string().min(1)
43475
43782
  });
43476
- var choiceDecisionQuestionSchema = z26.object({
43477
- type: z26.literal("choice"),
43783
+ var choiceDecisionQuestionSchema = z27.object({
43784
+ type: z27.literal("choice"),
43478
43785
  instructions: decisionInstructionsSchema.optional(),
43479
- criteria: z26.record(z26.string().min(1), z26.string()).refine((options) => Object.keys(options).length >= DECISION_REQUEST_LIMITS.minChoiceOptions, {
43786
+ criteria: z27.record(z27.string().min(1), z27.string()).refine((options) => Object.keys(options).length >= DECISION_REQUEST_LIMITS.minChoiceOptions, {
43480
43787
  message: `a choice question needs at least ${DECISION_REQUEST_LIMITS.minChoiceOptions} options`
43481
43788
  })
43482
43789
  });
43483
- var scoreDecisionQuestionSchema = z26.object({
43484
- type: z26.literal("score"),
43790
+ var scoreDecisionQuestionSchema = z27.object({
43791
+ type: z27.literal("score"),
43485
43792
  instructions: decisionInstructionsSchema.optional(),
43486
- criteria: z26.array(z26.string()).min(DECISION_REQUEST_LIMITS.minScoreLevels).max(DECISION_REQUEST_LIMITS.maxScoreLevels)
43793
+ criteria: z27.array(z27.string()).min(DECISION_REQUEST_LIMITS.minScoreLevels).max(DECISION_REQUEST_LIMITS.maxScoreLevels)
43487
43794
  });
43488
- var decisionQuestionSchema = z26.discriminatedUnion("type", [
43795
+ var decisionQuestionSchema = z27.discriminatedUnion("type", [
43489
43796
  noulDecisionQuestionSchema,
43490
43797
  choiceDecisionQuestionSchema,
43491
43798
  scoreDecisionQuestionSchema
43492
43799
  ]);
43493
- var decisionRequestSchema = z26.object({
43494
- model: z26.string().min(1).optional(),
43495
- lang: z26.string().regex(/^[a-z]{2,3}(-[A-Za-z0-9]{2,8})?$/).optional(),
43496
- cache: z26.boolean().optional(),
43800
+ var decisionRequestSchema = z27.object({
43801
+ model: z27.string().min(1).optional(),
43802
+ lang: z27.string().regex(/^[a-z]{2,3}(-[A-Za-z0-9]{2,8})?$/).optional(),
43803
+ cache: z27.boolean().optional(),
43497
43804
  state: decisionStateSchema,
43498
- questions: z26.record(z26.string().min(1), decisionQuestionSchema).refine(
43805
+ questions: z27.record(z27.string().min(1), decisionQuestionSchema).refine(
43499
43806
  (questions) => {
43500
43807
  const count = Object.keys(questions).length;
43501
43808
  return count >= DECISION_REQUEST_LIMITS.minQuestions && count <= DECISION_REQUEST_LIMITS.maxQuestions;
@@ -43505,139 +43812,139 @@ var decisionRequestSchema = z26.object({
43505
43812
  }
43506
43813
  )
43507
43814
  });
43508
- var noulDecisionAnswerSchema = z26.object({
43509
- type: z26.literal("noul"),
43510
- value: z26.boolean(),
43815
+ var noulDecisionAnswerSchema = z27.object({
43816
+ type: z27.literal("noul"),
43817
+ value: z27.boolean(),
43511
43818
  probability: unitIntervalSchema,
43512
43819
  confidence: unitIntervalSchema
43513
43820
  });
43514
- var choiceDecisionAnswerSchema = z26.object({
43515
- type: z26.literal("choice"),
43516
- value: z26.string().min(1),
43517
- probabilities: z26.record(z26.string().min(1), unitIntervalSchema),
43821
+ var choiceDecisionAnswerSchema = z27.object({
43822
+ type: z27.literal("choice"),
43823
+ value: z27.string().min(1),
43824
+ probabilities: z27.record(z27.string().min(1), unitIntervalSchema),
43518
43825
  confidence: unitIntervalSchema
43519
43826
  });
43520
- var scoreDecisionAnswerSchema = z26.object({
43521
- type: z26.literal("score"),
43522
- value: z26.number().int().nonnegative(),
43523
- probabilities: z26.array(unitIntervalSchema).min(DECISION_REQUEST_LIMITS.minScoreLevels).max(DECISION_REQUEST_LIMITS.maxScoreLevels),
43827
+ var scoreDecisionAnswerSchema = z27.object({
43828
+ type: z27.literal("score"),
43829
+ value: z27.number().int().nonnegative(),
43830
+ probabilities: z27.array(unitIntervalSchema).min(DECISION_REQUEST_LIMITS.minScoreLevels).max(DECISION_REQUEST_LIMITS.maxScoreLevels),
43524
43831
  confidence: unitIntervalSchema
43525
43832
  });
43526
- var decisionAnswerSchema = z26.discriminatedUnion("type", [
43833
+ var decisionAnswerSchema = z27.discriminatedUnion("type", [
43527
43834
  noulDecisionAnswerSchema,
43528
43835
  choiceDecisionAnswerSchema,
43529
43836
  scoreDecisionAnswerSchema
43530
43837
  ]);
43531
- var decisionOutcomeSchema = z26.object({
43532
- answers: z26.record(z26.string().min(1), decisionAnswerSchema),
43838
+ var decisionOutcomeSchema = z27.object({
43839
+ answers: z27.record(z27.string().min(1), decisionAnswerSchema),
43533
43840
  source: decisionOutcomeSourceSchema,
43534
- requestId: z26.string().min(1).optional(),
43535
- latencyMs: z26.number().nonnegative(),
43536
- costUsd: z26.number().nonnegative().optional(),
43537
- costMicros: z26.number().int().nonnegative().optional(),
43538
- balanceMicros: z26.number().int().optional(),
43539
- checkpoint: z26.string().min(1).optional(),
43540
- inputTokens: z26.number().int().nonnegative().optional()
43541
- });
43542
- var decisionProviderKindSchema = z26.enum(DECISION_PROVIDER_KINDS);
43543
- var decisionProviderConfigSchema = z26.object({
43544
- baseUrl: z26.url(),
43841
+ requestId: z27.string().min(1).optional(),
43842
+ latencyMs: z27.number().nonnegative(),
43843
+ costUsd: z27.number().nonnegative().optional(),
43844
+ costMicros: z27.number().int().nonnegative().optional(),
43845
+ balanceMicros: z27.number().int().optional(),
43846
+ checkpoint: z27.string().min(1).optional(),
43847
+ inputTokens: z27.number().int().nonnegative().optional()
43848
+ });
43849
+ var decisionProviderKindSchema = z27.enum(DECISION_PROVIDER_KINDS);
43850
+ var decisionProviderConfigSchema = z27.object({
43851
+ baseUrl: z27.url(),
43545
43852
  provider: decisionProviderKindSchema.optional()
43546
43853
  });
43547
43854
 
43548
43855
  // packages/contracts/src/nexus-account.ts
43549
- import { z as z27 } from "zod";
43550
- var nexusAccountUserSchema = z27.object({
43551
- id: z27.string(),
43552
- email: z27.string(),
43553
- name: z27.string().nullable().optional()
43554
- });
43555
- var nexusAccountOrganizationSchema = z27.object({
43556
- id: z27.string(),
43557
- name: z27.string(),
43558
- slug: z27.string().nullable().optional(),
43559
- role: z27.string().optional(),
43856
+ import { z as z28 } from "zod";
43857
+ var nexusAccountUserSchema = z28.object({
43858
+ id: z28.string(),
43859
+ email: z28.string(),
43860
+ name: z28.string().nullable().optional()
43861
+ });
43862
+ var nexusAccountOrganizationSchema = z28.object({
43863
+ id: z28.string(),
43864
+ name: z28.string(),
43865
+ slug: z28.string().nullable().optional(),
43866
+ role: z28.string().optional(),
43560
43867
  /** `true` for the personal organization created at sign-up. */
43561
- personal: z27.boolean().optional()
43868
+ personal: z28.boolean().optional()
43562
43869
  });
43563
- var nexusAccountMeSchema = z27.object({
43870
+ var nexusAccountMeSchema = z28.object({
43564
43871
  user: nexusAccountUserSchema,
43565
- organizations: z27.array(nexusAccountOrganizationSchema).default([])
43872
+ organizations: z28.array(nexusAccountOrganizationSchema).default([])
43566
43873
  });
43567
43874
 
43568
43875
  // packages/contracts/src/nexus-cloud.ts
43569
- import { z as z28 } from "zod";
43876
+ import { z as z29 } from "zod";
43570
43877
  var NEXUS_DEVICE_STATES = ["active", "signed-out", "revoked"];
43571
43878
  var NEXUS_CLOUD_PROFILES = ["device", "read-only"];
43572
43879
  var NEXUS_DEVICE_STATE_UNKNOWN = "unknown";
43573
- var isoTime = z28.iso.datetime({ offset: true });
43574
- var profile = z28.enum(NEXUS_CLOUD_PROFILES).nullable().catch(null);
43575
- var deviceState = z28.enum([...NEXUS_DEVICE_STATES, NEXUS_DEVICE_STATE_UNKNOWN]).catch(NEXUS_DEVICE_STATE_UNKNOWN);
43576
- var nexusCloudCredentialSchema = z28.object({
43577
- kind: z28.enum(["device", "session"]),
43578
- credentialId: z28.string().nullable().optional(),
43880
+ var isoTime = z29.iso.datetime({ offset: true });
43881
+ var profile = z29.enum(NEXUS_CLOUD_PROFILES).nullable().catch(null);
43882
+ var deviceState = z29.enum([...NEXUS_DEVICE_STATES, NEXUS_DEVICE_STATE_UNKNOWN]).catch(NEXUS_DEVICE_STATE_UNKNOWN);
43883
+ var nexusCloudCredentialSchema = z29.object({
43884
+ kind: z29.enum(["device", "session"]),
43885
+ credentialId: z29.string().nullable().optional(),
43579
43886
  profile: profile.optional(),
43580
- scopes: z28.array(z28.string()).default([]),
43887
+ scopes: z29.array(z29.string()).default([]),
43581
43888
  createdAt: isoTime.nullable().optional(),
43582
43889
  lastUsedAt: isoTime.nullable().optional(),
43583
43890
  /** When the credential expires if it is not used again; null for sessions. */
43584
43891
  idleExpiresAt: isoTime.nullable().optional()
43585
43892
  });
43586
- var nexusCloudDeviceSchema = z28.object({
43587
- deviceId: z28.string(),
43588
- name: z28.string(),
43589
- platform: z28.string().optional(),
43590
- arch: z28.string().nullable().optional(),
43591
- cliVersion: z28.string().nullable().optional(),
43893
+ var nexusCloudDeviceSchema = z29.object({
43894
+ deviceId: z29.string(),
43895
+ name: z29.string(),
43896
+ platform: z29.string().optional(),
43897
+ arch: z29.string().nullable().optional(),
43898
+ cliVersion: z29.string().nullable().optional(),
43592
43899
  createdAt: isoTime.optional(),
43593
43900
  lastSeenAt: isoTime.nullable().optional(),
43594
43901
  state: deviceState,
43595
43902
  signedOutAt: isoTime.nullable().optional(),
43596
43903
  /** Base64 device certificate; null until the device holds a key grant. */
43597
- certificate: z28.string().nullable().optional(),
43904
+ certificate: z29.string().nullable().optional(),
43598
43905
  /** The current credential's profile, or null with none (signed out or revoked). */
43599
43906
  profile: profile.optional(),
43600
43907
  /** True for the device whose credential made this request. */
43601
- current: z28.boolean().default(false),
43602
- projects: z28.number().int().nonnegative().optional(),
43603
- replicas: z28.number().int().nonnegative().optional(),
43908
+ current: z29.boolean().default(false),
43909
+ projects: z29.number().int().nonnegative().optional(),
43910
+ replicas: z29.number().int().nonnegative().optional(),
43604
43911
  lastSyncAt: isoTime.nullable().optional(),
43605
43912
  lastPresenceAt: isoTime.nullable().optional()
43606
43913
  });
43607
- var nexusCloudOrganizationSchema = z28.object({
43608
- id: z28.string(),
43609
- name: z28.string(),
43610
- slug: z28.string().nullable().optional(),
43611
- role: z28.string().optional(),
43612
- personal: z28.boolean().optional()
43914
+ var nexusCloudOrganizationSchema = z29.object({
43915
+ id: z29.string(),
43916
+ name: z29.string(),
43917
+ slug: z29.string().nullable().optional(),
43918
+ role: z29.string().optional(),
43919
+ personal: z29.boolean().optional()
43613
43920
  });
43614
- var nexusCloudUserSchema = z28.object({
43615
- id: z28.string(),
43616
- email: z28.string(),
43617
- name: z28.string().nullable().optional()
43921
+ var nexusCloudUserSchema = z29.object({
43922
+ id: z29.string(),
43923
+ email: z29.string(),
43924
+ name: z29.string().nullable().optional()
43618
43925
  });
43619
- var nexusCloudWhoamiSchema = z28.object({
43926
+ var nexusCloudWhoamiSchema = z29.object({
43620
43927
  serverTime: isoTime.optional(),
43621
43928
  user: nexusCloudUserSchema,
43622
- organizations: z28.array(nexusCloudOrganizationSchema).default([]),
43929
+ organizations: z29.array(nexusCloudOrganizationSchema).default([]),
43623
43930
  credential: nexusCloudCredentialSchema,
43624
43931
  /** The calling device; null for a session caller. */
43625
43932
  device: nexusCloudDeviceSchema.nullable()
43626
43933
  });
43627
- var nexusCloudDevicePageSchema = z28.object({
43628
- devices: z28.array(nexusCloudDeviceSchema),
43629
- nextCursor: z28.string().max(512).nullable().default(null),
43630
- truncated: z28.boolean().default(false)
43934
+ var nexusCloudDevicePageSchema = z29.object({
43935
+ devices: z29.array(nexusCloudDeviceSchema),
43936
+ nextCursor: z29.string().max(512).nullable().default(null),
43937
+ truncated: z29.boolean().default(false)
43631
43938
  });
43632
- var nexusCloudPresenceSchema = z28.looseObject({
43939
+ var nexusCloudPresenceSchema = z29.looseObject({
43633
43940
  observedAt: isoTime.optional(),
43634
- sync: z28.object({ enabled: z28.boolean() }).optional()
43941
+ sync: z29.object({ enabled: z29.boolean() }).optional()
43635
43942
  });
43636
- var nexusCloudReplicaSchema = z28.object({
43637
- projectId: z28.string(),
43638
- replicaId: z28.string(),
43639
- deviceId: z28.string(),
43640
- deviceName: z28.string(),
43943
+ var nexusCloudReplicaSchema = z29.object({
43944
+ projectId: z29.string(),
43945
+ replicaId: z29.string(),
43946
+ deviceId: z29.string(),
43947
+ deviceName: z29.string(),
43641
43948
  deviceState: deviceState.optional(),
43642
43949
  attachedAt: isoTime.optional(),
43643
43950
  lastSyncAt: isoTime.nullable(),
@@ -43646,72 +43953,72 @@ var nexusCloudReplicaSchema = z28.object({
43646
43953
  /** When the replica was retired (cleo-nexus T123), else null. Absent from servers older than retirement. */
43647
43954
  retiredAt: isoTime.nullable().optional(),
43648
43955
  /** The retired replica's named successor, else null (not retired, or retired with none). */
43649
- successor: z28.string().nullable().optional()
43956
+ successor: z29.string().nullable().optional()
43650
43957
  });
43651
- var nexusCloudDeviceCountsSchema = z28.object({
43652
- active: z28.number().int().nonnegative(),
43653
- total: z28.number().int().nonnegative()
43958
+ var nexusCloudDeviceCountsSchema = z29.object({
43959
+ active: z29.number().int().nonnegative(),
43960
+ total: z29.number().int().nonnegative()
43654
43961
  });
43655
43962
  var projectFields = {
43656
- projectId: z28.string(),
43657
- label: z28.string().nullable(),
43658
- organizationId: z28.string(),
43659
- organizationName: z28.string().optional(),
43660
- remoteUrl: z28.string().nullable().optional(),
43963
+ projectId: z29.string(),
43964
+ label: z29.string().nullable(),
43965
+ organizationId: z29.string(),
43966
+ organizationName: z29.string().optional(),
43967
+ remoteUrl: z29.string().nullable().optional(),
43661
43968
  createdAt: isoTime.optional()
43662
43969
  };
43663
- var nexusCloudProjectListItemSchema = z28.object({
43970
+ var nexusCloudProjectListItemSchema = z29.object({
43664
43971
  ...projectFields,
43665
- role: z28.string(),
43972
+ role: z29.string(),
43666
43973
  /**
43667
43974
  * The project name sealed with the project data key (`Project.encryptedName`), base64;
43668
43975
  * only a holder of the account key can open it (T13102).
43669
43976
  */
43670
- encryptedName: z28.string().nullable().optional(),
43671
- streamId: z28.string().optional(),
43672
- headSeq: z28.number().int().nonnegative().nullable().optional(),
43977
+ encryptedName: z29.string().nullable().optional(),
43978
+ streamId: z29.string().optional(),
43979
+ headSeq: z29.number().int().nonnegative().nullable().optional(),
43673
43980
  /** The stream's head snapshot; null when nothing was ever pushed (T13102: restorable or not). */
43674
- headCheckpointId: z28.string().nullable().optional(),
43675
- openConflicts: z28.number().int().nonnegative().optional(),
43676
- replicas: z28.array(nexusCloudReplicaSchema).default([]),
43981
+ headCheckpointId: z29.string().nullable().optional(),
43982
+ openConflicts: z29.number().int().nonnegative().optional(),
43983
+ replicas: z29.array(nexusCloudReplicaSchema).default([]),
43677
43984
  devices: nexusCloudDeviceCountsSchema.optional(),
43678
- replicaCount: z28.number().int().nonnegative().optional(),
43985
+ replicaCount: z29.number().int().nonnegative().optional(),
43679
43986
  lastSyncAt: isoTime.nullable().optional(),
43680
43987
  lastPresenceAt: isoTime.nullable().optional(),
43681
43988
  /** This project's replica list was cut at 50 (T12858). */
43682
- replicasTruncated: z28.boolean().default(false)
43989
+ replicasTruncated: z29.boolean().default(false)
43683
43990
  });
43684
- var nexusCloudProjectPageSchema = z28.object({
43685
- projects: z28.array(nexusCloudProjectListItemSchema),
43686
- nextCursor: z28.string().max(512).nullable().default(null),
43991
+ var nexusCloudProjectPageSchema = z29.object({
43992
+ projects: z29.array(nexusCloudProjectListItemSchema),
43993
+ nextCursor: z29.string().max(512).nullable().default(null),
43687
43994
  /** Anything in the page was cut (the project list or a replica list). */
43688
- truncated: z28.boolean().default(false),
43995
+ truncated: z29.boolean().default(false),
43689
43996
  /** The project list itself was cut at 1000 (T12858). */
43690
- projectsTruncated: z28.boolean().default(false)
43997
+ projectsTruncated: z29.boolean().default(false)
43691
43998
  });
43692
- var nexusCloudProjectDetailSchema = z28.object({
43693
- project: z28.object({ ...projectFields, deletedAt: isoTime.nullable().optional() }),
43694
- role: z28.string(),
43695
- canTrash: z28.boolean().optional(),
43696
- openConflicts: z28.number().int().nonnegative(),
43999
+ var nexusCloudProjectDetailSchema = z29.object({
44000
+ project: z29.object({ ...projectFields, deletedAt: isoTime.nullable().optional() }),
44001
+ role: z29.string(),
44002
+ canTrash: z29.boolean().optional(),
44003
+ openConflicts: z29.number().int().nonnegative(),
43697
44004
  /** At most 50, oldest attachment first. */
43698
- replicas: z28.array(nexusCloudReplicaSchema),
44005
+ replicas: z29.array(nexusCloudReplicaSchema),
43699
44006
  devices: nexusCloudDeviceCountsSchema,
43700
- replicaCount: z28.number().int().nonnegative().optional(),
44007
+ replicaCount: z29.number().int().nonnegative().optional(),
43701
44008
  lastSyncAt: isoTime.nullable().optional(),
43702
44009
  /** `replicas` was cut at 50. */
43703
- truncated: z28.boolean().default(false),
43704
- stream: z28.object({
43705
- streamId: z28.string(),
43706
- headSeq: z28.number().int().nonnegative(),
43707
- headCheckpointId: z28.string().nullable()
44010
+ truncated: z29.boolean().default(false),
44011
+ stream: z29.object({
44012
+ streamId: z29.string(),
44013
+ headSeq: z29.number().int().nonnegative(),
44014
+ headCheckpointId: z29.string().nullable()
43708
44015
  }).nullable()
43709
44016
  });
43710
- var nexusCloudReplicaPageSchema = z28.object({
43711
- replicas: z28.array(nexusCloudReplicaSchema),
44017
+ var nexusCloudReplicaPageSchema = z29.object({
44018
+ replicas: z29.array(nexusCloudReplicaSchema),
43712
44019
  devices: nexusCloudDeviceCountsSchema.optional(),
43713
- nextCursor: z28.string().max(512).nullable().default(null),
43714
- truncated: z28.boolean().default(false)
44020
+ nextCursor: z29.string().max(512).nullable().default(null),
44021
+ truncated: z29.boolean().default(false)
43715
44022
  });
43716
44023
  var NEXUS_STATUS_CHECK_IDS = [
43717
44024
  "credential.valid",
@@ -43727,56 +44034,56 @@ var NEXUS_STATUS_CHECK_IDS = [
43727
44034
  ];
43728
44035
  var NEXUS_STATUS_VERDICTS = ["ok", "attention", "not-linked", "not-registered"];
43729
44036
  var CLOUD_STATUS_VERDICTS = [...NEXUS_STATUS_VERDICTS, "not-signed-in"];
43730
- var knownCheckId = z28.enum(NEXUS_STATUS_CHECK_IDS);
43731
- var nexusCloudStatusCheckSchema = z28.object({
43732
- id: z28.enum(NEXUS_STATUS_CHECK_IDS),
43733
- ok: z28.boolean(),
43734
- required: z28.boolean(),
43735
- detail: z28.string()
43736
- });
43737
- var nexusCloudStatusSchema = z28.object({
44037
+ var knownCheckId = z29.enum(NEXUS_STATUS_CHECK_IDS);
44038
+ var nexusCloudStatusCheckSchema = z29.object({
44039
+ id: z29.enum(NEXUS_STATUS_CHECK_IDS),
44040
+ ok: z29.boolean(),
44041
+ required: z29.boolean(),
44042
+ detail: z29.string()
44043
+ });
44044
+ var nexusCloudStatusSchema = z29.object({
43738
44045
  serverTime: isoTime.optional(),
43739
- apiVersion: z28.string().optional(),
44046
+ apiVersion: z29.string().optional(),
43740
44047
  /**
43741
44048
  * Optional server features (e.g. {@link NEXUS_FEATURE_PROJECT_INITIAL_KEY}). Absent from servers older
43742
44049
  * than the list, which therefore support none of them.
43743
44050
  */
43744
- features: z28.array(z28.string()).optional(),
44051
+ features: z29.array(z29.string()).optional(),
43745
44052
  user: nexusCloudUserSchema,
43746
44053
  credential: nexusCloudCredentialSchema,
43747
44054
  device: nexusCloudDeviceSchema.nullable(),
43748
- project: z28.object({
43749
- projectId: z28.string(),
43750
- registered: z28.boolean(),
43751
- organizationId: z28.string().nullable(),
43752
- organizationName: z28.string().nullable(),
43753
- role: z28.string().nullable()
44055
+ project: z29.object({
44056
+ projectId: z29.string(),
44057
+ registered: z29.boolean(),
44058
+ organizationId: z29.string().nullable(),
44059
+ organizationName: z29.string().nullable(),
44060
+ role: z29.string().nullable()
43754
44061
  }).nullable(),
43755
- replica: z28.object({
43756
- replicaId: z28.string(),
43757
- attached: z28.boolean(),
43758
- attachedElsewhere: z28.boolean(),
44062
+ replica: z29.object({
44063
+ replicaId: z29.string(),
44064
+ attached: z29.boolean(),
44065
+ attachedElsewhere: z29.boolean(),
43759
44066
  attachedAt: isoTime.nullable(),
43760
44067
  lastSyncAt: isoTime.nullable(),
43761
44068
  presenceAt: isoTime.nullable(),
43762
- lastReplicaSeq: z28.number().int().nonnegative().nullable().optional()
44069
+ lastReplicaSeq: z29.number().int().nonnegative().nullable().optional()
43763
44070
  }).nullable(),
43764
- stream: z28.object({
43765
- streamId: z28.string(),
43766
- headSeq: z28.number().int().nonnegative(),
43767
- headCheckpointId: z28.string().nullable(),
43768
- openConflicts: z28.number().int().nonnegative(),
44071
+ stream: z29.object({
44072
+ streamId: z29.string(),
44073
+ headSeq: z29.number().int().nonnegative(),
44074
+ headCheckpointId: z29.string().nullable(),
44075
+ openConflicts: z29.number().int().nonnegative(),
43769
44076
  devices: nexusCloudDeviceCountsSchema
43770
44077
  }).nullable(),
43771
44078
  /** Check ids added by a newer server are dropped, never a parse failure. */
43772
- checks: z28.array(nexusCloudStatusCheckSchema.extend({ id: z28.string() })).transform(
44079
+ checks: z29.array(nexusCloudStatusCheckSchema.extend({ id: z29.string() })).transform(
43773
44080
  (list) => list.flatMap((c) => {
43774
44081
  const id = knownCheckId.safeParse(c.id);
43775
44082
  return id.success ? [{ ...c, id: id.data }] : [];
43776
44083
  })
43777
44084
  ),
43778
44085
  /** A verdict added by a newer server reads as `attention`: never `ok` by accident. */
43779
- verdict: z28.enum(NEXUS_STATUS_VERDICTS).catch("attention")
44086
+ verdict: z29.enum(NEXUS_STATUS_VERDICTS).catch("attention")
43780
44087
  });
43781
44088
  var LOGIN = "run `cleo login nexus`";
43782
44089
  var SESSION_EXPIRED_LOGIN = {
@@ -43821,52 +44128,55 @@ var NEXUS_FORBIDDEN_ERRORS = {
43821
44128
  };
43822
44129
 
43823
44130
  // packages/contracts/src/nexus-vault.ts
43824
- import { z as z29 } from "zod";
43825
- var isoTime2 = z29.iso.datetime({ offset: true });
43826
- 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);
43827
- var nexusUserKeysSchema = z29.looseObject({
43828
- keyVersion: z29.number().int().positive(),
43829
- masterKeyVerifier: z29.string()
43830
- });
43831
- var nexusProjectKeysSchema = z29.looseObject({
43832
- keys: z29.array(
43833
- z29.looseObject({ wrappedProjectKey: z29.string(), keyVersion: z29.number().int().positive() })
44131
+ import { z as z30 } from "zod";
44132
+ var isoTime2 = z30.iso.datetime({ offset: true });
44133
+ 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);
44134
+ var nexusUserKeysSchema = z30.looseObject({
44135
+ keyVersion: z30.number().int().positive(),
44136
+ masterKeyVerifier: z30.string()
44137
+ });
44138
+ var nexusProjectKeysSchema = z30.looseObject({
44139
+ keys: z30.array(
44140
+ z30.looseObject({ wrappedProjectKey: z30.string(), keyVersion: z30.number().int().positive() })
43834
44141
  )
43835
44142
  });
43836
- var nexusLeaseSchema = z29.looseObject({
43837
- streamId: z29.string(),
43838
- role: z29.string(),
44143
+ var nexusLeaseSchema = z30.looseObject({
44144
+ streamId: z30.string(),
44145
+ role: z30.string(),
43839
44146
  replicaId: uuid,
43840
44147
  expiresAt: isoTime2,
43841
44148
  forkedFromReplicaId: uuid.nullable().optional()
43842
44149
  });
43843
- var nexusLeaseAcquireSchema = z29.looseObject({ lease: nexusLeaseSchema });
43844
- var nexusStreamHeadSchema = z29.looseObject({
43845
- streamId: z29.string(),
43846
- kind: z29.string().optional(),
43847
- headSeq: z29.number().int().nonnegative(),
43848
- headCheckpointId: z29.string().nullable(),
44150
+ var nexusLeaseAcquireSchema = z30.looseObject({ lease: nexusLeaseSchema });
44151
+ var nexusStreamHeadSchema = z30.looseObject({
44152
+ streamId: z30.string(),
44153
+ kind: z30.string().optional(),
44154
+ headSeq: z30.number().int().nonnegative(),
44155
+ headCheckpointId: z30.string().nullable(),
43849
44156
  /**
43850
44157
  * The highest segment `schemaVersion` the stream holds (the server raises it on every append).
43851
44158
  * Absent from an older server.
43852
44159
  */
43853
- maxSchemaVersion: z29.number().int().nonnegative().optional()
44160
+ maxSchemaVersion: z30.number().int().nonnegative().optional()
43854
44161
  });
43855
- var nexusActivityEventSchema = z29.looseObject({
43856
- id: z29.union([z29.string(), z29.number()]),
44162
+ var nexusActivityEventSchema = z30.looseObject({
44163
+ id: z30.union([z30.string(), z30.number()]),
43857
44164
  at: isoTime2,
43858
- actorUserId: z29.string().nullable().optional(),
43859
- actorDeviceId: z29.string().nullable().optional(),
43860
- requestId: z29.string().nullable().optional(),
43861
- action: z29.string(),
43862
- target: z29.string().nullable().optional(),
43863
- detail: z29.unknown().optional()
44165
+ actorUserId: z30.string().nullable().optional(),
44166
+ actorDeviceId: z30.string().nullable().optional(),
44167
+ requestId: z30.string().nullable().optional(),
44168
+ action: z30.string(),
44169
+ target: z30.string().nullable().optional(),
44170
+ detail: z30.unknown().optional()
43864
44171
  });
43865
- var nexusActivityPageSchema = z29.looseObject({
43866
- events: z29.array(nexusActivityEventSchema),
43867
- nextBefore: z29.union([z29.string(), z29.number()]).nullable().optional()
44172
+ var nexusActivityPageSchema = z30.looseObject({
44173
+ events: z30.array(nexusActivityEventSchema),
44174
+ nextBefore: z30.union([z30.string(), z30.number()]).nullable().optional()
43868
44175
  });
43869
44176
 
44177
+ // packages/adapters/src/providers/claude-sdk/spawn.ts
44178
+ import { E_LEAD_NO_OWNER_CHANNEL as E_LEAD_NO_OWNER_CHANNEL2 } from "@cleocode/contracts/operations/orchestrate.js";
44179
+
43870
44180
  // packages/adapters/src/providers/shared/credentials.ts
43871
44181
  import { existsSync, readFileSync } from "node:fs";
43872
44182
  import { homedir } from "node:os";
@@ -44018,6 +44328,18 @@ var ClaudeSDKSpawnProvider = class {
44018
44328
  const instanceId = `sdk-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
44019
44329
  const sessionId = `cleo-${instanceId}`;
44020
44330
  const startTime = (/* @__PURE__ */ new Date()).toISOString();
44331
+ if (leadDeniedTools(context) !== null && context.options?.leadMode !== "detached") {
44332
+ return {
44333
+ instanceId,
44334
+ taskId: context.taskId,
44335
+ providerId: "claude-sdk",
44336
+ status: "failed",
44337
+ startTime,
44338
+ endTime: (/* @__PURE__ */ new Date()).toISOString(),
44339
+ exitCode: 1,
44340
+ 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`
44341
+ };
44342
+ }
44021
44343
  this.sessions.add({
44022
44344
  instanceId,
44023
44345
  sessionId,