@workit-dev/mcp 2.23.1 → 2.24.0

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 (2) hide show
  1. package/dist/index.js +1112 -839
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -7434,6 +7434,7 @@ var _parse = (_Err) => {
7434
7434
  };
7435
7435
  return fn;
7436
7436
  };
7437
+ var parse = /* @__PURE__ */ _parse($ZodRealError);
7437
7438
  var _parseAsync = (_Err) => {
7438
7439
  const fn = async (schema, value, _ctx, params) => {
7439
7440
  const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
@@ -7449,6 +7450,7 @@ var _parseAsync = (_Err) => {
7449
7450
  };
7450
7451
  return fn;
7451
7452
  };
7453
+ var parseAsync = /* @__PURE__ */ _parseAsync($ZodRealError);
7452
7454
  var _safeParse = (_Err) => (schema, value, _ctx) => {
7453
7455
  const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
7454
7456
  const result = schema._zod.run({ value, issues: [] }, ctx);
@@ -7484,6 +7486,7 @@ var _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
7484
7486
  result = await result;
7485
7487
  return result.issues.length ? failure(_Err, result.issues, ctx) : { success: true, data: result.value };
7486
7488
  };
7489
+ var safeParseAsync = /* @__PURE__ */ _safeParseAsync($ZodRealError);
7487
7490
  var COMPILE_INVALID = /* @__PURE__ */ Symbol.for("zod.compile.invalid");
7488
7491
  var COMPILE_FALLBACK = /* @__PURE__ */ Symbol.for("zod.compile.fallback");
7489
7492
  var validate = (schema, value, _ctx) => {
@@ -10393,6 +10396,9 @@ function _gte(value, params) {
10393
10396
  inclusive: true
10394
10397
  });
10395
10398
  }
