@workit-dev/pi 2.23.1 → 2.23.2

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 (3) hide show
  1. package/dist/worker.js +1410 -1533
  2. package/dist/workit.js +1409 -1342
  3. package/package.json +1 -1
package/dist/worker.js CHANGED
@@ -45,14 +45,6 @@ function cleanRegex(source) {
45
45
  const end = source.endsWith("$") ? source.length - 1 : source.length;
46
46
  return source.slice(start, end);
47
47
  }
48
- function floatSafeRemainder(val, step) {
49
- const ratio = val / step;
50
- const roundedRatio = Math.round(ratio);
51
- const tolerance = 4 * Number.EPSILON * Math.max(Math.abs(ratio), 1);
52
- if (Math.abs(ratio - roundedRatio) < tolerance)
53
- return 0;
54
- return ratio - roundedRatio;
55
- }
56
48
  function assignProp(target, prop, value) {
57
49
  Object.defineProperty(target, prop, {
58
50
  value,
@@ -813,6 +805,7 @@ var _parse = (_Err) => {
813
805
  };
814
806
  return fn;
815
807
  };
808
+ var parse = /* @__PURE__ */ _parse($ZodRealError);
816
809
  var _parseAsync = (_Err) => {
817
810
  const fn = async (schema, value, _ctx, params) => {
818
811
  const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
@@ -828,6 +821,7 @@ var _parseAsync = (_Err) => {
828
821
  };
829
822
  return fn;
830
823
  };
824
+ var parseAsync = /* @__PURE__ */ _parseAsync($ZodRealError);
831
825
  var _safeParse = (_Err) => (schema, value, _ctx) => {
832
826
  const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
833
827
  const result = schema._zod.run({ value, issues: [] }, ctx);
@@ -836,6 +830,7 @@ var _safeParse = (_Err) => (schema, value, _ctx) => {
836
830
  }
837
831
  return result.issues.length ? failure(_Err, result.issues, ctx) : { success: true, data: result.value };
838
832
  };
833
+ var safeParse = /* @__PURE__ */ _safeParse($ZodRealError);
839
834
  function failure(Err, issues, ctx) {
840
835
  let error;
841
836
  return {
@@ -862,6 +857,7 @@ var _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
862
857
  result = await result;
863
858
  return result.issues.length ? failure(_Err, result.issues, ctx) : { success: true, data: result.value };
864
859
  };
860
+ var safeParseAsync = /* @__PURE__ */ _safeParseAsync($ZodRealError);
865
861
  var COMPILE_INVALID = /* @__PURE__ */ Symbol.for("zod.compile.invalid");
866
862
  var COMPILE_FALLBACK = /* @__PURE__ */ Symbol.for("zod.compile.fallback");
867
863
  var validate = (schema, value, _ctx) => {
@@ -992,7 +988,6 @@ function datetime(args) {
992
988
  return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
993
989
  }
994
990
  var anyString = /^[\s\S]{0,}$/;
995
- var integer = /^-?\d+$/;
996
991
  var number = /^-?\d+(?:\.\d+)?$/;
997
992
  var boolean = /^(?:true|false)$/i;
998
993
  var lowercase = /^[^A-Z]*$/;
@@ -1050,24 +1045,6 @@ var $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan",
1050
1045
  });
1051
1046
  };
1052
1047
  });
1053
- var $ZodCheckMultipleOf = /* @__PURE__ */ $constructor("$ZodCheckMultipleOf", (inst, def) => {
1054
- $ZodCheck.init(inst, def);
1055
- inst._zod.check = (payload) => {
1056
- if (typeof payload.value !== typeof def.value)
1057
- throw new Error("Cannot mix number and bigint in multiple_of check.");
1058
- const isMultiple = typeof payload.value === "bigint" ? def.value !== BigInt(0) && payload.value % def.value === BigInt(0) : floatSafeRemainder(payload.value, def.value) === 0;
1059
- if (isMultiple)
1060
- return;
1061
- payload.issues.push({
1062
- origin: typeof payload.value,
1063
- code: "not_multiple_of",
1064
- divisor: def.value,
1065
- input: payload.value,
1066
- inst,
1067
- continue: !def.abort
1068
- });
1069
- };
1070
- });
1071
1048
  var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat", (inst, def) => {
1072
1049
  $ZodCheck.init(inst, def);
1073
1050
  def.format = def.format || "float64";
@@ -3712,14 +3689,6 @@ function _never(Class, params) {
3712
3689
  ...normalizeParams(params)
3713
3690
  });
3714
3691
  }
