@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
@@ -14474,7 +14474,7 @@ function resolveRef(ref, ctx) {
14474
14474
  function convertBaseSchema(schema, ctx) {
14475
14475
  if (schema.not !== void 0) {
14476
14476
  if (typeof schema.not === "object" && Object.keys(schema.not).length === 0) {
14477
- return z30.never();
14477
+ return z31.never();
14478
14478
  }
14479
14479
  throw new Error("not is not supported in Zod (except { not: {} } for never)");
14480
14480
  }
@@ -14496,7 +14496,7 @@ function convertBaseSchema(schema, ctx) {
14496
14496
  return ctx.refs.get(refPath);
14497
14497
  }
14498
14498
  if (ctx.processing.has(refPath)) {
14499
- return z30.lazy(() => {
14499
+ return z31.lazy(() => {
14500
14500
  if (!ctx.refs.has(refPath)) {
14501
14501
  throw new Error(`Circular reference not resolved: ${refPath}`);
14502
14502
  }
@@ -14513,25 +14513,25 @@ function convertBaseSchema(schema, ctx) {
14513
14513
  if (schema.enum !== void 0) {
14514
14514
  const enumValues = schema.enum;
14515
14515
  if (ctx.version === "openapi-3.0" && schema.nullable === true && enumValues.length === 1 && enumValues[0] === null) {
14516
- return z30.null();
14516
+ return z31.null();
14517
14517
  }
14518
14518
  if (enumValues.length === 0) {
14519
- return z30.never();
14519
+ return z31.never();
14520
14520
  }
14521
14521
  if (enumValues.length === 1) {
14522
- return z30.literal(enumValues[0]);
14522
+ return z31.literal(enumValues[0]);
14523
14523
  }
14524
14524
  if (enumValues.every((v) => typeof v === "string")) {
14525
- return z30.enum(enumValues);
14525
+ return z31.enum(enumValues);
14526
14526
  }
14527
- const literalSchemas = enumValues.map((v) => z30.literal(v));
14527
+ const literalSchemas = enumValues.map((v) => z31.literal(v));
14528
14528
  if (literalSchemas.length < 2) {
14529
14529
  return literalSchemas[0];
14530
14530
  }
14531
- return z30.union([literalSchemas[0], literalSchemas[1], ...literalSchemas.slice(2)]);
14531
+ return z31.union([literalSchemas[0], literalSchemas[1], ...literalSchemas.slice(2)]);
14532
14532
  }
14533
14533
  if (schema.const !== void 0) {
14534
- return z30.literal(schema.const);
14534
+ return z31.literal(schema.const);
14535
14535
  }
14536
14536
  const type = schema.type;
14537
14537
  if (Array.isArray(type)) {
@@ -14540,68 +14540,68 @@ function convertBaseSchema(schema, ctx) {
14540
14540
  return convertBaseSchema(typeSchema, ctx);
14541
14541
  });
14542
14542
  if (typeSchemas.length === 0) {
14543
- return z30.never();
14543
+ return z31.never();
14544
14544
  }
14545
14545
  if (typeSchemas.length === 1) {
14546
14546
  return typeSchemas[0];
14547
14547
  }
14548
- return z30.union(typeSchemas);
14548
+ return z31.union(typeSchemas);
14549
14549
  }
14550
14550
  if (!type) {
14551
- return z30.any();
14551
+ return z31.any();
14552
14552
  }
14553
14553
  let zodSchema2;
14554
14554
  switch (type) {
14555
14555
  case "string": {
14556
- let stringSchema = z30.string();
14556
+ let stringSchema = z31.string();
14557
14557
  if (schema.format) {
14558
14558
  const format = schema.format;
14559
14559
  if (format === "email") {
14560
- stringSchema = stringSchema.check(z30.email());
14560
+ stringSchema = stringSchema.check(z31.email());
14561
14561
  } else if (format === "uri" || format === "uri-reference") {
14562
- stringSchema = stringSchema.check(z30.url());
14562
+ stringSchema = stringSchema.check(z31.url());
14563
14563
  } else if (format === "uuid" || format === "guid") {
14564
- stringSchema = stringSchema.check(z30.uuid());
14564
+ stringSchema = stringSchema.check(z31.uuid());
14565
14565
  } else if (format === "date-time") {
14566
- stringSchema = stringSchema.check(z30.iso.datetime());
14566
+ stringSchema = stringSchema.check(z31.iso.datetime());
14567
14567
  } else if (format === "date") {
14568
- stringSchema = stringSchema.check(z30.iso.date());
14568
+ stringSchema = stringSchema.check(z31.iso.date());
14569
14569
  } else if (format === "time") {
14570
- stringSchema = stringSchema.check(z30.iso.time());
14570
+ stringSchema = stringSchema.check(z31.iso.time());
14571
14571
  } else if (format === "duration") {
14572
- stringSchema = stringSchema.check(z30.iso.duration());
14572
+ stringSchema = stringSchema.check(z31.iso.duration());
14573
14573
  } else if (format === "ipv4") {
14574
- stringSchema = stringSchema.check(z30.ipv4());
14574
+ stringSchema = stringSchema.check(z31.ipv4());
14575
14575
  } else if (format === "ipv6") {
14576
- stringSchema = stringSchema.check(z30.ipv6());
14576
+ stringSchema = stringSchema.check(z31.ipv6());
14577
14577
  } else if (format === "mac") {
14578
- stringSchema = stringSchema.check(z30.mac());
14578
+ stringSchema = stringSchema.check(z31.mac());
14579
14579
  } else if (format === "cidr") {
14580
- stringSchema = stringSchema.check(z30.cidrv4());
14580
+ stringSchema = stringSchema.check(z31.cidrv4());
14581
14581
  } else if (format === "cidr-v6") {
14582
- stringSchema = stringSchema.check(z30.cidrv6());
14582
+ stringSchema = stringSchema.check(z31.cidrv6());
14583
14583
  } else if (format === "base64") {
14584
- stringSchema = stringSchema.check(z30.base64());
14584
+ stringSchema = stringSchema.check(z31.base64());
14585
14585
  } else if (format === "base64url") {
14586
- stringSchema = stringSchema.check(z30.base64url());
14586
+ stringSchema = stringSchema.check(z31.base64url());
14587
14587
  } else if (format === "e164") {
14588
- stringSchema = stringSchema.check(z30.e164());
14588
+ stringSchema = stringSchema.check(z31.e164());
14589
14589
  } else if (format === "jwt") {
14590
- stringSchema = stringSchema.check(z30.jwt());
14590
+ stringSchema = stringSchema.check(z31.jwt());
14591
14591
  } else if (format === "emoji") {
14592
- stringSchema = stringSchema.check(z30.emoji());
14592
+ stringSchema = stringSchema.check(z31.emoji());
14593
14593
  } else if (format === "nanoid") {
14594
- stringSchema = stringSchema.check(z30.nanoid());
14594
+ stringSchema = stringSchema.check(z31.nanoid());
14595
14595
  } else if (format === "cuid") {
14596
- stringSchema = stringSchema.check(z30.cuid());
14596
+ stringSchema = stringSchema.check(z31.cuid());
14597
14597
  } else if (format === "cuid2") {
14598
- stringSchema = stringSchema.check(z30.cuid2());
14598
+ stringSchema = stringSchema.check(z31.cuid2());
14599
14599
  } else if (format === "ulid") {
14600
- stringSchema = stringSchema.check(z30.ulid());
14600
+ stringSchema = stringSchema.check(z31.ulid());
14601
14601
  } else if (format === "xid") {
14602
- stringSchema = stringSchema.check(z30.xid());
14602
+ stringSchema = stringSchema.check(z31.xid());
14603
14603
  } else if (format === "ksuid") {
14604
- stringSchema = stringSchema.check(z30.ksuid());
14604
+ stringSchema = stringSchema.check(z31.ksuid());
14605
14605
  }
14606
14606
  }
14607
14607
  if (typeof schema.minLength === "number") {
@@ -14618,7 +14618,7 @@ function convertBaseSchema(schema, ctx) {
14618
14618
  }
14619
14619
  case "number":
14620
14620
  case "integer": {
14621
- let numberSchema = type === "integer" ? z30.number().int() : z30.number();
14621
+ let numberSchema = type === "integer" ? z31.number().int() : z31.number();
14622
14622
  if (typeof schema.minimum === "number") {
14623
14623
  numberSchema = numberSchema.min(schema.minimum);
14624
14624
  }
@@ -14642,11 +14642,11 @@ function convertBaseSchema(schema, ctx) {
14642
14642
  break;
14643
14643
  }
14644
14644
  case "boolean": {
14645
- zodSchema2 = z30.boolean();
14645
+ zodSchema2 = z31.boolean();
14646
14646
  break;
14647
14647
  }
14648
14648
  case "null": {
14649
- zodSchema2 = z30.null();
14649
+ zodSchema2 = z31.null();
14650
14650
  break;
14651
14651
  }
14652
14652
  case "object": {
@@ -14659,14 +14659,14 @@ function convertBaseSchema(schema, ctx) {
14659
14659
  }
14660
14660
  if (schema.propertyNames) {
14661
14661
  const keySchema = convertSchema(schema.propertyNames, ctx);
14662
- const valueSchema = schema.additionalProperties && typeof schema.additionalProperties === "object" ? convertSchema(schema.additionalProperties, ctx) : z30.any();
14662
+ const valueSchema = schema.additionalProperties && typeof schema.additionalProperties === "object" ? convertSchema(schema.additionalProperties, ctx) : z31.any();
14663
14663
  if (Object.keys(shape).length === 0) {
14664
- zodSchema2 = z30.record(keySchema, valueSchema);
14664
+ zodSchema2 = z31.record(keySchema, valueSchema);
14665
14665
  break;
14666
14666
  }
14667
- const objectSchema2 = z30.object(shape).passthrough();
14668
- const recordSchema = z30.looseRecord(keySchema, valueSchema);
14669
- zodSchema2 = z30.intersection(objectSchema2, recordSchema);
14667
+ const objectSchema2 = z31.object(shape).passthrough();
14668
+ const recordSchema = z31.looseRecord(keySchema, valueSchema);
14669
+ zodSchema2 = z31.intersection(objectSchema2, recordSchema);
14670
14670
  break;
14671
14671
  }
14672
14672
  if (schema.patternProperties) {
@@ -14675,28 +14675,28 @@ function convertBaseSchema(schema, ctx) {
14675
14675
  const looseRecords = [];
14676
14676
  for (const pattern of patternKeys) {
14677
14677
  const patternValue = convertSchema(patternProps[pattern], ctx);
14678
- const keySchema = z30.string().regex(new RegExp(pattern));
14679
- looseRecords.push(z30.looseRecord(keySchema, patternValue));
14678
+ const keySchema = z31.string().regex(new RegExp(pattern));
14679
+ looseRecords.push(z31.looseRecord(keySchema, patternValue));
14680
14680
  }
14681
14681
  const schemasToIntersect = [];
14682
14682
  if (Object.keys(shape).length > 0) {
14683
- schemasToIntersect.push(z30.object(shape).passthrough());
14683
+ schemasToIntersect.push(z31.object(shape).passthrough());
14684
14684
  }
14685
14685
  schemasToIntersect.push(...looseRecords);
14686
14686
  if (schemasToIntersect.length === 0) {
14687
- zodSchema2 = z30.object({}).passthrough();
14687
+ zodSchema2 = z31.object({}).passthrough();
14688
14688
  } else if (schemasToIntersect.length === 1) {
14689
14689
  zodSchema2 = schemasToIntersect[0];
14690
14690
  } else {
14691
- let result = z30.intersection(schemasToIntersect[0], schemasToIntersect[1]);
14691
+ let result = z31.intersection(schemasToIntersect[0], schemasToIntersect[1]);
14692
14692
  for (let i = 2; i < schemasToIntersect.length; i++) {
14693
- result = z30.intersection(result, schemasToIntersect[i]);
14693
+ result = z31.intersection(result, schemasToIntersect[i]);
14694
14694
  }
14695
14695
  zodSchema2 = result;
14696
14696
  }
14697
14697
  break;
14698
14698
  }
14699
- const objectSchema = z30.object(shape);
14699
+ const objectSchema = z31.object(shape);
14700
14700
  if (schema.additionalProperties === false) {
14701
14701
  zodSchema2 = objectSchema.strict();
14702
14702
  } else if (typeof schema.additionalProperties === "object") {
@@ -14713,33 +14713,33 @@ function convertBaseSchema(schema, ctx) {
14713
14713
  const tupleItems = prefixItems.map((item) => convertSchema(item, ctx));
14714
14714
  const rest = items && typeof items === "object" && !Array.isArray(items) ? convertSchema(items, ctx) : void 0;
14715
14715
  if (rest) {
14716
- zodSchema2 = z30.tuple(tupleItems).rest(rest);
14716
+ zodSchema2 = z31.tuple(tupleItems).rest(rest);
14717
14717
  } else {
14718
- zodSchema2 = z30.tuple(tupleItems);
14718
+ zodSchema2 = z31.tuple(tupleItems);
14719
14719
  }
14720
14720
  if (typeof schema.minItems === "number") {
14721
- zodSchema2 = zodSchema2.check(z30.minLength(schema.minItems));
14721
+ zodSchema2 = zodSchema2.check(z31.minLength(schema.minItems));
14722
14722
  }
14723
14723
  if (typeof schema.maxItems === "number") {
14724
- zodSchema2 = zodSchema2.check(z30.maxLength(schema.maxItems));
14724
+ zodSchema2 = zodSchema2.check(z31.maxLength(schema.maxItems));
14725
14725
  }
14726
14726
  } else if (Array.isArray(items)) {
14727
14727
  const tupleItems = items.map((item) => convertSchema(item, ctx));
14728
14728
  const rest = schema.additionalItems && typeof schema.additionalItems === "object" ? convertSchema(schema.additionalItems, ctx) : void 0;
14729
14729
  if (rest) {
14730
- zodSchema2 = z30.tuple(tupleItems).rest(rest);
14730
+ zodSchema2 = z31.tuple(tupleItems).rest(rest);
14731
14731
  } else {
14732
- zodSchema2 = z30.tuple(tupleItems);
14732
+ zodSchema2 = z31.tuple(tupleItems);
14733
14733
  }
14734
14734
  if (typeof schema.minItems === "number") {
14735
- zodSchema2 = zodSchema2.check(z30.minLength(schema.minItems));
14735
+ zodSchema2 = zodSchema2.check(z31.minLength(schema.minItems));
14736
14736
  }
14737
14737
  if (typeof schema.maxItems === "number") {
14738
- zodSchema2 = zodSchema2.check(z30.maxLength(schema.maxItems));
14738
+ zodSchema2 = zodSchema2.check(z31.maxLength(schema.maxItems));
14739
14739
  }
14740
14740
  } else if (items !== void 0) {
14741
14741
  const element = convertSchema(items, ctx);
14742
- let arraySchema = z30.array(element);
14742
+ let arraySchema = z31.array(element);
14743
14743
  if (typeof schema.minItems === "number") {
14744
14744
  arraySchema = arraySchema.min(schema.minItems);
14745
14745
  }
@@ -14748,7 +14748,7 @@ function convertBaseSchema(schema, ctx) {
14748
14748
  }
14749
14749
  zodSchema2 = arraySchema;
14750
14750
  } else {
14751
- zodSchema2 = z30.array(z30.any());
14751
+ zodSchema2 = z31.array(z31.any());
14752
14752
  }
14753
14753
  break;
14754
14754
  }
@@ -14765,37 +14765,37 @@ function convertBaseSchema(schema, ctx) {
14765
14765
  }
14766
14766
  function convertSchema(schema, ctx) {
14767
14767
  if (typeof schema === "boolean") {
14768
- return schema ? z30.any() : z30.never();
14768
+ return schema ? z31.any() : z31.never();
14769
14769
  }
14770
14770
  let baseSchema = convertBaseSchema(schema, ctx);
14771
14771
  const hasExplicitType = schema.type || schema.enum !== void 0 || schema.const !== void 0;
14772
14772
  if (schema.anyOf && Array.isArray(schema.anyOf)) {
14773
14773
  const options = schema.anyOf.map((s) => convertSchema(s, ctx));
14774
- const anyOfUnion = z30.union(options);
14775
- baseSchema = hasExplicitType ? z30.intersection(baseSchema, anyOfUnion) : anyOfUnion;
14774
+ const anyOfUnion = z31.union(options);
14775
+ baseSchema = hasExplicitType ? z31.intersection(baseSchema, anyOfUnion) : anyOfUnion;
14776
14776
  }
14777
14777
  if (schema.oneOf && Array.isArray(schema.oneOf)) {
14778
14778
  const options = schema.oneOf.map((s) => convertSchema(s, ctx));
14779
- const oneOfUnion = z30.xor(options);
14780
- baseSchema = hasExplicitType ? z30.intersection(baseSchema, oneOfUnion) : oneOfUnion;
14779
+ const oneOfUnion = z31.xor(options);
14780
+ baseSchema = hasExplicitType ? z31.intersection(baseSchema, oneOfUnion) : oneOfUnion;
14781
14781
  }
14782
14782
  if (schema.allOf && Array.isArray(schema.allOf)) {
14783
14783
  if (schema.allOf.length === 0) {
14784
- baseSchema = hasExplicitType ? baseSchema : z30.any();
14784
+ baseSchema = hasExplicitType ? baseSchema : z31.any();
14785
14785
  } else {
14786
14786
  let result = hasExplicitType ? baseSchema : convertSchema(schema.allOf[0], ctx);
14787
14787
  const startIdx = hasExplicitType ? 0 : 1;
14788
14788
  for (let i = startIdx; i < schema.allOf.length; i++) {
14789
- result = z30.intersection(result, convertSchema(schema.allOf[i], ctx));
14789
+ result = z31.intersection(result, convertSchema(schema.allOf[i], ctx));
14790
14790
  }
14791
14791
  baseSchema = result;
14792
14792
  }
14793
14793
  }
14794
14794
  if (schema.nullable === true && ctx.version === "openapi-3.0") {
14795
- baseSchema = z30.nullable(baseSchema);
14795
+ baseSchema = z31.nullable(baseSchema);
14796
14796
  }
14797
14797
  if (schema.readOnly === true) {
14798
- baseSchema = z30.readonly(baseSchema);
14798
+ baseSchema = z31.readonly(baseSchema);
14799
14799
  }
14800
14800
  const extraMeta = {};
14801
14801
  const coreMetadataKeys = ["$id", "id", "$comment", "$anchor", "$vocabulary", "$dynamicRef", "$dynamicAnchor"];
@@ -14822,7 +14822,7 @@ function convertSchema(schema, ctx) {
14822
14822
  }
14823
14823
  function fromJSONSchema(schema, params) {
14824
14824
  if (typeof schema === "boolean") {
14825
- return schema ? z30.any() : z30.never();
14825
+ return schema ? z31.any() : z31.never();
14826
14826
  }
14827
14827
  const version2 = detectVersion(schema, params?.defaultTarget);
14828
14828
  const defs = schema.$defs || schema.definitions || {};
@@ -14836,14 +14836,14 @@ function fromJSONSchema(schema, params) {
14836
14836
  };
14837
14837
  return convertSchema(schema, ctx);
14838
14838
  }
14839
- var z30, RECOGNIZED_KEYS;
14839
+ var z31, RECOGNIZED_KEYS;
14840
14840
  var init_from_json_schema = __esm({
14841
14841
  "node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/from-json-schema.js"() {
14842
14842
  init_registries();
14843
14843
  init_checks2();
14844
14844
  init_iso();
14845
14845
  init_schemas2();
14846
- z30 = {
14846
+ z31 = {
14847
14847
  ...schemas_exports2,
14848
14848
  ...checks_exports2,
14849
14849
  iso: iso_exports
@@ -26401,17 +26401,321 @@ var ChangesetEntrySchema = z3.object({
26401
26401
  });
26402
26402
 
26403
26403
  // packages/contracts/src/config/manifest.ts
26404
- import { z as z5 } from "zod";
26404
+ import { z as z6 } from "zod";
26405
26405
 
26406
- // packages/contracts/src/config/worker-policy.ts
26406
+ // packages/contracts/src/orca-execution.ts
26407
26407
  import { z as z4 } from "zod";
26408
- var projectWorkerPolicySchema = z4.object({
26409
- verification: z4.object({
26410
- full: z4.enum(["local", "ci"]),
26411
- local: z4.enum(["single-file", "affected"])
26408
+ var identifier = z4.string().min(1);
26409
+ var orcaAgentSchema = z4.enum(["codex", "opencode2", "claude", "grok"]);
26410
+ var DEFAULT_ORCA_AGENTS = ["codex", "opencode2", "claude"];
26411
+ var orchestrateOrcaConfigSchema = z4.object({
26412
+ agents: z4.array(orcaAgentSchema).min(1).refine((agents) => new Set(agents).size === agents.length, "Agent ids must be unique.").default(DEFAULT_ORCA_AGENTS)
26413
+ });
26414
+ var orcaContextSchema = z4.object({
26415
+ runtimeId: identifier,
26416
+ coordinatorHandle: identifier,
26417
+ executionHostId: z4.literal("local")
26418
+ });
26419
+ var orcaRoutingRunSchema = z4.object({
26420
+ runId: identifier.nullable(),
26421
+ unconfiguredAgents: z4.array(orcaAgentSchema)
26422
+ });
26423
+ var orcaLaunchSchema = z4.object({
26424
+ projectId: identifier,
26425
+ projectRoot: identifier,
26426
+ taskId: identifier,
26427
+ instanceId: identifier,
26428
+ workerSessionId: identifier,
26429
+ agentId: identifier,
26430
+ role: z4.enum(["worker", "lead"]),
26431
+ protocol: identifier,
26432
+ worktreePath: identifier,
26433
+ worktreeBranch: identifier,
26434
+ projectHash: identifier,
26435
+ lockToken: identifier,
26436
+ prompt: identifier,
26437
+ harness: z4.enum(["claude-code", "codex", "opencode", "grok", "kimi"]),
26438
+ leadMailbox: identifier.nullable(),
26439
+ model: identifier.optional(),
26440
+ effort: identifier.optional(),
26441
+ accountId: identifier.optional()
26442
+ });
26443
+ var orcaStartBindingSchema = z4.object({
26444
+ runId: identifier.nullable(),
26445
+ orcaTaskId: identifier.nullable(),
26446
+ retryOf: identifier.nullable()
26447
+ });
26448
+ var orcaAttemptSchema = z4.object({
26449
+ backend: z4.literal("orca"),
26450
+ version: z4.literal(1),
26451
+ /** Monotonic local CAS revision; repeated identical observations still serialize. */
26452
+ revision: z4.number().int().nonnegative(),
26453
+ context: orcaContextSchema,
26454
+ launch: orcaLaunchSchema,
26455
+ promptDigest: z4.string().regex(/^[a-f0-9]{64}$/),
26456
+ workspaceId: identifier,
26457
+ workspaceSelector: identifier,
26458
+ state: z4.enum([
26459
+ "prepared",
26460
+ "launching",
26461
+ "ready",
26462
+ "turn_unobserved",
26463
+ "outcome_unknown",
26464
+ "stop_pending",
26465
+ "stop_unknown",
26466
+ "stopped",
26467
+ "failed",
26468
+ "circuit_broken"
26469
+ ]),
26470
+ runId: identifier.nullable(),
26471
+ orcaTaskId: identifier.nullable(),
26472
+ dispatchId: identifier.nullable(),
26473
+ retryOf: identifier.nullable(),
26474
+ /** Absent on legacy records, whose original argv cannot safely be reconstructed. */
26475
+ startBinding: orcaStartBindingSchema.optional(),
26476
+ /** UUID reserved before committing a retry; its first send and every replay use this key. */
26477
+ startRequestKey: z4.string().uuid().optional(),
26478
+ startRequestId: identifier.nullable(),
26479
+ /** UUID reserved before committing a stop; its first send and every replay use this key. */
26480
+ stopRequestKey: z4.string().uuid().optional(),
26481
+ /** Orca-issued stop request id, retained only when the stop receipt was received. */
26482
+ stopRequestId: identifier.nullable(),
26483
+ /**
26484
+ * Set when the worker-stop reply came from a runtime that proved it enumerates
26485
+ * every helper it stopped, so an omitted helper list means the worker had none.
26486
+ */
26487
+ stopHelperEvidence: z4.literal("enumerated").optional(),
26488
+ failureCount: z4.number().int().nonnegative(),
26489
+ resourceState: z4.string(),
26490
+ /** Full receipts retain effects, residual resources and recovery advice. */
26491
+ lastReceipt: z4.string().nullable(),
26492
+ lastError: z4.string().nullable(),
26493
+ /** Confirmed pre-dispatch refusal; never inferred from a process exit. */
26494
+ startRefusal: z4.literal("agent_unconfigured").optional(),
26495
+ observedAt: z4.string()
26496
+ });
26497
+ var orcaWorkerDoneSchema = z4.object({
26498
+ messageId: identifier,
26499
+ runtimeId: identifier,
26500
+ runId: identifier,
26501
+ orcaTaskId: identifier,
26502
+ dispatchId: identifier,
26503
+ senderHandle: identifier,
26504
+ outcome: z4.enum(["succeeded", "failed"]),
26505
+ body: z4.string(),
26506
+ reportPath: identifier
26507
+ });
26508
+ var orcaWorkerReportSchema = z4.object({
26509
+ event: orcaWorkerDoneSchema,
26510
+ manifestId: identifier,
26511
+ manifestDigest: z4.string().regex(/^[a-f0-9]{64}$/),
26512
+ reportText: z4.string().min(1).max(65536),
26513
+ reportDigest: z4.string().regex(/^[a-f0-9]{64}$/),
26514
+ ingestedAt: z4.string().datetime()
26515
+ });
26516
+ var orcaReportDeliverySchema = z4.object({
26517
+ key: identifier,
26518
+ mailbox: identifier.nullable(),
26519
+ state: z4.enum(["pending", "delivered"]),
26520
+ messageId: identifier.nullable(),
26521
+ deliveredAt: z4.string().datetime().nullable(),
26522
+ lastError: z4.string().nullable()
26523
+ });
26524
+ var orcaWorkerSettlementSchema = z4.object({
26525
+ resourceRelease: z4.object({
26526
+ dispatchId: identifier,
26527
+ releasedAt: z4.string().datetime(),
26528
+ receiptDigest: z4.string().regex(/^[a-f0-9]{64}$/),
26529
+ receipt: identifier
26530
+ }).optional(),
26531
+ retiredAt: z4.string().datetime().optional(),
26532
+ reportDelivery: orcaReportDeliverySchema.optional()
26533
+ });
26534
+ var orcaReportMessageSchema = z4.object({
26535
+ id: identifier,
26536
+ run_id: z4.string().nullable(),
26537
+ delivery_contract: z4.string(),
26538
+ from_handle: z4.string(),
26539
+ to_handle: z4.string(),
26540
+ type: z4.string(),
26541
+ body: z4.string(),
26542
+ payload: z4.string().nullable(),
26543
+ sender_pane_key: z4.string().nullable()
26544
+ });
26545
+ var orcaReportSourceSchema = z4.object({
26546
+ ok: z4.literal(true),
26547
+ _meta: z4.object({ runtimeId: identifier }),
26548
+ result: z4.object({
26549
+ messages: z4.array(z4.json()).optional(),
26550
+ dispatch: z4.object({
26551
+ id: identifier,
26552
+ run_id: identifier,
26553
+ task_id: identifier,
26554
+ assignee_handle: identifier,
26555
+ assignee_pane_key: z4.string().nullable(),
26556
+ status: z4.string()
26557
+ }).optional()
26558
+ })
26559
+ });
26560
+ var orcaWorkerDonePayloadSchema = z4.object({
26561
+ taskId: identifier,
26562
+ dispatchId: identifier,
26563
+ outcome: z4.enum(["succeeded", "failed"]),
26564
+ reportPath: identifier
26565
+ });
26566
+ var orcaWorkerRequestSchema = z4.object({
26567
+ action: z4.enum([
26568
+ "show",
26569
+ "read",
26570
+ "recover-start",
26571
+ "recover-stop",
26572
+ "retry",
26573
+ "stop",
26574
+ "ingest-report",
26575
+ "relay-report"
26576
+ ]),
26577
+ recordId: identifier,
26578
+ cursor: identifier.optional(),
26579
+ messageId: identifier.optional()
26580
+ }).refine(({ action, cursor }) => cursor === void 0 || action === "read", {
26581
+ message: "A source-pinned cursor is accepted only for read.",
26582
+ path: ["cursor"]
26583
+ }).refine(({ action, messageId }) => action === "ingest-report" === (messageId !== void 0), {
26584
+ message: "ingest-report requires an exact message id; other actions do not accept one.",
26585
+ path: ["messageId"]
26586
+ });
26587
+ var effectSchema = z4.object({
26588
+ kind: z4.string(),
26589
+ role: z4.string().optional(),
26590
+ action: z4.string().optional(),
26591
+ id: z4.string().optional()
26592
+ });
26593
+ var selectionSchema = z4.object({
26594
+ agent: z4.string().nullable().optional(),
26595
+ model: z4.string().nullable().optional(),
26596
+ effort: z4.string().nullable().optional()
26597
+ });
26598
+ var orcaReplySchema = z4.object({
26599
+ ok: z4.boolean(),
26600
+ _meta: z4.object({ runtimeId: z4.string().nullable() }).optional(),
26601
+ error: z4.object({
26602
+ code: z4.string(),
26603
+ message: z4.string(),
26604
+ data: z4.object({
26605
+ requestId: identifier.optional(),
26606
+ orchestrationRequestId: identifier.optional(),
26607
+ dispatchId: identifier.optional()
26608
+ }).optional()
26609
+ }).optional(),
26610
+ result: z4.object({
26611
+ state: z4.string().optional(),
26612
+ requestId: identifier.optional(),
26613
+ /**
26614
+ * Mutation ledger identity Orca stamps on every successful mutation result.
26615
+ * @remarks Installed Orca 1.4.255 attaches `{ requestId, replayed }` to the
26616
+ * result it records (`Jy` in the retained source), so a successful stop can
26617
+ * be bound to the request key this attempt issued.
26618
+ */
26619
+ mutation: z4.object({
26620
+ requestId: identifier.optional(),
26621
+ replayed: z4.boolean().optional()
26622
+ }).optional(),
26623
+ stage: z4.string().optional(),
26624
+ turnStart: z4.string().optional(),
26625
+ runId: identifier.optional(),
26626
+ run: z4.object({ id: identifier }).nullable().optional(),
26627
+ taskId: identifier.optional(),
26628
+ dispatchId: identifier.optional(),
26629
+ failureCount: z4.number().int().nonnegative().optional(),
26630
+ effects: z4.array(effectSchema).optional(),
26631
+ residualResources: z4.array(effectSchema).optional(),
26632
+ launch: z4.object({ effective: selectionSchema.optional() }).optional(),
26633
+ lastError: z4.string().nullable().optional(),
26634
+ processAction: z4.string().optional(),
26635
+ helpers: z4.array(
26636
+ z4.object({
26637
+ dispatchId: identifier.optional(),
26638
+ creatorDispatchId: identifier.optional(),
26639
+ outcome: z4.string(),
26640
+ keptOpenBy: identifier.optional(),
26641
+ state: z4.string().optional(),
26642
+ lastError: z4.string().nullable().optional()
26643
+ })
26644
+ ).optional(),
26645
+ helperStopError: z4.string().nullable().optional(),
26646
+ status: z4.string().optional(),
26647
+ terminal: z4.object({
26648
+ handle: identifier,
26649
+ connected: z4.boolean(),
26650
+ writable: z4.boolean(),
26651
+ executionHostId: identifier
26652
+ }).optional(),
26653
+ runtime: z4.object({
26654
+ runtimeId: identifier,
26655
+ reachable: z4.boolean(),
26656
+ state: z4.string(),
26657
+ capabilities: z4.array(z4.string())
26658
+ }).optional(),
26659
+ worktree: z4.object({
26660
+ id: identifier,
26661
+ path: identifier,
26662
+ branch: identifier,
26663
+ hostId: identifier,
26664
+ address: z4.object({ worktree: identifier }).optional()
26665
+ }).optional(),
26666
+ dispatch: z4.object({
26667
+ id: identifier,
26668
+ runId: identifier,
26669
+ taskId: identifier,
26670
+ /** Direct creator Dispatch that started this one; null for a Run root. */
26671
+ creatorDispatchId: identifier.nullable().optional(),
26672
+ failureCount: z4.number().int().nonnegative()
26673
+ }).optional(),
26674
+ worker: z4.object({
26675
+ dispatchId: identifier,
26676
+ runtimeEpoch: identifier,
26677
+ state: z4.string(),
26678
+ stage: z4.string(),
26679
+ worktreeId: identifier.nullable()
26680
+ }).optional(),
26681
+ observation: z4.object({ status: z4.string(), exactWorker: z4.boolean().optional() }).optional(),
26682
+ projection: z4.object({
26683
+ resource: z4.object({
26684
+ state: z4.string(),
26685
+ terminalState: z4.string(),
26686
+ ownerDispatchId: identifier.optional(),
26687
+ releaseState: z4.string().optional()
26688
+ }).optional()
26689
+ }).optional()
26690
+ }).optional()
26691
+ });
26692
+ var orcaCommandRegistrySchema = z4.object({
26693
+ schemaVersion: z4.number().int().positive(),
26694
+ commands: z4.array(z4.object({ command: identifier, flags: z4.array(z4.string()) }))
26695
+ });
26696
+ var accountProviderSchema = z4.object({
26697
+ accounts: z4.array(z4.object({})),
26698
+ activeAccountId: identifier.nullable()
26699
+ });
26700
+ var orcaAccountReplySchema = z4.object({
26701
+ ok: z4.literal(true),
26702
+ _meta: z4.object({ runtimeId: identifier }),
26703
+ result: z4.object({
26704
+ codex: accountProviderSchema,
26705
+ opencode: accountProviderSchema,
26706
+ claude: accountProviderSchema
26707
+ })
26708
+ });
26709
+
26710
+ // packages/contracts/src/config/worker-policy.ts
26711
+ import { z as z5 } from "zod";
26712
+ var projectWorkerPolicySchema = z5.object({
26713
+ verification: z5.object({
26714
+ full: z5.enum(["local", "ci"]),
26715
+ local: z5.enum(["single-file", "affected"])
26412
26716
  }).strict().optional(),
26413
- instructions: z4.array(
26414
- z4.string().min(1).max(512).regex(/\S/).regex(
26717
+ instructions: z5.array(
26718
+ z5.string().min(1).max(512).regex(/\S/).regex(
26415
26719
  /^(?!\s*#)[^\p{Cc}\p{Cf}\p{Zl}\p{Zp}]+$/u,
26416
26720
  "Instructions must be single-line text without control characters or a leading #"
26417
26721
  )
@@ -26439,8 +26743,11 @@ var CLEO_CONFIG_MANIFEST = {
26439
26743
  path: ".cleo/config.json",
26440
26744
  mergePrecedence: 20,
26441
26745
  driftDetection: "schema-validate",
26442
- schema: z5.object({
26443
- orchestrate: z5.object({ workerPolicy: projectWorkerPolicySchema.optional() }).passthrough().optional()
26746
+ schema: z6.object({
26747
+ orchestrate: z6.object({
26748
+ workerPolicy: projectWorkerPolicySchema.optional(),
26749
+ orca: orchestrateOrcaConfigSchema.optional()
26750
+ }).passthrough().optional()
26444
26751
  }).passthrough()
26445
26752
  };
26446
26753
  var GLOBAL_CLEO_CONFIG_MANIFEST = {
@@ -26456,139 +26763,139 @@ var CONFIG_MANIFEST_ENTRIES = Object.freeze([
26456
26763
  GLOBAL_CLEO_CONFIG_MANIFEST,
26457
26764
  CLEO_CONFIG_MANIFEST
26458
26765
  ]);
26459
- var configManifestEntrySchema = z5.object({
26460
- id: z5.string().min(1),
26461
- scope: z5.union([z5.literal("global"), z5.literal("project"), z5.literal("metadata")]),
26462
- path: z5.string().min(1),
26463
- schema: z5.unknown().optional(),
26464
- mergePrecedence: z5.number().int().nonnegative(),
26465
- driftDetection: z5.union([
26466
- z5.literal("schema-validate"),
26467
- z5.literal("staleness-gate"),
26468
- z5.literal("value-diff"),
26469
- z5.literal("none")
26766
+ var configManifestEntrySchema = z6.object({
26767
+ id: z6.string().min(1),
26768
+ scope: z6.union([z6.literal("global"), z6.literal("project"), z6.literal("metadata")]),
26769
+ path: z6.string().min(1),
26770
+ schema: z6.unknown().optional(),
26771
+ mergePrecedence: z6.number().int().nonnegative(),
26772
+ driftDetection: z6.union([
26773
+ z6.literal("schema-validate"),
26774
+ z6.literal("staleness-gate"),
26775
+ z6.literal("value-diff"),
26776
+ z6.literal("none")
26470
26777
  ]),
26471
- defaults: z5.record(z5.string(), z5.unknown()).optional()
26778
+ defaults: z6.record(z6.string(), z6.unknown()).optional()
26472
26779
  });
26473
26780
 
26474
26781
  // packages/contracts/src/daemon/health.ts
26475
- import { z as z7 } from "zod";
26782
+ import { z as z8 } from "zod";
26476
26783
 
26477
26784
  // packages/contracts/src/supervisor-ipc/messages.ts
26478
- import { z as z6 } from "zod";
26479
- var EnvPairSchema = z6.object({
26785
+ import { z as z7 } from "zod";
26786
+ var EnvPairSchema = z7.object({
26480
26787
  /** Environment variable name. */
26481
- key: z6.string().min(1),
26788
+ key: z7.string().min(1),
26482
26789
  /** Environment variable value. */
26483
- value: z6.string()
26790
+ value: z7.string()
26484
26791
  }).strict();
26485
- var ChildStateSchema = z6.enum(["running", "restarting", "stopped"]);
26486
- var ChildStatusSchema = z6.object({
26792
+ var ChildStateSchema = z7.enum(["running", "restarting", "stopped"]);
26793
+ var ChildStatusSchema = z7.object({
26487
26794
  /** Logical id of the child (stable across restarts). */
26488
- child_id: z6.string().min(1),
26795
+ child_id: z7.string().min(1),
26489
26796
  /** Current OS pid (0 when not currently running). */
26490
- pid: z6.number().int().nonnegative(),
26797
+ pid: z7.number().int().nonnegative(),
26491
26798
  /** Current liveness state. */
26492
26799
  state: ChildStateSchema,
26493
26800
  /** Total restarts observed for this child. */
26494
- restart_count: z6.number().int().nonnegative()
26801
+ restart_count: z7.number().int().nonnegative()
26495
26802
  }).strict();
26496
- var SpawnRequestSchema = z6.object({
26803
+ var SpawnRequestSchema = z7.object({
26497
26804
  /** Tag discriminating this request variant. */
26498
- kind: z6.literal("spawn"),
26805
+ kind: z7.literal("spawn"),
26499
26806
  /** Caller-chosen logical id for the child (stable across restarts). */
26500
- child_id: z6.string().min(1),
26807
+ child_id: z7.string().min(1),
26501
26808
  /** Absolute path to the program to execute. */
26502
- program: z6.string().min(1),
26809
+ program: z7.string().min(1),
26503
26810
  /** Arguments passed to the program. */
26504
- args: z6.array(z6.string()).default([]),
26811
+ args: z7.array(z7.string()).default([]),
26505
26812
  /** Environment overrides applied on top of the supervisor's environment. */
26506
- env: z6.array(EnvPairSchema).default([]),
26813
+ env: z7.array(EnvPairSchema).default([]),
26507
26814
  /** Optional working directory for the child. */
26508
- cwd: z6.string().optional()
26815
+ cwd: z7.string().optional()
26509
26816
  }).strict();
26510
- var RestartRequestSchema = z6.object({
26817
+ var RestartRequestSchema = z7.object({
26511
26818
  /** Tag discriminating this request variant. */
26512
- kind: z6.literal("restart"),
26819
+ kind: z7.literal("restart"),
26513
26820
  /** Logical id of the child to restart. */
26514
- child_id: z6.string().min(1)
26821
+ child_id: z7.string().min(1)
26515
26822
  }).strict();
26516
- var MonitorRequestSchema = z6.object({
26823
+ var MonitorRequestSchema = z7.object({
26517
26824
  /** Tag discriminating this request variant. */
26518
- kind: z6.literal("monitor"),
26825
+ kind: z7.literal("monitor"),
26519
26826
  /** Specific child id to monitor; omit to request all children. */
26520
- child_id: z6.string().optional()
26827
+ child_id: z7.string().optional()
26521
26828
  }).strict();
26522
- var HealthRequestSchema = z6.object({
26829
+ var HealthRequestSchema = z7.object({
26523
26830
  /** Tag discriminating this request variant. */
26524
- kind: z6.literal("health")
26831
+ kind: z7.literal("health")
26525
26832
  }).strict();
26526
- var SupervisorIpcRequestSchema = z6.discriminatedUnion("kind", [
26833
+ var SupervisorIpcRequestSchema = z7.discriminatedUnion("kind", [
26527
26834
  SpawnRequestSchema,
26528
26835
  RestartRequestSchema,
26529
26836
  MonitorRequestSchema,
26530
26837
  HealthRequestSchema
26531
26838
  ]);
26532
- var SpawnedResponseSchema = z6.object({
26839
+ var SpawnedResponseSchema = z7.object({
26533
26840
  /** Tag discriminating this response variant. */
26534
- kind: z6.literal("spawned"),
26841
+ kind: z7.literal("spawned"),
26535
26842
  /** Logical id of the spawned child. */
26536
- child_id: z6.string().min(1),
26843
+ child_id: z7.string().min(1),
26537
26844
  /** OS pid assigned to the spawned child. */
26538
- pid: z6.number().int().nonnegative()
26845
+ pid: z7.number().int().nonnegative()
26539
26846
  }).strict();
26540
- var RestartedResponseSchema = z6.object({
26847
+ var RestartedResponseSchema = z7.object({
26541
26848
  /** Tag discriminating this response variant. */
26542
- kind: z6.literal("restarted"),
26849
+ kind: z7.literal("restarted"),
26543
26850
  /** Logical id of the restarted child. */
26544
- child_id: z6.string().min(1),
26851
+ child_id: z7.string().min(1),
26545
26852
  /** New OS pid after the restart. */
26546
- pid: z6.number().int().nonnegative(),
26853
+ pid: z7.number().int().nonnegative(),
26547
26854
  /** Number of times this child has been restarted in total. */
26548
- restart_count: z6.number().int().nonnegative()
26855
+ restart_count: z7.number().int().nonnegative()
26549
26856
  }).strict();
26550
- var MonitorResponseSchema = z6.object({
26857
+ var MonitorResponseSchema = z7.object({
26551
26858
  /** Tag discriminating this response variant. */
26552
- kind: z6.literal("monitor"),
26859
+ kind: z7.literal("monitor"),
26553
26860
  /** One row per monitored child. */
26554
- children: z6.array(ChildStatusSchema)
26861
+ children: z7.array(ChildStatusSchema)
26555
26862
  }).strict();
26556
- var HealthResponseSchema = z6.object({
26863
+ var HealthResponseSchema = z7.object({
26557
26864
  /** Tag discriminating this response variant. */
26558
- kind: z6.literal("health"),
26865
+ kind: z7.literal("health"),
26559
26866
  /** Supervisor process pid. */
26560
- pid: z6.number().int().nonnegative(),
26867
+ pid: z7.number().int().nonnegative(),
26561
26868
  /** Number of children currently tracked. */
26562
- child_count: z6.number().int().nonnegative(),
26869
+ child_count: z7.number().int().nonnegative(),
26563
26870
  /** Seconds the supervisor has been running. */
26564
- uptime_secs: z6.number().int().nonnegative(),
26871
+ uptime_secs: z7.number().int().nonnegative(),
26565
26872
  /** Frozen protocol version the supervisor speaks. */
26566
- protocol_version: z6.string()
26873
+ protocol_version: z7.string()
26567
26874
  }).strict();
26568
- var LifecycleEventKindSchema = z6.enum(["child_exited", "child_restarted"]);
26569
- var LifecycleEventResponseSchema = z6.object({
26875
+ var LifecycleEventKindSchema = z7.enum(["child_exited", "child_restarted"]);
26876
+ var LifecycleEventResponseSchema = z7.object({
26570
26877
  /** Tag discriminating this response variant. */
26571
- kind: z6.literal("event"),
26878
+ kind: z7.literal("event"),
26572
26879
  /** What happened. */
26573
26880
  event: LifecycleEventKindSchema,
26574
26881
  /** Logical id of the affected child. */
26575
- child_id: z6.string().min(1),
26882
+ child_id: z7.string().min(1),
26576
26883
  /** Exit code, when the OS reported one. */
26577
- exit_code: z6.number().int().optional(),
26884
+ exit_code: z7.number().int().optional(),
26578
26885
  /** Terminating signal name, when the child was signalled (Unix). */
26579
- signal: z6.string().optional(),
26886
+ signal: z7.string().optional(),
26580
26887
  /** Backoff delay (ms) before the pending restart, when applicable. */
26581
- restart_delay_ms: z6.number().int().nonnegative().optional()
26888
+ restart_delay_ms: z7.number().int().nonnegative().optional()
26582
26889
  }).strict();
26583
- var ErrorResponseSchema = z6.object({
26890
+ var ErrorResponseSchema = z7.object({
26584
26891
  /** Tag discriminating this response variant. */
26585
- kind: z6.literal("error"),
26892
+ kind: z7.literal("error"),
26586
26893
  /** Machine-readable error code (e.g. `E_UNKNOWN_CHILD`). */
26587
- code: z6.string().min(1),
26894
+ code: z7.string().min(1),
26588
26895
  /** Human-readable error message. */
26589
- message: z6.string()
26896
+ message: z7.string()
26590
26897
  }).strict();
26591
- var SupervisorIpcResponseSchema = z6.discriminatedUnion("kind", [
26898
+ var SupervisorIpcResponseSchema = z7.discriminatedUnion("kind", [
26592
26899
  SpawnedResponseSchema,
26593
26900
  RestartedResponseSchema,
26594
26901
  MonitorResponseSchema,
@@ -26596,27 +26903,27 @@ var SupervisorIpcResponseSchema = z6.discriminatedUnion("kind", [
26596
26903
  LifecycleEventResponseSchema,
26597
26904
  ErrorResponseSchema
26598
26905
  ]);
26599
- var SupervisorIpcRequestEnvelopeSchema = z6.object({
26906
+ var SupervisorIpcRequestEnvelopeSchema = z7.object({
26600
26907
  /** Frozen protocol version. */
26601
- protocol_version: z6.string(),
26908
+ protocol_version: z7.string(),
26602
26909
  /** Correlation id echoed back on the matching response. */
26603
- id: z6.string().min(1),
26910
+ id: z7.string().min(1),
26604
26911
  /** Direction discriminator. */
26605
- direction: z6.literal("request"),
26912
+ direction: z7.literal("request"),
26606
26913
  /** The request body. */
26607
26914
  request: SupervisorIpcRequestSchema
26608
26915
  }).strict();
26609
- var SupervisorIpcResponseEnvelopeSchema = z6.object({
26916
+ var SupervisorIpcResponseEnvelopeSchema = z7.object({
26610
26917
  /** Frozen protocol version. */
26611
- protocol_version: z6.string(),
26918
+ protocol_version: z7.string(),
26612
26919
  /** Correlation id echoed from the originating request (or a fresh id for events). */
26613
- id: z6.string().min(1),
26920
+ id: z7.string().min(1),
26614
26921
  /** Direction discriminator. */
26615
- direction: z6.literal("response"),
26922
+ direction: z7.literal("response"),
26616
26923
  /** The response body. */
26617
26924
  response: SupervisorIpcResponseSchema
26618
26925
  }).strict();
26619
- var SupervisorIpcEnvelopeSchema = z6.discriminatedUnion("direction", [
26926
+ var SupervisorIpcEnvelopeSchema = z7.discriminatedUnion("direction", [
26620
26927
  SupervisorIpcRequestEnvelopeSchema,
26621
26928
  SupervisorIpcResponseEnvelopeSchema
26622
26929
  ]);
@@ -26640,17 +26947,17 @@ var SubsystemHealthSchema = ChildStatusSchema.extend({
26640
26947
  * Optional human-readable detail (e.g. last error message, queue depth).
26641
26948
  * Diagnostic only — not part of the supervisor wire contract.
26642
26949
  */
26643
- detail: z7.string().optional()
26950
+ detail: z8.string().optional()
26644
26951
  }).strict();
26645
- var HealthStatusSchema = z7.object({
26952
+ var HealthStatusSchema = z8.object({
26646
26953
  /** One health row per registered subsystem. */
26647
- subsystems: z7.array(SubsystemHealthSchema),
26954
+ subsystems: z8.array(SubsystemHealthSchema),
26648
26955
  /**
26649
26956
  * `true` iff every subsystem is in the `running` state. A convenience roll-up
26650
26957
  * derived from {@link HealthStatusSchema.shape.subsystems}; recomputed by
26651
26958
  * {@link summarizeHealth} so producers cannot desync it.
26652
26959
  */
26653
- allHealthy: z7.boolean()
26960
+ allHealthy: z8.boolean()
26654
26961
  }).strict();
26655
26962
 
26656
26963
  // packages/contracts/src/db-inventory.json
@@ -38579,7 +38886,7 @@ var OPERATIONS = [
38579
38886
  ];
38580
38887
 
38581
38888
  // packages/contracts/src/docs/modernize.ts
38582
- import { z as z8 } from "zod";
38889
+ import { z as z9 } from "zod";
38583
38890
  var DOCS_MODERNIZE_DISPOSITIONS = ["keep", "rename", "merge-into", "delete"];
38584
38891
  var DOCS_MODERNIZE_OPS = [
38585
38892
  "ingest",
@@ -38593,105 +38900,105 @@ var DOCS_MODERNIZE_OPS = [
38593
38900
  "reslug",
38594
38901
  "link-task"
38595
38902
  ];
38596
- var judgmentSchema = z8.object({
38597
- question: z8.enum(["classify", "merge"]),
38598
- site: z8.string(),
38599
- mode: z8.enum(["off", "shadow", "on"]),
38600
- ruleAnswer: z8.string(),
38601
- decidedAnswer: z8.string().nullable(),
38602
- decidedConfidence: z8.number().nullable(),
38603
- source: z8.enum(["provider", "cache", "fallback"]),
38604
- acted: z8.string()
38605
- });
38606
- var relPath = z8.string().min(1).max(1024);
38607
- var docsModernizePlanSchema = z8.object({
38608
- root: z8.string().min(1),
38609
- generatedAt: z8.string(),
38610
- mode: z8.enum(["tree", "store-only"]),
38611
- counts: z8.record(z8.enum(DOCS_MODERNIZE_DISPOSITIONS), z8.number()),
38612
- rows: z8.array(
38613
- z8.object({
38903
+ var judgmentSchema = z9.object({
38904
+ question: z9.enum(["classify", "merge"]),
38905
+ site: z9.string(),
38906
+ mode: z9.enum(["off", "shadow", "on"]),
38907
+ ruleAnswer: z9.string(),
38908
+ decidedAnswer: z9.string().nullable(),
38909
+ decidedConfidence: z9.number().nullable(),
38910
+ source: z9.enum(["provider", "cache", "fallback"]),
38911
+ acted: z9.string()
38912
+ });
38913
+ var relPath = z9.string().min(1).max(1024);
38914
+ var docsModernizePlanSchema = z9.object({
38915
+ root: z9.string().min(1),
38916
+ generatedAt: z9.string(),
38917
+ mode: z9.enum(["tree", "store-only"]),
38918
+ counts: z9.record(z9.enum(DOCS_MODERNIZE_DISPOSITIONS), z9.number()),
38919
+ rows: z9.array(
38920
+ z9.object({
38614
38921
  path: relPath,
38615
- sha256: z8.string().regex(/^[0-9a-f]{64}$/),
38616
- kind: z8.string().min(1),
38617
- slug: z8.string().regex(/^[a-z0-9][a-z0-9-]*$/),
38618
- title: z8.string(),
38619
- disposition: z8.enum(DOCS_MODERNIZE_DISPOSITIONS),
38620
- target: z8.string().min(1).max(1024).nullable(),
38621
- reasons: z8.array(z8.string()),
38622
- judgments: z8.array(judgmentSchema),
38623
- ownerTasks: z8.array(z8.string().regex(/^[TD]\d+$/)),
38624
- category: z8.string(),
38625
- refs: z8.array(z8.string()),
38626
- overridden: z8.boolean(),
38627
- covers: z8.array(z8.string()),
38628
- baselineRemove: z8.boolean()
38922
+ sha256: z9.string().regex(/^[0-9a-f]{64}$/),
38923
+ kind: z9.string().min(1),
38924
+ slug: z9.string().regex(/^[a-z0-9][a-z0-9-]*$/),
38925
+ title: z9.string(),
38926
+ disposition: z9.enum(DOCS_MODERNIZE_DISPOSITIONS),
38927
+ target: z9.string().min(1).max(1024).nullable(),
38928
+ reasons: z9.array(z9.string()),
38929
+ judgments: z9.array(judgmentSchema),
38930
+ ownerTasks: z9.array(z9.string().regex(/^[TD]\d+$/)),
38931
+ category: z9.string(),
38932
+ refs: z9.array(z9.string()),
38933
+ overridden: z9.boolean(),
38934
+ covers: z9.array(z9.string()),
38935
+ baselineRemove: z9.boolean()
38629
38936
  })
38630
38937
  ),
38631
- linkFixes: z8.array(
38632
- z8.object({
38633
- kind: z8.literal("link-fix"),
38938
+ linkFixes: z9.array(
38939
+ z9.object({
38940
+ kind: z9.literal("link-fix"),
38634
38941
  path: relPath,
38635
- href: z8.string().min(1).max(2048),
38636
- newHref: z8.string().min(1).max(2048),
38637
- base: z8.literal("repo").optional(),
38638
- sha256: z8.string().regex(/^[0-9a-f]{64}$/).optional()
38942
+ href: z9.string().min(1).max(2048),
38943
+ newHref: z9.string().min(1).max(2048),
38944
+ base: z9.literal("repo").optional(),
38945
+ sha256: z9.string().regex(/^[0-9a-f]{64}$/).optional()
38639
38946
  })
38640
38947
  ).optional(),
38641
- repoRoot: z8.string().min(1).optional()
38948
+ repoRoot: z9.string().min(1).optional()
38642
38949
  });
38643
- var docsModernizeOverridesSchema = z8.record(
38950
+ var docsModernizeOverridesSchema = z9.record(
38644
38951
  relPath,
38645
- z8.object({
38646
- disposition: z8.enum(DOCS_MODERNIZE_DISPOSITIONS),
38647
- target: z8.string().min(1).max(1024).nullable().optional(),
38648
- reason: z8.string().min(1),
38649
- kind: z8.string().min(1).optional(),
38650
- slug: z8.string().regex(/^[a-z0-9][a-z0-9-]*$/).optional(),
38651
- covers: z8.array(z8.string()).optional()
38952
+ z9.object({
38953
+ disposition: z9.enum(DOCS_MODERNIZE_DISPOSITIONS),
38954
+ target: z9.string().min(1).max(1024).nullable().optional(),
38955
+ reason: z9.string().min(1),
38956
+ kind: z9.string().min(1).optional(),
38957
+ slug: z9.string().regex(/^[a-z0-9][a-z0-9-]*$/).optional(),
38958
+ covers: z9.array(z9.string()).optional()
38652
38959
  })
38653
38960
  );
38654
- var receiptOpSchema = z8.object({
38655
- op: z8.enum(DOCS_MODERNIZE_OPS),
38656
- state: z8.enum(["pending", "done", "reversed"]),
38657
- slug: z8.string().nullable(),
38961
+ var receiptOpSchema = z9.object({
38962
+ op: z9.enum(DOCS_MODERNIZE_OPS),
38963
+ state: z9.enum(["pending", "done", "reversed"]),
38964
+ slug: z9.string().nullable(),
38658
38965
  path: relPath.nullable(),
38659
- target: z8.string().nullable(),
38660
- attachmentId: z8.string().nullable(),
38661
- ownerId: z8.string().nullable(),
38662
- beforeSha256: z8.string().regex(/^[0-9a-f]{64}$/).nullable(),
38663
- afterSha256: z8.string().regex(/^[0-9a-f]{64}$/).nullable(),
38664
- prior: z8.object({
38665
- lifecycleStatus: z8.string().nullable().optional(),
38666
- supersededBy: z8.string().nullable().optional(),
38667
- supersedes: z8.string().nullable().optional(),
38668
- previousAttachmentId: z8.string().nullable().optional(),
38669
- newAttachmentId: z8.string().nullable().optional(),
38670
- linkTargets: z8.array(z8.string()).optional(),
38671
- kind: z8.string().nullable().optional()
38966
+ target: z9.string().nullable(),
38967
+ attachmentId: z9.string().nullable(),
38968
+ ownerId: z9.string().nullable(),
38969
+ beforeSha256: z9.string().regex(/^[0-9a-f]{64}$/).nullable(),
38970
+ afterSha256: z9.string().regex(/^[0-9a-f]{64}$/).nullable(),
38971
+ prior: z9.object({
38972
+ lifecycleStatus: z9.string().nullable().optional(),
38973
+ supersededBy: z9.string().nullable().optional(),
38974
+ supersedes: z9.string().nullable().optional(),
38975
+ previousAttachmentId: z9.string().nullable().optional(),
38976
+ newAttachmentId: z9.string().nullable().optional(),
38977
+ linkTargets: z9.array(z9.string()).optional(),
38978
+ kind: z9.string().nullable().optional()
38672
38979
  }).optional(),
38673
- base: z8.literal("repo").optional()
38980
+ base: z9.literal("repo").optional()
38674
38981
  });
38675
38982
  var docsModernizeJournalLineSchema = receiptOpSchema.extend({
38676
- i: z8.number().int().min(0)
38677
- });
38678
- var docsModernizeReceiptSchema = z8.object({
38679
- runId: z8.string().regex(/^dm-[\w-]+$/),
38680
- root: z8.string().min(1),
38681
- appliedAt: z8.string(),
38682
- planSha256: z8.string(),
38683
- edgeCount: z8.number(),
38684
- rolledBackAt: z8.string().nullable(),
38685
- blobs: z8.array(z8.object({ path: relPath, sha256: z8.string() })),
38686
- moves: z8.array(z8.object({ from: relPath, to: relPath })),
38687
- deleted: z8.array(relPath),
38688
- ops: z8.array(receiptOpSchema),
38689
- durationMs: z8.number().optional(),
38690
- repoRoot: z8.string().min(1).optional()
38983
+ i: z9.number().int().min(0)
38984
+ });
38985
+ var docsModernizeReceiptSchema = z9.object({
38986
+ runId: z9.string().regex(/^dm-[\w-]+$/),
38987
+ root: z9.string().min(1),
38988
+ appliedAt: z9.string(),
38989
+ planSha256: z9.string(),
38990
+ edgeCount: z9.number(),
38991
+ rolledBackAt: z9.string().nullable(),
38992
+ blobs: z9.array(z9.object({ path: relPath, sha256: z9.string() })),
38993
+ moves: z9.array(z9.object({ from: relPath, to: relPath })),
38994
+ deleted: z9.array(relPath),
38995
+ ops: z9.array(receiptOpSchema),
38996
+ durationMs: z9.number().optional(),
38997
+ repoRoot: z9.string().min(1).optional()
38691
38998
  });
38692
38999
 
38693
39000
  // packages/contracts/src/docs/provenance.ts
38694
- import { z as z9 } from "zod";
39001
+ import { z as z10 } from "zod";
38695
39002
  var PROVENANCE_NODE_KINDS = [
38696
39003
  "doc",
38697
39004
  "task",
@@ -38714,96 +39021,96 @@ var DOC_LIFECYCLE_STATUSES = [
38714
39021
  "archived",
38715
39022
  "draft"
38716
39023
  ];
38717
- var provenanceNodeKindSchema = z9.enum(PROVENANCE_NODE_KINDS);
38718
- var provenanceEdgeRelationSchema = z9.enum(PROVENANCE_EDGE_RELATIONS);
38719
- var docLifecycleStatusSchema = z9.enum(DOC_LIFECYCLE_STATUSES);
39024
+ var provenanceNodeKindSchema = z10.enum(PROVENANCE_NODE_KINDS);
39025
+ var provenanceEdgeRelationSchema = z10.enum(PROVENANCE_EDGE_RELATIONS);
39026
+ var docLifecycleStatusSchema = z10.enum(DOC_LIFECYCLE_STATUSES);
38720
39027
  var provenanceNodeBaseFields = {
38721
- id: z9.string().min(1),
38722
- title: z9.string().min(1),
38723
- metadata: z9.record(z9.string(), z9.unknown()).optional()
39028
+ id: z10.string().min(1),
39029
+ title: z10.string().min(1),
39030
+ metadata: z10.record(z10.string(), z10.unknown()).optional()
38724
39031
  };
38725
- var provenanceDocNodeSchema = z9.object({
39032
+ var provenanceDocNodeSchema = z10.object({
38726
39033
  ...provenanceNodeBaseFields,
38727
- kind: z9.literal("doc"),
38728
- slug: z9.string().min(1),
38729
- docKind: z9.string().min(1),
39034
+ kind: z10.literal("doc"),
39035
+ slug: z10.string().min(1),
39036
+ docKind: z10.string().min(1),
38730
39037
  lifecycleStatus: docLifecycleStatusSchema,
38731
- publishedAt: z9.string().min(1),
38732
- supersededAt: z9.string().min(1).optional(),
38733
- summary: z9.string().optional()
39038
+ publishedAt: z10.string().min(1),
39039
+ supersededAt: z10.string().min(1).optional(),
39040
+ summary: z10.string().optional()
38734
39041
  });
38735
- var provenanceTaskNodeSchema = z9.object({
39042
+ var provenanceTaskNodeSchema = z10.object({
38736
39043
  ...provenanceNodeBaseFields,
38737
- kind: z9.literal("task"),
38738
- taskType: z9.enum(["saga", "epic", "task", "subtask"]),
38739
- status: z9.enum(["pending", "in_progress", "done", "blocked", "cancelled", "archived"])
39044
+ kind: z10.literal("task"),
39045
+ taskType: z10.enum(["saga", "epic", "task", "subtask"]),
39046
+ status: z10.enum(["pending", "in_progress", "done", "blocked", "cancelled", "archived"])
38740
39047
  });
38741
- var provenanceDecisionNodeSchema = z9.object({
39048
+ var provenanceDecisionNodeSchema = z10.object({
38742
39049
  ...provenanceNodeBaseFields,
38743
- kind: z9.literal("decision"),
38744
- outcome: z9.enum(["proposed", "accepted", "rejected", "superseded"]),
38745
- decidedAt: z9.string().min(1)
39050
+ kind: z10.literal("decision"),
39051
+ outcome: z10.enum(["proposed", "accepted", "rejected", "superseded"]),
39052
+ decidedAt: z10.string().min(1)
38746
39053
  });
38747
- var provenanceSessionNodeSchema = z9.object({
39054
+ var provenanceSessionNodeSchema = z10.object({
38748
39055
  ...provenanceNodeBaseFields,
38749
- kind: z9.literal("session"),
38750
- startedAt: z9.string().min(1),
38751
- endedAt: z9.string().min(1).optional()
39056
+ kind: z10.literal("session"),
39057
+ startedAt: z10.string().min(1),
39058
+ endedAt: z10.string().min(1).optional()
38752
39059
  });
38753
- var provenanceMemoryNodeSchema = z9.object({
39060
+ var provenanceMemoryNodeSchema = z10.object({
38754
39061
  ...provenanceNodeBaseFields,
38755
- kind: z9.literal("memory"),
38756
- memoryType: z9.enum(["observation", "pattern", "decision", "diary"]),
38757
- recordedAt: z9.string().min(1)
39062
+ kind: z10.literal("memory"),
39063
+ memoryType: z10.enum(["observation", "pattern", "decision", "diary"]),
39064
+ recordedAt: z10.string().min(1)
38758
39065
  });
38759
- var provenanceNodeSchema = z9.discriminatedUnion("kind", [
39066
+ var provenanceNodeSchema = z10.discriminatedUnion("kind", [
38760
39067
  provenanceDocNodeSchema,
38761
39068
  provenanceTaskNodeSchema,
38762
39069
  provenanceDecisionNodeSchema,
38763
39070
  provenanceSessionNodeSchema,
38764
39071
  provenanceMemoryNodeSchema
38765
39072
  ]);
38766
- var provenanceEdgeSchema = z9.object({
39073
+ var provenanceEdgeSchema = z10.object({
38767
39074
  relation: provenanceEdgeRelationSchema,
38768
- from: z9.string().min(1),
39075
+ from: z10.string().min(1),
38769
39076
  fromKind: provenanceNodeKindSchema,
38770
- to: z9.string().min(1),
39077
+ to: z10.string().min(1),
38771
39078
  toKind: provenanceNodeKindSchema,
38772
- addedAt: z9.string().min(1),
38773
- summary: z9.string().optional()
39079
+ addedAt: z10.string().min(1),
39080
+ summary: z10.string().optional()
38774
39081
  });
38775
- var docProvenanceResponseSchema = z9.object({
38776
- nodes: z9.array(provenanceNodeSchema).readonly(),
38777
- edges: z9.array(provenanceEdgeSchema).readonly(),
38778
- totalNodes: z9.number().int().nonnegative(),
38779
- totalEdges: z9.number().int().nonnegative()
39082
+ var docProvenanceResponseSchema = z10.object({
39083
+ nodes: z10.array(provenanceNodeSchema).readonly(),
39084
+ edges: z10.array(provenanceEdgeSchema).readonly(),
39085
+ totalNodes: z10.number().int().nonnegative(),
39086
+ totalEdges: z10.number().int().nonnegative()
38780
39087
  });
38781
39088
 
38782
39089
  // packages/contracts/src/docs/read.ts
38783
- import { z as z10 } from "zod";
38784
- var docFrontmatterSchema = z10.object({
38785
- slug: z10.string(),
38786
- kind: z10.string().nullable(),
38787
- title: z10.string().nullable(),
38788
- summary: z10.string().nullable(),
38789
- lifecycleStatus: z10.string(),
38790
- docVersion: z10.number().int(),
38791
- ownerVersion: z10.string().nullable(),
38792
- supersedes: z10.string().nullable(),
38793
- supersededBy: z10.string().nullable(),
38794
- topics: z10.array(z10.string()).readonly(),
38795
- relatedTasks: z10.array(z10.string()).readonly(),
38796
- sha256: z10.string(),
38797
- createdAt: z10.string()
38798
- });
38799
- var docBodySchema = z10.object({
38800
- encoding: z10.enum(["utf-8", "base64"]),
38801
- text: z10.string().optional(),
38802
- base64: z10.string().optional(),
38803
- sizeBytes: z10.number().int().nonnegative(),
38804
- mimeType: z10.string().nullable()
38805
- });
38806
- var docReadResponseSchema = z10.object({
39090
+ import { z as z11 } from "zod";
39091
+ var docFrontmatterSchema = z11.object({
39092
+ slug: z11.string(),
39093
+ kind: z11.string().nullable(),
39094
+ title: z11.string().nullable(),
39095
+ summary: z11.string().nullable(),
39096
+ lifecycleStatus: z11.string(),
39097
+ docVersion: z11.number().int(),
39098
+ ownerVersion: z11.string().nullable(),
39099
+ supersedes: z11.string().nullable(),
39100
+ supersededBy: z11.string().nullable(),
39101
+ topics: z11.array(z11.string()).readonly(),
39102
+ relatedTasks: z11.array(z11.string()).readonly(),
39103
+ sha256: z11.string(),
39104
+ createdAt: z11.string()
39105
+ });
39106
+ var docBodySchema = z11.object({
39107
+ encoding: z11.enum(["utf-8", "base64"]),
39108
+ text: z11.string().optional(),
39109
+ base64: z11.string().optional(),
39110
+ sizeBytes: z11.number().int().nonnegative(),
39111
+ mimeType: z11.string().nullable()
39112
+ });
39113
+ var docReadResponseSchema = z11.object({
38807
39114
  frontmatter: docFrontmatterSchema,
38808
39115
  body: docBodySchema
38809
39116
  });
@@ -38976,7 +39283,7 @@ function getErrorMessage(error48, fallback = "Unknown error") {
38976
39283
  }
38977
39284
 
38978
39285
  // packages/contracts/src/evidence-atom-schema.ts
38979
- import { z as z11 } from "zod";
39286
+ import { z as z12 } from "zod";
38980
39287
  var EVIDENCE_ATOM_KINDS = [
38981
39288
  "commit",
38982
39289
  "files",
@@ -38998,96 +39305,96 @@ var PARSER_PREFIXES = [...EVIDENCE_ATOM_KINDS, "state"];
38998
39305
  var KIND_BOUNDARY_REGEX = new RegExp(`;(?=\\s*(?:${PARSER_PREFIXES.join("|")})\\s*:)`, "g");
38999
39306
  var DEPLOY_PROVIDER_REGEX = /^[a-z0-9][a-z0-9._-]*$/;
39000
39307
  var DEPLOY_ID_REGEX = /^[^\s@|]+$/;
39001
- var commitAtomSchema = z11.object({
39002
- kind: z11.literal("commit"),
39003
- sha: z11.string().regex(/^[0-9a-f]{7,40}$/i, "commit sha must be 7-40 hex characters")
39004
- });
39005
- var filesAtomSchema = z11.object({
39006
- kind: z11.literal("files"),
39007
- paths: z11.array(z11.string().min(1)).min(1, "files atom requires at least one path")
39008
- });
39009
- var testRunAtomSchema = z11.object({
39010
- kind: z11.literal("test-run"),
39011
- path: z11.string().min(1, "test-run atom requires a non-empty path")
39012
- });
39013
- var qaRunAtomSchema = z11.object({
39014
- kind: z11.literal("qa-run"),
39015
- path: z11.string().min(1, "qa-run atom requires a non-empty path")
39016
- });
39017
- var toolAtomSchema = z11.object({
39018
- kind: z11.literal("tool"),
39019
- tool: z11.string().min(1, "tool atom requires a non-empty tool name")
39020
- });
39021
- var urlAtomSchema = z11.object({
39022
- kind: z11.literal("url"),
39023
- url: z11.string().min(1).regex(/^https?:\/\//, "url atom must start with http:// or https://")
39024
- });
39025
- var noteAtomSchema = z11.object({
39026
- kind: z11.literal("note"),
39027
- note: z11.string().min(1, "note atom must be non-empty").max(512, "note atom is too long (max 512 chars)")
39028
- });
39029
- var decisionAtomSchema = z11.object({
39030
- kind: z11.literal("decision"),
39031
- decisionId: z11.string().min(1, "decision atom requires a non-empty decision ID")
39032
- });
39033
- var prAtomSchema = z11.object({
39034
- kind: z11.literal("pr"),
39035
- prNumber: z11.number().int().positive("pr atom requires a positive integer PR number"),
39036
- componentPrNumber: z11.number().int().positive().optional(),
39308
+ var commitAtomSchema = z12.object({
39309
+ kind: z12.literal("commit"),
39310
+ sha: z12.string().regex(/^[0-9a-f]{7,40}$/i, "commit sha must be 7-40 hex characters")
39311
+ });
39312
+ var filesAtomSchema = z12.object({
39313
+ kind: z12.literal("files"),
39314
+ paths: z12.array(z12.string().min(1)).min(1, "files atom requires at least one path")
39315
+ });
39316
+ var testRunAtomSchema = z12.object({
39317
+ kind: z12.literal("test-run"),
39318
+ path: z12.string().min(1, "test-run atom requires a non-empty path")
39319
+ });
39320
+ var qaRunAtomSchema = z12.object({
39321
+ kind: z12.literal("qa-run"),
39322
+ path: z12.string().min(1, "qa-run atom requires a non-empty path")
39323
+ });
39324
+ var toolAtomSchema = z12.object({
39325
+ kind: z12.literal("tool"),
39326
+ tool: z12.string().min(1, "tool atom requires a non-empty tool name")
39327
+ });
39328
+ var urlAtomSchema = z12.object({
39329
+ kind: z12.literal("url"),
39330
+ url: z12.string().min(1).regex(/^https?:\/\//, "url atom must start with http:// or https://")
39331
+ });
39332
+ var noteAtomSchema = z12.object({
39333
+ kind: z12.literal("note"),
39334
+ note: z12.string().min(1, "note atom must be non-empty").max(512, "note atom is too long (max 512 chars)")
39335
+ });
39336
+ var decisionAtomSchema = z12.object({
39337
+ kind: z12.literal("decision"),
39338
+ decisionId: z12.string().min(1, "decision atom requires a non-empty decision ID")
39339
+ });
39340
+ var prAtomSchema = z12.object({
39341
+ kind: z12.literal("pr"),
39342
+ prNumber: z12.number().int().positive("pr atom requires a positive integer PR number"),
39343
+ componentPrNumber: z12.number().int().positive().optional(),
39037
39344
  /**
39038
39345
  * `pr:<owner>/<repo>#<n>` (T13912): the GitHub repository the PR number
39039
39346
  * belongs to, lowercased. Validated against the evidence git root's
39040
39347
  * `origin`, since PR numbers are only unique per repository.
39041
39348
  */
39042
- repo: z11.string().regex(/^[a-z0-9._-]+\/[a-z0-9._-]+$/).optional()
39349
+ repo: z12.string().regex(/^[a-z0-9._-]+\/[a-z0-9._-]+$/).optional()
39043
39350
  });
39044
- var ciAtomSchema = z11.object({
39045
- kind: z11.literal("ci"),
39046
- prNumber: z11.number().int().positive("ci atom requires a positive integer PR number"),
39047
- componentPrNumber: z11.number().int().positive().optional(),
39351
+ var ciAtomSchema = z12.object({
39352
+ kind: z12.literal("ci"),
39353
+ prNumber: z12.number().int().positive("ci atom requires a positive integer PR number"),
39354
+ componentPrNumber: z12.number().int().positive().optional(),
39048
39355
  /** `ci:<owner>/<repo>#<n>`, as for `pr:` (T13912). */
39049
- repo: z11.string().regex(/^[a-z0-9._-]+\/[a-z0-9._-]+$/).optional()
39356
+ repo: z12.string().regex(/^[a-z0-9._-]+\/[a-z0-9._-]+$/).optional()
39050
39357
  });
39051
- var ciRunAtomSchema = z11.object({
39052
- kind: z11.literal("ci-run"),
39053
- runId: z11.number().int().positive("ci-run atom requires a positive integer run id")
39358
+ var ciRunAtomSchema = z12.object({
39359
+ kind: z12.literal("ci-run"),
39360
+ runId: z12.number().int().positive("ci-run atom requires a positive integer run id")
39054
39361
  });
39055
- var deployAtomSchema = z11.object({
39056
- kind: z11.literal("deploy"),
39057
- provider: z11.string().regex(DEPLOY_PROVIDER_REGEX, "deploy atom provider must be a lowercase name"),
39058
- deploymentId: z11.string().regex(DEPLOY_ID_REGEX, "deploy atom requires a deployment id"),
39059
- sha: z11.string().regex(/^[0-9a-f]{7,40}$/, "deploy atom sha must be 7-40 lowercase hex chars"),
39060
- probeUrl: z11.string().regex(/^https?:\/\/\S+$/, "deploy atom probe url must start with http:// or https://")
39362
+ var deployAtomSchema = z12.object({
39363
+ kind: z12.literal("deploy"),
39364
+ provider: z12.string().regex(DEPLOY_PROVIDER_REGEX, "deploy atom provider must be a lowercase name"),
39365
+ deploymentId: z12.string().regex(DEPLOY_ID_REGEX, "deploy atom requires a deployment id"),
39366
+ sha: z12.string().regex(/^[0-9a-f]{7,40}$/, "deploy atom sha must be 7-40 lowercase hex chars"),
39367
+ probeUrl: z12.string().regex(/^https?:\/\/\S+$/, "deploy atom probe url must start with http:// or https://")
39061
39368
  });
39062
- var locDropAtomSchema = z11.object({
39063
- kind: z11.literal("loc-drop"),
39064
- fromLines: z11.number().int().nonnegative("loc-drop fromLines must be \u2265 0"),
39065
- toLines: z11.number().int().nonnegative("loc-drop toLines must be \u2265 0")
39369
+ var locDropAtomSchema = z12.object({
39370
+ kind: z12.literal("loc-drop"),
39371
+ fromLines: z12.number().int().nonnegative("loc-drop fromLines must be \u2265 0"),
39372
+ toLines: z12.number().int().nonnegative("loc-drop toLines must be \u2265 0")
39066
39373
  });
39067
- var callsiteCoverageAtomSchema = z11.object({
39068
- kind: z11.literal("callsite-coverage"),
39069
- symbolName: z11.string().min(1, "callsite-coverage atom requires a non-empty symbolName"),
39070
- relativeSourcePath: z11.string().min(1, "callsite-coverage atom requires a non-empty relativeSourcePath")
39374
+ var callsiteCoverageAtomSchema = z12.object({
39375
+ kind: z12.literal("callsite-coverage"),
39376
+ symbolName: z12.string().min(1, "callsite-coverage atom requires a non-empty symbolName"),
39377
+ relativeSourcePath: z12.string().min(1, "callsite-coverage atom requires a non-empty relativeSourcePath")
39071
39378
  });
39072
39379
  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}$/;
39073
39380
  var AC_ALIAS_REGEX = /^AC[0-9]{1,4}$/;
39074
39381
  var SATISFIES_TASK_ID_REGEX = /^T[0-9]{1,7}$/;
39075
39382
  var SATISFIES_VERSION_PIN_REGEX = /^[0-9]{14}$/;
39076
- var satisfiesAtomSchema = z11.object({
39077
- kind: z11.literal("satisfies"),
39383
+ var satisfiesAtomSchema = z12.object({
39384
+ kind: z12.literal("satisfies"),
39078
39385
  /** Target task ID — `T<1-7 digits>` per ADR-079-r2 §2.1. */
39079
- targetTaskId: z11.string().regex(SATISFIES_TASK_ID_REGEX, "satisfies atom targetTaskId must match /^T[0-9]{1,7}$/"),
39386
+ targetTaskId: z12.string().regex(SATISFIES_TASK_ID_REGEX, "satisfies atom targetTaskId must match /^T[0-9]{1,7}$/"),
39080
39387
  /** Lowercase UUIDv4/v5 — populated for the canonical form; undefined for alias form. */
39081
- targetAcId: z11.string().regex(AC_UUID_REGEX, "satisfies atom targetAcId must be a lowercase UUIDv4/v5").optional(),
39388
+ targetAcId: z12.string().regex(AC_UUID_REGEX, "satisfies atom targetAcId must be a lowercase UUIDv4/v5").optional(),
39082
39389
  /** Positional alias `AC<1-4 digits>` — populated for alias form; undefined for UUID form. */
39083
- targetAcAlias: z11.string().regex(AC_ALIAS_REGEX, "satisfies atom targetAcAlias must match /^AC[0-9]{1,4}$/").optional(),
39390
+ targetAcAlias: z12.string().regex(AC_ALIAS_REGEX, "satisfies atom targetAcAlias must match /^AC[0-9]{1,4}$/").optional(),
39084
39391
  /** Optional `@<14-digit YYYYMMDDhhmmss>` pin captured at mint time. */
39085
- versionPin: z11.string().regex(
39392
+ versionPin: z12.string().regex(
39086
39393
  SATISFIES_VERSION_PIN_REGEX,
39087
39394
  "satisfies atom versionPin must be 14 digits (YYYYMMDDhhmmss)"
39088
39395
  ).optional()
39089
39396
  });
39090
- var EvidenceAtomSchema = z11.discriminatedUnion("kind", [
39397
+ var EvidenceAtomSchema = z12.discriminatedUnion("kind", [
39091
39398
  commitAtomSchema,
39092
39399
  filesAtomSchema,
39093
39400
  testRunAtomSchema,
@@ -39149,54 +39456,54 @@ var ATOM_EXAMPLES = Object.freeze({
39149
39456
  });
39150
39457
 
39151
39458
  // packages/contracts/src/evidence-record-schema.ts
39152
- import { z as z12 } from "zod";
39153
- var evidenceBaseSchema = z12.object({
39459
+ import { z as z13 } from "zod";
39460
+ var evidenceBaseSchema = z13.object({
39154
39461
  /** Identity string of the agent that produced this record. */
39155
- agentIdentity: z12.string().min(1),
39462
+ agentIdentity: z13.string().min(1),
39156
39463
  /** SHA-256 hex digest (64 chars) of the attached artifact. */
39157
- attachmentSha256: z12.string().length(64),
39464
+ attachmentSha256: z13.string().length(64),
39158
39465
  /** ISO 8601 timestamp at which the action ran. */
39159
- ranAt: z12.string().datetime(),
39466
+ ranAt: z13.string().datetime(),
39160
39467
  /** Wall-clock duration of the action in milliseconds. */
39161
- durationMs: z12.number().nonnegative()
39468
+ durationMs: z13.number().nonnegative()
39162
39469
  });
39163
39470
  var implDiffRecordSchema = evidenceBaseSchema.extend({
39164
- kind: z12.literal("impl-diff"),
39165
- phase: z12.literal("implement"),
39166
- filesChanged: z12.array(z12.string().min(1)).min(1),
39167
- linesAdded: z12.number().int().nonnegative(),
39168
- linesRemoved: z12.number().int().nonnegative()
39471
+ kind: z13.literal("impl-diff"),
39472
+ phase: z13.literal("implement"),
39473
+ filesChanged: z13.array(z13.string().min(1)).min(1),
39474
+ linesAdded: z13.number().int().nonnegative(),
39475
+ linesRemoved: z13.number().int().nonnegative()
39169
39476
  });
39170
39477
  var validateSpecCheckRecordSchema = evidenceBaseSchema.extend({
39171
- kind: z12.literal("validate-spec-check"),
39172
- phase: z12.literal("validate"),
39173
- reqIdsChecked: z12.array(z12.string().min(1)).min(1),
39174
- passed: z12.boolean(),
39175
- details: z12.string().min(1)
39478
+ kind: z13.literal("validate-spec-check"),
39479
+ phase: z13.literal("validate"),
39480
+ reqIdsChecked: z13.array(z13.string().min(1)).min(1),
39481
+ passed: z13.boolean(),
39482
+ details: z13.string().min(1)
39176
39483
  });
39177
39484
  var testOutputRecordSchema = evidenceBaseSchema.extend({
39178
- kind: z12.literal("test-output"),
39179
- phase: z12.literal("test"),
39180
- command: z12.string().min(1),
39181
- exitCode: z12.number().int(),
39182
- testsPassed: z12.number().int().nonnegative(),
39183
- testsFailed: z12.number().int().nonnegative()
39485
+ kind: z13.literal("test-output"),
39486
+ phase: z13.literal("test"),
39487
+ command: z13.string().min(1),
39488
+ exitCode: z13.number().int(),
39489
+ testsPassed: z13.number().int().nonnegative(),
39490
+ testsFailed: z13.number().int().nonnegative()
39184
39491
  });
39185
39492
  var lintReportRecordSchema = evidenceBaseSchema.extend({
39186
- kind: z12.literal("lint-report"),
39187
- phase: z12.enum(["implement", "test"]),
39188
- tool: z12.string().min(1),
39189
- passed: z12.boolean(),
39190
- warnings: z12.number().int().nonnegative(),
39191
- errors: z12.number().int().nonnegative()
39493
+ kind: z13.literal("lint-report"),
39494
+ phase: z13.enum(["implement", "test"]),
39495
+ tool: z13.string().min(1),
39496
+ passed: z13.boolean(),
39497
+ warnings: z13.number().int().nonnegative(),
39498
+ errors: z13.number().int().nonnegative()
39192
39499
  });
39193
39500
  var commandOutputRecordSchema = evidenceBaseSchema.extend({
39194
- kind: z12.literal("command-output"),
39195
- phase: z12.enum(["implement", "validate", "test"]),
39196
- cmd: z12.string().min(1),
39197
- exitCode: z12.number().int()
39501
+ kind: z13.literal("command-output"),
39502
+ phase: z13.enum(["implement", "validate", "test"]),
39503
+ cmd: z13.string().min(1),
39504
+ exitCode: z13.number().int()
39198
39505
  });
39199
- var evidenceRecordSchema = z12.discriminatedUnion("kind", [
39506
+ var evidenceRecordSchema = z13.discriminatedUnion("kind", [
39200
39507
  implDiffRecordSchema,
39201
39508
  validateSpecCheckRecordSchema,
39202
39509
  testOutputRecordSchema,
@@ -40131,107 +40438,107 @@ var KIND_LIFECYCLE_REQUIREMENTS = Object.freeze({
40131
40438
  });
40132
40439
 
40133
40440
  // packages/contracts/src/lease-ipc/messages.ts
40134
- import { z as z13 } from "zod";
40135
- var LeaseScopeSchema = z13.enum(["project", "global"]);
40136
- var LeaseLaneSchema = z13.enum(["tasks", "brain", "bulk"]);
40137
- var LeaseAcquireRequestSchema = z13.object({
40441
+ import { z as z14 } from "zod";
40442
+ var LeaseScopeSchema = z14.enum(["project", "global"]);
40443
+ var LeaseLaneSchema = z14.enum(["tasks", "brain", "bulk"]);
40444
+ var LeaseAcquireRequestSchema = z14.object({
40138
40445
  /** Tag discriminating this request variant. */
40139
- kind: z13.literal("lease_acquire"),
40446
+ kind: z14.literal("lease_acquire"),
40140
40447
  /** The cleo.db scope being arbitrated. */
40141
40448
  scope: LeaseScopeSchema,
40142
40449
  /** The write lane within the scope. */
40143
40450
  lane: LeaseLaneSchema,
40144
40451
  /** Process+lane holder identity. */
40145
- holder_id: z13.string().min(1),
40452
+ holder_id: z14.string().min(1),
40146
40453
  /** Advisory priority — lower acquires sooner. `0` = highest. */
40147
- priority: z13.number().int().min(0).max(255),
40454
+ priority: z14.number().int().min(0).max(255),
40148
40455
  /** Lease time-to-live in milliseconds. */
40149
- ttl_ms: z13.number().int().nonnegative(),
40456
+ ttl_ms: z14.number().int().nonnegative(),
40150
40457
  /** When true, a same-holder acquire re-enters (refcount++) rather than queuing. */
40151
- reentrant: z13.boolean()
40458
+ reentrant: z14.boolean()
40152
40459
  }).strict();
40153
- var LeaseReleaseRequestSchema = z13.object({
40460
+ var LeaseReleaseRequestSchema = z14.object({
40154
40461
  /** Tag discriminating this request variant. */
40155
- kind: z13.literal("lease_release"),
40462
+ kind: z14.literal("lease_release"),
40156
40463
  /** The cleo.db scope being arbitrated. */
40157
40464
  scope: LeaseScopeSchema,
40158
40465
  /** The write lane within the scope. */
40159
40466
  lane: LeaseLaneSchema,
40160
40467
  /** Process+lane holder identity. */
40161
- holder_id: z13.string().min(1),
40468
+ holder_id: z14.string().min(1),
40162
40469
  /** The epoch fence the holder acquired — a stale epoch no-ops. */
40163
- epoch: z13.number().int().nonnegative()
40470
+ epoch: z14.number().int().nonnegative()
40164
40471
  }).strict();
40165
- var LeaseRenewRequestSchema = z13.object({
40472
+ var LeaseRenewRequestSchema = z14.object({
40166
40473
  /** Tag discriminating this request variant. */
40167
- kind: z13.literal("lease_renew"),
40474
+ kind: z14.literal("lease_renew"),
40168
40475
  /** The cleo.db scope being arbitrated. */
40169
40476
  scope: LeaseScopeSchema,
40170
40477
  /** The write lane within the scope. */
40171
40478
  lane: LeaseLaneSchema,
40172
40479
  /** Process+lane holder identity. */
40173
- holder_id: z13.string().min(1),
40480
+ holder_id: z14.string().min(1),
40174
40481
  /** The epoch fence the holder acquired (epoch-guarded renew). */
40175
- epoch: z13.number().int().nonnegative()
40482
+ epoch: z14.number().int().nonnegative()
40176
40483
  }).strict();
40177
- var RateCheckRequestSchema = z13.object({
40484
+ var RateCheckRequestSchema = z14.object({
40178
40485
  /** Tag discriminating this request variant. */
40179
- kind: z13.literal("rate_check"),
40486
+ kind: z14.literal("rate_check"),
40180
40487
  /** The cleo.db scope being checked. */
40181
40488
  scope: LeaseScopeSchema,
40182
40489
  /** The write lane within the scope. */
40183
40490
  lane: LeaseLaneSchema,
40184
40491
  /** Estimated bytes the caller intends to write. */
40185
- est_bytes: z13.number().int().nonnegative()
40492
+ est_bytes: z14.number().int().nonnegative()
40186
40493
  }).strict();
40187
- var ToolGrantRequestSchema = z13.object({
40494
+ var ToolGrantRequestSchema = z14.object({
40188
40495
  /** Tag discriminating this request variant. */
40189
- kind: z13.literal("tool_grant"),
40496
+ kind: z14.literal("tool_grant"),
40190
40497
  /** The tool name being requested. */
40191
- tool: z13.string().min(1),
40498
+ tool: z14.string().min(1),
40192
40499
  /** The requesting holder identity. */
40193
- holder_id: z13.string().min(1)
40500
+ holder_id: z14.string().min(1)
40194
40501
  }).strict();
40195
- var QueuePriorityClassSchema = z13.enum(["lead", "worker", "background"]);
40196
- var QueueAdmitRequestSchema = z13.object({
40502
+ var QueuePriorityClassSchema = z14.enum(["lead", "worker", "background"]);
40503
+ var QueueAdmitRequestSchema = z14.object({
40197
40504
  /** Tag discriminating this request variant. */
40198
- kind: z13.literal("queue_admit"),
40505
+ kind: z14.literal("queue_admit"),
40199
40506
  /** The LLM provider id the call targets (rate budget is per-provider). */
40200
- provider: z13.string().min(1),
40507
+ provider: z14.string().min(1),
40201
40508
  /** The caller's priority class (lead > worker > background). */
40202
40509
  priority_class: QueuePriorityClassSchema,
40203
40510
  /** The caller's estimate of the request's token cost (debited on admit). */
40204
- est_tokens: z13.number().int().nonnegative(),
40511
+ est_tokens: z14.number().int().nonnegative(),
40205
40512
  /** The child the call belongs to (in-flight tracking — the watchdog seam). */
40206
- child_id: z13.string().min(1)
40513
+ child_id: z14.string().min(1)
40207
40514
  }).strict();
40208
- var WorkerHeartbeatRequestSchema = z13.object({
40515
+ var WorkerHeartbeatRequestSchema = z14.object({
40209
40516
  /** Tag discriminating this request variant. */
40210
- kind: z13.literal("worker_heartbeat"),
40517
+ kind: z14.literal("worker_heartbeat"),
40211
40518
  /** The logical id of the heartbeating child (matches the registry key). */
40212
- child_id: z13.string().min(1),
40519
+ child_id: z14.string().min(1),
40213
40520
  /** The worker's own view of whether it is currently inside an LLM call. */
40214
- in_flight_llm: z13.boolean()
40521
+ in_flight_llm: z14.boolean()
40215
40522
  }).strict();
40216
- var ResourceAdmitRequestSchema = z13.object({
40523
+ var ResourceAdmitRequestSchema = z14.object({
40217
40524
  /** Tag discriminating this request variant. */
40218
- kind: z13.literal("resource_admit"),
40525
+ kind: z14.literal("resource_admit"),
40219
40526
  /** The resource class (e.g. `"db-heavy"`, `"full-build"`, `"test-run"`). */
40220
- class: z13.string().min(1),
40527
+ class: z14.string().min(1),
40221
40528
  /** The caller holding the slot — process/worktree-unique; the release key. */
40222
- holder_id: z13.string().min(1),
40529
+ holder_id: z14.string().min(1),
40223
40530
  /** The client-computed budget: the max concurrent holders for this class. */
40224
- budget: z13.number().int().nonnegative()
40531
+ budget: z14.number().int().nonnegative()
40225
40532
  }).strict();
40226
- var ResourceReleaseRequestSchema = z13.object({
40533
+ var ResourceReleaseRequestSchema = z14.object({
40227
40534
  /** Tag discriminating this request variant. */
40228
- kind: z13.literal("resource_release"),
40535
+ kind: z14.literal("resource_release"),
40229
40536
  /** The resource class the slot belongs to. */
40230
- class: z13.string().min(1),
40537
+ class: z14.string().min(1),
40231
40538
  /** The holder that was admitted (matches the admit `holder_id`). */
40232
- holder_id: z13.string().min(1)
40539
+ holder_id: z14.string().min(1)
40233
40540
  }).strict();
40234
- var LeaseIpcRequestSchema = z13.discriminatedUnion("kind", [
40541
+ var LeaseIpcRequestSchema = z14.discriminatedUnion("kind", [
40235
40542
  LeaseAcquireRequestSchema,
40236
40543
  LeaseReleaseRequestSchema,
40237
40544
  LeaseRenewRequestSchema,
@@ -40242,133 +40549,133 @@ var LeaseIpcRequestSchema = z13.discriminatedUnion("kind", [
40242
40549
  ResourceAdmitRequestSchema,
40243
40550
  ResourceReleaseRequestSchema
40244
40551
  ]);
40245
- var LeaseGrantedResponseSchema = z13.object({
40552
+ var LeaseGrantedResponseSchema = z14.object({
40246
40553
  /** Tag discriminating this response variant. */
40247
- kind: z13.literal("lease_granted"),
40554
+ kind: z14.literal("lease_granted"),
40248
40555
  /** The granted cleo.db scope. */
40249
40556
  scope: LeaseScopeSchema,
40250
40557
  /** The granted write lane. */
40251
40558
  lane: LeaseLaneSchema,
40252
40559
  /** The holder the lease was granted to. */
40253
- holder_id: z13.string().min(1),
40560
+ holder_id: z14.string().min(1),
40254
40561
  /** The monotonic epoch fence assigned to this grant. */
40255
- epoch: z13.number().int().nonnegative(),
40562
+ epoch: z14.number().int().nonnegative(),
40256
40563
  /** The lease TTL in milliseconds. */
40257
- ttl_ms: z13.number().int().nonnegative(),
40564
+ ttl_ms: z14.number().int().nonnegative(),
40258
40565
  /** Absolute expiry timestamp (epoch ms) for this grant. */
40259
- expires_at_ms: z13.number().int().nonnegative()
40566
+ expires_at_ms: z14.number().int().nonnegative()
40260
40567
  }).strict();
40261
- var LeaseQueuedResponseSchema = z13.object({
40568
+ var LeaseQueuedResponseSchema = z14.object({
40262
40569
  /** Tag discriminating this response variant. */
40263
- kind: z13.literal("lease_queued"),
40570
+ kind: z14.literal("lease_queued"),
40264
40571
  /** The queued cleo.db scope. */
40265
40572
  scope: LeaseScopeSchema,
40266
40573
  /** The queued write lane. */
40267
40574
  lane: LeaseLaneSchema,
40268
40575
  /** The monotonic ticket assigned for FIFO tiebreak. */
40269
- ticket: z13.number().int().nonnegative(),
40576
+ ticket: z14.number().int().nonnegative(),
40270
40577
  /** Number of waiters ahead of this one. */
40271
- ahead: z13.number().int().nonnegative()
40578
+ ahead: z14.number().int().nonnegative()
40272
40579
  }).strict();
40273
- var LeaseDeniedResponseSchema = z13.object({
40580
+ var LeaseDeniedResponseSchema = z14.object({
40274
40581
  /** Tag discriminating this response variant. */
40275
- kind: z13.literal("lease_denied"),
40582
+ kind: z14.literal("lease_denied"),
40276
40583
  /** The denied cleo.db scope. */
40277
40584
  scope: LeaseScopeSchema,
40278
40585
  /** Machine-readable denial code (e.g. `E_LEASE_UNAVAILABLE`). */
40279
- code: z13.string().min(1),
40586
+ code: z14.string().min(1),
40280
40587
  /** Human-readable denial message. */
40281
- message: z13.string()
40588
+ message: z14.string()
40282
40589
  }).strict();
40283
- var RateResultResponseSchema = z13.object({
40590
+ var RateResultResponseSchema = z14.object({
40284
40591
  /** Tag discriminating this response variant. */
40285
- kind: z13.literal("rate_result"),
40592
+ kind: z14.literal("rate_result"),
40286
40593
  /** The checked cleo.db scope. */
40287
40594
  scope: LeaseScopeSchema,
40288
40595
  /** Whether the write is within budget. */
40289
- ok: z13.boolean(),
40596
+ ok: z14.boolean(),
40290
40597
  /** Suggested back-off in milliseconds when `ok` is false. */
40291
- retry_after_ms: z13.number().int().nonnegative(),
40598
+ retry_after_ms: z14.number().int().nonnegative(),
40292
40599
  /** Remaining token budget for the scope. */
40293
- tokens_remaining: z13.number().int().nonnegative()
40600
+ tokens_remaining: z14.number().int().nonnegative()
40294
40601
  }).strict();
40295
- var ToolGrantedResponseSchema = z13.object({
40602
+ var ToolGrantedResponseSchema = z14.object({
40296
40603
  /** Tag discriminating this response variant. */
40297
- kind: z13.literal("tool_granted"),
40604
+ kind: z14.literal("tool_granted"),
40298
40605
  /** The granted tool name. */
40299
- tool: z13.string().min(1),
40606
+ tool: z14.string().min(1),
40300
40607
  /** The holder the tool grant was issued to. */
40301
- holder_id: z13.string().min(1)
40608
+ holder_id: z14.string().min(1)
40302
40609
  }).strict();
40303
- var LeaseRevokedResponseSchema = z13.object({
40610
+ var LeaseRevokedResponseSchema = z14.object({
40304
40611
  /** Tag discriminating this response variant. */
40305
- kind: z13.literal("lease_revoked"),
40612
+ kind: z14.literal("lease_revoked"),
40306
40613
  /** The revoked cleo.db scope. */
40307
40614
  scope: LeaseScopeSchema,
40308
40615
  /** The revoked write lane. */
40309
40616
  lane: LeaseLaneSchema,
40310
40617
  /** The holder whose lease was revoked. */
40311
- holder_id: z13.string().min(1),
40618
+ holder_id: z14.string().min(1),
40312
40619
  /** Human-readable reason for the revocation. */
40313
- reason: z13.string()
40620
+ reason: z14.string()
40314
40621
  }).strict();
40315
- var ChildKilledUnresponsiveResponseSchema = z13.object({
40622
+ var ChildKilledUnresponsiveResponseSchema = z14.object({
40316
40623
  /** Tag discriminating this response variant. */
40317
- kind: z13.literal("child_killed_unresponsive"),
40624
+ kind: z14.literal("child_killed_unresponsive"),
40318
40625
  /** Logical id of the killed child. */
40319
- child_id: z13.string().min(1),
40626
+ child_id: z14.string().min(1),
40320
40627
  /** The holder identity the killed child held the lease as. */
40321
- holder_id: z13.string().min(1),
40628
+ holder_id: z14.string().min(1),
40322
40629
  /** The cleo.db scope the killed child held the lease in. */
40323
40630
  scope: LeaseScopeSchema,
40324
40631
  /** Human-readable reason for the kill. */
40325
- reason: z13.string()
40632
+ reason: z14.string()
40326
40633
  }).strict();
40327
- var QueueAdmitDispositionSchema = z13.enum(["admitted", "deferred"]);
40328
- var QueueAdmitResultResponseSchema = z13.object({
40634
+ var QueueAdmitDispositionSchema = z14.enum(["admitted", "deferred"]);
40635
+ var QueueAdmitResultResponseSchema = z14.object({
40329
40636
  /** Tag discriminating this response variant. */
40330
- kind: z13.literal("queue_admit_result"),
40637
+ kind: z14.literal("queue_admit_result"),
40331
40638
  /** Whether the LLM call was admitted or deferred. */
40332
40639
  disposition: QueueAdmitDispositionSchema,
40333
40640
  /** Back-off in ms before re-requesting (0 when admitted). */
40334
- retry_after_ms: z13.number().int().nonnegative(),
40641
+ retry_after_ms: z14.number().int().nonnegative(),
40335
40642
  /** Remaining provider token budget after this decision. */
40336
- tokens_remaining: z13.number().int().nonnegative(),
40643
+ tokens_remaining: z14.number().int().nonnegative(),
40337
40644
  /** Number of higher/equal-priority waiters ahead (0 when admitted). */
40338
- queue_position: z13.number().int().nonnegative()
40645
+ queue_position: z14.number().int().nonnegative()
40339
40646
  }).strict();
40340
- var HeartbeatAckResponseSchema = z13.object({
40647
+ var HeartbeatAckResponseSchema = z14.object({
40341
40648
  /** Tag discriminating this response variant. */
40342
- kind: z13.literal("heartbeat_ack")
40649
+ kind: z14.literal("heartbeat_ack")
40343
40650
  }).strict();
40344
- var ResourceAdmitDispositionSchema = z13.enum(["admitted", "deferred"]);
40345
- var ResourceAdmitResultResponseSchema = z13.object({
40651
+ var ResourceAdmitDispositionSchema = z14.enum(["admitted", "deferred"]);
40652
+ var ResourceAdmitResultResponseSchema = z14.object({
40346
40653
  /** Tag discriminating this response variant. */
40347
- kind: z13.literal("resource_admit_result"),
40654
+ kind: z14.literal("resource_admit_result"),
40348
40655
  /** Whether the heavy op was admitted or deferred. */
40349
40656
  disposition: ResourceAdmitDispositionSchema,
40350
40657
  /** Back-off in ms before re-requesting (0 when admitted). */
40351
- retry_after_ms: z13.number().int().nonnegative(),
40658
+ retry_after_ms: z14.number().int().nonnegative(),
40352
40659
  /** Remaining slots for the class after this decision. */
40353
- slots_remaining: z13.number().int().nonnegative()
40660
+ slots_remaining: z14.number().int().nonnegative()
40354
40661
  }).strict();
40355
- var ResourceReleaseResultResponseSchema = z13.object({
40662
+ var ResourceReleaseResultResponseSchema = z14.object({
40356
40663
  /** Tag discriminating this response variant. */
40357
- kind: z13.literal("resource_release_result"),
40664
+ kind: z14.literal("resource_release_result"),
40358
40665
  /** Whether a held slot was actually released (false = no such holder). */
40359
- released: z13.boolean(),
40666
+ released: z14.boolean(),
40360
40667
  /** Remaining in-flight holders for the class after the release. */
40361
- slots_remaining: z13.number().int().nonnegative()
40668
+ slots_remaining: z14.number().int().nonnegative()
40362
40669
  }).strict();
40363
- var LeaseErrorResponseSchema = z13.object({
40670
+ var LeaseErrorResponseSchema = z14.object({
40364
40671
  /** Tag discriminating this response variant. */
40365
- kind: z13.literal("error"),
40672
+ kind: z14.literal("error"),
40366
40673
  /** Machine-readable error code (e.g. `E_LEASE_BAD_VERSION`, `E_LEASE_UNIMPLEMENTED`). */
40367
- code: z13.string().min(1),
40674
+ code: z14.string().min(1),
40368
40675
  /** Human-readable error message. */
40369
- message: z13.string()
40676
+ message: z14.string()
40370
40677
  }).strict();
40371
- var LeaseIpcResponseSchema = z13.discriminatedUnion("kind", [
40678
+ var LeaseIpcResponseSchema = z14.discriminatedUnion("kind", [
40372
40679
  LeaseGrantedResponseSchema,
40373
40680
  LeaseQueuedResponseSchema,
40374
40681
  LeaseDeniedResponseSchema,
@@ -40382,27 +40689,27 @@ var LeaseIpcResponseSchema = z13.discriminatedUnion("kind", [
40382
40689
  ResourceReleaseResultResponseSchema,
40383
40690
  LeaseErrorResponseSchema
40384
40691
  ]);
40385
- var LeaseIpcRequestEnvelopeSchema = z13.object({
40692
+ var LeaseIpcRequestEnvelopeSchema = z14.object({
40386
40693
  /** Parallel protocol version. */
40387
- protocol_version: z13.string(),
40694
+ protocol_version: z14.string(),
40388
40695
  /** Correlation id echoed back on the matching response. */
40389
- id: z13.string().min(1),
40696
+ id: z14.string().min(1),
40390
40697
  /** Direction discriminator. */
40391
- direction: z13.literal("request"),
40698
+ direction: z14.literal("request"),
40392
40699
  /** The request body. */
40393
40700
  request: LeaseIpcRequestSchema
40394
40701
  }).strict();
40395
- var LeaseIpcResponseEnvelopeSchema = z13.object({
40702
+ var LeaseIpcResponseEnvelopeSchema = z14.object({
40396
40703
  /** Parallel protocol version. */
40397
- protocol_version: z13.string(),
40704
+ protocol_version: z14.string(),
40398
40705
  /** Correlation id echoed from the originating request (or a fresh id for events). */
40399
- id: z13.string().min(1),
40706
+ id: z14.string().min(1),
40400
40707
  /** Direction discriminator. */
40401
- direction: z13.literal("response"),
40708
+ direction: z14.literal("response"),
40402
40709
  /** The response body. */
40403
40710
  response: LeaseIpcResponseSchema
40404
40711
  }).strict();
40405
- var LeaseIpcEnvelopeSchema = z13.discriminatedUnion("direction", [
40712
+ var LeaseIpcEnvelopeSchema = z14.discriminatedUnion("direction", [
40406
40713
  LeaseIpcRequestEnvelopeSchema,
40407
40714
  LeaseIpcResponseEnvelopeSchema
40408
40715
  ]);
@@ -40437,7 +40744,7 @@ var LEASE_IPC_MESSAGE_KINDS = [
40437
40744
  ];
40438
40745
 
40439
40746
  // packages/contracts/src/llm/catalog-schema.ts
40440
- import { z as z14 } from "zod";
40747
+ import { z as z15 } from "zod";
40441
40748
  var CATALOG_MODEL_STATUSES = [
40442
40749
  "stable",
40443
40750
  "beta",
@@ -40446,78 +40753,78 @@ var CATALOG_MODEL_STATUSES = [
40446
40753
  "retired"
40447
40754
  ];
40448
40755
  var CATALOG_AUTH_TYPES = ["api_key", "oauth", "bedrock", "vertex"];
40449
- var isoDate = z14.string().regex(/^\d{4}-\d{2}-\d{2}$/, "must be an ISO date (YYYY-MM-DD)");
40450
- var semver = z14.string().regex(/^\d+\.\d+\.\d+$/, "must be semver (MAJOR.MINOR.PATCH)");
40451
- var catalogModalitiesSchema = z14.object({
40452
- input: z14.array(z14.string()),
40453
- output: z14.array(z14.string())
40756
+ var isoDate = z15.string().regex(/^\d{4}-\d{2}-\d{2}$/, "must be an ISO date (YYYY-MM-DD)");
40757
+ var semver = z15.string().regex(/^\d+\.\d+\.\d+$/, "must be semver (MAJOR.MINOR.PATCH)");
40758
+ var catalogModalitiesSchema = z15.object({
40759
+ input: z15.array(z15.string()),
40760
+ output: z15.array(z15.string())
40454
40761
  }).strict();
40455
- var catalogCostSchema = z14.object({
40456
- input: z14.number().optional(),
40457
- output: z14.number().optional(),
40458
- cache_read: z14.number().optional(),
40459
- cache_write: z14.number().optional(),
40460
- context_over_200k: z14.number().optional()
40762
+ var catalogCostSchema = z15.object({
40763
+ input: z15.number().optional(),
40764
+ output: z15.number().optional(),
40765
+ cache_read: z15.number().optional(),
40766
+ cache_write: z15.number().optional(),
40767
+ context_over_200k: z15.number().optional()
40461
40768
  }).strict();
40462
- var catalogLimitSchema = z14.object({
40463
- context: z14.number(),
40464
- output: z14.number()
40769
+ var catalogLimitSchema = z15.object({
40770
+ context: z15.number(),
40771
+ output: z15.number()
40465
40772
  }).strict();
40466
- var catalogModelProviderSchema = z14.object({
40467
- npm: z14.string(),
40468
- api: z14.string()
40773
+ var catalogModelProviderSchema = z15.object({
40774
+ npm: z15.string(),
40775
+ api: z15.string()
40469
40776
  }).strict();
40470
- var catalogModelEntrySchema = z14.object({
40471
- id: z14.string(),
40472
- name: z14.string(),
40473
- family: z14.string(),
40474
- attachment: z14.boolean(),
40475
- reasoning: z14.boolean(),
40476
- temperature: z14.boolean(),
40477
- interleaved: z14.boolean(),
40478
- tool_call: z14.boolean(),
40777
+ var catalogModelEntrySchema = z15.object({
40778
+ id: z15.string(),
40779
+ name: z15.string(),
40780
+ family: z15.string(),
40781
+ attachment: z15.boolean(),
40782
+ reasoning: z15.boolean(),
40783
+ temperature: z15.boolean(),
40784
+ interleaved: z15.boolean(),
40785
+ tool_call: z15.boolean(),
40479
40786
  modalities: catalogModalitiesSchema,
40480
40787
  cost: catalogCostSchema,
40481
40788
  limit: catalogLimitSchema,
40482
- status: z14.enum(CATALOG_MODEL_STATUSES),
40789
+ status: z15.enum(CATALOG_MODEL_STATUSES),
40483
40790
  release_date: isoDate,
40484
40791
  provider: catalogModelProviderSchema
40485
40792
  }).strict();
40486
- var catalogProviderSchema = z14.object({
40487
- id: z14.string(),
40488
- endpoint: z14.string(),
40489
- authTypes: z14.array(z14.enum(CATALOG_AUTH_TYPES)).min(1),
40490
- npm: z14.string().optional()
40793
+ var catalogProviderSchema = z15.object({
40794
+ id: z15.string(),
40795
+ endpoint: z15.string(),
40796
+ authTypes: z15.array(z15.enum(CATALOG_AUTH_TYPES)).min(1),
40797
+ npm: z15.string().optional()
40491
40798
  }).strict();
40492
- var curatedCatalogSchema = z14.object({
40493
- $schema: z14.string().optional(),
40799
+ var curatedCatalogSchema = z15.object({
40800
+ $schema: z15.string().optional(),
40494
40801
  version: semver,
40495
40802
  lastUpdated: isoDate,
40496
- providers: z14.record(z14.string(), catalogProviderSchema),
40497
- models: z14.record(z14.string(), z14.record(z14.string(), catalogModelEntrySchema))
40803
+ providers: z15.record(z15.string(), catalogProviderSchema),
40804
+ models: z15.record(z15.string(), z15.record(z15.string(), catalogModelEntrySchema))
40498
40805
  }).strict();
40499
- var modelsCatalogRowInsertSchema = z14.object({
40500
- id: z14.string(),
40501
- providerId: z14.string(),
40502
- name: z14.string(),
40503
- family: z14.string(),
40504
- attachment: z14.boolean(),
40505
- reasoning: z14.boolean(),
40506
- temperature: z14.boolean(),
40507
- interleaved: z14.boolean(),
40508
- toolCall: z14.boolean(),
40509
- modalities: z14.string(),
40510
- cost: z14.string(),
40511
- contextLimit: z14.number().nullable().optional(),
40512
- outputLimit: z14.number().nullable().optional(),
40513
- status: z14.enum(CATALOG_MODEL_STATUSES),
40806
+ var modelsCatalogRowInsertSchema = z15.object({
40807
+ id: z15.string(),
40808
+ providerId: z15.string(),
40809
+ name: z15.string(),
40810
+ family: z15.string(),
40811
+ attachment: z15.boolean(),
40812
+ reasoning: z15.boolean(),
40813
+ temperature: z15.boolean(),
40814
+ interleaved: z15.boolean(),
40815
+ toolCall: z15.boolean(),
40816
+ modalities: z15.string(),
40817
+ cost: z15.string(),
40818
+ contextLimit: z15.number().nullable().optional(),
40819
+ outputLimit: z15.number().nullable().optional(),
40820
+ status: z15.enum(CATALOG_MODEL_STATUSES),
40514
40821
  releaseDate: isoDate,
40515
- modelsDevId: z14.string(),
40516
- source: z14.string(),
40517
- seededAt: z14.string().optional()
40822
+ modelsDevId: z15.string(),
40823
+ source: z15.string(),
40824
+ seededAt: z15.string().optional()
40518
40825
  }).strict();
40519
40826
  var modelsCatalogRowSelectSchema = modelsCatalogRowInsertSchema.extend({
40520
- seededAt: z14.string()
40827
+ seededAt: z15.string()
40521
40828
  });
40522
40829
 
40523
40830
  // packages/contracts/src/llm/system-of-use.ts
@@ -40565,7 +40872,7 @@ var BUILTIN_SYSTEMS_OF_USE = [
40565
40872
  ];
40566
40873
 
40567
40874
  // packages/contracts/src/workgraph.ts
40568
- import { z as z15 } from "zod";
40875
+ import { z as z16 } from "zod";
40569
40876
 
40570
40877
  // packages/contracts/src/status-registry.ts
40571
40878
  var TASK_STATUSES = [
@@ -40580,10 +40887,10 @@ var TASK_STATUSES = [
40580
40887
 
40581
40888
  // packages/contracts/src/workgraph.ts
40582
40889
  var E_WORKGRAPH_PARENT_TYPE_MATRIX = "E_WORKGRAPH_PARENT_TYPE_MATRIX";
40583
- var taskTypeSchema = z15.enum(["saga", "epic", "task", "subtask"]);
40584
- var taskPrioritySchema = z15.enum(["critical", "high", "medium", "low"]);
40585
- var taskStatusSchema = z15.enum(TASK_STATUSES);
40586
- var verificationGateSchema = z15.enum([
40890
+ var taskTypeSchema = z16.enum(["saga", "epic", "task", "subtask"]);
40891
+ var taskPrioritySchema = z16.enum(["critical", "high", "medium", "low"]);
40892
+ var taskStatusSchema = z16.enum(TASK_STATUSES);
40893
+ var verificationGateSchema = z16.enum([
40587
40894
  "implemented",
40588
40895
  "testsPassed",
40589
40896
  "qaPassed",
@@ -40592,7 +40899,7 @@ var verificationGateSchema = z15.enum([
40592
40899
  "documented",
40593
40900
  "nexusImpact"
40594
40901
  ]);
40595
- var workGraphRelationKindSchema = z15.enum([
40902
+ var workGraphRelationKindSchema = z16.enum([
40596
40903
  "contains",
40597
40904
  "depends_on",
40598
40905
  "blocks",
@@ -40600,317 +40907,317 @@ var workGraphRelationKindSchema = z15.enum([
40600
40907
  "groups",
40601
40908
  "satisfies"
40602
40909
  ]);
40603
- var workGraphTraversalDirectionSchema = z15.enum([
40910
+ var workGraphTraversalDirectionSchema = z16.enum([
40604
40911
  "ancestors",
40605
40912
  "descendants",
40606
40913
  "upstream",
40607
40914
  "downstream"
40608
40915
  ]);
40609
- var workGraphEdgeDirectionSchema = z15.enum(["out", "in", "both"]);
40610
- var paginationParamsSchema = z15.object({
40611
- cursor: z15.string().min(1).optional(),
40612
- limit: z15.number().int().positive().max(500).optional()
40916
+ var workGraphEdgeDirectionSchema = z16.enum(["out", "in", "both"]);
40917
+ var paginationParamsSchema = z16.object({
40918
+ cursor: z16.string().min(1).optional(),
40919
+ limit: z16.number().int().positive().max(500).optional()
40613
40920
  });
40614
- var workGraphNodeSchema = z15.object({
40615
- id: z15.string().min(1),
40921
+ var workGraphNodeSchema = z16.object({
40922
+ id: z16.string().min(1),
40616
40923
  type: taskTypeSchema,
40617
- title: z15.string(),
40924
+ title: z16.string(),
40618
40925
  status: taskStatusSchema,
40619
40926
  priority: taskPrioritySchema,
40620
- parentId: z15.string().min(1).optional()
40927
+ parentId: z16.string().min(1).optional()
40621
40928
  });
40622
- var workGraphEdgeSchema = z15.object({
40623
- fromId: z15.string().min(1),
40624
- toId: z15.string().min(1),
40929
+ var workGraphEdgeSchema = z16.object({
40930
+ fromId: z16.string().min(1),
40931
+ toId: z16.string().min(1),
40625
40932
  kind: workGraphRelationKindSchema
40626
40933
  });
40627
- var workGraphHierarchyEdgeSchema = z15.object({
40628
- fromId: z15.string().min(1),
40629
- toId: z15.string().min(1),
40630
- kind: z15.literal("contains")
40934
+ var workGraphHierarchyEdgeSchema = z16.object({
40935
+ fromId: z16.string().min(1),
40936
+ toId: z16.string().min(1),
40937
+ kind: z16.literal("contains")
40631
40938
  }).strict();
40632
- var workGraphPageInfoSchema = z15.object({
40633
- nextCursor: z15.string().min(1).optional(),
40634
- hasMore: z15.boolean()
40635
- });
40636
- var workGraphRollupCountsSchema = z15.object({
40637
- total: z15.number().int().nonnegative(),
40638
- byStatus: z15.partialRecord(taskStatusSchema, z15.number().int().nonnegative()),
40639
- byType: z15.partialRecord(taskTypeSchema, z15.number().int().nonnegative())
40640
- });
40641
- var workGraphSubtreePercentagesSchema = z15.object({
40642
- done: z15.number().nonnegative(),
40643
- active: z15.number().nonnegative(),
40644
- blocked: z15.number().nonnegative(),
40645
- pending: z15.number().nonnegative(),
40646
- cancelled: z15.number().nonnegative()
40647
- });
40648
- var workGraphProjectionMismatchSchema = z15.object({
40649
- field: z15.string().min(1),
40650
- expected: z15.number().int().nonnegative(),
40651
- actual: z15.number().int().nonnegative()
40939
+ var workGraphPageInfoSchema = z16.object({
40940
+ nextCursor: z16.string().min(1).optional(),
40941
+ hasMore: z16.boolean()
40942
+ });
40943
+ var workGraphRollupCountsSchema = z16.object({
40944
+ total: z16.number().int().nonnegative(),
40945
+ byStatus: z16.partialRecord(taskStatusSchema, z16.number().int().nonnegative()),
40946
+ byType: z16.partialRecord(taskTypeSchema, z16.number().int().nonnegative())
40947
+ });
40948
+ var workGraphSubtreePercentagesSchema = z16.object({
40949
+ done: z16.number().nonnegative(),
40950
+ active: z16.number().nonnegative(),
40951
+ blocked: z16.number().nonnegative(),
40952
+ pending: z16.number().nonnegative(),
40953
+ cancelled: z16.number().nonnegative()
40954
+ });
40955
+ var workGraphProjectionMismatchSchema = z16.object({
40956
+ field: z16.string().min(1),
40957
+ expected: z16.number().int().nonnegative(),
40958
+ actual: z16.number().int().nonnegative()
40652
40959
  });
40653
40960
  var workGraphReadyFrontierTaskSchema = workGraphNodeSchema.extend({
40654
- role: z15.string().min(1).optional(),
40655
- dependencyBlockers: z15.array(z15.object({ taskId: z15.string().min(1), status: taskStatusSchema })),
40656
- gateBlockers: z15.array(z15.object({ gate: verificationGateSchema }))
40961
+ role: z16.string().min(1).optional(),
40962
+ dependencyBlockers: z16.array(z16.object({ taskId: z16.string().min(1), status: taskStatusSchema })),
40963
+ gateBlockers: z16.array(z16.object({ gate: verificationGateSchema }))
40657
40964
  });
40658
40965
  var workGraphRelationEdgeSchema = workGraphEdgeSchema.extend({
40659
- source: z15.literal("relation"),
40660
- relationType: z15.enum(TASK_RELATION_TYPES),
40661
- reason: z15.string().min(1).optional()
40966
+ source: z16.literal("relation"),
40967
+ relationType: z16.enum(TASK_RELATION_TYPES),
40968
+ reason: z16.string().min(1).optional()
40662
40969
  });
40663
40970
  var workGraphDependencyEdgeSchema = workGraphEdgeSchema.extend({
40664
- source: z15.literal("dependency"),
40665
- kind: z15.literal("depends_on")
40971
+ source: z16.literal("dependency"),
40972
+ kind: z16.literal("depends_on")
40666
40973
  });
40667
- var workGraphOmissionReasonSchema = z15.enum([
40974
+ var workGraphOmissionReasonSchema = z16.enum([
40668
40975
  "budget_exceeded",
40669
40976
  "not_requested",
40670
40977
  "not_available",
40671
40978
  "redacted",
40672
40979
  "truncated"
40673
40980
  ]);
40674
- var workGraphContextBudgetSchema = z15.object({
40675
- tokenBudget: z15.number().int().nonnegative(),
40676
- estimatedTokens: z15.number().int().nonnegative(),
40677
- remainingTokens: z15.number().int().nonnegative(),
40678
- truncated: z15.boolean()
40679
- });
40680
- var workGraphOmissionSchema = z15.object({
40681
- path: z15.string().min(1),
40981
+ var workGraphContextBudgetSchema = z16.object({
40982
+ tokenBudget: z16.number().int().nonnegative(),
40983
+ estimatedTokens: z16.number().int().nonnegative(),
40984
+ remainingTokens: z16.number().int().nonnegative(),
40985
+ truncated: z16.boolean()
40986
+ });
40987
+ var workGraphOmissionSchema = z16.object({
40988
+ path: z16.string().min(1),
40682
40989
  reason: workGraphOmissionReasonSchema,
40683
- message: z15.string().min(1),
40684
- estimatedTokens: z15.number().int().nonnegative().optional()
40990
+ message: z16.string().min(1),
40991
+ estimatedTokens: z16.number().int().nonnegative().optional()
40685
40992
  });
40686
- var workGraphDirectEdgeSchema = z15.discriminatedUnion("source", [
40993
+ var workGraphDirectEdgeSchema = z16.discriminatedUnion("source", [
40687
40994
  workGraphRelationEdgeSchema,
40688
40995
  workGraphDependencyEdgeSchema
40689
40996
  ]);
40690
40997
  var workGraphContextPackParamsSchema = paginationParamsSchema.extend({
40691
- rootId: z15.string().min(1),
40692
- tokenBudget: z15.number().int().positive().optional(),
40693
- includeRelations: z15.boolean().optional(),
40694
- includeReadiness: z15.boolean().optional(),
40695
- includeRollup: z15.boolean().optional()
40998
+ rootId: z16.string().min(1),
40999
+ tokenBudget: z16.number().int().positive().optional(),
41000
+ includeRelations: z16.boolean().optional(),
41001
+ includeReadiness: z16.boolean().optional(),
41002
+ includeRollup: z16.boolean().optional()
40696
41003
  });
40697
41004
  var workGraphSliceParamsSchema = paginationParamsSchema.extend({
40698
- rootId: z15.string().min(1),
41005
+ rootId: z16.string().min(1),
40699
41006
  direction: workGraphTraversalDirectionSchema.optional(),
40700
- maxDepth: z15.number().int().nonnegative().optional(),
40701
- includeRelations: z15.boolean().optional()
41007
+ maxDepth: z16.number().int().nonnegative().optional(),
41008
+ includeRelations: z16.boolean().optional()
40702
41009
  });
40703
- var workGraphSliceSchema = z15.object({
40704
- rootId: z15.string().min(1),
41010
+ var workGraphSliceSchema = z16.object({
41011
+ rootId: z16.string().min(1),
40705
41012
  direction: workGraphTraversalDirectionSchema,
40706
- nodes: z15.array(workGraphNodeSchema),
40707
- edges: z15.array(workGraphEdgeSchema),
41013
+ nodes: z16.array(workGraphNodeSchema),
41014
+ edges: z16.array(workGraphEdgeSchema),
40708
41015
  pageInfo: workGraphPageInfoSchema,
40709
- omissions: z15.array(workGraphOmissionSchema).optional()
40710
- });
40711
- var workGraphReadinessParamsSchema = z15.object({
40712
- rootId: z15.string().min(1),
40713
- role: z15.string().min(1).optional(),
40714
- includeGateBlockers: z15.boolean().optional()
40715
- });
40716
- var workGraphReadinessResultSchema = z15.object({
40717
- rootId: z15.string().min(1),
40718
- role: z15.string().min(1).optional(),
40719
- ready: z15.boolean(),
40720
- warnings: z15.array(z15.string()),
40721
- groups: z15.object({
40722
- ready: z15.array(workGraphReadyFrontierTaskSchema),
40723
- blocked: z15.array(workGraphReadyFrontierTaskSchema),
40724
- blockedBy: z15.array(
40725
- z15.discriminatedUnion("kind", [
40726
- z15.object({
40727
- kind: z15.literal("dependency"),
40728
- blockerId: z15.string().min(1),
40729
- blocks: z15.array(z15.string().min(1))
41016
+ omissions: z16.array(workGraphOmissionSchema).optional()
41017
+ });
41018
+ var workGraphReadinessParamsSchema = z16.object({
41019
+ rootId: z16.string().min(1),
41020
+ role: z16.string().min(1).optional(),
41021
+ includeGateBlockers: z16.boolean().optional()
41022
+ });
41023
+ var workGraphReadinessResultSchema = z16.object({
41024
+ rootId: z16.string().min(1),
41025
+ role: z16.string().min(1).optional(),
41026
+ ready: z16.boolean(),
41027
+ warnings: z16.array(z16.string()),
41028
+ groups: z16.object({
41029
+ ready: z16.array(workGraphReadyFrontierTaskSchema),
41030
+ blocked: z16.array(workGraphReadyFrontierTaskSchema),
41031
+ blockedBy: z16.array(
41032
+ z16.discriminatedUnion("kind", [
41033
+ z16.object({
41034
+ kind: z16.literal("dependency"),
41035
+ blockerId: z16.string().min(1),
41036
+ blocks: z16.array(z16.string().min(1))
40730
41037
  }),
40731
- z15.object({
40732
- kind: z15.literal("gate"),
41038
+ z16.object({
41039
+ kind: z16.literal("gate"),
40733
41040
  gate: verificationGateSchema,
40734
- blocks: z15.array(z15.string().min(1))
41041
+ blocks: z16.array(z16.string().min(1))
40735
41042
  })
40736
41043
  ])
40737
41044
  )
40738
41045
  })
40739
41046
  });
40740
- var workGraphContextPackSchema = z15.object({
40741
- rootId: z15.string().min(1),
40742
- generatedAt: z15.string().min(1),
41047
+ var workGraphContextPackSchema = z16.object({
41048
+ rootId: z16.string().min(1),
41049
+ generatedAt: z16.string().min(1),
40743
41050
  budget: workGraphContextBudgetSchema,
40744
41051
  slice: workGraphSliceSchema,
40745
- relationEdges: z15.object({
40746
- rootId: z15.string().min(1),
41052
+ relationEdges: z16.object({
41053
+ rootId: z16.string().min(1),
40747
41054
  direction: workGraphEdgeDirectionSchema,
40748
- edges: z15.array(workGraphDirectEdgeSchema)
41055
+ edges: z16.array(workGraphDirectEdgeSchema)
40749
41056
  }).optional(),
40750
41057
  readiness: workGraphReadinessResultSchema.optional(),
40751
- rollup: z15.lazy(() => tasksRollupResultSchema).optional(),
40752
- omissions: z15.array(workGraphOmissionSchema)
40753
- });
40754
- var workGraphScaffoldValidateParamsSchema = z15.object({
40755
- rootId: z15.string().min(1),
40756
- nodes: z15.array(
40757
- z15.object({
40758
- id: z15.string().min(1),
41058
+ rollup: z16.lazy(() => tasksRollupResultSchema).optional(),
41059
+ omissions: z16.array(workGraphOmissionSchema)
41060
+ });
41061
+ var workGraphScaffoldValidateParamsSchema = z16.object({
41062
+ rootId: z16.string().min(1),
41063
+ nodes: z16.array(
41064
+ z16.object({
41065
+ id: z16.string().min(1),
40759
41066
  type: taskTypeSchema,
40760
- parentId: z15.string().min(1).nullable().optional()
41067
+ parentId: z16.string().min(1).nullable().optional()
40761
41068
  })
40762
41069
  ),
40763
- edges: z15.array(workGraphDirectEdgeSchema).optional(),
40764
- dryRun: z15.boolean().optional()
40765
- });
40766
- var workGraphScaffoldValidationIssueSchema = z15.object({
40767
- code: z15.string().min(1),
40768
- message: z15.string().min(1),
40769
- taskId: z15.string().min(1).optional(),
40770
- severity: z15.enum(["error", "warning"])
40771
- });
40772
- var workGraphScaffoldValidateResultSchema = z15.object({
40773
- rootId: z15.string().min(1),
40774
- valid: z15.boolean(),
40775
- dryRun: z15.boolean(),
40776
- issues: z15.array(workGraphScaffoldValidationIssueSchema),
40777
- hierarchy: z15.object({
40778
- valid: z15.boolean(),
40779
- violations: z15.array(
40780
- z15.object({
40781
- code: z15.literal(E_WORKGRAPH_PARENT_TYPE_MATRIX),
40782
- taskId: z15.string().min(1),
41070
+ edges: z16.array(workGraphDirectEdgeSchema).optional(),
41071
+ dryRun: z16.boolean().optional()
41072
+ });
41073
+ var workGraphScaffoldValidationIssueSchema = z16.object({
41074
+ code: z16.string().min(1),
41075
+ message: z16.string().min(1),
41076
+ taskId: z16.string().min(1).optional(),
41077
+ severity: z16.enum(["error", "warning"])
41078
+ });
41079
+ var workGraphScaffoldValidateResultSchema = z16.object({
41080
+ rootId: z16.string().min(1),
41081
+ valid: z16.boolean(),
41082
+ dryRun: z16.boolean(),
41083
+ issues: z16.array(workGraphScaffoldValidationIssueSchema),
41084
+ hierarchy: z16.object({
41085
+ valid: z16.boolean(),
41086
+ violations: z16.array(
41087
+ z16.object({
41088
+ code: z16.literal(E_WORKGRAPH_PARENT_TYPE_MATRIX),
41089
+ taskId: z16.string().min(1),
40783
41090
  taskType: taskTypeSchema,
40784
- parentId: z15.string().min(1).nullable(),
41091
+ parentId: z16.string().min(1).nullable(),
40785
41092
  parentType: taskTypeSchema.optional(),
40786
- message: z15.string().min(1)
41093
+ message: z16.string().min(1)
40787
41094
  })
40788
41095
  )
40789
41096
  })
40790
41097
  });
40791
41098
  var workGraphScaffoldApplyParamsSchema = workGraphScaffoldValidateParamsSchema.extend({
40792
- apply: z15.boolean().optional()
41099
+ apply: z16.boolean().optional()
40793
41100
  });
40794
41101
  var workGraphScaffoldApplyResultSchema = workGraphScaffoldValidateResultSchema.extend({
40795
- applied: z15.boolean(),
40796
- nodesChanged: z15.number().int().nonnegative(),
40797
- edgesChanged: z15.number().int().nonnegative()
40798
- });
40799
- var workGraphPlanningDocParamsSchema = z15.object({
40800
- rootId: z15.string().min(1),
40801
- audience: z15.enum(["agent", "maintainer"]),
40802
- tokenBudget: z15.number().int().positive().optional(),
40803
- includeRelations: z15.boolean().optional(),
40804
- includeReadiness: z15.boolean().optional(),
40805
- includeRollup: z15.boolean().optional()
40806
- });
40807
- var workGraphPlanningDocSchema = z15.object({
40808
- rootId: z15.string().min(1),
40809
- generatedAt: z15.string().min(1),
40810
- audience: z15.enum(["agent", "maintainer"]),
40811
- title: z15.string().min(1),
40812
- content: z15.string(),
40813
- sections: z15.array(z15.string().min(1)),
40814
- estimatedTokens: z15.number().int().nonnegative(),
40815
- budget: z15.object({
40816
- tokenBudget: z15.number().int().positive(),
40817
- truncated: z15.boolean()
41102
+ applied: z16.boolean(),
41103
+ nodesChanged: z16.number().int().nonnegative(),
41104
+ edgesChanged: z16.number().int().nonnegative()
41105
+ });
41106
+ var workGraphPlanningDocParamsSchema = z16.object({
41107
+ rootId: z16.string().min(1),
41108
+ audience: z16.enum(["agent", "maintainer"]),
41109
+ tokenBudget: z16.number().int().positive().optional(),
41110
+ includeRelations: z16.boolean().optional(),
41111
+ includeReadiness: z16.boolean().optional(),
41112
+ includeRollup: z16.boolean().optional()
41113
+ });
41114
+ var workGraphPlanningDocSchema = z16.object({
41115
+ rootId: z16.string().min(1),
41116
+ generatedAt: z16.string().min(1),
41117
+ audience: z16.enum(["agent", "maintainer"]),
41118
+ title: z16.string().min(1),
41119
+ content: z16.string(),
41120
+ sections: z16.array(z16.string().min(1)),
41121
+ estimatedTokens: z16.number().int().nonnegative(),
41122
+ budget: z16.object({
41123
+ tokenBudget: z16.number().int().positive(),
41124
+ truncated: z16.boolean()
40818
41125
  }).optional()
40819
41126
  });
40820
41127
  var tasksTraverseParamsSchema = paginationParamsSchema.extend({
40821
- rootId: z15.string().min(1),
41128
+ rootId: z16.string().min(1),
40822
41129
  direction: workGraphTraversalDirectionSchema,
40823
- maxDepth: z15.number().int().nonnegative().optional(),
40824
- includeRelations: z15.boolean().optional()
41130
+ maxDepth: z16.number().int().nonnegative().optional(),
41131
+ includeRelations: z16.boolean().optional()
40825
41132
  });
40826
- var tasksTraverseResultSchema = z15.object({
40827
- rootId: z15.string().min(1),
41133
+ var tasksTraverseResultSchema = z16.object({
41134
+ rootId: z16.string().min(1),
40828
41135
  direction: workGraphTraversalDirectionSchema,
40829
- nodes: z15.array(workGraphNodeSchema),
40830
- edges: z15.array(workGraphEdgeSchema),
41136
+ nodes: z16.array(workGraphNodeSchema),
41137
+ edges: z16.array(workGraphEdgeSchema),
40831
41138
  pageInfo: workGraphPageInfoSchema
40832
41139
  });
40833
41140
  var tasksTreeParamsSchema = paginationParamsSchema.extend({
40834
- rootId: z15.string().min(1),
40835
- maxDepth: z15.number().int().nonnegative().optional()
41141
+ rootId: z16.string().min(1),
41142
+ maxDepth: z16.number().int().nonnegative().optional()
40836
41143
  });
40837
- var tasksTreeResultSchema = z15.object({
40838
- rootId: z15.string().min(1),
40839
- nodes: z15.array(workGraphNodeSchema.extend({ depth: z15.number().int().positive() })),
40840
- edges: z15.array(workGraphHierarchyEdgeSchema),
41144
+ var tasksTreeResultSchema = z16.object({
41145
+ rootId: z16.string().min(1),
41146
+ nodes: z16.array(workGraphNodeSchema.extend({ depth: z16.number().int().positive() })),
41147
+ edges: z16.array(workGraphHierarchyEdgeSchema),
40841
41148
  pageInfo: workGraphPageInfoSchema
40842
41149
  });
40843
- var tasksRollupParamsSchema = z15.object({
40844
- rootId: z15.string().min(1),
41150
+ var tasksRollupParamsSchema = z16.object({
41151
+ rootId: z16.string().min(1),
40845
41152
  expectedDirectRollup: workGraphRollupCountsSchema.optional()
40846
41153
  });
40847
- var tasksRollupResultSchema = z15.object({
40848
- rootId: z15.string().min(1),
41154
+ var tasksRollupResultSchema = z16.object({
41155
+ rootId: z16.string().min(1),
40849
41156
  direct: workGraphRollupCountsSchema,
40850
41157
  subtree: workGraphRollupCountsSchema,
40851
- percentDenominator: z15.object({
40852
- basis: z15.literal("subtree-total"),
40853
- total: z15.number().int().nonnegative(),
40854
- description: z15.string().min(1)
41158
+ percentDenominator: z16.object({
41159
+ basis: z16.literal("subtree-total"),
41160
+ total: z16.number().int().nonnegative(),
41161
+ description: z16.string().min(1)
40855
41162
  }),
40856
41163
  percentages: workGraphSubtreePercentagesSchema,
40857
- staleProjection: z15.boolean(),
40858
- projectionMismatches: z15.array(workGraphProjectionMismatchSchema)
40859
- });
40860
- var tasksFrontierParamsSchema = z15.object({
40861
- rootId: z15.string().min(1),
40862
- role: z15.string().min(1).optional()
40863
- });
40864
- var tasksFrontierResultSchema = z15.object({
40865
- rootId: z15.string().min(1),
40866
- role: z15.string().min(1).optional(),
40867
- groups: z15.object({
40868
- ready: z15.array(workGraphReadyFrontierTaskSchema),
40869
- blocked: z15.array(workGraphReadyFrontierTaskSchema),
40870
- blockedBy: z15.array(
40871
- z15.discriminatedUnion("kind", [
40872
- z15.object({
40873
- kind: z15.literal("dependency"),
40874
- blockerId: z15.string().min(1),
40875
- blocks: z15.array(z15.string().min(1))
41164
+ staleProjection: z16.boolean(),
41165
+ projectionMismatches: z16.array(workGraphProjectionMismatchSchema)
41166
+ });
41167
+ var tasksFrontierParamsSchema = z16.object({
41168
+ rootId: z16.string().min(1),
41169
+ role: z16.string().min(1).optional()
41170
+ });
41171
+ var tasksFrontierResultSchema = z16.object({
41172
+ rootId: z16.string().min(1),
41173
+ role: z16.string().min(1).optional(),
41174
+ groups: z16.object({
41175
+ ready: z16.array(workGraphReadyFrontierTaskSchema),
41176
+ blocked: z16.array(workGraphReadyFrontierTaskSchema),
41177
+ blockedBy: z16.array(
41178
+ z16.discriminatedUnion("kind", [
41179
+ z16.object({
41180
+ kind: z16.literal("dependency"),
41181
+ blockerId: z16.string().min(1),
41182
+ blocks: z16.array(z16.string().min(1))
40876
41183
  }),
40877
- z15.object({
40878
- kind: z15.literal("gate"),
41184
+ z16.object({
41185
+ kind: z16.literal("gate"),
40879
41186
  gate: verificationGateSchema,
40880
- blocks: z15.array(z15.string().min(1))
41187
+ blocks: z16.array(z16.string().min(1))
40881
41188
  })
40882
41189
  ])
40883
41190
  )
40884
41191
  })
40885
41192
  });
40886
41193
  var tasksWorkGraphAuditParamsSchema = paginationParamsSchema.extend({
40887
- rootId: z15.string().min(1),
40888
- maxDepth: z15.number().int().nonnegative().optional(),
40889
- includeRelations: z15.boolean().optional()
40890
- });
40891
- var tasksWorkGraphAuditResultSchema = z15.object({
40892
- rootId: z15.string().min(1),
40893
- hierarchy: z15.object({
40894
- valid: z15.boolean(),
40895
- violations: z15.array(
40896
- z15.object({
40897
- code: z15.literal(E_WORKGRAPH_PARENT_TYPE_MATRIX),
40898
- taskId: z15.string().min(1),
41194
+ rootId: z16.string().min(1),
41195
+ maxDepth: z16.number().int().nonnegative().optional(),
41196
+ includeRelations: z16.boolean().optional()
41197
+ });
41198
+ var tasksWorkGraphAuditResultSchema = z16.object({
41199
+ rootId: z16.string().min(1),
41200
+ hierarchy: z16.object({
41201
+ valid: z16.boolean(),
41202
+ violations: z16.array(
41203
+ z16.object({
41204
+ code: z16.literal(E_WORKGRAPH_PARENT_TYPE_MATRIX),
41205
+ taskId: z16.string().min(1),
40899
41206
  taskType: taskTypeSchema,
40900
- parentId: z15.string().min(1).nullable(),
41207
+ parentId: z16.string().min(1).nullable(),
40901
41208
  parentType: taskTypeSchema.optional(),
40902
- message: z15.string().min(1)
41209
+ message: z16.string().min(1)
40903
41210
  })
40904
41211
  )
40905
41212
  }),
40906
41213
  traversal: tasksTraverseResultSchema,
40907
41214
  frontier: tasksFrontierResultSchema,
40908
41215
  rollup: tasksRollupResultSchema,
40909
- relationEdges: z15.object({
40910
- rootId: z15.string().min(1),
41216
+ relationEdges: z16.object({
41217
+ rootId: z16.string().min(1),
40911
41218
  direction: workGraphEdgeDirectionSchema,
40912
- edges: z15.array(
40913
- z15.discriminatedUnion("source", [
41219
+ edges: z16.array(
41220
+ z16.discriminatedUnion("source", [
40914
41221
  workGraphRelationEdgeSchema,
40915
41222
  workGraphDependencyEdgeSchema
40916
41223
  ])
@@ -40919,60 +41226,60 @@ var tasksWorkGraphAuditResultSchema = z15.object({
40919
41226
  });
40920
41227
 
40921
41228
  // packages/contracts/src/operations/docs.ts
40922
- import { z as z16 } from "zod";
40923
- var DOCS_PROJECTION_PROPOSAL_SCHEMA = z16.object({
40924
- version: z16.literal(1),
40925
- operation: z16.literal("docs.projection"),
40926
- identity: z16.object({
40927
- projectId: z16.string().min(1),
40928
- projectRoot: z16.string().min(1),
40929
- actor: z16.string().min(1),
40930
- operation: z16.literal("docs.projection"),
40931
- idempotencyKey: z16.string().min(1)
41229
+ import { z as z17 } from "zod";
41230
+ var DOCS_PROJECTION_PROPOSAL_SCHEMA = z17.object({
41231
+ version: z17.literal(1),
41232
+ operation: z17.literal("docs.projection"),
41233
+ identity: z17.object({
41234
+ projectId: z17.string().min(1),
41235
+ projectRoot: z17.string().min(1),
41236
+ actor: z17.string().min(1),
41237
+ operation: z17.literal("docs.projection"),
41238
+ idempotencyKey: z17.string().min(1)
40932
41239
  }).strict(),
40933
- source: z16.object({
40934
- attachmentId: z16.string().min(1),
40935
- sha256: z16.string().regex(/^[a-f0-9]{64}$/),
40936
- ownerId: z16.string().min(1),
40937
- ownerType: z16.enum(["task", "session", "observation", "decision", "learning", "pattern"]),
40938
- label: z16.string().min(1)
41240
+ source: z17.object({
41241
+ attachmentId: z17.string().min(1),
41242
+ sha256: z17.string().regex(/^[a-f0-9]{64}$/),
41243
+ ownerId: z17.string().min(1),
41244
+ ownerType: z17.enum(["task", "session", "observation", "decision", "learning", "pattern"]),
41245
+ label: z17.string().min(1)
40939
41246
  }).strict(),
40940
- observation: z16.object({
40941
- kind: z16.literal("doc-attachment"),
40942
- attachmentId: z16.string().min(1),
40943
- ownerId: z16.string().min(1),
40944
- addedAt: z16.string().min(1),
40945
- slug: z16.string().optional(),
40946
- type: z16.string().optional()
41247
+ observation: z17.object({
41248
+ kind: z17.literal("doc-attachment"),
41249
+ attachmentId: z17.string().min(1),
41250
+ ownerId: z17.string().min(1),
41251
+ addedAt: z17.string().min(1),
41252
+ slug: z17.string().optional(),
41253
+ type: z17.string().optional()
40947
41254
  }).strict()
40948
41255
  }).strict();
40949
- var DOCS_PROJECTION_RECEIPT_SCHEMA = z16.object({
40950
- version: z16.literal(1),
40951
- sourceHash: z16.string().regex(/^[a-f0-9]{64}$/),
40952
- graph: z16.enum(["completed", "disabled"]),
41256
+ var DOCS_PROJECTION_RECEIPT_SCHEMA = z17.object({
41257
+ version: z17.literal(1),
41258
+ sourceHash: z17.string().regex(/^[a-f0-9]{64}$/),
41259
+ graph: z17.enum(["completed", "disabled"]),
40953
41260
  /** Legacy receipts (before T13985): the "Doc attached" observation the projection wrote. */
40954
- observationId: z16.string().min(1).optional(),
41261
+ observationId: z17.string().min(1).optional(),
40955
41262
  /** T13985 (D11180): the canonical `llmtxt --documents--> owner` edge was written. */
40956
- documents: z16.literal(true).optional(),
40957
- verifiedAt: z16.string().min(1),
40958
- actor: z16.string().min(1)
41263
+ documents: z17.literal(true).optional(),
41264
+ verifiedAt: z17.string().min(1),
41265
+ actor: z17.string().min(1)
40959
41266
  }).strict().refine((receipt) => receipt.observationId !== void 0 || receipt.documents === true, {
40960
41267
  message: "A projection receipt records its documents edge or, for legacy jobs, its observation"
40961
41268
  });
40962
41269
 
40963
41270
  // packages/contracts/src/operations/ensures-schema-registry.ts
40964
- import { z as z17 } from "zod";
40965
- var taskTreeEntrySchema = z17.object({
40966
- 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" }),
40967
- 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), {
41271
+ import { z as z18 } from "zod";
41272
+ var taskTreeEntrySchema = z18.object({
41273
+ 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" }),
41274
+ 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), {
40968
41275
  message: "acceptance array contains no non-empty strings"
40969
41276
  }),
40970
- id: z17.string().optional(),
40971
- parentId: z17.string().optional(),
40972
- depends: z17.array(z17.string()).optional()
41277
+ id: z18.string().optional(),
41278
+ parentId: z18.string().optional(),
41279
+ depends: z18.array(z18.string()).optional()
40973
41280
  });
40974
- 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" });
40975
- var evidenceSchema = z17.unknown().superRefine((value, ctx) => {
41281
+ 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" });
41282
+ var evidenceSchema = z18.unknown().superRefine((value, ctx) => {
40976
41283
  if (value === null || value === void 0) {
40977
41284
  ctx.addIssue({
40978
41285
  code: "custom",
@@ -41006,7 +41313,7 @@ var evidenceSchema = z17.unknown().superRefine((value, ctx) => {
41006
41313
  message: `evidence must be a string, array, or object (got ${typeof value})`
41007
41314
  });
41008
41315
  });
41009
- var passthroughSchema = z17.unknown();
41316
+ var passthroughSchema = z18.unknown();
41010
41317
  var LEGACY_PASSTHROUGH_SCHEMA_NAMES = [
41011
41318
  // release.cantbook
41012
41319
  "version_bump_report",
@@ -41039,44 +41346,44 @@ var LEAD_RUNNER_TOOL_NAME = "cleo_run";
41039
41346
  var LEAD_RUNNER_TOOL = `mcp__${LEAD_RUNNER_MCP_SERVER}__${LEAD_RUNNER_TOOL_NAME}`;
41040
41347
 
41041
41348
  // packages/contracts/src/release/evidence-atoms.ts
41042
- import { z as z18 } from "zod";
41043
- var parsedPrEvidenceAtomSchema = z18.object({
41044
- kind: z18.literal("pr"),
41045
- prNumber: z18.number().int().positive()
41046
- });
41047
- var prEvidenceStateModifierSchema = z18.object({
41048
- kind: z18.literal("state"),
41049
- value: z18.literal("MERGED")
41050
- });
41051
- var ghPrViewSchema = z18.object({
41052
- state: z18.enum(["OPEN", "CLOSED", "MERGED"]),
41053
- mergedAt: z18.string().nullable(),
41054
- headRefOid: z18.string().optional(),
41055
- mergeCommit: z18.object({ oid: z18.string() }).nullable().optional(),
41056
- title: z18.string().optional(),
41057
- body: z18.string().optional(),
41058
- headRefName: z18.string().optional(),
41059
- files: z18.array(z18.object({ path: z18.string() })).optional(),
41060
- changedFiles: z18.number().int().nonnegative().optional(),
41061
- mergeable: z18.string().optional(),
41062
- statusCheckRollup: z18.array(
41063
- z18.object({
41064
- __typename: z18.string().optional(),
41065
- name: z18.string().optional(),
41066
- workflowName: z18.string().optional(),
41067
- conclusion: z18.string().nullable().optional(),
41068
- status: z18.string().optional(),
41349
+ import { z as z19 } from "zod";
41350
+ var parsedPrEvidenceAtomSchema = z19.object({
41351
+ kind: z19.literal("pr"),
41352
+ prNumber: z19.number().int().positive()
41353
+ });
41354
+ var prEvidenceStateModifierSchema = z19.object({
41355
+ kind: z19.literal("state"),
41356
+ value: z19.literal("MERGED")
41357
+ });
41358
+ var ghPrViewSchema = z19.object({
41359
+ state: z19.enum(["OPEN", "CLOSED", "MERGED"]),
41360
+ mergedAt: z19.string().nullable(),
41361
+ headRefOid: z19.string().optional(),
41362
+ mergeCommit: z19.object({ oid: z19.string() }).nullable().optional(),
41363
+ title: z19.string().optional(),
41364
+ body: z19.string().optional(),
41365
+ headRefName: z19.string().optional(),
41366
+ files: z19.array(z19.object({ path: z19.string() })).optional(),
41367
+ changedFiles: z19.number().int().nonnegative().optional(),
41368
+ mergeable: z19.string().optional(),
41369
+ statusCheckRollup: z19.array(
41370
+ z19.object({
41371
+ __typename: z19.string().optional(),
41372
+ name: z19.string().optional(),
41373
+ workflowName: z19.string().optional(),
41374
+ conclusion: z19.string().nullable().optional(),
41375
+ status: z19.string().optional(),
41069
41376
  /** ISO start time of a CheckRun; orders re-runs of one check (T13506). */
41070
- startedAt: z18.string().nullable().optional(),
41377
+ startedAt: z19.string().nullable().optional(),
41071
41378
  /** ISO completion time of a CheckRun; orders re-runs of one check (T13506). */
41072
- completedAt: z18.string().nullable().optional()
41379
+ completedAt: z19.string().nullable().optional()
41073
41380
  }).passthrough()
41074
41381
  ).optional().default([])
41075
41382
  }).passthrough();
41076
41383
  var PR_REQUIRED_WORKFLOWS = Object.freeze(["CI", "Contracts Dep Lint"]);
41077
41384
 
41078
41385
  // packages/contracts/src/release/plan.ts
41079
- import { z as z19 } from "zod";
41386
+ import { z as z20 } from "zod";
41080
41387
  var RELEASE_CHANNEL = ["latest", "beta", "alpha", "rc", "canary"];
41081
41388
  var RELEASE_SCHEME = ["calver", "semver", "calver-suffix"];
41082
41389
  var RELEASE_KIND = ["regular", "hotfix", "prerelease"];
@@ -41120,20 +41427,20 @@ var RESOLVED_SOURCE = [
41120
41427
  "language-default",
41121
41428
  "legacy-alias"
41122
41429
  ];
41123
- var ReleaseChannelSchema = z19.enum(RELEASE_CHANNEL);
41124
- var ReleaseSchemeSchema = z19.enum(RELEASE_SCHEME);
41125
- var ReleaseKindSchema = z19.enum(RELEASE_KIND);
41126
- var ReleaseStatusSchema = z19.enum(RELEASE_STATUS);
41127
- var GateStatusSchema = z19.enum(GATE_STATUS);
41128
- var GateNameSchema = z19.enum(GATE_NAME);
41129
- var PlatformTupleSchema = z19.enum(PLATFORM_TUPLE);
41130
- var PublisherSchema = z19.enum(PUBLISHER);
41131
- var TaskKindSchema = z19.enum(TASK_KIND);
41132
- var ImpactSchema = z19.enum(IMPACT);
41133
- var ResolvedSourceSchema = z19.enum(RESOLVED_SOURCE);
41134
- var Iso8601 = z19.iso.datetime({ offset: true });
41135
- var NonEmptyString = z19.string().min(1);
41136
- var ReleasePlanTaskSchema = z19.object({
41430
+ var ReleaseChannelSchema = z20.enum(RELEASE_CHANNEL);
41431
+ var ReleaseSchemeSchema = z20.enum(RELEASE_SCHEME);
41432
+ var ReleaseKindSchema = z20.enum(RELEASE_KIND);
41433
+ var ReleaseStatusSchema = z20.enum(RELEASE_STATUS);
41434
+ var GateStatusSchema = z20.enum(GATE_STATUS);
41435
+ var GateNameSchema = z20.enum(GATE_NAME);
41436
+ var PlatformTupleSchema = z20.enum(PLATFORM_TUPLE);
41437
+ var PublisherSchema = z20.enum(PUBLISHER);
41438
+ var TaskKindSchema = z20.enum(TASK_KIND);
41439
+ var ImpactSchema = z20.enum(IMPACT);
41440
+ var ResolvedSourceSchema = z20.enum(RESOLVED_SOURCE);
41441
+ var Iso8601 = z20.iso.datetime({ offset: true });
41442
+ var NonEmptyString = z20.string().min(1);
41443
+ var ReleasePlanTaskSchema = z20.object({
41137
41444
  /** Task ID (e.g. "T10001"). Format intentionally loose so historical IDs validate. */
41138
41445
  id: NonEmptyString,
41139
41446
  /** Conventional-commit-aligned task classification. */
@@ -41141,20 +41448,20 @@ var ReleasePlanTaskSchema = z19.object({
41141
41448
  /** SemVer impact classification. */
41142
41449
  impact: ImpactSchema,
41143
41450
  /** Human-readable changelog line for this task. */
41144
- userFacingSummary: z19.string(),
41451
+ userFacingSummary: z20.string(),
41145
41452
  /**
41146
41453
  * ADR-051 evidence atoms attesting the task's gate results. Format is
41147
41454
  * `kind:value` (e.g. `commit:abc123`, `test-run:vitest.json`). The contract
41148
41455
  * accepts empty arrays so legacy plans validate; `cleo release plan`
41149
41456
  * enforces non-empty via R-301.
41150
41457
  */
41151
- evidenceAtoms: z19.array(NonEmptyString),
41458
+ evidenceAtoms: z20.array(NonEmptyString),
41152
41459
  /** IVTR phase at plan time — informational only per R-316. */
41153
- ivtrPhaseAtPlan: z19.string().optional(),
41460
+ ivtrPhaseAtPlan: z20.string().optional(),
41154
41461
  /** Epic this task rolls up to, locked at plan time per R-303. */
41155
41462
  epicAncestor: NonEmptyString
41156
41463
  });
41157
- var ReleaseGateSchema = z19.object({
41464
+ var ReleaseGateSchema = z20.object({
41158
41465
  /** Canonical gate name. */
41159
41466
  name: GateNameSchema,
41160
41467
  /** ADR-051 atom string identifying the resolved tool (e.g. `tool:test`). */
@@ -41164,11 +41471,11 @@ var ReleaseGateSchema = z19.object({
41164
41471
  /** ISO-8601 timestamp the gate was last verified. */
41165
41472
  lastVerifiedAt: Iso8601,
41166
41473
  /** Resolved shell command (e.g. `pnpm run test`). Optional for unresolved gates. */
41167
- resolvedCommand: z19.string().optional(),
41474
+ resolvedCommand: z20.string().optional(),
41168
41475
  /** Provenance of the resolved command. Optional for unresolved gates. */
41169
41476
  resolvedSource: ResolvedSourceSchema.optional()
41170
41477
  });
41171
- var ReleasePlatformMatrixEntrySchema = z19.object({
41478
+ var ReleasePlatformMatrixEntrySchema = z20.object({
41172
41479
  /** Target platform tuple. */
41173
41480
  platform: PlatformTupleSchema,
41174
41481
  /** Distribution backend. */
@@ -41176,47 +41483,47 @@ var ReleasePlatformMatrixEntrySchema = z19.object({
41176
41483
  /** Package identifier on the target backend (e.g. `@cleocode/cleo`). */
41177
41484
  package: NonEmptyString,
41178
41485
  /** Whether to run the GHA smoke job for this matrix entry. */
41179
- smoke: z19.boolean().default(true).optional()
41486
+ smoke: z20.boolean().default(true).optional()
41180
41487
  });
41181
- var ReleasePreflightSummarySchema = z19.object({
41488
+ var ReleasePreflightSummarySchema = z20.object({
41182
41489
  /** True if esbuild externals are out of sync with package.json. */
41183
- esbuildExternalsDrift: z19.boolean(),
41490
+ esbuildExternalsDrift: z20.boolean(),
41184
41491
  /** True if `pnpm-lock.yaml` diverges from the workspace manifest. */
41185
- lockfileDrift: z19.boolean(),
41492
+ lockfileDrift: z20.boolean(),
41186
41493
  /** True if all epic children are in terminal lifecycle states. */
41187
- epicCompletenessClean: z19.boolean(),
41494
+ epicCompletenessClean: z20.boolean(),
41188
41495
  /** True if no task appears in multiple in-flight release plans. */
41189
- doubleListingClean: z19.boolean(),
41496
+ doubleListingClean: z20.boolean(),
41190
41497
  /** Non-fatal preflight warnings (e.g. unresolved tools per R-024). */
41191
- preflightWarnings: z19.array(z19.string()).default([]).optional()
41498
+ preflightWarnings: z20.array(z20.string()).default([]).optional()
41192
41499
  });
41193
- var ReleasePlanChangelogSchema = z19.object({
41500
+ var ReleasePlanChangelogSchema = z20.object({
41194
41501
  /** `kind=feat` tasks. */
41195
- features: z19.array(NonEmptyString).default([]),
41502
+ features: z20.array(NonEmptyString).default([]),
41196
41503
  /** `kind=fix` or `kind=hotfix` tasks. */
41197
- fixes: z19.array(NonEmptyString).default([]),
41504
+ fixes: z20.array(NonEmptyString).default([]),
41198
41505
  /** `kind=chore`, `docs`, `refactor`, `test`, `perf` tasks. */
41199
- chores: z19.array(NonEmptyString).default([]),
41506
+ chores: z20.array(NonEmptyString).default([]),
41200
41507
  /** `kind=breaking` or `kind=revert` tasks. */
41201
- breaking: z19.array(NonEmptyString).default([])
41508
+ breaking: z20.array(NonEmptyString).default([])
41202
41509
  });
41203
- var ReleasePlanMetaSchema = z19.object({
41510
+ var ReleasePlanMetaSchema = z20.object({
41204
41511
  /** True if this is the project's first ever release. */
41205
- firstEverRelease: z19.boolean().optional(),
41512
+ firstEverRelease: z20.boolean().optional(),
41206
41513
  /** Canonical tool names that could not be resolved at plan time. */
41207
- unresolvedTools: z19.array(z19.string()).optional(),
41514
+ unresolvedTools: z20.array(z20.string()).optional(),
41208
41515
  /** Project archetype detected at plan time. */
41209
- archetype: z19.string().optional()
41210
- }).catchall(z19.unknown());
41211
- var ReleasePlanSchema = z19.object({
41516
+ archetype: z20.string().optional()
41517
+ }).catchall(z20.unknown());
41518
+ var ReleasePlanSchema = z20.object({
41212
41519
  /** Schema URL for this plan version. */
41213
- $schema: z19.string().optional(),
41520
+ $schema: z20.string().optional(),
41214
41521
  /** Requested version string (e.g. "v2026.6.0"). Includes the leading `v`. */
41215
41522
  version: NonEmptyString,
41216
41523
  /** Resolved version string after suffix application (e.g. "v2026.6.0.2"). */
41217
41524
  resolvedVersion: NonEmptyString,
41218
41525
  /** True if a `calver-suffix` was applied to disambiguate a same-day hotfix. */
41219
- suffixApplied: z19.boolean(),
41526
+ suffixApplied: z20.boolean(),
41220
41527
  /** Versioning scheme governing `version` / `resolvedVersion`. */
41221
41528
  scheme: ReleaseSchemeSchema,
41222
41529
  /** npm dist-tag channel for this release. */
@@ -41230,7 +41537,7 @@ var ReleasePlanSchema = z19.object({
41230
41537
  /** Release-kind classification. */
41231
41538
  releaseKind: ReleaseKindSchema,
41232
41539
  /** Explicit hooks-v1 stable promotion; ordinary and hotfix releases are exempt. */
41233
- hooksV1Promotion: z19.boolean().optional(),
41540
+ hooksV1Promotion: z20.boolean().optional(),
41234
41541
  /** Audited reason for shipping a source change that opens the hooks-v1 gate without the promotion (T13555). */
41235
41542
  hooksV1Waiver: NonEmptyString.optional(),
41236
41543
  /** ISO-8601 timestamp the plan was written. */
@@ -41241,27 +41548,27 @@ var ReleasePlanSchema = z19.object({
41241
41548
  * Version of the previous release on the same channel. MUST be `null` only
41242
41549
  * for first-ever releases (R-300, enforced at the verb layer).
41243
41550
  */
41244
- previousVersion: z19.string().nullable(),
41551
+ previousVersion: z20.string().nullable(),
41245
41552
  /** Git tag of the previous release (typically `previousVersion` prefixed). */
41246
- previousTag: z19.string().nullable(),
41553
+ previousTag: z20.string().nullable(),
41247
41554
  /** ISO-8601 timestamp the previous release was published. */
41248
41555
  previousShippedAt: Iso8601.nullable(),
41249
41556
  /** Tasks rolled into this release. */
41250
- tasks: z19.array(ReleasePlanTaskSchema),
41557
+ tasks: z20.array(ReleasePlanTaskSchema),
41251
41558
  /** Bucketed changelog. */
41252
41559
  changelog: ReleasePlanChangelogSchema,
41253
41560
  /** Per-gate verification status. */
41254
- gates: z19.array(ReleaseGateSchema),
41561
+ gates: z20.array(ReleaseGateSchema),
41255
41562
  /** Platform / publisher matrix. */
41256
- platformMatrix: z19.array(ReleasePlatformMatrixEntrySchema),
41563
+ platformMatrix: z20.array(ReleasePlatformMatrixEntrySchema),
41257
41564
  /** Preflight summary from `cleo release plan`. */
41258
41565
  preflightSummary: ReleasePreflightSummarySchema,
41259
41566
  /** URL of the GHA workflow run (populated by `release-prepare.yml`). */
41260
- workflowRunUrl: z19.string().nullable(),
41567
+ workflowRunUrl: z20.string().nullable(),
41261
41568
  /** URL of the bump PR (populated by `cleo release open`). */
41262
- prUrl: z19.string().nullable(),
41569
+ prUrl: z20.string().nullable(),
41263
41570
  /** Merge commit SHA on `main` (populated by `release-publish.yml`). */
41264
- mergeCommitSha: z19.string().nullable(),
41571
+ mergeCommitSha: z20.string().nullable(),
41265
41572
  /** Current FSM state per R-302. */
41266
41573
  status: ReleaseStatusSchema,
41267
41574
  /** Informational / forward-compat metadata. */
@@ -41291,48 +41598,48 @@ var RESOURCE_CLASSES = Object.freeze([
41291
41598
  ]);
41292
41599
 
41293
41600
  // packages/contracts/src/session-journal.ts
41294
- import { z as z20 } from "zod";
41601
+ import { z as z21 } from "zod";
41295
41602
  var SESSION_JOURNAL_SCHEMA_VERSION = "1.0";
41296
- var sessionJournalDoctorSummarySchema = z20.object({
41603
+ var sessionJournalDoctorSummarySchema = z21.object({
41297
41604
  /** `true` when zero noise patterns were detected. */
41298
- isClean: z20.boolean(),
41605
+ isClean: z21.boolean(),
41299
41606
  /** Total number of noise findings across all patterns. */
41300
- findingsCount: z20.number().int().nonnegative(),
41607
+ findingsCount: z21.number().int().nonnegative(),
41301
41608
  /** Pattern names that were detected (empty when isClean). */
41302
- patterns: z20.array(z20.string()),
41609
+ patterns: z21.array(z21.string()),
41303
41610
  /** Total brain entries scanned. `0` = empty or unavailable. */
41304
- totalScanned: z20.number().int().nonnegative()
41611
+ totalScanned: z21.number().int().nonnegative()
41305
41612
  });
41306
- var sessionJournalDebriefSummarySchema = z20.object({
41613
+ var sessionJournalDebriefSummarySchema = z21.object({
41307
41614
  /** First 200 characters of the session end note (if provided). */
41308
- noteExcerpt: z20.string().max(200).optional(),
41615
+ noteExcerpt: z21.string().max(200).optional(),
41309
41616
  /** Number of tasks completed during the session. */
41310
- tasksCompletedCount: z20.number().int().nonnegative(),
41617
+ tasksCompletedCount: z21.number().int().nonnegative(),
41311
41618
  /** Up to 5 task IDs (not titles) that were the focus of the session. */
41312
- tasksFocused: z20.array(z20.string()).max(5).optional()
41619
+ tasksFocused: z21.array(z21.string()).max(5).optional()
41313
41620
  });
41314
- var sessionJournalEntrySchema = z20.object({
41621
+ var sessionJournalEntrySchema = z21.object({
41315
41622
  // Identity
41316
41623
  /** Schema version for forward-compatibility. Always `'1.0'` in this release. */
41317
- schemaVersion: z20.literal(SESSION_JOURNAL_SCHEMA_VERSION),
41624
+ schemaVersion: z21.literal(SESSION_JOURNAL_SCHEMA_VERSION),
41318
41625
  /** ISO 8601 timestamp when the entry was written. */
41319
- timestamp: z20.string(),
41626
+ timestamp: z21.string(),
41320
41627
  /** CLEO session ID (e.g. `ses_20260424055456_ede571`). */
41321
- sessionId: z20.string(),
41628
+ sessionId: z21.string(),
41322
41629
  /** Event type that triggered this journal entry. */
41323
- eventType: z20.enum(["session_start", "session_end", "observation", "decision", "error"]),
41630
+ eventType: z21.enum(["session_start", "session_end", "observation", "decision", "error"]),
41324
41631
  // Session metadata (set on session_start / session_end)
41325
41632
  /** Agent identifier (e.g. `cleo-prime`, `claude-code`). */
41326
- agentIdentifier: z20.string().optional(),
41633
+ agentIdentifier: z21.string().optional(),
41327
41634
  /** Provider adapter ID active for this session. */
41328
- providerId: z20.string().optional(),
41635
+ providerId: z21.string().optional(),
41329
41636
  /** Session scope string (e.g. `'global'` or `'epic:T1263'`). */
41330
- scope: z20.string().optional(),
41637
+ scope: z21.string().optional(),
41331
41638
  // Session-end fields
41332
41639
  /** Duration of the session in seconds (session_end only). */
41333
- duration: z20.number().int().nonnegative().optional(),
41640
+ duration: z21.number().int().nonnegative().optional(),
41334
41641
  /** Task IDs (not titles) completed during the session. */
41335
- tasksCompleted: z20.array(z20.string()).optional(),
41642
+ tasksCompleted: z21.array(z21.string()).optional(),
41336
41643
  // Doctor summary (T1262 absorbed)
41337
41644
  /**
41338
41645
  * Compact result of `scanBrainNoise` run at session-end.
@@ -41347,52 +41654,52 @@ var sessionJournalEntrySchema = z20.object({
41347
41654
  debriefSummary: sessionJournalDebriefSummarySchema.optional(),
41348
41655
  // Optional hash chain
41349
41656
  /** SHA-256 hex of the previous entry's raw JSON string (for integrity chain). */
41350
- prevEntryHash: z20.string().optional()
41657
+ prevEntryHash: z21.string().optional()
41351
41658
  });
41352
41659
 
41353
41660
  // packages/contracts/src/task-evidence.ts
41354
- import { z as z21 } from "zod";
41355
- var fileEvidenceSchema = z21.object({
41356
- kind: z21.literal("file"),
41357
- sha256: z21.string().length(64),
41358
- timestamp: z21.string().datetime(),
41359
- path: z21.string().min(1),
41360
- mime: z21.string().optional(),
41361
- description: z21.string().optional()
41362
- });
41363
- var logEvidenceSchema = z21.object({
41364
- kind: z21.literal("log"),
41365
- sha256: z21.string().length(64),
41366
- timestamp: z21.string().datetime(),
41367
- source: z21.string().min(1),
41368
- description: z21.string().optional()
41369
- });
41370
- var screenshotEvidenceSchema = z21.object({
41371
- kind: z21.literal("screenshot"),
41372
- sha256: z21.string().length(64),
41373
- timestamp: z21.string().datetime(),
41374
- mime: z21.enum(["image/png", "image/jpeg", "image/webp"]).optional(),
41375
- description: z21.string().optional()
41376
- });
41377
- var testOutputEvidenceSchema = z21.object({
41378
- kind: z21.literal("test-output"),
41379
- sha256: z21.string().length(64),
41380
- timestamp: z21.string().datetime(),
41381
- passed: z21.number().int().nonnegative(),
41382
- failed: z21.number().int().nonnegative(),
41383
- skipped: z21.number().int().nonnegative(),
41384
- exitCode: z21.number().int(),
41385
- description: z21.string().optional()
41386
- });
41387
- var commandOutputEvidenceSchema = z21.object({
41388
- kind: z21.literal("command-output"),
41389
- sha256: z21.string().length(64),
41390
- timestamp: z21.string().datetime(),
41391
- cmd: z21.string().min(1),
41392
- exitCode: z21.number().int(),
41393
- description: z21.string().optional()
41394
- });
41395
- var taskEvidenceSchema = z21.discriminatedUnion("kind", [
41661
+ import { z as z22 } from "zod";
41662
+ var fileEvidenceSchema = z22.object({
41663
+ kind: z22.literal("file"),
41664
+ sha256: z22.string().length(64),
41665
+ timestamp: z22.string().datetime(),
41666
+ path: z22.string().min(1),
41667
+ mime: z22.string().optional(),
41668
+ description: z22.string().optional()
41669
+ });
41670
+ var logEvidenceSchema = z22.object({
41671
+ kind: z22.literal("log"),
41672
+ sha256: z22.string().length(64),
41673
+ timestamp: z22.string().datetime(),
41674
+ source: z22.string().min(1),
41675
+ description: z22.string().optional()
41676
+ });
41677
+ var screenshotEvidenceSchema = z22.object({
41678
+ kind: z22.literal("screenshot"),
41679
+ sha256: z22.string().length(64),
41680
+ timestamp: z22.string().datetime(),
41681
+ mime: z22.enum(["image/png", "image/jpeg", "image/webp"]).optional(),
41682
+ description: z22.string().optional()
41683
+ });
41684
+ var testOutputEvidenceSchema = z22.object({
41685
+ kind: z22.literal("test-output"),
41686
+ sha256: z22.string().length(64),
41687
+ timestamp: z22.string().datetime(),
41688
+ passed: z22.number().int().nonnegative(),
41689
+ failed: z22.number().int().nonnegative(),
41690
+ skipped: z22.number().int().nonnegative(),
41691
+ exitCode: z22.number().int(),
41692
+ description: z22.string().optional()
41693
+ });
41694
+ var commandOutputEvidenceSchema = z22.object({
41695
+ kind: z22.literal("command-output"),
41696
+ sha256: z22.string().length(64),
41697
+ timestamp: z22.string().datetime(),
41698
+ cmd: z22.string().min(1),
41699
+ exitCode: z22.number().int(),
41700
+ description: z22.string().optional()
41701
+ });
41702
+ var taskEvidenceSchema = z22.discriminatedUnion("kind", [
41396
41703
  fileEvidenceSchema,
41397
41704
  logEvidenceSchema,
41398
41705
  screenshotEvidenceSchema,
@@ -41401,8 +41708,8 @@ var taskEvidenceSchema = z21.discriminatedUnion("kind", [
41401
41708
  ]);
41402
41709
 
41403
41710
  // packages/contracts/src/tasks/archive.ts
41404
- import { z as z22 } from "zod";
41405
- var ArchiveReason = z22.enum([
41711
+ import { z as z23 } from "zod";
41712
+ var ArchiveReason = z23.enum([
41406
41713
  "verified",
41407
41714
  "reconciled",
41408
41715
  "superseded",
@@ -41413,42 +41720,42 @@ var ArchiveReason = z22.enum([
41413
41720
  var ARCHIVE_REASON_VALUES = ArchiveReason.options;
41414
41721
 
41415
41722
  // packages/contracts/src/tasks/index.ts
41416
- import { z as z23 } from "zod";
41417
- var taskMutationWarningSeveritySchema = z23.enum(["info", "warning"]);
41418
- var taskMutationWarningSchema = z23.object({
41419
- code: z23.string().min(1),
41420
- message: z23.string().min(1),
41723
+ import { z as z24 } from "zod";
41724
+ var taskMutationWarningSeveritySchema = z24.enum(["info", "warning"]);
41725
+ var taskMutationWarningSchema = z24.object({
41726
+ code: z24.string().min(1),
41727
+ message: z24.string().min(1),
41421
41728
  severity: taskMutationWarningSeveritySchema.optional(),
41422
- taskId: z23.string().min(1).optional(),
41423
- field: z23.string().min(1).optional(),
41424
- index: z23.number().int().nonnegative().optional()
41425
- });
41426
- var taskMutationDryRunSummarySchema = z23.object({
41427
- dryRun: z23.literal(true),
41428
- wouldCreate: z23.number().int().nonnegative(),
41429
- wouldUpdate: z23.number().int().nonnegative(),
41430
- wouldDelete: z23.number().int().nonnegative(),
41431
- wouldAffect: z23.number().int().nonnegative(),
41432
- validatedCount: z23.number().int().nonnegative(),
41433
- insertedCount: z23.literal(0),
41434
- updatedCount: z23.literal(0),
41435
- deletedCount: z23.literal(0),
41436
- warnings: z23.array(taskMutationWarningSchema)
41437
- });
41438
- var taskMutationTaskRecordSchema = z23.object({ id: z23.string().min(1) }).passthrough();
41439
- var taskMutationEnvelopeSchema = z23.object({
41440
- dryRun: z23.boolean().optional(),
41441
- created: z23.array(taskMutationTaskRecordSchema),
41442
- updated: z23.array(taskMutationTaskRecordSchema),
41443
- deleted: z23.array(taskMutationTaskRecordSchema),
41444
- affectedCount: z23.number().int().nonnegative(),
41445
- mutationWarnings: z23.array(taskMutationWarningSchema),
41729
+ taskId: z24.string().min(1).optional(),
41730
+ field: z24.string().min(1).optional(),
41731
+ index: z24.number().int().nonnegative().optional()
41732
+ });
41733
+ var taskMutationDryRunSummarySchema = z24.object({
41734
+ dryRun: z24.literal(true),
41735
+ wouldCreate: z24.number().int().nonnegative(),
41736
+ wouldUpdate: z24.number().int().nonnegative(),
41737
+ wouldDelete: z24.number().int().nonnegative(),
41738
+ wouldAffect: z24.number().int().nonnegative(),
41739
+ validatedCount: z24.number().int().nonnegative(),
41740
+ insertedCount: z24.literal(0),
41741
+ updatedCount: z24.literal(0),
41742
+ deletedCount: z24.literal(0),
41743
+ warnings: z24.array(taskMutationWarningSchema)
41744
+ });
41745
+ var taskMutationTaskRecordSchema = z24.object({ id: z24.string().min(1) }).passthrough();
41746
+ var taskMutationEnvelopeSchema = z24.object({
41747
+ dryRun: z24.boolean().optional(),
41748
+ created: z24.array(taskMutationTaskRecordSchema),
41749
+ updated: z24.array(taskMutationTaskRecordSchema),
41750
+ deleted: z24.array(taskMutationTaskRecordSchema),
41751
+ affectedCount: z24.number().int().nonnegative(),
41752
+ mutationWarnings: z24.array(taskMutationWarningSchema),
41446
41753
  dryRunSummary: taskMutationDryRunSummarySchema.optional()
41447
41754
  });
41448
- var completionTaskStatusSchema = z23.enum(TASK_STATUSES);
41449
- var completionCriterionKindSchema = z23.enum(["text", "evidence_bound", "child_task"]);
41450
- var completionCriterionStatusSchema = z23.enum(["satisfied", "unsatisfied", "waived", "replaced"]);
41451
- var completionBlockerReasonSchema = z23.enum([
41755
+ var completionTaskStatusSchema = z24.enum(TASK_STATUSES);
41756
+ var completionCriterionKindSchema = z24.enum(["text", "evidence_bound", "child_task"]);
41757
+ var completionCriterionStatusSchema = z24.enum(["satisfied", "unsatisfied", "waived", "replaced"]);
41758
+ var completionBlockerReasonSchema = z24.enum([
41452
41759
  "missing_evidence_binding",
41453
41760
  "child_not_done",
41454
41761
  "child_cancelled_requires_waiver",
@@ -41456,68 +41763,68 @@ var completionBlockerReasonSchema = z23.enum([
41456
41763
  "child_missing",
41457
41764
  "done_parent_stale"
41458
41765
  ]);
41459
- var completionStaleReasonSchema = z23.enum(["done_parent_has_unsatisfied_criteria"]);
41460
- var completionProjectionRepairErrorCodeSchema = z23.enum([
41766
+ var completionStaleReasonSchema = z24.enum(["done_parent_has_unsatisfied_criteria"]);
41767
+ var completionProjectionRepairErrorCodeSchema = z24.enum([
41461
41768
  "projection_not_stale",
41462
41769
  "criteria_missing",
41463
41770
  "binding_target_missing",
41464
41771
  "repair_conflict"
41465
41772
  ]);
41466
- var completionCriterionWaiverSchema = z23.object({
41467
- criterionAcId: z23.string().min(1),
41468
- childTaskId: z23.string().min(1),
41469
- reason: z23.string().min(1),
41470
- actor: z23.string().min(1),
41471
- waivedAt: z23.string().min(1)
41472
- });
41473
- var completionCriterionReplacementSchema = z23.object({
41474
- criterionAcId: z23.string().min(1),
41475
- originalChildTaskId: z23.string().min(1),
41476
- replacementChildTaskId: z23.string().min(1),
41477
- reason: z23.string().min(1),
41478
- actor: z23.string().min(1),
41479
- replacedAt: z23.string().min(1)
41480
- });
41481
- var completionCriterionEvaluationSchema = z23.object({
41482
- acId: z23.string().min(1),
41483
- alias: z23.string().min(1),
41484
- text: z23.string(),
41773
+ var completionCriterionWaiverSchema = z24.object({
41774
+ criterionAcId: z24.string().min(1),
41775
+ childTaskId: z24.string().min(1),
41776
+ reason: z24.string().min(1),
41777
+ actor: z24.string().min(1),
41778
+ waivedAt: z24.string().min(1)
41779
+ });
41780
+ var completionCriterionReplacementSchema = z24.object({
41781
+ criterionAcId: z24.string().min(1),
41782
+ originalChildTaskId: z24.string().min(1),
41783
+ replacementChildTaskId: z24.string().min(1),
41784
+ reason: z24.string().min(1),
41785
+ actor: z24.string().min(1),
41786
+ replacedAt: z24.string().min(1)
41787
+ });
41788
+ var completionCriterionEvaluationSchema = z24.object({
41789
+ acId: z24.string().min(1),
41790
+ alias: z24.string().min(1),
41791
+ text: z24.string(),
41485
41792
  kind: completionCriterionKindSchema,
41486
41793
  status: completionCriterionStatusSchema,
41487
41794
  reason: completionBlockerReasonSchema.optional(),
41488
- targetTaskId: z23.string().min(1).optional(),
41795
+ targetTaskId: z24.string().min(1).optional(),
41489
41796
  targetTaskStatus: completionTaskStatusSchema.optional(),
41490
41797
  waiver: completionCriterionWaiverSchema.optional(),
41491
41798
  replacement: completionCriterionReplacementSchema.optional(),
41492
41799
  replacementTaskStatus: completionTaskStatusSchema.optional(),
41493
- evidenceBindings: z23.number().int().nonnegative()
41800
+ evidenceBindings: z24.number().int().nonnegative()
41494
41801
  });
41495
41802
  var unsatisfiedCompletionCriterionSchema = completionCriterionEvaluationSchema.extend({
41496
- status: z23.literal("unsatisfied"),
41803
+ status: z24.literal("unsatisfied"),
41497
41804
  reason: completionBlockerReasonSchema
41498
41805
  });
41499
- var completionTotalsSchema = z23.object({
41500
- criteria: z23.number().int().nonnegative(),
41501
- satisfied: z23.number().int().nonnegative(),
41502
- unsatisfied: z23.number().int().nonnegative(),
41503
- waived: z23.number().int().nonnegative(),
41504
- replaced: z23.number().int().nonnegative()
41505
- });
41506
- var completionContextPackSchema = z23.object({
41507
- taskId: z23.string().min(1),
41508
- generatedAt: z23.string().min(1),
41509
- source: z23.literal("audit_log"),
41510
- window: z23.object({
41511
- limit: z23.number().int().positive(),
41512
- since: z23.string().min(1).optional(),
41513
- relationDepth: z23.number().int().nonnegative(),
41514
- relatedTaskIds: z23.array(z23.string().min(1))
41806
+ var completionTotalsSchema = z24.object({
41807
+ criteria: z24.number().int().nonnegative(),
41808
+ satisfied: z24.number().int().nonnegative(),
41809
+ unsatisfied: z24.number().int().nonnegative(),
41810
+ waived: z24.number().int().nonnegative(),
41811
+ replaced: z24.number().int().nonnegative()
41812
+ });
41813
+ var completionContextPackSchema = z24.object({
41814
+ taskId: z24.string().min(1),
41815
+ generatedAt: z24.string().min(1),
41816
+ source: z24.literal("audit_log"),
41817
+ window: z24.object({
41818
+ limit: z24.number().int().positive(),
41819
+ since: z24.string().min(1).optional(),
41820
+ relationDepth: z24.number().int().nonnegative(),
41821
+ relatedTaskIds: z24.array(z24.string().min(1))
41515
41822
  }),
41516
- events: z23.array(
41517
- z23.object({
41518
- id: z23.string().min(1),
41519
- timestamp: z23.string().min(1),
41520
- action: z23.enum([
41823
+ events: z24.array(
41824
+ z24.object({
41825
+ id: z24.string().min(1),
41826
+ timestamp: z24.string().min(1),
41827
+ action: z24.enum([
41521
41828
  "task_completed",
41522
41829
  "task_reopened",
41523
41830
  "task_cancelled",
@@ -41525,77 +41832,77 @@ var completionContextPackSchema = z23.object({
41525
41832
  "task_reparented",
41526
41833
  "ac_projection_rebuilt"
41527
41834
  ]),
41528
- taskId: z23.string().min(1),
41529
- relation: z23.enum(["self", "parent", "child", "sibling", "related"]),
41530
- actor: z23.string().min(1),
41531
- details: z23.record(z23.string(), z23.unknown()).optional(),
41532
- before: z23.record(z23.string(), z23.unknown()).optional(),
41533
- after: z23.record(z23.string(), z23.unknown()).optional()
41835
+ taskId: z24.string().min(1),
41836
+ relation: z24.enum(["self", "parent", "child", "sibling", "related"]),
41837
+ actor: z24.string().min(1),
41838
+ details: z24.record(z24.string(), z24.unknown()).optional(),
41839
+ before: z24.record(z24.string(), z24.unknown()).optional(),
41840
+ after: z24.record(z24.string(), z24.unknown()).optional()
41534
41841
  })
41535
41842
  ),
41536
- summary: z23.object({
41537
- totalEvents: z23.number().int().nonnegative(),
41538
- byAction: z23.record(z23.string(), z23.number().int().nonnegative()),
41539
- byRelation: z23.record(z23.string(), z23.number().int().nonnegative()),
41540
- latestEventAt: z23.string().nullable()
41843
+ summary: z24.object({
41844
+ totalEvents: z24.number().int().nonnegative(),
41845
+ byAction: z24.record(z24.string(), z24.number().int().nonnegative()),
41846
+ byRelation: z24.record(z24.string(), z24.number().int().nonnegative()),
41847
+ latestEventAt: z24.string().nullable()
41541
41848
  })
41542
41849
  });
41543
- var completionEvaluationSchema = z23.object({
41544
- taskId: z23.string().min(1),
41850
+ var completionEvaluationSchema = z24.object({
41851
+ taskId: z24.string().min(1),
41545
41852
  taskStatus: completionTaskStatusSchema,
41546
- ready: z23.boolean(),
41547
- stale: z23.boolean(),
41548
- staleReasons: z23.array(completionStaleReasonSchema),
41853
+ ready: z24.boolean(),
41854
+ stale: z24.boolean(),
41855
+ staleReasons: z24.array(completionStaleReasonSchema),
41549
41856
  contextPack: completionContextPackSchema.optional(),
41550
- satisfied: z23.array(completionCriterionEvaluationSchema),
41551
- unsatisfied: z23.array(unsatisfiedCompletionCriterionSchema),
41552
- waived: z23.array(completionCriterionEvaluationSchema),
41553
- replaced: z23.array(completionCriterionEvaluationSchema),
41857
+ satisfied: z24.array(completionCriterionEvaluationSchema),
41858
+ unsatisfied: z24.array(unsatisfiedCompletionCriterionSchema),
41859
+ waived: z24.array(completionCriterionEvaluationSchema),
41860
+ replaced: z24.array(completionCriterionEvaluationSchema),
41554
41861
  totals: completionTotalsSchema
41555
41862
  });
41556
- var completionExplanationSchema = z23.object({
41557
- taskId: z23.string().min(1),
41558
- ready: z23.boolean(),
41559
- stale: z23.boolean(),
41560
- summary: z23.string(),
41863
+ var completionExplanationSchema = z24.object({
41864
+ taskId: z24.string().min(1),
41865
+ ready: z24.boolean(),
41866
+ stale: z24.boolean(),
41867
+ summary: z24.string(),
41561
41868
  contextPack: completionContextPackSchema.optional(),
41562
- blockers: z23.array(completionCriterionEvaluationSchema)
41869
+ blockers: z24.array(completionCriterionEvaluationSchema)
41563
41870
  });
41564
- var completionListParamsSchema = z23.object({
41565
- taskId: z23.string().min(1),
41871
+ var completionListParamsSchema = z24.object({
41872
+ taskId: z24.string().min(1),
41566
41873
  status: completionCriterionStatusSchema.optional(),
41567
41874
  kind: completionCriterionKindSchema.optional()
41568
41875
  });
41569
- var completionListResultSchema = z23.object({
41570
- taskId: z23.string().min(1),
41571
- criteria: z23.array(completionCriterionEvaluationSchema),
41876
+ var completionListResultSchema = z24.object({
41877
+ taskId: z24.string().min(1),
41878
+ criteria: z24.array(completionCriterionEvaluationSchema),
41572
41879
  totals: completionTotalsSchema
41573
41880
  });
41574
- var completionEvaluateParamsSchema = z23.object({
41575
- taskId: z23.string().min(1),
41576
- includeContext: z23.boolean().optional(),
41577
- limit: z23.number().int().positive().optional(),
41578
- since: z23.string().min(1).optional(),
41579
- relationDepth: z23.number().int().nonnegative().optional()
41881
+ var completionEvaluateParamsSchema = z24.object({
41882
+ taskId: z24.string().min(1),
41883
+ includeContext: z24.boolean().optional(),
41884
+ limit: z24.number().int().positive().optional(),
41885
+ since: z24.string().min(1).optional(),
41886
+ relationDepth: z24.number().int().nonnegative().optional()
41580
41887
  });
41581
- var completionProjectionRepairErrorSchema = z23.object({
41888
+ var completionProjectionRepairErrorSchema = z24.object({
41582
41889
  code: completionProjectionRepairErrorCodeSchema,
41583
- message: z23.string().min(1),
41584
- taskId: z23.string().min(1),
41585
- acId: z23.string().min(1).optional(),
41586
- evidenceAtomId: z23.string().min(1).optional()
41587
- });
41588
- var completionProjectionRepairParamsSchema = z23.object({
41589
- taskId: z23.string().min(1),
41590
- dryRun: z23.boolean().optional()
41591
- });
41592
- var completionProjectionRepairResultSchema = z23.object({
41593
- taskId: z23.string().min(1),
41594
- repaired: z23.boolean(),
41595
- dryRun: z23.boolean(),
41596
- staleBefore: z23.boolean(),
41597
- staleAfter: z23.boolean(),
41598
- errors: z23.array(completionProjectionRepairErrorSchema)
41890
+ message: z24.string().min(1),
41891
+ taskId: z24.string().min(1),
41892
+ acId: z24.string().min(1).optional(),
41893
+ evidenceAtomId: z24.string().min(1).optional()
41894
+ });
41895
+ var completionProjectionRepairParamsSchema = z24.object({
41896
+ taskId: z24.string().min(1),
41897
+ dryRun: z24.boolean().optional()
41898
+ });
41899
+ var completionProjectionRepairResultSchema = z24.object({
41900
+ taskId: z24.string().min(1),
41901
+ repaired: z24.boolean(),
41902
+ dryRun: z24.boolean(),
41903
+ staleBefore: z24.boolean(),
41904
+ staleAfter: z24.boolean(),
41905
+ errors: z24.array(completionProjectionRepairErrorSchema)
41599
41906
  });
41600
41907
 
41601
41908
  // packages/contracts/src/taxonomy.ts
@@ -42098,7 +42405,7 @@ var TaxonomyRegistry = class _TaxonomyRegistry {
42098
42405
  };
42099
42406
 
42100
42407
  // packages/contracts/src/templates/manifest.ts
42101
- import { z as z24 } from "zod";
42408
+ import { z as z25 } from "zod";
42102
42409
  var TEMPLATE_KINDS = ["workflow", "config", "agent", "skill", "provider", "doc"];
42103
42410
  var TEMPLATE_SUBSTITUTIONS = ["regex-tmpl", "static", "json-merge"];
42104
42411
  var TEMPLATE_UPDATE_STRATEGIES = [
@@ -42115,79 +42422,79 @@ var PLACEHOLDER_SOURCES = [
42115
42422
  "tool-resolver",
42116
42423
  "literal"
42117
42424
  ];
42118
- var PlaceholderSpecSchema = z24.object({
42425
+ var PlaceholderSpecSchema = z25.object({
42119
42426
  /**
42120
42427
  * Placeholder identifier as it appears in the template body
42121
42428
  * (e.g. `NODE_VERSION` matches `{{NODE_VERSION}}`).
42122
42429
  */
42123
- name: z24.string().min(1, "placeholder name must be non-empty"),
42430
+ name: z25.string().min(1, "placeholder name must be non-empty"),
42124
42431
  /** Resolver source the installer consults for this placeholder. */
42125
- source: z24.enum(PLACEHOLDER_SOURCES),
42432
+ source: z25.enum(PLACEHOLDER_SOURCES),
42126
42433
  /**
42127
42434
  * Path expression evaluated against `source` (e.g. `engines.node` against
42128
42435
  * `project-context`, `defaults.branchModel` against `.cleo/config`).
42129
42436
  * For `literal` source, this MAY be the literal value's identifier.
42130
42437
  */
42131
- sourcePath: z24.string().min(1, "placeholder sourcePath must be non-empty"),
42438
+ sourcePath: z25.string().min(1, "placeholder sourcePath must be non-empty"),
42132
42439
  /**
42133
42440
  * Fallback value used when `source[sourcePath]` resolves to `undefined`.
42134
42441
  * `null` is permitted to explicitly mark "no default — failure required".
42135
42442
  */
42136
- defaultValue: z24.union([z24.string(), z24.number(), z24.boolean(), z24.null()]).optional()
42443
+ defaultValue: z25.union([z25.string(), z25.number(), z25.boolean(), z25.null()]).optional()
42137
42444
  });
42138
- var TemplateManifestEntrySchema = z24.object({
42445
+ var TemplateManifestEntrySchema = z25.object({
42139
42446
  /** Stable identifier for this template entry. */
42140
- id: z24.string().min(1, "id must be non-empty"),
42447
+ id: z25.string().min(1, "id must be non-empty"),
42141
42448
  /** Category of file this template represents. */
42142
- kind: z24.enum(TEMPLATE_KINDS),
42449
+ kind: z25.enum(TEMPLATE_KINDS),
42143
42450
  /** Repo-relative path of the template source file. */
42144
- sourcePath: z24.string().min(1, "sourcePath must be non-empty"),
42451
+ sourcePath: z25.string().min(1, "sourcePath must be non-empty"),
42145
42452
  /** Project-relative path where the rendered template installs. */
42146
- installPath: z24.string().min(1, "installPath must be non-empty"),
42453
+ installPath: z25.string().min(1, "installPath must be non-empty"),
42147
42454
  /** Substitution strategy the installer applies to `sourcePath`. */
42148
- substitution: z24.enum(TEMPLATE_SUBSTITUTIONS),
42455
+ substitution: z25.enum(TEMPLATE_SUBSTITUTIONS),
42149
42456
  /** Declared placeholders this template requires. May be empty. */
42150
- placeholders: z24.array(PlaceholderSpecSchema),
42457
+ placeholders: z25.array(PlaceholderSpecSchema),
42151
42458
  /** Reconciliation policy on upgrade. */
42152
- updateStrategy: z24.enum(TEMPLATE_UPDATE_STRATEGIES)
42459
+ updateStrategy: z25.enum(TEMPLATE_UPDATE_STRATEGIES)
42153
42460
  });
42154
42461
 
42155
42462
  // packages/contracts/src/validator/index.ts
42156
- import { z as z25 } from "zod";
42463
+ import { z as z26 } from "zod";
42157
42464
  var VALIDATOR_ID_REGEX = /^validator-[a-z0-9][a-z0-9-]*$/;
42158
- var validatorFindingSchema = z25.object({
42159
- acId: z25.string().min(1, "acId must be non-empty"),
42160
- status: z25.enum(["pass", "fail", "inconclusive"]),
42161
- reasoning: z25.string().min(1, "reasoning must be non-empty"),
42162
- evidenceRefs: z25.array(z25.string()).optional(),
42163
- checkedAt: z25.string().min(1, "checkedAt must be a non-empty ISO-8601 string")
42164
- });
42165
- var validatorAttestationSchema = z25.object({
42166
- verdict: z25.literal("attest"),
42167
- taskId: z25.string().min(1),
42168
- validatorId: z25.string().regex(VALIDATOR_ID_REGEX, "validatorId must match the pattern validator-<discriminator>"),
42169
- findings: z25.array(validatorFindingSchema).min(1, "attestation must contain at least one finding").refine(
42465
+ var validatorFindingSchema = z26.object({
42466
+ acId: z26.string().min(1, "acId must be non-empty"),
42467
+ status: z26.enum(["pass", "fail", "inconclusive"]),
42468
+ reasoning: z26.string().min(1, "reasoning must be non-empty"),
42469
+ evidenceRefs: z26.array(z26.string()).optional(),
42470
+ checkedAt: z26.string().min(1, "checkedAt must be a non-empty ISO-8601 string")
42471
+ });
42472
+ var validatorAttestationSchema = z26.object({
42473
+ verdict: z26.literal("attest"),
42474
+ taskId: z26.string().min(1),
42475
+ validatorId: z26.string().regex(VALIDATOR_ID_REGEX, "validatorId must match the pattern validator-<discriminator>"),
42476
+ findings: z26.array(validatorFindingSchema).min(1, "attestation must contain at least one finding").refine(
42170
42477
  (findings) => findings.every((f) => f.status === "pass"),
42171
42478
  'attestation requires every finding to have status="pass"'
42172
42479
  ),
42173
- summary: z25.string().optional(),
42174
- attestedAt: z25.string().min(1),
42175
- schemaVersion: z25.literal("1")
42176
- });
42177
- var validatorRejectionSchema = z25.object({
42178
- verdict: z25.literal("reject"),
42179
- taskId: z25.string().min(1),
42180
- validatorId: z25.string().regex(VALIDATOR_ID_REGEX, "validatorId must match the pattern validator-<discriminator>"),
42181
- findings: z25.array(validatorFindingSchema).min(1, "rejection must contain at least one finding").refine(
42480
+ summary: z26.string().optional(),
42481
+ attestedAt: z26.string().min(1),
42482
+ schemaVersion: z26.literal("1")
42483
+ });
42484
+ var validatorRejectionSchema = z26.object({
42485
+ verdict: z26.literal("reject"),
42486
+ taskId: z26.string().min(1),
42487
+ validatorId: z26.string().regex(VALIDATOR_ID_REGEX, "validatorId must match the pattern validator-<discriminator>"),
42488
+ findings: z26.array(validatorFindingSchema).min(1, "rejection must contain at least one finding").refine(
42182
42489
  (findings) => findings.some((f) => f.status !== "pass"),
42183
42490
  'rejection requires at least one finding with status "fail" or "inconclusive"'
42184
42491
  ),
42185
- summary: z25.string().min(1, "rejection summary must be non-empty"),
42186
- remediationHints: z25.array(z25.string()).optional(),
42187
- rejectedAt: z25.string().min(1),
42188
- schemaVersion: z25.literal("1")
42492
+ summary: z26.string().min(1, "rejection summary must be non-empty"),
42493
+ remediationHints: z26.array(z26.string()).optional(),
42494
+ rejectedAt: z26.string().min(1),
42495
+ schemaVersion: z26.literal("1")
42189
42496
  });
42190
- var validatorVerdictSchema = z25.discriminatedUnion("verdict", [
42497
+ var validatorVerdictSchema = z26.discriminatedUnion("verdict", [
42191
42498
  validatorAttestationSchema,
42192
42499
  validatorRejectionSchema
42193
42500
  ]);
@@ -42937,7 +43244,7 @@ var CAAMP_DAMAGED_START_PATTERN_SOURCE = damagedMarkerSource("START");
42937
43244
  var CAAMP_DAMAGED_END_PATTERN_SOURCE = damagedMarkerSource("END");
42938
43245
 
42939
43246
  // packages/contracts/src/decide.ts
42940
- import { z as z26 } from "zod";
43247
+ import { z as z27 } from "zod";
42941
43248
  var DECISION_QUESTION_TYPES = ["noul", "choice", "score"];
42942
43249
  var DECISION_OUTCOME_SOURCES = ["provider", "cache", "fallback"];
42943
43250
  var DECISION_REQUEST_LIMITS = {
@@ -42959,11 +43266,11 @@ var DECISION_REQUEST_LIMITS = {
42959
43266
  maxScoreLevels: 10
42960
43267
  };
42961
43268
  var DECISION_PROVIDER_KINDS = ["layahost", "jev"];
42962
- var decisionQuestionTypeSchema = z26.enum(DECISION_QUESTION_TYPES);
42963
- var decisionOutcomeSourceSchema = z26.enum(DECISION_OUTCOME_SOURCES);
42964
- var decisionInstructionsSchema = z26.union([z26.string(), z26.record(z26.string(), z26.json())]);
42965
- var unitIntervalSchema = z26.number().min(0).max(1);
42966
- var decisionStateSchema = z26.union([z26.string(), z26.array(z26.json()), z26.record(z26.string(), z26.json())]).superRefine((state, context) => {
43269
+ var decisionQuestionTypeSchema = z27.enum(DECISION_QUESTION_TYPES);
43270
+ var decisionOutcomeSourceSchema = z27.enum(DECISION_OUTCOME_SOURCES);
43271
+ var decisionInstructionsSchema = z27.union([z27.string(), z27.record(z27.string(), z27.json())]);
43272
+ var unitIntervalSchema = z27.number().min(0).max(1);
43273
+ var decisionStateSchema = z27.union([z27.string(), z27.array(z27.json()), z27.record(z27.string(), z27.json())]).superRefine((state, context) => {
42967
43274
  const size = typeof state === "string" ? state.length : JSON.stringify(state).length;
42968
43275
  if (size > DECISION_REQUEST_LIMITS.maxStateChars) {
42969
43276
  context.addIssue({
@@ -42972,34 +43279,34 @@ var decisionStateSchema = z26.union([z26.string(), z26.array(z26.json()), z26.re
42972
43279
  });
42973
43280
  }
42974
43281
  });
42975
- var noulDecisionQuestionSchema = z26.object({
42976
- type: z26.literal("noul"),
43282
+ var noulDecisionQuestionSchema = z27.object({
43283
+ type: z27.literal("noul"),
42977
43284
  instructions: decisionInstructionsSchema.optional(),
42978
- criteria: z26.string().min(1)
43285
+ criteria: z27.string().min(1)
42979
43286
  });
42980
- var choiceDecisionQuestionSchema = z26.object({
42981
- type: z26.literal("choice"),
43287
+ var choiceDecisionQuestionSchema = z27.object({
43288
+ type: z27.literal("choice"),
42982
43289
  instructions: decisionInstructionsSchema.optional(),
42983
- criteria: z26.record(z26.string().min(1), z26.string()).refine((options) => Object.keys(options).length >= DECISION_REQUEST_LIMITS.minChoiceOptions, {
43290
+ criteria: z27.record(z27.string().min(1), z27.string()).refine((options) => Object.keys(options).length >= DECISION_REQUEST_LIMITS.minChoiceOptions, {
42984
43291
  message: `a choice question needs at least ${DECISION_REQUEST_LIMITS.minChoiceOptions} options`
42985
43292
  })
42986
43293
  });
42987
- var scoreDecisionQuestionSchema = z26.object({
42988
- type: z26.literal("score"),
43294
+ var scoreDecisionQuestionSchema = z27.object({
43295
+ type: z27.literal("score"),
42989
43296
  instructions: decisionInstructionsSchema.optional(),
42990
- criteria: z26.array(z26.string()).min(DECISION_REQUEST_LIMITS.minScoreLevels).max(DECISION_REQUEST_LIMITS.maxScoreLevels)
43297
+ criteria: z27.array(z27.string()).min(DECISION_REQUEST_LIMITS.minScoreLevels).max(DECISION_REQUEST_LIMITS.maxScoreLevels)
42991
43298
  });
42992
- var decisionQuestionSchema = z26.discriminatedUnion("type", [
43299
+ var decisionQuestionSchema = z27.discriminatedUnion("type", [
42993
43300
  noulDecisionQuestionSchema,
42994
43301
  choiceDecisionQuestionSchema,
42995
43302
  scoreDecisionQuestionSchema
42996
43303
  ]);
42997
- var decisionRequestSchema = z26.object({
42998
- model: z26.string().min(1).optional(),
42999
- lang: z26.string().regex(/^[a-z]{2,3}(-[A-Za-z0-9]{2,8})?$/).optional(),
43000
- cache: z26.boolean().optional(),
43304
+ var decisionRequestSchema = z27.object({
43305
+ model: z27.string().min(1).optional(),
43306
+ lang: z27.string().regex(/^[a-z]{2,3}(-[A-Za-z0-9]{2,8})?$/).optional(),
43307
+ cache: z27.boolean().optional(),
43001
43308
  state: decisionStateSchema,
43002
- questions: z26.record(z26.string().min(1), decisionQuestionSchema).refine(
43309
+ questions: z27.record(z27.string().min(1), decisionQuestionSchema).refine(
43003
43310
  (questions) => {
43004
43311
  const count = Object.keys(questions).length;
43005
43312
  return count >= DECISION_REQUEST_LIMITS.minQuestions && count <= DECISION_REQUEST_LIMITS.maxQuestions;
@@ -43009,139 +43316,139 @@ var decisionRequestSchema = z26.object({
43009
43316
  }
43010
43317
  )
43011
43318
  });
43012
- var noulDecisionAnswerSchema = z26.object({
43013
- type: z26.literal("noul"),
43014
- value: z26.boolean(),
43319
+ var noulDecisionAnswerSchema = z27.object({
43320
+ type: z27.literal("noul"),
43321
+ value: z27.boolean(),
43015
43322
  probability: unitIntervalSchema,
43016
43323
  confidence: unitIntervalSchema
43017
43324
  });
43018
- var choiceDecisionAnswerSchema = z26.object({
43019
- type: z26.literal("choice"),
43020
- value: z26.string().min(1),
43021
- probabilities: z26.record(z26.string().min(1), unitIntervalSchema),
43325
+ var choiceDecisionAnswerSchema = z27.object({
43326
+ type: z27.literal("choice"),
43327
+ value: z27.string().min(1),
43328
+ probabilities: z27.record(z27.string().min(1), unitIntervalSchema),
43022
43329
  confidence: unitIntervalSchema
43023
43330
  });
43024
- var scoreDecisionAnswerSchema = z26.object({
43025
- type: z26.literal("score"),
43026
- value: z26.number().int().nonnegative(),
43027
- probabilities: z26.array(unitIntervalSchema).min(DECISION_REQUEST_LIMITS.minScoreLevels).max(DECISION_REQUEST_LIMITS.maxScoreLevels),
43331
+ var scoreDecisionAnswerSchema = z27.object({
43332
+ type: z27.literal("score"),
43333
+ value: z27.number().int().nonnegative(),
43334
+ probabilities: z27.array(unitIntervalSchema).min(DECISION_REQUEST_LIMITS.minScoreLevels).max(DECISION_REQUEST_LIMITS.maxScoreLevels),
43028
43335
  confidence: unitIntervalSchema
43029
43336
  });
43030
- var decisionAnswerSchema = z26.discriminatedUnion("type", [
43337
+ var decisionAnswerSchema = z27.discriminatedUnion("type", [
43031
43338
  noulDecisionAnswerSchema,
43032
43339
  choiceDecisionAnswerSchema,
43033
43340
  scoreDecisionAnswerSchema
43034
43341
  ]);
43035
- var decisionOutcomeSchema = z26.object({
43036
- answers: z26.record(z26.string().min(1), decisionAnswerSchema),
43342
+ var decisionOutcomeSchema = z27.object({
43343
+ answers: z27.record(z27.string().min(1), decisionAnswerSchema),
43037
43344
  source: decisionOutcomeSourceSchema,
43038
- requestId: z26.string().min(1).optional(),
43039
- latencyMs: z26.number().nonnegative(),
43040
- costUsd: z26.number().nonnegative().optional(),
43041
- costMicros: z26.number().int().nonnegative().optional(),
43042
- balanceMicros: z26.number().int().optional(),
43043
- checkpoint: z26.string().min(1).optional(),
43044
- inputTokens: z26.number().int().nonnegative().optional()
43045
- });
43046
- var decisionProviderKindSchema = z26.enum(DECISION_PROVIDER_KINDS);
43047
- var decisionProviderConfigSchema = z26.object({
43048
- baseUrl: z26.url(),
43345
+ requestId: z27.string().min(1).optional(),
43346
+ latencyMs: z27.number().nonnegative(),
43347
+ costUsd: z27.number().nonnegative().optional(),
43348
+ costMicros: z27.number().int().nonnegative().optional(),
43349
+ balanceMicros: z27.number().int().optional(),
43350
+ checkpoint: z27.string().min(1).optional(),
43351
+ inputTokens: z27.number().int().nonnegative().optional()
43352
+ });
43353
+ var decisionProviderKindSchema = z27.enum(DECISION_PROVIDER_KINDS);
43354
+ var decisionProviderConfigSchema = z27.object({
43355
+ baseUrl: z27.url(),
43049
43356
  provider: decisionProviderKindSchema.optional()
43050
43357
  });
43051
43358
 
43052
43359
  // packages/contracts/src/nexus-account.ts
43053
- import { z as z27 } from "zod";
43054
- var nexusAccountUserSchema = z27.object({
43055
- id: z27.string(),
43056
- email: z27.string(),
43057
- name: z27.string().nullable().optional()
43058
- });
43059
- var nexusAccountOrganizationSchema = z27.object({
43060
- id: z27.string(),
43061
- name: z27.string(),
43062
- slug: z27.string().nullable().optional(),
43063
- role: z27.string().optional(),
43360
+ import { z as z28 } from "zod";
43361
+ var nexusAccountUserSchema = z28.object({
43362
+ id: z28.string(),
43363
+ email: z28.string(),
43364
+ name: z28.string().nullable().optional()
43365
+ });
43366
+ var nexusAccountOrganizationSchema = z28.object({
43367
+ id: z28.string(),
43368
+ name: z28.string(),
43369
+ slug: z28.string().nullable().optional(),
43370
+ role: z28.string().optional(),
43064
43371
  /** `true` for the personal organization created at sign-up. */
43065
- personal: z27.boolean().optional()
43372
+ personal: z28.boolean().optional()
43066
43373
  });
43067
- var nexusAccountMeSchema = z27.object({
43374
+ var nexusAccountMeSchema = z28.object({
43068
43375
  user: nexusAccountUserSchema,
43069
- organizations: z27.array(nexusAccountOrganizationSchema).default([])
43376
+ organizations: z28.array(nexusAccountOrganizationSchema).default([])
43070
43377
  });
43071
43378
 
43072
43379
  // packages/contracts/src/nexus-cloud.ts
43073
- import { z as z28 } from "zod";
43380
+ import { z as z29 } from "zod";
43074
43381
  var NEXUS_DEVICE_STATES = ["active", "signed-out", "revoked"];
43075
43382
  var NEXUS_CLOUD_PROFILES = ["device", "read-only"];
43076
43383
  var NEXUS_DEVICE_STATE_UNKNOWN = "unknown";
43077
- var isoTime = z28.iso.datetime({ offset: true });
43078
- var profile = z28.enum(NEXUS_CLOUD_PROFILES).nullable().catch(null);
43079
- var deviceState = z28.enum([...NEXUS_DEVICE_STATES, NEXUS_DEVICE_STATE_UNKNOWN]).catch(NEXUS_DEVICE_STATE_UNKNOWN);
43080
- var nexusCloudCredentialSchema = z28.object({
43081
- kind: z28.enum(["device", "session"]),
43082
- credentialId: z28.string().nullable().optional(),
43384
+ var isoTime = z29.iso.datetime({ offset: true });
43385
+ var profile = z29.enum(NEXUS_CLOUD_PROFILES).nullable().catch(null);
43386
+ var deviceState = z29.enum([...NEXUS_DEVICE_STATES, NEXUS_DEVICE_STATE_UNKNOWN]).catch(NEXUS_DEVICE_STATE_UNKNOWN);
43387
+ var nexusCloudCredentialSchema = z29.object({
43388
+ kind: z29.enum(["device", "session"]),
43389
+ credentialId: z29.string().nullable().optional(),
43083
43390
  profile: profile.optional(),
43084
- scopes: z28.array(z28.string()).default([]),
43391
+ scopes: z29.array(z29.string()).default([]),
43085
43392
  createdAt: isoTime.nullable().optional(),
43086
43393
  lastUsedAt: isoTime.nullable().optional(),
43087
43394
  /** When the credential expires if it is not used again; null for sessions. */
43088
43395
  idleExpiresAt: isoTime.nullable().optional()
43089
43396
  });
43090
- var nexusCloudDeviceSchema = z28.object({
43091
- deviceId: z28.string(),
43092
- name: z28.string(),
43093
- platform: z28.string().optional(),
43094
- arch: z28.string().nullable().optional(),
43095
- cliVersion: z28.string().nullable().optional(),
43397
+ var nexusCloudDeviceSchema = z29.object({
43398
+ deviceId: z29.string(),
43399
+ name: z29.string(),
43400
+ platform: z29.string().optional(),
43401
+ arch: z29.string().nullable().optional(),
43402
+ cliVersion: z29.string().nullable().optional(),
43096
43403
  createdAt: isoTime.optional(),
43097
43404
  lastSeenAt: isoTime.nullable().optional(),
43098
43405
  state: deviceState,
43099
43406
  signedOutAt: isoTime.nullable().optional(),
43100
43407
  /** Base64 device certificate; null until the device holds a key grant. */
43101
- certificate: z28.string().nullable().optional(),
43408
+ certificate: z29.string().nullable().optional(),
43102
43409
  /** The current credential's profile, or null with none (signed out or revoked). */
43103
43410
  profile: profile.optional(),
43104
43411
  /** True for the device whose credential made this request. */
43105
- current: z28.boolean().default(false),
43106
- projects: z28.number().int().nonnegative().optional(),
43107
- replicas: z28.number().int().nonnegative().optional(),
43412
+ current: z29.boolean().default(false),
43413
+ projects: z29.number().int().nonnegative().optional(),
43414
+ replicas: z29.number().int().nonnegative().optional(),
43108
43415
  lastSyncAt: isoTime.nullable().optional(),
43109
43416
  lastPresenceAt: isoTime.nullable().optional()
43110
43417
  });
43111
- var nexusCloudOrganizationSchema = z28.object({
43112
- id: z28.string(),
43113
- name: z28.string(),
43114
- slug: z28.string().nullable().optional(),
43115
- role: z28.string().optional(),
43116
- personal: z28.boolean().optional()
43418
+ var nexusCloudOrganizationSchema = z29.object({
43419
+ id: z29.string(),
43420
+ name: z29.string(),
43421
+ slug: z29.string().nullable().optional(),
43422
+ role: z29.string().optional(),
43423
+ personal: z29.boolean().optional()
43117
43424
  });
43118
- var nexusCloudUserSchema = z28.object({
43119
- id: z28.string(),
43120
- email: z28.string(),
43121
- name: z28.string().nullable().optional()
43425
+ var nexusCloudUserSchema = z29.object({
43426
+ id: z29.string(),
43427
+ email: z29.string(),
43428
+ name: z29.string().nullable().optional()
43122
43429
  });
43123
- var nexusCloudWhoamiSchema = z28.object({
43430
+ var nexusCloudWhoamiSchema = z29.object({
43124
43431
  serverTime: isoTime.optional(),
43125
43432
  user: nexusCloudUserSchema,
43126
- organizations: z28.array(nexusCloudOrganizationSchema).default([]),
43433
+ organizations: z29.array(nexusCloudOrganizationSchema).default([]),
43127
43434
  credential: nexusCloudCredentialSchema,
43128
43435
  /** The calling device; null for a session caller. */
43129
43436
  device: nexusCloudDeviceSchema.nullable()
43130
43437
  });
43131
- var nexusCloudDevicePageSchema = z28.object({
43132
- devices: z28.array(nexusCloudDeviceSchema),
43133
- nextCursor: z28.string().max(512).nullable().default(null),
43134
- truncated: z28.boolean().default(false)
43438
+ var nexusCloudDevicePageSchema = z29.object({
43439
+ devices: z29.array(nexusCloudDeviceSchema),
43440
+ nextCursor: z29.string().max(512).nullable().default(null),
43441
+ truncated: z29.boolean().default(false)
43135
43442
  });
43136
- var nexusCloudPresenceSchema = z28.looseObject({
43443
+ var nexusCloudPresenceSchema = z29.looseObject({
43137
43444
  observedAt: isoTime.optional(),
43138
- sync: z28.object({ enabled: z28.boolean() }).optional()
43445
+ sync: z29.object({ enabled: z29.boolean() }).optional()
43139
43446
  });
43140
- var nexusCloudReplicaSchema = z28.object({
43141
- projectId: z28.string(),
43142
- replicaId: z28.string(),
43143
- deviceId: z28.string(),
43144
- deviceName: z28.string(),
43447
+ var nexusCloudReplicaSchema = z29.object({
43448
+ projectId: z29.string(),
43449
+ replicaId: z29.string(),
43450
+ deviceId: z29.string(),
43451
+ deviceName: z29.string(),
43145
43452
  deviceState: deviceState.optional(),
43146
43453
  attachedAt: isoTime.optional(),
43147
43454
  lastSyncAt: isoTime.nullable(),
@@ -43150,72 +43457,72 @@ var nexusCloudReplicaSchema = z28.object({
43150
43457
  /** When the replica was retired (cleo-nexus T123), else null. Absent from servers older than retirement. */
43151
43458
  retiredAt: isoTime.nullable().optional(),
43152
43459
  /** The retired replica's named successor, else null (not retired, or retired with none). */
43153
- successor: z28.string().nullable().optional()
43460
+ successor: z29.string().nullable().optional()
43154
43461
  });
43155
- var nexusCloudDeviceCountsSchema = z28.object({
43156
- active: z28.number().int().nonnegative(),
43157
- total: z28.number().int().nonnegative()
43462
+ var nexusCloudDeviceCountsSchema = z29.object({
43463
+ active: z29.number().int().nonnegative(),
43464
+ total: z29.number().int().nonnegative()
43158
43465
  });
43159
43466
  var projectFields = {
43160
- projectId: z28.string(),
43161
- label: z28.string().nullable(),
43162
- organizationId: z28.string(),
43163
- organizationName: z28.string().optional(),
43164
- remoteUrl: z28.string().nullable().optional(),
43467
+ projectId: z29.string(),
43468
+ label: z29.string().nullable(),
43469
+ organizationId: z29.string(),
43470
+ organizationName: z29.string().optional(),
43471
+ remoteUrl: z29.string().nullable().optional(),
43165
43472
  createdAt: isoTime.optional()
43166
43473
  };
43167
- var nexusCloudProjectListItemSchema = z28.object({
43474
+ var nexusCloudProjectListItemSchema = z29.object({
43168
43475
  ...projectFields,
43169
- role: z28.string(),
43476
+ role: z29.string(),
43170
43477
  /**
43171
43478
  * The project name sealed with the project data key (`Project.encryptedName`), base64;
43172
43479
  * only a holder of the account key can open it (T13102).
43173
43480
  */
43174
- encryptedName: z28.string().nullable().optional(),
43175
- streamId: z28.string().optional(),
43176
- headSeq: z28.number().int().nonnegative().nullable().optional(),
43481
+ encryptedName: z29.string().nullable().optional(),
43482
+ streamId: z29.string().optional(),
43483
+ headSeq: z29.number().int().nonnegative().nullable().optional(),
43177
43484
  /** The stream's head snapshot; null when nothing was ever pushed (T13102: restorable or not). */
43178
- headCheckpointId: z28.string().nullable().optional(),
43179
- openConflicts: z28.number().int().nonnegative().optional(),
43180
- replicas: z28.array(nexusCloudReplicaSchema).default([]),
43485
+ headCheckpointId: z29.string().nullable().optional(),
43486
+ openConflicts: z29.number().int().nonnegative().optional(),
43487
+ replicas: z29.array(nexusCloudReplicaSchema).default([]),
43181
43488
  devices: nexusCloudDeviceCountsSchema.optional(),
43182
- replicaCount: z28.number().int().nonnegative().optional(),
43489
+ replicaCount: z29.number().int().nonnegative().optional(),
43183
43490
  lastSyncAt: isoTime.nullable().optional(),
43184
43491
  lastPresenceAt: isoTime.nullable().optional(),
43185
43492
  /** This project's replica list was cut at 50 (T12858). */
43186
- replicasTruncated: z28.boolean().default(false)
43493
+ replicasTruncated: z29.boolean().default(false)
43187
43494
  });
43188
- var nexusCloudProjectPageSchema = z28.object({
43189
- projects: z28.array(nexusCloudProjectListItemSchema),
43190
- nextCursor: z28.string().max(512).nullable().default(null),
43495
+ var nexusCloudProjectPageSchema = z29.object({
43496
+ projects: z29.array(nexusCloudProjectListItemSchema),
43497
+ nextCursor: z29.string().max(512).nullable().default(null),
43191
43498
  /** Anything in the page was cut (the project list or a replica list). */
43192
- truncated: z28.boolean().default(false),
43499
+ truncated: z29.boolean().default(false),
43193
43500
  /** The project list itself was cut at 1000 (T12858). */
43194
- projectsTruncated: z28.boolean().default(false)
43501
+ projectsTruncated: z29.boolean().default(false)
43195
43502
  });
43196
- var nexusCloudProjectDetailSchema = z28.object({
43197
- project: z28.object({ ...projectFields, deletedAt: isoTime.nullable().optional() }),
43198
- role: z28.string(),
43199
- canTrash: z28.boolean().optional(),
43200
- openConflicts: z28.number().int().nonnegative(),
43503
+ var nexusCloudProjectDetailSchema = z29.object({
43504
+ project: z29.object({ ...projectFields, deletedAt: isoTime.nullable().optional() }),
43505
+ role: z29.string(),
43506
+ canTrash: z29.boolean().optional(),
43507
+ openConflicts: z29.number().int().nonnegative(),
43201
43508
  /** At most 50, oldest attachment first. */
43202
- replicas: z28.array(nexusCloudReplicaSchema),
43509
+ replicas: z29.array(nexusCloudReplicaSchema),
43203
43510
  devices: nexusCloudDeviceCountsSchema,
43204
- replicaCount: z28.number().int().nonnegative().optional(),
43511
+ replicaCount: z29.number().int().nonnegative().optional(),
43205
43512
  lastSyncAt: isoTime.nullable().optional(),
43206
43513
  /** `replicas` was cut at 50. */
43207
- truncated: z28.boolean().default(false),
43208
- stream: z28.object({
43209
- streamId: z28.string(),
43210
- headSeq: z28.number().int().nonnegative(),
43211
- headCheckpointId: z28.string().nullable()
43514
+ truncated: z29.boolean().default(false),
43515
+ stream: z29.object({
43516
+ streamId: z29.string(),
43517
+ headSeq: z29.number().int().nonnegative(),
43518
+ headCheckpointId: z29.string().nullable()
43212
43519
  }).nullable()
43213
43520
  });
43214
- var nexusCloudReplicaPageSchema = z28.object({
43215
- replicas: z28.array(nexusCloudReplicaSchema),
43521
+ var nexusCloudReplicaPageSchema = z29.object({
43522
+ replicas: z29.array(nexusCloudReplicaSchema),
43216
43523
  devices: nexusCloudDeviceCountsSchema.optional(),
43217
- nextCursor: z28.string().max(512).nullable().default(null),
43218
- truncated: z28.boolean().default(false)
43524
+ nextCursor: z29.string().max(512).nullable().default(null),
43525
+ truncated: z29.boolean().default(false)
43219
43526
  });
43220
43527
  var NEXUS_STATUS_CHECK_IDS = [
43221
43528
  "credential.valid",
@@ -43231,56 +43538,56 @@ var NEXUS_STATUS_CHECK_IDS = [
43231
43538
  ];
43232
43539
  var NEXUS_STATUS_VERDICTS = ["ok", "attention", "not-linked", "not-registered"];
43233
43540
  var CLOUD_STATUS_VERDICTS = [...NEXUS_STATUS_VERDICTS, "not-signed-in"];
43234
- var knownCheckId = z28.enum(NEXUS_STATUS_CHECK_IDS);
43235
- var nexusCloudStatusCheckSchema = z28.object({
43236
- id: z28.enum(NEXUS_STATUS_CHECK_IDS),
43237
- ok: z28.boolean(),
43238
- required: z28.boolean(),
43239
- detail: z28.string()
43240
- });
43241
- var nexusCloudStatusSchema = z28.object({
43541
+ var knownCheckId = z29.enum(NEXUS_STATUS_CHECK_IDS);
43542
+ var nexusCloudStatusCheckSchema = z29.object({
43543
+ id: z29.enum(NEXUS_STATUS_CHECK_IDS),
43544
+ ok: z29.boolean(),
43545
+ required: z29.boolean(),
43546
+ detail: z29.string()
43547
+ });
43548
+ var nexusCloudStatusSchema = z29.object({
43242
43549
  serverTime: isoTime.optional(),
43243
- apiVersion: z28.string().optional(),
43550
+ apiVersion: z29.string().optional(),
43244
43551
  /**
43245
43552
  * Optional server features (e.g. {@link NEXUS_FEATURE_PROJECT_INITIAL_KEY}). Absent from servers older
43246
43553
  * than the list, which therefore support none of them.
43247
43554
  */
43248
- features: z28.array(z28.string()).optional(),
43555
+ features: z29.array(z29.string()).optional(),
43249
43556
  user: nexusCloudUserSchema,
43250
43557
  credential: nexusCloudCredentialSchema,
43251
43558
  device: nexusCloudDeviceSchema.nullable(),
43252
- project: z28.object({
43253
- projectId: z28.string(),
43254
- registered: z28.boolean(),
43255
- organizationId: z28.string().nullable(),
43256
- organizationName: z28.string().nullable(),
43257
- role: z28.string().nullable()
43559
+ project: z29.object({
43560
+ projectId: z29.string(),
43561
+ registered: z29.boolean(),
43562
+ organizationId: z29.string().nullable(),
43563
+ organizationName: z29.string().nullable(),
43564
+ role: z29.string().nullable()
43258
43565
  }).nullable(),
43259
- replica: z28.object({
43260
- replicaId: z28.string(),
43261
- attached: z28.boolean(),
43262
- attachedElsewhere: z28.boolean(),
43566
+ replica: z29.object({
43567
+ replicaId: z29.string(),
43568
+ attached: z29.boolean(),
43569
+ attachedElsewhere: z29.boolean(),
43263
43570
  attachedAt: isoTime.nullable(),
43264
43571
  lastSyncAt: isoTime.nullable(),
43265
43572
  presenceAt: isoTime.nullable(),
43266
- lastReplicaSeq: z28.number().int().nonnegative().nullable().optional()
43573
+ lastReplicaSeq: z29.number().int().nonnegative().nullable().optional()
43267
43574
  }).nullable(),
43268
- stream: z28.object({
43269
- streamId: z28.string(),
43270
- headSeq: z28.number().int().nonnegative(),
43271
- headCheckpointId: z28.string().nullable(),
43272
- openConflicts: z28.number().int().nonnegative(),
43575
+ stream: z29.object({
43576
+ streamId: z29.string(),
43577
+ headSeq: z29.number().int().nonnegative(),
43578
+ headCheckpointId: z29.string().nullable(),
43579
+ openConflicts: z29.number().int().nonnegative(),
43273
43580
  devices: nexusCloudDeviceCountsSchema
43274
43581
  }).nullable(),
43275
43582
  /** Check ids added by a newer server are dropped, never a parse failure. */
43276
- checks: z28.array(nexusCloudStatusCheckSchema.extend({ id: z28.string() })).transform(
43583
+ checks: z29.array(nexusCloudStatusCheckSchema.extend({ id: z29.string() })).transform(
43277
43584
  (list) => list.flatMap((c) => {
43278
43585
  const id = knownCheckId.safeParse(c.id);
43279
43586
  return id.success ? [{ ...c, id: id.data }] : [];
43280
43587
  })
43281
43588
  ),
43282
43589
  /** A verdict added by a newer server reads as `attention`: never `ok` by accident. */
43283
- verdict: z28.enum(NEXUS_STATUS_VERDICTS).catch("attention")
43590
+ verdict: z29.enum(NEXUS_STATUS_VERDICTS).catch("attention")
43284
43591
  });
43285
43592
  var LOGIN = "run `cleo login nexus`";
43286
43593
  var SESSION_EXPIRED_LOGIN = {
@@ -43325,50 +43632,50 @@ var NEXUS_FORBIDDEN_ERRORS = {
43325
43632
  };
43326
43633
 
43327
43634
  // packages/contracts/src/nexus-vault.ts
43328
- import { z as z29 } from "zod";
43329
- var isoTime2 = z29.iso.datetime({ offset: true });
43330
- 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);
43331
- var nexusUserKeysSchema = z29.looseObject({
43332
- keyVersion: z29.number().int().positive(),
43333
- masterKeyVerifier: z29.string()
43334
- });
43335
- var nexusProjectKeysSchema = z29.looseObject({
43336
- keys: z29.array(
43337
- z29.looseObject({ wrappedProjectKey: z29.string(), keyVersion: z29.number().int().positive() })
43635
+ import { z as z30 } from "zod";
43636
+ var isoTime2 = z30.iso.datetime({ offset: true });
43637
+ 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);
43638
+ var nexusUserKeysSchema = z30.looseObject({
43639
+ keyVersion: z30.number().int().positive(),
43640
+ masterKeyVerifier: z30.string()
43641
+ });
43642
+ var nexusProjectKeysSchema = z30.looseObject({
43643
+ keys: z30.array(
43644
+ z30.looseObject({ wrappedProjectKey: z30.string(), keyVersion: z30.number().int().positive() })
43338
43645
  )
43339
43646
  });
43340
- var nexusLeaseSchema = z29.looseObject({
43341
- streamId: z29.string(),
43342
- role: z29.string(),
43647
+ var nexusLeaseSchema = z30.looseObject({
43648
+ streamId: z30.string(),
43649
+ role: z30.string(),
43343
43650
  replicaId: uuid,
43344
43651
  expiresAt: isoTime2,
43345
43652
  forkedFromReplicaId: uuid.nullable().optional()
43346
43653
  });
43347
- var nexusLeaseAcquireSchema = z29.looseObject({ lease: nexusLeaseSchema });
43348
- var nexusStreamHeadSchema = z29.looseObject({
43349
- streamId: z29.string(),
43350
- kind: z29.string().optional(),
43351
- headSeq: z29.number().int().nonnegative(),
43352
- headCheckpointId: z29.string().nullable(),
43654
+ var nexusLeaseAcquireSchema = z30.looseObject({ lease: nexusLeaseSchema });
43655
+ var nexusStreamHeadSchema = z30.looseObject({
43656
+ streamId: z30.string(),
43657
+ kind: z30.string().optional(),
43658
+ headSeq: z30.number().int().nonnegative(),
43659
+ headCheckpointId: z30.string().nullable(),
43353
43660
  /**
43354
43661
  * The highest segment `schemaVersion` the stream holds (the server raises it on every append).
43355
43662
  * Absent from an older server.
43356
43663
  */
43357
- maxSchemaVersion: z29.number().int().nonnegative().optional()
43664
+ maxSchemaVersion: z30.number().int().nonnegative().optional()
43358
43665
  });
43359
- var nexusActivityEventSchema = z29.looseObject({
43360
- id: z29.union([z29.string(), z29.number()]),
43666
+ var nexusActivityEventSchema = z30.looseObject({
43667
+ id: z30.union([z30.string(), z30.number()]),
43361
43668
  at: isoTime2,
43362
- actorUserId: z29.string().nullable().optional(),
43363
- actorDeviceId: z29.string().nullable().optional(),
43364
- requestId: z29.string().nullable().optional(),
43365
- action: z29.string(),
43366
- target: z29.string().nullable().optional(),
43367
- detail: z29.unknown().optional()
43368
- });
43369
- var nexusActivityPageSchema = z29.looseObject({
43370
- events: z29.array(nexusActivityEventSchema),
43371
- nextBefore: z29.union([z29.string(), z29.number()]).nullable().optional()
43669
+ actorUserId: z30.string().nullable().optional(),
43670
+ actorDeviceId: z30.string().nullable().optional(),
43671
+ requestId: z30.string().nullable().optional(),
43672
+ action: z30.string(),
43673
+ target: z30.string().nullable().optional(),
43674
+ detail: z30.unknown().optional()
43675
+ });
43676
+ var nexusActivityPageSchema = z30.looseObject({
43677
+ events: z30.array(nexusActivityEventSchema),
43678
+ nextBefore: z30.union([z30.string(), z30.number()]).nullable().optional()
43372
43679
  });
43373
43680
 
43374
43681
  // packages/adapters/src/providers/shared/lead-tool-strip.ts