10399
+ function _nonnegative(params) {
10400
+ return _gte(0, params);
10401
+ }
10396
10402
  function _multipleOf(value, params) {
10397
10403
  return new $ZodCheckMultipleOf({
10398
10404
  check: "multiple_of",
@@ -11602,6 +11608,250 @@ var optionalProcessor = (schema, ctx, _json, params) => {
11602
11608
  const seen = ctx.seen.get(schema);
11603
11609
  seen.ref = def.innerType;
11604
11610
  };
11611
+ // node_modules/zod/v4/mini/schemas.js
11612
+ var ZodMiniType = /* @__PURE__ */ $constructor("ZodMiniType", (inst, def) => {
11613
+ if (!inst._zod)
11614
+ throw new Error("Uninitialized schema in ZodMiniType.");
11615
+ $ZodType.init(inst, def);
11616
+ inst.def = def;
11617
+ inst.type = def.type;
11618
+ }, {
11619
+ get with() {
11620
+ return this.check;
11621
+ },
11622
+ set with(value) {
11623
+ own(this, "with", value);
11624
+ },
11625
+ parse(data, params) {
11626
+ return parse(this, data, params, { callee: this.parse });
11627
+ },
11628
+ parseAsync(data, params) {
11629
+ return parseAsync(this, data, params, { callee: this.parseAsync });
11630
+ },
11631
+ safeParse(data, params) {
11632
+ return safeParse(this, data, params);
11633
+ },
11634
+ safeParseAsync(data, params) {
11635
+ return safeParseAsync(this, data, params);
11636
+ },
11637
+ check(...checks) {
11638
+ const def = this.def;
11639
+ return this.clone({
11640
+ ...def,
11641
+ checks: [
11642
+ ...def.checks ?? [],
11643
+ ...checks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch)
11644
+ ]
11645
+ }, { parent: true });
11646
+ },
11647
+ clone(_def, params) {
11648
+ return clone(this, _def, params);
11649
+ },
11650
+ brand() {
11651
+ return this;
11652
+ },
11653
+ register(reg, meta) {
11654
+ reg.add(this, meta);
11655
+ return this;
11656
+ },
11657
+ apply(fn, ...args) {
11658
+ return args.length === 0 ? fn(this) : fn(this, ...args);
11659
+ }
11660
+ });
11661
+ var ZodMiniString = /* @__PURE__ */ $constructor("ZodMiniString", (inst, def) => {
11662
+ $ZodString.init(inst, def);
11663
+ ZodMiniType.init(inst, def);
11664
+ });
11665
+ function string2(params) {
11666
+ return _string(ZodMiniString, params);
11667
+ }
11668
+ var ZodMiniStringFormat = /* @__PURE__ */ $constructor("ZodMiniStringFormat", (inst, def) => {
11669
+ $ZodStringFormat.init(inst, def);
11670
+ ZodMiniString.init(inst, def);
11671
+ });
11672
+ var ZodMiniURL = /* @__PURE__ */ $constructor("ZodMiniURL", (inst, def) => {
11673
+ $ZodURL.init(inst, def);
11674
+ ZodMiniStringFormat.init(inst, def);
11675
+ });
11676
+ function url(params) {
11677
+ return _url(ZodMiniURL, params);
11678
+ }
11679
+ var ZodMiniNumber = /* @__PURE__ */ $constructor("ZodMiniNumber", (inst, def) => {
11680
+ $ZodNumber.init(inst, def);
11681
+ ZodMiniType.init(inst, def);
11682
+ });
11683
+ function number2(params) {
11684
+ return _number(ZodMiniNumber, params);
11685
+ }
11686
+ var ZodMiniNumberFormat = /* @__PURE__ */ $constructor("ZodMiniNumberFormat", (inst, def) => {
11687
+ $ZodNumberFormat.init(inst, def);
11688
+ ZodMiniNumber.init(inst, def);
11689
+ });
11690
+ function int(params) {
11691
+ return _int(ZodMiniNumberFormat, params);
11692
+ }
11693
+ var ZodMiniBoolean = /* @__PURE__ */ $constructor("ZodMiniBoolean", (inst, def) => {
11694
+ $ZodBoolean.init(inst, def);
11695
+ ZodMiniType.init(inst, def);
11696
+ });
11697
+ function boolean2(params) {
11698
+ return _boolean(ZodMiniBoolean, params);
11699
+ }
11700
+ var ZodMiniUnknown = /* @__PURE__ */ $constructor("ZodMiniUnknown", (inst, def) => {
11701
+ $ZodUnknown.init(inst, def);
11702
+ ZodMiniType.init(inst, def);
11703
+ });
11704
+ function unknown() {
11705
+ return _unknown(ZodMiniUnknown);
11706
+ }
11707
+ var ZodMiniNever = /* @__PURE__ */ $constructor("ZodMiniNever", (inst, def) => {
11708
+ $ZodNever.init(inst, def);
11709
+ ZodMiniType.init(inst, def);
11710
+ });
11711
+ function never(params) {
11712
+ return _never(ZodMiniNever, params);
11713
+ }
11714
+ var ZodMiniArray = /* @__PURE__ */ $constructor("ZodMiniArray", (inst, def) => {
11715
+ $ZodArray.init(inst, def);
11716
+ ZodMiniType.init(inst, def);
11717
+ });
11718
+ function array(element, params) {
11719
+ return new ZodMiniArray({
11720
+ type: "array",
11721
+ element,
11722
+ ...normalizeParams(params)
11723
+ });
11724
+ }
11725
+ var ZodMiniObject = /* @__PURE__ */ $constructor("ZodMiniObject", (inst, def) => {
11726
+ $ZodObject.init(inst, def);
11727
+ ZodMiniType.init(inst, def);
11728
+ installLazyProp(inst, "shape", (self) => self._zod.def.shape, false);
11729
+ });
11730
+ function strictObject(shape, params) {
11731
+ return new ZodMiniObject({
11732
+ type: "object",
11733
+ shape,
11734
+ catchall: never(),
11735
+ ...normalizeParams(params)
11736
+ });
11737
+ }
11738
+ function looseObject(shape, params) {
11739
+ return new ZodMiniObject({
11740
+ type: "object",
11741
+ shape,
11742
+ catchall: unknown(),
11743
+ ...normalizeParams(params)
11744
+ });
11745
+ }
11746
+ function extend2(schema, shape) {
11747
+ return extend(schema, shape);
11748
+ }
11749
+ function pick2(schema, mask) {
11750
+ return pick(schema, mask);
11751
+ }
11752
+ function omit2(schema, mask) {
11753
+ return omit(schema, mask);
11754
+ }
11755
+ var ZodMiniUnion = /* @__PURE__ */ $constructor("ZodMiniUnion", (inst, def) => {
11756
+ $ZodUnion.init(inst, def);
11757
+ ZodMiniType.init(inst, def);
11758
+ });
11759
+ function union(options, params) {
11760
+ return new ZodMiniUnion({
11761
+ type: "union",
11762
+ options,
11763
+ ...normalizeParams(params)
11764
+ });
11765
+ }
11766
+ var ZodMiniDiscriminatedUnion = /* @__PURE__ */ $constructor("ZodMiniDiscriminatedUnion", (inst, def) => {
11767
+ $ZodDiscriminatedUnion.init(inst, def);
11768
+ ZodMiniType.init(inst, def);
11769
+ });
11770
+ function discriminatedUnion(discriminator, options, params) {
11771
+ return new ZodMiniDiscriminatedUnion({
11772
+ type: "union",
11773
+ options,
11774
+ discriminator,
11775
+ ...normalizeParams(params)
11776
+ });
11777
+ }
11778
+ var ZodMiniRecord = /* @__PURE__ */ $constructor("ZodMiniRecord", (inst, def) => {
11779
+ $ZodRecord.init(inst, def);
11780
+ ZodMiniType.init(inst, def);
11781
+ });
11782
+ function record(keyType, valueType, params) {
11783
+ if (!valueType || !valueType._zod) {
11784
+ return new ZodMiniRecord({
11785
+ type: "record",
11786
+ keyType: string2(),
11787
+ valueType: keyType,
11788
+ ...normalizeParams(valueType)
11789
+ });
11790
+ }
11791
+ return new ZodMiniRecord({
11792
+ type: "record",
11793
+ keyType,
11794
+ valueType,
11795
+ ...normalizeParams(params)
11796
+ });
11797
+ }
11798
+ var ZodMiniEnum = /* @__PURE__ */ $constructor("ZodMiniEnum", (inst, def) => {
11799
+ $ZodEnum.init(inst, def);
11800
+ ZodMiniType.init(inst, def);
11801
+ inst.options = [...inst._zod.values];
11802
+ });
11803
+ function _enum(values, params) {
11804
+ const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
11805
+ return new ZodMiniEnum({
11806
+ type: "enum",
11807
+ entries,
11808
+ ...normalizeParams(params)
11809
+ });
11810
+ }
11811
+ var ZodMiniLiteral = /* @__PURE__ */ $constructor("ZodMiniLiteral", (inst, def) => {
11812
+ $ZodLiteral.init(inst, def);
11813
+ ZodMiniType.init(inst, def);
11814
+ });
11815
+ function literal(value, params) {
11816
+ return new ZodMiniLiteral({
11817
+ type: "literal",
11818
+ values: Array.isArray(value) ? value : [value],
11819
+ ...normalizeParams(params)
11820
+ });
11821
+ }
11822
+ var ZodMiniOptional = /* @__PURE__ */ $constructor("ZodMiniOptional", (inst, def) => {
11823
+ $ZodOptional.init(inst, def);
11824
+ ZodMiniType.init(inst, def);
11825
+ });
11826
+ function optional(innerType) {
11827
+ return new ZodMiniOptional({
11828
+ type: "optional",
11829
+ innerType
11830
+ });
11831
+ }
11832
+ var ZodMiniNullable = /* @__PURE__ */ $constructor("ZodMiniNullable", (inst, def) => {
11833
+ $ZodNullable.init(inst, def);
11834
+ ZodMiniType.init(inst, def);
11835
+ });
11836
+ function nullable(innerType) {
11837
+ return new ZodMiniNullable({
11838
+ type: "nullable",
11839
+ innerType
11840
+ });
11841
+ }
11842
+ var ZodMiniCustom = /* @__PURE__ */ $constructor("ZodMiniCustom", (inst, def) => {
11843
+ $ZodCustom.init(inst, def);
11844
+ ZodMiniType.init(inst, def);
11845
+ });
11846
+ function custom(fn, _params) {
11847
+ return _custom(ZodMiniCustom, fn ?? (() => true), _params);
11848
+ }
11849
+ function refine(fn, _params = {}) {
11850
+ return _refine(ZodMiniCustom, fn, _params);
11851
+ }
11852
+ function superRefine(fn, params) {
11853
+ return _superRefine(fn, params);
11854
+ }
11605
11855
  // node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
11606
11856
  function isZ4Schema(s) {
11607
11857
  const schema = s;
@@ -11710,7 +11960,7 @@ var ZodRealError = /* @__PURE__ */ $constructor("ZodError", initializer2, undefi
11710
11960
  });
11711
11961
 
11712
11962
  // node_modules/zod/v4/classic/parse.js
11713
- var parse3 = /* @__PURE__ */ _parse(ZodRealError);
11963
+ var parse4 = /* @__PURE__ */ _parse(ZodRealError);
11714
11964
  var parseAsync2 = /* @__PURE__ */ _parseAsync(ZodRealError);
11715
11965
  var safeParse3 = /* @__PURE__ */ _safeParse(ZodRealError);
11716
11966
  var safeParseAsync2 = /* @__PURE__ */ _safeParseAsync(ZodRealError);
@@ -11762,34 +12012,34 @@ var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
11762
12012
  return this;
11763
12013
  },
11764
12014
  refine(check, params) {
11765
- return this.check(refine(check, params));
12015
+ return this.check(refine2(check, params));
11766
12016
  },
11767
12017
  superRefine(refinement, params) {
11768
- return this.check(superRefine(refinement, params));
12018
+ return this.check(superRefine2(refinement, params));
11769
12019
  },
11770
12020
  overwrite(fn) {
11771
12021
  return this.check(_overwrite(fn));
11772
12022
  },
11773
12023
  optional() {
11774
- return optional(this);
12024
+ return optional2(this);
11775
12025
  },
11776
12026
  exactOptional() {
11777
12027
  return exactOptional(this);
11778
12028
  },
11779
12029
  nullable() {
11780
- return nullable(this);
12030
+ return nullable2(this);
11781
12031
  },
11782
12032
  nullish() {
11783
- return optional(nullable(this));
12033
+ return optional2(nullable2(this));
11784
12034
  },
11785
12035
  nonoptional(params) {
11786
12036
  return nonoptional(this, params);
11787
12037
  },
11788
12038
  array() {
11789
- return array(this);
12039
+ return array2(this);
11790
12040
  },
11791
12041
  or(arg) {
11792
- return union([this, arg]);
12042
+ return union2([this, arg]);
11793
12043
  },
11794
12044
  and(arg) {
11795
12045
  return intersection(this, arg);
@@ -11846,7 +12096,7 @@ var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
11846
12096
  own(this, "~standard", value);
11847
12097
  },
11848
12098
  parse: function _parse(data, params) {
11849
- return parse3(this, data, params, { callee: _parse });
12099
+ return parse4(this, data, params, { callee: _parse });
11850
12100
  },
11851
12101
  parseAsync: async function _parseAsync(data, params) {
11852
12102
  return await parseAsync2(this, data, params, { callee: _parseAsync });
@@ -12041,7 +12291,7 @@ var ZodString = /* @__PURE__ */ $constructor("ZodString", (inst, def) => {
12041
12291
  return this.check(_isoDuration(ZodISODuration, params));
12042
12292
  }
12043
12293
  });
12044
- function string2(params) {
12294
+ function string3(params) {
12045
12295
  return _string(ZodString, params);
12046
12296
  }
12047
12297
  var ZodStringFormat = /* @__PURE__ */ $constructor("ZodStringFormat", (inst, def) => {
@@ -12179,10 +12429,10 @@ var ZodNumber = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => {
12179
12429
  return this.check(_lte(value, params));
12180
12430
  },
12181
12431
  int(params) {
12182
- return this.check(int(params));
12432
+ return this.check(int2(params));
12183
12433
  },
12184
12434
  safe(params) {
12185
- return this.check(int(params));
12435
+ return this.check(int2(params));
12186
12436
  },
12187
12437
  positive(params) {
12188
12438
  return this.check(_gt(0, params));
@@ -12206,14 +12456,14 @@ var ZodNumber = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => {
12206
12456
  return this;
12207
12457
  }
12208
12458
  }));
12209
- function number2(params) {
12459
+ function number3(params) {
12210
12460
  return _number(ZodNumber, params);
12211
12461
  }
12212
12462
  var ZodNumberFormat = /* @__PURE__ */ $constructor("ZodNumberFormat", (inst, def) => {
12213
12463
  $ZodNumberFormat.init(inst, def);
12214
12464
  ZodNumber.init(inst, def);
12215
12465
  });
12216
- function int(params) {
12466
+ function int2(params) {
12217
12467
  return _int(ZodNumberFormat, params);
12218
12468
  }
12219
12469
  var ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
@@ -12221,7 +12471,7 @@ var ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
12221
12471
  ZodType.init(inst, def);
12222
12472
  inst._zod.processJSONSchema = (ctx, json, params) => booleanProcessor(inst, ctx, json, params);
12223
12473
  });
12224
- function boolean2(params) {
12474
+ function boolean3(params) {
12225
12475
  return _boolean(ZodBoolean, params);
12226
12476
  }
12227
12477
  var ZodNull = /* @__PURE__ */ $constructor("ZodNull", (inst, def) => {
@@ -12237,7 +12487,7 @@ var ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
12237
12487
  ZodType.init(inst, def);
12238
12488
  inst._zod.processJSONSchema = (ctx, json, params) => unknownProcessor(inst, ctx, json, params);
12239
12489
  });
12240
- function unknown() {
12490
+ function unknown2() {
12241
12491
  return _unknown(ZodUnknown);
12242
12492
  }
12243
12493
  var ZodNever = /* @__PURE__ */ $constructor("ZodNever", (inst, def) => {
@@ -12245,7 +12495,7 @@ var ZodNever = /* @__PURE__ */ $constructor("ZodNever", (inst, def) => {
12245
12495
  ZodType.init(inst, def);
12246
12496
  inst._zod.processJSONSchema = (ctx, json, params) => neverProcessor(inst, ctx, json, params);
12247
12497
  });
12248
- function never(params) {
12498
+ function never2(params) {
12249
12499
  return _never(ZodNever, params);
12250
12500
  }
12251
12501
  var ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
@@ -12271,7 +12521,7 @@ var ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
12271
12521
  return this.element;
12272
12522
  }
12273
12523
  });
12274
- function array(element, params) {
12524
+ function array2(element, params) {
12275
12525
  return _array(ZodArray, element, params);
12276
12526
  }
12277
12527
  var ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
@@ -12282,19 +12532,19 @@ var ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
12282
12532
  installLazyProp(inst, "shape", (self) => self._zod.def.shape, false);
12283
12533
  }, {
12284
12534
  keyof() {
12285
- return _enum(Object.keys(this._zod.def.shape));
12535
+ return _enum2(Object.keys(this._zod.def.shape));
12286
12536
  },
12287
12537
  catchall(catchall) {
12288
12538
  return this.clone(mergeDefs(this._zod.def, { catchall }));
12289
12539
  },
12290
12540
  passthrough() {
12291
- return this.clone(mergeDefs(this._zod.def, { catchall: unknown() }));
12541
+ return this.clone(mergeDefs(this._zod.def, { catchall: unknown2() }));
12292
12542
  },
12293
12543
  loose() {
12294
- return this.clone(mergeDefs(this._zod.def, { catchall: unknown() }));
12544
+ return this.clone(mergeDefs(this._zod.def, { catchall: unknown2() }));
12295
12545
  },
12296
12546
  strict() {
12297
- return this.clone(mergeDefs(this._zod.def, { catchall: never() }));
12547
+ return this.clone(mergeDefs(this._zod.def, { catchall: never2() }));
12298
12548
  },
12299
12549
  strip() {
12300
12550
  return this.clone(mergeDefs(this._zod.def, { catchall: undefined }));
@@ -12324,7 +12574,7 @@ var ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
12324
12574
  return required(ZodNonOptional, this, args[0]);
12325
12575
  }
12326
12576
  });
12327
- function object(shape, params) {
12577
+ function object2(shape, params) {
12328
12578
  const def = {
12329
12579
  type: "object",
12330
12580
  shape: shape ?? {},
@@ -12332,11 +12582,11 @@ function object(shape, params) {
12332
12582
  };
12333
12583
  return new ZodObject(def);
12334
12584
  }
12335
- function looseObject(shape, params) {
12585
+ function looseObject2(shape, params) {
12336
12586
  return new ZodObject({
12337
12587
  type: "object",
12338
12588
  shape,
12339
- catchall: unknown(),
12589
+ catchall: unknown2(),
12340
12590
  ...normalizeParams(params)
12341
12591
  });
12342
12592
  }
@@ -12346,7 +12596,7 @@ var ZodUnion = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => {
12346
12596
  inst._zod.processJSONSchema = (ctx, json, params) => unionProcessor(inst, ctx, json, params);
12347
12597
  inst.options = def.options;
12348
12598
  });
12349
- function union(options, params) {
12599
+ function union2(options, params) {
12350
12600
  return new ZodUnion({
12351
12601
  type: "union",
12352
12602
  options,
@@ -12357,7 +12607,7 @@ var ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("ZodDiscriminatedUnion"
12357
12607
  ZodUnion.init(inst, def);
12358
12608
  $ZodDiscriminatedUnion.init(inst, def);
12359
12609
  });
12360
- function discriminatedUnion(discriminator, options, params) {
12610
+ function discriminatedUnion2(discriminator, options, params) {
12361
12611
  return new ZodDiscriminatedUnion({
12362
12612
  type: "union",
12363
12613
  options,
@@ -12385,11 +12635,11 @@ var ZodRecord = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => {
12385
12635
  inst.keyType = def.keyType;
12386
12636
  inst.valueType = def.valueType;
12387
12637
  });
12388
- function record(keyType, valueType, params) {
12638
+ function record2(keyType, valueType, params) {
12389
12639
  if (!valueType || !valueType._zod) {
12390
12640
  return new ZodRecord({
12391
12641
  type: "record",
12392
- keyType: string2(),
12642
+ keyType: string3(),
12393
12643
  valueType: keyType,
12394
12644
  ...normalizeParams(valueType)
12395
12645
  });
@@ -12439,7 +12689,7 @@ var ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
12439
12689
  });
12440
12690
  };
12441
12691
  });
12442
- function _enum(values, params) {
12692
+ function _enum2(values, params) {
12443
12693
  const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
12444
12694
  return new ZodEnum({
12445
12695
  type: "enum",
@@ -12461,7 +12711,7 @@ var ZodLiteral = /* @__PURE__ */ $constructor("ZodLiteral", (inst, def) => {
12461
12711
  }
12462
12712
  });
12463
12713
  });
12464
- function literal(value, params) {
12714
+ function literal2(value, params) {
12465
12715
  return new ZodLiteral({
12466
12716
  type: "literal",
12467
12717
  values: Array.isArray(value) ? value : [value],
@@ -12514,7 +12764,7 @@ var ZodOptional = /* @__PURE__ */ $constructor("ZodOptional", (inst, def) => {
12514
12764
  inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
12515
12765
  inst.unwrap = () => inst._zod.def.innerType;
12516
12766
  });
12517
- function optional(innerType) {
12767
+ function optional2(innerType) {
12518
12768
  return new ZodOptional({
12519
12769
  type: "optional",
12520
12770
  innerType
@@ -12538,7 +12788,7 @@ var ZodNullable = /* @__PURE__ */ $constructor("ZodNullable", (inst, def) => {
12538
12788
  inst._zod.processJSONSchema = (ctx, json, params) => nullableProcessor(inst, ctx, json, params);
12539
12789
  inst.unwrap = () => inst._zod.def.innerType;
12540
12790
  });
12541
- function nullable(innerType) {
12791
+ function nullable2(innerType) {
12542
12792
  return new ZodNullable({
12543
12793
  type: "nullable",
12544
12794
  innerType
@@ -12637,13 +12887,13 @@ var ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
12637
12887
  ZodType.init(inst, def);
12638
12888
  inst._zod.processJSONSchema = (ctx, json, params) => customProcessor(inst, ctx, json, params);
12639
12889
  });
12640
- function custom(fn, _params) {
12890
+ function custom2(fn, _params) {
12641
12891
  return _custom(ZodCustom, fn ?? (() => true), _params);
12642
12892
  }
12643
- function refine(fn, _params = {}) {
12893
+ function refine2(fn, _params = {}) {
12644
12894
  return _refine(ZodCustom, fn, _params);
12645
12895
  }
12646
- function superRefine(fn, params) {
12896
+ function superRefine2(fn, params) {
12647
12897
  return _superRefine(fn, params);
12648
12898
  }
12649
12899
  function preprocess(fn, schema) {
@@ -12662,58 +12912,58 @@ var LATEST_PROTOCOL_VERSION = "2025-11-25";
12662
12912
  var SUPPORTED_PROTOCOL_VERSIONS = [LATEST_PROTOCOL_VERSION, "2025-06-18", "2025-03-26", "2024-11-05", "2024-10-07"];
12663
12913
  var RELATED_TASK_META_KEY = "io.modelcontextprotocol/related-task";
12664
12914
  var JSONRPC_VERSION = "2.0";
12665
- var AssertObjectSchema = custom((v) => v !== null && (typeof v === "object" || typeof v === "function"));
12666
- var ProgressTokenSchema = union([string2(), number2().int()]);
12667
- var CursorSchema = string2();
12668
- var TaskCreationParamsSchema = looseObject({
12669
- ttl: number2().optional(),
12670
- pollInterval: number2().optional()
12915
+ var AssertObjectSchema = custom2((v) => v !== null && (typeof v === "object" || typeof v === "function"));
12916
+ var ProgressTokenSchema = union2([string3(), number3().int()]);
12917
+ var CursorSchema = string3();
12918
+ var TaskCreationParamsSchema = looseObject2({
12919
+ ttl: number3().optional(),
12920
+ pollInterval: number3().optional()
12671
12921
  });
12672
- var TaskMetadataSchema = object({
12673
- ttl: number2().optional()
12922
+ var TaskMetadataSchema = object2({
12923
+ ttl: number3().optional()
12674
12924
  });
12675
- var RelatedTaskMetadataSchema = object({
12676
- taskId: string2()
12925
+ var RelatedTaskMetadataSchema = object2({
12926
+ taskId: string3()
12677
12927
  });
12678
- var RequestMetaSchema = looseObject({
12928
+ var RequestMetaSchema = looseObject2({
12679
12929
  progressToken: ProgressTokenSchema.optional(),
12680
12930
  [RELATED_TASK_META_KEY]: RelatedTaskMetadataSchema.optional()
12681
12931
  });
12682
- var BaseRequestParamsSchema = object({
12932
+ var BaseRequestParamsSchema = object2({
12683
12933
  _meta: RequestMetaSchema.optional()
12684
12934
  });
12685
12935
  var TaskAugmentedRequestParamsSchema = BaseRequestParamsSchema.extend({
12686
12936
  task: TaskMetadataSchema.optional()
12687
12937
  });
12688
12938
  var isTaskAugmentedRequestParams = (value) => TaskAugmentedRequestParamsSchema.safeParse(value).success;
12689
- var RequestSchema = object({
12690
- method: string2(),
12939
+ var RequestSchema = object2({
12940
+ method: string3(),
12691
12941
  params: BaseRequestParamsSchema.loose().optional()
12692
12942
  });
12693
- var NotificationsParamsSchema = object({
12943
+ var NotificationsParamsSchema = object2({
12694
12944
  _meta: RequestMetaSchema.optional()
12695
12945
  });
12696
- var NotificationSchema = object({
12697
- method: string2(),
12946
+ var NotificationSchema = object2({
12947
+ method: string3(),
12698
12948
  params: NotificationsParamsSchema.loose().optional()
12699
12949
  });
12700
- var ResultSchema = looseObject({
12950
+ var ResultSchema = looseObject2({
12701
12951
  _meta: RequestMetaSchema.optional()
12702
12952
  });
12703
- var RequestIdSchema = union([string2(), number2().int()]);
12704
- var JSONRPCRequestSchema = object({
12705
- jsonrpc: literal(JSONRPC_VERSION),
12953
+ var RequestIdSchema = union2([string3(), number3().int()]);
12954
+ var JSONRPCRequestSchema = object2({
12955
+ jsonrpc: literal2(JSONRPC_VERSION),
12706
12956
  id: RequestIdSchema,
12707
12957
  ...RequestSchema.shape
12708
12958
  }).strict();
12709
12959
  var isJSONRPCRequest = (value) => JSONRPCRequestSchema.safeParse(value).success;
12710
- var JSONRPCNotificationSchema = object({
12711
- jsonrpc: literal(JSONRPC_VERSION),
12960
+ var JSONRPCNotificationSchema = object2({
12961
+ jsonrpc: literal2(JSONRPC_VERSION),
12712
12962
  ...NotificationSchema.shape
12713
12963
  }).strict();
12714
12964
  var isJSONRPCNotification = (value) => JSONRPCNotificationSchema.safeParse(value).success;
12715
- var JSONRPCResultResponseSchema = object({
12716
- jsonrpc: literal(JSONRPC_VERSION),
12965
+ var JSONRPCResultResponseSchema = object2({
12966
+ jsonrpc: literal2(JSONRPC_VERSION),
12717
12967
  id: RequestIdSchema,
12718
12968
  result: ResultSchema
12719
12969
  }).strict();
@@ -12729,55 +12979,55 @@ var ErrorCode;
12729
12979
  ErrorCode[ErrorCode["InternalError"] = -32603] = "InternalError";
12730
12980
  ErrorCode[ErrorCode["UrlElicitationRequired"] = -32042] = "UrlElicitationRequired";
12731
12981
  })(ErrorCode || (ErrorCode = {}));
12732
- var JSONRPCErrorResponseSchema = object({
12733
- jsonrpc: literal(JSONRPC_VERSION),
12982
+ var JSONRPCErrorResponseSchema = object2({
12983
+ jsonrpc: literal2(JSONRPC_VERSION),
12734
12984
  id: RequestIdSchema.optional(),
12735
- error: object({
12736
- code: number2().int(),
12737
- message: string2(),
12738
- data: unknown().optional()
12985
+ error: object2({
12986
+ code: number3().int(),
12987
+ message: string3(),
12988
+ data: unknown2().optional()
12739
12989
  })
12740
12990
  }).strict();
12741
12991
  var isJSONRPCErrorResponse = (value) => JSONRPCErrorResponseSchema.safeParse(value).success;
12742
- var JSONRPCMessageSchema = union([
12992
+ var JSONRPCMessageSchema = union2([
12743
12993
  JSONRPCRequestSchema,
12744
12994
  JSONRPCNotificationSchema,
12745
12995
  JSONRPCResultResponseSchema,
12746
12996
  JSONRPCErrorResponseSchema
12747
12997
  ]);
12748
- var JSONRPCResponseSchema = union([JSONRPCResultResponseSchema, JSONRPCErrorResponseSchema]);
12998
+ var JSONRPCResponseSchema = union2([JSONRPCResultResponseSchema, JSONRPCErrorResponseSchema]);
12749
12999
  var EmptyResultSchema = ResultSchema.strict();
12750
13000
  var CancelledNotificationParamsSchema = NotificationsParamsSchema.extend({
12751
13001
  requestId: RequestIdSchema.optional(),
12752
- reason: string2().optional()
13002
+ reason: string3().optional()
12753
13003
  });
12754
13004
  var CancelledNotificationSchema = NotificationSchema.extend({
12755
- method: literal("notifications/cancelled"),
13005
+ method: literal2("notifications/cancelled"),
12756
13006
  params: CancelledNotificationParamsSchema
12757
13007
  });
12758
- var IconSchema = object({
12759
- src: string2(),
12760
- mimeType: string2().optional(),
12761
- sizes: array(string2()).optional(),
12762
- theme: _enum(["light", "dark"]).optional()
13008
+ var IconSchema = object2({
13009
+ src: string3(),
13010
+ mimeType: string3().optional(),
13011
+ sizes: array2(string3()).optional(),
13012
+ theme: _enum2(["light", "dark"]).optional()
12763
13013
  });
12764
- var IconsSchema = object({
12765
- icons: array(IconSchema).optional()
13014
+ var IconsSchema = object2({
13015
+ icons: array2(IconSchema).optional()
12766
13016
  });
12767
- var BaseMetadataSchema = object({
12768
- name: string2(),
12769
- title: string2().optional()
13017
+ var BaseMetadataSchema = object2({
13018
+ name: string3(),
13019
+ title: string3().optional()
12770
13020
  });
12771
13021
  var ImplementationSchema = BaseMetadataSchema.extend({
12772
13022
  ...BaseMetadataSchema.shape,
12773
13023
  ...IconsSchema.shape,
12774
- version: string2(),
12775
- websiteUrl: string2().optional(),
12776
- description: string2().optional()
13024
+ version: string3(),
13025
+ websiteUrl: string3().optional(),
13026
+ description: string3().optional()
12777
13027
  });
12778
- var FormElicitationCapabilitySchema = intersection(object({
12779
- applyDefaults: boolean2().optional()
12780
- }), record(string2(), unknown()));
13028
+ var FormElicitationCapabilitySchema = intersection(object2({
13029
+ applyDefaults: boolean3().optional()
13030
+ }), record2(string3(), unknown2()));
12781
13031
  var ElicitationCapabilitySchema = preprocess((value) => {
12782
13032
  if (value && typeof value === "object" && !Array.isArray(value)) {
12783
13033
  if (Object.keys(value).length === 0) {
@@ -12785,96 +13035,96 @@ var ElicitationCapabilitySchema = preprocess((value) => {
12785
13035
  }
12786
13036
  }
12787
13037
  return value;
12788
- }, intersection(object({
13038
+ }, intersection(object2({
12789
13039
  form: FormElicitationCapabilitySchema.optional(),
12790
13040
  url: AssertObjectSchema.optional()
12791
- }), record(string2(), unknown()).optional()));
12792
- var ClientTasksCapabilitySchema = looseObject({
13041
+ }), record2(string3(), unknown2()).optional()));
13042
+ var ClientTasksCapabilitySchema = looseObject2({
12793
13043
  list: AssertObjectSchema.optional(),
12794
13044
  cancel: AssertObjectSchema.optional(),
12795
- requests: looseObject({
12796
- sampling: looseObject({
13045
+ requests: looseObject2({
13046
+ sampling: looseObject2({
12797
13047
  createMessage: AssertObjectSchema.optional()
12798
13048
  }).optional(),
12799
- elicitation: looseObject({
13049
+ elicitation: looseObject2({
12800
13050
  create: AssertObjectSchema.optional()
12801
13051
  }).optional()
12802
13052
  }).optional()
12803
13053
  });
12804
- var ServerTasksCapabilitySchema = looseObject({
13054
+ var ServerTasksCapabilitySchema = looseObject2({
12805
13055
  list: AssertObjectSchema.optional(),
12806
13056
  cancel: AssertObjectSchema.optional(),
12807
- requests: looseObject({
12808
- tools: looseObject({
13057
+ requests: looseObject2({
13058
+ tools: looseObject2({
12809
13059
  call: AssertObjectSchema.optional()
12810
13060
  }).optional()
12811
13061
  }).optional()
12812
13062
  });
12813
- var ClientCapabilitiesSchema = object({
12814
- experimental: record(string2(), AssertObjectSchema).optional(),
12815
- sampling: object({
13063
+ var ClientCapabilitiesSchema = object2({
13064
+ experimental: record2(string3(), AssertObjectSchema).optional(),
13065
+ sampling: object2({
12816
13066
  context: AssertObjectSchema.optional(),
12817
13067
  tools: AssertObjectSchema.optional()
12818
13068
  }).optional(),
12819
13069
  elicitation: ElicitationCapabilitySchema.optional(),
12820
- roots: object({
12821
- listChanged: boolean2().optional()
13070
+ roots: object2({
13071
+ listChanged: boolean3().optional()
12822
13072
  }).optional(),
12823
13073
  tasks: ClientTasksCapabilitySchema.optional(),
12824
- extensions: record(string2(), AssertObjectSchema).optional()
13074
+ extensions: record2(string3(), AssertObjectSchema).optional()
12825
13075
  });
12826
13076
  var InitializeRequestParamsSchema = BaseRequestParamsSchema.extend({
12827
- protocolVersion: string2(),
13077
+ protocolVersion: string3(),
12828
13078
  capabilities: ClientCapabilitiesSchema,
12829
13079
  clientInfo: ImplementationSchema
12830
13080
  });
12831
13081
  var InitializeRequestSchema = RequestSchema.extend({
12832
- method: literal("initialize"),
13082
+ method: literal2("initialize"),
12833
13083
  params: InitializeRequestParamsSchema
12834
13084
  });
12835
- var ServerCapabilitiesSchema = object({
12836
- experimental: record(string2(), AssertObjectSchema).optional(),
13085
+ var ServerCapabilitiesSchema = object2({
13086
+ experimental: record2(string3(), AssertObjectSchema).optional(),
12837
13087
  logging: AssertObjectSchema.optional(),
12838
13088
  completions: AssertObjectSchema.optional(),
12839
- prompts: object({
12840
- listChanged: boolean2().optional()
13089
+ prompts: object2({
13090
+ listChanged: boolean3().optional()
12841
13091
  }).optional(),
12842
- resources: object({
12843
- subscribe: boolean2().optional(),
12844
- listChanged: boolean2().optional()
13092
+ resources: object2({
13093
+ subscribe: boolean3().optional(),
13094
+ listChanged: boolean3().optional()
12845
13095
  }).optional(),
12846
- tools: object({
12847
- listChanged: boolean2().optional()
13096
+ tools: object2({
13097
+ listChanged: boolean3().optional()
12848
13098
  }).optional(),
12849
13099
  tasks: ServerTasksCapabilitySchema.optional(),
12850
- extensions: record(string2(), AssertObjectSchema).optional()
13100
+ extensions: record2(string3(), AssertObjectSchema).optional()
12851
13101
  });
12852
13102
  var InitializeResultSchema = ResultSchema.extend({
12853
- protocolVersion: string2(),
13103
+ protocolVersion: string3(),
12854
13104
  capabilities: ServerCapabilitiesSchema,
12855
13105
  serverInfo: ImplementationSchema,
12856
- instructions: string2().optional()
13106
+ instructions: string3().optional()
12857
13107
  });
12858
13108
  var InitializedNotificationSchema = NotificationSchema.extend({
12859
- method: literal("notifications/initialized"),
13109
+ method: literal2("notifications/initialized"),
12860
13110
  params: NotificationsParamsSchema.optional()
12861
13111
  });
12862
13112
  var PingRequestSchema = RequestSchema.extend({
12863
- method: literal("ping"),
13113
+ method: literal2("ping"),
12864
13114
  params: BaseRequestParamsSchema.optional()
12865
13115
  });
12866
- var ProgressSchema = object({
12867
- progress: number2(),
12868
- total: optional(number2()),
12869
- message: optional(string2())
13116
+ var ProgressSchema = object2({
13117
+ progress: number3(),
13118
+ total: optional2(number3()),
13119
+ message: optional2(string3())
12870
13120
  });
12871
- var ProgressNotificationParamsSchema = object({
13121
+ var ProgressNotificationParamsSchema = object2({
12872
13122
  ...NotificationsParamsSchema.shape,
12873
13123
  ...ProgressSchema.shape,
12874
13124
  progressToken: ProgressTokenSchema
12875
13125
  });
12876
13126
  var ProgressNotificationSchema = NotificationSchema.extend({
12877
- method: literal("notifications/progress"),
13127
+ method: literal2("notifications/progress"),
12878
13128
  params: ProgressNotificationParamsSchema
12879
13129
  });
12880
13130
  var PaginatedRequestParamsSchema = BaseRequestParamsSchema.extend({
@@ -12886,60 +13136,60 @@ var PaginatedRequestSchema = RequestSchema.extend({
12886
13136
  var PaginatedResultSchema = ResultSchema.extend({
12887
13137
  nextCursor: CursorSchema.optional()
12888
13138
  });
12889
- var TaskStatusSchema = _enum(["working", "input_required", "completed", "failed", "cancelled"]);
12890
- var TaskSchema = object({
12891
- taskId: string2(),
13139
+ var TaskStatusSchema = _enum2(["working", "input_required", "completed", "failed", "cancelled"]);
13140
+ var TaskSchema = object2({
13141
+ taskId: string3(),
12892
13142
  status: TaskStatusSchema,
12893
- ttl: union([number2(), _null3()]),
12894
- createdAt: string2(),
12895
- lastUpdatedAt: string2(),
12896
- pollInterval: optional(number2()),
12897
- statusMessage: optional(string2())
13143
+ ttl: union2([number3(), _null3()]),
13144
+ createdAt: string3(),
13145
+ lastUpdatedAt: string3(),
13146
+ pollInterval: optional2(number3()),
13147
+ statusMessage: optional2(string3())
12898
13148
  });
12899
13149
  var CreateTaskResultSchema = ResultSchema.extend({
12900
13150
  task: TaskSchema
12901
13151
  });
12902
13152
  var TaskStatusNotificationParamsSchema = NotificationsParamsSchema.merge(TaskSchema);
12903
13153
  var TaskStatusNotificationSchema = NotificationSchema.extend({
12904
- method: literal("notifications/tasks/status"),
13154
+ method: literal2("notifications/tasks/status"),
12905
13155
  params: TaskStatusNotificationParamsSchema
12906
13156
  });
12907
13157
  var GetTaskRequestSchema = RequestSchema.extend({
12908
- method: literal("tasks/get"),
13158
+ method: literal2("tasks/get"),
12909
13159
  params: BaseRequestParamsSchema.extend({
12910
- taskId: string2()
13160
+ taskId: string3()
12911
13161
  })
12912
13162
  });
12913
13163
  var GetTaskResultSchema = ResultSchema.merge(TaskSchema);
12914
13164
  var GetTaskPayloadRequestSchema = RequestSchema.extend({
12915
- method: literal("tasks/result"),
13165
+ method: literal2("tasks/result"),
12916
13166
  params: BaseRequestParamsSchema.extend({
12917
- taskId: string2()
13167
+ taskId: string3()
12918
13168
  })
12919
13169
  });
12920
13170
  var GetTaskPayloadResultSchema = ResultSchema.loose();
12921
13171
  var ListTasksRequestSchema = PaginatedRequestSchema.extend({
12922
- method: literal("tasks/list")
13172
+ method: literal2("tasks/list")
12923
13173
  });
12924
13174
  var ListTasksResultSchema = PaginatedResultSchema.extend({
12925
- tasks: array(TaskSchema)
13175
+ tasks: array2(TaskSchema)
12926
13176
  });
12927
13177
  var CancelTaskRequestSchema = RequestSchema.extend({
12928
- method: literal("tasks/cancel"),
13178
+ method: literal2("tasks/cancel"),
12929
13179
  params: BaseRequestParamsSchema.extend({
12930
- taskId: string2()
13180
+ taskId: string3()
12931
13181
  })
12932
13182
  });
12933
13183
  var CancelTaskResultSchema = ResultSchema.merge(TaskSchema);
12934
- var ResourceContentsSchema = object({
12935
- uri: string2(),
12936
- mimeType: optional(string2()),
12937
- _meta: record(string2(), unknown()).optional()
13184
+ var ResourceContentsSchema = object2({
13185
+ uri: string3(),
13186
+ mimeType: optional2(string3()),
13187
+ _meta: record2(string3(), unknown2()).optional()
12938
13188
  });
12939
13189
  var TextResourceContentsSchema = ResourceContentsSchema.extend({
12940
- text: string2()
13190
+ text: string3()
12941
13191
  });
12942
- var Base64Schema = string2().refine((val) => {
13192
+ var Base64Schema = string3().refine((val) => {
12943
13193
  try {
12944
13194
  atob(val);
12945
13195
  return true;
@@ -12950,447 +13200,447 @@ var Base64Schema = string2().refine((val) => {
12950
13200
  var BlobResourceContentsSchema = ResourceContentsSchema.extend({
12951
13201
  blob: Base64Schema
12952
13202
  });
12953
- var RoleSchema = _enum(["user", "assistant"]);
12954
- var AnnotationsSchema = object({
12955
- audience: array(RoleSchema).optional(),
12956
- priority: number2().min(0).max(1).optional(),
13203
+ var RoleSchema = _enum2(["user", "assistant"]);
13204
+ var AnnotationsSchema = object2({
13205
+ audience: array2(RoleSchema).optional(),
13206
+ priority: number3().min(0).max(1).optional(),
12957
13207
  lastModified: datetime2({ offset: true }).optional()
12958
13208
  });
12959
- var ResourceSchema = object({
13209
+ var ResourceSchema = object2({
12960
13210
  ...BaseMetadataSchema.shape,
12961
13211
  ...IconsSchema.shape,
12962
- uri: string2(),
12963
- description: optional(string2()),
12964
- mimeType: optional(string2()),
12965
- size: optional(number2()),
13212
+ uri: string3(),
13213
+ description: optional2(string3()),
13214
+ mimeType: optional2(string3()),
13215
+ size: optional2(number3()),
12966
13216
  annotations: AnnotationsSchema.optional(),
12967
- _meta: optional(looseObject({}))
13217
+ _meta: optional2(looseObject2({}))
12968
13218
  });
12969
- var ResourceTemplateSchema = object({
13219
+ var ResourceTemplateSchema = object2({
12970
13220
  ...BaseMetadataSchema.shape,
12971
13221
  ...IconsSchema.shape,
12972
- uriTemplate: string2(),
12973
- description: optional(string2()),
12974
- mimeType: optional(string2()),
13222
+ uriTemplate: string3(),
13223
+ description: optional2(string3()),
13224
+ mimeType: optional2(string3()),
12975
13225
  annotations: AnnotationsSchema.optional(),
12976
- _meta: optional(looseObject({}))
13226
+ _meta: optional2(looseObject2({}))
12977
13227
  });
12978
13228
  var ListResourcesRequestSchema = PaginatedRequestSchema.extend({
12979
- method: literal("resources/list")
13229
+ method: literal2("resources/list")
12980
13230
  });
12981
13231
  var ListResourcesResultSchema = PaginatedResultSchema.extend({
12982
- resources: array(ResourceSchema)
13232
+ resources: array2(ResourceSchema)
12983
13233
  });
12984
13234
  var ListResourceTemplatesRequestSchema = PaginatedRequestSchema.extend({
12985
- method: literal("resources/templates/list")
13235
+ method: literal2("resources/templates/list")
12986
13236
  });
12987
13237
  var ListResourceTemplatesResultSchema = PaginatedResultSchema.extend({
12988
- resourceTemplates: array(ResourceTemplateSchema)
13238
+ resourceTemplates: array2(ResourceTemplateSchema)
12989
13239
  });
12990
13240
  var ResourceRequestParamsSchema = BaseRequestParamsSchema.extend({
12991
- uri: string2()
13241
+ uri: string3()
12992
13242
  });
12993
13243
  var ReadResourceRequestParamsSchema = ResourceRequestParamsSchema;
12994
13244
  var ReadResourceRequestSchema = RequestSchema.extend({
12995
- method: literal("resources/read"),
13245
+ method: literal2("resources/read"),
12996
13246
  params: ReadResourceRequestParamsSchema
12997
13247
  });
12998
13248
  var ReadResourceResultSchema = ResultSchema.extend({
12999
- contents: array(union([TextResourceContentsSchema, BlobResourceContentsSchema]))
13249
+ contents: array2(union2([TextResourceContentsSchema, BlobResourceContentsSchema]))
13000
13250
  });
13001
13251
  var ResourceListChangedNotificationSchema = NotificationSchema.extend({
13002
- method: literal("notifications/resources/list_changed"),
13252
+ method: literal2("notifications/resources/list_changed"),
13003
13253
  params: NotificationsParamsSchema.optional()
13004
13254
  });
13005
13255
  var SubscribeRequestParamsSchema = ResourceRequestParamsSchema;
13006
13256
  var SubscribeRequestSchema = RequestSchema.extend({
13007
- method: literal("resources/subscribe"),
13257
+ method: literal2("resources/subscribe"),
13008
13258
  params: SubscribeRequestParamsSchema
13009
13259
  });
13010
13260
  var UnsubscribeRequestParamsSchema = ResourceRequestParamsSchema;
13011
13261
  var UnsubscribeRequestSchema = RequestSchema.extend({
13012
- method: literal("resources/unsubscribe"),
13262
+ method: literal2("resources/unsubscribe"),
13013
13263
  params: UnsubscribeRequestParamsSchema
13014
13264
  });
13015
13265
  var ResourceUpdatedNotificationParamsSchema = NotificationsParamsSchema.extend({
13016
- uri: string2()
13266
+ uri: string3()
13017
13267
  });
13018
13268
  var ResourceUpdatedNotificationSchema = NotificationSchema.extend({
13019
- method: literal("notifications/resources/updated"),
13269
+ method: literal2("notifications/resources/updated"),
13020
13270
  params: ResourceUpdatedNotificationParamsSchema
13021
13271
  });
13022
- var PromptArgumentSchema = object({
13023
- name: string2(),
13024
- description: optional(string2()),
13025
- required: optional(boolean2())
13272
+ var PromptArgumentSchema = object2({
13273
+ name: string3(),
13274
+ description: optional2(string3()),
13275
+ required: optional2(boolean3())
13026
13276
  });
13027
- var PromptSchema = object({
13277
+ var PromptSchema = object2({
13028
13278
  ...BaseMetadataSchema.shape,
13029
13279
  ...IconsSchema.shape,
13030
- description: optional(string2()),
13031
- arguments: optional(array(PromptArgumentSchema)),
13032
- _meta: optional(looseObject({}))
13280
+ description: optional2(string3()),
13281
+ arguments: optional2(array2(PromptArgumentSchema)),
13282
+ _meta: optional2(looseObject2({}))
13033
13283
  });
13034
13284
  var ListPromptsRequestSchema = PaginatedRequestSchema.extend({
13035
- method: literal("prompts/list")
13285
+ method: literal2("prompts/list")
13036
13286
  });
13037
13287
  var ListPromptsResultSchema = PaginatedResultSchema.extend({
13038
- prompts: array(PromptSchema)
13288
+ prompts: array2(PromptSchema)
13039
13289
  });
13040
13290
  var GetPromptRequestParamsSchema = BaseRequestParamsSchema.extend({
13041
- name: string2(),
13042
- arguments: record(string2(), string2()).optional()
13291
+ name: string3(),
13292
+ arguments: record2(string3(), string3()).optional()
13043
13293
  });
13044
13294
  var GetPromptRequestSchema = RequestSchema.extend({
13045
- method: literal("prompts/get"),
13295
+ method: literal2("prompts/get"),
13046
13296
  params: GetPromptRequestParamsSchema
13047
13297
  });
13048
- var TextContentSchema = object({
13049
- type: literal("text"),
13050
- text: string2(),
13298
+ var TextContentSchema = object2({
13299
+ type: literal2("text"),
13300
+ text: string3(),
13051
13301
  annotations: AnnotationsSchema.optional(),
13052
- _meta: record(string2(), unknown()).optional()
13302
+ _meta: record2(string3(), unknown2()).optional()
13053
13303
  });
13054
- var ImageContentSchema = object({
13055
- type: literal("image"),
13304
+ var ImageContentSchema = object2({
13305
+ type: literal2("image"),
13056
13306
  data: Base64Schema,
13057
- mimeType: string2(),
13307
+ mimeType: string3(),
13058
13308
  annotations: AnnotationsSchema.optional(),
13059
- _meta: record(string2(), unknown()).optional()
13309
+ _meta: record2(string3(), unknown2()).optional()
13060
13310
  });
13061
- var AudioContentSchema = object({
13062
- type: literal("audio"),
13311
+ var AudioContentSchema = object2({
13312
+ type: literal2("audio"),
13063
13313
  data: Base64Schema,
13064
- mimeType: string2(),
13314
+ mimeType: string3(),
13065
13315
  annotations: AnnotationsSchema.optional(),
13066
- _meta: record(string2(), unknown()).optional()
13067
- });
13068
- var ToolUseContentSchema = object({
13069
- type: literal("tool_use"),
13070
- name: string2(),
13071
- id: string2(),
13072
- input: record(string2(), unknown()),
13073
- _meta: record(string2(), unknown()).optional()
13074
- });
13075
- var EmbeddedResourceSchema = object({
13076
- type: literal("resource"),
13077
- resource: union([TextResourceContentsSchema, BlobResourceContentsSchema]),
13316
+ _meta: record2(string3(), unknown2()).optional()
13317
+ });
13318
+ var ToolUseContentSchema = object2({
13319
+ type: literal2("tool_use"),
13320
+ name: string3(),
13321
+ id: string3(),
13322
+ input: record2(string3(), unknown2()),
13323
+ _meta: record2(string3(), unknown2()).optional()
13324
+ });
13325
+ var EmbeddedResourceSchema = object2({
13326
+ type: literal2("resource"),
13327
+ resource: union2([TextResourceContentsSchema, BlobResourceContentsSchema]),
13078
13328
  annotations: AnnotationsSchema.optional(),
13079
- _meta: record(string2(), unknown()).optional()
13329
+ _meta: record2(string3(), unknown2()).optional()
13080
13330
  });
13081
13331
  var ResourceLinkSchema = ResourceSchema.extend({
13082
- type: literal("resource_link")
13332
+ type: literal2("resource_link")
13083
13333
  });
13084
- var ContentBlockSchema = union([
13334
+ var ContentBlockSchema = union2([
13085
13335
  TextContentSchema,
13086
13336
  ImageContentSchema,
13087
13337
  AudioContentSchema,
13088
13338
  ResourceLinkSchema,
13089
13339
  EmbeddedResourceSchema
13090
13340
  ]);
13091
- var PromptMessageSchema = object({
13341
+ var PromptMessageSchema = object2({
13092
13342
  role: RoleSchema,
13093
13343
  content: ContentBlockSchema
13094
13344
  });
13095
13345
  var GetPromptResultSchema = ResultSchema.extend({
13096
- description: string2().optional(),
13097
- messages: array(PromptMessageSchema)
13346
+ description: string3().optional(),
13347
+ messages: array2(PromptMessageSchema)
13098
13348
  });
13099
13349
  var PromptListChangedNotificationSchema = NotificationSchema.extend({
13100
- method: literal("notifications/prompts/list_changed"),
13350
+ method: literal2("notifications/prompts/list_changed"),
13101
13351
  params: NotificationsParamsSchema.optional()
13102
13352
  });
13103
- var ToolAnnotationsSchema = object({
13104
- title: string2().optional(),
13105
- readOnlyHint: boolean2().optional(),
13106
- destructiveHint: boolean2().optional(),
13107
- idempotentHint: boolean2().optional(),
13108
- openWorldHint: boolean2().optional()
13353
+ var ToolAnnotationsSchema = object2({
13354
+ title: string3().optional(),
13355
+ readOnlyHint: boolean3().optional(),
13356
+ destructiveHint: boolean3().optional(),
13357
+ idempotentHint: boolean3().optional(),
13358
+ openWorldHint: boolean3().optional()
13109
13359
  });
13110
- var ToolExecutionSchema = object({
13111
- taskSupport: _enum(["required", "optional", "forbidden"]).optional()
13360
+ var ToolExecutionSchema = object2({
13361
+ taskSupport: _enum2(["required", "optional", "forbidden"]).optional()
13112
13362
  });
13113
- var ToolSchema = object({
13363
+ var ToolSchema = object2({
13114
13364
  ...BaseMetadataSchema.shape,
13115
13365
  ...IconsSchema.shape,
13116
- description: string2().optional(),
13117
- inputSchema: object({
13118
- type: literal("object"),
13119
- properties: record(string2(), AssertObjectSchema).optional(),
13120
- required: array(string2()).optional()
13121
- }).catchall(unknown()),
13122
- outputSchema: object({
13123
- type: literal("object"),
13124
- properties: record(string2(), AssertObjectSchema).optional(),
13125
- required: array(string2()).optional()
13126
- }).catchall(unknown()).optional(),
13366
+ description: string3().optional(),
13367
+ inputSchema: object2({
13368
+ type: literal2("object"),
13369
+ properties: record2(string3(), AssertObjectSchema).optional(),
13370
+ required: array2(string3()).optional()
13371
+ }).catchall(unknown2()),
13372
+ outputSchema: object2({
13373
+ type: literal2("object"),
13374
+ properties: record2(string3(), AssertObjectSchema).optional(),
13375
+ required: array2(string3()).optional()
13376
+ }).catchall(unknown2()).optional(),
13127
13377
  annotations: ToolAnnotationsSchema.optional(),
13128
13378
  execution: ToolExecutionSchema.optional(),
13129
- _meta: record(string2(), unknown()).optional()
13379
+ _meta: record2(string3(), unknown2()).optional()
13130
13380
  });
13131
13381
  var ListToolsRequestSchema = PaginatedRequestSchema.extend({
13132
- method: literal("tools/list")
13382
+ method: literal2("tools/list")
13133
13383
  });
13134
13384
  var ListToolsResultSchema = PaginatedResultSchema.extend({
13135
- tools: array(ToolSchema)
13385
+ tools: array2(ToolSchema)
13136
13386
  });
13137
13387
  var CallToolResultSchema = ResultSchema.extend({
13138
- content: array(ContentBlockSchema).default([]),
13139
- structuredContent: record(string2(), unknown()).optional(),
13140
- isError: boolean2().optional()
13388
+ content: array2(ContentBlockSchema).default([]),
13389
+ structuredContent: record2(string3(), unknown2()).optional(),
13390
+ isError: boolean3().optional()
13141
13391
  });
13142
13392
  var CompatibilityCallToolResultSchema = CallToolResultSchema.or(ResultSchema.extend({
13143
- toolResult: unknown()
13393
+ toolResult: unknown2()
13144
13394
  }));
13145
13395
  var CallToolRequestParamsSchema = TaskAugmentedRequestParamsSchema.extend({
13146
- name: string2(),
13147
- arguments: record(string2(), unknown()).optional()
13396
+ name: string3(),
13397
+ arguments: record2(string3(), unknown2()).optional()
13148
13398
  });
13149
13399
  var CallToolRequestSchema = RequestSchema.extend({
13150
- method: literal("tools/call"),
13400
+ method: literal2("tools/call"),
13151
13401
  params: CallToolRequestParamsSchema
13152
13402
  });
13153
13403
  var ToolListChangedNotificationSchema = NotificationSchema.extend({
13154
- method: literal("notifications/tools/list_changed"),
13404
+ method: literal2("notifications/tools/list_changed"),
13155
13405
  params: NotificationsParamsSchema.optional()
13156
13406
  });
13157
- var ListChangedOptionsBaseSchema = object({
13158
- autoRefresh: boolean2().default(true),
13159
- debounceMs: number2().int().nonnegative().default(300)
13407
+ var ListChangedOptionsBaseSchema = object2({
13408
+ autoRefresh: boolean3().default(true),
13409
+ debounceMs: number3().int().nonnegative().default(300)
13160
13410
  });
13161
- var LoggingLevelSchema = _enum(["debug", "info", "notice", "warning", "error", "critical", "alert", "emergency"]);
13411
+ var LoggingLevelSchema = _enum2(["debug", "info", "notice", "warning", "error", "critical", "alert", "emergency"]);
13162
13412
  var SetLevelRequestParamsSchema = BaseRequestParamsSchema.extend({
13163
13413
  level: LoggingLevelSchema
13164
13414
  });
13165
13415
  var SetLevelRequestSchema = RequestSchema.extend({
13166
- method: literal("logging/setLevel"),
13416
+ method: literal2("logging/setLevel"),
13167
13417
  params: SetLevelRequestParamsSchema
13168
13418
  });
13169
13419
  var LoggingMessageNotificationParamsSchema = NotificationsParamsSchema.extend({
13170
13420
  level: LoggingLevelSchema,
13171
- logger: string2().optional(),
13172
- data: unknown()
13421
+ logger: string3().optional(),
13422
+ data: unknown2()
13173
13423
  });
13174
13424
  var LoggingMessageNotificationSchema = NotificationSchema.extend({
13175
- method: literal("notifications/message"),
13425
+ method: literal2("notifications/message"),
13176
13426
  params: LoggingMessageNotificationParamsSchema
13177
13427
  });
13178
- var ModelHintSchema = object({
13179
- name: string2().optional()
13428
+ var ModelHintSchema = object2({
13429
+ name: string3().optional()
13180
13430
  });
13181
- var ModelPreferencesSchema = object({
13182
- hints: array(ModelHintSchema).optional(),
13183
- costPriority: number2().min(0).max(1).optional(),
13184
- speedPriority: number2().min(0).max(1).optional(),
13185
- intelligencePriority: number2().min(0).max(1).optional()
13431
+ var ModelPreferencesSchema = object2({
13432
+ hints: array2(ModelHintSchema).optional(),
13433
+ costPriority: number3().min(0).max(1).optional(),
13434
+ speedPriority: number3().min(0).max(1).optional(),
13435
+ intelligencePriority: number3().min(0).max(1).optional()
13186
13436
  });
13187
- var ToolChoiceSchema = object({
13188
- mode: _enum(["auto", "required", "none"]).optional()
13437
+ var ToolChoiceSchema = object2({
13438
+ mode: _enum2(["auto", "required", "none"]).optional()
13189
13439
  });
13190
- var ToolResultContentSchema = object({
13191
- type: literal("tool_result"),
13192
- toolUseId: string2().describe("The unique identifier for the corresponding tool call."),
13193
- content: array(ContentBlockSchema).default([]),
13194
- structuredContent: object({}).loose().optional(),
13195
- isError: boolean2().optional(),
13196
- _meta: record(string2(), unknown()).optional()
13440
+ var ToolResultContentSchema = object2({
13441
+ type: literal2("tool_result"),
13442
+ toolUseId: string3().describe("The unique identifier for the corresponding tool call."),
13443
+ content: array2(ContentBlockSchema).default([]),
13444
+ structuredContent: object2({}).loose().optional(),
13445
+ isError: boolean3().optional(),
13446
+ _meta: record2(string3(), unknown2()).optional()
13197
13447
  });
13198
- var SamplingContentSchema = discriminatedUnion("type", [TextContentSchema, ImageContentSchema, AudioContentSchema]);
13199
- var SamplingMessageContentBlockSchema = discriminatedUnion("type", [
13448
+ var SamplingContentSchema = discriminatedUnion2("type", [TextContentSchema, ImageContentSchema, AudioContentSchema]);
13449
+ var SamplingMessageContentBlockSchema = discriminatedUnion2("type", [
13200
13450
  TextContentSchema,
13201
13451
  ImageContentSchema,
13202
13452
  AudioContentSchema,
13203
13453
  ToolUseContentSchema,
13204
13454
  ToolResultContentSchema
13205
13455
  ]);
13206
- var SamplingMessageSchema = object({
13456
+ var SamplingMessageSchema = object2({
13207
13457
  role: RoleSchema,
13208
- content: union([SamplingMessageContentBlockSchema, array(SamplingMessageContentBlockSchema)]),
13209
- _meta: record(string2(), unknown()).optional()
13458
+ content: union2([SamplingMessageContentBlockSchema, array2(SamplingMessageContentBlockSchema)]),
13459
+ _meta: record2(string3(), unknown2()).optional()
13210
13460
  });
13211
13461
  var CreateMessageRequestParamsSchema = TaskAugmentedRequestParamsSchema.extend({
13212
- messages: array(SamplingMessageSchema),
13462
+ messages: array2(SamplingMessageSchema),
13213
13463
  modelPreferences: ModelPreferencesSchema.optional(),
13214
- systemPrompt: string2().optional(),
13215
- includeContext: _enum(["none", "thisServer", "allServers"]).optional(),
13216
- temperature: number2().optional(),
13217
- maxTokens: number2().int(),
13218
- stopSequences: array(string2()).optional(),
13464
+ systemPrompt: string3().optional(),
13465
+ includeContext: _enum2(["none", "thisServer", "allServers"]).optional(),
13466
+ temperature: number3().optional(),
13467
+ maxTokens: number3().int(),
13468
+ stopSequences: array2(string3()).optional(),
13219
13469
  metadata: AssertObjectSchema.optional(),
13220
- tools: array(ToolSchema).optional(),
13470
+ tools: array2(ToolSchema).optional(),
13221
13471
  toolChoice: ToolChoiceSchema.optional()
13222
13472
  });
13223
13473
  var CreateMessageRequestSchema = RequestSchema.extend({
13224
- method: literal("sampling/createMessage"),
13474
+ method: literal2("sampling/createMessage"),
13225
13475
  params: CreateMessageRequestParamsSchema
13226
13476
  });
13227
13477
  var CreateMessageResultSchema = ResultSchema.extend({
13228
- model: string2(),
13229
- stopReason: optional(_enum(["endTurn", "stopSequence", "maxTokens"]).or(string2())),
13478
+ model: string3(),
13479
+ stopReason: optional2(_enum2(["endTurn", "stopSequence", "maxTokens"]).or(string3())),
13230
13480
  role: RoleSchema,
13231
13481
  content: SamplingContentSchema
13232
13482
  });
13233
13483
  var CreateMessageResultWithToolsSchema = ResultSchema.extend({
13234
- model: string2(),
13235
- stopReason: optional(_enum(["endTurn", "stopSequence", "maxTokens", "toolUse"]).or(string2())),
13484
+ model: string3(),
13485
+ stopReason: optional2(_enum2(["endTurn", "stopSequence", "maxTokens", "toolUse"]).or(string3())),
13236
13486
  role: RoleSchema,
13237
- content: union([SamplingMessageContentBlockSchema, array(SamplingMessageContentBlockSchema)])
13238
- });
13239
- var BooleanSchemaSchema = object({
13240
- type: literal("boolean"),
13241
- title: string2().optional(),
13242
- description: string2().optional(),
13243
- default: boolean2().optional()
13244
- });
13245
- var StringSchemaSchema = object({
13246
- type: literal("string"),
13247
- title: string2().optional(),
13248
- description: string2().optional(),
13249
- minLength: number2().optional(),
13250
- maxLength: number2().optional(),
13251
- format: _enum(["email", "uri", "date", "date-time"]).optional(),
13252
- default: string2().optional()
13253
- });
13254
- var NumberSchemaSchema = object({
13255
- type: _enum(["number", "integer"]),
13256
- title: string2().optional(),
13257
- description: string2().optional(),
13258
- minimum: number2().optional(),
13259
- maximum: number2().optional(),
13260
- default: number2().optional()
13261
- });
13262
- var UntitledSingleSelectEnumSchemaSchema = object({
13263
- type: literal("string"),
13264
- title: string2().optional(),
13265
- description: string2().optional(),
13266
- enum: array(string2()),
13267
- default: string2().optional()
13268
- });
13269
- var TitledSingleSelectEnumSchemaSchema = object({
13270
- type: literal("string"),
13271
- title: string2().optional(),
13272
- description: string2().optional(),
13273
- oneOf: array(object({
13274
- const: string2(),
13275
- title: string2()
13487
+ content: union2([SamplingMessageContentBlockSchema, array2(SamplingMessageContentBlockSchema)])
13488
+ });
13489
+ var BooleanSchemaSchema = object2({
13490
+ type: literal2("boolean"),
13491
+ title: string3().optional(),
13492
+ description: string3().optional(),
13493
+ default: boolean3().optional()
13494
+ });
13495
+ var StringSchemaSchema = object2({
13496
+ type: literal2("string"),
13497
+ title: string3().optional(),
13498
+ description: string3().optional(),
13499
+ minLength: number3().optional(),
13500
+ maxLength: number3().optional(),
13501
+ format: _enum2(["email", "uri", "date", "date-time"]).optional(),
13502
+ default: string3().optional()
13503
+ });
13504
+ var NumberSchemaSchema = object2({
13505
+ type: _enum2(["number", "integer"]),
13506
+ title: string3().optional(),
13507
+ description: string3().optional(),
13508
+ minimum: number3().optional(),
13509
+ maximum: number3().optional(),
13510
+ default: number3().optional()
13511
+ });
13512
+ var UntitledSingleSelectEnumSchemaSchema = object2({
13513
+ type: literal2("string"),
13514
+ title: string3().optional(),
13515
+ description: string3().optional(),
13516
+ enum: array2(string3()),
13517
+ default: string3().optional()
13518
+ });
13519
+ var TitledSingleSelectEnumSchemaSchema = object2({
13520
+ type: literal2("string"),
13521
+ title: string3().optional(),
13522
+ description: string3().optional(),
13523
+ oneOf: array2(object2({
13524
+ const: string3(),
13525
+ title: string3()
13276
13526
  })),
13277
- default: string2().optional()
13278
- });
13279
- var LegacyTitledEnumSchemaSchema = object({
13280
- type: literal("string"),
13281
- title: string2().optional(),
13282
- description: string2().optional(),
13283
- enum: array(string2()),
13284
- enumNames: array(string2()).optional(),
13285
- default: string2().optional()
13286
- });
13287
- var SingleSelectEnumSchemaSchema = union([UntitledSingleSelectEnumSchemaSchema, TitledSingleSelectEnumSchemaSchema]);
13288
- var UntitledMultiSelectEnumSchemaSchema = object({
13289
- type: literal("array"),
13290
- title: string2().optional(),
13291
- description: string2().optional(),
13292
- minItems: number2().optional(),
13293
- maxItems: number2().optional(),
13294
- items: object({
13295
- type: literal("string"),
13296
- enum: array(string2())
13527
+ default: string3().optional()
13528
+ });
13529
+ var LegacyTitledEnumSchemaSchema = object2({
13530
+ type: literal2("string"),
13531
+ title: string3().optional(),
13532
+ description: string3().optional(),
13533
+ enum: array2(string3()),
13534
+ enumNames: array2(string3()).optional(),
13535
+ default: string3().optional()
13536
+ });
13537
+ var SingleSelectEnumSchemaSchema = union2([UntitledSingleSelectEnumSchemaSchema, TitledSingleSelectEnumSchemaSchema]);
13538
+ var UntitledMultiSelectEnumSchemaSchema = object2({
13539
+ type: literal2("array"),
13540
+ title: string3().optional(),
13541
+ description: string3().optional(),
13542
+ minItems: number3().optional(),
13543
+ maxItems: number3().optional(),
13544
+ items: object2({
13545
+ type: literal2("string"),
13546
+ enum: array2(string3())
13297
13547
  }),
13298
- default: array(string2()).optional()
13299
- });
13300
- var TitledMultiSelectEnumSchemaSchema = object({
13301
- type: literal("array"),
13302
- title: string2().optional(),
13303
- description: string2().optional(),
13304
- minItems: number2().optional(),
13305
- maxItems: number2().optional(),
13306
- items: object({
13307
- anyOf: array(object({
13308
- const: string2(),
13309
- title: string2()
13548
+ default: array2(string3()).optional()
13549
+ });
13550
+ var TitledMultiSelectEnumSchemaSchema = object2({
13551
+ type: literal2("array"),
13552
+ title: string3().optional(),
13553
+ description: string3().optional(),
13554
+ minItems: number3().optional(),
13555
+ maxItems: number3().optional(),
13556
+ items: object2({
13557
+ anyOf: array2(object2({
13558
+ const: string3(),
13559
+ title: string3()
13310
13560
  }))
13311
13561
  }),
13312
- default: array(string2()).optional()
13562
+ default: array2(string3()).optional()
13313
13563
  });
13314
- var MultiSelectEnumSchemaSchema = union([UntitledMultiSelectEnumSchemaSchema, TitledMultiSelectEnumSchemaSchema]);
13315
- var EnumSchemaSchema = union([LegacyTitledEnumSchemaSchema, SingleSelectEnumSchemaSchema, MultiSelectEnumSchemaSchema]);
13316
- var PrimitiveSchemaDefinitionSchema = union([EnumSchemaSchema, BooleanSchemaSchema, StringSchemaSchema, NumberSchemaSchema]);
13564
+ var MultiSelectEnumSchemaSchema = union2([UntitledMultiSelectEnumSchemaSchema, TitledMultiSelectEnumSchemaSchema]);
13565
+ var EnumSchemaSchema = union2([LegacyTitledEnumSchemaSchema, SingleSelectEnumSchemaSchema, MultiSelectEnumSchemaSchema]);
13566
+ var PrimitiveSchemaDefinitionSchema = union2([EnumSchemaSchema, BooleanSchemaSchema, StringSchemaSchema, NumberSchemaSchema]);
13317
13567
  var ElicitRequestFormParamsSchema = TaskAugmentedRequestParamsSchema.extend({
13318
- mode: literal("form").optional(),
13319
- message: string2(),
13320
- requestedSchema: object({
13321
- type: literal("object"),
13322
- properties: record(string2(), PrimitiveSchemaDefinitionSchema),
13323
- required: array(string2()).optional()
13568
+ mode: literal2("form").optional(),
13569
+ message: string3(),
13570
+ requestedSchema: object2({
13571
+ type: literal2("object"),
13572
+ properties: record2(string3(), PrimitiveSchemaDefinitionSchema),
13573
+ required: array2(string3()).optional()
13324
13574
  })
13325
13575
  });
13326
13576
  var ElicitRequestURLParamsSchema = TaskAugmentedRequestParamsSchema.extend({
13327
- mode: literal("url"),
13328
- message: string2(),
13329
- elicitationId: string2(),
13330
- url: string2().url()
13577
+ mode: literal2("url"),
13578
+ message: string3(),
13579
+ elicitationId: string3(),
13580
+ url: string3().url()
13331
13581
  });
13332
- var ElicitRequestParamsSchema = union([ElicitRequestFormParamsSchema, ElicitRequestURLParamsSchema]);
13582
+ var ElicitRequestParamsSchema = union2([ElicitRequestFormParamsSchema, ElicitRequestURLParamsSchema]);
13333
13583
  var ElicitRequestSchema = RequestSchema.extend({
13334
- method: literal("elicitation/create"),
13584
+ method: literal2("elicitation/create"),
13335
13585
  params: ElicitRequestParamsSchema
13336
13586
  });
13337
13587
  var ElicitationCompleteNotificationParamsSchema = NotificationsParamsSchema.extend({
13338
- elicitationId: string2()
13588
+ elicitationId: string3()
13339
13589
  });
13340
13590
  var ElicitationCompleteNotificationSchema = NotificationSchema.extend({
13341
- method: literal("notifications/elicitation/complete"),
13591
+ method: literal2("notifications/elicitation/complete"),
13342
13592
  params: ElicitationCompleteNotificationParamsSchema
13343
13593
  });
13344
13594
  var ElicitResultSchema = ResultSchema.extend({
13345
- action: _enum(["accept", "decline", "cancel"]),
13346
- content: preprocess((val) => val === null ? undefined : val, record(string2(), union([string2(), number2(), boolean2(), array(string2())])).optional())
13595
+ action: _enum2(["accept", "decline", "cancel"]),
13596
+ content: preprocess((val) => val === null ? undefined : val, record2(string3(), union2([string3(), number3(), boolean3(), array2(string3())])).optional())
13347
13597
  });
13348
- var ResourceTemplateReferenceSchema = object({
13349
- type: literal("ref/resource"),
13350
- uri: string2()
13598
+ var ResourceTemplateReferenceSchema = object2({
13599
+ type: literal2("ref/resource"),
13600
+ uri: string3()
13351
13601
  });
13352
- var PromptReferenceSchema = object({
13353
- type: literal("ref/prompt"),
13354
- name: string2()
13602
+ var PromptReferenceSchema = object2({
13603
+ type: literal2("ref/prompt"),
13604
+ name: string3()
13355
13605
  });
13356
13606
  var CompleteRequestParamsSchema = BaseRequestParamsSchema.extend({
13357
- ref: union([PromptReferenceSchema, ResourceTemplateReferenceSchema]),
13358
- argument: object({
13359
- name: string2(),
13360
- value: string2()
13607
+ ref: union2([PromptReferenceSchema, ResourceTemplateReferenceSchema]),
13608
+ argument: object2({
13609
+ name: string3(),
13610
+ value: string3()
13361
13611
  }),
13362
- context: object({
13363
- arguments: record(string2(), string2()).optional()
13612
+ context: object2({
13613
+ arguments: record2(string3(), string3()).optional()
13364
13614
  }).optional()
13365
13615
  });
13366
13616
  var CompleteRequestSchema = RequestSchema.extend({
13367
- method: literal("completion/complete"),
13617
+ method: literal2("completion/complete"),
13368
13618
  params: CompleteRequestParamsSchema
13369
13619
  });
13370
13620
  var CompleteResultSchema = ResultSchema.extend({
13371
- completion: looseObject({
13372
- values: array(string2()).max(100),
13373
- total: optional(number2().int()),
13374
- hasMore: optional(boolean2())
13621
+ completion: looseObject2({
13622
+ values: array2(string3()).max(100),
13623
+ total: optional2(number3().int()),
13624
+ hasMore: optional2(boolean3())
13375
13625
  })
13376
13626
  });
13377
- var RootSchema = object({
13378
- uri: string2().startsWith("file://"),
13379
- name: string2().optional(),
13380
- _meta: record(string2(), unknown()).optional()
13627
+ var RootSchema = object2({
13628
+ uri: string3().startsWith("file://"),
13629
+ name: string3().optional(),
13630
+ _meta: record2(string3(), unknown2()).optional()
13381
13631
  });
13382
13632
  var ListRootsRequestSchema = RequestSchema.extend({
13383
- method: literal("roots/list"),
13633
+ method: literal2("roots/list"),
13384
13634
  params: BaseRequestParamsSchema.optional()
13385
13635
  });
13386
13636
  var ListRootsResultSchema = ResultSchema.extend({
13387
- roots: array(RootSchema)
13637
+ roots: array2(RootSchema)
13388
13638
  });
13389
13639
  var RootsListChangedNotificationSchema = NotificationSchema.extend({
13390
- method: literal("notifications/roots/list_changed"),
13640
+ method: literal2("notifications/roots/list_changed"),
13391
13641
  params: NotificationsParamsSchema.optional()
13392
13642
  });
13393
- var ClientRequestSchema = union([
13643
+ var ClientRequestSchema = union2([
13394
13644
  PingRequestSchema,
13395
13645
  InitializeRequestSchema,
13396
13646
  CompleteRequestSchema,
@@ -13409,14 +13659,14 @@ var ClientRequestSchema = union([
13409
13659
  ListTasksRequestSchema,
13410
13660
  CancelTaskRequestSchema
13411
13661
  ]);
13412
- var ClientNotificationSchema = union([
13662
+ var ClientNotificationSchema = union2([
13413
13663
  CancelledNotificationSchema,
13414
13664
  ProgressNotificationSchema,
13415
13665
  InitializedNotificationSchema,
13416
13666
  RootsListChangedNotificationSchema,
13417
13667
  TaskStatusNotificationSchema
13418
13668
  ]);
13419
- var ClientResultSchema = union([
13669
+ var ClientResultSchema = union2([
13420
13670
  EmptyResultSchema,
13421
13671
  CreateMessageResultSchema,
13422
13672
  CreateMessageResultWithToolsSchema,
@@ -13426,7 +13676,7 @@ var ClientResultSchema = union([
13426
13676
  ListTasksResultSchema,
13427
13677
  CreateTaskResultSchema
13428
13678
  ]);
13429
- var ServerRequestSchema = union([
13679
+ var ServerRequestSchema = union2([
13430
13680
  PingRequestSchema,
13431
13681
  CreateMessageRequestSchema,
13432
13682
  ElicitRequestSchema,
@@ -13436,7 +13686,7 @@ var ServerRequestSchema = union([
13436
13686
  ListTasksRequestSchema,
13437
13687
  CancelTaskRequestSchema
13438
13688
  ]);
13439
- var ServerNotificationSchema = union([
13689
+ var ServerNotificationSchema = union2([
13440
13690
  CancelledNotificationSchema,
13441
13691
  ProgressNotificationSchema,
13442
13692
  LoggingMessageNotificationSchema,
@@ -13447,7 +13697,7 @@ var ServerNotificationSchema = union([
13447
13697
  TaskStatusNotificationSchema,
13448
13698
  ElicitationCompleteNotificationSchema
13449
13699
  ]);
13450
- var ServerResultSchema = union([
13700
+ var ServerResultSchema = union2([
13451
13701
  EmptyResultSchema,
13452
13702
  InitializeResultSchema,
13453
13703
  CompleteResultSchema,
@@ -14978,6 +15228,18 @@ import path30 from "node:path";
14978
15228
 
14979
15229
  // packages/workit-core/src/core/task-contract.ts
14980
15230
  import { createHash, randomUUID } from "node:crypto";
15231
+
15232
+ // packages/workit-core/src/core/zod-mini.ts
15233
+ if (!globalConfig.localeError)
15234
+ config(en_default());
15235
+ if (!globalConfig.memoizer)
15236
+ config({ memoizer: memoizer() });
15237
+ var described = (schema, description) => {
15238
+ const copy = schema.clone();
15239
+ globalRegistry.add(copy, { description });
15240
+ return copy;
15241
+ };
15242
+
14981
15243
  // packages/workit-core/src/core/scope-glob.ts
14982
15244
  var GLOB = /[*?[\]{}]/u;
14983
15245
  var segmentRegex = (pattern) => {
@@ -15065,11 +15327,11 @@ var text = string2().check((ctx) => {
15065
15327
  if (invalidUnicode(ctx.value))
15066
15328
  ctx.issues.push({ code: "custom", input: ctx.value, message: "invalid Unicode", path: [] });
15067
15329
  });
15068
- var id = text.regex(uuidPattern, "expected lowercase UUID");
15330
+ var id = text.check(_regex(uuidPattern, "expected lowercase UUID"));
15069
15331
  var idRefPattern = /^[0-9a-f][0-9a-f-]{7,35}$/;
15070
- var idRef = text.regex(idRefPattern, "expected a UUID or an id prefix of 8+ characters");
15071
- var digest = text.regex(digestPattern, "expected lowercase SHA-256 digest");
15072
- var revision = text.regex(uuidPattern, "expected UUID revision");
15332
+ var idRef = text.check(_regex(idRefPattern, "expected a UUID or an id prefix of 8+ characters"));
15333
+ var digest = text.check(_regex(digestPattern, "expected lowercase SHA-256 digest"));
15334
+ var revision = text.check(_regex(uuidPattern, "expected UUID revision"));
15073
15335
  var validUtc = (value) => {
15074
15336
  const match = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,9}))?Z$/.exec(value);
15075
15337
  if (!match)
@@ -15090,8 +15352,8 @@ var utcSchema = text.check((ctx) => {
15090
15352
  });
15091
15353
  });
15092
15354
  var utc = utcSchema;
15093
- var safeInteger = number2().int().safe();
15094
- var nonEmpty = text.min(1);
15355
+ var safeInteger = number2().check(int()).check(int());
15356
+ var nonEmpty = text.check(_minLength(1));
15095
15357
  var pathValue = nonEmpty.check((ctx) => {
15096
15358
  if (ctx.value !== "." && (ctx.value.includes("\\") || ctx.value.split("/").includes(".."))) {
15097
15359
  ctx.issues.push({
@@ -15102,8 +15364,8 @@ var pathValue = nonEmpty.check((ctx) => {
15102
15364
  });
15103
15365
  }
15104
15366
  });
15105
- var nullableDigest = digest.nullable();
15106
- var nullableId = id.nullable();
15367
+ var nullableDigest = nullable(digest);
15368
+ var nullableId = nullable(id);
15107
15369
  var hostSchema = _enum([
15108
15370
  "opencode",
15109
15371
  "cursor",
@@ -15115,11 +15377,11 @@ var hostSchema = _enum([
15115
15377
  ]);
15116
15378
  var assuranceSchema = _enum(["enforced", "agent_guided", "unavailable"]);
15117
15379
  var outcomeSchema = _enum(["verified", "accepted_limitations", "stopped"]);
15118
- var scopeSchema = object({
15380
+ var scopeSchema = strictObject({
15119
15381
  description: text,
15120
15382
  paths: array(pathValue),
15121
15383
  exclusions: array(pathValue)
15122
- }).strict();
15384
+ });
15123
15385
  var scopeGap = (outer, inner) => {
15124
15386
  const strip = (value) => value.length > 1 ? value.replace(/\/+$/, "") : value;
15125
15387
  const normOuter = {
@@ -15144,14 +15406,14 @@ var scopeGap = (outer, inner) => {
15144
15406
  };
15145
15407
  var scopeCovers = (outer, inner) => scopeGap(outer, inner) === null;
15146
15408
  var refSchema = discriminatedUnion("kind", [
15147
- object({ kind: literal("file"), path: pathValue, digest: nullableDigest }).strict(),
15148
- object({
15409
+ strictObject({ kind: literal("file"), path: pathValue, digest: nullableDigest }),
15410
+ strictObject({
15149
15411
  kind: literal("record"),
15150
15412
  collection: _enum(["evidence", "decisions", "findings", "workers"]),
15151
15413
  id
15152
- }).strict(),
15153
- object({ kind: literal("host"), host: hostSchema, handle: nonEmpty }).strict(),
15154
- object({ kind: literal("external"), url: text.url() }).strict()
15414
+ }),
15415
+ strictObject({ kind: literal("host"), host: hostSchema, handle: nonEmpty }),
15416
+ strictObject({ kind: literal("external"), url: text.check(url()) })
15155
15417
  ]);
15156
15418
  var rewriteUnknown = (value, map) => {
15157
15419
  if (Array.isArray(value)) {
@@ -15183,8 +15445,8 @@ var rewriteNode = (value, schema, map) => {
15183
15445
  return mapped === null ? { drop: true } : { drop: false, value: mapped };
15184
15446
  }
15185
15447
  let node = schema;
15186
- while (node instanceof ZodNullable || node instanceof ZodOptional || node instanceof ZodDefault) {
15187
- node = node.unwrap();
15448
+ while (node instanceof $ZodNullable || node instanceof $ZodOptional || node instanceof $ZodDefault) {
15449
+ node = node._zod.def.innerType;
15188
15450
  }
15189
15451
  if (node === refSchema) {
15190
15452
  if (!refSchema.safeParse(value).success)
@@ -15192,21 +15454,21 @@ var rewriteNode = (value, schema, map) => {
15192
15454
  const mapped = map(value);
15193
15455
  return mapped === null ? { drop: true } : { drop: false, value: mapped };
15194
15456
  }
15195
- if (node instanceof ZodArray) {
15457
+ if (node instanceof $ZodArray) {
15196
15458
  if (!Array.isArray(value))
15197
15459
  return { drop: false, value };
15198
15460
  const out = [];
15199
15461
  for (const item of value) {
15200
- const rewritten = rewriteNode(item, node.element, map);
15462
+ const rewritten = rewriteNode(item, node._zod.def.element, map);
15201
15463
  if (!rewritten.drop)
15202
15464
  out.push(rewritten.value);
15203
15465
  }
15204
15466
  return { drop: false, value: out };
15205
15467
  }
15206
- if (node instanceof ZodObject) {
15468
+ if (node instanceof $ZodObject) {
15207
15469
  if (typeof value !== "object" || value === null || Array.isArray(value))
15208
15470
  return { drop: false, value };
15209
- const shape = node.shape;
15471
+ const shape = node._zod.def.shape;
15210
15472
  const record = value;
15211
15473
  const out = {};
15212
15474
  for (const [key, item] of Object.entries(record)) {
@@ -15218,9 +15480,9 @@ var rewriteNode = (value, schema, map) => {
15218
15480
  const child = shape[key];
15219
15481
  const rewritten = rewriteNode(item, child, map);
15220
15482
  if (rewritten.drop) {
15221
- if (child instanceof ZodOptional || child instanceof ZodDefault)
15483
+ if (child instanceof $ZodOptional || child instanceof $ZodDefault)
15222
15484
  continue;
15223
- if (child instanceof ZodNullable) {
15485
+ if (child instanceof $ZodNullable) {
15224
15486
  out[key] = null;
15225
15487
  continue;
15226
15488
  }
@@ -15236,34 +15498,34 @@ var rewriteRecordRefs = (value, schema, map) => {
15236
15498
  const rewritten = rewriteNode(value, schema, map);
15237
15499
  return rewritten.drop ? null : rewritten.value;
15238
15500
  };
15239
- var provenanceSchema = object({
15501
+ var provenanceSchema = strictObject({
15240
15502
  kind: _enum(["host_observed", "agent_reported", "imported"]),
15241
15503
  host: hostSchema,
15242
- session: refSchema.nullable(),
15504
+ session: nullable(refSchema),
15243
15505
  workerId: nullableId
15244
- }).strict();
15245
- var entrySchema = (data) => object({ id, recordedAt: utc, provenance: provenanceSchema, data }).strict();
15506
+ });
15507
+ var entrySchema = (data) => strictObject({ id, recordedAt: utc, provenance: provenanceSchema, data });
15246
15508
  var RISK_TIERS = ["trivial", "normal", "high"];
15247
- var judgmentSchema = object({
15509
+ var judgmentSchema = strictObject({
15248
15510
  riskTier: _enum(RISK_TIERS),
15249
15511
  behaviorChange: boolean2(),
15250
15512
  productChoiceOpen: boolean2(),
15251
15513
  needsPlan: boolean2(),
15252
- note: text.nullable(),
15514
+ note: nullable(text),
15253
15515
  refs: array(refSchema)
15254
- }).strict();
15516
+ });
15255
15517
  var legacyAssessmentSchema = looseObject({});
15256
- var constraintSchema = object({
15518
+ var constraintSchema = strictObject({
15257
15519
  id: nonEmpty,
15258
15520
  kind: _enum(["host", "project", "user"]),
15259
15521
  statement: text,
15260
15522
  source: refSchema,
15261
15523
  acceptanceAllowed: boolean2(),
15262
- requires: array(object({
15524
+ requires: array(strictObject({
15263
15525
  kind: _enum(["check", "method", "decision"]),
15264
15526
  scope: scopeSchema,
15265
15527
  refs: array(refSchema),
15266
- method: _enum([
15528
+ method: nullable(_enum([
15267
15529
  "investigation",
15268
15530
  "challenge",
15269
15531
  "artifacts",
@@ -15273,10 +15535,10 @@ var constraintSchema = object({
15273
15535
  "delegation",
15274
15536
  "continuity",
15275
15537
  "decisions"
15276
- ]).nullable(),
15538
+ ])),
15277
15539
  before: _enum(["dependent_action", "write", "close"]),
15278
- dependentAction: text.nullable()
15279
- }).strict().check((ctx) => {
15540
+ dependentAction: nullable(text)
15541
+ }).check((ctx) => {
15280
15542
  const obligation = ctx.value;
15281
15543
  const validMethod = obligation.kind === "method" && obligation.method !== null || obligation.kind !== "method" && obligation.method === null;
15282
15544
  if (!validMethod)
@@ -15287,13 +15549,17 @@ var constraintSchema = object({
15287
15549
  path: ["method"]
15288
15550
  });
15289
15551
  }))
15290
- }).strict();
15291
- var intentSchema = object({ objective: text, scope: scopeSchema, authorityRefs: array(refSchema) }).strict();
15292
- var progressSchema = object({
15552
+ });
15553
+ var intentSchema = strictObject({
15554
+ objective: text,
15555
+ scope: scopeSchema,
15556
+ authorityRefs: array(refSchema)
15557
+ });
15558
+ var progressSchema = strictObject({
15293
15559
  summary: text,
15294
- nextAction: text.nullable(),
15295
- blockers: array(object({ reason: text, dependentAction: text, refs: array(refSchema) }).strict())
15296
- }).strict();
15560
+ nextAction: nullable(text),
15561
+ blockers: array(strictObject({ reason: text, dependentAction: text, refs: array(refSchema) }))
15562
+ });
15297
15563
  var dimensionSchema = _enum([
15298
15564
  "investigation",
15299
15565
  "challenge",
@@ -15305,10 +15571,10 @@ var dimensionSchema = _enum([
15305
15571
  "continuity",
15306
15572
  "decisions"
15307
15573
  ]);
15308
- var policySchema = object({
15309
- policyVersion: text.regex(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/),
15574
+ var policySchema = strictObject({
15575
+ policyVersion: text.check(_regex(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/)),
15310
15576
  inputDigest: digest,
15311
- requirements: array(object({
15577
+ requirements: array(strictObject({
15312
15578
  id: digest,
15313
15579
  ruleId: nonEmpty,
15314
15580
  dimension: dimensionSchema,
@@ -15316,29 +15582,29 @@ var policySchema = object({
15316
15582
  reason: text,
15317
15583
  satisfaction: text,
15318
15584
  before: _enum(["dependent_action", "write", "close"]),
15319
- dependentAction: text.nullable(),
15585
+ dependentAction: nullable(text),
15320
15586
  acceptanceAllowed: boolean2()
15321
- }).strict())
15322
- }).strict();
15323
- var requirementSchema = policySchema.shape.requirements.element;
15324
- var policyChangeSchema = object({
15587
+ }))
15588
+ });
15589
+ var requirementSchema = policySchema.shape.requirements._zod.def.element;
15590
+ var policyChangeSchema = strictObject({
15325
15591
  recordedAt: utc,
15326
15592
  fromInputDigest: nullableDigest,
15327
15593
  toInputDigest: digest,
15328
15594
  added: array(digest),
15329
15595
  retired: array(digest),
15330
15596
  reason: text
15331
- }).strict();
15332
- var candidateSchema = object({
15597
+ });
15598
+ var candidateSchema = strictObject({
15333
15599
  id: digest,
15334
15600
  scope: scopeSchema,
15335
15601
  completeness: _enum(["known", "uncertain"]),
15336
- files: array(object({
15602
+ files: array(strictObject({
15337
15603
  path: pathValue,
15338
15604
  kind: _enum(["file", "symlink", "absent"]),
15339
15605
  digest: nullableDigest,
15340
- executable: boolean2().nullable()
15341
- }).strict().check((ctx) => {
15606
+ executable: nullable(boolean2())
15607
+ }).check((ctx) => {
15342
15608
  const file = ctx.value;
15343
15609
  const valid = file.kind === "absent" ? file.digest === null && file.executable === null : file.kind === "file" ? file.digest !== null && typeof file.executable === "boolean" : file.digest !== null && file.executable === null;
15344
15610
  if (!valid)
@@ -15349,7 +15615,7 @@ var candidateSchema = object({
15349
15615
  path: []
15350
15616
  });
15351
15617
  })),
15352
- environment: array(object({ name: nonEmpty, value: text.nullable(), refs: array(refSchema) }).strict()).check((ctx) => {
15618
+ environment: array(strictObject({ name: nonEmpty, value: nullable(text), refs: array(refSchema) })).check((ctx) => {
15353
15619
  if (new Set(ctx.value.map((value) => value.name)).size !== ctx.value.length)
15354
15620
  ctx.issues.push({
15355
15621
  code: "custom",
@@ -15358,8 +15624,8 @@ var candidateSchema = object({
15358
15624
  path: []
15359
15625
  });
15360
15626
  }),
15361
- head: text.nullable()
15362
- }).strict().check((ctx) => {
15627
+ head: nullable(text)
15628
+ }).check((ctx) => {
15363
15629
  if (ctx.value.id !== candidateDigest(ctx.value))
15364
15630
  ctx.issues.push({
15365
15631
  code: "custom",
@@ -15368,139 +15634,142 @@ var candidateSchema = object({
15368
15634
  path: ["id"]
15369
15635
  });
15370
15636
  });
15371
- var checkObservationSchema = object({
15637
+ var checkObservationSchema = strictObject({
15372
15638
  observer: literal("workit_cli"),
15373
- name: nonEmpty.nullable(),
15639
+ name: nullable(nonEmpty),
15374
15640
  configured: boolean2(),
15375
- argv: array(text).min(1),
15641
+ argv: array(text).check(_minLength(1)),
15376
15642
  shell: boolean2(),
15377
15643
  cwd: nonEmpty,
15378
15644
  exitCode: safeInteger,
15379
- durationMs: safeInteger.min(0),
15645
+ durationMs: safeInteger.check(_gte(0)),
15380
15646
  timedOut: boolean2(),
15381
- head: text.nullable(),
15382
- tree: text.nullable(),
15383
- dirty: boolean2().nullable(),
15384
- signal: text.nullable(),
15385
- treeAfter: text.nullable(),
15647
+ head: nullable(text),
15648
+ tree: nullable(text),
15649
+ dirty: nullable(boolean2()),
15650
+ signal: nullable(text),
15651
+ treeAfter: nullable(text),
15386
15652
  modifiedWorktree: boolean2(),
15387
- base: text.nullable(),
15388
- patchId: text.nullable(),
15389
- environment: object({
15653
+ base: nullable(text),
15654
+ patchId: nullable(text),
15655
+ environment: strictObject({
15390
15656
  platform: nonEmpty,
15391
15657
  arch: nonEmpty,
15392
- vars: record(nonEmpty, text.nullable())
15393
- }).strict(),
15394
- logDigest: text.nullable(),
15395
- logRef: text.nullable(),
15396
- logTail: array(text).max(40),
15397
- ledgerRowId: text.nullable(),
15398
- attestation: object({ host: nonEmpty, session: text.nullable(), agentId: text.nullable() }).strict().nullable()
15399
- }).strict();
15658
+ vars: record(nonEmpty, nullable(text))
15659
+ }),
15660
+ logDigest: nullable(text),
15661
+ logRef: nullable(text),
15662
+ logTail: array(text).check(_maxLength(40)),
15663
+ ledgerRowId: nullable(text),
15664
+ attestation: nullable(strictObject({ host: nonEmpty, session: nullable(text), agentId: nullable(text) }))
15665
+ });
15400
15666
  var CHECK_OBSERVATION_PATH = "evidence.*.data.observation";
15401
15667
  var evidenceFields = {
15402
15668
  kind: _enum(["check", "review", "investigation", "artifact"]),
15403
15669
  claim: text,
15404
15670
  requirementIds: array(digest),
15405
- beforeCandidateId: nullableDigest.optional(),
15406
- candidateId: nullableDigest.optional(),
15671
+ beforeCandidateId: optional(nullableDigest),
15672
+ candidateId: optional(nullableDigest),
15407
15673
  result: _enum(["passed", "failed", "missing", "skipped"]),
15408
15674
  summary: text,
15409
15675
  refs: array(refSchema),
15410
- exitCode: safeInteger.nullable(),
15411
- reviewContext: refSchema.nullable()
15676
+ exitCode: nullable(safeInteger),
15677
+ reviewContext: nullable(refSchema)
15412
15678
  };
15413
- var evidenceSchema = object({ ...evidenceFields, observation: checkObservationSchema.optional() }).strict();
15414
- var reportedEvidenceSchema = object(evidenceFields).strict();
15415
- var evidenceEvaluationSchema = object({
15679
+ var evidenceSchema = strictObject({
15680
+ ...evidenceFields,
15681
+ observation: optional(checkObservationSchema)
15682
+ });
15683
+ var reportedEvidenceSchema = strictObject(evidenceFields);
15684
+ var evidenceEvaluationSchema = strictObject({
15416
15685
  evidenceId: id,
15417
15686
  status: _enum(["passed", "failed", "missing", "skipped", "stale"]),
15418
15687
  reason: text
15419
- }).strict();
15420
- var decisionSchema = object({
15688
+ });
15689
+ var decisionSchema = strictObject({
15421
15690
  purpose: _enum(["design", "action", "limitation", "preference"]),
15422
- binding: object({
15691
+ binding: strictObject({
15423
15692
  taskId: id,
15424
15693
  workspaceId: id,
15425
15694
  scope: scopeSchema,
15426
15695
  presented: text,
15427
15696
  contentRefs: array(refSchema),
15428
- statedChoice: object({ ref: text, text }).strict().optional()
15429
- }).strict(),
15697
+ statedChoice: optional(strictObject({ ref: text, text }))
15698
+ }),
15430
15699
  digest,
15431
15700
  response: _enum(["approved", "rejected", "stated"]),
15432
15701
  requirementIds: array(digest),
15433
- revoked: object({ at: utc, reason: text }).strict().nullable()
15434
- }).strict();
15435
- var findingSchema = object({
15702
+ revoked: nullable(strictObject({ at: utc, reason: text }))
15703
+ });
15704
+ var findingSchema = strictObject({
15436
15705
  claim: text,
15437
15706
  consequence: text,
15438
15707
  scope: scopeSchema,
15439
15708
  candidateId: nullableDigest,
15440
15709
  refs: array(refSchema),
15441
15710
  disposition: _enum(["open", "fixed", "dismissed", "deferred"]),
15442
- resolution: object({ reason: text, evidenceIds: array(id), decisionIds: array(id) }).strict().nullable(),
15443
- leadOwned: literal(true).optional()
15444
- }).strict();
15445
- var assignmentSchema = object({
15711
+ resolution: nullable(strictObject({ reason: text, evidenceIds: array(id), decisionIds: array(id) })),
15712
+ leadOwned: optional(literal(true))
15713
+ });
15714
+ var assignmentSchema = strictObject({
15446
15715
  role: _enum(["investigator", "reviewer", "implementer"]),
15447
15716
  objective: text,
15448
15717
  scope: scopeSchema,
15449
15718
  decisionIds: array(id),
15450
15719
  requirementIds: array(digest),
15451
- candidateId: nullableDigest.optional(),
15720
+ candidateId: optional(nullableDigest),
15452
15721
  stoppingCondition: text
15453
- }).strict();
15454
- var workerReportSchema = object({
15722
+ });
15723
+ var workerReportSchema = strictObject({
15455
15724
  outcome: _enum(["completed", "failed", "cancelled"]),
15456
15725
  summary: text,
15457
15726
  evidenceIds: array(id),
15458
15727
  findingIds: array(idRef)
15459
- }).strict();
15460
- var workerSchema = object({
15728
+ });
15729
+ var workerSchema = strictObject({
15461
15730
  assignment: assignmentSchema,
15462
15731
  state: _enum(["assigned", "dispatching", "running", "cancelling", "stopped", "unknown"]),
15463
- session: refSchema.nullable(),
15464
- coordinator: refSchema.optional(),
15465
- report: workerReportSchema.nullable()
15466
- }).strict();
15467
- var closureSchema = object({
15732
+ session: nullable(refSchema),
15733
+ coordinator: optional(refSchema),
15734
+ report: nullable(workerReportSchema)
15735
+ });
15736
+ var closureSchema = strictObject({
15468
15737
  outcome: outcomeSchema,
15469
15738
  at: utc,
15470
15739
  summary: text,
15471
15740
  decisionIds: array(id),
15472
15741
  evidenceIds: array(id)
15473
- }).strict();
15474
- var runtimeSchema = object({
15475
- createdWith: text.nullable(),
15742
+ });
15743
+ var runtimeSchema = strictObject({
15744
+ createdWith: nullable(text),
15476
15745
  updatedWith: text
15477
- }).strict();
15478
- var taskRecordSchema = object({
15746
+ });
15747
+ var taskRecordSchema = strictObject({
15479
15748
  schemaVersion: literal(1),
15480
15749
  id,
15481
15750
  workspaceId: id,
15482
15751
  revision,
15483
15752
  createdAt: utc,
15484
15753
  updatedAt: utc,
15485
- origin: object({ workspaceId: id, taskId: id, exportDigest: digest }).strict().nullable(),
15754
+ origin: nullable(strictObject({ workspaceId: id, taskId: id, exportDigest: digest })),
15486
15755
  intent: entrySchema(intentSchema),
15487
15756
  constraints: array(constraintSchema),
15488
15757
  status: _enum(["active", "paused", "closed"]),
15489
- closure: closureSchema.nullable(),
15758
+ closure: nullable(closureSchema),
15490
15759
  progress: progressSchema,
15491
- pauseReason: text.nullable().optional(),
15492
- runtime: runtimeSchema.optional(),
15760
+ pauseReason: optional(nullable(text)),
15761
+ runtime: optional(runtimeSchema),
15493
15762
  assessments: array(entrySchema(legacyAssessmentSchema)),
15494
- judgments: array(entrySchema(judgmentSchema)).optional(),
15495
- policy: policySchema.nullable(),
15763
+ judgments: optional(array(entrySchema(judgmentSchema))),
15764
+ policy: nullable(policySchema),
15496
15765
  policyChanges: array(policyChangeSchema),
15497
15766
  candidates: array(candidateSchema),
15498
15767
  evidence: array(entrySchema(evidenceSchema)),
15499
15768
  decisions: array(entrySchema(decisionSchema)),
15500
15769
  findings: array(entrySchema(findingSchema)),
15501
15770
  workers: array(entrySchema(workerSchema)),
15502
- critical: array(nonEmpty).optional()
15503
- }).strict();
15771
+ critical: optional(array(nonEmpty))
15772
+ });
15504
15773
  var stripCount = (strips) => strips.reduce((sum, strip) => sum + strip.keys.length, 0);
15505
15774
  var strippable = (issues, prefix = []) => {
15506
15775
  const strips = [];
@@ -15554,117 +15823,224 @@ var parseStoredRecord = (schema, value) => {
15554
15823
  return { ...first, critical };
15555
15824
  return { success: true, data: parsed.data, stripped: [...new Set(stripped)] };
15556
15825
  };
15557
- var workspaceRecordSchema = object({
15826
+ var workspaceRecordSchema = strictObject({
15558
15827
  schemaVersion: literal(1),
15559
15828
  id,
15560
15829
  revision,
15561
15830
  root: nonEmpty,
15562
- runtime: runtimeSchema.optional(),
15563
- critical: array(nonEmpty).optional()
15564
- }).strict();
15565
- var capabilitySchema = object({
15831
+ runtime: optional(runtimeSchema),
15832
+ critical: optional(array(nonEmpty))
15833
+ });
15834
+ var capabilitySchema = strictObject({
15566
15835
  name: nonEmpty,
15567
15836
  surface: nonEmpty,
15568
15837
  assurance: assuranceSchema,
15569
15838
  reason: text,
15570
15839
  refs: array(refSchema)
15571
- }).strict();
15572
- var requirementEvaluationSchema = object({
15840
+ });
15841
+ var requirementEvaluationSchema = strictObject({
15573
15842
  requirementId: digest,
15574
15843
  status: _enum(["satisfied", "unsatisfied", "accepted_limitation", "unavailable"]),
15575
15844
  evidenceIds: array(id),
15576
15845
  decisionIds: array(id),
15577
15846
  reason: text
15578
- }).strict();
15579
- var taskViewSchema = object({
15847
+ });
15848
+ var taskViewSchema = strictObject({
15580
15849
  task: taskRecordSchema,
15581
15850
  workspace: workspaceRecordSchema,
15582
15851
  capabilities: array(capabilitySchema),
15583
15852
  requirements: array(requirementEvaluationSchema),
15584
15853
  evidence: array(evidenceEvaluationSchema)
15585
- }).strict();
15586
- var taskSummarySchema = object({
15854
+ });
15855
+ var taskSummarySchema = strictObject({
15587
15856
  id,
15588
15857
  revision,
15589
15858
  workspaceRevision: revision,
15590
15859
  createdAt: utc,
15591
15860
  updatedAt: utc,
15592
- runtime: runtimeSchema.nullable(),
15861
+ runtime: nullable(runtimeSchema),
15593
15862
  objective: text,
15594
15863
  status: _enum(["active", "paused", "closed"]),
15595
- closure: closureSchema.nullable(),
15864
+ closure: nullable(closureSchema),
15596
15865
  progress: progressSchema,
15597
- policy: policySchema.nullable(),
15866
+ policy: nullable(policySchema),
15598
15867
  requirements: array(requirementEvaluationSchema)
15599
- }).strict();
15600
- var taskListItemSchema = taskSummarySchema.omit({ policy: true, requirements: true }).extend({ source: provenanceSchema.pick({ host: true, kind: true }) }).strict();
15601
- var exportBundleSchema = object({
15868
+ });
15869
+ var taskListItemSchema = extend2(omit2(taskSummarySchema, { policy: true, requirements: true }), { source: pick2(provenanceSchema, { host: true, kind: true }) });
15870
+ var exportBundleSchema = strictObject({
15602
15871
  schemaVersion: literal(1),
15603
15872
  exportedAt: utc,
15604
15873
  sourceWorkspaceId: id,
15605
15874
  task: taskRecordSchema,
15606
15875
  digest
15607
- }).strict();
15608
- var callerSchema = object({ host: hostSchema, actor: text }).strict();
15876
+ });
15877
+ var callerSchema = strictObject({ host: hostSchema, actor: text });
15878
+ var success = (revisionValue, workspaceRevisionValue, data) => ({
15879
+ ok: true,
15880
+ schemaVersion: 1,
15881
+ revision: revisionValue,
15882
+ workspaceRevision: workspaceRevisionValue,
15883
+ data
15884
+ });
15885
+ var failure2 = (code, error, details = {}) => ({ ok: false, schemaVersion: 1, code, error, details });
15886
+ function resolveIdRef(kind, ref, ids) {
15887
+ if (ids.includes(ref))
15888
+ return success(null, null, ref);
15889
+ const matches = ids.filter((candidate) => candidate.startsWith(ref));
15890
+ if (matches.length === 1)
15891
+ return success(null, null, matches[0]);
15892
+ if (matches.length === 0)
15893
+ return failure2("not_found", `${kind} not found`);
15894
+ return failure2("invalid_input", `${kind} prefix ${ref} is ambiguous; candidates: ${matches.join(", ")}`);
15895
+ }
15896
+ function canonical(value, seen) {
15897
+ if (value === null || typeof value === "boolean" || typeof value === "string") {
15898
+ if (typeof value === "string" && invalidUnicode(value))
15899
+ throw new TypeError("invalid Unicode");
15900
+ return value;
15901
+ }
15902
+ if (typeof value === "number") {
15903
+ if (!Number.isSafeInteger(value))
15904
+ throw new TypeError("number must be a finite safe integer");
15905
+ return value;
15906
+ }
15907
+ if (typeof value !== "object")
15908
+ throw new TypeError("value is not JSON serializable");
15909
+ if (seen.has(value))
15910
+ throw new TypeError("cyclic value");
15911
+ seen.add(value);
15912
+ let result;
15913
+ if (Array.isArray(value)) {
15914
+ for (let index = 0;index < value.length; index += 1) {
15915
+ if (!(index in value))
15916
+ throw new TypeError("sparse array");
15917
+ }
15918
+ result = value.map((item) => canonical(item, seen));
15919
+ } else {
15920
+ if (Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null)
15921
+ throw new TypeError("value is not a JSON object");
15922
+ if (Reflect.ownKeys(value).some((key) => typeof key !== "string"))
15923
+ throw new TypeError("symbol key is not JSON");
15924
+ if (Object.keys(value).some((key) => invalidUnicode(key)))
15925
+ throw new TypeError("invalid Unicode");
15926
+ result = Object.fromEntries(Object.keys(value).toSorted().map((key) => [key, canonical(value[key], seen)]));
15927
+ }
15928
+ seen.delete(value);
15929
+ return result;
15930
+ }
15931
+ function canonicalJson(value) {
15932
+ return JSON.stringify(canonical(value, new Set));
15933
+ }
15934
+ function sha256(value) {
15935
+ if (typeof value === "string" && invalidUnicode(value))
15936
+ throw new TypeError("invalid Unicode");
15937
+ return createHash("sha256").update(typeof value === "string" ? value : canonicalJson(value), "utf8").digest("hex");
15938
+ }
15939
+ function newId() {
15940
+ return randomUUID().toLowerCase();
15941
+ }
15942
+ function newRevision() {
15943
+ return randomUUID().toLowerCase();
15944
+ }
15945
+ var compareCodeUnits = (left, right) => {
15946
+ const length = Math.min(left.length, right.length);
15947
+ for (let index = 0;index < length; index += 1) {
15948
+ const difference = left.charCodeAt(index) - right.charCodeAt(index);
15949
+ if (difference !== 0)
15950
+ return difference;
15951
+ }
15952
+ return left.length - right.length;
15953
+ };
15954
+ var compareNullableText = (left, right) => left === right ? 0 : left === null ? -1 : right === null ? 1 : compareCodeUnits(left, right);
15955
+ var compareBooleanNullable = (left, right) => left === right ? 0 : left === null ? -1 : right === null ? 1 : Number(left) - Number(right);
15956
+ function decisionDigest(input) {
15957
+ const { digest: _ignored, revoked: _revoked, ...value } = input;
15958
+ return sha256(value);
15959
+ }
15960
+ function candidateDigest(input) {
15961
+ const normalizedScope = {
15962
+ description: input.scope.description,
15963
+ paths: [...input.scope.paths].toSorted(compareCodeUnits),
15964
+ exclusions: [...input.scope.exclusions].toSorted(compareCodeUnits)
15965
+ };
15966
+ return sha256({
15967
+ scope: normalizedScope,
15968
+ completeness: input.completeness,
15969
+ files: [...input.files].toSorted((left, right) => compareCodeUnits(left.path, right.path) || compareCodeUnits(left.kind, right.kind) || compareNullableText(left.digest, right.digest) || compareBooleanNullable(left.executable, right.executable)),
15970
+ environment: input.environment.map(({ name, value }) => ({ name, value })).toSorted((left, right) => compareCodeUnits(left.name, right.name) || compareNullableText(left.value, right.value)),
15971
+ head: input.head
15972
+ });
15973
+ }
15974
+ function requirementId(input) {
15975
+ return sha256({
15976
+ ...input,
15977
+ scope: {
15978
+ description: input.scope.description,
15979
+ paths: [...input.scope.paths].toSorted(compareCodeUnits),
15980
+ exclusions: [...input.scope.exclusions].toSorted(compareCodeUnits)
15981
+ }
15982
+ });
15983
+ }
15984
+ // packages/workit-core/src/core/operations.ts
15609
15985
  var base = { schemaVersion: literal(1) };
15610
15986
  var revisions = {
15611
- expectedRevision: revision.optional(),
15612
- expectedWorkspaceRevision: revision.optional()
15987
+ expectedRevision: optional(revision),
15988
+ expectedWorkspaceRevision: optional(revision)
15613
15989
  };
15614
15990
  var taskId = { taskId: id };
15615
- var operation = (shape) => object({ ...base, ...shape }).strict();
15991
+ var operation = (shape) => strictObject({ ...base, ...shape });
15616
15992
  var taskOperations = {
15617
15993
  start: operation({
15618
15994
  action: literal("start"),
15619
- expectedWorkspaceRevision: revision.nullable().optional(),
15995
+ expectedWorkspaceRevision: optional(nullable(revision)),
15620
15996
  intent: intentSchema
15621
15997
  }),
15622
15998
  list: operation({
15623
15999
  action: literal("list"),
15624
- status: _enum(["open", "closed", "all"]).optional(),
15625
- query: string2().trim().min(1).max(200).optional(),
15626
- limit: number2().int().min(1).max(50).optional()
16000
+ status: optional(_enum(["open", "closed", "all"])),
16001
+ query: optional(string2().check(_trim()).check(_minLength(1)).check(_maxLength(200))),
16002
+ limit: optional(number2().check(int()).check(_gte(1)).check(_lte(50)))
15627
16003
  }),
15628
16004
  inspect: operation({
15629
16005
  action: literal("inspect"),
15630
16006
  ...taskId,
15631
- view: _enum(["summary", "full"]).optional()
16007
+ view: optional(_enum(["summary", "full"]))
15632
16008
  }),
15633
16009
  revise: operation({
15634
16010
  action: literal("revise"),
15635
16011
  ...taskId,
15636
16012
  ...revisions,
15637
- expectedWorkspaceRevision: revision.optional(),
16013
+ expectedWorkspaceRevision: optional(revision),
15638
16014
  intent: intentSchema,
15639
16015
  reason: text
15640
16016
  }),
15641
16017
  progress: operation({
15642
16018
  action: literal("progress"),
15643
16019
  ...taskId,
15644
- expectedRevision: revision.optional(),
16020
+ expectedRevision: optional(revision),
15645
16021
  progress: progressSchema
15646
16022
  }),
15647
16023
  pause: operation({
15648
16024
  action: literal("pause"),
15649
16025
  ...taskId,
15650
16026
  ...revisions,
15651
- expectedWorkspaceRevision: revision.optional(),
16027
+ expectedWorkspaceRevision: optional(revision),
15652
16028
  reason: text
15653
16029
  }),
15654
16030
  resume: operation({
15655
16031
  action: literal("resume"),
15656
16032
  ...taskId,
15657
16033
  ...revisions,
15658
- expectedWorkspaceRevision: revision.optional()
16034
+ expectedWorkspaceRevision: optional(revision)
15659
16035
  }),
15660
16036
  close: operation({
15661
16037
  action: literal("close"),
15662
16038
  ...taskId,
15663
16039
  ...revisions,
15664
- expectedWorkspaceRevision: revision.optional(),
16040
+ expectedWorkspaceRevision: optional(revision),
15665
16041
  outcome: outcomeSchema,
15666
16042
  summary: text,
15667
- decisionIds: array(id).optional()
16043
+ decisionIds: optional(array(id))
15668
16044
  })
15669
16045
  };
15670
16046
  var rawJudgment = record(string2(), unknown());
@@ -15672,7 +16048,7 @@ var policyOperations = {
15672
16048
  assess: operation({
15673
16049
  action: literal("assess"),
15674
16050
  ...taskId,
15675
- expectedRevision: revision.optional(),
16051
+ expectedRevision: optional(revision),
15676
16052
  judgment: rawJudgment
15677
16053
  }),
15678
16054
  preview: operation({ action: literal("preview"), ...taskId, judgment: rawJudgment }),
@@ -15682,7 +16058,7 @@ var evidenceOperations = {
15682
16058
  record: operation({
15683
16059
  action: literal("record"),
15684
16060
  ...taskId,
15685
- expectedRevision: revision.optional(),
16061
+ expectedRevision: optional(revision),
15686
16062
  evidence: reportedEvidenceSchema
15687
16063
  })
15688
16064
  };
@@ -15690,17 +16066,17 @@ var findingOperations = {
15690
16066
  record: operation({
15691
16067
  action: literal("record"),
15692
16068
  ...taskId,
15693
- expectedRevision: revision.optional(),
16069
+ expectedRevision: optional(revision),
15694
16070
  claim: text,
15695
16071
  consequence: text,
15696
16072
  scope: scopeSchema,
15697
- candidateId: nullableDigest.optional(),
16073
+ candidateId: optional(nullableDigest),
15698
16074
  refs: array(refSchema)
15699
16075
  }),
15700
16076
  resolve: operation({
15701
16077
  action: literal("resolve"),
15702
16078
  ...taskId,
15703
- expectedRevision: revision.optional(),
16079
+ expectedRevision: optional(revision),
15704
16080
  findingId: idRef,
15705
16081
  disposition: _enum(["open", "fixed", "dismissed", "deferred"]),
15706
16082
  reason: text,
@@ -15712,11 +16088,11 @@ var decisionOperations = {
15712
16088
  record: operation({
15713
16089
  action: literal("record"),
15714
16090
  ...taskId,
15715
- expectedRevision: revision.optional(),
16091
+ expectedRevision: optional(revision),
15716
16092
  purpose: decisionSchema.shape.purpose,
15717
- binding: decisionSchema.shape.binding.extend({
15718
- taskId: id.optional(),
15719
- workspaceId: id.optional()
16093
+ binding: extend2(decisionSchema.shape.binding, {
16094
+ taskId: optional(id),
16095
+ workspaceId: optional(id)
15720
16096
  }),
15721
16097
  response: decisionSchema.shape.response,
15722
16098
  requirementIds: array(digest)
@@ -15724,7 +16100,7 @@ var decisionOperations = {
15724
16100
  revoke: operation({
15725
16101
  action: literal("revoke"),
15726
16102
  ...taskId,
15727
- expectedRevision: revision.optional(),
16103
+ expectedRevision: optional(revision),
15728
16104
  decisionId: id,
15729
16105
  reason: text
15730
16106
  })
@@ -15734,14 +16110,14 @@ var workerOperations = {
15734
16110
  action: literal("assign"),
15735
16111
  ...taskId,
15736
16112
  ...revisions,
15737
- expectedWorkspaceRevision: revision.optional(),
16113
+ expectedWorkspaceRevision: optional(revision),
15738
16114
  assignment: assignmentSchema
15739
16115
  }),
15740
16116
  report: operation({
15741
16117
  action: literal("report"),
15742
16118
  ...taskId,
15743
- expectedRevision: revision.optional(),
15744
- expectedWorkspaceRevision: revision.optional(),
16119
+ expectedRevision: optional(revision),
16120
+ expectedWorkspaceRevision: optional(revision),
15745
16121
  workerId: idRef,
15746
16122
  report: workerReportSchema
15747
16123
  }),
@@ -15749,7 +16125,7 @@ var workerOperations = {
15749
16125
  action: literal("cancel"),
15750
16126
  ...taskId,
15751
16127
  ...revisions,
15752
- expectedWorkspaceRevision: revision.optional(),
16128
+ expectedWorkspaceRevision: optional(revision),
15753
16129
  workerId: idRef,
15754
16130
  reason: text
15755
16131
  })
@@ -15758,7 +16134,7 @@ var stateOperations = {
15758
16134
  export: operation({ action: literal("export"), ...taskId }),
15759
16135
  import: operation({
15760
16136
  action: literal("import"),
15761
- expectedWorkspaceRevision: revision.nullable().optional(),
16137
+ expectedWorkspaceRevision: optional(nullable(revision)),
15762
16138
  bundle: exportBundleSchema
15763
16139
  })
15764
16140
  };
@@ -15780,7 +16156,7 @@ var OPERATION_ACTIONS = {
15780
16156
  worker: Object.keys(workerOperations),
15781
16157
  state: Object.keys(stateOperations)
15782
16158
  };
15783
- var withImplicitTask = (options) => Object.values(options).map((option) => ("taskId" in option.shape) ? option.extend({ taskId: id.optional() }) : option);
16159
+ var withImplicitTask = (options) => Object.values(options).map((option) => ("taskId" in option.shape) ? extend2(option, { taskId: optional(id) }) : option);
15784
16160
  var advertised = (options) => discriminatedUnion("action", withImplicitTask(options));
15785
16161
  var advertisedOperationSchemas = {
15786
16162
  task: advertised(taskOperations),
@@ -15791,24 +16167,6 @@ var advertisedOperationSchemas = {
15791
16167
  worker: advertised(workerOperations),
15792
16168
  state: advertised(stateOperations)
15793
16169
  };
15794
- var success = (revisionValue, workspaceRevisionValue, data) => ({
15795
- ok: true,
15796
- schemaVersion: 1,
15797
- revision: revisionValue,
15798
- workspaceRevision: workspaceRevisionValue,
15799
- data
15800
- });
15801
- var failure2 = (code, error, details = {}) => ({ ok: false, schemaVersion: 1, code, error, details });
15802
- function resolveIdRef(kind, ref, ids) {
15803
- if (ids.includes(ref))
15804
- return success(null, null, ref);
15805
- const matches = ids.filter((candidate) => candidate.startsWith(ref));
15806
- if (matches.length === 1)
15807
- return success(null, null, matches[0]);
15808
- if (matches.length === 0)
15809
- return failure2("not_found", `${kind} not found`);
15810
- return failure2("invalid_input", `${kind} prefix ${ref} is ambiguous; candidates: ${matches.join(", ")}`);
15811
- }
15812
16170
  function parseOperation(family, input) {
15813
16171
  if (typeof input === "object" && input !== null && "schemaVersion" in input && input.schemaVersion !== SCHEMA_VERSION)
15814
16172
  return failure2("unsupported_version", "unsupported schema version", { operation: family });
@@ -15821,94 +16179,6 @@ function parseOperation(family, input) {
15821
16179
  }));
15822
16180
  return failure2("invalid_input", "operation input is invalid", { fields });
15823
16181
  }
15824
- function canonical(value, seen) {
15825
- if (value === null || typeof value === "boolean" || typeof value === "string") {
15826
- if (typeof value === "string" && invalidUnicode(value))
15827
- throw new TypeError("invalid Unicode");
15828
- return value;
15829
- }
15830
- if (typeof value === "number") {
15831
- if (!Number.isSafeInteger(value))
15832
- throw new TypeError("number must be a finite safe integer");
15833
- return value;
15834
- }
15835
- if (typeof value !== "object")
15836
- throw new TypeError("value is not JSON serializable");
15837
- if (seen.has(value))
15838
- throw new TypeError("cyclic value");
15839
- seen.add(value);
15840
- let result;
15841
- if (Array.isArray(value)) {
15842
- for (let index = 0;index < value.length; index += 1) {
15843
- if (!(index in value))
15844
- throw new TypeError("sparse array");
15845
- }
15846
- result = value.map((item) => canonical(item, seen));
15847
- } else {
15848
- if (Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null)
15849
- throw new TypeError("value is not a JSON object");
15850
- if (Reflect.ownKeys(value).some((key) => typeof key !== "string"))
15851
- throw new TypeError("symbol key is not JSON");
15852
- if (Object.keys(value).some((key) => invalidUnicode(key)))
15853
- throw new TypeError("invalid Unicode");
15854
- result = Object.fromEntries(Object.keys(value).toSorted().map((key) => [key, canonical(value[key], seen)]));
15855
- }
15856
- seen.delete(value);
15857
- return result;
15858
- }
15859
- function canonicalJson(value) {
15860
- return JSON.stringify(canonical(value, new Set));
15861
- }
15862
- function sha256(value) {
15863
- if (typeof value === "string" && invalidUnicode(value))
15864
- throw new TypeError("invalid Unicode");
15865
- return createHash("sha256").update(typeof value === "string" ? value : canonicalJson(value), "utf8").digest("hex");
15866
- }
15867
- function newId() {
15868
- return randomUUID().toLowerCase();
15869
- }
15870
- function newRevision() {
15871
- return randomUUID().toLowerCase();
15872
- }
15873
- var compareCodeUnits = (left, right) => {
15874
- const length = Math.min(left.length, right.length);
15875
- for (let index = 0;index < length; index += 1) {
15876
- const difference = left.charCodeAt(index) - right.charCodeAt(index);
15877
- if (difference !== 0)
15878
- return difference;
15879
- }
15880
- return left.length - right.length;
15881
- };
15882
- var compareNullableText = (left, right) => left === right ? 0 : left === null ? -1 : right === null ? 1 : compareCodeUnits(left, right);
15883
- var compareBooleanNullable = (left, right) => left === right ? 0 : left === null ? -1 : right === null ? 1 : Number(left) - Number(right);
15884
- function decisionDigest(input) {
15885
- const { digest: _ignored, revoked: _revoked, ...value } = input;
15886
- return sha256(value);
15887
- }
15888
- function candidateDigest(input) {
15889
- const normalizedScope = {
15890
- description: input.scope.description,
15891
- paths: [...input.scope.paths].toSorted(compareCodeUnits),
15892
- exclusions: [...input.scope.exclusions].toSorted(compareCodeUnits)
15893
- };
15894
- return sha256({
15895
- scope: normalizedScope,
15896
- completeness: input.completeness,
15897
- files: [...input.files].toSorted((left, right) => compareCodeUnits(left.path, right.path) || compareCodeUnits(left.kind, right.kind) || compareNullableText(left.digest, right.digest) || compareBooleanNullable(left.executable, right.executable)),
15898
- environment: input.environment.map(({ name, value }) => ({ name, value })).toSorted((left, right) => compareCodeUnits(left.name, right.name) || compareNullableText(left.value, right.value)),
15899
- head: input.head
15900
- });
15901
- }
15902
- function requirementId(input) {
15903
- return sha256({
15904
- ...input,
15905
- scope: {
15906
- description: input.scope.description,
15907
- paths: [...input.scope.paths].toSorted(compareCodeUnits),
15908
- exclusions: [...input.scope.exclusions].toSorted(compareCodeUnits)
15909
- }
15910
- });
15911
- }
15912
16182
  // packages/workit-core/src/core/operation-input.ts
15913
16183
  var str = (d, values) => ({
15914
16184
  type: "string",
@@ -15917,7 +16187,7 @@ var str = (d, values) => ({
15917
16187
  });
15918
16188
  var list = (d) => ({ type: "array", ...d ? { d } : {} });
15919
16189
  var bool = (d) => ({ type: "boolean", ...d ? { d } : {} });
15920
- var int2 = (d) => ({ type: "integer", ...d ? { d } : {} });
16190
+ var int3 = (d) => ({ type: "integer", ...d ? { d } : {} });
15921
16191
  var scopeFields = {
15922
16192
  paths: list("Scope paths (default: whole checkout)."),
15923
16193
  exclusions: list(),
@@ -15938,7 +16208,7 @@ var FLAT = {
15938
16208
  decisionIds: list(),
15939
16209
  status: str(undefined, ["open", "closed", "all"]),
15940
16210
  query: str(),
15941
- limit: int2(),
16211
+ limit: int3(),
15942
16212
  view: str(undefined, ["summary", "full"])
15943
16213
  }
15944
16214
  },
@@ -15958,7 +16228,7 @@ var FLAT = {
15958
16228
  claim: str(),
15959
16229
  result: str(undefined, ["passed", "failed", "missing", "skipped"]),
15960
16230
  summary: str(),
15961
- exitCode: int2(),
16231
+ exitCode: int3(),
15962
16232
  refs,
15963
16233
  requirementIds: list(),
15964
16234
  candidateId: str(),
@@ -16307,7 +16577,7 @@ var FLAT_NAME = {
16307
16577
  };
16308
16578
  var NOT_FLAT = new Set(["schemaVersion", "action", "workspaceId"]);
16309
16579
  function actionKeys(family, action) {
16310
- const options = advertisedOperationSchemas[family].options;
16580
+ const options = advertisedOperationSchemas[family]._zod.def.options;
16311
16581
  const option = options.find((item) => {
16312
16582
  const literal = defOf(item).shape?.action;
16313
16583
  return literal._zod.def.values.includes(action);
@@ -17839,59 +18109,57 @@ var checkoutRemotes = (cwd) => {
17839
18109
  };
17840
18110
 
17841
18111
  // packages/workit-core/src/core/workspaces.ts
17842
- var nonBlank = string2().refine((value) => value.trim().length > 0, "must not be blank");
18112
+ var nonBlank = string2().check(refine((value) => value.trim().length > 0, "must not be blank"));
17843
18113
  var branchPreset = custom((value) => typeof value === "string" && Object.hasOwn(PRESETS, value), "unsupported branch preset");
17844
18114
  var commitPreset = custom((value) => typeof value === "string" && COMMIT_PRESETS.includes(value), "unsupported commit preset");
17845
- var workspaceBranchPolicySchema = object({
17846
- preset: branchPreset.describe("The branch model: gitflow, github-flow, trunk-based or custom (allowed/protected set by hand)."),
17847
- developBranch: nonBlank.optional().describe("The integration branch gitflow uses (default develop)."),
17848
- prefixes: object({
18115
+ var workspaceBranchPolicySchema = strictObject({
18116
+ preset: described(branchPreset, "The branch model: gitflow, github-flow, trunk-based or custom (allowed/protected set by hand)."),
18117
+ developBranch: described(optional(nonBlank), "The integration branch gitflow uses (default develop)."),
18118
+ prefixes: described(optional(looseObject({
17849
18119
  feature: nonBlank,
17850
18120
  bugfix: nonBlank,
17851
18121
  release: nonBlank,
17852
18122
  hotfix: nonBlank
17853
- }).passthrough().optional().describe("The branch prefix per kind (feature/, bugfix/, release/, hotfix/)."),
17854
- allowed: array(nonBlank).optional().describe("Branch name globs a new branch must match (`feature/*`)."),
17855
- protected: array(nonBlank).optional().describe("Branches nobody commits or pushes to directly."),
17856
- integration: _enum(["pr", "merge"]).optional().describe("How work reaches its base: `pr` (default) opens a PR, `merge` merges locally.")
17857
- }).strict();
17858
- var workspaceCommitPolicySchema = object({
17859
- preset: commitPreset.describe("The commit message flavor, e.g. conventional."),
17860
- pattern: string2().optional().describe("A regular expression every commit subject must match.")
17861
- }).strict();
17862
- var workspaceProfileSchema = object({
17863
- branchPolicy: workspaceBranchPolicySchema.optional().describe("This profile's branch policy."),
17864
- commitPolicy: workspaceCommitPolicySchema.optional().describe("This profile's commit policy.")
17865
- }).strict().refine((profile) => profile.branchPolicy !== undefined || profile.commitPolicy !== undefined, {
17866
- message: "a profile must define branchPolicy or commitPolicy"
17867
- });
18123
+ })), "The branch prefix per kind (feature/, bugfix/, release/, hotfix/)."),
18124
+ allowed: described(optional(array(nonBlank)), "Branch name globs a new branch must match (`feature/*`)."),
18125
+ protected: described(optional(array(nonBlank)), "Branches nobody commits or pushes to directly."),
18126
+ integration: described(optional(_enum(["pr", "merge"])), "How work reaches its base: `pr` (default) opens a PR, `merge` merges locally.")
18127
+ });
18128
+ var workspaceCommitPolicySchema = strictObject({
18129
+ preset: described(commitPreset, "The commit message flavor, e.g. conventional."),
18130
+ pattern: described(optional(string2()), "A regular expression every commit subject must match.")
18131
+ });
18132
+ var workspaceProfileSchema = strictObject({
18133
+ branchPolicy: described(optional(workspaceBranchPolicySchema), "This profile's branch policy."),
18134
+ commitPolicy: described(optional(workspaceCommitPolicySchema), "This profile's commit policy.")
18135
+ }).check(refine((profile) => profile.branchPolicy !== undefined || profile.commitPolicy !== undefined, { message: "a profile must define branchPolicy or commitPolicy" }));
17868
18136
  var versionSourceSchema = discriminatedUnion("kind", [
17869
- object({
18137
+ strictObject({
17870
18138
  kind: literal("package-json"),
17871
18139
  path: nonBlank,
17872
18140
  field: nonBlank
17873
- }).strict(),
17874
- object({ kind: literal("git-tag") }).strict(),
17875
- object({ kind: literal("manual") }).strict()
18141
+ }),
18142
+ strictObject({ kind: literal("git-tag") }),
18143
+ strictObject({ kind: literal("manual") })
17876
18144
  ]);
17877
- var releaseTrackSchema = object({
17878
- strategy: branchPreset.optional().describe("The branch model this track follows."),
17879
- productionBranch: nonBlank.describe("The branch releases land on (main)."),
17880
- integrationBranch: nonBlank.describe("The branch work integrates into (develop)."),
17881
- naming: object({
17882
- feature: nonBlank.optional(),
17883
- release: nonBlank.optional(),
17884
- hotfix: nonBlank.optional()
17885
- }).passthrough().optional().describe("Branch name templates per kind, e.g. `feature/{name}`."),
17886
- baseBranch: nonBlank.optional().describe("The branch new work starts from."),
17887
- mergeBackBranches: array(nonBlank).optional().describe("Branches a finished release or hotfix is merged back into."),
17888
- pullRequestTarget: nonBlank.optional().describe("The branch PRs target."),
17889
- tagNamespace: string2().optional().describe("A prefix for this track's release tags."),
17890
- versionSource: versionSourceSchema.optional().describe("Where the version comes from: package-json, git-tag or manual."),
17891
- requiredChecks: array(nonBlank).optional().describe("CI checks that must pass before a release."),
17892
- critical: array(nonBlank).optional().describe("Fields an older Workit must not ignore: when one is unknown or malformed, Workit fails closed."),
17893
- releaseNotes: unknown().optional().describe("This track's release notes mode, over the workspace's `releaseNotes`.")
17894
- }).passthrough().superRefine((track, context) => {
18145
+ var releaseTrackSchema = looseObject({
18146
+ strategy: described(optional(branchPreset), "The branch model this track follows."),
18147
+ productionBranch: described(nonBlank, "The branch releases land on (main)."),
18148
+ integrationBranch: described(nonBlank, "The branch work integrates into (develop)."),
18149
+ naming: described(optional(looseObject({
18150
+ feature: optional(nonBlank),
18151
+ release: optional(nonBlank),
18152
+ hotfix: optional(nonBlank)
18153
+ })), "Branch name templates per kind, e.g. `feature/{name}`."),
18154
+ baseBranch: described(optional(nonBlank), "The branch new work starts from."),
18155
+ mergeBackBranches: described(optional(array(nonBlank)), "Branches a finished release or hotfix is merged back into."),
18156
+ pullRequestTarget: described(optional(nonBlank), "The branch PRs target."),
18157
+ tagNamespace: described(optional(string2()), "A prefix for this track's release tags."),
18158
+ versionSource: described(optional(versionSourceSchema), "Where the version comes from: package-json, git-tag or manual."),
18159
+ requiredChecks: described(optional(array(nonBlank)), "CI checks that must pass before a release."),
18160
+ critical: described(optional(array(nonBlank)), "Fields an older Workit must not ignore: when one is unknown or malformed, Workit fails closed."),
18161
+ releaseNotes: described(optional(unknown()), "This track's release notes mode, over the workspace's `releaseNotes`.")
18162
+ }).check(superRefine((track, context) => {
17895
18163
  for (const [field, values] of [
17896
18164
  ["mergeBackBranches", track.mergeBackBranches ?? []],
17897
18165
  ["requiredChecks", track.requiredChecks ?? []]
@@ -17911,67 +18179,68 @@ var releaseTrackSchema = object({
17911
18179
  message: "must stay inside the repository"
17912
18180
  });
17913
18181
  }
17914
- });
17915
- var modelRoles = unknown().optional().describe("Per role (decider, implementer, verifier, reviewer, explore, babysit, default for a general-purpose spawn): a model name, `{ model, effort }`, or one of those per host (claude_code, opencode, codex, codex_cli, codex_desktop, cursor, pi, default). The implementer takes one per tier (mundane, standard, hard).");
17916
- var workspaceConfigSchema = object({
17917
- name: nonBlank.describe("The workspace's unique name."),
17918
- glob: nonBlank.describe("The directories this entry covers, an absolute path glob with * and ** (`/home/you/work/**`); the narrowest match wins."),
17919
- vcs: object({
17920
- provider: _enum(["gitlab", "github"]).describe("The forge: github or gitlab."),
17921
- defaultTargetBranch: nonBlank.optional().describe("The branch PRs target by default."),
17922
- tokenFile: nonBlank.optional().describe("A file holding the forge token for this workspace."),
17923
- account: nonBlank.optional().describe("The forge login delivery runs as; grants need it to reach the forge."),
17924
- host: unknown().optional().describe("A self-hosted forge's host name.")
17925
- }).passthrough().optional().describe("The forge this workspace's repositories live on."),
17926
- autoApprove: union([boolean2(), array(nonBlank)]).optional().describe("Legacy (≤4.x) standing approvals, read once as autonomy grants; use `autonomy`."),
17927
- defaultEndpoint: unknown().optional().describe("Where an unnamed request stops: commit (default), pr, green or merged. Set with `workit grant set`, like grants."),
17928
- verification: _enum(["proportional", "self", "independent"]).optional().describe("How a normal-risk behavior change is verified: proportional (default), self or independent. Set with `workit grant set`, like grants."),
17929
- delegation: unknown().optional().describe("Who does the work: `inline-first` (default) keeps the lead working itself and refuses a slice without a reason to delegate; `lead-orchestrates` allows slices without one."),
17930
- changelog: unknown().optional().describe("The Keep a Changelog step before a PR opens: `off` (default), `update` (an existing CHANGELOG.md needs an Unreleased entry from a user-facing PR) or `create` (the entry is required, creating the file). `workit pr create` enforces it."),
17931
- docs: unknown().optional().describe("The docs refresh the ship skill does before a PR opens: `off` (default) or `when-user-facing`."),
17932
- changelogPath: unknown().optional().describe("Where the changelog lives, repo-relative: one path or glob, or a list (a monorepo with one changelog per package; any of them satisfies the gate). Default CHANGELOG.md at the repo root."),
17933
- prTemplate: unknown().optional().describe("Which template a PR description fills: `auto` (default: the repo's GitHub/GitLab template, else Workit's), `repo` (the repo's, refused when it has none), `workit` (Workit's Summary/Evidence/Merge danger) or a repo-relative path to one `.md` file."),
17934
- releaseNotes: unknown().optional().describe("The release notes `workit release finish` publishes on the forge release: `auto` (default: the draft when there is one, else the notes built from the version's changelog section), `off` (no forge release) or `review` (finish refuses until `workit release notes approve`). A release track overrides it."),
17935
- trailers: boolean2().optional().describe("Whether commits get the `Workit-Session:` trailer (default true). With false, authorship lives in the ledger only."),
17936
- deleteBranch: boolean2().optional().describe("Whether `workit pr merge` deletes the head branch after a merge (default true); `--keep-branch` opts out for one merge."),
17937
- cleanup: unknown().optional().describe("What happens when work finishes: `auto` (default) removes the delivered branch's clean Workit worktree and local branch, switches a clean checkout on it back to the trunk, and stops the processes registered inside them; `keep` removes and stops nothing. A value Workit does not know reads as `keep`."),
17938
- feedback: unknown().optional().describe('`workit feedback` for this workspace: `off` hides its contract line and makes the verb refuse; `{ "account": "<login>" }` names the GitHub login it posts with; workspaces inside this one inherit it.'),
17939
- liveSessionGuard: boolean2().optional().describe("Whether the live-session guard denies edits in a checkout another live agent session owns (default true)."),
17940
- fanout: object({
17941
- tierModels: unknown().optional().describe("The model per slice TIER (mundane, standard, hard), as one name or per host."),
17942
- deps: unknown().optional().describe("How `workit fanout worktree create` gives a slice worktree node_modules: `install` (default: its own frozen install of its lockfile) or `link` (links into the main checkout's installed packages, for a repo too slow to install per slice). `--deps` overrides it."),
17943
- installTimeout: unknown().optional().describe("How long the own install may run before its process tree is killed and the worktree is linked instead: a duration such as `90s` or `10m` (default `5m`). `--install-timeout` overrides it.")
17944
- }).passthrough().optional().describe("Fanout settings."),
17945
- models: object({ roles: modelRoles }).passthrough().optional().describe("Model and effort per role and host (roles), the lead's own advisory model (lead), how a role model applies (enforce: advise, the default, or strict) and, under strict, whether a model the lead names on a spawn wins (allowLeadOverride, default false); the same key at the top of workspaces.json is the global default."),
17946
- resources: unknown().optional().describe("Heavy-check limits on this machine: slots, scope, heavy, light, memoryMax, cpuQuota, wait."),
17947
- remotes: array(nonBlank.refine((pattern) => remotePattern(pattern) !== null, "is not a remote URL (https://host/owner/repo, git@host:owner/repo, a path, or owner/*)")).optional().describe("Remote URLs this entry owns: a checkout pushing to or opening PRs on one never exceeds this entry's grants, wherever the folder is (`owner/*` claims a whole owner). Only the user changes it, in their own terminal."),
17948
- externalRepos: array(nonBlank.regex(/^[\w-]+(?:\/\w[\w.-]*)*\/(?:\w[\w.-]*|\*)$/u, "is owner/name, group/project or owner/* on the checkout's forge host, without the host")).optional().describe("Repositories outside this workspace's own forge owners that `workit issue create|comment|close --repo` may write to: `owner/name`, or `owner/*` for a whole owner. Only the user changes it, in their own terminal."),
17949
- autonomy: object(Object.fromEntries(["push", "pr", "merge", "release", "rerun"].map((kind) => [
18182
+ }));
18183
+ var modelRoles = described(optional(unknown()), "Per role (decider, implementer, verifier, reviewer, explore, babysit, default for a general-purpose spawn): a model name, `{ model, effort }`, or one of those per host (claude_code, opencode, codex, codex_cli, codex_desktop, cursor, pi, default). The implementer takes one per tier (mundane, standard, hard).");
18184
+ var workspaceConfigSchema = looseObject({
18185
+ name: described(nonBlank, "The workspace's unique name."),
18186
+ glob: described(nonBlank, "The directories this entry covers, an absolute path glob with * and ** (`/home/you/work/**`); the narrowest match wins."),
18187
+ vcs: described(optional(looseObject({
18188
+ provider: described(_enum(["gitlab", "github"]), "The forge: github or gitlab."),
18189
+ defaultTargetBranch: described(optional(nonBlank), "The branch PRs target by default."),
18190
+ tokenFile: described(optional(nonBlank), "A file holding the forge token for this workspace."),
18191
+ account: described(optional(nonBlank), "The forge login delivery runs as; grants need it to reach the forge."),
18192
+ host: described(optional(unknown()), "A self-hosted forge's host name.")
18193
+ })), "The forge this workspace's repositories live on."),
18194
+ autoApprove: described(optional(union([boolean2(), array(nonBlank)])), "Legacy (≤4.x) standing approvals, read once as autonomy grants; use `autonomy`."),
18195
+ defaultEndpoint: described(optional(unknown()), "Where an unnamed request stops: commit (default), pr, green or merged. Set with `workit grant set`, like grants."),
18196
+ verification: described(optional(_enum(["proportional", "self", "independent"])), "How a normal-risk behavior change is verified: proportional (default), self or independent. Set with `workit grant set`, like grants."),
18197
+ delegation: described(optional(unknown()), "Who does the work: `inline-first` (default) keeps the lead working itself and refuses a slice without a reason to delegate; `lead-orchestrates` allows slices without one."),
18198
+ changelog: described(optional(unknown()), "The Keep a Changelog step before a PR opens: `off` (default), `update` (an existing CHANGELOG.md needs an Unreleased entry from a user-facing PR) or `create` (the entry is required, creating the file). `workit pr create` enforces it."),
18199
+ docs: described(optional(unknown()), "The docs refresh the ship skill does before a PR opens: `off` (default) or `when-user-facing`."),
18200
+ changelogPath: described(optional(unknown()), "Where the changelog lives, repo-relative: one path or glob, or a list (a monorepo with one changelog per package; any of them satisfies the gate). Default CHANGELOG.md at the repo root."),
18201
+ prTemplate: described(optional(unknown()), "Which template a PR description fills: `auto` (default: the repo's GitHub/GitLab template, else Workit's), `repo` (the repo's, refused when it has none), `workit` (Workit's Summary/Evidence/Merge danger) or a repo-relative path to one `.md` file."),
18202
+ releaseNotes: described(optional(unknown()), "The release notes `workit release finish` publishes on the forge release: `auto` (default: the draft when there is one, else the notes built from the version's changelog section), `off` (no forge release) or `review` (finish refuses until `workit release notes approve`). A release track overrides it."),
18203
+ trailers: described(optional(boolean2()), "Whether commits get the `Workit-Session:` trailer (default true). With false, authorship lives in the ledger only."),
18204
+ deleteBranch: described(optional(boolean2()), "Whether `workit pr merge` deletes the head branch after a merge (default true); `--keep-branch` opts out for one merge."),
18205
+ cleanup: described(optional(unknown()), "What happens when work finishes: `auto` (default) removes the delivered branch's clean Workit worktree and local branch, switches a clean checkout on it back to the trunk, and stops the processes registered inside them; `keep` removes and stops nothing. A value Workit does not know reads as `keep`."),
18206
+ feedback: described(optional(unknown()), '`workit feedback` for this workspace: `off` hides its contract line and makes the verb refuse; `{ "account": "<login>" }` names the GitHub login it posts with; workspaces inside this one inherit it.'),
18207
+ liveSessionGuard: described(optional(boolean2()), "Whether the live-session guard denies edits in a checkout another live agent session owns (default true)."),
18208
+ fanout: described(optional(looseObject({
18209
+ tierModels: described(optional(unknown()), "The model per slice TIER (mundane, standard, hard), as one name or per host."),
18210
+ deps: described(optional(unknown()), "How `workit fanout worktree create` gives a slice worktree node_modules: `install` (default: its own frozen install of its lockfile) or `link` (links into the main checkout's installed packages, for a repo too slow to install per slice). `--deps` overrides it."),
18211
+ installTimeout: described(optional(unknown()), "How long the own install may run before its process tree is killed and the worktree is linked instead: a duration such as `90s` or `10m` (default `5m`). `--install-timeout` overrides it.")
18212
+ })), "Fanout settings."),
18213
+ models: described(optional(looseObject({ roles: modelRoles })), "Model and effort per role and host (roles), the lead's own advisory model (lead), how a role model applies (enforce: advise, the default, or strict) and, under strict, whether a model the lead names on a spawn wins (allowLeadOverride, default false); the same key at the top of workspaces.json is the global default."),
18214
+ resources: described(optional(unknown()), "Heavy-check limits on this machine: slots, scope, heavy, light, memoryMax, cpuQuota, wait."),
18215
+ remotes: described(optional(array(nonBlank.check(refine((pattern) => remotePattern(pattern) !== null, "is not a remote URL (https://host/owner/repo, git@host:owner/repo, a path, or owner/*)")))), "Remote URLs this entry owns: a checkout pushing to or opening PRs on one never exceeds this entry's grants, wherever the folder is (`owner/*` claims a whole owner). Only the user changes it, in their own terminal."),
18216
+ externalRepos: described(optional(array(nonBlank.check(_regex(/^[\w-]+(?:\/\w[\w.-]*)*\/(?:\w[\w.-]*|\*)$/u, "is owner/name, group/project or owner/* on the checkout's forge host, without the host")))), "Repositories outside this workspace's own forge owners that `workit issue create|comment|close --repo` may write to: `owner/name`, or `owner/*` for a whole owner. Only the user changes it, in their own terminal."),
18217
+ additiveRiskPaths: described(optional(array(nonBlank)), "Risk-path globs whose purely additive edits follow the review lane of the rest of the diff. Only the user sets it; it counts only while sealed."),
18218
+ autonomy: described(optional(looseObject(Object.fromEntries(["push", "pr", "merge", "release", "rerun"].map((kind) => [
17950
18219
  kind,
17951
- union([boolean2(), literal("verified")]).optional().describe(`The ${kind} grant: true, false, or "verified" (only after a verdict).`)
17952
- ]))).passthrough().optional().describe("Autonomy grants (D15): only ever set here, by the user, with `workit grant set`."),
17953
- youtrack: object({
17954
- baseUrl: nonBlank.optional().describe("This workspace's YouTrack URL."),
17955
- link_issues: boolean2().optional().describe("Legacy alias of `issues: { provider: youtrack, link: true }`."),
17956
- writes: _enum(["ask", "auto"]).optional().describe("ask (default): each workit youtrack write waits for the user's yes. auto: posts without asking, behind WORKIT_YT_WRITE=1."),
17957
- autoHosts: array(nonBlank).optional().describe("With writes auto: the only YouTrack hosts (`acme.youtrack.cloud`) a write may reach without asking. A raw ytrack write must name one with --host; a write elsewhere asks. Only the user widens it, in their own terminal (`workit workspace seal`).")
17958
- }).passthrough().optional().describe("YouTrack settings for this workspace."),
17959
- issues: object({
17960
- provider: _enum(["github", "gitlab", "youtrack"]).optional().describe("The issue tracker PRs link to."),
17961
- link: boolean2().optional().describe("Derive the issue from the branch name."),
17962
- relation: unknown().optional().describe("How a PR names its issue: `closes` (default) or `refs`."),
17963
- backlink: boolean2().optional().describe("Post the PR URL on each linked issue after the PR is opened."),
17964
- link_on_pr: boolean2().optional().describe("Legacy alias of `link`."),
17965
- repo: unknown().optional().describe("The GitHub/GitLab repository (owner/name) that holds the issues; default the PR's own."),
17966
- host: unknown().optional().describe("That repository's host; default the PR's host, or the tracker's public one.")
17967
- }).passthrough().optional().describe("The issue tracker PRs link to (any forge with any tracker)."),
17968
- branchPolicy: workspaceBranchPolicySchema.optional().describe("Which branches may be created and which are protected."),
17969
- commitPolicy: workspaceCommitPolicySchema.optional().describe("The commit message rules."),
17970
- defaultProfile: nonBlank.optional().describe("The profile used when none is named; must be a key of `profiles`."),
17971
- profiles: record(nonBlank, workspaceProfileSchema).optional().describe("Named branch/commit policy variants of this workspace."),
17972
- releaseTracks: record(nonBlank, releaseTrackSchema).optional().describe("Named release tracks: production and integration branches, naming and versioning."),
17973
- releasePackages: unknown().optional().describe("Packages released from this repository's own release line under their own tag namespace (`pkg-a@0.1.0`): keyed by package name, each `{ tagNamespace?, changelogPath? }` (default namespace `<name>@`). `workit release package <name> <version>` tags and publishes one.")
17974
- }).passthrough().superRefine((workspace, context) => {
18220
+ described(optional(union([boolean2(), literal("verified")])), `The ${kind} grant: true, false, or "verified" (only after a verdict).`)
18221
+ ])))), "Autonomy grants (D15): only ever set here, by the user, with `workit grant set`."),
18222
+ youtrack: described(optional(looseObject({
18223
+ baseUrl: described(optional(nonBlank), "This workspace's YouTrack URL."),
18224
+ link_issues: described(optional(boolean2()), "Legacy alias of `issues: { provider: youtrack, link: true }`."),
18225
+ writes: described(optional(_enum(["ask", "auto"])), "ask (default): each workit youtrack write waits for the user's yes. auto: posts without asking, behind WORKIT_YT_WRITE=1."),
18226
+ autoHosts: described(optional(array(nonBlank)), "With writes auto: the only YouTrack hosts (`acme.youtrack.cloud`) a write may reach without asking. A raw ytrack write must name one with --host; a write elsewhere asks. Only the user widens it, in their own terminal (`workit workspace seal`).")
18227
+ })), "YouTrack settings for this workspace."),
18228
+ issues: described(optional(looseObject({
18229
+ provider: described(optional(_enum(["github", "gitlab", "youtrack"])), "The issue tracker PRs link to."),
18230
+ link: described(optional(boolean2()), "Derive the issue from the branch name."),
18231
+ relation: described(optional(unknown()), "How a PR names its issue: `closes` (default) or `refs`."),
18232
+ backlink: described(optional(boolean2()), "Post the PR URL on each linked issue after the PR is opened."),
18233
+ link_on_pr: described(optional(boolean2()), "Legacy alias of `link`."),
18234
+ repo: described(optional(unknown()), "The GitHub/GitLab repository (owner/name) that holds the issues; default the PR's own."),
18235
+ host: described(optional(unknown()), "That repository's host; default the PR's host, or the tracker's public one.")
18236
+ })), "The issue tracker PRs link to (any forge with any tracker)."),
18237
+ branchPolicy: described(optional(workspaceBranchPolicySchema), "Which branches may be created and which are protected."),
18238
+ commitPolicy: described(optional(workspaceCommitPolicySchema), "The commit message rules."),
18239
+ defaultProfile: described(optional(nonBlank), "The profile used when none is named; must be a key of `profiles`."),
18240
+ profiles: described(optional(record(nonBlank, workspaceProfileSchema)), "Named branch/commit policy variants of this workspace."),
18241
+ releaseTracks: described(optional(record(nonBlank, releaseTrackSchema)), "Named release tracks: production and integration branches, naming and versioning."),
18242
+ releasePackages: described(optional(unknown()), "Packages released from this repository's own release line under their own tag namespace (`pkg-a@0.1.0`): keyed by package name, each `{ tagNamespace?, changelogPath? }` (default namespace `<name>@`). `workit release package <name> <version>` tags and publishes one.")
18243
+ }).check(superRefine((workspace, context) => {
17975
18244
  if (workspace.defaultProfile !== undefined && !Object.hasOwn(workspace.profiles ?? {}, workspace.defaultProfile)) {
17976
18245
  context.addIssue({
17977
18246
  code: "custom",
@@ -17979,14 +18248,14 @@ var workspaceConfigSchema = object({
17979
18248
  message: `does not name a configured profile`
17980
18249
  });
17981
18250
  }
17982
- });
17983
- var workspacesFileSchema = object({
17984
- workspaces: array(workspaceConfigSchema).optional().describe("Workspace entries, each mapping a path glob to its forge, policies and grants."),
17985
- models: object({ roles: modelRoles }).passthrough().optional().describe("The global default model and effort per role and host (roles), the lead's own advisory model (lead), how a role model applies (enforce: advise, the default, or strict) and, under strict, whether a model the lead names on a spawn wins (allowLeadOverride, default false)."),
17986
- feedback: object({
17987
- account: nonBlank.optional().describe("The GitHub login `workit feedback --post` uses when no workspace names one; never the workspace's work account by default.")
17988
- }).passthrough().optional().describe("`workit feedback` defaults for every workspace.")
17989
- }).passthrough().superRefine((file, context) => {
18251
+ }));
18252
+ var workspacesFileSchema = looseObject({
18253
+ workspaces: described(optional(array(workspaceConfigSchema)), "Workspace entries, each mapping a path glob to its forge, policies and grants."),
18254
+ models: described(optional(looseObject({ roles: modelRoles })), "The global default model and effort per role and host (roles), the lead's own advisory model (lead), how a role model applies (enforce: advise, the default, or strict) and, under strict, whether a model the lead names on a spawn wins (allowLeadOverride, default false)."),
18255
+ feedback: described(optional(looseObject({
18256
+ account: described(optional(nonBlank), "The GitHub login `workit feedback --post` uses when no workspace names one; never the workspace's work account by default.")
18257
+ })), "`workit feedback` defaults for every workspace.")
18258
+ }).check(superRefine((file, context) => {
17990
18259
  const names = new Set;
17991
18260
  for (const [index, workspace] of (file.workspaces ?? []).entries()) {
17992
18261
  if (names.has(workspace.name)) {
@@ -17998,7 +18267,7 @@ var workspacesFileSchema = object({
17998
18267
  }
17999
18268
  names.add(workspace.name);
18000
18269
  }
18001
- });
18270
+ }));
18002
18271
  var workspacesRevision = (contents) => createHash4("sha256").update(contents ?? "<missing>").digest("hex");
18003
18272
  var validateWorkspacesDocument = (parsed, file) => {
18004
18273
  if (!isConfigObject(parsed)) {
@@ -18343,25 +18612,25 @@ var resolveWorkspaceFrom = (cwd, dir, workspaceName) => {
18343
18612
  };
18344
18613
  var runtimeWorkspacePolicySchema = (kind) => {
18345
18614
  const key = kind === "branch" ? "branchPolicy" : kind === "commit" ? "commitPolicy" : "vcs";
18346
- const policySchema = kind === "branch" ? workspaceBranchPolicySchema : kind === "commit" ? workspaceCommitPolicySchema : object({
18615
+ const policySchema = kind === "branch" ? workspaceBranchPolicySchema : kind === "commit" ? workspaceCommitPolicySchema : looseObject({
18347
18616
  provider: _enum(["gitlab", "github"]),
18348
- defaultTargetBranch: nonBlank.optional(),
18349
- account: nonBlank.optional()
18350
- }).passthrough();
18351
- const profileSchema = object({ [key]: policySchema.optional() }).passthrough();
18352
- const entrySchema = object({
18617
+ defaultTargetBranch: optional(nonBlank),
18618
+ account: optional(nonBlank)
18619
+ });
18620
+ const profileSchema = looseObject({ [key]: optional(policySchema) });
18621
+ const entrySchema = looseObject({
18353
18622
  name: nonBlank,
18354
18623
  glob: nonBlank,
18355
- [key]: policySchema.optional(),
18356
- defaultProfile: nonBlank.optional(),
18357
- profiles: record(nonBlank, profileSchema).optional()
18358
- }).passthrough();
18624
+ [key]: optional(policySchema),
18625
+ defaultProfile: optional(nonBlank),
18626
+ profiles: optional(record(nonBlank, profileSchema))
18627
+ });
18359
18628
  return entrySchema;
18360
18629
  };
18361
18630
  var resolveRuntimeWorkspaceVcs = (cwd) => resolveRuntimeWorkspaceCandidate(cwd, "vcs");
18362
- var runtimeWorkspaceIndexSchema = object({
18363
- workspaces: array(object({ name: nonBlank, glob: nonBlank }).passthrough()).optional()
18364
- }).passthrough();
18631
+ var runtimeWorkspaceIndexSchema = looseObject({
18632
+ workspaces: optional(array(looseObject({ name: nonBlank, glob: nonBlank })))
18633
+ });
18365
18634
  var matchRuntimeWorkspace = (cwd, dir = configDir2()) => {
18366
18635
  const file = path7.join(dir, "workspaces.json");
18367
18636
  let raw;
@@ -20980,13 +21249,13 @@ var assetRoot = () => {
20980
21249
  import { spawnSync as spawnSync10 } from "node:child_process";
20981
21250
  import fs12 from "node:fs";
20982
21251
  import { hostname } from "node:os";
20983
- var metadataLockSchema = object({
20984
- pid: number2().int().nonnegative().safe(),
20985
- processStart: string2().nullable(),
20986
- host: string2().min(1),
20987
- nonce: string2().min(1),
20988
- externalAction: literal(true).optional()
20989
- }).strict();
21252
+ var metadataLockSchema = strictObject({
21253
+ pid: number2().check(int(), _nonnegative(), int()),
21254
+ processStart: nullable(string2()),
21255
+ host: string2().check(_minLength(1)),
21256
+ nonce: string2().check(_minLength(1)),
21257
+ externalAction: optional(literal(true))
21258
+ });
20990
21259
  var FOREIGN_LOCK_TTL_MS = 10 * 60000;
20991
21260
  var UNREADABLE_LOCK_TTL_MS = 30000;
20992
21261
  var RECLAIM_GUARD_TTL_MS = 30000;
@@ -24490,6 +24759,7 @@ var WORD2 = /[\w./:@=+,-]+/uy;
24490
24759
  var QUOTED = /"[^"$`\\]*"/uy;
24491
24760
  var COMMAND = /^[\w.+][\w./+-]*$/u;
24492
24761
  var SHELL_STATE = new Set(". alias bg bind break builtin call caller case cd command compgen complete compopt continue coproc declare dirs disown do done elif else enable esac eval exec exit export fc fg fi for function getopts goto hash help history if in jobs kill let local logout mapfile popd pushd read readarray readonly return select set shift shopt source suspend then time times trap type typeset ulimit umask unalias unset until wait while".split(" "));
24762
+ var EFFECTFUL = /^(?:curl|wget|npx|bunx|gh|dlx|push|publish|deploy)$/iu;
24493
24763
  var FALLBACK = new Set(["echo", "true"]);
24494
24764
  var FORM = 'more than && <command> or && (<command> || echo "<text>")';
24495
24765
  var OUTSIDE = '(outside plain words and "double-quoted text")';
@@ -24550,9 +24820,11 @@ function masking(before, appended) {
24550
24820
  return FORM;
24551
24821
  if (names ? !names.has(name.word) : SHELL_STATE.has(name.word.toLowerCase()))
24552
24822
  return names ? FORM : `the shell command ${name.word}`;
24553
- index += 1;
24554
- for (let token = list[index];token && !("op" in token); token = list[index])
24823
+ for (let token = list[index];token && !("op" in token); token = list[index]) {
24824
+ if ("word" in token && EFFECTFUL.test(token.word))
24825
+ return `the effectful command ${token.word}`;
24555
24826
  index += 1;
24827
+ }
24556
24828
  return null;
24557
24829
  };
24558
24830
  while (index < list.length) {
@@ -27388,7 +27660,7 @@ import path24 from "node:path";
27388
27660
  var SEAL_FILE = "workspaces.json.seal";
27389
27661
  var SEAL_VERSION = 1;
27390
27662
  var SEAL_COMMAND = "workit workspace seal";
27391
- var pick2 = (value, keys) => {
27663
+ var pick3 = (value, keys) => {
27392
27664
  if (!value || typeof value !== "object" || Array.isArray(value))
27393
27665
  return;
27394
27666
  const out = Object.fromEntries(keys.flatMap((key) => {
@@ -27402,6 +27674,7 @@ var ENTRY_KEYS = [
27402
27674
  "glob",
27403
27675
  "remotes",
27404
27676
  "externalRepos",
27677
+ "additiveRiskPaths",
27405
27678
  "vcs",
27406
27679
  "autonomy",
27407
27680
  "autoApprove",
@@ -27411,11 +27684,11 @@ var ENTRY_KEYS = [
27411
27684
  ];
27412
27685
  var IDENTITY_KEYS = ["provider", "account", "tokenFile", "host"];
27413
27686
  var sealProjection = (entries) => entries.map((entry) => {
27414
- const all = pick2(entry, ENTRY_KEYS) ?? {};
27415
- return pick2({
27687
+ const all = pick3(entry, ENTRY_KEYS) ?? {};
27688
+ return pick3({
27416
27689
  ...all,
27417
- vcs: pick2(all.vcs, IDENTITY_KEYS),
27418
- youtrack: pick2(all.youtrack, ["writes", "autoHosts"])
27690
+ vcs: pick3(all.vcs, IDENTITY_KEYS),
27691
+ youtrack: pick3(all.youtrack, ["writes", "autoHosts"])
27419
27692
  }, ENTRY_KEYS);
27420
27693
  });
27421
27694
  var canonical4 = (value) => JSON.stringify(value, (_key, item) => item && typeof item === "object" && !Array.isArray(item) ? Object.fromEntries(Object.entries(item).toSorted(([a], [b]) => a < b ? -1 : a > b ? 1 : 0)) : item);
@@ -30851,8 +31124,8 @@ var fetchYouTrackIssueBody = async (issue, ytrack = ytrackRunner(process.env, yo
30851
31124
  };
30852
31125
 
30853
31126
  // packages/workit-core/src/core/context-read.ts
30854
- var contextReadSchema = object({
30855
- kind: _enum([
31127
+ var contextReadSchema = object2({
31128
+ kind: _enum2([
30856
31129
  "git",
30857
31130
  "pr",
30858
31131
  "youtrack",
@@ -30862,14 +31135,14 @@ var contextReadSchema = object({
30862
31135
  "release",
30863
31136
  "affected"
30864
31137
  ]),
30865
- range: string2().optional(),
30866
- issueId: string2().optional(),
30867
- issueUrl: string2().optional(),
30868
- issueRef: string2().optional(),
30869
- mode: string2().optional(),
30870
- specPath: string2().optional(),
30871
- planPath: string2().optional(),
30872
- cwd: string2().min(1).optional()
31138
+ range: string3().optional(),
31139
+ issueId: string3().optional(),
31140
+ issueUrl: string3().optional(),
31141
+ issueRef: string3().optional(),
31142
+ mode: string3().optional(),
31143
+ specPath: string3().optional(),
31144
+ planPath: string3().optional(),
31145
+ cwd: string3().min(1).optional()
30873
31146
  }).strict();
30874
31147
  var readExternalContext = async (root, payload) => {
30875
31148
  if (payload.range !== undefined && !isSafeContextRange(payload.range))
@@ -31024,7 +31297,7 @@ var SAME_CALL_FAILED = "Same call failed twice:";
31024
31297
  var MAX_SESSIONS = 256;
31025
31298
  var stable = (value) => JSON.stringify(value, (_key, entry) => entry && typeof entry === "object" && !Array.isArray(entry) ? Object.fromEntries(Object.entries(entry).toSorted(([a], [b]) => a.localeCompare(b))) : entry) ?? "null";
31026
31299
  var hashOf = (call) => createHash13("sha256").update(call).digest("hex").slice(0, 32);
31027
- var record3 = (memo, sessionId, call, failed, next) => {
31300
+ var record4 = (memo, sessionId, call, failed, next) => {
31028
31301
  const previous = memo.get(sessionId);
31029
31302
  memo.delete(sessionId);
31030
31303
  if (!failed)
@@ -31045,7 +31318,7 @@ var correctedPayload = (tool, result) => {
31045
31318
  };
31046
31319
  var escalateToolFailure = (memo, sessionId, tool, input, result) => {
31047
31320
  const failed = isFailure(result);
31048
- const line = record3(memo, sessionId, `tool\x00${tool}\x00${stable(input)}`, failed, failed ? correctedPayload(tool, result) : null);
31321
+ const line = record4(memo, sessionId, `tool\x00${tool}\x00${stable(input)}`, failed, failed ? correctedPayload(tool, result) : null);
31049
31322
  return line && failed ? { ...result, error: `${result.error}
31050
31323
  ${line}` } : result;
31051
31324
  };