3715
- function _lt(value, params) {
3716
- return new $ZodCheckLessThan({
3717
- check: "less_than",
3718
- ...normalizeParams(params),
3719
- value,
3720
- inclusive: false
3721
- });
3722
- }
3723
3692
  function _lte(value, params) {
3724
3693
  return new $ZodCheckLessThan({
3725
3694
  check: "less_than",
@@ -3728,14 +3697,6 @@ function _lte(value, params) {
3728
3697
  inclusive: true
3729
3698
  });
3730
3699
  }
3731
- function _gt(value, params) {
3732
- return new $ZodCheckGreaterThan({
3733
- check: "greater_than",
3734
- ...normalizeParams(params),
3735
- value,
3736
- inclusive: false
3737
- });
3738
- }
3739
3700
  function _gte(value, params) {
3740
3701
  return new $ZodCheckGreaterThan({
3741
3702
  check: "greater_than",
@@ -3744,12 +3705,8 @@ function _gte(value, params) {
3744
3705
  inclusive: true
3745
3706
  });
3746
3707
  }
3747
- function _multipleOf(value, params) {
3748
- return new $ZodCheckMultipleOf({
3749
- check: "multiple_of",
3750
- ...normalizeParams(params),
3751
- value
3752
- });
3708
+ function _nonnegative(params) {
3709
+ return _gte(0, params);
3753
3710
  }
3754
3711
  function _maxLength(maximum, params) {
3755
3712
  const ch = new $ZodCheckMaxLength({
@@ -4552,51 +4509,6 @@ var stringProcessor = (schema, ctx, _json, _params) => {
4552
4509
  }
4553
4510
  }
4554
4511
  };
4555
- var numberProcessor = (schema, ctx, _json, params) => {
4556
- const json = _json;
4557
- const { minimum, maximum, multipleOf, exclusiveMaximum, exclusiveMinimum, isInt } = aggregateChecks(schema);
4558
- json.type = isInt ? "integer" : "number";
4559
- const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
4560
- const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
4561
- const legacy = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
4562
- if (exMin) {
4563
- if (legacy) {
4564
- json.minimum = exclusiveMinimum;
4565
- json.exclusiveMinimum = true;
4566
- } else {
4567
- json.exclusiveMinimum = exclusiveMinimum;
4568
- }
4569
- } else if (typeof minimum === "number") {
4570
- json.minimum = minimum;
4571
- }
4572
- if (exMax) {
4573
- if (legacy) {
4574
- json.maximum = exclusiveMaximum;
4575
- json.exclusiveMaximum = true;
4576
- } else {
4577
- json.exclusiveMaximum = exclusiveMaximum;
4578
- }
4579
- } else if (typeof maximum === "number") {
4580
- json.maximum = maximum;
4581
- }
4582
- if (multipleOf) {
4583
- const divisors = new Set;
4584
- for (const divisor of multipleOf) {
4585
- if (Number.isFinite(divisor) && divisor !== 0)
4586
- divisors.add(Math.abs(divisor));
4587
- else
4588
- handleUnrepresentable(schema, ctx, json, params, `A multipleOf divisor of ${divisor} cannot be represented in JSON Schema`);
4589
- }
4590
- const [first, ...rest] = divisors;
4591
- if (first !== undefined)
4592
- json.multipleOf = first;
4593
- if (rest.length)
4594
- json.allOf = [...json.allOf ?? [], ...rest.map((m) => ({ multipleOf: m }))];
4595
- }
4596
- };
4597
- var booleanProcessor = (_schema, _ctx, json, _params) => {
4598
- json.type = "boolean";
4599
- };
4600
4512
  var neverProcessor = (_schema, _ctx, json, _params) => {
4601
4513
  json.not = {};
4602
4514
  };
@@ -4614,45 +4526,6 @@ var enumProcessor = (schema, _ctx, json, _params) => {
4614
4526
  json.type = "string";
4615
4527
  json.enum = values;
4616
4528
  };
4617
- var literalProcessor = (schema, ctx, json, params) => {
4618
- const def = schema._zod.def;
4619
- if (def.values.length === 0) {
4620
- json.not = {};
4621
- return;
4622
- }
4623
- const vals = [];
4624
- for (const val of def.values) {
4625
- if (val === undefined) {
4626
- if (handleUnrepresentable(schema, ctx, json, params, "Literal `undefined` cannot be represented in JSON Schema"))
4627
- return;
4628
- } else if (typeof val === "bigint") {
4629
- if (handleUnrepresentable(schema, ctx, json, params, "BigInt literals cannot be represented in JSON Schema"))
4630
- return;
4631
- vals.push(Number(val));
4632
- } else {
4633
- vals.push(val);
4634
- }
4635
- }
4636
- if (vals.length === 0) {} else if (vals.length === 1) {
4637
- const val = vals[0];
4638
- json.type = val === null ? "null" : typeof val;
4639
- if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
4640
- json.enum = [val];
4641
- } else {
4642
- json.const = val;
4643
- }
4644
- } else {
4645
- if (vals.every((v) => typeof v === "number"))
4646
- json.type = "number";
4647
- if (vals.every((v) => typeof v === "string"))
4648
- json.type = "string";
4649
- if (vals.every((v) => typeof v === "boolean"))
4650
- json.type = "boolean";
4651
- if (vals.every((v) => v === null))
4652
- json.type = "null";
4653
- json.enum = vals;
4654
- }
4655
- };
4656
4529
  var customProcessor = (schema, ctx, json, params) => {
4657
4530
  handleUnrepresentable(schema, ctx, json, params, "Custom types cannot be represented in JSON Schema");
4658
4531
  };
@@ -4752,112 +4625,7 @@ var intersectionProcessor = (schema, ctx, json, params) => {
4752
4625
  json.allOf = allOf;
4753
4626
  ctx.intersections.push(allOf);
4754
4627
  };
4755
- function stringifyKeyNames(bySchema, json, visited) {
4756
- if (json.$ref) {
4757
- if (visited.has(json))
4758
- return json;
4759
- visited.add(json);
4760
- const def = bySchema.get(json)?.def;
4761
- if (!def)
4762
- return json;
4763
- const inlined = stringifyKeyNames(bySchema, def, visited);
4764
- return inlined === def ? json : inlined;
4765
- }
4766
- for (const keyword of ["anyOf", "oneOf"]) {
4767
- const branches = json[keyword];
4768
- if (!Array.isArray(branches))
4769
- continue;
4770
- const mapped = branches.map((branch) => stringifyKeyNames(bySchema, branch, visited));
4771
- if (mapped.some((branch, i) => branch !== branches[i]))
4772
- json = { ...json, [keyword]: mapped };
4773
- }
4774
- const types = Array.isArray(json.type) ? json.type : [json.type];
4775
- const numericType = !types.includes("string") && types.some((t) => t === "number" || t === "integer");
4776
- const values = json.enum ?? (json.const !== undefined ? [json.const] : undefined);
4777
- if (!numericType && !values?.some((v) => typeof v === "number"))
4778
- return json;
4779
- const { minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf, format, id, ...rest } = json;
4780
- if (rest.enum)
4781
- rest.enum = rest.enum.map((v) => typeof v === "number" ? String(v) : v);
4782
- else if (typeof rest.const === "number")
4783
- rest.const = String(rest.const);
4784
- if (!numericType)
4785
- return rest;
4786
- rest.type = "string";
4787
- if (!values)
4788
- rest.pattern = (types.includes("number") ? number : integer).source;
4789
- return rest;
4790
- }
4791
4628
  var pendingRecords = new WeakMap;
4792
- function rewriteKeyNames(ctx) {
4793
- const bySchema = new Map;
4794
- for (const entry of ctx.seen.values()) {
4795
- if (entry.def && !bySchema.has(entry.schema))
4796
- bySchema.set(entry.schema, entry);
4797
- }
4798
- const rewrites = new Map;
4799
- for (const record of pendingRecords.get(ctx) ?? []) {
4800
- const seen = ctx.seen.get(record);
4801
- const names = (seen?.def ?? seen?.schema)?.propertyNames;
4802
- if (!names || names === true || rewrites.has(names))
4803
- continue;
4804
- const rewritten = stringifyKeyNames(bySchema, names, new Set);
4805
- if (rewritten !== names)
4806
- rewrites.set(names, rewritten);
4807
- }
4808
- if (!rewrites.size)
4809
- return;
4810
- for (const entry of ctx.seen.values()) {
4811
- for (const carrier of [entry.schema, entry.def]) {
4812
- const rewritten = carrier && rewrites.get(carrier.propertyNames);
4813
- if (rewritten)
4814
- carrier.propertyNames = rewritten;
4815
- }
4816
- }
4817
- }
4818
- var recordProcessor = (schema, ctx, _json, params) => {
4819
- const json = _json;
4820
- const def = schema._zod.def;
4821
- json.type = "object";
4822
- const keyType = def.keyType;
4823
- const patterns = aggregateChecks(keyType).patterns;
4824
- if (def.mode === "loose" && patterns && patterns.size > 0) {
4825
- const valueSchema = processSchema(def.valueType, ctx, {
4826
- ...params,
4827
- path: [...params.path, "patternProperties", "*"]
4828
- });
4829
- json.patternProperties = {};
4830
- for (const pattern of patterns) {
4831
- assignProp(json.patternProperties, exactPattern(pattern).source, valueSchema);
4832
- }
4833
- } else {
4834
- if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") {
4835
- json.propertyNames = processSchema(def.keyType, ctx, {
4836
- ...params,
4837
- path: [...params.path, "propertyNames"]
4838
- });
4839
- let pending = pendingRecords.get(ctx);
4840
- if (!pending) {
4841
- pending = [];
4842
- pendingRecords.set(ctx, pending);
4843
- ctx.deferred.push(() => rewriteKeyNames(ctx));
4844
- }
4845
- pending.push(schema);
4846
- }
4847
- json.additionalProperties = processSchema(def.valueType, ctx, {
4848
- ...params,
4849
- path: [...params.path, "additionalProperties"]
4850
- });
4851
- }
4852
- const keyValues = keyType._zod.values;
4853
- const omittableOnInput = ctx.io === "input" && inputOptin(def.valueType) !== undefined;
4854
- if (keyValues && !def.partial && !omittableOnInput) {
4855
- const validKeyValues = [...keyValues].filter((v) => typeof v === "string" || typeof v === "number");
4856
- if (validKeyValues.length > 0) {
4857
- json.required = validKeyValues.map(String);
4858
- }
4859
- }
4860
- };
4861
4629
  var nullableProcessor = (schema, ctx, json, params) => {
4862
4630
  const def = schema._zod.def;
4863
4631
  const inner = processSchema(def.innerType, ctx, params);
@@ -4944,95 +4712,44 @@ var optionalProcessor = (schema, ctx, _json, params) => {
4944
4712
  const seen = ctx.seen.get(schema);
4945
4713
  seen.ref = def.innerType;
4946
4714
  };
4947
- // node_modules/zod/v4/classic/errors.js
4948
- var _installedErrorProtos = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
4949
- function _lazyMethod(proto, key, make) {
4950
- Object.defineProperty(proto, key, {
4951
- configurable: true,
4952
- enumerable: false,
4953
- get() {
4954
- const value = make(this);
4955
- Object.defineProperty(this, key, { value, configurable: true, writable: true });
4956
- return value;
4957
- },
4958
- set(value) {
4959
- Object.defineProperty(this, key, { value, configurable: true, writable: true });
4960
- }
4961
- });
4962
- }
4963
- var initializer2 = (inst, issues) => {
4964
- $ZodError.init(inst, issues);
4965
- inst.name = "ZodError";
4966
- const proto = Object.getPrototypeOf(inst);
4967
- if (_installedErrorProtos.has(proto))
4968
- return;
4969
- _installedErrorProtos.add(proto);
4970
- _lazyMethod(proto, "format", (self) => (mapper) => formatError(self, mapper));
4971
- _lazyMethod(proto, "flatten", (self) => (mapper) => flattenError(self, mapper));
4972
- _lazyMethod(proto, "addIssue", (self) => (issue) => {
4973
- self.issues.push(issue);
4974
- self.message = JSON.stringify(self.issues, jsonStringifyReplacer, 2);
4975
- });
4976
- _lazyMethod(proto, "addIssues", (self) => (issues) => {
4977
- self.issues.push(...issues);
4978
- self.message = JSON.stringify(self.issues, jsonStringifyReplacer, 2);
4979
- });
4980
- Object.defineProperty(proto, "isEmpty", {
4981
- configurable: true,
4982
- enumerable: false,
4983
- get() {
4984
- return this.issues.length === 0;
4985
- }
4986
- });
4987
- };
4988
- var ZodRealError = /* @__PURE__ */ $constructor("ZodError", initializer2, undefined, {
4989
- Parent: Error
4990
- });
4991
-
4992
- // node_modules/zod/v4/classic/parse.js
4993
- var parse2 = /* @__PURE__ */ _parse(ZodRealError);
4994
- var parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
4995
- var safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
4996
- var safeParseAsync = /* @__PURE__ */ _safeParseAsync(ZodRealError);
4997
- var encode = /* @__PURE__ */ _encode(ZodRealError);
4998
- var decode = /* @__PURE__ */ _decode(ZodRealError);
4999
- var encodeAsync = /* @__PURE__ */ _encodeAsync(ZodRealError);
5000
- var decodeAsync = /* @__PURE__ */ _decodeAsync(ZodRealError);
5001
- var safeEncode = /* @__PURE__ */ _safeEncode(ZodRealError);
5002
- var safeDecode = /* @__PURE__ */ _safeDecode(ZodRealError);
5003
- var safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
5004
- var safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
5005
-
5006
- // node_modules/zod/v4/classic/schemas.js
5007
- function _ensureDefaultLocale() {
5008
- if (!globalConfig.localeError)
5009
- config(en_default());
5010
- }
5011
- function _ensureDefaultMemoizer() {
5012
- if (!globalConfig.memoizer)
5013
- config({ memoizer: memoizer() });
5014
- }
5015
- var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
5016
- _ensureDefaultLocale();
4715
+ // node_modules/zod/v4/mini/schemas.js
4716
+ var ZodMiniType = /* @__PURE__ */ $constructor("ZodMiniType", (inst, def) => {
4717
+ if (!inst._zod)
4718
+ throw new Error("Uninitialized schema in ZodMiniType.");
5017
4719
  $ZodType.init(inst, def);
5018
4720
  inst.def = def;
5019
4721
  inst.type = def.type;
5020
- return inst;
5021
4722
  }, {
5022
- check(...chks) {
4723
+ get with() {
4724
+ return this.check;
4725
+ },
4726
+ set with(value) {
4727
+ own(this, "with", value);
4728
+ },
4729
+ parse(data, params) {
4730
+ return parse(this, data, params, { callee: this.parse });
4731
+ },
4732
+ parseAsync(data, params) {
4733
+ return parseAsync(this, data, params, { callee: this.parseAsync });
4734
+ },
4735
+ safeParse(data, params) {
4736
+ return safeParse(this, data, params);
4737
+ },
4738
+ safeParseAsync(data, params) {
4739
+ return safeParseAsync(this, data, params);
4740
+ },
4741
+ check(...checks) {
5023
4742
  const def = this.def;
5024
- return this.clone(mergeDefs(def, {
4743
+ return this.clone({
4744
+ ...def,
5025
4745
  checks: [
5026
4746
  ...def.checks ?? [],
5027
- ...chks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch)
4747
+ ...checks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch)
5028
4748
  ]
5029
- }), { parent: true });
4749
+ }, { parent: true });
5030
4750
  },
5031
- with(...chks) {
5032
- return this.check(...chks);
5033
- },
5034
- clone(def, params) {
5035
- return clone(this, def, params);
4751
+ clone(_def, params) {
4752
+ return clone(this, _def, params);
5036
4753
  },
5037
4754
  brand() {
5038
4755
  return this;
@@ -5041,879 +4758,215 @@ var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
5041
4758
  reg.add(this, meta);
5042
4759
  return this;
5043
4760
  },
5044
- refine(check, params) {
5045
- return this.check(refine(check, params));
5046
- },
5047
- superRefine(refinement, params) {
5048
- return this.check(superRefine(refinement, params));
5049
- },
5050
- overwrite(fn) {
5051
- return this.check(_overwrite(fn));
5052
- },
5053
- optional() {
5054
- return optional(this);
5055
- },
5056
- exactOptional() {
5057
- return exactOptional(this);
5058
- },
5059
- nullable() {
5060
- return nullable(this);
5061
- },
5062
- nullish() {
5063
- return optional(nullable(this));
5064
- },
5065
- nonoptional(params) {
5066
- return nonoptional(this, params);
5067
- },
5068
- array() {
5069
- return array(this);
5070
- },
5071
- or(arg) {
5072
- return union([this, arg]);
5073
- },
5074
- and(arg) {
5075
- return intersection(this, arg);
5076
- },
5077
- transform(tx) {
5078
- return pipe(this, transform(tx));
5079
- },
5080
- default(d) {
5081
- return _default(this, d);
5082
- },
5083
- prefault(d) {
5084
- return prefault(this, d);
5085
- },
5086
- catch(params) {
5087
- return _catch(this, params);
5088
- },
5089
- pipe(target) {
5090
- return pipe(this, target);
5091
- },
5092
- readonly() {
5093
- return readonly(this);
5094
- },
5095
- describe(description) {
5096
- const cl = this.clone();
5097
- globalRegistry.add(cl, { description });
5098
- return cl;
5099
- },
5100
- meta(...args) {
5101
- if (args.length === 0)
5102
- return globalRegistry.get(this);
5103
- const cl = this.clone();
5104
- globalRegistry.add(cl, args[0]);
5105
- return cl;
5106
- },
5107
- isOptional() {
5108
- return this.safeParse(undefined).success;
5109
- },
5110
- isNullable() {
5111
- return this.safeParse(null).success;
5112
- },
5113
4761
  apply(fn, ...args) {
5114
4762
  return args.length === 0 ? fn(this) : fn(this, ...args);
5115
- },
5116
- get "~standard"() {
5117
- return hide(this, "~standard", {
5118
- ...standardProps(this),
5119
- jsonSchema: {
5120
- input: createStandardJSONSchemaMethod(this, "input"),
5121
- output: createStandardJSONSchemaMethod(this, "output")
5122
- }
5123
- });
5124
- },
5125
- set "~standard"(value) {
5126
- own(this, "~standard", value);
5127
- },
5128
- parse: function _parse(data, params) {
5129
- return parse2(this, data, params, { callee: _parse });
5130
- },
5131
- parseAsync: async function _parseAsync(data, params) {
5132
- return await parseAsync(this, data, params, { callee: _parseAsync });
5133
- },
5134
- safeParse(data, params) {
5135
- return safeParse(this, data, params);
5136
- },
5137
- async safeParseAsync(data, params) {
5138
- return safeParseAsync(this, data, params);
5139
- },
5140
- get spa() {
5141
- return this?.safeParseAsync;
5142
- },
5143
- set spa(value) {
5144
- own(this, "spa", value);
5145
- },
5146
- validate(data, params) {
5147
- return validate(this, data, params);
5148
- },
5149
- validateAsync(data, params) {
5150
- return validateAsync(this, data, params);
5151
- },
5152
- encode: function _encode(data, params) {
5153
- return encode(this, data, params, { callee: _encode });
5154
- },
5155
- decode: function _decode(data, params) {
5156
- return decode(this, data, params, { callee: _decode });
5157
- },
5158
- encodeAsync: async function _encodeAsync(data, params) {
5159
- return await encodeAsync(this, data, params, { callee: _encodeAsync });
5160
- },
5161
- decodeAsync: async function _decodeAsync(data, params) {
5162
- return await decodeAsync(this, data, params, { callee: _decodeAsync });
5163
- },
5164
- safeEncode(data, params) {
5165
- return safeEncode(this, data, params);
5166
- },
5167
- safeDecode(data, params) {
5168
- return safeDecode(this, data, params);
5169
- },
5170
- async safeEncodeAsync(data, params) {
5171
- return safeEncodeAsync(this, data, params);
5172
- },
5173
- async safeDecodeAsync(data, params) {
5174
- return safeDecodeAsync(this, data, params);
5175
- },
5176
- toJSONSchema(params) {
5177
- return createToJSONSchemaMethod(this, {})(params);
5178
- },
5179
- get description() {
5180
- return globalRegistry.get(this)?.description;
5181
- },
5182
- get _def() {
5183
- return this._zod.def;
5184
4763
  }
5185
4764
  });
5186
- var _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
5187
- $ZodString.init(inst, def);
5188
- ZodType.init(inst, def);
5189
- inst._zod.processJSONSchema = (ctx, json, params) => stringProcessor(inst, ctx, json, params);
5190
- }, /* @__PURE__ */ derived({
5191
- format: (inst) => aggregateChecks(inst).format ?? null,
5192
- minLength: (inst) => aggregateChecks(inst).minimum ?? null,
5193
- maxLength: (inst) => aggregateChecks(inst).maximum ?? null
5194
- }, {
5195
- regex(...args) {
5196
- return this.check(_regex(...args));
5197
- },
5198
- includes(...args) {
5199
- return this.check(_includes(...args));
5200
- },
5201
- startsWith(...args) {
5202
- return this.check(_startsWith(...args));
5203
- },
5204
- endsWith(...args) {
5205
- return this.check(_endsWith(...args));
5206
- },
5207
- min(...args) {
5208
- return this.check(_minLength(...args));
5209
- },
5210
- max(...args) {
5211
- return this.check(_maxLength(...args));
5212
- },
5213
- length(...args) {
5214
- return this.check(_length(...args));
5215
- },
5216
- nonempty(...args) {
5217
- return this.check(_minLength(1, ...args));
5218
- },
5219
- lowercase(params) {
5220
- return this.check(_lowercase(params));
5221
- },
5222
- uppercase(params) {
5223
- return this.check(_uppercase(params));
5224
- },
5225
- trim() {
5226
- return this.check(_trim());
5227
- },
5228
- normalize(...args) {
5229
- return this.check(_normalize(...args));
5230
- },
5231
- toLowerCase() {
5232
- return this.check(_toLowerCase());
5233
- },
5234
- toUpperCase() {
5235
- return this.check(_toUpperCase());
5236
- },
5237
- slugify() {
5238
- return this.check(_slugify());
5239
- }
5240
- }));
5241
- var ZodString = /* @__PURE__ */ $constructor("ZodString", (inst, def) => {
4765
+ var ZodMiniString = /* @__PURE__ */ $constructor("ZodMiniString", (inst, def) => {
5242
4766
  $ZodString.init(inst, def);
5243
- _ZodString.init(inst, def);
5244
- }, {
5245
- email(params) {
5246
- return this.check(_email(ZodEmail, params));
5247
- },
5248
- url(params) {
5249
- return this.check(_url(ZodURL, params));
5250
- },
5251
- jwt(params) {
5252
- return this.check(_jwt(ZodJWT, params));
5253
- },
5254
- emoji(params) {
5255
- return this.check(_emoji2(ZodEmoji, params));
5256
- },
5257
- guid(params) {
5258
- return this.check(_guid(ZodGUID, params));
5259
- },
5260
- uuid(params) {
5261
- return this.check(_uuid(ZodUUID, params));
5262
- },
5263
- uuidv4(params) {
5264
- return this.check(_uuidv4(ZodUUID, params));
5265
- },
5266
- uuidv6(params) {
5267
- return this.check(_uuidv6(ZodUUID, params));
5268
- },
5269
- uuidv7(params) {
5270
- return this.check(_uuidv7(ZodUUID, params));
5271
- },
5272
- nanoid(params) {
5273
- return this.check(_nanoid(ZodNanoID, params));
5274
- },
5275
- cuid(params) {
5276
- return this.check(_cuid(ZodCUID, params));
5277
- },
5278
- cuid2(params) {
5279
- return this.check(_cuid2(ZodCUID2, params));
5280
- },
5281
- ulid(params) {
5282
- return this.check(_ulid(ZodULID, params));
5283
- },
5284
- base64(params) {
5285
- return this.check(_base64(ZodBase64, params));
5286
- },
5287
- base64url(params) {
5288
- return this.check(_base64url(ZodBase64URL, params));
5289
- },
5290
- xid(params) {
5291
- return this.check(_xid(ZodXID, params));
5292
- },
5293
- ksuid(params) {
5294
- return this.check(_ksuid(ZodKSUID, params));
5295
- },
5296
- ipv4(params) {
5297
- return this.check(_ipv4(ZodIPv4, params));
5298
- },
5299
- ipv6(params) {
5300
- return this.check(_ipv6(ZodIPv6, params));
5301
- },
5302
- cidrv4(params) {
5303
- return this.check(_cidrv4(ZodCIDRv4, params));
5304
- },
5305
- cidrv6(params) {
5306
- return this.check(_cidrv6(ZodCIDRv6, params));
5307
- },
5308
- e164(params) {
5309
- return this.check(_e164(ZodE164, params));
5310
- },
5311
- datetime(params) {
5312
- return this.check(_isoDateTime(ZodISODateTime, params));
5313
- },
5314
- date(params) {
5315
- return this.check(_isoDate(ZodISODate, params));
5316
- },
5317
- time(params) {
5318
- return this.check(_isoTime(ZodISOTime, params));
5319
- },
5320
- duration(params) {
5321
- return this.check(_isoDuration(ZodISODuration, params));
5322
- }
4767
+ ZodMiniType.init(inst, def);
5323
4768
  });
5324
4769
  function string2(params) {
5325
- return _string(ZodString, params);
4770
+ return _string(ZodMiniString, params);
5326
4771
  }
5327
- var ZodStringFormat = /* @__PURE__ */ $constructor("ZodStringFormat", (inst, def) => {
4772
+ var ZodMiniStringFormat = /* @__PURE__ */ $constructor("ZodMiniStringFormat", (inst, def) => {
5328
4773
  $ZodStringFormat.init(inst, def);
5329
- _ZodString.init(inst, def);
5330
- });
5331
- var ZodISODateTime = /* @__PURE__ */ $constructor("ZodISODateTime", (inst, def) => {
5332
- $ZodISODateTime.init(inst, def);
5333
- ZodStringFormat.init(inst, def);
5334
- });
5335
- var ZodISODate = /* @__PURE__ */ $constructor("ZodISODate", (inst, def) => {
5336
- $ZodISODate.init(inst, def);
5337
- ZodStringFormat.init(inst, def);
4774
+ ZodMiniString.init(inst, def);
5338
4775
  });
5339
- var ZodISOTime = /* @__PURE__ */ $constructor("ZodISOTime", (inst, def) => {
5340
- $ZodISOTime.init(inst, def);
5341
- ZodStringFormat.init(inst, def);
4776
+ var ZodMiniURL = /* @__PURE__ */ $constructor("ZodMiniURL", (inst, def) => {
4777
+ $ZodURL.init(inst, def);
4778
+ ZodMiniStringFormat.init(inst, def);
5342
4779
  });
5343
- var ZodISODuration = /* @__PURE__ */ $constructor("ZodISODuration", (inst, def) => {
5344
- $ZodISODuration.init(inst, def);
5345
- ZodStringFormat.init(inst, def);
4780
+ function url(params) {
4781
+ return _url(ZodMiniURL, params);
4782
+ }
4783
+ var ZodMiniNumber = /* @__PURE__ */ $constructor("ZodMiniNumber", (inst, def) => {
4784
+ $ZodNumber.init(inst, def);
4785
+ ZodMiniType.init(inst, def);
5346
4786
  });
5347
- var ZodEmail = /* @__PURE__ */ $constructor("ZodEmail", (inst, def) => {
5348
- $ZodEmail.init(inst, def);
5349
- ZodStringFormat.init(inst, def);
4787
+ function number2(params) {
4788
+ return _number(ZodMiniNumber, params);
4789
+ }
4790
+ var ZodMiniNumberFormat = /* @__PURE__ */ $constructor("ZodMiniNumberFormat", (inst, def) => {
4791
+ $ZodNumberFormat.init(inst, def);
4792
+ ZodMiniNumber.init(inst, def);
5350
4793
  });
5351
- var ZodGUID = /* @__PURE__ */ $constructor("ZodGUID", (inst, def) => {
5352
- $ZodGUID.init(inst, def);
5353
- ZodStringFormat.init(inst, def);
4794
+ function int(params) {
4795
+ return _int(ZodMiniNumberFormat, params);
4796
+ }
4797
+ var ZodMiniBoolean = /* @__PURE__ */ $constructor("ZodMiniBoolean", (inst, def) => {
4798
+ $ZodBoolean.init(inst, def);
4799
+ ZodMiniType.init(inst, def);
5354
4800
  });
5355
- var ZodUUID = /* @__PURE__ */ $constructor("ZodUUID", (inst, def) => {
5356
- $ZodUUID.init(inst, def);
5357
- ZodStringFormat.init(inst, def);
4801
+ function boolean2(params) {
4802
+ return _boolean(ZodMiniBoolean, params);
4803
+ }
4804
+ var ZodMiniUnknown = /* @__PURE__ */ $constructor("ZodMiniUnknown", (inst, def) => {
4805
+ $ZodUnknown.init(inst, def);
4806
+ ZodMiniType.init(inst, def);
5358
4807
  });
5359
- var ZodURL = /* @__PURE__ */ $constructor("ZodURL", (inst, def) => {
5360
- $ZodURL.init(inst, def);
5361
- ZodStringFormat.init(inst, def);
4808
+ function unknown() {
4809
+ return _unknown(ZodMiniUnknown);
4810
+ }
4811
+ var ZodMiniNever = /* @__PURE__ */ $constructor("ZodMiniNever", (inst, def) => {
4812
+ $ZodNever.init(inst, def);
4813
+ ZodMiniType.init(inst, def);
5362
4814
  });
5363
- var ZodEmoji = /* @__PURE__ */ $constructor("ZodEmoji", (inst, def) => {
5364
- $ZodEmoji.init(inst, def);
5365
- ZodStringFormat.init(inst, def);
4815
+ function never(params) {
4816
+ return _never(ZodMiniNever, params);
4817
+ }
4818
+ var ZodMiniArray = /* @__PURE__ */ $constructor("ZodMiniArray", (inst, def) => {
4819
+ $ZodArray.init(inst, def);
4820
+ ZodMiniType.init(inst, def);
5366
4821
  });
5367
- var ZodNanoID = /* @__PURE__ */ $constructor("ZodNanoID", (inst, def) => {
5368
- $ZodNanoID.init(inst, def);
5369
- ZodStringFormat.init(inst, def);
4822
+ function array(element, params) {
4823
+ return new ZodMiniArray({
4824
+ type: "array",
4825
+ element,
4826
+ ...normalizeParams(params)
4827
+ });
4828
+ }
4829
+ var ZodMiniObject = /* @__PURE__ */ $constructor("ZodMiniObject", (inst, def) => {
4830
+ $ZodObject.init(inst, def);
4831
+ ZodMiniType.init(inst, def);
4832
+ installLazyProp(inst, "shape", (self) => self._zod.def.shape, false);
5370
4833
  });
5371
- var ZodCUID = /* @__PURE__ */ $constructor("ZodCUID", (inst, def) => {
5372
- $ZodCUID.init(inst, def);
5373
- ZodStringFormat.init(inst, def);
4834
+ function strictObject(shape, params) {
4835
+ return new ZodMiniObject({
4836
+ type: "object",
4837
+ shape,
4838
+ catchall: never(),
4839
+ ...normalizeParams(params)
4840
+ });
4841
+ }
4842
+ function looseObject(shape, params) {
4843
+ return new ZodMiniObject({
4844
+ type: "object",
4845
+ shape,
4846
+ catchall: unknown(),
4847
+ ...normalizeParams(params)
4848
+ });
4849
+ }
4850
+ function extend2(schema, shape) {
4851
+ return extend(schema, shape);
4852
+ }
4853
+ function pick2(schema, mask) {
4854
+ return pick(schema, mask);
4855
+ }
4856
+ function omit2(schema, mask) {
4857
+ return omit(schema, mask);
4858
+ }
4859
+ var ZodMiniUnion = /* @__PURE__ */ $constructor("ZodMiniUnion", (inst, def) => {
4860
+ $ZodUnion.init(inst, def);
4861
+ ZodMiniType.init(inst, def);
5374
4862
  });
5375
- var ZodCUID2 = /* @__PURE__ */ $constructor("ZodCUID2", (inst, def) => {
5376
- $ZodCUID2.init(inst, def);
5377
- ZodStringFormat.init(inst, def);
4863
+ function union(options, params) {
4864
+ return new ZodMiniUnion({
4865
+ type: "union",
4866
+ options,
4867
+ ...normalizeParams(params)
4868
+ });
4869
+ }
4870
+ var ZodMiniDiscriminatedUnion = /* @__PURE__ */ $constructor("ZodMiniDiscriminatedUnion", (inst, def) => {
4871
+ $ZodDiscriminatedUnion.init(inst, def);
4872
+ ZodMiniType.init(inst, def);
5378
4873
  });
5379
- var ZodULID = /* @__PURE__ */ $constructor("ZodULID", (inst, def) => {
5380
- $ZodULID.init(inst, def);
5381
- ZodStringFormat.init(inst, def);
5382
- });
5383
- var ZodXID = /* @__PURE__ */ $constructor("ZodXID", (inst, def) => {
5384
- $ZodXID.init(inst, def);
5385
- ZodStringFormat.init(inst, def);
5386
- });
5387
- var ZodKSUID = /* @__PURE__ */ $constructor("ZodKSUID", (inst, def) => {
5388
- $ZodKSUID.init(inst, def);
5389
- ZodStringFormat.init(inst, def);
5390
- });
5391
- var ZodIPv4 = /* @__PURE__ */ $constructor("ZodIPv4", (inst, def) => {
5392
- $ZodIPv4.init(inst, def);
5393
- ZodStringFormat.init(inst, def);
5394
- });
5395
- var ZodIPv6 = /* @__PURE__ */ $constructor("ZodIPv6", (inst, def) => {
5396
- $ZodIPv6.init(inst, def);
5397
- ZodStringFormat.init(inst, def);
5398
- });
5399
- var ZodCIDRv4 = /* @__PURE__ */ $constructor("ZodCIDRv4", (inst, def) => {
5400
- $ZodCIDRv4.init(inst, def);
5401
- ZodStringFormat.init(inst, def);
5402
- });
5403
- var ZodCIDRv6 = /* @__PURE__ */ $constructor("ZodCIDRv6", (inst, def) => {
5404
- $ZodCIDRv6.init(inst, def);
5405
- ZodStringFormat.init(inst, def);
5406
- });
5407
- var ZodBase64 = /* @__PURE__ */ $constructor("ZodBase64", (inst, def) => {
5408
- $ZodBase64.init(inst, def);
5409
- ZodStringFormat.init(inst, def);
5410
- });
5411
- var ZodBase64URL = /* @__PURE__ */ $constructor("ZodBase64URL", (inst, def) => {
5412
- $ZodBase64URL.init(inst, def);
5413
- ZodStringFormat.init(inst, def);
5414
- });
5415
- var ZodE164 = /* @__PURE__ */ $constructor("ZodE164", (inst, def) => {
5416
- $ZodE164.init(inst, def);
5417
- ZodStringFormat.init(inst, def);
5418
- });
5419
- var ZodJWT = /* @__PURE__ */ $constructor("ZodJWT", (inst, def) => {
5420
- $ZodJWT.init(inst, def);
5421
- ZodStringFormat.init(inst, def);
5422
- });
5423
- var ZodNumber = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => {
5424
- $ZodNumber.init(inst, def);
5425
- ZodType.init(inst, def);
5426
- inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json, params);
5427
- inst.isFinite = true;
5428
- }, /* @__PURE__ */ derived({
5429
- minValue: (inst) => {
5430
- const { minimum, exclusiveMinimum } = aggregateChecks(inst);
5431
- return Math.max(minimum ?? Number.NEGATIVE_INFINITY, exclusiveMinimum ?? Number.NEGATIVE_INFINITY);
5432
- },
5433
- maxValue: (inst) => {
5434
- const { maximum, exclusiveMaximum } = aggregateChecks(inst);
5435
- return Math.min(maximum ?? Number.POSITIVE_INFINITY, exclusiveMaximum ?? Number.POSITIVE_INFINITY);
5436
- },
5437
- isInt: (inst) => {
5438
- const { isInt, multipleOf } = aggregateChecks(inst);
5439
- return !!isInt || !!multipleOf?.some(Number.isSafeInteger);
5440
- },
5441
- format: (inst) => aggregateChecks(inst).format ?? null
5442
- }, {
5443
- gt(value, params) {
5444
- return this.check(_gt(value, params));
5445
- },
5446
- gte(value, params) {
5447
- return this.check(_gte(value, params));
5448
- },
5449
- min(value, params) {
5450
- return this.check(_gte(value, params));
5451
- },
5452
- lt(value, params) {
5453
- return this.check(_lt(value, params));
5454
- },
5455
- lte(value, params) {
5456
- return this.check(_lte(value, params));
5457
- },
5458
- max(value, params) {
5459
- return this.check(_lte(value, params));
5460
- },
5461
- int(params) {
5462
- return this.check(int(params));
5463
- },
5464
- safe(params) {
5465
- return this.check(int(params));
5466
- },
5467
- positive(params) {
5468
- return this.check(_gt(0, params));
5469
- },
5470
- nonnegative(params) {
5471
- return this.check(_gte(0, params));
5472
- },
5473
- negative(params) {
5474
- return this.check(_lt(0, params));
5475
- },
5476
- nonpositive(params) {
5477
- return this.check(_lte(0, params));
5478
- },
5479
- multipleOf(value, params) {
5480
- return this.check(_multipleOf(value, params));
5481
- },
5482
- step(value, params) {
5483
- return this.check(_multipleOf(value, params));
5484
- },
5485
- finite() {
5486
- return this;
5487
- }
5488
- }));
5489
- function number2(params) {
5490
- return _number(ZodNumber, params);
5491
- }
5492
- var ZodNumberFormat = /* @__PURE__ */ $constructor("ZodNumberFormat", (inst, def) => {
5493
- $ZodNumberFormat.init(inst, def);
5494
- ZodNumber.init(inst, def);
5495
- });
5496
- function int(params) {
5497
- return _int(ZodNumberFormat, params);
5498
- }
5499
- var ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
5500
- $ZodBoolean.init(inst, def);
5501
- ZodType.init(inst, def);
5502
- inst._zod.processJSONSchema = (ctx, json, params) => booleanProcessor(inst, ctx, json, params);
5503
- });
5504
- function boolean2(params) {
5505
- return _boolean(ZodBoolean, params);
5506
- }
5507
- var ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
5508
- $ZodUnknown.init(inst, def);
5509
- ZodType.init(inst, def);
5510
- inst._zod.processJSONSchema = (ctx, json, params) => unknownProcessor(inst, ctx, json, params);
5511
- });
5512
- function unknown() {
5513
- return _unknown(ZodUnknown);
5514
- }
5515
- var ZodNever = /* @__PURE__ */ $constructor("ZodNever", (inst, def) => {
5516
- $ZodNever.init(inst, def);
5517
- ZodType.init(inst, def);
5518
- inst._zod.processJSONSchema = (ctx, json, params) => neverProcessor(inst, ctx, json, params);
5519
- });
5520
- function never(params) {
5521
- return _never(ZodNever, params);
5522
- }
5523
- var ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
5524
- _ensureDefaultMemoizer();
5525
- $ZodArray.init(inst, def);
5526
- ZodType.init(inst, def);
5527
- inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor(inst, ctx, json, params);
5528
- inst.element = def.element;
5529
- }, {
5530
- min(n, params) {
5531
- return this.check(_minLength(n, params));
5532
- },
5533
- nonempty(params) {
5534
- return this.check(_minLength(1, params));
5535
- },
5536
- max(n, params) {
5537
- return this.check(_maxLength(n, params));
5538
- },
5539
- length(n, params) {
5540
- return this.check(_length(n, params));
5541
- },
5542
- unwrap() {
5543
- return this.element;
5544
- }
5545
- });
5546
- function array(element, params) {
5547
- return _array(ZodArray, element, params);
5548
- }
5549
- var ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
5550
- _ensureDefaultMemoizer();
5551
- $ZodObjectJIT.init(inst, def);
5552
- ZodType.init(inst, def);
5553
- inst._zod.processJSONSchema = (ctx, json, params) => objectProcessor(inst, ctx, json, params);
5554
- installLazyProp(inst, "shape", (self) => self._zod.def.shape, false);
5555
- }, {
5556
- keyof() {
5557
- return _enum(Object.keys(this._zod.def.shape));
5558
- },
5559
- catchall(catchall) {
5560
- return this.clone(mergeDefs(this._zod.def, { catchall }));
5561
- },
5562
- passthrough() {
5563
- return this.clone(mergeDefs(this._zod.def, { catchall: unknown() }));
5564
- },
5565
- loose() {
5566
- return this.clone(mergeDefs(this._zod.def, { catchall: unknown() }));
5567
- },
5568
- strict() {
5569
- return this.clone(mergeDefs(this._zod.def, { catchall: never() }));
5570
- },
5571
- strip() {
5572
- return this.clone(mergeDefs(this._zod.def, { catchall: undefined }));
5573
- },
5574
- extend(incoming) {
5575
- return extend(this, incoming);
5576
- },
5577
- safeExtend(incoming) {
5578
- return safeExtend(this, incoming);
5579
- },
5580
- merge(other) {
5581
- return merge(this, other);
5582
- },
5583
- pick(mask) {
5584
- return pick(this, mask);
5585
- },
5586
- omit(mask) {
5587
- return omit(this, mask);
5588
- },
5589
- partial(...args) {
5590
- return partial(ZodOptional, this, args[0]);
5591
- },
5592
- exactPartial(...args) {
5593
- return partial(ZodExactOptional, this, args[0], "exactPartial");
5594
- },
5595
- required(...args) {
5596
- return required(ZodNonOptional, this, args[0]);
5597
- }
5598
- });
5599
- function object(shape, params) {
5600
- const def = {
5601
- type: "object",
5602
- shape: shape ?? {},
5603
- ...normalizeParams(params)
5604
- };
5605
- return new ZodObject(def);
5606
- }
5607
- function looseObject(shape, params) {
5608
- return new ZodObject({
5609
- type: "object",
5610
- shape,
5611
- catchall: unknown(),
5612
- ...normalizeParams(params)
5613
- });
5614
- }
5615
- var ZodUnion = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => {
5616
- $ZodUnion.init(inst, def);
5617
- ZodType.init(inst, def);
5618
- inst._zod.processJSONSchema = (ctx, json, params) => unionProcessor(inst, ctx, json, params);
5619
- inst.options = def.options;
5620
- });
5621
- function union(options, params) {
5622
- return new ZodUnion({
5623
- type: "union",
5624
- options,
5625
- ...normalizeParams(params)
5626
- });
5627
- }
5628
- var ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("ZodDiscriminatedUnion", (inst, def) => {
5629
- ZodUnion.init(inst, def);
5630
- $ZodDiscriminatedUnion.init(inst, def);
5631
- });
5632
- function discriminatedUnion(discriminator, options, params) {
5633
- return new ZodDiscriminatedUnion({
5634
- type: "union",
5635
- options,
5636
- discriminator,
5637
- ...normalizeParams(params)
5638
- });
5639
- }
5640
- var ZodIntersection = /* @__PURE__ */ $constructor("ZodIntersection", (inst, def) => {
5641
- $ZodIntersection.init(inst, def);
5642
- ZodType.init(inst, def);
5643
- inst._zod.processJSONSchema = (ctx, json, params) => intersectionProcessor(inst, ctx, json, params);
5644
- });
5645
- function intersection(left, right) {
5646
- return new ZodIntersection({
5647
- type: "intersection",
5648
- left,
5649
- right
5650
- });
5651
- }
5652
- var ZodRecord = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => {
5653
- _ensureDefaultMemoizer();
5654
- $ZodRecord.init(inst, def);
5655
- ZodType.init(inst, def);
5656
- inst._zod.processJSONSchema = (ctx, json, params) => recordProcessor(inst, ctx, json, params);
5657
- inst.keyType = def.keyType;
5658
- inst.valueType = def.valueType;
4874
+ function discriminatedUnion(discriminator, options, params) {
4875
+ return new ZodMiniDiscriminatedUnion({
4876
+ type: "union",
4877
+ options,
4878
+ discriminator,
4879
+ ...normalizeParams(params)
4880
+ });
4881
+ }
4882
+ var ZodMiniRecord = /* @__PURE__ */ $constructor("ZodMiniRecord", (inst, def) => {
4883
+ $ZodRecord.init(inst, def);
4884
+ ZodMiniType.init(inst, def);
5659
4885
  });
5660
4886
  function record(keyType, valueType, params) {
5661
4887
  if (!valueType || !valueType._zod) {
5662
- return new ZodRecord({
4888
+ return new ZodMiniRecord({
5663
4889
  type: "record",
5664
4890
  keyType: string2(),
5665
4891
  valueType: keyType,
5666
4892
  ...normalizeParams(valueType)
5667
4893
  });
5668
4894
  }
5669
- return new ZodRecord({
4895
+ return new ZodMiniRecord({
5670
4896
  type: "record",
5671
4897
  keyType,
5672
4898
  valueType,
5673
4899
  ...normalizeParams(params)
5674
4900
  });
5675
4901
  }
5676
- var ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
4902
+ var ZodMiniEnum = /* @__PURE__ */ $constructor("ZodMiniEnum", (inst, def) => {
5677
4903
  $ZodEnum.init(inst, def);
5678
- ZodType.init(inst, def);
5679
- inst._zod.processJSONSchema = (ctx, json, params) => enumProcessor(inst, ctx, json, params);
5680
- inst.enum = def.entries;
4904
+ ZodMiniType.init(inst, def);
5681
4905
  inst.options = [...inst._zod.values];
5682
- const keys = new Set(Object.keys(def.entries));
5683
- inst.extract = (values, params) => {
5684
- const newEntries = {};
5685
- for (const value of values) {
5686
- if (keys.has(value)) {
5687
- newEntries[value] = def.entries[value];
5688
- } else
5689
- throw new Error(`Key ${value} not found in enum`);
5690
- }
5691
- return new ZodEnum({
5692
- ...def,
5693
- checks: [],
5694
- ...normalizeParams(params),
5695
- entries: newEntries
5696
- });
5697
- };
5698
- inst.exclude = (values, params) => {
5699
- const newEntries = { ...def.entries };
5700
- for (const value of values) {
5701
- if (keys.has(value)) {
5702
- delete newEntries[value];
5703
- } else
5704
- throw new Error(`Key ${value} not found in enum`);
5705
- }
5706
- return new ZodEnum({
5707
- ...def,
5708
- checks: [],
5709
- ...normalizeParams(params),
5710
- entries: newEntries
5711
- });
5712
- };
5713
4906
  });
5714
4907
  function _enum(values, params) {
5715
4908
  const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
5716
- return new ZodEnum({
4909
+ return new ZodMiniEnum({
5717
4910
  type: "enum",
5718
4911
  entries,
5719
4912
  ...normalizeParams(params)
5720
4913
  });
5721
4914
  }
5722
- var ZodLiteral = /* @__PURE__ */ $constructor("ZodLiteral", (inst, def) => {
4915
+ var ZodMiniLiteral = /* @__PURE__ */ $constructor("ZodMiniLiteral", (inst, def) => {
5723
4916
  $ZodLiteral.init(inst, def);
5724
- ZodType.init(inst, def);
5725
- inst._zod.processJSONSchema = (ctx, json, params) => literalProcessor(inst, ctx, json, params);
5726
- inst.values = new Set(def.values);
5727
- Object.defineProperty(inst, "value", {
5728
- get() {
5729
- if (def.values.length > 1) {
5730
- throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");
5731
- }
5732
- return def.values[0];
5733
- }
5734
- });
4917
+ ZodMiniType.init(inst, def);
5735
4918
  });
5736
4919
  function literal(value, params) {
5737
- return new ZodLiteral({
4920
+ return new ZodMiniLiteral({
5738
4921
  type: "literal",
5739
4922
  values: Array.isArray(value) ? value : [value],
5740
4923
  ...normalizeParams(params)
5741
4924
  });
5742
4925
  }
5743
- var ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
5744
- _ensureDefaultMemoizer();
5745
- $ZodTransform.init(inst, def);
5746
- ZodType.init(inst, def);
5747
- inst._zod.processJSONSchema = (ctx, json, params) => transformProcessor(inst, ctx, json, params);
5748
- inst._zod.parse = (payload, _ctx) => {
5749
- if (_ctx.direction === "backward") {
5750
- throw new $ZodEncodeError(inst.constructor.name);
5751
- }
5752
- payload.addIssue = (issue2) => {
5753
- if (typeof issue2 === "string") {
5754
- payload.issues.push(issue(issue2, payload.value, def));
5755
- } else {
5756
- const _issue = issue2;
5757
- if (_issue.fatal)
5758
- _issue.continue = false;
5759
- _issue.code ?? (_issue.code = "custom");
5760
- if (!("input" in _issue))
5761
- _issue.input = payload.value;
5762
- _issue.inst ?? (_issue.inst = inst);
5763
- payload.issues.push(issue(_issue));
5764
- }
5765
- };
5766
- const output = def.transform(payload.value, payload);
5767
- if (output instanceof Promise) {
5768
- return output.then((output) => {
5769
- payload.value = output;
5770
- return payload;
5771
- });
5772
- }
5773
- payload.value = output;
5774
- return payload;
5775
- };
5776
- });
5777
- function transform(fn) {
5778
- return new ZodTransform({
5779
- type: "transform",
5780
- transform: fn
5781
- });
5782
- }
5783
- var ZodOptional = /* @__PURE__ */ $constructor("ZodOptional", (inst, def) => {
4926
+ var ZodMiniOptional = /* @__PURE__ */ $constructor("ZodMiniOptional", (inst, def) => {
5784
4927
  $ZodOptional.init(inst, def);
5785
- ZodType.init(inst, def);
5786
- inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
5787
- inst.unwrap = () => inst._zod.def.innerType;
4928
+ ZodMiniType.init(inst, def);
5788
4929
  });
5789
4930
  function optional(innerType) {
5790
- return new ZodOptional({
5791
- type: "optional",
5792
- innerType
5793
- });
5794
- }
5795
- var ZodExactOptional = /* @__PURE__ */ $constructor("ZodExactOptional", (inst, def) => {
5796
- $ZodExactOptional.init(inst, def);
5797
- ZodType.init(inst, def);
5798
- inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
5799
- inst.unwrap = () => inst._zod.def.innerType;
5800
- });
5801
- function exactOptional(innerType) {
5802
- return new ZodExactOptional({
4931
+ return new ZodMiniOptional({
5803
4932
  type: "optional",
5804
4933
  innerType
5805
4934
  });
5806
4935
  }
5807
- var ZodNullable = /* @__PURE__ */ $constructor("ZodNullable", (inst, def) => {
4936
+ var ZodMiniNullable = /* @__PURE__ */ $constructor("ZodMiniNullable", (inst, def) => {
5808
4937
  $ZodNullable.init(inst, def);
5809
- ZodType.init(inst, def);
5810
- inst._zod.processJSONSchema = (ctx, json, params) => nullableProcessor(inst, ctx, json, params);
5811
- inst.unwrap = () => inst._zod.def.innerType;
4938
+ ZodMiniType.init(inst, def);
5812
4939
  });
5813
4940
  function nullable(innerType) {
5814
- return new ZodNullable({
4941
+ return new ZodMiniNullable({
5815
4942
  type: "nullable",
5816
4943
  innerType
5817
4944
  });
5818
4945
  }
5819
- var ZodDefault = /* @__PURE__ */ $constructor("ZodDefault", (inst, def) => {
5820
- $ZodDefault.init(inst, def);
5821
- ZodType.init(inst, def);
5822
- inst._zod.processJSONSchema = (ctx, json, params) => defaultProcessor(inst, ctx, json, params);
5823
- inst.unwrap = () => inst._zod.def.innerType;
5824
- inst.removeDefault = inst.unwrap;
5825
- });
5826
- function _default(innerType, defaultValue) {
5827
- return new ZodDefault({
5828
- type: "default",
5829
- innerType,
5830
- get defaultValue() {
5831
- return typeof defaultValue === "function" ? defaultValue() : shallowClone(defaultValue);
5832
- }
5833
- });
5834
- }
5835
- var ZodPrefault = /* @__PURE__ */ $constructor("ZodPrefault", (inst, def) => {
5836
- $ZodPrefault.init(inst, def);
5837
- ZodType.init(inst, def);
5838
- inst._zod.processJSONSchema = (ctx, json, params) => prefaultProcessor(inst, ctx, json, params);
5839
- inst.unwrap = () => inst._zod.def.innerType;
5840
- });
5841
- function prefault(innerType, defaultValue) {
5842
- return new ZodPrefault({
5843
- type: "prefault",
5844
- innerType,
5845
- get defaultValue() {
5846
- return typeof defaultValue === "function" ? defaultValue() : shallowClone(defaultValue);
5847
- }
5848
- });
5849
- }
5850
- var ZodNonOptional = /* @__PURE__ */ $constructor("ZodNonOptional", (inst, def) => {
5851
- $ZodNonOptional.init(inst, def);
5852
- ZodType.init(inst, def);
5853
- inst._zod.processJSONSchema = (ctx, json, params) => nonoptionalProcessor(inst, ctx, json, params);
5854
- inst.unwrap = () => inst._zod.def.innerType;
5855
- });
5856
- function nonoptional(innerType, params) {
5857
- return new ZodNonOptional({
5858
- type: "nonoptional",
5859
- innerType,
5860
- ...normalizeParams(params)
5861
- });
5862
- }
5863
- var ZodCatch = /* @__PURE__ */ $constructor("ZodCatch", (inst, def) => {
5864
- $ZodCatch.init(inst, def);
5865
- ZodType.init(inst, def);
5866
- inst._zod.processJSONSchema = (ctx, json, params) => catchProcessor(inst, ctx, json, params);
5867
- inst.unwrap = () => inst._zod.def.innerType;
5868
- inst.removeCatch = inst.unwrap;
5869
- });
5870
- function _catch(innerType, catchValue) {
5871
- return new ZodCatch({
5872
- type: "catch",
5873
- innerType,
5874
- catchValue: typeof catchValue === "function" ? catchValue : constantCatch(catchValue)
5875
- });
5876
- }
5877
- var ZodPipe = /* @__PURE__ */ $constructor("ZodPipe", (inst, def) => {
5878
- $ZodPipe.init(inst, def);
5879
- ZodType.init(inst, def);
5880
- inst._zod.processJSONSchema = (ctx, json, params) => pipeProcessor(inst, ctx, json, params);
5881
- inst.in = def.in;
5882
- inst.out = def.out;
5883
- });
5884
- function pipe(in_, out) {
5885
- return new ZodPipe({
5886
- type: "pipe",
5887
- in: in_,
5888
- out
5889
- });
5890
- }
5891
- var ZodReadonly = /* @__PURE__ */ $constructor("ZodReadonly", (inst, def) => {
5892
- $ZodReadonly.init(inst, def);
5893
- ZodType.init(inst, def);
5894
- inst._zod.processJSONSchema = (ctx, json, params) => readonlyProcessor(inst, ctx, json, params);
5895
- inst.unwrap = () => inst._zod.def.innerType;
5896
- });
5897
- function readonly(innerType) {
5898
- return new ZodReadonly({
5899
- type: "readonly",
5900
- innerType
5901
- });
5902
- }
5903
- var ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
4946
+ var ZodMiniCustom = /* @__PURE__ */ $constructor("ZodMiniCustom", (inst, def) => {
5904
4947
  $ZodCustom.init(inst, def);
5905
- ZodType.init(inst, def);
5906
- inst._zod.processJSONSchema = (ctx, json, params) => customProcessor(inst, ctx, json, params);
4948
+ ZodMiniType.init(inst, def);
5907
4949
  });
5908
4950
  function custom(fn, _params) {
5909
- return _custom(ZodCustom, fn ?? (() => true), _params);
4951
+ return _custom(ZodMiniCustom, fn ?? (() => true), _params);
5910
4952
  }
5911
4953
  function refine(fn, _params = {}) {
5912
- return _refine(ZodCustom, fn, _params);
4954
+ return _refine(ZodMiniCustom, fn, _params);
5913
4955
  }
5914
4956
  function superRefine(fn, params) {
5915
4957
  return _superRefine(fn, params);
5916
4958
  }
4959
+ // packages/workit-core/src/core/zod-mini.ts
4960
+ if (!globalConfig.localeError)
4961
+ config(en_default());
4962
+ if (!globalConfig.memoizer)
4963
+ config({ memoizer: memoizer() });
4964
+ var described = (schema, description) => {
4965
+ const copy = schema.clone();
4966
+ globalRegistry.add(copy, { description });
4967
+ return copy;
4968
+ };
4969
+
5917
4970
  // packages/workit-core/src/core/task-contract.ts
5918
4971
  var OPERATION_FAMILIES = [
5919
4972
  "task",
@@ -5943,11 +4996,11 @@ var text = string2().check((ctx) => {
5943
4996
  if (invalidUnicode(ctx.value))
5944
4997
  ctx.issues.push({ code: "custom", input: ctx.value, message: "invalid Unicode", path: [] });
5945
4998
  });
5946
- var id = text.regex(uuidPattern, "expected lowercase UUID");
4999
+ var id = text.check(_regex(uuidPattern, "expected lowercase UUID"));
5947
5000
  var idRefPattern = /^[0-9a-f][0-9a-f-]{7,35}$/;
5948
- var idRef = text.regex(idRefPattern, "expected a UUID or an id prefix of 8+ characters");
5949
- var digest = text.regex(digestPattern, "expected lowercase SHA-256 digest");
5950
- var revision = text.regex(uuidPattern, "expected UUID revision");
5001
+ var idRef = text.check(_regex(idRefPattern, "expected a UUID or an id prefix of 8+ characters"));
5002
+ var digest = text.check(_regex(digestPattern, "expected lowercase SHA-256 digest"));
5003
+ var revision = text.check(_regex(uuidPattern, "expected UUID revision"));
5951
5004
  var validUtc = (value) => {
5952
5005
  const match = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,9}))?Z$/.exec(value);
5953
5006
  if (!match)
@@ -5968,8 +5021,8 @@ var utcSchema = text.check((ctx) => {
5968
5021
  });
5969
5022
  });
5970
5023
  var utc = utcSchema;
5971
- var safeInteger = number2().int().safe();
5972
- var nonEmpty = text.min(1);
5024
+ var safeInteger = number2().check(int()).check(int());
5025
+ var nonEmpty = text.check(_minLength(1));
5973
5026
  var pathValue = nonEmpty.check((ctx) => {
5974
5027
  if (ctx.value !== "." && (ctx.value.includes("\\") || ctx.value.split("/").includes(".."))) {
5975
5028
  ctx.issues.push({
@@ -5980,8 +5033,8 @@ var pathValue = nonEmpty.check((ctx) => {
5980
5033
  });
5981
5034
  }
5982
5035
  });
5983
- var nullableDigest = digest.nullable();
5984
- var nullableId = id.nullable();
5036
+ var nullableDigest = nullable(digest);
5037
+ var nullableId = nullable(id);
5985
5038
  var hostSchema = _enum([
5986
5039
  "opencode",
5987
5040
  "cursor",
@@ -5993,49 +5046,49 @@ var hostSchema = _enum([
5993
5046
  ]);
5994
5047
  var assuranceSchema = _enum(["enforced", "agent_guided", "unavailable"]);
5995
5048
  var outcomeSchema = _enum(["verified", "accepted_limitations", "stopped"]);
5996
- var scopeSchema = object({
5049
+ var scopeSchema = strictObject({
5997
5050
  description: text,
5998
5051
  paths: array(pathValue),
5999
5052
  exclusions: array(pathValue)
6000
- }).strict();
5053
+ });
6001
5054
  var refSchema = discriminatedUnion("kind", [
6002
- object({ kind: literal("file"), path: pathValue, digest: nullableDigest }).strict(),
6003
- object({
5055
+ strictObject({ kind: literal("file"), path: pathValue, digest: nullableDigest }),
5056
+ strictObject({
6004
5057
  kind: literal("record"),
6005
5058
  collection: _enum(["evidence", "decisions", "findings", "workers"]),
6006
5059
  id
6007
- }).strict(),
6008
- object({ kind: literal("host"), host: hostSchema, handle: nonEmpty }).strict(),
6009
- object({ kind: literal("external"), url: text.url() }).strict()
5060
+ }),
5061
+ strictObject({ kind: literal("host"), host: hostSchema, handle: nonEmpty }),
5062
+ strictObject({ kind: literal("external"), url: text.check(url()) })
6010
5063
  ]);
6011
- var provenanceSchema = object({
5064
+ var provenanceSchema = strictObject({
6012
5065
  kind: _enum(["host_observed", "agent_reported", "imported"]),
6013
5066
  host: hostSchema,
6014
- session: refSchema.nullable(),
5067
+ session: nullable(refSchema),
6015
5068
  workerId: nullableId
6016
- }).strict();
6017
- var entrySchema = (data) => object({ id, recordedAt: utc, provenance: provenanceSchema, data }).strict();
5069
+ });
5070
+ var entrySchema = (data) => strictObject({ id, recordedAt: utc, provenance: provenanceSchema, data });
6018
5071
  var RISK_TIERS = ["trivial", "normal", "high"];
6019
- var judgmentSchema = object({
5072
+ var judgmentSchema = strictObject({
6020
5073
  riskTier: _enum(RISK_TIERS),
6021
5074
  behaviorChange: boolean2(),
6022
5075
  productChoiceOpen: boolean2(),
6023
5076
  needsPlan: boolean2(),
6024
- note: text.nullable(),
5077
+ note: nullable(text),
6025
5078
  refs: array(refSchema)
6026
- }).strict();
5079
+ });
6027
5080
  var legacyAssessmentSchema = looseObject({});
6028
- var constraintSchema = object({
5081
+ var constraintSchema = strictObject({
6029
5082
  id: nonEmpty,
6030
5083
  kind: _enum(["host", "project", "user"]),
6031
5084
  statement: text,
6032
5085
  source: refSchema,
6033
5086
  acceptanceAllowed: boolean2(),
6034
- requires: array(object({
5087
+ requires: array(strictObject({
6035
5088
  kind: _enum(["check", "method", "decision"]),
6036
5089
  scope: scopeSchema,
6037
5090
  refs: array(refSchema),
6038
- method: _enum([
5091
+ method: nullable(_enum([
6039
5092
  "investigation",
6040
5093
  "challenge",
6041
5094
  "artifacts",
@@ -6045,10 +5098,10 @@ var constraintSchema = object({
6045
5098
  "delegation",
6046
5099
  "continuity",
6047
5100
  "decisions"
6048
- ]).nullable(),
5101
+ ])),
6049
5102
  before: _enum(["dependent_action", "write", "close"]),
6050
- dependentAction: text.nullable()
6051
- }).strict().check((ctx) => {
5103
+ dependentAction: nullable(text)
5104
+ }).check((ctx) => {
6052
5105
  const obligation = ctx.value;
6053
5106
  const validMethod = obligation.kind === "method" && obligation.method !== null || obligation.kind !== "method" && obligation.method === null;
6054
5107
  if (!validMethod)
@@ -6059,13 +5112,17 @@ var constraintSchema = object({
6059
5112
  path: ["method"]
6060
5113
  });
6061
5114
  }))
6062
- }).strict();
6063
- var intentSchema = object({ objective: text, scope: scopeSchema, authorityRefs: array(refSchema) }).strict();
6064
- var progressSchema = object({
5115
+ });
5116
+ var intentSchema = strictObject({
5117
+ objective: text,
5118
+ scope: scopeSchema,
5119
+ authorityRefs: array(refSchema)
5120
+ });
5121
+ var progressSchema = strictObject({
6065
5122
  summary: text,
6066
- nextAction: text.nullable(),
6067
- blockers: array(object({ reason: text, dependentAction: text, refs: array(refSchema) }).strict())
6068
- }).strict();
5123
+ nextAction: nullable(text),
5124
+ blockers: array(strictObject({ reason: text, dependentAction: text, refs: array(refSchema) }))
5125
+ });
6069
5126
  var dimensionSchema = _enum([
6070
5127
  "investigation",
6071
5128
  "challenge",
@@ -6077,10 +5134,10 @@ var dimensionSchema = _enum([
6077
5134
  "continuity",
6078
5135
  "decisions"
6079
5136
  ]);
6080
- var policySchema = object({
6081
- policyVersion: text.regex(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/),
5137
+ var policySchema = strictObject({
5138
+ policyVersion: text.check(_regex(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/)),
6082
5139
  inputDigest: digest,
6083
- requirements: array(object({
5140
+ requirements: array(strictObject({
6084
5141
  id: digest,
6085
5142
  ruleId: nonEmpty,
6086
5143
  dimension: dimensionSchema,
@@ -6088,29 +5145,29 @@ var policySchema = object({
6088
5145
  reason: text,
6089
5146
  satisfaction: text,
6090
5147
  before: _enum(["dependent_action", "write", "close"]),
6091
- dependentAction: text.nullable(),
5148
+ dependentAction: nullable(text),
6092
5149
  acceptanceAllowed: boolean2()
6093
- }).strict())
6094
- }).strict();
6095
- var requirementSchema = policySchema.shape.requirements.element;
6096
- var policyChangeSchema = object({
5150
+ }))
5151
+ });
5152
+ var requirementSchema = policySchema.shape.requirements._zod.def.element;
5153
+ var policyChangeSchema = strictObject({
6097
5154
  recordedAt: utc,
6098
5155
  fromInputDigest: nullableDigest,
6099
5156
  toInputDigest: digest,
6100
5157
  added: array(digest),
6101
5158
  retired: array(digest),
6102
5159
  reason: text
6103
- }).strict();
6104
- var candidateSchema = object({
5160
+ });
5161
+ var candidateSchema = strictObject({
6105
5162
  id: digest,
6106
5163
  scope: scopeSchema,
6107
5164
  completeness: _enum(["known", "uncertain"]),
6108
- files: array(object({
5165
+ files: array(strictObject({
6109
5166
  path: pathValue,
6110
5167
  kind: _enum(["file", "symlink", "absent"]),
6111
5168
  digest: nullableDigest,
6112
- executable: boolean2().nullable()
6113
- }).strict().check((ctx) => {
5169
+ executable: nullable(boolean2())
5170
+ }).check((ctx) => {
6114
5171
  const file = ctx.value;
6115
5172
  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;
6116
5173
  if (!valid)
@@ -6121,7 +5178,7 @@ var candidateSchema = object({
6121
5178
  path: []
6122
5179
  });
6123
5180
  })),
6124
- environment: array(object({ name: nonEmpty, value: text.nullable(), refs: array(refSchema) }).strict()).check((ctx) => {
5181
+ environment: array(strictObject({ name: nonEmpty, value: nullable(text), refs: array(refSchema) })).check((ctx) => {
6125
5182
  if (new Set(ctx.value.map((value) => value.name)).size !== ctx.value.length)
6126
5183
  ctx.issues.push({
6127
5184
  code: "custom",
@@ -6130,8 +5187,8 @@ var candidateSchema = object({
6130
5187
  path: []
6131
5188
  });
6132
5189
  }),
6133
- head: text.nullable()
6134
- }).strict().check((ctx) => {
5190
+ head: nullable(text)
5191
+ }).check((ctx) => {
6135
5192
  if (ctx.value.id !== candidateDigest(ctx.value))
6136
5193
  ctx.issues.push({
6137
5194
  code: "custom",
@@ -6140,257 +5197,337 @@ var candidateSchema = object({
6140
5197
  path: ["id"]
6141
5198
  });
6142
5199
  });
6143
- var checkObservationSchema = object({
5200
+ var checkObservationSchema = strictObject({
6144
5201
  observer: literal("workit_cli"),
6145
- name: nonEmpty.nullable(),
5202
+ name: nullable(nonEmpty),
6146
5203
  configured: boolean2(),
6147
- argv: array(text).min(1),
5204
+ argv: array(text).check(_minLength(1)),
6148
5205
  shell: boolean2(),
6149
5206
  cwd: nonEmpty,
6150
5207
  exitCode: safeInteger,
6151
- durationMs: safeInteger.min(0),
5208
+ durationMs: safeInteger.check(_gte(0)),
6152
5209
  timedOut: boolean2(),
6153
- head: text.nullable(),
6154
- tree: text.nullable(),
6155
- dirty: boolean2().nullable(),
6156
- signal: text.nullable(),
6157
- treeAfter: text.nullable(),
5210
+ head: nullable(text),
5211
+ tree: nullable(text),
5212
+ dirty: nullable(boolean2()),
5213
+ signal: nullable(text),
5214
+ treeAfter: nullable(text),
6158
5215
  modifiedWorktree: boolean2(),
6159
- base: text.nullable(),
6160
- patchId: text.nullable(),
6161
- environment: object({
5216
+ base: nullable(text),
5217
+ patchId: nullable(text),
5218
+ environment: strictObject({
6162
5219
  platform: nonEmpty,
6163
5220
  arch: nonEmpty,
6164
- vars: record(nonEmpty, text.nullable())
6165
- }).strict(),
6166
- logDigest: text.nullable(),
6167
- logRef: text.nullable(),
6168
- logTail: array(text).max(40),
6169
- ledgerRowId: text.nullable(),
6170
- attestation: object({ host: nonEmpty, session: text.nullable(), agentId: text.nullable() }).strict().nullable()
6171
- }).strict();
5221
+ vars: record(nonEmpty, nullable(text))
5222
+ }),
5223
+ logDigest: nullable(text),
5224
+ logRef: nullable(text),
5225
+ logTail: array(text).check(_maxLength(40)),
5226
+ ledgerRowId: nullable(text),
5227
+ attestation: nullable(strictObject({ host: nonEmpty, session: nullable(text), agentId: nullable(text) }))
5228
+ });
6172
5229
  var evidenceFields = {
6173
5230
  kind: _enum(["check", "review", "investigation", "artifact"]),
6174
5231
  claim: text,
6175
5232
  requirementIds: array(digest),
6176
- beforeCandidateId: nullableDigest.optional(),
6177
- candidateId: nullableDigest.optional(),
5233
+ beforeCandidateId: optional(nullableDigest),
5234
+ candidateId: optional(nullableDigest),
6178
5235
  result: _enum(["passed", "failed", "missing", "skipped"]),
6179
5236
  summary: text,
6180
5237
  refs: array(refSchema),
6181
- exitCode: safeInteger.nullable(),
6182
- reviewContext: refSchema.nullable()
5238
+ exitCode: nullable(safeInteger),
5239
+ reviewContext: nullable(refSchema)
6183
5240
  };
6184
- var evidenceSchema = object({ ...evidenceFields, observation: checkObservationSchema.optional() }).strict();
6185
- var reportedEvidenceSchema = object(evidenceFields).strict();
6186
- var evidenceEvaluationSchema = object({
5241
+ var evidenceSchema = strictObject({
5242
+ ...evidenceFields,
5243
+ observation: optional(checkObservationSchema)
5244
+ });
5245
+ var reportedEvidenceSchema = strictObject(evidenceFields);
5246
+ var evidenceEvaluationSchema = strictObject({
6187
5247
  evidenceId: id,
6188
5248
  status: _enum(["passed", "failed", "missing", "skipped", "stale"]),
6189
5249
  reason: text
6190
- }).strict();
6191
- var decisionSchema = object({
5250
+ });
5251
+ var decisionSchema = strictObject({
6192
5252
  purpose: _enum(["design", "action", "limitation", "preference"]),
6193
- binding: object({
5253
+ binding: strictObject({
6194
5254
  taskId: id,
6195
5255
  workspaceId: id,
6196
5256
  scope: scopeSchema,
6197
5257
  presented: text,
6198
5258
  contentRefs: array(refSchema),
6199
- statedChoice: object({ ref: text, text }).strict().optional()
6200
- }).strict(),
5259
+ statedChoice: optional(strictObject({ ref: text, text }))
5260
+ }),
6201
5261
  digest,
6202
5262
  response: _enum(["approved", "rejected", "stated"]),
6203
5263
  requirementIds: array(digest),
6204
- revoked: object({ at: utc, reason: text }).strict().nullable()
6205
- }).strict();
6206
- var findingSchema = object({
5264
+ revoked: nullable(strictObject({ at: utc, reason: text }))
5265
+ });
5266
+ var findingSchema = strictObject({
6207
5267
  claim: text,
6208
5268
  consequence: text,
6209
5269
  scope: scopeSchema,
6210
5270
  candidateId: nullableDigest,
6211
5271
  refs: array(refSchema),
6212
5272
  disposition: _enum(["open", "fixed", "dismissed", "deferred"]),
6213
- resolution: object({ reason: text, evidenceIds: array(id), decisionIds: array(id) }).strict().nullable(),
6214
- leadOwned: literal(true).optional()
6215
- }).strict();
6216
- var assignmentSchema = object({
5273
+ resolution: nullable(strictObject({ reason: text, evidenceIds: array(id), decisionIds: array(id) })),
5274
+ leadOwned: optional(literal(true))
5275
+ });
5276
+ var assignmentSchema = strictObject({
6217
5277
  role: _enum(["investigator", "reviewer", "implementer"]),
6218
5278
  objective: text,
6219
5279
  scope: scopeSchema,
6220
5280
  decisionIds: array(id),
6221
5281
  requirementIds: array(digest),
6222
- candidateId: nullableDigest.optional(),
5282
+ candidateId: optional(nullableDigest),
6223
5283
  stoppingCondition: text
6224
- }).strict();
6225
- var workerReportSchema = object({
5284
+ });
5285
+ var workerReportSchema = strictObject({
6226
5286
  outcome: _enum(["completed", "failed", "cancelled"]),
6227
5287
  summary: text,
6228
5288
  evidenceIds: array(id),
6229
5289
  findingIds: array(idRef)
6230
- }).strict();
6231
- var workerSchema = object({
5290
+ });
5291
+ var workerSchema = strictObject({
6232
5292
  assignment: assignmentSchema,
6233
5293
  state: _enum(["assigned", "dispatching", "running", "cancelling", "stopped", "unknown"]),
6234
- session: refSchema.nullable(),
6235
- coordinator: refSchema.optional(),
6236
- report: workerReportSchema.nullable()
6237
- }).strict();
6238
- var closureSchema = object({
5294
+ session: nullable(refSchema),
5295
+ coordinator: optional(refSchema),
5296
+ report: nullable(workerReportSchema)
5297
+ });
5298
+ var closureSchema = strictObject({
6239
5299
  outcome: outcomeSchema,
6240
5300
  at: utc,
6241
5301
  summary: text,
6242
5302
  decisionIds: array(id),
6243
5303
  evidenceIds: array(id)
6244
- }).strict();
6245
- var runtimeSchema = object({
6246
- createdWith: text.nullable(),
5304
+ });
5305
+ var runtimeSchema = strictObject({
5306
+ createdWith: nullable(text),
6247
5307
  updatedWith: text
6248
- }).strict();
6249
- var taskRecordSchema = object({
5308
+ });
5309
+ var taskRecordSchema = strictObject({
6250
5310
  schemaVersion: literal(1),
6251
5311
  id,
6252
5312
  workspaceId: id,
6253
5313
  revision,
6254
5314
  createdAt: utc,
6255
5315
  updatedAt: utc,
6256
- origin: object({ workspaceId: id, taskId: id, exportDigest: digest }).strict().nullable(),
5316
+ origin: nullable(strictObject({ workspaceId: id, taskId: id, exportDigest: digest })),
6257
5317
  intent: entrySchema(intentSchema),
6258
5318
  constraints: array(constraintSchema),
6259
5319
  status: _enum(["active", "paused", "closed"]),
6260
- closure: closureSchema.nullable(),
5320
+ closure: nullable(closureSchema),
6261
5321
  progress: progressSchema,
6262
- pauseReason: text.nullable().optional(),
6263
- runtime: runtimeSchema.optional(),
5322
+ pauseReason: optional(nullable(text)),
5323
+ runtime: optional(runtimeSchema),
6264
5324
  assessments: array(entrySchema(legacyAssessmentSchema)),
6265
- judgments: array(entrySchema(judgmentSchema)).optional(),
6266
- policy: policySchema.nullable(),
5325
+ judgments: optional(array(entrySchema(judgmentSchema))),
5326
+ policy: nullable(policySchema),
6267
5327
  policyChanges: array(policyChangeSchema),
6268
5328
  candidates: array(candidateSchema),
6269
5329
  evidence: array(entrySchema(evidenceSchema)),
6270
5330
  decisions: array(entrySchema(decisionSchema)),
6271
5331
  findings: array(entrySchema(findingSchema)),
6272
5332
  workers: array(entrySchema(workerSchema)),
6273
- critical: array(nonEmpty).optional()
6274
- }).strict();
6275
- var workspaceRecordSchema = object({
5333
+ critical: optional(array(nonEmpty))
5334
+ });
5335
+ var workspaceRecordSchema = strictObject({
6276
5336
  schemaVersion: literal(1),
6277
5337
  id,
6278
5338
  revision,
6279
5339
  root: nonEmpty,
6280
- runtime: runtimeSchema.optional(),
6281
- critical: array(nonEmpty).optional()
6282
- }).strict();
6283
- var capabilitySchema = object({
5340
+ runtime: optional(runtimeSchema),
5341
+ critical: optional(array(nonEmpty))
5342
+ });
5343
+ var capabilitySchema = strictObject({
6284
5344
  name: nonEmpty,
6285
5345
  surface: nonEmpty,
6286
5346
  assurance: assuranceSchema,
6287
5347
  reason: text,
6288
5348
  refs: array(refSchema)
6289
- }).strict();
6290
- var requirementEvaluationSchema = object({
5349
+ });
5350
+ var requirementEvaluationSchema = strictObject({
6291
5351
  requirementId: digest,
6292
5352
  status: _enum(["satisfied", "unsatisfied", "accepted_limitation", "unavailable"]),
6293
5353
  evidenceIds: array(id),
6294
5354
  decisionIds: array(id),
6295
5355
  reason: text
6296
- }).strict();
6297
- var taskViewSchema = object({
5356
+ });
5357
+ var taskViewSchema = strictObject({
6298
5358
  task: taskRecordSchema,
6299
5359
  workspace: workspaceRecordSchema,
6300
5360
  capabilities: array(capabilitySchema),
6301
5361
  requirements: array(requirementEvaluationSchema),
6302
5362
  evidence: array(evidenceEvaluationSchema)
6303
- }).strict();
6304
- var taskSummarySchema = object({
5363
+ });
5364
+ var taskSummarySchema = strictObject({
6305
5365
  id,
6306
5366
  revision,
6307
5367
  workspaceRevision: revision,
6308
5368
  createdAt: utc,
6309
5369
  updatedAt: utc,
6310
- runtime: runtimeSchema.nullable(),
5370
+ runtime: nullable(runtimeSchema),
6311
5371
  objective: text,
6312
5372
  status: _enum(["active", "paused", "closed"]),
6313
- closure: closureSchema.nullable(),
5373
+ closure: nullable(closureSchema),
6314
5374
  progress: progressSchema,
6315
- policy: policySchema.nullable(),
5375
+ policy: nullable(policySchema),
6316
5376
  requirements: array(requirementEvaluationSchema)
6317
- }).strict();
6318
- var taskListItemSchema = taskSummarySchema.omit({ policy: true, requirements: true }).extend({ source: provenanceSchema.pick({ host: true, kind: true }) }).strict();
6319
- var exportBundleSchema = object({
5377
+ });
5378
+ var taskListItemSchema = extend2(omit2(taskSummarySchema, { policy: true, requirements: true }), { source: pick2(provenanceSchema, { host: true, kind: true }) });
5379
+ var exportBundleSchema = strictObject({
6320
5380
  schemaVersion: literal(1),
6321
5381
  exportedAt: utc,
6322
5382
  sourceWorkspaceId: id,
6323
5383
  task: taskRecordSchema,
6324
5384
  digest
6325
- }).strict();
6326
- var callerSchema = object({ host: hostSchema, actor: text }).strict();
6327
- var base = { schemaVersion: literal(1) };
6328
- var revisions = {
6329
- expectedRevision: revision.optional(),
6330
- expectedWorkspaceRevision: revision.optional()
6331
- };
6332
- var taskId = { taskId: id };
6333
- var operation = (shape) => object({ ...base, ...shape }).strict();
6334
- var taskOperations = {
6335
- start: operation({
6336
- action: literal("start"),
6337
- expectedWorkspaceRevision: revision.nullable().optional(),
6338
- intent: intentSchema
6339
- }),
6340
- list: operation({
6341
- action: literal("list"),
6342
- status: _enum(["open", "closed", "all"]).optional(),
6343
- query: string2().trim().min(1).max(200).optional(),
6344
- limit: number2().int().min(1).max(50).optional()
6345
- }),
6346
- inspect: operation({
6347
- action: literal("inspect"),
6348
- ...taskId,
6349
- view: _enum(["summary", "full"]).optional()
6350
- }),
6351
- revise: operation({
6352
- action: literal("revise"),
6353
- ...taskId,
6354
- ...revisions,
6355
- expectedWorkspaceRevision: revision.optional(),
6356
- intent: intentSchema,
6357
- reason: text
6358
- }),
6359
- progress: operation({
6360
- action: literal("progress"),
6361
- ...taskId,
6362
- expectedRevision: revision.optional(),
6363
- progress: progressSchema
6364
- }),
6365
- pause: operation({
6366
- action: literal("pause"),
6367
- ...taskId,
6368
- ...revisions,
6369
- expectedWorkspaceRevision: revision.optional(),
6370
- reason: text
6371
- }),
6372
- resume: operation({
6373
- action: literal("resume"),
6374
- ...taskId,
6375
- ...revisions,
6376
- expectedWorkspaceRevision: revision.optional()
6377
- }),
6378
- close: operation({
6379
- action: literal("close"),
6380
- ...taskId,
6381
- ...revisions,
6382
- expectedWorkspaceRevision: revision.optional(),
6383
- outcome: outcomeSchema,
6384
- summary: text,
6385
- decisionIds: array(id).optional()
6386
- })
6387
- };
6388
- var rawJudgment = record(string2(), unknown());
6389
- var policyOperations = {
6390
- assess: operation({
6391
- action: literal("assess"),
5385
+ });
5386
+ var callerSchema = strictObject({ host: hostSchema, actor: text });
5387
+ var success = (revisionValue, workspaceRevisionValue, data) => ({
5388
+ ok: true,
5389
+ schemaVersion: 1,
5390
+ revision: revisionValue,
5391
+ workspaceRevision: workspaceRevisionValue,
5392
+ data
5393
+ });
5394
+ var failure2 = (code, error, details = {}) => ({ ok: false, schemaVersion: 1, code, error, details });
5395
+ function canonical(value, seen) {
5396
+ if (value === null || typeof value === "boolean" || typeof value === "string") {
5397
+ if (typeof value === "string" && invalidUnicode(value))
5398
+ throw new TypeError("invalid Unicode");
5399
+ return value;
5400
+ }
5401
+ if (typeof value === "number") {
5402
+ if (!Number.isSafeInteger(value))
5403
+ throw new TypeError("number must be a finite safe integer");
5404
+ return value;
5405
+ }
5406
+ if (typeof value !== "object")
5407
+ throw new TypeError("value is not JSON serializable");
5408
+ if (seen.has(value))
5409
+ throw new TypeError("cyclic value");
5410
+ seen.add(value);
5411
+ let result;
5412
+ if (Array.isArray(value)) {
5413
+ for (let index = 0;index < value.length; index += 1) {
5414
+ if (!(index in value))
5415
+ throw new TypeError("sparse array");
5416
+ }
5417
+ result = value.map((item) => canonical(item, seen));
5418
+ } else {
5419
+ if (Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null)
5420
+ throw new TypeError("value is not a JSON object");
5421
+ if (Reflect.ownKeys(value).some((key) => typeof key !== "string"))
5422
+ throw new TypeError("symbol key is not JSON");
5423
+ if (Object.keys(value).some((key) => invalidUnicode(key)))
5424
+ throw new TypeError("invalid Unicode");
5425
+ result = Object.fromEntries(Object.keys(value).toSorted().map((key) => [key, canonical(value[key], seen)]));
5426
+ }
5427
+ seen.delete(value);
5428
+ return result;
5429
+ }
5430
+ function canonicalJson(value) {
5431
+ return JSON.stringify(canonical(value, new Set));
5432
+ }
5433
+ function sha256(value) {
5434
+ if (typeof value === "string" && invalidUnicode(value))
5435
+ throw new TypeError("invalid Unicode");
5436
+ return createHash("sha256").update(typeof value === "string" ? value : canonicalJson(value), "utf8").digest("hex");
5437
+ }
5438
+ var compareCodeUnits = (left, right) => {
5439
+ const length = Math.min(left.length, right.length);
5440
+ for (let index = 0;index < length; index += 1) {
5441
+ const difference = left.charCodeAt(index) - right.charCodeAt(index);
5442
+ if (difference !== 0)
5443
+ return difference;
5444
+ }
5445
+ return left.length - right.length;
5446
+ };
5447
+ var compareNullableText = (left, right) => left === right ? 0 : left === null ? -1 : right === null ? 1 : compareCodeUnits(left, right);
5448
+ var compareBooleanNullable = (left, right) => left === right ? 0 : left === null ? -1 : right === null ? 1 : Number(left) - Number(right);
5449
+ function candidateDigest(input) {
5450
+ const normalizedScope = {
5451
+ description: input.scope.description,
5452
+ paths: [...input.scope.paths].toSorted(compareCodeUnits),
5453
+ exclusions: [...input.scope.exclusions].toSorted(compareCodeUnits)
5454
+ };
5455
+ return sha256({
5456
+ scope: normalizedScope,
5457
+ completeness: input.completeness,
5458
+ 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)),
5459
+ environment: input.environment.map(({ name, value }) => ({ name, value })).toSorted((left, right) => compareCodeUnits(left.name, right.name) || compareNullableText(left.value, right.value)),
5460
+ head: input.head
5461
+ });
5462
+ }
5463
+ // packages/workit-core/src/core/operations.ts
5464
+ var base = { schemaVersion: literal(1) };
5465
+ var revisions = {
5466
+ expectedRevision: optional(revision),
5467
+ expectedWorkspaceRevision: optional(revision)
5468
+ };
5469
+ var taskId = { taskId: id };
5470
+ var operation = (shape) => strictObject({ ...base, ...shape });
5471
+ var taskOperations = {
5472
+ start: operation({
5473
+ action: literal("start"),
5474
+ expectedWorkspaceRevision: optional(nullable(revision)),
5475
+ intent: intentSchema
5476
+ }),
5477
+ list: operation({
5478
+ action: literal("list"),
5479
+ status: optional(_enum(["open", "closed", "all"])),
5480
+ query: optional(string2().check(_trim()).check(_minLength(1)).check(_maxLength(200))),
5481
+ limit: optional(number2().check(int()).check(_gte(1)).check(_lte(50)))
5482
+ }),
5483
+ inspect: operation({
5484
+ action: literal("inspect"),
5485
+ ...taskId,
5486
+ view: optional(_enum(["summary", "full"]))
5487
+ }),
5488
+ revise: operation({
5489
+ action: literal("revise"),
5490
+ ...taskId,
5491
+ ...revisions,
5492
+ expectedWorkspaceRevision: optional(revision),
5493
+ intent: intentSchema,
5494
+ reason: text
5495
+ }),
5496
+ progress: operation({
5497
+ action: literal("progress"),
5498
+ ...taskId,
5499
+ expectedRevision: optional(revision),
5500
+ progress: progressSchema
5501
+ }),
5502
+ pause: operation({
5503
+ action: literal("pause"),
5504
+ ...taskId,
5505
+ ...revisions,
5506
+ expectedWorkspaceRevision: optional(revision),
5507
+ reason: text
5508
+ }),
5509
+ resume: operation({
5510
+ action: literal("resume"),
5511
+ ...taskId,
5512
+ ...revisions,
5513
+ expectedWorkspaceRevision: optional(revision)
5514
+ }),
5515
+ close: operation({
5516
+ action: literal("close"),
5517
+ ...taskId,
5518
+ ...revisions,
5519
+ expectedWorkspaceRevision: optional(revision),
5520
+ outcome: outcomeSchema,
5521
+ summary: text,
5522
+ decisionIds: optional(array(id))
5523
+ })
5524
+ };
5525
+ var rawJudgment = record(string2(), unknown());
5526
+ var policyOperations = {
5527
+ assess: operation({
5528
+ action: literal("assess"),
6392
5529
  ...taskId,
6393
- expectedRevision: revision.optional(),
5530
+ expectedRevision: optional(revision),
6394
5531
  judgment: rawJudgment
6395
5532
  }),
6396
5533
  preview: operation({ action: literal("preview"), ...taskId, judgment: rawJudgment }),
@@ -6400,7 +5537,7 @@ var evidenceOperations = {
6400
5537
  record: operation({
6401
5538
  action: literal("record"),
6402
5539
  ...taskId,
6403
- expectedRevision: revision.optional(),
5540
+ expectedRevision: optional(revision),
6404
5541
  evidence: reportedEvidenceSchema
6405
5542
  })
6406
5543
  };
@@ -6408,17 +5545,17 @@ var findingOperations = {
6408
5545
  record: operation({
6409
5546
  action: literal("record"),
6410
5547
  ...taskId,
6411
- expectedRevision: revision.optional(),
5548
+ expectedRevision: optional(revision),
6412
5549
  claim: text,
6413
5550
  consequence: text,
6414
5551
  scope: scopeSchema,
6415
- candidateId: nullableDigest.optional(),
5552
+ candidateId: optional(nullableDigest),
6416
5553
  refs: array(refSchema)
6417
5554
  }),
6418
5555
  resolve: operation({
6419
5556
  action: literal("resolve"),
6420
5557
  ...taskId,
6421
- expectedRevision: revision.optional(),
5558
+ expectedRevision: optional(revision),
6422
5559
  findingId: idRef,
6423
5560
  disposition: _enum(["open", "fixed", "dismissed", "deferred"]),
6424
5561
  reason: text,
@@ -6430,11 +5567,11 @@ var decisionOperations = {
6430
5567
  record: operation({
6431
5568
  action: literal("record"),
6432
5569
  ...taskId,
6433
- expectedRevision: revision.optional(),
5570
+ expectedRevision: optional(revision),
6434
5571
  purpose: decisionSchema.shape.purpose,
6435
- binding: decisionSchema.shape.binding.extend({
6436
- taskId: id.optional(),
6437
- workspaceId: id.optional()
5572
+ binding: extend2(decisionSchema.shape.binding, {
5573
+ taskId: optional(id),
5574
+ workspaceId: optional(id)
6438
5575
  }),
6439
5576
  response: decisionSchema.shape.response,
6440
5577
  requirementIds: array(digest)
@@ -6442,7 +5579,7 @@ var decisionOperations = {
6442
5579
  revoke: operation({
6443
5580
  action: literal("revoke"),
6444
5581
  ...taskId,
6445
- expectedRevision: revision.optional(),
5582
+ expectedRevision: optional(revision),
6446
5583
  decisionId: id,
6447
5584
  reason: text
6448
5585
  })
@@ -6452,14 +5589,14 @@ var workerOperations = {
6452
5589
  action: literal("assign"),
6453
5590
  ...taskId,
6454
5591
  ...revisions,
6455
- expectedWorkspaceRevision: revision.optional(),
5592
+ expectedWorkspaceRevision: optional(revision),
6456
5593
  assignment: assignmentSchema
6457
5594
  }),
6458
5595
  report: operation({
6459
5596
  action: literal("report"),
6460
5597
  ...taskId,
6461
- expectedRevision: revision.optional(),
6462
- expectedWorkspaceRevision: revision.optional(),
5598
+ expectedRevision: optional(revision),
5599
+ expectedWorkspaceRevision: optional(revision),
6463
5600
  workerId: idRef,
6464
5601
  report: workerReportSchema
6465
5602
  }),
@@ -6467,7 +5604,7 @@ var workerOperations = {
6467
5604
  action: literal("cancel"),
6468
5605
  ...taskId,
6469
5606
  ...revisions,
6470
- expectedWorkspaceRevision: revision.optional(),
5607
+ expectedWorkspaceRevision: optional(revision),
6471
5608
  workerId: idRef,
6472
5609
  reason: text
6473
5610
  })
@@ -6476,7 +5613,7 @@ var stateOperations = {
6476
5613
  export: operation({ action: literal("export"), ...taskId }),
6477
5614
  import: operation({
6478
5615
  action: literal("import"),
6479
- expectedWorkspaceRevision: revision.nullable().optional(),
5616
+ expectedWorkspaceRevision: optional(nullable(revision)),
6480
5617
  bundle: exportBundleSchema
6481
5618
  })
6482
5619
  };
@@ -6498,7 +5635,7 @@ var OPERATION_ACTIONS = {
6498
5635
  worker: Object.keys(workerOperations),
6499
5636
  state: Object.keys(stateOperations)
6500
5637
  };
6501
- var withImplicitTask = (options) => Object.values(options).map((option) => ("taskId" in option.shape) ? option.extend({ taskId: id.optional() }) : option);
5638
+ var withImplicitTask = (options) => Object.values(options).map((option) => ("taskId" in option.shape) ? extend2(option, { taskId: optional(id) }) : option);
6502
5639
  var advertised = (options) => discriminatedUnion("action", withImplicitTask(options));
6503
5640
  var advertisedOperationSchemas = {
6504
5641
  task: advertised(taskOperations),
@@ -6509,82 +5646,6 @@ var advertisedOperationSchemas = {
6509
5646
  worker: advertised(workerOperations),
6510
5647
  state: advertised(stateOperations)
6511
5648
  };
6512
- var success = (revisionValue, workspaceRevisionValue, data) => ({
6513
- ok: true,
6514
- schemaVersion: 1,
6515
- revision: revisionValue,
6516
- workspaceRevision: workspaceRevisionValue,
6517
- data
6518
- });
6519
- var failure2 = (code, error, details = {}) => ({ ok: false, schemaVersion: 1, code, error, details });
6520
- function canonical(value, seen) {
6521
- if (value === null || typeof value === "boolean" || typeof value === "string") {
6522
- if (typeof value === "string" && invalidUnicode(value))
6523
- throw new TypeError("invalid Unicode");
6524
- return value;
6525
- }
6526
- if (typeof value === "number") {
6527
- if (!Number.isSafeInteger(value))
6528
- throw new TypeError("number must be a finite safe integer");
6529
- return value;
6530
- }
6531
- if (typeof value !== "object")
6532
- throw new TypeError("value is not JSON serializable");
6533
- if (seen.has(value))
6534
- throw new TypeError("cyclic value");
6535
- seen.add(value);
6536
- let result;
6537
- if (Array.isArray(value)) {
6538
- for (let index = 0;index < value.length; index += 1) {
6539
- if (!(index in value))
6540
- throw new TypeError("sparse array");
6541
- }
6542
- result = value.map((item) => canonical(item, seen));
6543
- } else {
6544
- if (Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null)
6545
- throw new TypeError("value is not a JSON object");
6546
- if (Reflect.ownKeys(value).some((key) => typeof key !== "string"))
6547
- throw new TypeError("symbol key is not JSON");
6548
- if (Object.keys(value).some((key) => invalidUnicode(key)))
6549
- throw new TypeError("invalid Unicode");
6550
- result = Object.fromEntries(Object.keys(value).toSorted().map((key) => [key, canonical(value[key], seen)]));
6551
- }
6552
- seen.delete(value);
6553
- return result;
6554
- }
6555
- function canonicalJson(value) {
6556
- return JSON.stringify(canonical(value, new Set));
6557
- }
6558
- function sha256(value) {
6559
- if (typeof value === "string" && invalidUnicode(value))
6560
- throw new TypeError("invalid Unicode");
6561
- return createHash("sha256").update(typeof value === "string" ? value : canonicalJson(value), "utf8").digest("hex");
6562
- }
6563
- var compareCodeUnits = (left, right) => {
6564
- const length = Math.min(left.length, right.length);
6565
- for (let index = 0;index < length; index += 1) {
6566
- const difference = left.charCodeAt(index) - right.charCodeAt(index);
6567
- if (difference !== 0)
6568
- return difference;
6569
- }
6570
- return left.length - right.length;
6571
- };
6572
- var compareNullableText = (left, right) => left === right ? 0 : left === null ? -1 : right === null ? 1 : compareCodeUnits(left, right);
6573
- var compareBooleanNullable = (left, right) => left === right ? 0 : left === null ? -1 : right === null ? 1 : Number(left) - Number(right);
6574
- function candidateDigest(input) {
6575
- const normalizedScope = {
6576
- description: input.scope.description,
6577
- paths: [...input.scope.paths].toSorted(compareCodeUnits),
6578
- exclusions: [...input.scope.exclusions].toSorted(compareCodeUnits)
6579
- };
6580
- return sha256({
6581
- scope: normalizedScope,
6582
- completeness: input.completeness,
6583
- 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)),
6584
- environment: input.environment.map(({ name, value }) => ({ name, value })).toSorted((left, right) => compareCodeUnits(left.name, right.name) || compareNullableText(left.value, right.value)),
6585
- head: input.head
6586
- });
6587
- }
6588
5649
  // packages/workit-core/src/core/operation-input.ts
6589
5650
  var str = (d, values) => ({
6590
5651
  type: "string",
@@ -7359,59 +6420,57 @@ var remotePattern = (pattern) => {
7359
6420
  };
7360
6421
 
7361
6422
  // packages/workit-core/src/core/workspaces.ts
7362
- var nonBlank = string2().refine((value) => value.trim().length > 0, "must not be blank");
6423
+ var nonBlank = string2().check(refine((value) => value.trim().length > 0, "must not be blank"));
7363
6424
  var branchPreset = custom((value) => typeof value === "string" && Object.hasOwn(PRESETS, value), "unsupported branch preset");
7364
6425
  var commitPreset = custom((value) => typeof value === "string" && COMMIT_PRESETS.includes(value), "unsupported commit preset");
7365
- var workspaceBranchPolicySchema = object({
7366
- preset: branchPreset.describe("The branch model: gitflow, github-flow, trunk-based or custom (allowed/protected set by hand)."),
7367
- developBranch: nonBlank.optional().describe("The integration branch gitflow uses (default develop)."),
7368
- prefixes: object({
6426
+ var workspaceBranchPolicySchema = strictObject({
6427
+ preset: described(branchPreset, "The branch model: gitflow, github-flow, trunk-based or custom (allowed/protected set by hand)."),
6428
+ developBranch: described(optional(nonBlank), "The integration branch gitflow uses (default develop)."),
6429
+ prefixes: described(optional(looseObject({
7369
6430
  feature: nonBlank,
7370
6431
  bugfix: nonBlank,
7371
6432
  release: nonBlank,
7372
6433
  hotfix: nonBlank
7373
- }).passthrough().optional().describe("The branch prefix per kind (feature/, bugfix/, release/, hotfix/)."),
7374
- allowed: array(nonBlank).optional().describe("Branch name globs a new branch must match (`feature/*`)."),
7375
- protected: array(nonBlank).optional().describe("Branches nobody commits or pushes to directly."),
7376
- integration: _enum(["pr", "merge"]).optional().describe("How work reaches its base: `pr` (default) opens a PR, `merge` merges locally.")
7377
- }).strict();
7378
- var workspaceCommitPolicySchema = object({
7379
- preset: commitPreset.describe("The commit message flavor, e.g. conventional."),
7380
- pattern: string2().optional().describe("A regular expression every commit subject must match.")
7381
- }).strict();
7382
- var workspaceProfileSchema = object({
7383
- branchPolicy: workspaceBranchPolicySchema.optional().describe("This profile's branch policy."),
7384
- commitPolicy: workspaceCommitPolicySchema.optional().describe("This profile's commit policy.")
7385
- }).strict().refine((profile) => profile.branchPolicy !== undefined || profile.commitPolicy !== undefined, {
7386
- message: "a profile must define branchPolicy or commitPolicy"
7387
- });
6434
+ })), "The branch prefix per kind (feature/, bugfix/, release/, hotfix/)."),
6435
+ allowed: described(optional(array(nonBlank)), "Branch name globs a new branch must match (`feature/*`)."),
6436
+ protected: described(optional(array(nonBlank)), "Branches nobody commits or pushes to directly."),
6437
+ integration: described(optional(_enum(["pr", "merge"])), "How work reaches its base: `pr` (default) opens a PR, `merge` merges locally.")
6438
+ });
6439
+ var workspaceCommitPolicySchema = strictObject({
6440
+ preset: described(commitPreset, "The commit message flavor, e.g. conventional."),
6441
+ pattern: described(optional(string2()), "A regular expression every commit subject must match.")
6442
+ });
6443
+ var workspaceProfileSchema = strictObject({
6444
+ branchPolicy: described(optional(workspaceBranchPolicySchema), "This profile's branch policy."),
6445
+ commitPolicy: described(optional(workspaceCommitPolicySchema), "This profile's commit policy.")
6446
+ }).check(refine((profile) => profile.branchPolicy !== undefined || profile.commitPolicy !== undefined, { message: "a profile must define branchPolicy or commitPolicy" }));
7388
6447
  var versionSourceSchema = discriminatedUnion("kind", [
7389
- object({
6448
+ strictObject({
7390
6449
  kind: literal("package-json"),
7391
6450
  path: nonBlank,
7392
6451
  field: nonBlank
7393
- }).strict(),
7394
- object({ kind: literal("git-tag") }).strict(),
7395
- object({ kind: literal("manual") }).strict()
6452
+ }),
6453
+ strictObject({ kind: literal("git-tag") }),
6454
+ strictObject({ kind: literal("manual") })
7396
6455
  ]);
7397
- var releaseTrackSchema = object({
7398
- strategy: branchPreset.optional().describe("The branch model this track follows."),
7399
- productionBranch: nonBlank.describe("The branch releases land on (main)."),
7400
- integrationBranch: nonBlank.describe("The branch work integrates into (develop)."),
7401
- naming: object({
7402
- feature: nonBlank.optional(),
7403
- release: nonBlank.optional(),
7404
- hotfix: nonBlank.optional()
7405
- }).passthrough().optional().describe("Branch name templates per kind, e.g. `feature/{name}`."),
7406
- baseBranch: nonBlank.optional().describe("The branch new work starts from."),
7407
- mergeBackBranches: array(nonBlank).optional().describe("Branches a finished release or hotfix is merged back into."),
7408
- pullRequestTarget: nonBlank.optional().describe("The branch PRs target."),
7409
- tagNamespace: string2().optional().describe("A prefix for this track's release tags."),
7410
- versionSource: versionSourceSchema.optional().describe("Where the version comes from: package-json, git-tag or manual."),
7411
- requiredChecks: array(nonBlank).optional().describe("CI checks that must pass before a release."),
7412
- critical: array(nonBlank).optional().describe("Fields an older Workit must not ignore: when one is unknown or malformed, Workit fails closed."),
7413
- releaseNotes: unknown().optional().describe("This track's release notes mode, over the workspace's `releaseNotes`.")
7414
- }).passthrough().superRefine((track, context) => {
6456
+ var releaseTrackSchema = looseObject({
6457
+ strategy: described(optional(branchPreset), "The branch model this track follows."),
6458
+ productionBranch: described(nonBlank, "The branch releases land on (main)."),
6459
+ integrationBranch: described(nonBlank, "The branch work integrates into (develop)."),
6460
+ naming: described(optional(looseObject({
6461
+ feature: optional(nonBlank),
6462
+ release: optional(nonBlank),
6463
+ hotfix: optional(nonBlank)
6464
+ })), "Branch name templates per kind, e.g. `feature/{name}`."),
6465
+ baseBranch: described(optional(nonBlank), "The branch new work starts from."),
6466
+ mergeBackBranches: described(optional(array(nonBlank)), "Branches a finished release or hotfix is merged back into."),
6467
+ pullRequestTarget: described(optional(nonBlank), "The branch PRs target."),
6468
+ tagNamespace: described(optional(string2()), "A prefix for this track's release tags."),
6469
+ versionSource: described(optional(versionSourceSchema), "Where the version comes from: package-json, git-tag or manual."),
6470
+ requiredChecks: described(optional(array(nonBlank)), "CI checks that must pass before a release."),
6471
+ critical: described(optional(array(nonBlank)), "Fields an older Workit must not ignore: when one is unknown or malformed, Workit fails closed."),
6472
+ releaseNotes: described(optional(unknown()), "This track's release notes mode, over the workspace's `releaseNotes`.")
6473
+ }).check(superRefine((track, context) => {
7415
6474
  for (const [field, values] of [
7416
6475
  ["mergeBackBranches", track.mergeBackBranches ?? []],
7417
6476
  ["requiredChecks", track.requiredChecks ?? []]
@@ -7431,67 +6490,67 @@ var releaseTrackSchema = object({
7431
6490
  message: "must stay inside the repository"
7432
6491
  });
7433
6492
  }
7434
- });
7435
- 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).");
7436
- var workspaceConfigSchema = object({
7437
- name: nonBlank.describe("The workspace's unique name."),
7438
- glob: nonBlank.describe("The directories this entry covers, an absolute path glob with * and ** (`/home/you/work/**`); the narrowest match wins."),
7439
- vcs: object({
7440
- provider: _enum(["gitlab", "github"]).describe("The forge: github or gitlab."),
7441
- defaultTargetBranch: nonBlank.optional().describe("The branch PRs target by default."),
7442
- tokenFile: nonBlank.optional().describe("A file holding the forge token for this workspace."),
7443
- account: nonBlank.optional().describe("The forge login delivery runs as; grants need it to reach the forge."),
7444
- host: unknown().optional().describe("A self-hosted forge's host name.")
7445
- }).passthrough().optional().describe("The forge this workspace's repositories live on."),
7446
- autoApprove: union([boolean2(), array(nonBlank)]).optional().describe("Legacy (≤4.x) standing approvals, read once as autonomy grants; use `autonomy`."),
7447
- defaultEndpoint: unknown().optional().describe("Where an unnamed request stops: commit (default), pr, green or merged. Set with `workit grant set`, like grants."),
7448
- 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."),
7449
- 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."),
7450
- 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."),
7451
- docs: unknown().optional().describe("The docs refresh the ship skill does before a PR opens: `off` (default) or `when-user-facing`."),
7452
- 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."),
7453
- 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."),
7454
- 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."),
7455
- trailers: boolean2().optional().describe("Whether commits get the `Workit-Session:` trailer (default true). With false, authorship lives in the ledger only."),
7456
- deleteBranch: boolean2().optional().describe("Whether `workit pr merge` deletes the head branch after a merge (default true); `--keep-branch` opts out for one merge."),
7457
- 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`."),
7458
- 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.'),
7459
- liveSessionGuard: boolean2().optional().describe("Whether the live-session guard denies edits in a checkout another live agent session owns (default true)."),
7460
- fanout: object({
7461
- tierModels: unknown().optional().describe("The model per slice TIER (mundane, standard, hard), as one name or per host."),
7462
- 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."),
7463
- 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.")
7464
- }).passthrough().optional().describe("Fanout settings."),
7465
- 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."),
7466
- resources: unknown().optional().describe("Heavy-check limits on this machine: slots, scope, heavy, light, memoryMax, cpuQuota, wait."),
7467
- 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."),
7468
- 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."),
7469
- autonomy: object(Object.fromEntries(["push", "pr", "merge", "release", "rerun"].map((kind) => [
6493
+ }));
6494
+ 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).");
6495
+ var workspaceConfigSchema = looseObject({
6496
+ name: described(nonBlank, "The workspace's unique name."),
6497
+ glob: described(nonBlank, "The directories this entry covers, an absolute path glob with * and ** (`/home/you/work/**`); the narrowest match wins."),
6498
+ vcs: described(optional(looseObject({
6499
+ provider: described(_enum(["gitlab", "github"]), "The forge: github or gitlab."),
6500
+ defaultTargetBranch: described(optional(nonBlank), "The branch PRs target by default."),
6501
+ tokenFile: described(optional(nonBlank), "A file holding the forge token for this workspace."),
6502
+ account: described(optional(nonBlank), "The forge login delivery runs as; grants need it to reach the forge."),
6503
+ host: described(optional(unknown()), "A self-hosted forge's host name.")
6504
+ })), "The forge this workspace's repositories live on."),
6505
+ autoApprove: described(optional(union([boolean2(), array(nonBlank)])), "Legacy (≤4.x) standing approvals, read once as autonomy grants; use `autonomy`."),
6506
+ defaultEndpoint: described(optional(unknown()), "Where an unnamed request stops: commit (default), pr, green or merged. Set with `workit grant set`, like grants."),
6507
+ 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."),
6508
+ 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."),
6509
+ 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."),
6510
+ docs: described(optional(unknown()), "The docs refresh the ship skill does before a PR opens: `off` (default) or `when-user-facing`."),
6511
+ 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."),
6512
+ 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."),
6513
+ 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."),
6514
+ trailers: described(optional(boolean2()), "Whether commits get the `Workit-Session:` trailer (default true). With false, authorship lives in the ledger only."),
6515
+ deleteBranch: described(optional(boolean2()), "Whether `workit pr merge` deletes the head branch after a merge (default true); `--keep-branch` opts out for one merge."),
6516
+ 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`."),
6517
+ 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.'),
6518
+ liveSessionGuard: described(optional(boolean2()), "Whether the live-session guard denies edits in a checkout another live agent session owns (default true)."),
6519
+ fanout: described(optional(looseObject({
6520
+ tierModels: described(optional(unknown()), "The model per slice TIER (mundane, standard, hard), as one name or per host."),
6521
+ 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."),
6522
+ 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.")
6523
+ })), "Fanout settings."),
6524
+ 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."),
6525
+ resources: described(optional(unknown()), "Heavy-check limits on this machine: slots, scope, heavy, light, memoryMax, cpuQuota, wait."),
6526
+ 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."),
6527
+ 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."),
6528
+ autonomy: described(optional(looseObject(Object.fromEntries(["push", "pr", "merge", "release", "rerun"].map((kind) => [
7470
6529
  kind,
7471
- union([boolean2(), literal("verified")]).optional().describe(`The ${kind} grant: true, false, or "verified" (only after a verdict).`)
7472
- ]))).passthrough().optional().describe("Autonomy grants (D15): only ever set here, by the user, with `workit grant set`."),
7473
- youtrack: object({
7474
- baseUrl: nonBlank.optional().describe("This workspace's YouTrack URL."),
7475
- link_issues: boolean2().optional().describe("Legacy alias of `issues: { provider: youtrack, link: true }`."),
7476
- 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."),
7477
- 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`).")
7478
- }).passthrough().optional().describe("YouTrack settings for this workspace."),
7479
- issues: object({
7480
- provider: _enum(["github", "gitlab", "youtrack"]).optional().describe("The issue tracker PRs link to."),
7481
- link: boolean2().optional().describe("Derive the issue from the branch name."),
7482
- relation: unknown().optional().describe("How a PR names its issue: `closes` (default) or `refs`."),
7483
- backlink: boolean2().optional().describe("Post the PR URL on each linked issue after the PR is opened."),
7484
- link_on_pr: boolean2().optional().describe("Legacy alias of `link`."),
7485
- repo: unknown().optional().describe("The GitHub/GitLab repository (owner/name) that holds the issues; default the PR's own."),
7486
- host: unknown().optional().describe("That repository's host; default the PR's host, or the tracker's public one.")
7487
- }).passthrough().optional().describe("The issue tracker PRs link to (any forge with any tracker)."),
7488
- branchPolicy: workspaceBranchPolicySchema.optional().describe("Which branches may be created and which are protected."),
7489
- commitPolicy: workspaceCommitPolicySchema.optional().describe("The commit message rules."),
7490
- defaultProfile: nonBlank.optional().describe("The profile used when none is named; must be a key of `profiles`."),
7491
- profiles: record(nonBlank, workspaceProfileSchema).optional().describe("Named branch/commit policy variants of this workspace."),
7492
- releaseTracks: record(nonBlank, releaseTrackSchema).optional().describe("Named release tracks: production and integration branches, naming and versioning."),
7493
- 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.")
7494
- }).passthrough().superRefine((workspace, context) => {
6530
+ described(optional(union([boolean2(), literal("verified")])), `The ${kind} grant: true, false, or "verified" (only after a verdict).`)
6531
+ ])))), "Autonomy grants (D15): only ever set here, by the user, with `workit grant set`."),
6532
+ youtrack: described(optional(looseObject({
6533
+ baseUrl: described(optional(nonBlank), "This workspace's YouTrack URL."),
6534
+ link_issues: described(optional(boolean2()), "Legacy alias of `issues: { provider: youtrack, link: true }`."),
6535
+ 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."),
6536
+ 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`).")
6537
+ })), "YouTrack settings for this workspace."),
6538
+ issues: described(optional(looseObject({
6539
+ provider: described(optional(_enum(["github", "gitlab", "youtrack"])), "The issue tracker PRs link to."),
6540
+ link: described(optional(boolean2()), "Derive the issue from the branch name."),
6541
+ relation: described(optional(unknown()), "How a PR names its issue: `closes` (default) or `refs`."),
6542
+ backlink: described(optional(boolean2()), "Post the PR URL on each linked issue after the PR is opened."),
6543
+ link_on_pr: described(optional(boolean2()), "Legacy alias of `link`."),
6544
+ repo: described(optional(unknown()), "The GitHub/GitLab repository (owner/name) that holds the issues; default the PR's own."),
6545
+ host: described(optional(unknown()), "That repository's host; default the PR's host, or the tracker's public one.")
6546
+ })), "The issue tracker PRs link to (any forge with any tracker)."),
6547
+ branchPolicy: described(optional(workspaceBranchPolicySchema), "Which branches may be created and which are protected."),
6548
+ commitPolicy: described(optional(workspaceCommitPolicySchema), "The commit message rules."),
6549
+ defaultProfile: described(optional(nonBlank), "The profile used when none is named; must be a key of `profiles`."),
6550
+ profiles: described(optional(record(nonBlank, workspaceProfileSchema)), "Named branch/commit policy variants of this workspace."),
6551
+ releaseTracks: described(optional(record(nonBlank, releaseTrackSchema)), "Named release tracks: production and integration branches, naming and versioning."),
6552
+ 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.")
6553
+ }).check(superRefine((workspace, context) => {
7495
6554
  if (workspace.defaultProfile !== undefined && !Object.hasOwn(workspace.profiles ?? {}, workspace.defaultProfile)) {
7496
6555
  context.addIssue({
7497
6556
  code: "custom",
@@ -7499,14 +6558,14 @@ var workspaceConfigSchema = object({
7499
6558
  message: `does not name a configured profile`
7500
6559
  });
7501
6560
  }
7502
- });
7503
- var workspacesFileSchema = object({
7504
- workspaces: array(workspaceConfigSchema).optional().describe("Workspace entries, each mapping a path glob to its forge, policies and grants."),
7505
- 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)."),
7506
- feedback: object({
7507
- account: nonBlank.optional().describe("The GitHub login `workit feedback --post` uses when no workspace names one; never the workspace's work account by default.")
7508
- }).passthrough().optional().describe("`workit feedback` defaults for every workspace.")
7509
- }).passthrough().superRefine((file, context) => {
6561
+ }));
6562
+ var workspacesFileSchema = looseObject({
6563
+ workspaces: described(optional(array(workspaceConfigSchema)), "Workspace entries, each mapping a path glob to its forge, policies and grants."),
6564
+ 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)."),
6565
+ feedback: described(optional(looseObject({
6566
+ account: described(optional(nonBlank), "The GitHub login `workit feedback --post` uses when no workspace names one; never the workspace's work account by default.")
6567
+ })), "`workit feedback` defaults for every workspace.")
6568
+ }).check(superRefine((file, context) => {
7510
6569
  const names = new Set;
7511
6570
  for (const [index, workspace] of (file.workspaces ?? []).entries()) {
7512
6571
  if (names.has(workspace.name)) {
@@ -7518,7 +6577,7 @@ var workspacesFileSchema = object({
7518
6577
  }
7519
6578
  names.add(workspace.name);
7520
6579
  }
7521
- });
6580
+ }));
7522
6581
  var globToRegExp2 = (glob) => {
7523
6582
  let out = "";
7524
6583
  for (let i = 0;i < glob.length; i++) {
@@ -7753,9 +6812,9 @@ var selectWorkspaceMatch = (matches, cwd, workspaceName) => {
7753
6812
  }
7754
6813
  return mostSpecific[0];
7755
6814
  };
7756
- var runtimeWorkspaceIndexSchema = object({
7757
- workspaces: array(object({ name: nonBlank, glob: nonBlank }).passthrough()).optional()
7758
- }).passthrough();
6815
+ var runtimeWorkspaceIndexSchema = looseObject({
6816
+ workspaces: optional(array(looseObject({ name: nonBlank, glob: nonBlank })))
6817
+ });
7759
6818
  var matchRuntimeWorkspace = (cwd, dir = configDir2()) => {
7760
6819
  const file = path6.join(dir, "workspaces.json");
7761
6820
  let raw;
@@ -8424,13 +7483,13 @@ var assetRoot = () => {
8424
7483
  // packages/workit-core/src/core/store-lock.ts
8425
7484
  import { spawnSync as spawnSync6 } from "node:child_process";
8426
7485
  import fs6 from "node:fs";
8427
- var metadataLockSchema = object({
8428
- pid: number2().int().nonnegative().safe(),
8429
- processStart: string2().nullable(),
8430
- host: string2().min(1),
8431
- nonce: string2().min(1),
8432
- externalAction: literal(true).optional()
8433
- }).strict();
7486
+ var metadataLockSchema = strictObject({
7487
+ pid: number2().check(int(), _nonnegative(), int()),
7488
+ processStart: nullable(string2()),
7489
+ host: string2().check(_minLength(1)),
7490
+ nonce: string2().check(_minLength(1)),
7491
+ externalAction: optional(literal(true))
7492
+ });
8434
7493
  var FOREIGN_LOCK_TTL_MS = 10 * 60000;
8435
7494
  var parseProcStatStart = (stat) => {
8436
7495
  const close = stat.lastIndexOf(")");
@@ -9483,6 +8542,824 @@ var CREATING_ACTIONS = new Set([
9483
8542
  "worker.assign"
9484
8543
  ]);
9485
8544
  var retryPause = new Int32Array(new SharedArrayBuffer(4));
8545
+ // node_modules/zod/v4/classic/errors.js
8546
+ var _installedErrorProtos = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
8547
+ function _lazyMethod(proto, key, make) {
8548
+ Object.defineProperty(proto, key, {
8549
+ configurable: true,
8550
+ enumerable: false,
8551
+ get() {
8552
+ const value = make(this);
8553
+ Object.defineProperty(this, key, { value, configurable: true, writable: true });
8554
+ return value;
8555
+ },
8556
+ set(value) {
8557
+ Object.defineProperty(this, key, { value, configurable: true, writable: true });
8558
+ }
8559
+ });
8560
+ }
8561
+ var initializer2 = (inst, issues) => {
8562
+ $ZodError.init(inst, issues);
8563
+ inst.name = "ZodError";
8564
+ const proto = Object.getPrototypeOf(inst);
8565
+ if (_installedErrorProtos.has(proto))
8566
+ return;
8567
+ _installedErrorProtos.add(proto);
8568
+ _lazyMethod(proto, "format", (self) => (mapper) => formatError(self, mapper));
8569
+ _lazyMethod(proto, "flatten", (self) => (mapper) => flattenError(self, mapper));
8570
+ _lazyMethod(proto, "addIssue", (self) => (issue) => {
8571
+ self.issues.push(issue);
8572
+ self.message = JSON.stringify(self.issues, jsonStringifyReplacer, 2);
8573
+ });
8574
+ _lazyMethod(proto, "addIssues", (self) => (issues) => {
8575
+ self.issues.push(...issues);
8576
+ self.message = JSON.stringify(self.issues, jsonStringifyReplacer, 2);
8577
+ });
8578
+ Object.defineProperty(proto, "isEmpty", {
8579
+ configurable: true,
8580
+ enumerable: false,
8581
+ get() {
8582
+ return this.issues.length === 0;
8583
+ }
8584
+ });
8585
+ };
8586
+ var ZodRealError = /* @__PURE__ */ $constructor("ZodError", initializer2, undefined, {
8587
+ Parent: Error
8588
+ });
8589
+
8590
+ // node_modules/zod/v4/classic/parse.js
8591
+ var parse4 = /* @__PURE__ */ _parse(ZodRealError);
8592
+ var parseAsync2 = /* @__PURE__ */ _parseAsync(ZodRealError);
8593
+ var safeParse2 = /* @__PURE__ */ _safeParse(ZodRealError);
8594
+ var safeParseAsync2 = /* @__PURE__ */ _safeParseAsync(ZodRealError);
8595
+ var encode2 = /* @__PURE__ */ _encode(ZodRealError);
8596
+ var decode2 = /* @__PURE__ */ _decode(ZodRealError);
8597
+ var encodeAsync2 = /* @__PURE__ */ _encodeAsync(ZodRealError);
8598
+ var decodeAsync2 = /* @__PURE__ */ _decodeAsync(ZodRealError);
8599
+ var safeEncode2 = /* @__PURE__ */ _safeEncode(ZodRealError);
8600
+ var safeDecode2 = /* @__PURE__ */ _safeDecode(ZodRealError);
8601
+ var safeEncodeAsync2 = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
8602
+ var safeDecodeAsync2 = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
8603
+
8604
+ // node_modules/zod/v4/classic/schemas.js
8605
+ function _ensureDefaultLocale() {
8606
+ if (!globalConfig.localeError)
8607
+ config(en_default());
8608
+ }
8609
+ function _ensureDefaultMemoizer() {
8610
+ if (!globalConfig.memoizer)
8611
+ config({ memoizer: memoizer() });
8612
+ }
8613
+ var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
8614
+ _ensureDefaultLocale();
8615
+ $ZodType.init(inst, def);
8616
+ inst.def = def;
8617
+ inst.type = def.type;
8618
+ return inst;
8619
+ }, {
8620
+ check(...chks) {
8621
+ const def = this.def;
8622
+ return this.clone(mergeDefs(def, {
8623
+ checks: [
8624
+ ...def.checks ?? [],
8625
+ ...chks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch)
8626
+ ]
8627
+ }), { parent: true });
8628
+ },
8629
+ with(...chks) {
8630
+ return this.check(...chks);
8631
+ },
8632
+ clone(def, params) {
8633
+ return clone(this, def, params);
8634
+ },
8635
+ brand() {
8636
+ return this;
8637
+ },
8638
+ register(reg, meta) {
8639
+ reg.add(this, meta);
8640
+ return this;
8641
+ },
8642
+ refine(check, params) {
8643
+ return this.check(refine2(check, params));
8644
+ },
8645
+ superRefine(refinement, params) {
8646
+ return this.check(superRefine2(refinement, params));
8647
+ },
8648
+ overwrite(fn) {
8649
+ return this.check(_overwrite(fn));
8650
+ },
8651
+ optional() {
8652
+ return optional2(this);
8653
+ },
8654
+ exactOptional() {
8655
+ return exactOptional(this);
8656
+ },
8657
+ nullable() {
8658
+ return nullable2(this);
8659
+ },
8660
+ nullish() {
8661
+ return optional2(nullable2(this));
8662
+ },
8663
+ nonoptional(params) {
8664
+ return nonoptional(this, params);
8665
+ },
8666
+ array() {
8667
+ return array2(this);
8668
+ },
8669
+ or(arg) {
8670
+ return union2([this, arg]);
8671
+ },
8672
+ and(arg) {
8673
+ return intersection(this, arg);
8674
+ },
8675
+ transform(tx) {
8676
+ return pipe(this, transform(tx));
8677
+ },
8678
+ default(d) {
8679
+ return _default(this, d);
8680
+ },
8681
+ prefault(d) {
8682
+ return prefault(this, d);
8683
+ },
8684
+ catch(params) {
8685
+ return _catch(this, params);
8686
+ },
8687
+ pipe(target) {
8688
+ return pipe(this, target);
8689
+ },
8690
+ readonly() {
8691
+ return readonly(this);
8692
+ },
8693
+ describe(description) {
8694
+ const cl = this.clone();
8695
+ globalRegistry.add(cl, { description });
8696
+ return cl;
8697
+ },
8698
+ meta(...args) {
8699
+ if (args.length === 0)
8700
+ return globalRegistry.get(this);
8701
+ const cl = this.clone();
8702
+ globalRegistry.add(cl, args[0]);
8703
+ return cl;
8704
+ },
8705
+ isOptional() {
8706
+ return this.safeParse(undefined).success;
8707
+ },
8708
+ isNullable() {
8709
+ return this.safeParse(null).success;
8710
+ },
8711
+ apply(fn, ...args) {
8712
+ return args.length === 0 ? fn(this) : fn(this, ...args);
8713
+ },
8714
+ get "~standard"() {
8715
+ return hide(this, "~standard", {
8716
+ ...standardProps(this),
8717
+ jsonSchema: {
8718
+ input: createStandardJSONSchemaMethod(this, "input"),
8719
+ output: createStandardJSONSchemaMethod(this, "output")
8720
+ }
8721
+ });
8722
+ },
8723
+ set "~standard"(value) {
8724
+ own(this, "~standard", value);
8725
+ },
8726
+ parse: function _parse(data, params) {
8727
+ return parse4(this, data, params, { callee: _parse });
8728
+ },
8729
+ parseAsync: async function _parseAsync(data, params) {
8730
+ return await parseAsync2(this, data, params, { callee: _parseAsync });
8731
+ },
8732
+ safeParse(data, params) {
8733
+ return safeParse2(this, data, params);
8734
+ },
8735
+ async safeParseAsync(data, params) {
8736
+ return safeParseAsync2(this, data, params);
8737
+ },
8738
+ get spa() {
8739
+ return this?.safeParseAsync;
8740
+ },
8741
+ set spa(value) {
8742
+ own(this, "spa", value);
8743
+ },
8744
+ validate(data, params) {
8745
+ return validate(this, data, params);
8746
+ },
8747
+ validateAsync(data, params) {
8748
+ return validateAsync(this, data, params);
8749
+ },
8750
+ encode: function _encode(data, params) {
8751
+ return encode2(this, data, params, { callee: _encode });
8752
+ },
8753
+ decode: function _decode(data, params) {
8754
+ return decode2(this, data, params, { callee: _decode });
8755
+ },
8756
+ encodeAsync: async function _encodeAsync(data, params) {
8757
+ return await encodeAsync2(this, data, params, { callee: _encodeAsync });
8758
+ },
8759
+ decodeAsync: async function _decodeAsync(data, params) {
8760
+ return await decodeAsync2(this, data, params, { callee: _decodeAsync });
8761
+ },
8762
+ safeEncode(data, params) {
8763
+ return safeEncode2(this, data, params);
8764
+ },
8765
+ safeDecode(data, params) {
8766
+ return safeDecode2(this, data, params);
8767
+ },
8768
+ async safeEncodeAsync(data, params) {
8769
+ return safeEncodeAsync2(this, data, params);
8770
+ },
8771
+ async safeDecodeAsync(data, params) {
8772
+ return safeDecodeAsync2(this, data, params);
8773
+ },
8774
+ toJSONSchema(params) {
8775
+ return createToJSONSchemaMethod(this, {})(params);
8776
+ },
8777
+ get description() {
8778
+ return globalRegistry.get(this)?.description;
8779
+ },
8780
+ get _def() {
8781
+ return this._zod.def;
8782
+ }
8783
+ });
8784
+ var _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
8785
+ $ZodString.init(inst, def);
8786
+ ZodType.init(inst, def);
8787
+ inst._zod.processJSONSchema = (ctx, json, params) => stringProcessor(inst, ctx, json, params);
8788
+ }, /* @__PURE__ */ derived({
8789
+ format: (inst) => aggregateChecks(inst).format ?? null,
8790
+ minLength: (inst) => aggregateChecks(inst).minimum ?? null,
8791
+ maxLength: (inst) => aggregateChecks(inst).maximum ?? null
8792
+ }, {
8793
+ regex(...args) {
8794
+ return this.check(_regex(...args));
8795
+ },
8796
+ includes(...args) {
8797
+ return this.check(_includes(...args));
8798
+ },
8799
+ startsWith(...args) {
8800
+ return this.check(_startsWith(...args));
8801
+ },
8802
+ endsWith(...args) {
8803
+ return this.check(_endsWith(...args));
8804
+ },
8805
+ min(...args) {
8806
+ return this.check(_minLength(...args));
8807
+ },
8808
+ max(...args) {
8809
+ return this.check(_maxLength(...args));
8810
+ },
8811
+ length(...args) {
8812
+ return this.check(_length(...args));
8813
+ },
8814
+ nonempty(...args) {
8815
+ return this.check(_minLength(1, ...args));
8816
+ },
8817
+ lowercase(params) {
8818
+ return this.check(_lowercase(params));
8819
+ },
8820
+ uppercase(params) {
8821
+ return this.check(_uppercase(params));
8822
+ },
8823
+ trim() {
8824
+ return this.check(_trim());
8825
+ },
8826
+ normalize(...args) {
8827
+ return this.check(_normalize(...args));
8828
+ },
8829
+ toLowerCase() {
8830
+ return this.check(_toLowerCase());
8831
+ },
8832
+ toUpperCase() {
8833
+ return this.check(_toUpperCase());
8834
+ },
8835
+ slugify() {
8836
+ return this.check(_slugify());
8837
+ }
8838
+ }));
8839
+ var ZodString = /* @__PURE__ */ $constructor("ZodString", (inst, def) => {
8840
+ $ZodString.init(inst, def);
8841
+ _ZodString.init(inst, def);
8842
+ }, {
8843
+ email(params) {
8844
+ return this.check(_email(ZodEmail, params));
8845
+ },
8846
+ url(params) {
8847
+ return this.check(_url(ZodURL, params));
8848
+ },
8849
+ jwt(params) {
8850
+ return this.check(_jwt(ZodJWT, params));
8851
+ },
8852
+ emoji(params) {
8853
+ return this.check(_emoji2(ZodEmoji, params));
8854
+ },
8855
+ guid(params) {
8856
+ return this.check(_guid(ZodGUID, params));
8857
+ },
8858
+ uuid(params) {
8859
+ return this.check(_uuid(ZodUUID, params));
8860
+ },
8861
+ uuidv4(params) {
8862
+ return this.check(_uuidv4(ZodUUID, params));
8863
+ },
8864
+ uuidv6(params) {
8865
+ return this.check(_uuidv6(ZodUUID, params));
8866
+ },
8867
+ uuidv7(params) {
8868
+ return this.check(_uuidv7(ZodUUID, params));
8869
+ },
8870
+ nanoid(params) {
8871
+ return this.check(_nanoid(ZodNanoID, params));
8872
+ },
8873
+ cuid(params) {
8874
+ return this.check(_cuid(ZodCUID, params));
8875
+ },
8876
+ cuid2(params) {
8877
+ return this.check(_cuid2(ZodCUID2, params));
8878
+ },
8879
+ ulid(params) {
8880
+ return this.check(_ulid(ZodULID, params));
8881
+ },
8882
+ base64(params) {
8883
+ return this.check(_base64(ZodBase64, params));
8884
+ },
8885
+ base64url(params) {
8886
+ return this.check(_base64url(ZodBase64URL, params));
8887
+ },
8888
+ xid(params) {
8889
+ return this.check(_xid(ZodXID, params));
8890
+ },
8891
+ ksuid(params) {
8892
+ return this.check(_ksuid(ZodKSUID, params));
8893
+ },
8894
+ ipv4(params) {
8895
+ return this.check(_ipv4(ZodIPv4, params));
8896
+ },
8897
+ ipv6(params) {
8898
+ return this.check(_ipv6(ZodIPv6, params));
8899
+ },
8900
+ cidrv4(params) {
8901
+ return this.check(_cidrv4(ZodCIDRv4, params));
8902
+ },
8903
+ cidrv6(params) {
8904
+ return this.check(_cidrv6(ZodCIDRv6, params));
8905
+ },
8906
+ e164(params) {
8907
+ return this.check(_e164(ZodE164, params));
8908
+ },
8909
+ datetime(params) {
8910
+ return this.check(_isoDateTime(ZodISODateTime, params));
8911
+ },
8912
+ date(params) {
8913
+ return this.check(_isoDate(ZodISODate, params));
8914
+ },
8915
+ time(params) {
8916
+ return this.check(_isoTime(ZodISOTime, params));
8917
+ },
8918
+ duration(params) {
8919
+ return this.check(_isoDuration(ZodISODuration, params));
8920
+ }
8921
+ });
8922
+ function string3(params) {
8923
+ return _string(ZodString, params);
8924
+ }
8925
+ var ZodStringFormat = /* @__PURE__ */ $constructor("ZodStringFormat", (inst, def) => {
8926
+ $ZodStringFormat.init(inst, def);
8927
+ _ZodString.init(inst, def);
8928
+ });
8929
+ var ZodISODateTime = /* @__PURE__ */ $constructor("ZodISODateTime", (inst, def) => {
8930
+ $ZodISODateTime.init(inst, def);
8931
+ ZodStringFormat.init(inst, def);
8932
+ });
8933
+ var ZodISODate = /* @__PURE__ */ $constructor("ZodISODate", (inst, def) => {
8934
+ $ZodISODate.init(inst, def);
8935
+ ZodStringFormat.init(inst, def);
8936
+ });
8937
+ var ZodISOTime = /* @__PURE__ */ $constructor("ZodISOTime", (inst, def) => {
8938
+ $ZodISOTime.init(inst, def);
8939
+ ZodStringFormat.init(inst, def);
8940
+ });
8941
+ var ZodISODuration = /* @__PURE__ */ $constructor("ZodISODuration", (inst, def) => {
8942
+ $ZodISODuration.init(inst, def);
8943
+ ZodStringFormat.init(inst, def);
8944
+ });
8945
+ var ZodEmail = /* @__PURE__ */ $constructor("ZodEmail", (inst, def) => {
8946
+ $ZodEmail.init(inst, def);
8947
+ ZodStringFormat.init(inst, def);
8948
+ });
8949
+ var ZodGUID = /* @__PURE__ */ $constructor("ZodGUID", (inst, def) => {
8950
+ $ZodGUID.init(inst, def);
8951
+ ZodStringFormat.init(inst, def);
8952
+ });
8953
+ var ZodUUID = /* @__PURE__ */ $constructor("ZodUUID", (inst, def) => {
8954
+ $ZodUUID.init(inst, def);
8955
+ ZodStringFormat.init(inst, def);
8956
+ });
8957
+ var ZodURL = /* @__PURE__ */ $constructor("ZodURL", (inst, def) => {
8958
+ $ZodURL.init(inst, def);
8959
+ ZodStringFormat.init(inst, def);
8960
+ });
8961
+ var ZodEmoji = /* @__PURE__ */ $constructor("ZodEmoji", (inst, def) => {
8962
+ $ZodEmoji.init(inst, def);
8963
+ ZodStringFormat.init(inst, def);
8964
+ });
8965
+ var ZodNanoID = /* @__PURE__ */ $constructor("ZodNanoID", (inst, def) => {
8966
+ $ZodNanoID.init(inst, def);
8967
+ ZodStringFormat.init(inst, def);
8968
+ });
8969
+ var ZodCUID = /* @__PURE__ */ $constructor("ZodCUID", (inst, def) => {
8970
+ $ZodCUID.init(inst, def);
8971
+ ZodStringFormat.init(inst, def);
8972
+ });
8973
+ var ZodCUID2 = /* @__PURE__ */ $constructor("ZodCUID2", (inst, def) => {
8974
+ $ZodCUID2.init(inst, def);
8975
+ ZodStringFormat.init(inst, def);
8976
+ });
8977
+ var ZodULID = /* @__PURE__ */ $constructor("ZodULID", (inst, def) => {
8978
+ $ZodULID.init(inst, def);
8979
+ ZodStringFormat.init(inst, def);
8980
+ });
8981
+ var ZodXID = /* @__PURE__ */ $constructor("ZodXID", (inst, def) => {
8982
+ $ZodXID.init(inst, def);
8983
+ ZodStringFormat.init(inst, def);
8984
+ });
8985
+ var ZodKSUID = /* @__PURE__ */ $constructor("ZodKSUID", (inst, def) => {
8986
+ $ZodKSUID.init(inst, def);
8987
+ ZodStringFormat.init(inst, def);
8988
+ });
8989
+ var ZodIPv4 = /* @__PURE__ */ $constructor("ZodIPv4", (inst, def) => {
8990
+ $ZodIPv4.init(inst, def);
8991
+ ZodStringFormat.init(inst, def);
8992
+ });
8993
+ var ZodIPv6 = /* @__PURE__ */ $constructor("ZodIPv6", (inst, def) => {
8994
+ $ZodIPv6.init(inst, def);
8995
+ ZodStringFormat.init(inst, def);
8996
+ });
8997
+ var ZodCIDRv4 = /* @__PURE__ */ $constructor("ZodCIDRv4", (inst, def) => {
8998
+ $ZodCIDRv4.init(inst, def);
8999
+ ZodStringFormat.init(inst, def);
9000
+ });
9001
+ var ZodCIDRv6 = /* @__PURE__ */ $constructor("ZodCIDRv6", (inst, def) => {
9002
+ $ZodCIDRv6.init(inst, def);
9003
+ ZodStringFormat.init(inst, def);
9004
+ });
9005
+ var ZodBase64 = /* @__PURE__ */ $constructor("ZodBase64", (inst, def) => {
9006
+ $ZodBase64.init(inst, def);
9007
+ ZodStringFormat.init(inst, def);
9008
+ });
9009
+ var ZodBase64URL = /* @__PURE__ */ $constructor("ZodBase64URL", (inst, def) => {
9010
+ $ZodBase64URL.init(inst, def);
9011
+ ZodStringFormat.init(inst, def);
9012
+ });
9013
+ var ZodE164 = /* @__PURE__ */ $constructor("ZodE164", (inst, def) => {
9014
+ $ZodE164.init(inst, def);
9015
+ ZodStringFormat.init(inst, def);
9016
+ });
9017
+ var ZodJWT = /* @__PURE__ */ $constructor("ZodJWT", (inst, def) => {
9018
+ $ZodJWT.init(inst, def);
9019
+ ZodStringFormat.init(inst, def);
9020
+ });
9021
+ var ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
9022
+ $ZodUnknown.init(inst, def);
9023
+ ZodType.init(inst, def);
9024
+ inst._zod.processJSONSchema = (ctx, json, params) => unknownProcessor(inst, ctx, json, params);
9025
+ });
9026
+ function unknown2() {
9027
+ return _unknown(ZodUnknown);
9028
+ }
9029
+ var ZodNever = /* @__PURE__ */ $constructor("ZodNever", (inst, def) => {
9030
+ $ZodNever.init(inst, def);
9031
+ ZodType.init(inst, def);
9032
+ inst._zod.processJSONSchema = (ctx, json, params) => neverProcessor(inst, ctx, json, params);
9033
+ });
9034
+ function never2(params) {
9035
+ return _never(ZodNever, params);
9036
+ }
9037
+ var ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
9038
+ _ensureDefaultMemoizer();
9039
+ $ZodArray.init(inst, def);
9040
+ ZodType.init(inst, def);
9041
+ inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor(inst, ctx, json, params);
9042
+ inst.element = def.element;
9043
+ }, {
9044
+ min(n, params) {
9045
+ return this.check(_minLength(n, params));
9046
+ },
9047
+ nonempty(params) {
9048
+ return this.check(_minLength(1, params));
9049
+ },
9050
+ max(n, params) {
9051
+ return this.check(_maxLength(n, params));
9052
+ },
9053
+ length(n, params) {
9054
+ return this.check(_length(n, params));
9055
+ },
9056
+ unwrap() {
9057
+ return this.element;
9058
+ }
9059
+ });
9060
+ function array2(element, params) {
9061
+ return _array(ZodArray, element, params);
9062
+ }
9063
+ var ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
9064
+ _ensureDefaultMemoizer();
9065
+ $ZodObjectJIT.init(inst, def);
9066
+ ZodType.init(inst, def);
9067
+ inst._zod.processJSONSchema = (ctx, json, params) => objectProcessor(inst, ctx, json, params);
9068
+ installLazyProp(inst, "shape", (self) => self._zod.def.shape, false);
9069
+ }, {
9070
+ keyof() {
9071
+ return _enum2(Object.keys(this._zod.def.shape));
9072
+ },
9073
+ catchall(catchall) {
9074
+ return this.clone(mergeDefs(this._zod.def, { catchall }));
9075
+ },
9076
+ passthrough() {
9077
+ return this.clone(mergeDefs(this._zod.def, { catchall: unknown2() }));
9078
+ },
9079
+ loose() {
9080
+ return this.clone(mergeDefs(this._zod.def, { catchall: unknown2() }));
9081
+ },
9082
+ strict() {
9083
+ return this.clone(mergeDefs(this._zod.def, { catchall: never2() }));
9084
+ },
9085
+ strip() {
9086
+ return this.clone(mergeDefs(this._zod.def, { catchall: undefined }));
9087
+ },
9088
+ extend(incoming) {
9089
+ return extend(this, incoming);
9090
+ },
9091
+ safeExtend(incoming) {
9092
+ return safeExtend(this, incoming);
9093
+ },
9094
+ merge(other) {
9095
+ return merge(this, other);
9096
+ },
9097
+ pick(mask) {
9098
+ return pick(this, mask);
9099
+ },
9100
+ omit(mask) {
9101
+ return omit(this, mask);
9102
+ },
9103
+ partial(...args) {
9104
+ return partial(ZodOptional, this, args[0]);
9105
+ },
9106
+ exactPartial(...args) {
9107
+ return partial(ZodExactOptional, this, args[0], "exactPartial");
9108
+ },
9109
+ required(...args) {
9110
+ return required(ZodNonOptional, this, args[0]);
9111
+ }
9112
+ });
9113
+ function object(shape, params) {
9114
+ const def = {
9115
+ type: "object",
9116
+ shape: shape ?? {},
9117
+ ...normalizeParams(params)
9118
+ };
9119
+ return new ZodObject(def);
9120
+ }
9121
+ var ZodUnion = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => {
9122
+ $ZodUnion.init(inst, def);
9123
+ ZodType.init(inst, def);
9124
+ inst._zod.processJSONSchema = (ctx, json, params) => unionProcessor(inst, ctx, json, params);
9125
+ inst.options = def.options;
9126
+ });
9127
+ function union2(options, params) {
9128
+ return new ZodUnion({
9129
+ type: "union",
9130
+ options,
9131
+ ...normalizeParams(params)
9132
+ });
9133
+ }
9134
+ var ZodIntersection = /* @__PURE__ */ $constructor("ZodIntersection", (inst, def) => {
9135
+ $ZodIntersection.init(inst, def);
9136
+ ZodType.init(inst, def);
9137
+ inst._zod.processJSONSchema = (ctx, json, params) => intersectionProcessor(inst, ctx, json, params);
9138
+ });
9139
+ function intersection(left, right) {
9140
+ return new ZodIntersection({
9141
+ type: "intersection",
9142
+ left,
9143
+ right
9144
+ });
9145
+ }
9146
+ var ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
9147
+ $ZodEnum.init(inst, def);
9148
+ ZodType.init(inst, def);
9149
+ inst._zod.processJSONSchema = (ctx, json, params) => enumProcessor(inst, ctx, json, params);
9150
+ inst.enum = def.entries;
9151
+ inst.options = [...inst._zod.values];
9152
+ const keys = new Set(Object.keys(def.entries));
9153
+ inst.extract = (values, params) => {
9154
+ const newEntries = {};
9155
+ for (const value of values) {
9156
+ if (keys.has(value)) {
9157
+ newEntries[value] = def.entries[value];
9158
+ } else
9159
+ throw new Error(`Key ${value} not found in enum`);
9160
+ }
9161
+ return new ZodEnum({
9162
+ ...def,
9163
+ checks: [],
9164
+ ...normalizeParams(params),
9165
+ entries: newEntries
9166
+ });
9167
+ };
9168
+ inst.exclude = (values, params) => {
9169
+ const newEntries = { ...def.entries };
9170
+ for (const value of values) {
9171
+ if (keys.has(value)) {
9172
+ delete newEntries[value];
9173
+ } else
9174
+ throw new Error(`Key ${value} not found in enum`);
9175
+ }
9176
+ return new ZodEnum({
9177
+ ...def,
9178
+ checks: [],
9179
+ ...normalizeParams(params),
9180
+ entries: newEntries
9181
+ });
9182
+ };
9183
+ });
9184
+ function _enum2(values, params) {
9185
+ const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
9186
+ return new ZodEnum({
9187
+ type: "enum",
9188
+ entries,
9189
+ ...normalizeParams(params)
9190
+ });
9191
+ }
9192
+ var ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
9193
+ _ensureDefaultMemoizer();
9194
+ $ZodTransform.init(inst, def);
9195
+ ZodType.init(inst, def);
9196
+ inst._zod.processJSONSchema = (ctx, json, params) => transformProcessor(inst, ctx, json, params);
9197
+ inst._zod.parse = (payload, _ctx) => {
9198
+ if (_ctx.direction === "backward") {
9199
+ throw new $ZodEncodeError(inst.constructor.name);
9200
+ }
9201
+ payload.addIssue = (issue2) => {
9202
+ if (typeof issue2 === "string") {
9203
+ payload.issues.push(issue(issue2, payload.value, def));
9204
+ } else {
9205
+ const _issue = issue2;
9206
+ if (_issue.fatal)
9207
+ _issue.continue = false;
9208
+ _issue.code ?? (_issue.code = "custom");
9209
+ if (!("input" in _issue))
9210
+ _issue.input = payload.value;
9211
+ _issue.inst ?? (_issue.inst = inst);
9212
+ payload.issues.push(issue(_issue));
9213
+ }
9214
+ };
9215
+ const output = def.transform(payload.value, payload);
9216
+ if (output instanceof Promise) {
9217
+ return output.then((output) => {
9218
+ payload.value = output;
9219
+ return payload;
9220
+ });
9221
+ }
9222
+ payload.value = output;
9223
+ return payload;
9224
+ };
9225
+ });
9226
+ function transform(fn) {
9227
+ return new ZodTransform({
9228
+ type: "transform",
9229
+ transform: fn
9230
+ });
9231
+ }
9232
+ var ZodOptional = /* @__PURE__ */ $constructor("ZodOptional", (inst, def) => {
9233
+ $ZodOptional.init(inst, def);
9234
+ ZodType.init(inst, def);
9235
+ inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
9236
+ inst.unwrap = () => inst._zod.def.innerType;
9237
+ });
9238
+ function optional2(innerType) {
9239
+ return new ZodOptional({
9240
+ type: "optional",
9241
+ innerType
9242
+ });
9243
+ }
9244
+ var ZodExactOptional = /* @__PURE__ */ $constructor("ZodExactOptional", (inst, def) => {
9245
+ $ZodExactOptional.init(inst, def);
9246
+ ZodType.init(inst, def);
9247
+ inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
9248
+ inst.unwrap = () => inst._zod.def.innerType;
9249
+ });
9250
+ function exactOptional(innerType) {
9251
+ return new ZodExactOptional({
9252
+ type: "optional",
9253
+ innerType
9254
+ });
9255
+ }
9256
+ var ZodNullable = /* @__PURE__ */ $constructor("ZodNullable", (inst, def) => {
9257
+ $ZodNullable.init(inst, def);
9258
+ ZodType.init(inst, def);
9259
+ inst._zod.processJSONSchema = (ctx, json, params) => nullableProcessor(inst, ctx, json, params);
9260
+ inst.unwrap = () => inst._zod.def.innerType;
9261
+ });
9262
+ function nullable2(innerType) {
9263
+ return new ZodNullable({
9264
+ type: "nullable",
9265
+ innerType
9266
+ });
9267
+ }
9268
+ var ZodDefault = /* @__PURE__ */ $constructor("ZodDefault", (inst, def) => {
9269
+ $ZodDefault.init(inst, def);
9270
+ ZodType.init(inst, def);
9271
+ inst._zod.processJSONSchema = (ctx, json, params) => defaultProcessor(inst, ctx, json, params);
9272
+ inst.unwrap = () => inst._zod.def.innerType;
9273
+ inst.removeDefault = inst.unwrap;
9274
+ });
9275
+ function _default(innerType, defaultValue) {
9276
+ return new ZodDefault({
9277
+ type: "default",
9278
+ innerType,
9279
+ get defaultValue() {
9280
+ return typeof defaultValue === "function" ? defaultValue() : shallowClone(defaultValue);
9281
+ }
9282
+ });
9283
+ }
9284
+ var ZodPrefault = /* @__PURE__ */ $constructor("ZodPrefault", (inst, def) => {
9285
+ $ZodPrefault.init(inst, def);
9286
+ ZodType.init(inst, def);
9287
+ inst._zod.processJSONSchema = (ctx, json, params) => prefaultProcessor(inst, ctx, json, params);
9288
+ inst.unwrap = () => inst._zod.def.innerType;
9289
+ });
9290
+ function prefault(innerType, defaultValue) {
9291
+ return new ZodPrefault({
9292
+ type: "prefault",
9293
+ innerType,
9294
+ get defaultValue() {
9295
+ return typeof defaultValue === "function" ? defaultValue() : shallowClone(defaultValue);
9296
+ }
9297
+ });
9298
+ }
9299
+ var ZodNonOptional = /* @__PURE__ */ $constructor("ZodNonOptional", (inst, def) => {
9300
+ $ZodNonOptional.init(inst, def);
9301
+ ZodType.init(inst, def);
9302
+ inst._zod.processJSONSchema = (ctx, json, params) => nonoptionalProcessor(inst, ctx, json, params);
9303
+ inst.unwrap = () => inst._zod.def.innerType;
9304
+ });
9305
+ function nonoptional(innerType, params) {
9306
+ return new ZodNonOptional({
9307
+ type: "nonoptional",
9308
+ innerType,
9309
+ ...normalizeParams(params)
9310
+ });
9311
+ }
9312
+ var ZodCatch = /* @__PURE__ */ $constructor("ZodCatch", (inst, def) => {
9313
+ $ZodCatch.init(inst, def);
9314
+ ZodType.init(inst, def);
9315
+ inst._zod.processJSONSchema = (ctx, json, params) => catchProcessor(inst, ctx, json, params);
9316
+ inst.unwrap = () => inst._zod.def.innerType;
9317
+ inst.removeCatch = inst.unwrap;
9318
+ });
9319
+ function _catch(innerType, catchValue) {
9320
+ return new ZodCatch({
9321
+ type: "catch",
9322
+ innerType,
9323
+ catchValue: typeof catchValue === "function" ? catchValue : constantCatch(catchValue)
9324
+ });
9325
+ }
9326
+ var ZodPipe = /* @__PURE__ */ $constructor("ZodPipe", (inst, def) => {
9327
+ $ZodPipe.init(inst, def);
9328
+ ZodType.init(inst, def);
9329
+ inst._zod.processJSONSchema = (ctx, json, params) => pipeProcessor(inst, ctx, json, params);
9330
+ inst.in = def.in;
9331
+ inst.out = def.out;
9332
+ });
9333
+ function pipe(in_, out) {
9334
+ return new ZodPipe({
9335
+ type: "pipe",
9336
+ in: in_,
9337
+ out
9338
+ });
9339
+ }
9340
+ var ZodReadonly = /* @__PURE__ */ $constructor("ZodReadonly", (inst, def) => {
9341
+ $ZodReadonly.init(inst, def);
9342
+ ZodType.init(inst, def);
9343
+ inst._zod.processJSONSchema = (ctx, json, params) => readonlyProcessor(inst, ctx, json, params);
9344
+ inst.unwrap = () => inst._zod.def.innerType;
9345
+ });
9346
+ function readonly(innerType) {
9347
+ return new ZodReadonly({
9348
+ type: "readonly",
9349
+ innerType
9350
+ });
9351
+ }
9352
+ var ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
9353
+ $ZodCustom.init(inst, def);
9354
+ ZodType.init(inst, def);
9355
+ inst._zod.processJSONSchema = (ctx, json, params) => customProcessor(inst, ctx, json, params);
9356
+ });
9357
+ function refine2(fn, _params = {}) {
9358
+ return _refine(ZodCustom, fn, _params);
9359
+ }
9360
+ function superRefine2(fn, params) {
9361
+ return _superRefine(fn, params);
9362
+ }
9486
9363
  // packages/workit-core/src/core/pr-create.ts
9487
9364
  var bounded = (timeout) => ({
9488
9365
  encoding: "utf8",
@@ -9503,7 +9380,7 @@ var ASSET_ROOT = assetRoot();
9503
9380
 
9504
9381
  // packages/workit-core/src/core/context-read.ts
9505
9382
  var contextReadSchema = object({
9506
- kind: _enum([
9383
+ kind: _enum2([
9507
9384
  "git",
9508
9385
  "pr",
9509
9386
  "youtrack",
@@ -9513,14 +9390,14 @@ var contextReadSchema = object({
9513
9390
  "release",
9514
9391
  "affected"
9515
9392
  ]),
9516
- range: string2().optional(),
9517
- issueId: string2().optional(),
9518
- issueUrl: string2().optional(),
9519
- issueRef: string2().optional(),
9520
- mode: string2().optional(),
9521
- specPath: string2().optional(),
9522
- planPath: string2().optional(),
9523
- cwd: string2().min(1).optional()
9393
+ range: string3().optional(),
9394
+ issueId: string3().optional(),
9395
+ issueUrl: string3().optional(),
9396
+ issueRef: string3().optional(),
9397
+ mode: string3().optional(),
9398
+ specPath: string3().optional(),
9399
+ planPath: string3().optional(),
9400
+ cwd: string3().min(1).optional()
9524
9401
  }).strict();
9525
9402
  // packages/workit-core/src/hooks/budget-signal.ts
9526
9403
  import { createHash as createHash5 } from "node:crypto";