@pmelab/gtd 15.9.0 → 15.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -607,7 +607,7 @@ const isRecordOrArray = (input) => typeof input === "object" && input !== null;
607
607
  * @since 2.0.0
608
608
  * @see isRecord to check for plain objects (excluding arrays and functions).
609
609
  */
610
- const isObject$2 = (input) => isRecordOrArray(input) || isFunction$1(input);
610
+ const isObject$3 = (input) => isRecordOrArray(input) || isFunction$1(input);
611
611
  /**
612
612
  * A refinement that checks if a value is an object-like value and has a specific property key.
613
613
  *
@@ -630,7 +630,7 @@ const isObject$2 = (input) => isRecordOrArray(input) || isFunction$1(input);
630
630
  * @category guards
631
631
  * @since 2.0.0
632
632
  */
633
- const hasProperty = /*#__PURE__*/ dual(2, (self, property) => isObject$2(self) && property in self);
633
+ const hasProperty = /*#__PURE__*/ dual(2, (self, property) => isObject$3(self) && property in self);
634
634
  /**
635
635
  * A refinement that checks if a value is an object with a `_tag` property
636
636
  * that matches the given tag. This is a powerful tool for working with
@@ -1295,7 +1295,7 @@ function formatUnknown(input, options) {
1295
1295
  seen.add(v);
1296
1296
  return `${v.constructor.name}(${go(Array.from(v), d)})`;
1297
1297
  }
1298
- if (isObject$2(v)) {
1298
+ if (isObject$3(v)) {
1299
1299
  if (seen.has(v)) return CIRCULAR;
1300
1300
  seen.add(v);
1301
1301
  const keys = ownKeys(v);
@@ -5273,7 +5273,7 @@ const empty$21 = /*#__PURE__*/ (() => {
5273
5273
  return o;
5274
5274
  })();
5275
5275
  /** @internal */
5276
- const fail$11 = (error) => {
5276
+ const fail$12 = (error) => {
5277
5277
  const o = Object.create(proto$10);
5278
5278
  o._tag = OP_FAIL$2;
5279
5279
  o.error = error;
@@ -5353,7 +5353,7 @@ const failureOrCause$1 = (self) => {
5353
5353
  /** @internal */
5354
5354
  const flipCauseOption$1 = (self) => match$7(self, {
5355
5355
  onEmpty: some(empty$21),
5356
- onFail: map$14(fail$11),
5356
+ onFail: map$14(fail$12),
5357
5357
  onDie: (defect) => some(die$4(defect)),
5358
5358
  onInterrupt: (fiberId) => some(interrupt$5(fiberId)),
5359
5359
  onSequential: mergeWith$1(sequential$3),
@@ -5389,7 +5389,7 @@ const electFailures = (self) => match$7(self, {
5389
5389
  onParallel: parallel$3
5390
5390
  });
5391
5391
  /** @internal */
5392
- const map$10 = /*#__PURE__*/ dual(2, (self, f) => flatMap$7(self, (e) => fail$11(f(e))));
5392
+ const map$10 = /*#__PURE__*/ dual(2, (self, f) => flatMap$7(self, (e) => fail$12(f(e))));
5393
5393
  /** @internal */
5394
5394
  const flatMap$7 = /*#__PURE__*/ dual(2, (self, f) => match$7(self, {
5395
5395
  onEmpty: empty$21,
@@ -8131,7 +8131,7 @@ const capture = (obj, span) => {
8131
8131
  });
8132
8132
  return obj;
8133
8133
  };
8134
- const die$3 = (defect) => isObject$2(defect) && !(spanSymbol in defect) ? withFiberRuntime$1((fiber) => failCause$6(die$4(capture(defect, currentSpanFromFiber(fiber))))) : failCause$6(die$4(defect));
8134
+ const die$3 = (defect) => isObject$3(defect) && !(spanSymbol in defect) ? withFiberRuntime$1((fiber) => failCause$6(die$4(capture(defect, currentSpanFromFiber(fiber))))) : failCause$6(die$4(defect));
8135
8135
  const dieMessage$1 = (message) => failCauseSync$1(() => die$4(new RuntimeException(message)));
8136
8136
  const either$1 = (self) => matchEffect$1(self, {
8137
8137
  onFailure: (e) => succeed$8(left(e)),
@@ -8141,8 +8141,8 @@ const exit$2 = (self) => matchCause$1(self, {
8141
8141
  onFailure: exitFailCause$1,
8142
8142
  onSuccess: exitSucceed$1
8143
8143
  });
8144
- const fail$10 = (error) => isObject$2(error) && !(spanSymbol in error) ? withFiberRuntime$1((fiber) => failCause$6(fail$11(capture(error, currentSpanFromFiber(fiber))))) : failCause$6(fail$11(error));
8145
- const failSync = (evaluate) => flatMap$6(sync$2(evaluate), fail$10);
8144
+ const fail$11 = (error) => isObject$3(error) && !(spanSymbol in error) ? withFiberRuntime$1((fiber) => failCause$6(fail$12(capture(error, currentSpanFromFiber(fiber))))) : failCause$6(fail$12(error));
8145
+ const failSync = (evaluate) => flatMap$6(sync$2(evaluate), fail$11);
8146
8146
  const failCause$6 = (cause) => {
8147
8147
  const effect = new EffectPrimitiveFailure(OP_FAILURE);
8148
8148
  effect.effect_instruction_i0 = cause;
@@ -8161,7 +8161,7 @@ const andThen$1 = /*#__PURE__*/ dual(2, (self, f) => flatMap$6(self, (a) => {
8161
8161
  const b = typeof f === "function" ? f(a) : f;
8162
8162
  if (isEffect$1(b)) return b;
8163
8163
  else if (isPromiseLike(b)) return unsafeAsync((resume) => {
8164
- b.then((a) => resume(succeed$8(a)), (e) => resume(fail$10(new UnknownException(e, "An unknown error occurred in Effect.andThen"))));
8164
+ b.then((a) => resume(succeed$8(a)), (e) => resume(fail$11(new UnknownException(e, "An unknown error occurred in Effect.andThen"))));
8165
8165
  });
8166
8166
  return succeed$8(b);
8167
8167
  }));
@@ -8277,11 +8277,11 @@ const sync$2 = (thunk) => {
8277
8277
  effect.effect_instruction_i0 = thunk;
8278
8278
  return effect;
8279
8279
  };
8280
- const tap$1 = /*#__PURE__*/ dual((args) => args.length === 3 || args.length === 2 && !(isObject$2(args[1]) && "onlyEffect" in args[1]), (self, f) => flatMap$6(self, (a) => {
8280
+ const tap$1 = /*#__PURE__*/ dual((args) => args.length === 3 || args.length === 2 && !(isObject$3(args[1]) && "onlyEffect" in args[1]), (self, f) => flatMap$6(self, (a) => {
8281
8281
  const b = typeof f === "function" ? f(a) : f;
8282
8282
  if (isEffect$1(b)) return as$1(b, a);
8283
8283
  else if (isPromiseLike(b)) return unsafeAsync((resume) => {
8284
- b.then((_) => resume(succeed$8(a)), (e) => resume(fail$10(new UnknownException(e, "An unknown error occurred in Effect.tap"))));
8284
+ b.then((_) => resume(succeed$8(a)), (e) => resume(fail$11(new UnknownException(e, "An unknown error occurred in Effect.tap"))));
8285
8285
  });
8286
8286
  return succeed$8(a);
8287
8287
  }));
@@ -8574,7 +8574,7 @@ const causeSquashWith = /*#__PURE__*/ dual(2, (self, f) => {
8574
8574
  const YieldableError$1 = /*#__PURE__*/ function() {
8575
8575
  class YieldableError extends globalThis.Error {
8576
8576
  commit() {
8577
- return fail$10(this);
8577
+ return fail$11(this);
8578
8578
  }
8579
8579
  toJSON() {
8580
8580
  const obj = { ...this };
@@ -8584,7 +8584,7 @@ const YieldableError$1 = /*#__PURE__*/ function() {
8584
8584
  }
8585
8585
  [NodeInspectSymbol]() {
8586
8586
  if (this.toString !== globalThis.Error.prototype.toString) return this.stack ? `${this.toString()}\n${this.stack.split("\n").slice(1).join("\n")}` : this.toString();
8587
- else if ("Bun" in globalThis) return pretty$1(fail$11(this), { renderErrorCause: true });
8587
+ else if ("Bun" in globalThis) return pretty$1(fail$12(this), { renderErrorCause: true });
8588
8588
  return this;
8589
8589
  }
8590
8590
  }
@@ -8661,7 +8661,7 @@ const exitCollectAll = (exits, options) => exitCollectAllInternal(exits, options
8661
8661
  /** @internal */
8662
8662
  const exitDie$1 = (defect) => exitFailCause$1(die$4(defect));
8663
8663
  /** @internal */
8664
- const exitFail = (error) => exitFailCause$1(fail$11(error));
8664
+ const exitFail = (error) => exitFailCause$1(fail$12(error));
8665
8665
  /** @internal */
8666
8666
  const exitFailCause$1 = (cause) => {
8667
8667
  const effect = new EffectPrimitiveFailure(OP_FAILURE);
@@ -8781,7 +8781,7 @@ const deferredCompleteWith = /*#__PURE__*/ dual(2, (self, effect) => sync$2(() =
8781
8781
  }
8782
8782
  }));
8783
8783
  const deferredDone = /*#__PURE__*/ dual(2, (self, exit) => deferredCompleteWith(self, exit));
8784
- const deferredFail = /*#__PURE__*/ dual(2, (self, error) => deferredCompleteWith(self, fail$10(error)));
8784
+ const deferredFail = /*#__PURE__*/ dual(2, (self, error) => deferredCompleteWith(self, fail$11(error)));
8785
8785
  const deferredFailCause = /*#__PURE__*/ dual(2, (self, cause) => deferredCompleteWith(self, failCause$6(cause)));
8786
8786
  const deferredInterrupt = (self) => flatMap$6(fiberId, (fiberId) => deferredCompleteWith(self, interruptWith(fiberId)));
8787
8787
  const deferredInterruptWith = /*#__PURE__*/ dual(2, (self, fiberId) => deferredCompleteWith(self, interruptWith(fiberId)));
@@ -8843,7 +8843,7 @@ const empty$12 = empty$21;
8843
8843
  * @since 2.0.0
8844
8844
  * @category Constructors
8845
8845
  */
8846
- const fail$9 = fail$11;
8846
+ const fail$10 = fail$12;
8847
8847
  /**
8848
8848
  * Creates a `Die` cause from an unexpected error.
8849
8849
  *
@@ -9141,7 +9141,7 @@ const complete$1 = deferredComplete;
9141
9141
  * @since 2.0.0
9142
9142
  * @category utils
9143
9143
  */
9144
- const fail$8 = deferredFail;
9144
+ const fail$9 = deferredFail;
9145
9145
  /**
9146
9146
  * Fails the `Deferred` with the specified `Cause`, which will be propagated to
9147
9147
  * all fibers waiting on the value of the `Deferred`.
@@ -9490,7 +9490,7 @@ const makeFlat = (options) => ({
9490
9490
  /** @internal */
9491
9491
  const fromFlat = (flat) => make$33({
9492
9492
  load: (config) => flatMap$6(fromFlatLoop(flat, empty$26(), config, false), (chunk) => match$8(head$2(chunk), {
9493
- onNone: () => fail$10(MissingData(empty$26(), `Expected a single value having structure: ${config}`)),
9493
+ onNone: () => fail$11(MissingData(empty$26(), `Expected a single value having structure: ${config}`)),
9494
9494
  onSome: succeed$8
9495
9495
  })),
9496
9496
  flattened: flat
@@ -9549,10 +9549,10 @@ const fromFlatLoop = (flat, prefix, config, split) => {
9549
9549
  switch (op._tag) {
9550
9550
  case OP_CONSTANT: return succeed$8(of$2(op.value));
9551
9551
  case OP_DESCRIBED: return suspend$7(() => fromFlatLoop(flat, prefix, op.config, split));
9552
- case OP_FAIL$1: return fail$10(MissingData(prefix, op.message));
9552
+ case OP_FAIL$1: return fail$11(MissingData(prefix, op.message));
9553
9553
  case OP_FALLBACK: return pipe(suspend$7(() => fromFlatLoop(flat, prefix, op.first, split)), catchAll$1((error1) => {
9554
- if (op.condition(error1)) return pipe(fromFlatLoop(flat, prefix, op.second, split), catchAll$1((error2) => fail$10(Or(error1, error2))));
9555
- return fail$10(error1);
9554
+ if (op.condition(error1)) return pipe(fromFlatLoop(flat, prefix, op.second, split), catchAll$1((error2) => fail$11(Or(error1, error2))));
9555
+ return fail$11(error1);
9556
9556
  }));
9557
9557
  case OP_LAZY: return suspend$7(() => fromFlatLoop(flat, prefix, op.config(), split));
9558
9558
  case OP_MAP_OR_FAIL: return suspend$7(() => pipe(fromFlatLoop(flat, prefix, op.original, split), flatMap$6(forEachSequential((a) => pipe(op.mapOrFail(a), mapError$2(prefixed(appendConfigPath(prefix, op.original))))))));
@@ -9560,7 +9560,7 @@ const fromFlatLoop = (flat, prefix, config, split) => {
9560
9560
  case OP_PRIMITIVE: return pipe(patch$3(prefix, flat.patch), flatMap$6((prefix) => pipe(flat.load(prefix, op, split), flatMap$6((values) => {
9561
9561
  if (values.length === 0) {
9562
9562
  const name = pipe(last(prefix), getOrElse(() => "<n/a>"));
9563
- return fail$10(MissingData([], `Expected ${op.description} with name ${name}`));
9563
+ return fail$11(MissingData([], `Expected ${op.description} with name ${name}`));
9564
9564
  }
9565
9565
  return succeed$8(values);
9566
9566
  }))));
@@ -9579,9 +9579,9 @@ const fromFlatLoop = (flat, prefix, config, split) => {
9579
9579
  }));
9580
9580
  })))));
9581
9581
  case OP_ZIP_WITH$1: return suspend$7(() => pipe(fromFlatLoop(flat, prefix, op.left, split), either$1, flatMap$6((left) => pipe(fromFlatLoop(flat, prefix, op.right, split), either$1, flatMap$6((right$9) => {
9582
- if (isLeft(left) && isLeft(right$9)) return fail$10(And(left.left, right$9.left));
9583
- if (isLeft(left) && isRight(right$9)) return fail$10(left.left);
9584
- if (isRight(left) && isLeft(right$9)) return fail$10(right$9.left);
9582
+ if (isLeft(left) && isLeft(right$9)) return fail$11(And(left.left, right$9.left));
9583
+ if (isLeft(left) && isRight(right$9)) return fail$11(left.left);
9584
+ if (isRight(left) && isLeft(right$9)) return fail$11(right$9.left);
9585
9585
  if (isRight(left) && isRight(right$9)) {
9586
9586
  const path = pipe(prefix, join$4("."));
9587
9587
  const fail = fromFlatLoopFail(prefix, path);
@@ -10699,7 +10699,7 @@ const failCause$4 = /*#__PURE__*/ makeExit({
10699
10699
  * @experimental
10700
10700
  * @category constructors
10701
10701
  */
10702
- const fail$7 = (error) => failCause$4(causeFail(error));
10702
+ const fail$8 = (error) => failCause$4(causeFail(error));
10703
10703
  /**
10704
10704
  * Pause the execution of the current `Micro` effect, and resume it on the next
10705
10705
  * scheduler tick.
@@ -10997,7 +10997,7 @@ const YieldableError = /*#__PURE__*/ function() {
10997
10997
  Object.assign(YieldableError.prototype, MicroProto, StructuralPrototype, {
10998
10998
  [identifier]: "Failure",
10999
10999
  [evaluate]() {
11000
- return fail$7(this);
11000
+ return fail$8(this);
11001
11001
  },
11002
11002
  toString() {
11003
11003
  return this.message ? `${this.name}: ${this.message}` : this.name;
@@ -11335,7 +11335,7 @@ const try_$1 = (arg) => {
11335
11335
  try {
11336
11336
  return succeed$8(internalCall(evaluate));
11337
11337
  } catch (error) {
11338
- return fail$10(onFailure ? internalCall(() => onFailure(error)) : new UnknownException(error, "An unknown error occurred in Effect.try"));
11338
+ return fail$11(onFailure ? internalCall(() => onFailure(error)) : new UnknownException(error, "An unknown error occurred in Effect.try"));
11339
11339
  }
11340
11340
  });
11341
11341
  };
@@ -11408,7 +11408,7 @@ const promise$1 = (evaluate) => evaluate.length >= 1 ? async_((resolve, signal)
11408
11408
  const provideService$1 = /*#__PURE__*/ dual(3, (self, tag, service) => contextWithEffect((env) => provideContext$1(self, add(env, tag, service))));
11409
11409
  const provideServiceEffect = /*#__PURE__*/ dual(3, (self, tag, effect) => contextWithEffect((env) => flatMap$6(effect, (service) => provideContext$1(self, pipe(env, add(tag, service))))));
11410
11410
  const sandbox$1 = (self) => matchCauseEffect$2(self, {
11411
- onFailure: fail$10,
11411
+ onFailure: fail$11,
11412
11412
  onSuccess: succeed$8
11413
11413
  });
11414
11414
  const sleep$1 = sleep$2;
@@ -11426,7 +11426,7 @@ const tryPromise$1 = (arg) => {
11426
11426
  evaluate = arg.try;
11427
11427
  catcher = arg.catch;
11428
11428
  }
11429
- const fail = (e) => catcher ? failSync(() => catcher(e)) : fail$10(new UnknownException(e, "An unknown error occurred in Effect.tryPromise"));
11429
+ const fail = (e) => catcher ? failSync(() => catcher(e)) : fail$11(new UnknownException(e, "An unknown error occurred in Effect.tryPromise"));
11430
11430
  if (evaluate.length >= 1) return async_((resolve, signal) => {
11431
11431
  try {
11432
11432
  evaluate(signal).then((a) => resolve(succeed$8(a)), (e) => resolve(fail(e)));
@@ -11491,7 +11491,7 @@ const die$1 = exitDie$1;
11491
11491
  * @since 2.0.0
11492
11492
  * @category constructors
11493
11493
  */
11494
- const fail$6 = exitFail;
11494
+ const fail$7 = exitFail;
11495
11495
  /**
11496
11496
  * Constructs a new `Exit.Failure` from the specified `Cause` of type `E`.
11497
11497
  *
@@ -13667,10 +13667,10 @@ var FiberRuntime = class extends Class {
13667
13667
  return sync$2(() => unsafeGet(this.currentContext, op));
13668
13668
  }
13669
13669
  ["Left"](op) {
13670
- return fail$10(op.left);
13670
+ return fail$11(op.left);
13671
13671
  }
13672
13672
  ["None"](_) {
13673
- return fail$10(new NoSuchElementException$2());
13673
+ return fail$11(new NoSuchElementException$2());
13674
13674
  }
13675
13675
  ["Right"](op) {
13676
13676
  return exitSucceed$1(op.right);
@@ -13686,7 +13686,7 @@ var FiberRuntime = class extends Class {
13686
13686
  if (exit._tag === "Success") return resume(exitSucceed$1(exit.value));
13687
13687
  switch (exit.cause._tag) {
13688
13688
  case "Interrupt": return resume(exitFailCause$1(interrupt$5(none$2)));
13689
- case "Fail": return resume(fail$10(exit.cause.error));
13689
+ case "Fail": return resume(fail$11(exit.cause.error));
13690
13690
  case "Die": return resume(die$3(exit.cause.defect));
13691
13691
  }
13692
13692
  });
@@ -13946,7 +13946,7 @@ const allValidate = (effects, reconcile, options) => {
13946
13946
  errors[i] = none;
13947
13947
  }
13948
13948
  }
13949
- if (errored) return reconcile._tag === "Some" ? fail$10(reconcile.value(errors)) : fail$10(errors);
13949
+ if (errored) return reconcile._tag === "Some" ? fail$11(reconcile.value(errors)) : fail$11(errors);
13950
13950
  else if (options?.discard) return void_$4;
13951
13951
  return reconcile._tag === "Some" ? succeed$8(reconcile.value(successes)) : succeed$8(successes);
13952
13952
  });
@@ -15934,7 +15934,7 @@ var ScheduleDriverImpl = class {
15934
15934
  next(input) {
15935
15935
  return pipe(map$8(get$4(this.ref), (tuple) => tuple[1]), flatMap$6((state) => pipe(currentTimeMillis, flatMap$6((now) => pipe(suspend$7(() => this.schedule.step(now, input, state)), flatMap$6(([state, out, decision]) => {
15936
15936
  const setState = set$2(this.ref, [some(out), state]);
15937
- if (isDone(decision)) return setState.pipe(zipRight$3(fail$10(none$4())));
15937
+ if (isDone(decision)) return setState.pipe(zipRight$3(fail$11(none$4())));
15938
15938
  const millis$1 = start$1(decision.intervals) - now;
15939
15939
  if (millis$1 <= 0) return setState.pipe(zipRight$3(updateInfo(this.iterationMeta, now, input, out)), as$1(out));
15940
15940
  const duration = millis(millis$1);
@@ -16072,12 +16072,12 @@ const scheduleDefectWrap = (self) => catchAll$1(self, (e) => die$3(new ScheduleD
16072
16072
  /** @internal */
16073
16073
  const scheduleDefectRefailCause = (cause) => match$8(find(cause, (_) => isDieType$1(_) && isScheduleDefect(_.defect) ? some(_.defect) : none$4()), {
16074
16074
  onNone: () => cause,
16075
- onSome: (error) => fail$11(error.error)
16075
+ onSome: (error) => fail$12(error.error)
16076
16076
  });
16077
16077
  /** @internal */
16078
16078
  const scheduleDefectRefail = (effect) => catchAllCause$1(effect, (cause) => failCause$6(scheduleDefectRefailCause(cause)));
16079
16079
  /** @internal */
16080
- const repeat_Effect = /*#__PURE__*/ dual(2, (self, schedule) => repeatOrElse_Effect(self, schedule, (e, _) => fail$10(e)));
16080
+ const repeat_Effect = /*#__PURE__*/ dual(2, (self, schedule) => repeatOrElse_Effect(self, schedule, (e, _) => fail$11(e)));
16081
16081
  /** @internal */
16082
16082
  const repeat_combined = /*#__PURE__*/ dual(2, (self, options) => {
16083
16083
  if (isSchedule(options)) return repeat_Effect(self, options);
@@ -16109,7 +16109,7 @@ const repeatOrElseEffectLoop = (self, driver, orElse, value) => matchEffect$1(dr
16109
16109
  })
16110
16110
  });
16111
16111
  /** @internal */
16112
- const retry_Effect = /*#__PURE__*/ dual(2, (self, policy) => retryOrElse_Effect(self, policy, (e, _) => fail$10(e)));
16112
+ const retry_Effect = /*#__PURE__*/ dual(2, (self, policy) => retryOrElse_Effect(self, policy, (e, _) => fail$11(e)));
16113
16113
  /** @internal */
16114
16114
  const retry_combined = /*#__PURE__*/ dual(2, (self, options) => {
16115
16115
  if (isSchedule(options)) return retry_Effect(self, options);
@@ -16876,7 +16876,7 @@ const withFiberRuntime = withFiberRuntime$1;
16876
16876
  * @since 2.0.0
16877
16877
  * @category Creating Effects
16878
16878
  */
16879
- const fail$5 = fail$10;
16879
+ const fail$6 = fail$11;
16880
16880
  /**
16881
16881
  * Creates an `Effect` that fails with the specified `Cause`.
16882
16882
  *
@@ -21005,7 +21005,7 @@ const collectElementsReader = (builder) => readWith({
21005
21005
  onInput: (outElem) => flatMap$3(sync(() => {
21006
21006
  builder.push(outElem);
21007
21007
  }), () => collectElementsReader(builder)),
21008
- onFailure: fail$4,
21008
+ onFailure: fail$5,
21009
21009
  onDone: succeedNow
21010
21010
  });
21011
21011
  /** @internal */
@@ -21049,7 +21049,7 @@ const ensuringWith = /*#__PURE__*/ dual(2, (self, finalizer) => {
21049
21049
  return op;
21050
21050
  });
21051
21051
  /** @internal */
21052
- const fail$4 = (error) => failCause$1(fail$9(error));
21052
+ const fail$5 = (error) => failCause$1(fail$10(error));
21053
21053
  /** @internal */
21054
21054
  const failCause$1 = (cause) => failCauseSync(() => cause);
21055
21055
  /** @internal */
@@ -22036,7 +22036,7 @@ var SingleProducerAsyncInputImpl = class {
22036
22036
  }));
22037
22037
  }
22038
22038
  get take() {
22039
- return this.takeWith((cause) => failCause$3(map$7(cause, left)), (elem) => succeed$5(elem), (done) => fail$6(right(done)));
22039
+ return this.takeWith((cause) => failCause$3(map$7(cause, left)), (elem) => succeed$5(elem), (done) => fail$7(right(done)));
22040
22040
  }
22041
22041
  takeWith(onError, onElement, onDone) {
22042
22042
  return flatMap$4(make$35(), (deferred) => flatten$5(modify(this.ref, (state) => {
@@ -22087,7 +22087,7 @@ const fromInput = (input) => unwrap$2(input.takeWith(failCause$1, (elem) => flat
22087
22087
  /** @internal */
22088
22088
  const identityChannel = () => readWith({
22089
22089
  onInput: (input) => flatMap$3(write$1(input), () => identityChannel()),
22090
- onFailure: fail$4,
22090
+ onFailure: fail$5,
22091
22091
  onDone: succeedNow
22092
22092
  });
22093
22093
  /** @internal */
@@ -22096,7 +22096,7 @@ const map$3 = /*#__PURE__*/ dual(2, (self, f) => flatMap$3(self, (a) => sync(()
22096
22096
  const mapOut = /*#__PURE__*/ dual(2, (self, f) => {
22097
22097
  const reader = readWith({
22098
22098
  onInput: (outElem) => flatMap$3(write$1(f(outElem)), () => reader),
22099
- onFailure: fail$4,
22099
+ onFailure: fail$5,
22100
22100
  onDone: succeedNow
22101
22101
  });
22102
22102
  return pipeTo$1(self, reader);
@@ -22261,15 +22261,15 @@ const pipeToOrFail = /*#__PURE__*/ dual(2, (self, that) => suspend$4(() => {
22261
22261
  });
22262
22262
  const writer = readWithCause({
22263
22263
  onInput: (outElem) => pipe(write$1(outElem), flatMap$3(() => writer)),
22264
- onFailure: (cause) => isDieType(cause) && isChannelException(cause.defect) && equals$2(cause.defect, channelException) ? fail$4(cause.defect.error) : failCause$1(cause),
22264
+ onFailure: (cause) => isDieType(cause) && isChannelException(cause.defect) && equals$2(cause.defect, channelException) ? fail$5(cause.defect.error) : failCause$1(cause),
22265
22265
  onDone: succeedNow
22266
22266
  });
22267
22267
  return pipeTo$1(pipeTo$1(pipeTo$1(self, reader), that), writer);
22268
22268
  }));
22269
22269
  /** @internal */
22270
- const run$5 = (self) => scopedWith$1((scope) => runIn(self, scope));
22270
+ const run$6 = (self) => scopedWith$1((scope) => runIn(self, scope));
22271
22271
  /** @internal */
22272
- const runDrain = (self) => run$5(drain$2(self));
22272
+ const runDrain = (self) => run$6(drain$2(self));
22273
22273
  /** @internal */
22274
22274
  const runScoped = (self) => scopeWith((scope) => runIn(self, scope));
22275
22275
  /** @internal */
@@ -22428,7 +22428,7 @@ const foldChunksReader = (s, contFn, f) => {
22428
22428
  if (!contFn(s)) return succeedNow(s);
22429
22429
  return readWith({
22430
22430
  onInput: (input) => foldChunksReader(f(s, input), contFn, f),
22431
- onFailure: fail$4,
22431
+ onFailure: fail$5,
22432
22432
  onDone: () => succeedNow(s)
22433
22433
  });
22434
22434
  };
@@ -22652,10 +22652,10 @@ const make$12 = (emit) => {
22652
22652
  })));
22653
22653
  },
22654
22654
  end() {
22655
- return this(fail$5(none$4()));
22655
+ return this(fail$6(none$4()));
22656
22656
  },
22657
22657
  fail(e) {
22658
- return this(fail$5(some(e)));
22658
+ return this(fail$6(some(e)));
22659
22659
  },
22660
22660
  fromEffect(effect) {
22661
22661
  return this(mapBoth$1(effect, {
@@ -22698,7 +22698,7 @@ const chunk = (chunk) => new TakeImpl(succeed$5(chunk));
22698
22698
  /** @internal */
22699
22699
  const done = (self) => suspend$5(() => self.exit);
22700
22700
  /** @internal */
22701
- const end$1 = /*#__PURE__*/ new TakeImpl(/*#__PURE__*/ fail$6(/*#__PURE__*/ none$4()));
22701
+ const end$1 = /*#__PURE__*/ new TakeImpl(/*#__PURE__*/ fail$7(/*#__PURE__*/ none$4()));
22702
22702
  /** @internal */
22703
22703
  const failCause = (cause) => new TakeImpl(failCause$3(pipe(cause, map$7(some))));
22704
22704
  /** @internal */
@@ -22720,7 +22720,7 @@ const match = /*#__PURE__*/ dual(2, (self, { onEnd, onFailure, onSuccess }) => m
22720
22720
  //#endregion
22721
22721
  //#region node_modules/effect/dist/esm/internal/stream/pull.js
22722
22722
  /** @internal */
22723
- const end = () => fail$5(none$4());
22723
+ const end = () => fail$6(none$4());
22724
22724
  /** @internal */
22725
22725
  const StreamTypeId = /*#__PURE__*/ Symbol.for("effect/Stream");
22726
22726
  /** @internal */
@@ -22833,7 +22833,7 @@ const fromEffect$1 = (effect) => pipe(effect, mapError$1(some), fromEffectOption
22833
22833
  const fromEffectOption = (effect) => new StreamImpl(unwrap$2(match$2(effect, {
22834
22834
  onFailure: match$8({
22835
22835
  onNone: () => void_$1,
22836
- onSome: fail$4
22836
+ onSome: fail$5
22837
22837
  }),
22838
22838
  onSuccess: (a) => write$1(of$1(a))
22839
22839
  })));
@@ -22842,18 +22842,18 @@ const map$1 = /*#__PURE__*/ dual(2, (self, f) => new StreamImpl(pipe(toChannel$2
22842
22842
  /** @internal */
22843
22843
  const mapChunks$1 = /*#__PURE__*/ dual(2, (self, f) => new StreamImpl(pipe(toChannel$2(self), mapOut(f))));
22844
22844
  /** @internal */
22845
- const mkString$1 = (self) => run$4(self, mkString$2);
22845
+ const mkString$1 = (self) => run$5(self, mkString$2);
22846
22846
  /** @internal */
22847
22847
  const pipeThroughChannel = /*#__PURE__*/ dual(2, (self, channel) => new StreamImpl(pipeTo$1(toChannel$2(self), channel)));
22848
22848
  /** @internal */
22849
22849
  const repeatEffectChunkOption = (effect) => unfoldChunkEffect(effect, (effect) => pipe(map$4(effect, (chunk) => some([chunk, effect])), catchAll(match$8({
22850
22850
  onNone: () => succeed$3(none$4()),
22851
- onSome: fail$5
22851
+ onSome: fail$6
22852
22852
  }))));
22853
22853
  /** @internal */
22854
- const run$4 = /*#__PURE__*/ dual(2, (self, sink) => toChannel$2(self).pipe(pipeToOrFail(toChannel$3(sink)), runDrain));
22854
+ const run$5 = /*#__PURE__*/ dual(2, (self, sink) => toChannel$2(self).pipe(pipeToOrFail(toChannel$3(sink)), runDrain));
22855
22855
  /** @internal */
22856
- const runCollect$1 = (self) => run$4(self, collectAll());
22856
+ const runCollect$1 = (self) => run$5(self, collectAll());
22857
22857
  /** @internal */
22858
22858
  const runIntoQueueScoped = /*#__PURE__*/ dual(2, (self, queue) => {
22859
22859
  const writer = readWithCause({
@@ -22880,7 +22880,7 @@ const transduce$1 = /*#__PURE__*/ dual(2, (self, sink) => {
22880
22880
  const leftover = leftovers.ref;
22881
22881
  if (isEmpty$7(leftover)) return readWith({
22882
22882
  onInput: (input) => pipe(write$1(input), flatMap$3(() => buffer)),
22883
- onFailure: fail$4,
22883
+ onFailure: fail$5,
22884
22884
  onDone: succeedNow
22885
22885
  });
22886
22886
  leftovers.ref = empty$25();
@@ -22894,7 +22894,7 @@ const transduce$1 = /*#__PURE__*/ dual(2, (self, sink) => {
22894
22894
  };
22895
22895
  const upstreamMarker = readWith({
22896
22896
  onInput: (input) => flatMap$3(write$1(input), () => upstreamMarker),
22897
- onFailure: fail$4,
22897
+ onFailure: fail$5,
22898
22898
  onDone: (done) => zipRight(sync(() => {
22899
22899
  upstreamDone.ref = true;
22900
22900
  }), succeedNow(done))
@@ -25445,7 +25445,7 @@ const succeed = right;
25445
25445
  * @category constructors
25446
25446
  * @since 3.10.0
25447
25447
  */
25448
- const fail$3 = left;
25448
+ const fail$4 = left;
25449
25449
  const _try = try_$2;
25450
25450
  /**
25451
25451
  * @category constructors
@@ -25635,7 +25635,7 @@ const go = (ast, isDecoding) => {
25635
25635
  case "BooleanKeyword": return fromRefinement(ast, isBoolean);
25636
25636
  case "BigIntKeyword": return fromRefinement(ast, isBigInt);
25637
25637
  case "SymbolKeyword": return fromRefinement(ast, isSymbol);
25638
- case "ObjectKeyword": return fromRefinement(ast, isObject$2);
25638
+ case "ObjectKeyword": return fromRefinement(ast, isObject$3);
25639
25639
  case "Enums": return fromRefinement(ast, (u) => ast.enums.some(([_, value]) => value === u));
25640
25640
  case "TemplateLiteral": {
25641
25641
  const regex = getTemplateLiteralRegExp(ast);
@@ -26330,7 +26330,7 @@ const getArrayFormatterIssues = (issue, parentTag, path) => {
26330
26330
  *
26331
26331
  * @since 2.0.0
26332
26332
  */
26333
- const pick = /*#__PURE__*/ dual((args) => isObject$2(args[0]), (s, ...keys) => {
26333
+ const pick = /*#__PURE__*/ dual((args) => isObject$3(args[0]), (s, ...keys) => {
26334
26334
  const out = {};
26335
26335
  for (const k of keys) if (k in s) out[k] = s[k];
26336
26336
  return out;
@@ -26349,7 +26349,7 @@ const pick = /*#__PURE__*/ dual((args) => isObject$2(args[0]), (s, ...keys) => {
26349
26349
  *
26350
26350
  * @since 2.0.0
26351
26351
  */
26352
- const omit = /*#__PURE__*/ dual((args) => isObject$2(args[0]), (s, ...keys) => {
26352
+ const omit = /*#__PURE__*/ dual((args) => isObject$3(args[0]), (s, ...keys) => {
26353
26353
  const out = { ...s };
26354
26354
  for (const k of keys) delete out[k];
26355
26355
  return out;
@@ -26470,7 +26470,7 @@ const decodeUnknown = (schema, options) => {
26470
26470
  * @category guards
26471
26471
  * @since 3.10.0
26472
26472
  */
26473
- const isSchema = (u) => hasProperty(u, TypeId$7) && isObject$2(u[TypeId$7]);
26473
+ const isSchema = (u) => hasProperty(u, TypeId$7) && isObject$3(u[TypeId$7]);
26474
26474
  function getDefaultLiteralAST(literals) {
26475
26475
  return isMembers(literals) ? Union$1.make(mapMembers(literals, (literal) => new Literal$1(literal))) : new Literal$1(literals[0]);
26476
26476
  }
@@ -26487,7 +26487,7 @@ function Literal(...literals) {
26487
26487
  }
26488
26488
  const declareConstructor = (typeParameters, options, annotations) => makeDeclareClass(typeParameters, new Declaration(typeParameters.map((tp) => tp.ast), (...typeParameters) => options.decode(...typeParameters.map(make$10)), (...typeParameters) => options.encode(...typeParameters.map(make$10)), toASTAnnotations(annotations)));
26489
26489
  const declarePrimitive = (is, annotations) => {
26490
- const decodeUnknown = () => (input, _, ast) => is(input) ? succeed(input) : fail$3(new Type(ast, input));
26490
+ const decodeUnknown = () => (input, _, ast) => is(input) ? succeed(input) : fail$4(new Type(ast, input));
26491
26491
  return makeDeclareClass([], new Declaration([], decodeUnknown, decodeUnknown, toASTAnnotations(annotations)));
26492
26492
  };
26493
26493
  function makeDeclareClass(typeParameters, ast) {
@@ -27177,8 +27177,8 @@ const LengthSchemaId = LengthSchemaId$1;
27177
27177
  * @since 3.10.0
27178
27178
  */
27179
27179
  const length = (length, annotations) => (self) => {
27180
- const minLength = isObject$2(length) ? Math.max(0, Math.floor(length.min)) : Math.max(0, Math.floor(length));
27181
- const maxLength = isObject$2(length) ? Math.max(minLength, Math.floor(length.max)) : minLength;
27180
+ const minLength = isObject$3(length) ? Math.max(0, Math.floor(length.min)) : Math.max(0, Math.floor(length));
27181
+ const maxLength = isObject$3(length) ? Math.max(minLength, Math.floor(length.max)) : minLength;
27182
27182
  if (minLength !== maxLength) return self.pipe(filter((a) => a.length >= minLength && a.length <= maxLength, {
27183
27183
  schemaId: LengthSchemaId,
27184
27184
  title: `length({ min: ${minLength}, max: ${maxLength})`,
@@ -27651,7 +27651,7 @@ transform$1(/*#__PURE__*/ Boolean$.annotations({ description: "a boolean that wi
27651
27651
  });
27652
27652
  const encodeSymbol = (sym, ast) => {
27653
27653
  const key = Symbol.keyFor(sym);
27654
- return key === void 0 ? fail$3(new Type(ast, sym, `Unable to encode a unique symbol ${String(sym)} into a string`)) : succeed(key);
27654
+ return key === void 0 ? fail$4(new Type(ast, sym, `Unable to encode a unique symbol ${String(sym)} into a string`)) : succeed(key);
27655
27655
  };
27656
27656
  const decodeSymbol = (s) => succeed(Symbol.for(s));
27657
27657
  transformOrFail(String$.annotations({ description: "a string to be decoded into a globally shared symbol" }), SymbolFromSelf, {
@@ -27737,7 +27737,7 @@ transformOrFail(NonNegativeBigIntFromSelf.annotations({ description: "a bigint t
27737
27737
  strict: true,
27738
27738
  decode: (i) => succeed(nanos(i)),
27739
27739
  encode: (a, _, ast) => match$8(toNanos(a), {
27740
- onNone: () => fail$3(new Type(ast, a, `Unable to encode ${a} into a bigint`)),
27740
+ onNone: () => fail$4(new Type(ast, a, `Unable to encode ${a} into a bigint`)),
27741
27741
  onSome: (nanos) => succeed(nanos)
27742
27742
  })
27743
27743
  }).annotations({ identifier: "DurationFromNanos" });
@@ -27961,7 +27961,7 @@ var TimeZoneFromSelf = class extends Union(TimeZoneOffsetFromSelf, TimeZoneNamed
27961
27961
  transformOrFail(String$.annotations({ description: "a string to be decoded into a TimeZone" }), TimeZoneFromSelf, {
27962
27962
  strict: true,
27963
27963
  decode: (i, _, ast) => match$8(zoneFromString(i), {
27964
- onNone: () => fail$3(new Type(ast, i, `Unable to decode ${JSON.stringify(i)} into a TimeZone`)),
27964
+ onNone: () => fail$4(new Type(ast, i, `Unable to decode ${JSON.stringify(i)} into a TimeZone`)),
27965
27965
  onSome: succeed
27966
27966
  }),
27967
27967
  encode: (a) => succeed(zoneToString(a))
@@ -27987,7 +27987,7 @@ var DateTimeZonedFromSelf = class extends declare((u) => isDateTime(u) && isZone
27987
27987
  transformOrFail(String$.annotations({ description: "a string to be decoded into a DateTime.Zoned" }), DateTimeZonedFromSelf, {
27988
27988
  strict: true,
27989
27989
  decode: (i, _, ast) => match$8(makeZonedFromString(i), {
27990
- onNone: () => fail$3(new Type(ast, i, `Unable to decode ${JSON.stringify(i)} into a DateTime.Zoned`)),
27990
+ onNone: () => fail$4(new Type(ast, i, `Unable to decode ${JSON.stringify(i)} into a DateTime.Zoned`)),
27991
27991
  onSome: succeed
27992
27992
  }),
27993
27993
  encode: (a) => succeed(formatIsoZoned(a))
@@ -28001,7 +28001,7 @@ const optionPretty = (value) => match$8({
28001
28001
  onNone: () => "none()",
28002
28002
  onSome: (a) => `some(${value(a)})`
28003
28003
  });
28004
- const optionParse = (decodeUnknown) => (u, options, ast) => isOption(u) ? isNone(u) ? succeed(none$4()) : toComposite(decodeUnknown(u.value, options), some, ast, u) : fail$3(new Type(ast, u));
28004
+ const optionParse = (decodeUnknown) => (u, options, ast) => isOption(u) ? isNone(u) ? succeed(none$4()) : toComposite(decodeUnknown(u.value, options), some, ast, u) : fail$4(new Type(ast, u));
28005
28005
  const OptionFromSelf_ = (value) => {
28006
28006
  return declare([value], {
28007
28007
  decode: (value) => optionParse(decodeUnknown$1(value)),
@@ -28044,7 +28044,7 @@ var BigDecimalFromSelf = class extends declare(isBigDecimal, {
28044
28044
  transformOrFail(String$.annotations({ description: "a string to be decoded into a BigDecimal" }), BigDecimalFromSelf, {
28045
28045
  strict: true,
28046
28046
  decode: (i, _, ast) => fromString$1(i).pipe(match$8({
28047
- onNone: () => fail$3(new Type(ast, i, `Unable to decode ${JSON.stringify(i)} into a BigDecimal`)),
28047
+ onNone: () => fail$4(new Type(ast, i, `Unable to decode ${JSON.stringify(i)} into a BigDecimal`)),
28048
28048
  onSome: (val) => succeed(normalize(val))
28049
28049
  })),
28050
28050
  encode: (a) => succeed(format$1(normalize(a)))
@@ -28166,7 +28166,7 @@ const makeClass = ({ Base, annotations, disableToString, fields, identifier, kin
28166
28166
  let out = astCache.get(this);
28167
28167
  if (out) return out;
28168
28168
  const declaration = declare([schema], {
28169
- decode: () => (input, _, ast) => input instanceof this || fallbackInstanceOf(input) ? succeed(input) : fail$3(new Type(ast, input)),
28169
+ decode: () => (input, _, ast) => input instanceof this || fallbackInstanceOf(input) ? succeed(input) : fail$4(new Type(ast, input)),
28170
28170
  encode: () => (input, options) => input instanceof this ? succeed(input) : map(encodeUnknown(typeSide)(input, options), (props) => new this(props, true))
28171
28171
  }, {
28172
28172
  identifier,
@@ -28393,7 +28393,7 @@ const causePretty = (error) => (cause) => {
28393
28393
  };
28394
28394
  return f(cause);
28395
28395
  };
28396
- const causeParse = (decodeUnknown) => (u, options, ast) => isCause(u) ? toComposite(decodeUnknown(causeEncode(u), options), causeDecode, ast, u) : fail$3(new Type(ast, u));
28396
+ const causeParse = (decodeUnknown) => (u, options, ast) => isCause(u) ? toComposite(decodeUnknown(causeEncode(u), options), causeDecode, ast, u) : fail$4(new Type(ast, u));
28397
28397
  /**
28398
28398
  * @category Cause transformations
28399
28399
  * @since 3.10.0
@@ -28412,7 +28412,7 @@ const CauseFromSelf = ({ defect, error }) => {
28412
28412
  function causeDecode(cause) {
28413
28413
  switch (cause._tag) {
28414
28414
  case "Empty": return empty$12;
28415
- case "Fail": return fail$9(cause.error);
28415
+ case "Fail": return fail$10(cause.error);
28416
28416
  case "Die": return die$2(cause.defect);
28417
28417
  case "Interrupt": return interrupt$3(fiberIdDecode(cause.fiberId));
28418
28418
  case "Sequential": return sequential$2(causeDecode(cause.left), causeDecode(cause.right));
@@ -28478,7 +28478,7 @@ const Cause = ({ defect, error }) => {
28478
28478
  var Defect = class extends transform$1(Unknown, Unknown, {
28479
28479
  strict: true,
28480
28480
  decode: (i) => {
28481
- if (isObject$2(i) && "message" in i && typeof i.message === "string") {
28481
+ if (isObject$3(i) && "message" in i && typeof i.message === "string") {
28482
28482
  const err = new Error(i.message, { cause: i });
28483
28483
  if ("name" in i && typeof i.name === "string") err.name = i.name;
28484
28484
  err.stack = "stack" in i && typeof i.stack === "string" ? i.stack : "";
@@ -28569,7 +28569,7 @@ const mkString = mkString$1;
28569
28569
  * @since 2.0.0
28570
28570
  * @category destructors
28571
28571
  */
28572
- const run$3 = run$4;
28572
+ const run$4 = run$5;
28573
28573
  /**
28574
28574
  * Runs the stream and collects all of its elements to a chunk.
28575
28575
  *
@@ -28716,7 +28716,7 @@ const makeExecutor$1 = (start) => {
28716
28716
  stream,
28717
28717
  string: (command, encoding = "utf-8") => {
28718
28718
  const decoder = new TextDecoder(encoding);
28719
- return pipe(start(command), flatMap$4((process) => run$3(process.stdout, collectUint8Array)), map$4((bytes) => decoder.decode(bytes)), scoped$3);
28719
+ return pipe(start(command), flatMap$4((process) => run$4(process.stdout, collectUint8Array)), map$4((bytes) => decoder.decode(bytes)), scoped$3);
28720
28720
  },
28721
28721
  lines: (command, encoding = "utf-8") => {
28722
28722
  return pipe(streamLines(command, encoding), runCollect, map$4(toArray$1));
@@ -28995,11 +28995,11 @@ var SystemError = class extends TaggedError("@effect/platform/Error/SystemError"
28995
28995
  const effectify$1 = (fn, onError, onSyncError) => (...args) => async((resume) => {
28996
28996
  try {
28997
28997
  fn(...args, (err, result) => {
28998
- if (err) resume(fail$5(onError ? onError(err, args) : err));
28998
+ if (err) resume(fail$6(onError ? onError(err, args) : err));
28999
28999
  else resume(succeed$3(result));
29000
29000
  });
29001
29001
  } catch (err) {
29002
- resume(onSyncError ? fail$5(onSyncError(err, args)) : die(err));
29002
+ resume(onSyncError ? fail$6(onSyncError(err, args)) : die(err));
29003
29003
  }
29004
29004
  });
29005
29005
  //#endregion
@@ -29020,7 +29020,7 @@ bigint1024 * bigint1024 * bigint1024 * bigint1024 * bigint1024;
29020
29020
  const make$7 = (impl) => {
29021
29021
  return tag$1.of({
29022
29022
  ...impl,
29023
- exists: (path) => pipe(impl.access(path), as(true), catchTag("SystemError", (e) => e.reason === "NotFound" ? succeed$3(false) : fail$5(e))),
29023
+ exists: (path) => pipe(impl.access(path), as(true), catchTag("SystemError", (e) => e.reason === "NotFound" ? succeed$3(false) : fail$6(e))),
29024
29024
  readFileString: (path, encoding) => tryMap(impl.readFile(path), {
29025
29025
  try: (_) => new TextDecoder(encoding).decode(_),
29026
29026
  catch: (cause) => new BadArgument({
@@ -29840,7 +29840,7 @@ const layerManager$3 = /*#__PURE__*/ effect$1(WorkerManager, /* @__PURE__ */ gen
29840
29840
  return DeferredTypeId in mailbox ? succeed$7(mailbox, response[2][0]) : zipRight$1(mailbox.offerAll(response[2]), mailbox.end);
29841
29841
  case 2:
29842
29842
  case 3: {
29843
- if (response[1] === 2) return DeferredTypeId in mailbox ? fail$8(mailbox, response[2]) : mailbox.fail(response[2]);
29843
+ if (response[1] === 2) return DeferredTypeId in mailbox ? fail$9(mailbox, response[2]) : mailbox.fail(response[2]);
29844
29844
  const cause = WorkerError.decodeCause(response[2]);
29845
29845
  return DeferredTypeId in mailbox ? failCause$5(mailbox, cause) : mailbox.failCause(cause);
29846
29846
  }
@@ -30144,7 +30144,7 @@ const makeFile = /*#__PURE__*/ (() => {
30144
30144
  }
30145
30145
  writeAllChunk(buffer) {
30146
30146
  return flatMap$4(suspend$5(() => nodeWriteAll(this.fd, buffer, void 0, void 0, this.append ? void 0 : Number(this.position))), (bytesWritten) => {
30147
- if (bytesWritten === 0) return fail$5(new SystemError({
30147
+ if (bytesWritten === 0) return fail$6(new SystemError({
30148
30148
  module: "FileSystem",
30149
30149
  method: "writeAll",
30150
30150
  reason: "WriteZero",
@@ -30180,11 +30180,11 @@ const readDirectory = (path, options) => tryPromise({
30180
30180
  const readFile$1 = (path) => async((resume, signal) => {
30181
30181
  try {
30182
30182
  NFS.readFile(path, { signal }, (err, data) => {
30183
- if (err) resume(fail$5(handleErrnoException("FileSystem", "readFile")(err, [path])));
30183
+ if (err) resume(fail$6(handleErrnoException("FileSystem", "readFile")(err, [path])));
30184
30184
  else resume(succeed$3(data));
30185
30185
  });
30186
30186
  } catch (err) {
30187
- resume(fail$5(handleBadArgument("readFile")(err)));
30187
+ resume(fail$6(handleBadArgument("readFile")(err)));
30188
30188
  }
30189
30189
  });
30190
30190
  const readLink = /*#__PURE__*/ (() => {
@@ -30238,7 +30238,7 @@ const watchNode = (path, options) => asyncScoped((emit) => acquireRelease(sync$1
30238
30238
  case "rename":
30239
30239
  emit.fromEffect(matchEffect(stat(path), {
30240
30240
  onSuccess: (_) => succeed$3(WatchEventCreate({ path })),
30241
- onFailure: (err) => err._tag === "SystemError" && err.reason === "NotFound" ? succeed$3(WatchEventRemove({ path })) : fail$5(err)
30241
+ onFailure: (err) => err._tag === "SystemError" && err.reason === "NotFound" ? succeed$3(WatchEventRemove({ path })) : fail$6(err)
30242
30242
  }));
30243
30243
  return;
30244
30244
  case "change":
@@ -30268,11 +30268,11 @@ const writeFile$1 = (path, data, options) => async((resume, signal) => {
30268
30268
  flag: options?.flag,
30269
30269
  mode: options?.mode
30270
30270
  }, (err) => {
30271
- if (err) resume(fail$5(handleErrnoException("FileSystem", "writeFile")(err, [path])));
30271
+ if (err) resume(fail$6(handleErrnoException("FileSystem", "writeFile")(err, [path])));
30272
30272
  else resume(_void);
30273
30273
  });
30274
30274
  } catch (err) {
30275
- resume(fail$5(handleBadArgument("writeFile")(err)));
30275
+ resume(fail$6(handleBadArgument("writeFile")(err)));
30276
30276
  }
30277
30277
  });
30278
30278
  //#endregion
@@ -30356,7 +30356,7 @@ const unsafeReadableRead = (readable, onError, exit, options) => {
30356
30356
  latch.unsafeOpen();
30357
30357
  }
30358
30358
  function onErr(err) {
30359
- exit.current = fail$6(onError(err));
30359
+ exit.current = fail$7(onError(err));
30360
30360
  latch.unsafeOpen();
30361
30361
  }
30362
30362
  function onEnd() {
@@ -30396,7 +30396,7 @@ const fromWritable = (evaluate, onError, options) => fromChannel(fromWritableCha
30396
30396
  const fromWritableChannel = (writable, onError, options) => flatMap$1(zip$1(sync$1(() => writable()), make$35()), ([writable, deferred]) => embedInput(writableOutput(writable, deferred, onError), writeInput(writable, (cause) => failCause$5(deferred, cause), options, complete$1(deferred, _void))));
30397
30397
  const writableOutput = (writable, deferred, onError) => suspend$5(() => {
30398
30398
  function handleError(err) {
30399
- unsafeDone(deferred, fail$5(onError(err)));
30399
+ unsafeDone(deferred, fail$6(onError(err)));
30400
30400
  }
30401
30401
  writable.on("error", handleError);
30402
30402
  return ensuring$2(_await$2(deferred), sync$1(() => {
@@ -30444,7 +30444,7 @@ const runCommand$1 = (fileSystem) => (command) => {
30444
30444
  detached: process.platform !== "win32"
30445
30445
  });
30446
30446
  handle.on("error", (err) => {
30447
- resume(fail$5(toPlatformError("spawn", err, command)));
30447
+ resume(fail$6(toPlatformError("spawn", err, command)));
30448
30448
  });
30449
30449
  handle.on("exit", (...args) => {
30450
30450
  unsafeDone(exitCode, succeed$3(args));
@@ -30458,14 +30458,14 @@ const runCommand$1 = (fileSystem) => (command) => {
30458
30458
  }));
30459
30459
  const killProcessGroup = process.platform === "win32" ? (handle, _) => async((resume) => {
30460
30460
  ChildProcess.exec(`taskkill /pid ${handle.pid} /T /F`, (error) => {
30461
- if (error) resume(fail$5(toPlatformError("kill", toError$2(error), command)));
30461
+ if (error) resume(fail$6(toPlatformError("kill", toError$2(error), command)));
30462
30462
  else resume(_void);
30463
30463
  });
30464
30464
  }) : (handle, signal) => try_({
30465
30465
  try: () => process.kill(-handle.pid, signal),
30466
30466
  catch: (error) => toPlatformError("kill", toError$2(error), command)
30467
30467
  });
30468
- const killProcess = (handle, signal) => suspend$5(() => handle.kill(signal) ? _void : fail$5(toPlatformError("kill", new globalThis.Error("Failed to kill process"), command)));
30468
+ const killProcess = (handle, signal) => suspend$5(() => handle.kill(signal) ? _void : fail$6(toPlatformError("kill", new globalThis.Error("Failed to kill process"), command)));
30469
30469
  return pipe(match$8(command.cwd, {
30470
30470
  onNone: () => _void,
30471
30471
  onSome: (dir) => fileSystem.access(dir)
@@ -30480,7 +30480,7 @@ const runCommand$1 = (fileSystem) => (command) => {
30480
30480
  if (handle.stdin !== null) stdin = fromWritable(() => handle.stdin, (err) => toPlatformError("toWritable", toError$2(err), command));
30481
30481
  const exitCode = flatMap$4(_await$2(exitCodeDeferred), ([code, signal]) => {
30482
30482
  if (code !== null) return succeed$3(ExitCode(code));
30483
- return fail$5(toPlatformError("exitCode", new globalThis.Error(`Process interrupted due to receipt of signal: ${signal}`), command));
30483
+ return fail$6(toPlatformError("exitCode", new globalThis.Error(`Process interrupted due to receipt of signal: ${signal}`), command));
30484
30484
  });
30485
30485
  const isRunning = negate(isDone$4(exitCodeDeferred));
30486
30486
  const kill = (signal = "SIGTERM") => killProcessGroup(handle, signal).pipe(orElse$1(() => killProcess(handle, signal)), zipRight$1(asVoid(_await$2(exitCodeDeferred))));
@@ -30497,7 +30497,7 @@ const runCommand$1 = (fileSystem) => (command) => {
30497
30497
  stderr,
30498
30498
  stdout
30499
30499
  });
30500
- }), typeof command.stdin === "string" ? identity$1 : tap((process) => forkDaemon(run$3(command.stdin, process.stdin))));
30500
+ }), typeof command.stdin === "string" ? identity$1 : tap((process) => forkDaemon(run$4(command.stdin, process.stdin))));
30501
30501
  }
30502
30502
  case "PipedCommand": {
30503
30503
  const flattened = flatten(command);
@@ -30611,7 +30611,7 @@ const layer = /*#__PURE__*/ pipe(/*#__PURE__*/ mergeAll$1(layer$3, layer$5, /* @
30611
30611
  return sync$1(() => readlineInterface.off("line", onLine));
30612
30612
  })), scoped$3);
30613
30613
  const display = (prompt) => uninterruptible(async((resume) => {
30614
- stdout.write(prompt, (err) => err ? resume(fail$5(new BadArgument({
30614
+ stdout.write(prompt, (err) => err ? resume(fail$6(new BadArgument({
30615
30615
  module: "Terminal",
30616
30616
  method: "display",
30617
30617
  description: "Failed to write prompt to stdout",
@@ -30904,7 +30904,7 @@ const human = (name, options = {}) => ctx().step({
30904
30904
  options
30905
30905
  });
30906
30906
  /** A check: `body` runs at the edge and its effect on the tree is committed. */
30907
- const run$2 = (name, body, options = {}) => ctx().step({
30907
+ const run$3 = (name, body, options = {}) => ctx().step({
30908
30908
  kind: "run",
30909
30909
  name,
30910
30910
  body,
@@ -31096,7 +31096,7 @@ const wrote = (path) => changes(path).some((c) => c.status !== "deleted");
31096
31096
  */
31097
31097
  const check = async (name, command, options) => {
31098
31098
  const { report, label, sweep, sweepOnGreen } = options;
31099
- await run$2(name, checkScript(command, {
31099
+ await run$3(name, checkScript(command, {
31100
31100
  report,
31101
31101
  stamp: head().slice(0, 7),
31102
31102
  sweep,
@@ -31181,7 +31181,7 @@ var flows_exports = /* @__PURE__ */ __exportAll({
31181
31181
  restart: () => restart,
31182
31182
  restoreScript: () => restoreScript,
31183
31183
  revertScript: () => revertScript,
31184
- run: () => run$2,
31184
+ run: () => run$3,
31185
31185
  scope: () => scope,
31186
31186
  sectionBodies: () => sectionBodies,
31187
31187
  sections: () => sections,
@@ -49458,7 +49458,7 @@ const packageItem = async (pkg) => {
49458
49458
  if (await specReview(pkg, since)) break;
49459
49459
  await fixSpec(pkg);
49460
49460
  }
49461
- await run$2("closing", removeScript([
49461
+ await run$3("closing", removeScript([
49462
49462
  pkg,
49463
49463
  SPEC_FEEDBACK,
49464
49464
  ".gtd/SATISFIED.md",
@@ -49521,7 +49521,7 @@ const architecturePass = async () => {
49521
49521
  const skip = truncated.length === 0 && answered(answers.architectureWarranted, "no", numeric(vars.architectureSkipMinP, Infinity));
49522
49522
  const plan = read(REQUIREMENTS);
49523
49523
  if (skip && plan !== void 0) {
49524
- await run$2("architecture-promote", moveScript(REQUIREMENTS, `.gtd/packages/01-${slug(sections(plan)[0] ?? "")}.md`), { label: "Promoting the plan straight to a package" });
49524
+ await run$3("architecture-promote", moveScript(REQUIREMENTS, `.gtd/packages/01-${slug(sections(plan)[0] ?? "")}.md`), { label: "Promoting the plan straight to a package" });
49525
49525
  return;
49526
49526
  }
49527
49527
  await architecture();
@@ -49672,7 +49672,7 @@ const finish = async (reviewed, collectedAt, escalations) => {
49672
49672
  const record = read(".gtd/REVIEW.md") ?? "";
49673
49673
  const { folded, settled } = afterCollect(collectedAt);
49674
49674
  const noted = since.some((c) => c.path === REVIEW);
49675
- const close = () => run$2("review.closing", removeScript([REVIEW]), {
49675
+ const close = () => run$3("review.closing", removeScript([REVIEW]), {
49676
49676
  label: "Closing the review",
49677
49677
  base: round
49678
49678
  });
@@ -49837,7 +49837,7 @@ var unified_exports = /* @__PURE__ */ __exportAll({
49837
49837
  /** Revert the sketch that started the process out of the working tree; its intent survives in history. */
49838
49838
  const unwind = () => {
49839
49839
  const commit = head();
49840
- return run$2("unwind", revertScript(commit, FEEDBACK, unwindFailure(commit)), { label: "Unwinding your input" });
49840
+ return run$3("unwind", revertScript(commit, FEEDBACK, unwindFailure(commit)), { label: "Unwinding your input" });
49841
49841
  };
49842
49842
  /**
49843
49843
  * Undo the human's review-round code edits. A path changed since the human
@@ -49845,7 +49845,7 @@ const unwind = () => {
49845
49845
  */
49846
49846
  const reUnwind = async (feedback) => {
49847
49847
  const { base, restoreFrom, edited } = feedback;
49848
- await run$2("re-unwind", restoreScript(base, {
49848
+ await run$3("re-unwind", restoreScript(base, {
49849
49849
  restore: edited.filter((c) => c.status !== "added").map((c) => c.path),
49850
49850
  remove: edited.filter((c) => c.status === "added").map((c) => c.path)
49851
49851
  }, restoreFrom), {
@@ -50050,7 +50050,7 @@ const classifyUntracked = (exec, ref, untrackedPaths) => gen(function* () {
50050
50050
  * `git add`. Callers that expect a probe to fail handle it with an explicit
50051
50051
  * `catchAll`.
50052
50052
  */
50053
- const run$1 = (root, ...args) => scoped$3(gen(function* () {
50053
+ const run$2 = (root, ...args) => scoped$3(gen(function* () {
50054
50054
  const process = yield* (yield* CommandExecutor).start(make$8(...args).pipe(workingDirectory(root), stdout("pipe"), stderr("pipe")));
50055
50055
  const collect = (stream) => stream.pipe(decodeText(), mkString);
50056
50056
  const [stdout$3, stderr$3, exitCode] = yield* all$1([
@@ -50058,7 +50058,7 @@ const run$1 = (root, ...args) => scoped$3(gen(function* () {
50058
50058
  collect(process.stderr),
50059
50059
  process.exitCode
50060
50060
  ], { concurrency: "unbounded" });
50061
- if (exitCode !== 0) return yield* fail$5(/* @__PURE__ */ new Error(`${args.join(" ")} failed (exit ${exitCode}): ${stderr$3.trim()}`));
50061
+ if (exitCode !== 0) return yield* fail$6(/* @__PURE__ */ new Error(`${args.join(" ")} failed (exit ${exitCode}): ${stderr$3.trim()}`));
50062
50062
  return stdout$3;
50063
50063
  })).pipe(mapError$1((e) => e instanceof Error ? e : new Error(String(e))));
50064
50064
  /**
@@ -50082,9 +50082,9 @@ var InvalidRefError = class extends Error {
50082
50082
  * missing one. A separate pure function so this rare branch is unit-testable
50083
50083
  * without a real git repository contriving the condition.
50084
50084
  */
50085
- const resolvedRefOrCorrupted = (ref, hash) => /^[0-9a-f]{40}$/.test(hash) ? succeed$3(hash) : fail$5(new InvalidRefError(`Invalid ref: ${ref}`, [`ref: ${ref}`]));
50085
+ const resolvedRefOrCorrupted = (ref, hash) => /^[0-9a-f]{40}$/.test(hash) ? succeed$3(hash) : fail$6(new InvalidRefError(`Invalid ref: ${ref}`, [`ref: ${ref}`]));
50086
50086
  const makeGitImpl = (executor, root) => {
50087
- const exec = (...args) => run$1(root, ...args).pipe(provide$2(succeed$2(CommandExecutor, executor)));
50087
+ const exec = (...args) => run$2(root, ...args).pipe(provide$2(succeed$2(CommandExecutor, executor)));
50088
50088
  return {
50089
50089
  lastCommitSubject: (ref = "HEAD") => exec("git", "log", "-1", "--pretty=%s", ref).pipe(map$4((s) => s.trim())),
50090
50090
  lastCommitMessage: () => exec("git", "log", "-1", "--pretty=%B").pipe(map$4((s) => s.trim())),
@@ -50109,7 +50109,7 @@ const makeGitImpl = (executor, root) => {
50109
50109
  }),
50110
50110
  resolveRef: (ref) => exec("git", "rev-parse", "--verify", ref).pipe(map$4((s) => s.trim()), flatMap$4((hash) => resolvedRefOrCorrupted(ref, hash))),
50111
50111
  readRefOption: (ref) => exec("git", "rev-parse", "--verify", "--quiet", ref).pipe(map$4((s) => some(s.trim())), catchAll(() => succeed$3(none$4()))),
50112
- isAncestor: (a, b) => run$1(root, "git", "merge-base", "--is-ancestor", a, b).pipe(provide$2(succeed$2(CommandExecutor, executor)), map$4(() => true), catchAll(() => succeed$3(false))),
50112
+ isAncestor: (a, b) => run$2(root, "git", "merge-base", "--is-ancestor", a, b).pipe(provide$2(succeed$2(CommandExecutor, executor)), map$4(() => true), catchAll(() => succeed$3(false))),
50113
50113
  topLevel: () => exec("git", "rev-parse", "--show-toplevel").pipe(map$4((s) => s.trim())),
50114
50114
  gitDir: () => exec("git", "rev-parse", "--absolute-git-dir").pipe(map$4((s) => s.trim())),
50115
50115
  gitCommonDir: () => exec("git", "rev-parse", "--path-format=absolute", "--git-common-dir").pipe(map$4((s) => s.trim())),
@@ -50160,10 +50160,10 @@ const makeGitImpl = (executor, root) => {
50160
50160
  },
50161
50161
  commitAllWithPrefix: (prefix) => gen(function* () {
50162
50162
  yield* exec("git", "add", "-A");
50163
- yield* exec("git", "commit", "--allow-empty", "-m", prefix).pipe(catchAll((error) => error.message.includes("empty git commit") ? exec("git", "commit", "--allow-empty", "--no-verify", "-m", prefix) : fail$5(error)));
50163
+ yield* exec("git", "commit", "--allow-empty", "-m", prefix).pipe(catchAll((error) => error.message.includes("empty git commit") ? exec("git", "commit", "--allow-empty", "--no-verify", "-m", prefix) : fail$6(error)));
50164
50164
  }).pipe(asVoid),
50165
50165
  softResetTo: (ref) => exec("git", "reset", "--soft", ref).pipe(asVoid),
50166
- commitAsIs: (message) => exec("git", "commit", "--allow-empty", "-m", message).pipe(catchAll((error) => error.message.includes("empty git commit") ? exec("git", "commit", "--allow-empty", "--no-verify", "-m", message) : fail$5(error))).pipe(asVoid),
50166
+ commitAsIs: (message) => exec("git", "commit", "--allow-empty", "-m", message).pipe(catchAll((error) => error.message.includes("empty git commit") ? exec("git", "commit", "--allow-empty", "--no-verify", "-m", message) : fail$6(error))).pipe(asVoid),
50167
50167
  discardPending: () => gen(function* () {
50168
50168
  yield* exec("git", "add", "-A");
50169
50169
  yield* exec("git", "reset", "--hard", "HEAD");
@@ -57783,7 +57783,7 @@ const load = gen(function* () {
57783
57783
  const fatal = diagnostics.filter((d) => d.severity === "error");
57784
57784
  if (fatal.length > 0) {
57785
57785
  const lines = fatal.map(formatDiagnostic);
57786
- return yield* fail$5(new GtdError(`gtd config:\n${lines.map((line) => ` - ${line}`).join("\n")}`));
57786
+ return yield* fail$6(new GtdError(`gtd config:\n${lines.map((line) => ` - ${line}`).join("\n")}`));
57787
57787
  }
57788
57788
  const initial = yield* firstStep(loaded, resolveVars(loaded.defaults, compiled.rcVars, {}, host.env), headTree(yield* Workspace));
57789
57789
  return {
@@ -57917,7 +57917,7 @@ const replayToFirstStep = (loaded, vars, tree) => flatMap$4(promise(() => replay
57917
57917
  })), (outcome) => {
57918
57918
  if (outcome.kind === "rest") return succeed$3(outcome.rest.name);
57919
57919
  const problem = outcome.kind === "failed" || outcome.kind === "refused" ? outcome.message.replace(/^gtd: /, "") : "the default entry must begin at a step — that step is where a finished process waits";
57920
- return fail$5(new GtdError(`gtd config:\n - ${loaded.origin}: ${problem}`));
57920
+ return fail$6(new GtdError(`gtd config:\n - ${loaded.origin}: ${problem}`));
57921
57921
  });
57922
57922
  /**
57923
57923
  * The default entry's first step — where a finished process waits — found the
@@ -57932,7 +57932,7 @@ const firstStep = (loaded, vars, head) => gen(function* () {
57932
57932
  if (!empty.read()) return name;
57933
57933
  const atHead = yield* replayToFirstStep(loaded, vars, head);
57934
57934
  if (atHead === name) return name;
57935
- return yield* fail$5(new GtdError(`gtd config:\n - ${loaded.origin}: the flow's first step on an ordinary start depends on the repository's files ("${name}" without them, "${atHead}" at HEAD) — that step is where a finished process waits, so it must not change as files do`));
57935
+ return yield* fail$6(new GtdError(`gtd config:\n - ${loaded.origin}: the flow's first step on an ordinary start depends on the repository's files ("${name}" without them, "${atHead}" at HEAD) — that step is where a finished process waits, so it must not change as files do`));
57936
57936
  });
57937
57937
  var ConfigService = class ConfigService extends Tag("ConfigService")() {
57938
57938
  static Live = succeed$2(ConfigService, { load });
@@ -57952,7 +57952,7 @@ const renderInitScaffold = () => ({ config: JSON.stringify({
57952
57952
  }, null, 2) + "\n" });
57953
57953
  //#endregion
57954
57954
  //#region src/judges/providers/fixed.ts
57955
- const fail$2 = (message) => {
57955
+ const fail$3 = (message) => {
57956
57956
  throw new Error(`gtd judge run: ${message}`);
57957
57957
  };
57958
57958
  const isAnswer = (v) => [
@@ -57963,9 +57963,9 @@ const isAnswer = (v) => [
57963
57963
  const isProbability = (v) => typeof v === "number" && v >= 0 && v <= 1;
57964
57964
  const validate = (entry, index) => {
57965
57965
  const { id, answer, p } = typeof entry === "object" && entry !== null ? entry : {};
57966
- if (typeof id !== "string") return fail$2(`answers entry ${index} has no string "id"`);
57967
- if (!isAnswer(answer)) return fail$2(`answers entry "${id}": "answer" must be a string, number or boolean`);
57968
- if (!isProbability(p)) return fail$2(`answers entry "${id}": "p" must be a number in [0, 1]`);
57966
+ if (typeof id !== "string") return fail$3(`answers entry ${index} has no string "id"`);
57967
+ if (!isAnswer(answer)) return fail$3(`answers entry "${id}": "answer" must be a string, number or boolean`);
57968
+ if (!isProbability(p)) return fail$3(`answers entry "${id}": "p" must be a number in [0, 1]`);
57969
57969
  return {
57970
57970
  id,
57971
57971
  answer,
@@ -57975,16 +57975,16 @@ const validate = (entry, index) => {
57975
57975
  const fixed = ({ answersPath, env }) => async (questions) => {
57976
57976
  const inline = env["GTD_JUDGE_ANSWERS"];
57977
57977
  let raw;
57978
- if (answersPath !== void 0) raw = await readFile(answersPath, "utf8").catch((e) => fail$2(`cannot read --answers ${answersPath}: ${e instanceof Error ? e.message : String(e)}`));
57978
+ if (answersPath !== void 0) raw = await readFile(answersPath, "utf8").catch((e) => fail$3(`cannot read --answers ${answersPath}: ${e instanceof Error ? e.message : String(e)}`));
57979
57979
  else if (inline !== void 0 && inline !== "") raw = inline;
57980
- else return fail$2("provider \"fixed\" needs --answers <path> or GTD_JUDGE_ANSWERS");
57980
+ else return fail$3("provider \"fixed\" needs --answers <path> or GTD_JUDGE_ANSWERS");
57981
57981
  let parsed;
57982
57982
  try {
57983
57983
  parsed = JSON.parse(raw);
57984
57984
  } catch {
57985
- return fail$2("the fixed answers are not valid JSON");
57985
+ return fail$3("the fixed answers are not valid JSON");
57986
57986
  }
57987
- if (!Array.isArray(parsed)) return fail$2("the fixed answers must be a JSON array");
57987
+ if (!Array.isArray(parsed)) return fail$3("the fixed answers must be a JSON array");
57988
57988
  const asked = new Set(questions.map((q) => q.id));
57989
57989
  return parsed.flatMap((entry, i) => {
57990
57990
  const id = entry?.id;
@@ -57993,13 +57993,7 @@ const fixed = ({ answersPath, env }) => async (questions) => {
57993
57993
  });
57994
57994
  };
57995
57995
  //#endregion
57996
- //#region src/judges/providers/jev.ts
57997
- const DEFAULT_URL = "https://api.typesafe.ai/v1/systemone";
57998
- const MODEL = "jev-latest";
57999
- const RETRIES = 3;
58000
- const fail$1 = (message) => {
58001
- throw new Error(`gtd judge run: ${message}`);
58002
- };
57996
+ //#region src/judges/criteria.ts
58003
57997
  const LABEL = /(?:^|\. )([A-Za-z][A-Za-z0-9_-]*): /g;
58004
57998
  /** Same splitter as gtd-build's `judge_request`: text before the first label is dropped. */
58005
57999
  const splitLabels = (criteria) => {
@@ -58010,6 +58004,14 @@ const splitLabels = (criteria) => {
58010
58004
  return [m[1], criteria.slice(start, end).replace(/^ /, "")];
58011
58005
  });
58012
58006
  };
58007
+ //#endregion
58008
+ //#region src/judges/providers/jev.ts
58009
+ const DEFAULT_URL = "https://api.typesafe.ai/v1/systemone";
58010
+ const MODEL = "jev-latest";
58011
+ const RETRIES = 3;
58012
+ const fail$2 = (message) => {
58013
+ throw new Error(`gtd judge run: ${message}`);
58014
+ };
58013
58015
  const translate = (q) => {
58014
58016
  if (q.primitive === "noul") return {
58015
58017
  type: "noul",
@@ -58017,7 +58019,7 @@ const translate = (q) => {
58017
58019
  };
58018
58020
  const levels = splitLabels(q.criteria);
58019
58021
  if (q.primitive === "choice") {
58020
- if (levels.length < 2) return fail$1(`question "${q.id}": choice criteria need at least 2 labelled options`);
58022
+ if (levels.length < 2) return fail$2(`question "${q.id}": choice criteria need at least 2 labelled options`);
58021
58023
  return {
58022
58024
  type: "choice",
58023
58025
  instructions: q.instructions,
@@ -58025,14 +58027,14 @@ const translate = (q) => {
58025
58027
  };
58026
58028
  }
58027
58029
  if (q.primitive === "score") {
58028
- if (levels.length < 2 || levels.length > 10) return fail$1(`question "${q.id}": score criteria need 2 to 10 labelled levels, found ${levels.length}`);
58030
+ if (levels.length < 2 || levels.length > 10) return fail$2(`question "${q.id}": score criteria need 2 to 10 labelled levels, found ${levels.length}`);
58029
58031
  return {
58030
58032
  type: "score",
58031
58033
  instructions: q.instructions,
58032
58034
  criteria: levels.map(([, v]) => v)
58033
58035
  };
58034
58036
  }
58035
- return fail$1(`question "${q.id}": unknown primitive "${String(q.primitive)}"`);
58037
+ return fail$2(`question "${q.id}": unknown primitive "${String(q.primitive)}"`);
58036
58038
  };
58037
58039
  const toRequest = (questions, state) => ({
58038
58040
  model: MODEL,
@@ -58040,15 +58042,15 @@ const toRequest = (questions, state) => ({
58040
58042
  questions: Object.fromEntries(questions.map((q) => [q.id, translate(q)]))
58041
58043
  });
58042
58044
  const clamp = (n) => Math.min(1, Math.max(0, n));
58043
- const unreadable = (why) => fail$1(`unreadable jev response: ${why}`);
58044
- const num = (v, what) => typeof v === "number" && Number.isFinite(v) ? v : unreadable(`${what} is not a finite number`);
58045
+ const unreadable$1 = (why) => fail$2(`unreadable jev response: ${why}`);
58046
+ const num = (v, what) => typeof v === "number" && Number.isFinite(v) ? v : unreadable$1(`${what} is not a finite number`);
58045
58047
  const probs = (a, id) => {
58046
58048
  const raw = a["probabilities"];
58047
- if (typeof raw !== "object" || raw === null) return unreadable(`"${id}" has no probabilities`);
58049
+ if (typeof raw !== "object" || raw === null) return unreadable$1(`"${id}" has no probabilities`);
58048
58050
  return Object.fromEntries(Object.entries(raw).map(([k, v]) => [k, num(v, `"${id}" probability "${k}"`)]));
58049
58051
  };
58050
- const toVerdict = (q, a) => {
58051
- if (a["type"] !== q.primitive) return unreadable(`"${q.id}" answered as ${String(a["type"])}, asked ${q.primitive}`);
58052
+ const toVerdict$1 = (q, a) => {
58053
+ if (a["type"] !== q.primitive) return unreadable$1(`"${q.id}" answered as ${String(a["type"])}, asked ${q.primitive}`);
58052
58054
  if (q.primitive === "noul") {
58053
58055
  const n = num(a["noul"], `"${q.id}" noul`);
58054
58056
  return n >= .5 ? {
@@ -58064,7 +58066,7 @@ const toVerdict = (q, a) => {
58064
58066
  const p = probs(a, q.id);
58065
58067
  if (q.primitive === "choice") {
58066
58068
  const choice = a["choice"];
58067
- if (typeof choice !== "string" || !(choice in p)) return unreadable(`"${q.id}" choice is absent from its probabilities`);
58069
+ if (typeof choice !== "string" || !(choice in p)) return unreadable$1(`"${q.id}" choice is absent from its probabilities`);
58068
58070
  return {
58069
58071
  id: q.id,
58070
58072
  answer: choice,
@@ -58072,7 +58074,7 @@ const toVerdict = (q, a) => {
58072
58074
  };
58073
58075
  }
58074
58076
  const levels = Object.entries(p).map(([k, v]) => [Number(k), v]);
58075
- if (levels.length === 0 || levels.some(([k]) => !Number.isFinite(k))) return unreadable(`"${q.id}" score probabilities are not numeric levels`);
58077
+ if (levels.length === 0 || levels.some(([k]) => !Number.isFinite(k))) return unreadable$1(`"${q.id}" score probabilities are not numeric levels`);
58076
58078
  const top = levels.reduce((best, cur) => cur[1] > best[1] || cur[1] === best[1] && cur[0] < best[0] ? cur : best);
58077
58079
  return {
58078
58080
  id: q.id,
@@ -58082,11 +58084,11 @@ const toVerdict = (q, a) => {
58082
58084
  };
58083
58085
  const toVerdicts = (questions, response) => {
58084
58086
  const answers = response?.answers;
58085
- if (typeof answers !== "object" || answers === null || Array.isArray(answers)) return unreadable("no \"answers\" object");
58087
+ if (typeof answers !== "object" || answers === null || Array.isArray(answers)) return unreadable$1("no \"answers\" object");
58086
58088
  const map = answers;
58087
58089
  const missing = questions.filter((q) => typeof map[q.id] !== "object" || map[q.id] === null);
58088
- if (missing.length > 0) return fail$1(`jev answered ${questions.length - missing.length} of ${questions.length} questions; missing ${missing.map((q) => q.id).join(", ")}`);
58089
- return questions.map((q) => toVerdict(q, map[q.id]));
58090
+ if (missing.length > 0) return fail$2(`jev answered ${questions.length - missing.length} of ${questions.length} questions; missing ${missing.map((q) => q.id).join(", ")}`);
58091
+ return questions.map((q) => toVerdict$1(q, map[q.id]));
58090
58092
  };
58091
58093
  const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
58092
58094
  const post = async (url, key, body, delayMs) => {
@@ -58099,41 +58101,165 @@ const post = async (url, key, body, delayMs) => {
58099
58101
  },
58100
58102
  body,
58101
58103
  signal: AbortSignal.timeout(18e4)
58102
- }).catch((e) => fail$1(`jev request failed: ${e instanceof Error ? e.message : String(e)}`));
58104
+ }).catch((e) => fail$2(`jev request failed: ${e instanceof Error ? e.message : String(e)}`));
58103
58105
  const text = await res.text();
58104
58106
  if (res.status === 200) return text;
58105
58107
  if ((res.status === 429 || res.status === 529) && attempt < RETRIES) {
58106
58108
  await sleep(delayMs);
58107
58109
  continue;
58108
58110
  }
58109
- return fail$1(`jev responded ${res.status}: ${text.slice(0, 2048)}`);
58111
+ return fail$2(`jev responded ${res.status}: ${text.slice(0, 2048)}`);
58110
58112
  }
58111
58113
  };
58112
58114
  const parse = (text) => {
58113
58115
  try {
58114
58116
  return JSON.parse(text);
58115
58117
  } catch {
58116
- return unreadable("not JSON");
58118
+ return unreadable$1("not JSON");
58117
58119
  }
58118
58120
  };
58119
58121
  const jev = ({ env, retryDelayMs = 2e3 }) => async (questions, state) => {
58120
58122
  const key = env["TYPESAFE_API_KEY"];
58121
- if (key === void 0 || key === "") return fail$1("--provider jev needs TYPESAFE_API_KEY");
58123
+ if (key === void 0 || key === "") return fail$2("--provider jev needs TYPESAFE_API_KEY");
58122
58124
  const url = env["JEV_BASE_URL"] || DEFAULT_URL;
58123
58125
  const text = await post(url, key, JSON.stringify(toRequest(questions, state)), retryDelayMs);
58124
58126
  return toVerdicts(questions, parse(text));
58125
58127
  };
58126
58128
  //#endregion
58129
+ //#region src/judges/providers/llm.ts
58130
+ const DEFAULT_MODEL = "haiku";
58131
+ const TIMEOUT_MS = 18e4;
58132
+ const SYSTEM_PROMPT = "You are a strict, impartial judge. Answer each question from the supplied evidence alone.\nReply only with the structured answer; never use tools or ask questions.";
58133
+ const fail$1 = (message) => {
58134
+ throw new Error(`gtd judge run: ${message}`);
58135
+ };
58136
+ const unreadable = (why) => fail$1(`unreadable claude response: ${why}`);
58137
+ /** Validated up front so a bad question throws before any spawn. */
58138
+ const levelsOf = (q) => {
58139
+ if (q.primitive === "noul") return [];
58140
+ if (q.primitive !== "choice" && q.primitive !== "score") return fail$1(`question "${q.id}": unknown primitive "${String(q.primitive)}"`);
58141
+ const levels = splitLabels(q.criteria);
58142
+ if (levels.length < 2) return fail$1(`question "${q.id}": ${q.primitive} criteria need at least 2 labelled ${q.primitive === "choice" ? "options" : "levels"}`);
58143
+ return levels;
58144
+ };
58145
+ const optionsOf = (q) => q.primitive === "noul" ? ["yes", "no"] : q.primitive === "choice" ? levelsOf(q).map(([label]) => label) : levelsOf(q).map((_, i) => i + 1);
58146
+ const describe = (q) => {
58147
+ const head = `<question id="${q.id}">\n${q.instructions}\n`;
58148
+ if (q.primitive === "noul") return `${head}Criteria: ${q.criteria}\nAnswer "yes" or "no".\n</question>`;
58149
+ const levels = levelsOf(q);
58150
+ return `${head}${q.primitive === "choice" ? levels.map(([label, text]) => `- ${label}: ${text}`).join("\n") : levels.map(([, text], i) => `${i + 1}. ${text}`).join("\n")}\n${q.primitive === "choice" ? "Answer with exactly one label." : "Answer with the number of one level."}\n</question>`;
58151
+ };
58152
+ const toPrompt = (questions, state) => [
58153
+ "Answer every question below from the evidence alone. For each, give your answer and p, your confidence between 0 and 1 that the given answer is correct.",
58154
+ ...Object.entries(state).map(([key, body]) => `<evidence key="${key}">\n${body}\n</evidence>`),
58155
+ ...questions.map(describe)
58156
+ ].join("\n\n");
58157
+ const answerSchema = (q) => {
58158
+ return {
58159
+ type: "object",
58160
+ properties: {
58161
+ answer: { enum: optionsOf(q) },
58162
+ p: {
58163
+ type: "number",
58164
+ minimum: 0,
58165
+ maximum: 1
58166
+ }
58167
+ },
58168
+ required: ["answer", "p"],
58169
+ additionalProperties: false
58170
+ };
58171
+ };
58172
+ const toSchema = (questions) => ({
58173
+ type: "object",
58174
+ properties: Object.fromEntries(questions.map((q) => [q.id, answerSchema(q)])),
58175
+ required: questions.map((q) => q.id),
58176
+ additionalProperties: false
58177
+ });
58178
+ const isObject$2 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
58179
+ const toVerdict = (q, raw) => {
58180
+ if (!isObject$2(raw)) return unreadable(`"${q.id}" is not an object`);
58181
+ const { answer, p } = raw;
58182
+ if (typeof p !== "number" || !Number.isFinite(p) || p < 0 || p > 1) return unreadable(`"${q.id}" p is not a number in [0, 1]`);
58183
+ if (!optionsOf(q).includes(answer)) return unreadable(`"${q.id}" answer is not one of its options`);
58184
+ return {
58185
+ id: q.id,
58186
+ answer,
58187
+ p
58188
+ };
58189
+ };
58190
+ const toLlmVerdicts = (questions, stdout) => {
58191
+ let envelope;
58192
+ try {
58193
+ envelope = JSON.parse(stdout);
58194
+ } catch {
58195
+ return unreadable("not JSON");
58196
+ }
58197
+ if (!isObject$2(envelope)) return unreadable("not an object");
58198
+ if (envelope["is_error"] === true) return fail$1(`claude failed: ${String(envelope["result"])}`);
58199
+ const out = envelope["structured_output"];
58200
+ if (!isObject$2(out)) return unreadable("no structured_output object");
58201
+ const missing = questions.filter((q) => !isObject$2(out[q.id]));
58202
+ if (missing.length > 0) return fail$1(`claude answered ${questions.length - missing.length} of ${questions.length} questions; missing ${missing.map((q) => q.id).join(", ")}`);
58203
+ return questions.map((q) => toVerdict(q, out[q.id]));
58204
+ };
58205
+ const run$1 = (argv, stdin, { env, cwd, timeoutMs }) => new Promise((resolve, reject) => {
58206
+ const child = execFile("claude", argv, {
58207
+ cwd,
58208
+ env,
58209
+ timeout: timeoutMs,
58210
+ killSignal: "SIGKILL",
58211
+ maxBuffer: 64 * 1024 * 1024
58212
+ }, (e, stdout, stderr) => {
58213
+ if (!e) return resolve(stdout);
58214
+ const { code, killed, message } = e;
58215
+ reject(/* @__PURE__ */ new Error(code === "ENOENT" ? "gtd judge run: --provider llm needs `claude` on PATH" : killed ? `gtd judge run: claude timed out after ${timeoutMs} ms` : typeof code === "number" ? `gtd judge run: claude exited ${code}: ${stderr.slice(0, 2048)}` : `gtd judge run: claude failed to start: ${message}`));
58216
+ });
58217
+ child.stdin?.on("error", () => {});
58218
+ child.stdin?.end(stdin);
58219
+ });
58220
+ const llm = ({ env, cwd, model = DEFAULT_MODEL, timeoutMs = TIMEOUT_MS }) => async (questions, state) => {
58221
+ const schema = JSON.stringify(toSchema(questions));
58222
+ const prompt = toPrompt(questions, state);
58223
+ const stdout = await run$1([
58224
+ "-p",
58225
+ "--model",
58226
+ model,
58227
+ "--output-format",
58228
+ "json",
58229
+ "--json-schema",
58230
+ schema,
58231
+ "--system-prompt",
58232
+ SYSTEM_PROMPT,
58233
+ "--tools",
58234
+ "",
58235
+ "--no-session-persistence",
58236
+ "--settings",
58237
+ "{\"disableAllHooks\":true}"
58238
+ ], prompt, {
58239
+ env,
58240
+ cwd,
58241
+ timeoutMs
58242
+ });
58243
+ return toLlmVerdicts(questions, stdout);
58244
+ };
58245
+ //#endregion
58127
58246
  //#region src/judges/run.ts
58128
58247
  const fail = (message) => {
58129
58248
  throw new Error(`gtd judge run: ${message}`);
58130
58249
  };
58131
- const answererFor = ({ provider, answers, env }) => {
58250
+ /** The only place auto selection lives; it never falls back across providers. */
58251
+ const answererFor = ({ provider, answers, env, model, cwd }) => {
58252
+ if (model !== void 0 && provider !== void 0 && provider !== "llm") return fail(`--model only applies to --provider llm, not ${provider}`);
58132
58253
  if (provider === "fixed") return fixed({
58133
58254
  answersPath: answers,
58134
58255
  env
58135
58256
  });
58136
- return jev({ env });
58257
+ if (provider === "jev" || provider === void 0 && model === void 0 && env["TYPESAFE_API_KEY"]) return jev({ env });
58258
+ return llm({
58259
+ env,
58260
+ cwd,
58261
+ model
58262
+ });
58137
58263
  };
58138
58264
  const runJudge = async (opts) => {
58139
58265
  let doc;
@@ -62536,7 +62662,7 @@ const generateSelfSignedCert = (request) => gen(function* () {
62536
62662
  `-addext "extendedKeyUsage=serverAuth"`,
62537
62663
  `-addext "basicConstraints=critical,CA:FALSE"`
62538
62664
  ].join(" ");
62539
- return yield* runner.bash(command).pipe(mapError$1((e) => new GtdError(`gtd ui: could not run openssl to issue a certificate: ${e.message}`)), flatMap$4((outcome) => outcome.status !== 0 ? fail$5(new GtdError("gtd ui: openssl exited without issuing a certificate", [`exit status: ${outcome.status ?? "signal"}`, ...outcome.output.trim().split("\n").filter(Boolean)])) : try_({
62665
+ return yield* runner.bash(command).pipe(mapError$1((e) => new GtdError(`gtd ui: could not run openssl to issue a certificate: ${e.message}`)), flatMap$4((outcome) => outcome.status !== 0 ? fail$6(new GtdError("gtd ui: openssl exited without issuing a certificate", [`exit status: ${outcome.status ?? "signal"}`, ...outcome.output.trim().split("\n").filter(Boolean)])) : try_({
62540
62666
  try: () => ({
62541
62667
  cert: readFileSync(certPath, "utf8"),
62542
62668
  key: readFileSync(keyPath, "utf8")
@@ -62568,7 +62694,7 @@ const obtainTailscaleCert = (domain) => gen(function* () {
62568
62694
  `--key-file ${shellQuote(keyPath)}`,
62569
62695
  shellQuote(domain)
62570
62696
  ].join(" ");
62571
- return yield* runner.bash(command).pipe(mapError$1((e) => new GtdError(`gtd ui: could not run tailscale cert to issue a certificate: ${e.message}`)), flatMap$4((outcome) => outcome.status !== 0 ? fail$5(new GtdError("gtd ui: tailscale cert exited without issuing a certificate", [`exit status: ${outcome.status ?? "signal"}`, ...outcome.output.trim().split("\n").filter(Boolean)])) : try_({
62697
+ return yield* runner.bash(command).pipe(mapError$1((e) => new GtdError(`gtd ui: could not run tailscale cert to issue a certificate: ${e.message}`)), flatMap$4((outcome) => outcome.status !== 0 ? fail$6(new GtdError("gtd ui: tailscale cert exited without issuing a certificate", [`exit status: ${outcome.status ?? "signal"}`, ...outcome.output.trim().split("\n").filter(Boolean)])) : try_({
62572
62698
  try: () => ({
62573
62699
  cert: readFileSync(certPath, "utf8"),
62574
62700
  key: readFileSync(keyPath, "utf8")
@@ -62605,7 +62731,7 @@ const TRPC_PATH_PREFIX = "/trpc";
62605
62731
  */
62606
62732
  const resolveBindHost = (host, config, pickHost = () => pickBindHost(OS.networkInterfaces())) => {
62607
62733
  const resolved = host ?? config?.host ?? pickHost();
62608
- return resolved === void 0 ? fail$5(new GtdError("gtd ui: no Tailscale interface found to bind to, and no --host given", ["join a tailnet, so a CGNAT (100.64.0.0/10) address is available", "or pass --host <address> to bind explicitly"])) : succeed$3(resolved);
62734
+ return resolved === void 0 ? fail$6(new GtdError("gtd ui: no Tailscale interface found to bind to, and no --host given", ["join a tailnet, so a CGNAT (100.64.0.0/10) address is available", "or pass --host <address> to bind explicitly"])) : succeed$3(resolved);
62609
62735
  };
62610
62736
  /**
62611
62737
  * `--self-signed`, then a configured pair, then a real `tailscale cert`, then
@@ -62622,11 +62748,11 @@ const resolveCertPair = (options, config, bindHost, displayHost, tailscaleStatus
62622
62748
  if (config?.cert !== void 0 && config.key !== void 0) return loadCertPair(config.cert, config.key);
62623
62749
  if (config?.cert !== void 0 || config?.key !== void 0) {
62624
62750
  const missing = config.cert === void 0 ? "ui.cert" : "ui.key";
62625
- return fail$5(new GtdError(`gtd ui: ${missing} is not configured — both cert and key are required`, [`ui.${config.cert === void 0 ? "key" : "cert"} is configured, but ${missing} is not`, "pass --self-signed for a throwaway certificate instead"]));
62751
+ return fail$6(new GtdError(`gtd ui: ${missing} is not configured — both cert and key are required`, [`ui.${config.cert === void 0 ? "key" : "cert"} is configured, but ${missing} is not`, "pass --self-signed for a throwaway certificate instead"]));
62626
62752
  }
62627
62753
  const certDomain = tailscaleStatus?.certDomains[0];
62628
62754
  if (certDomain !== void 0) return obtainTailscaleCert(certDomain);
62629
- return fail$5(new GtdError("gtd ui: HTTPS is mandatory and no certificate is configured", [
62755
+ return fail$6(new GtdError("gtd ui: HTTPS is mandatory and no certificate is configured", [
62630
62756
  "pass --self-signed for a throwaway certificate",
62631
62757
  "or configure ui.cert and ui.key",
62632
62758
  "or join a tailnet with HTTPS certs enabled for an automatic one"
@@ -62647,7 +62773,7 @@ var UiListener = class UiListener extends Tag("UiListener")() {
62647
62773
  key: tls.key
62648
62774
  }, handler) : http.createServer(handler);
62649
62775
  server.once("error", (err) => {
62650
- resume(fail$5(err.code === "EADDRINUSE" ? new GtdError(`gtd ui: port ${port} is already in use`) : new GtdError(`gtd ui: could not start the server: ${err.message}`)));
62776
+ resume(fail$6(err.code === "EADDRINUSE" ? new GtdError(`gtd ui: port ${port} is already in use`) : new GtdError(`gtd ui: could not start the server: ${err.message}`)));
62651
62777
  });
62652
62778
  server.listen(port, host, () => {
62653
62779
  const address = server.address();
@@ -62706,7 +62832,7 @@ const readDevTemplate = (fs, root) => fs.readFileString(join(root, "src/web/inde
62706
62832
  */
62707
62833
  const rebuildDevClientScript = (runner, fs, root) => gen(function* () {
62708
62834
  const outcome = yield* runner.bash(`cd ${JSON.stringify(root)} && npx tsdown --filter web`).pipe(mapError$1((e) => new GtdError(`gtd ui --dev: could not rebuild the client: ${e.message}`)));
62709
- if (outcome.status !== 0) return yield* fail$5(new GtdError("gtd ui --dev: rebuilding the client failed", outcome.output.trim().split("\n").filter(Boolean)));
62835
+ if (outcome.status !== 0) return yield* fail$6(new GtdError("gtd ui --dev: rebuilding the client failed", outcome.output.trim().split("\n").filter(Boolean)));
62710
62836
  return yield* fs.readFileString(join(root, "dist/web/main.js")).pipe(mapError$1((e) => new GtdError(`gtd ui --dev: could not read the rebuilt client: ${e.message}`)));
62711
62837
  });
62712
62838
  /**
@@ -62717,7 +62843,7 @@ const rebuildDevClientScript = (runner, fs, root) => gen(function* () {
62717
62843
  */
62718
62844
  const rebuildDevClientCss = (runner, fs, root) => gen(function* () {
62719
62845
  const outcome = yield* runner.bash(`cd ${JSON.stringify(root)} && npx @tailwindcss/cli -i src/web/styles.css -o dist/web/main.css`).pipe(mapError$1((e) => new GtdError(`gtd ui --dev: could not rebuild the stylesheet: ${e.message}`)));
62720
- if (outcome.status !== 0) return yield* fail$5(new GtdError("gtd ui --dev: rebuilding the stylesheet failed", outcome.output.trim().split("\n").filter(Boolean)));
62846
+ if (outcome.status !== 0) return yield* fail$6(new GtdError("gtd ui --dev: rebuilding the stylesheet failed", outcome.output.trim().split("\n").filter(Boolean)));
62721
62847
  return yield* fs.readFileString(join(root, "dist/web/main.css")).pipe(mapError$1((e) => new GtdError(`gtd ui --dev: could not read the rebuilt stylesheet: ${e.message}`)));
62722
62848
  });
62723
62849
  /** The one piece of content this server ever serves: the client HTML, with its JS AND CSS inlined — a build-time constant in production, resolved ONCE at startup under `--dev` too (T5) and held for the process's whole lifetime, never re-read or rebuilt per request. */
@@ -62985,7 +63111,7 @@ const resolveListener = (args) => gen(function* () {
62985
63111
  const runUiCommand = (options, config, out) => gen(function* () {
62986
63112
  const cwd = yield* Host;
62987
63113
  const step = yield* promise(() => readStep({ path: cwd.root }, liveBeatDeps));
62988
- if (step.status === "broken" || !isRenderable(step)) return yield* fail$5(refusalFor(step));
63114
+ if (step.status === "broken" || !isRenderable(step)) return yield* fail$6(refusalFor(step));
62989
63115
  const servedState = step.state;
62990
63116
  const servedLabel = step.label;
62991
63117
  const runner = yield* CommandRunner;
@@ -63817,11 +63943,11 @@ const restAt = (ref) => gen(function* () {
63817
63943
  };
63818
63944
  const outcome = yield* promise(() => replayFor(setup));
63819
63945
  const error = replayError(outcome);
63820
- if (error !== void 0 || outcome.kind !== "rest") return yield* fail$5(error ?? /* @__PURE__ */ new Error("gtd: replay found no rest"));
63946
+ if (error !== void 0 || outcome.kind !== "rest") return yield* fail$6(error ?? /* @__PURE__ */ new Error("gtd: replay found no rest"));
63821
63947
  const step = outcome.rest;
63822
63948
  yield* (yield* Narrator).narrate(`rest resolved: ${step.name} (awaits ${step.actor})`);
63823
63949
  const stepDef = stepDefOf(step);
63824
- if (stepDef.mode !== void 0 && def.modes[stepDef.mode] === void 0) return yield* fail$5(/* @__PURE__ */ new Error(`gtd config: step "${step.name}": mode "${stepDef.mode}" is not a mode this workflow knows (${knownModes(def).join(", ")})`));
63950
+ if (stepDef.mode !== void 0 && def.modes[stepDef.mode] === void 0) return yield* fail$6(/* @__PURE__ */ new Error(`gtd config: step "${step.name}": mode "${stepDef.mode}" is not a mode this workflow knows (${knownModes(def).join(", ")})`));
63825
63951
  const changes = ref === void 0 ? (yield* git.changedPaths()).map((e) => ({
63826
63952
  status: normalizeStatus(e.status),
63827
63953
  path: e.path
@@ -63935,7 +64061,7 @@ const decideLanding = (rest, verdicts) => gen(function* () {
63935
64061
  kind: "refusal",
63936
64062
  message: outcome.message
63937
64063
  };
63938
- if (outcome.kind === "divergence" || outcome.kind === "failed") return yield* fail$5(new Error(outcome.message));
64064
+ if (outcome.kind === "divergence" || outcome.kind === "failed") return yield* fail$6(new Error(outcome.message));
63939
64065
  const to = outcome.kind === "rest" ? outcome.rest.name : rest.def.initial;
63940
64066
  if (rest.changes.length === 0 && rest.stepDef.kind === "script" && to === rest.state) return {
63941
64067
  kind: "noop",
@@ -75939,13 +76065,19 @@ while :; do
75939
76065
  # you re-ran us resting here: you either edited something or accepted by
75940
76066
  # editing nothing, so land the opening beat either way. Later beats are
75941
76067
  # gates we just produced and you have not read yet — hand off. A judge
75942
- # gate's own \`--json=judge\` is non-empty here; the message: itself
75943
- # already tells you to run \`gtd judge answer\` and paste a verdict, so
75944
- # this reference driver just displays it and stops like any other
75945
- # message — it never calls the network. An aware driver would read
75946
- # \`--json=judge\` here instead and route it to an LLM (see "Judge gates"
75947
- # below).
76068
+ # gate's own \`--json=judge\` is non-empty here: pipe it through
76069
+ # \`gtd judge run\` and land the verdict via \`gtd judge answer\`. POSIX sh has
76070
+ # no pipefail, so each step is captured first and only piped on when it
76071
+ # succeeded; if \`gtd judge run\` fails or \`gtd judge answer\` rejects the
76072
+ # verdict, its stderr reaches you and we fall through to the human hand-off.
75948
76073
  message)
76074
+ if [ -n "$(gtd next --json=judge)" ] &&
76075
+ verdict="$(gtd judge --json | gtd judge run)" &&
76076
+ script="$(printf '%s\\n' "$verdict" | gtd judge answer --json=script)"; then
76077
+ printf '%s\\n' "$script" | sh
76078
+ beat=$((beat + 1))
76079
+ continue
76080
+ fi
75949
76081
  [ "$beat" = 1 ] || {
75950
76082
  gtd next
75951
76083
  exit 0
@@ -76569,7 +76701,7 @@ var SelectorUsageError = class extends Error {};
76569
76701
  const writeSelection = (out, fields, path) => gen(function* () {
76570
76702
  const selection = selectPath(fields, path);
76571
76703
  if (selection.kind === "value") out.write(`${selection.text}\n`);
76572
- else if (selection.kind === "unknown") return yield* fail$5(new SelectorUsageError(`gtd: unknown --json selector "${selection.path}" — see \`gtd --help\``));
76704
+ else if (selection.kind === "unknown") return yield* fail$6(new SelectorUsageError(`gtd: unknown --json selector "${selection.path}" — see \`gtd --help\``));
76573
76705
  });
76574
76706
  /** `needs: "none"` skips the repo-root guard — the server is keyed on file name, not workflow state. */
76575
76707
  const runLspCommand = () => startLspServer();
@@ -76589,7 +76721,7 @@ const runInitCommand = (out) => gen(function* () {
76589
76721
  const git = yield* GitService;
76590
76722
  const host = yield* Host;
76591
76723
  const inRepo = yield* assertInitLocation(git, host);
76592
- if (yield* configPresentAt(host.root)) return yield* fail$5(/* @__PURE__ */ new Error("gtd init: a gtd config already exists — remove it before re-initializing"));
76724
+ if (yield* configPresentAt(host.root)) return yield* fail$6(/* @__PURE__ */ new Error("gtd init: a gtd config already exists — remove it before re-initializing"));
76593
76725
  const scaffold = renderInitScaffold();
76594
76726
  yield* (yield* Workspace).write(".gtdrc.json", scaffold.config);
76595
76727
  const wrote = "Wrote .gtdrc.json seeding the default variables (the test command) and a\nPrettier formatting suggestion. gtd runs its built-in workflow by default — add\na workflow: key only if you want to customize the machine itself.\n\n";
@@ -76618,7 +76750,7 @@ const EMPTY_TREE = "4b825dc642cb6eb9a060e54bf8d69288fbee4904";
76618
76750
  const planLanding = (opts = {}) => gen(function* () {
76619
76751
  const rest = yield* currentRest;
76620
76752
  const outcome = planStep(yield* snapshotFromRest(rest, opts.judge), opts);
76621
- if (outcome.kind === "refusal") return yield* fail$5(new Error(outcome.message));
76753
+ if (outcome.kind === "refusal") return yield* fail$6(new Error(outcome.message));
76622
76754
  if (outcome.kind === "noop") {
76623
76755
  const required = ScriptSurface.render([{
76624
76756
  kind: "outcome",
@@ -76657,13 +76789,13 @@ const planLanding = (opts = {}) => gen(function* () {
76657
76789
  */
76658
76790
  const runSummaryCommand = (out) => gen(function* () {
76659
76791
  const rendered = yield* summaryFor(yield* summaryRun);
76660
- if (rendered === void 0) return yield* fail$5(/* @__PURE__ */ new Error("gtd summary: refused — either this workflow declares no \"summary:\" template, or there is no finished/in-flight process to summarize at HEAD"));
76792
+ if (rendered === void 0) return yield* fail$6(/* @__PURE__ */ new Error("gtd summary: refused — either this workflow declares no \"summary:\" template, or there is no finished/in-flight process to summarize at HEAD"));
76661
76793
  out.write(rendered.endsWith("\n") ? rendered : rendered + "\n");
76662
76794
  });
76663
76795
  /** Prints the review anchor hash bare, so an external tool can be pointed at the range under review. Nothing is written. Refuses when the run has no commits, where the hash would name a range with no review. */
76664
76796
  const runBaseCommand = (out) => gen(function* () {
76665
76797
  const rest = yield* currentRest;
76666
- if (rest.run.trace.length === 0) return yield* fail$5(/* @__PURE__ */ new Error("gtd base: refused — no process is underway at HEAD"));
76798
+ if (rest.run.trace.length === 0) return yield* fail$6(/* @__PURE__ */ new Error("gtd base: refused — no process is underway at HEAD"));
76667
76799
  const base = reviewBaseFor(rest);
76668
76800
  out.write(`${base}\n`);
76669
76801
  });
@@ -76671,7 +76803,7 @@ const runBaseCommand = (out) => gen(function* () {
76671
76803
  const runJudgeCommand = (json, out) => gen(function* () {
76672
76804
  const rest = yield* currentRest;
76673
76805
  const rendered = yield* renderRest(rest);
76674
- if (rendered.judge === void 0) return yield* fail$5(/* @__PURE__ */ new Error(`gtd judge: refused — the resolved rest ("${rest.state}") declares no "judge:"`));
76806
+ if (rendered.judge === void 0) return yield* fail$6(/* @__PURE__ */ new Error(`gtd judge: refused — the resolved rest ("${rest.state}") declares no "judge:"`));
76675
76807
  const document = rendered.judge.endsWith("\n") ? rendered.judge : `${rendered.judge}\n`;
76676
76808
  if (json.kind === "select") {
76677
76809
  const selection = selectPath(yield* try_({
@@ -76679,7 +76811,7 @@ const runJudgeCommand = (json, out) => gen(function* () {
76679
76811
  catch: () => new SelectorUsageError("gtd judge: the resolved rest's \"judge:\" template did not render valid JSON")
76680
76812
  }), json.path);
76681
76813
  if (selection.kind === "value") out.write(`${selection.text}\n`);
76682
- else if (selection.kind === "unknown") return yield* fail$5(new SelectorUsageError(`gtd: unknown --json selector "${selection.path}" — see \`gtd --help\``));
76814
+ else if (selection.kind === "unknown") return yield* fail$6(new SelectorUsageError(`gtd: unknown --json selector "${selection.path}" — see \`gtd --help\``));
76683
76815
  return;
76684
76816
  }
76685
76817
  out.write(document);
@@ -76709,6 +76841,8 @@ const runJudgeRunCommand = (command, out) => gen(function* () {
76709
76841
  try: () => runJudge({
76710
76842
  provider: command.provider,
76711
76843
  answers: command.answers,
76844
+ model: command.model,
76845
+ cwd: host.scratchDir,
76712
76846
  env: host.env,
76713
76847
  input
76714
76848
  }),
@@ -76740,7 +76874,7 @@ const verdictSchemaFor = (ids) => Array$(Struct({
76740
76874
  const runJudgeAnswerCommand = (json, out) => gen(function* () {
76741
76875
  const rest = yield* currentRest;
76742
76876
  const rendered = yield* renderRest(rest);
76743
- if (rendered.judge === void 0) return yield* fail$5(/* @__PURE__ */ new Error(`gtd judge answer: refused — the resolved rest ("${rest.state}") declares no "judge:"`));
76877
+ if (rendered.judge === void 0) return yield* fail$6(/* @__PURE__ */ new Error(`gtd judge answer: refused — the resolved rest ("${rest.state}") declares no "judge:"`));
76744
76878
  const ids = (yield* parseJudgeDocument(rendered.judge)).questions.map((q) => q.id);
76745
76879
  const raw = yield* readStdin();
76746
76880
  const parsed = yield* try_({
@@ -76786,7 +76920,7 @@ const runEntryCommand = (actor, entryState, varOverrides, out, commandLabel) =>
76786
76920
  commandLabel,
76787
76921
  vars: varOverrides
76788
76922
  });
76789
- if (plan.kind === "refusal") return yield* fail$5(new Error(plan.message));
76923
+ if (plan.kind === "refusal") return yield* fail$6(new Error(plan.message));
76790
76924
  out.write(landingScript(ScriptSurface.render(plan.steps)));
76791
76925
  });
76792
76926
  /**
@@ -76815,7 +76949,7 @@ const runAbandonCommand = (out) => gen(function* () {
76815
76949
  return;
76816
76950
  }
76817
76951
  const restState = run.trace[run.trace.length - 1].state;
76818
- if (run.startParentHash === EMPTY_TREE) return yield* fail$5(/* @__PURE__ */ new Error(`gtd abandon: the process underway (resting at "${restState}") starts at the repository's first commit — there is no earlier commit to rewind to`));
76952
+ if (run.startParentHash === EMPTY_TREE) return yield* fail$6(/* @__PURE__ */ new Error(`gtd abandon: the process underway (resting at "${restState}") starts at the repository's first commit — there is no earlier commit to rewind to`));
76819
76953
  const required = emitScripts([
76820
76954
  {
76821
76955
  kind: "gitWrite",
@@ -76841,13 +76975,13 @@ const runAbandonCommand = (out) => gen(function* () {
76841
76975
  */
76842
76976
  const runRestoreCommand = (out) => gen(function* () {
76843
76977
  const git = yield* GitService;
76844
- if ((yield* currentRest).changes.length > 0) return yield* fail$5(/* @__PURE__ */ new Error("gtd restore: refuses on a dirty working tree — commit, stash, or discard your changes first."));
76978
+ if ((yield* currentRest).changes.length > 0) return yield* fail$6(/* @__PURE__ */ new Error("gtd restore: refuses on a dirty working tree — commit, stash, or discard your changes first."));
76845
76979
  const retained = yield* readRetainedHistory(git);
76846
- if (isNone(retained)) return yield* fail$5(/* @__PURE__ */ new Error("gtd restore: no retained history to restore."));
76980
+ if (isNone(retained)) return yield* fail$6(/* @__PURE__ */ new Error("gtd restore: no retained history to restore."));
76847
76981
  const tip = retained.value;
76848
76982
  const headHash = yield* git.resolveRef("HEAD");
76849
76983
  const check = yield* restorability(git, headHash, tip);
76850
- if (!check.ok) return yield* fail$5(/* @__PURE__ */ new Error(`gtd restore: ${check.reason} — HEAD ${headHash.slice(0, 7)} is ahead of the retained tip ${tip.slice(0, 7)}.`));
76984
+ if (!check.ok) return yield* fail$6(/* @__PURE__ */ new Error(`gtd restore: ${check.reason} — HEAD ${headHash.slice(0, 7)} is ahead of the retained tip ${tip.slice(0, 7)}.`));
76851
76985
  const after = yield* restAt(tip);
76852
76986
  const required = emitScripts([
76853
76987
  {
@@ -76891,7 +77025,7 @@ const resolveValidateScript = (rest) => gen(function* () {
76891
77025
  const mode = rest.stepDef.mode;
76892
77026
  if (file === void 0 || mode === void 0) return void 0;
76893
77027
  const resolved = resolveMode(rest.def, rest.state, mode);
76894
- if (resolved.kind === "unknown") return yield* fail$5(new Error(resolved.message));
77028
+ if (resolved.kind === "unknown") return yield* fail$6(new Error(resolved.message));
76895
77029
  const { script } = yield* validateScriptFor(resolved, file);
76896
77030
  return {
76897
77031
  file,
@@ -76947,23 +77081,23 @@ const formatFinding = (file, finding) => {
76947
77081
  */
76948
77082
  const runCheckCommand = (mode, file, openQuestions, openThreadsFlag) => gen(function* () {
76949
77083
  const format = steeringFormatFor(mode);
76950
- if (format === void 0) return yield* fail$5(/* @__PURE__ */ new Error(`gtd check: unknown mode "${mode}" — known modes: ${BUILT_IN_MODE_NAMES.join(", ")}`));
77084
+ if (format === void 0) return yield* fail$6(/* @__PURE__ */ new Error(`gtd check: unknown mode "${mode}" — known modes: ${BUILT_IN_MODE_NAMES.join(", ")}`));
76951
77085
  if (openThreadsFlag) {
76952
- if (openQuestions) return yield* fail$5(/* @__PURE__ */ new Error("gtd check: --open-threads and --open-questions are mutually exclusive"));
77086
+ if (openQuestions) return yield* fail$6(/* @__PURE__ */ new Error("gtd check: --open-threads and --open-questions are mutually exclusive"));
76953
77087
  if (format.openThreads === void 0) {
76954
77088
  const accepted = BUILT_IN_MODE_NAMES.filter((name) => steeringFormatFor(name)?.openThreads !== void 0);
76955
- return yield* fail$5(/* @__PURE__ */ new Error(`gtd check: --open-threads only applies to modes ${accepted.join(", ")} — got "${mode}"`));
77089
+ return yield* fail$6(/* @__PURE__ */ new Error(`gtd check: --open-threads only applies to modes ${accepted.join(", ")} — got "${mode}"`));
76956
77090
  }
76957
77091
  return yield* runOpenThreadsCheckCommand(format, file);
76958
77092
  }
76959
77093
  if (openQuestions) {
76960
- if (mode !== "qa") return yield* fail$5(/* @__PURE__ */ new Error(`gtd check: --open-questions only applies to mode "qa" — got "${mode}"`));
77094
+ if (mode !== "qa") return yield* fail$6(/* @__PURE__ */ new Error(`gtd check: --open-questions only applies to mode "qa" — got "${mode}"`));
76961
77095
  return yield* runOpenQuestionsCheckCommand(format, file);
76962
77096
  }
76963
77097
  const content = (yield* Workspace).atPath(file);
76964
77098
  const errors = content !== void 0 ? format.validate(content).map((finding) => formatFinding(file, finding)) : [];
76965
77099
  if (errors.length === 0) return;
76966
- return yield* fail$5(/* @__PURE__ */ new Error(`gtd check: ${file} is not valid under mode "${mode}" (${errors.length} finding(s)):\n` + errors.join("\n")));
77100
+ return yield* fail$6(/* @__PURE__ */ new Error(`gtd check: ${file} is not valid under mode "${mode}" (${errors.length} finding(s)):\n` + errors.join("\n")));
76967
77101
  });
76968
77102
  /**
76969
77103
  * The bare `gtd check --open-threads`: code-comment threads in the files the
@@ -76980,15 +77114,15 @@ const runCodeThreadsCheckCommand = () => gen(function* () {
76980
77114
  return [...threads.filter((t) => t.waitingOn === "human").map((t) => `${path}:${t.line + 1}: ${t.entries[0].text}`), ...findings.map((f) => `${path}:${(f.line ?? 0) + 1}: ${f.message}`)];
76981
77115
  });
76982
77116
  if (lines.length === 0) return;
76983
- return yield* fail$5(new Error(lines.join("\n")));
77117
+ return yield* fail$6(new Error(lines.join("\n")));
76984
77118
  });
76985
77119
  /** Prints one `file:line: [^name]: <first H entry>` line per open thread; a missing file fails, like `--open-questions`. */
76986
77120
  const runOpenThreadsCheckCommand = (format, file) => gen(function* () {
76987
77121
  const content = (yield* Workspace).atPath(file);
76988
- if (content === void 0) return yield* fail$5(/* @__PURE__ */ new Error(`gtd check: ${file} does not exist`));
77122
+ if (content === void 0) return yield* fail$6(/* @__PURE__ */ new Error(`gtd check: ${file} does not exist`));
76989
77123
  const errors = openThreads(format, content).map((t) => `${file}:${t.line + 1}: [^${t.name}]: ${t.firstMe}`);
76990
77124
  if (errors.length === 0) return;
76991
- return yield* fail$5(/* @__PURE__ */ new Error(`gtd check: ${errors.length} open thread(s) in ${file}:\n` + errors.join("\n")));
77125
+ return yield* fail$6(/* @__PURE__ */ new Error(`gtd check: ${errors.length} open thread(s) in ${file}:\n` + errors.join("\n")));
76992
77126
  });
76993
77127
  /**
76994
77128
  * Runs the SAME `unansweredQuestions` predicate a flow's `openQuestions()`
@@ -76997,10 +77131,10 @@ const runOpenThreadsCheckCommand = (format, file) => gen(function* () {
76997
77131
  */
76998
77132
  const runOpenQuestionsCheckCommand = (format, file) => gen(function* () {
76999
77133
  const content = (yield* Workspace).atPath(file);
77000
- if (content === void 0) return yield* fail$5(/* @__PURE__ */ new Error(`gtd check: ${file} does not exist`));
77134
+ if (content === void 0) return yield* fail$6(/* @__PURE__ */ new Error(`gtd check: ${file} does not exist`));
77001
77135
  const errors = unansweredQuestions(format, content).map((q) => `${file}:${q.headingLine + 1}: ${q.question}`);
77002
77136
  if (errors.length === 0) return;
77003
- return yield* fail$5(/* @__PURE__ */ new Error(`gtd check: ${errors.length} open question(s) unanswered in ${file}:\n` + errors.join("\n")));
77137
+ return yield* fail$6(/* @__PURE__ */ new Error(`gtd check: ${errors.length} open question(s) unanswered in ${file}:\n` + errors.join("\n")));
77004
77138
  });
77005
77139
  /**
77006
77140
  * Clears the `review` format's ticks in `<file>`, writing back only when the
@@ -77077,11 +77211,11 @@ const runUiCliCommand = (command, out) => gen(function* () {
77077
77211
  */
77078
77212
  const assertRunningFromRepoRoot = (git, host) => gen(function* () {
77079
77213
  const topLevel = yield* git.topLevel();
77080
- if ((yield* host.realPath(topLevel)) !== (yield* host.realPath(host.root))) return yield* fail$5(/* @__PURE__ */ new Error(`gtd must be run from the repository root (${topLevel}); the current directory is ${host.root}`));
77214
+ if ((yield* host.realPath(topLevel)) !== (yield* host.realPath(host.root))) return yield* fail$6(/* @__PURE__ */ new Error(`gtd must be run from the repository root (${topLevel}); the current directory is ${host.root}`));
77081
77215
  });
77082
77216
  /** A command that derives workflow state needs at least one commit too — a commitless repository has no HEAD to resolve a `Rest` at. */
77083
77217
  const assertRepositoryHasCommits = (git) => gen(function* () {
77084
- if (!(yield* git.hasCommits())) return yield* fail$5(/* @__PURE__ */ new Error("gtd requires a repository with at least one commit — make an initial commit, then run gtd again"));
77218
+ if (!(yield* git.hasCommits())) return yield* fail$6(/* @__PURE__ */ new Error("gtd requires a repository with at least one commit — make an initial commit, then run gtd again"));
77085
77219
  });
77086
77220
  /**
77087
77221
  * `gtd init` may run either at a repository root or in a directory outside
@@ -77094,7 +77228,7 @@ const assertRepositoryHasCommits = (git) => gen(function* () {
77094
77228
  const assertInitLocation = (git, host) => gen(function* () {
77095
77229
  const topLevel = yield* either(git.topLevel());
77096
77230
  if (topLevel._tag === "Left") return false;
77097
- if ((yield* host.realPath(topLevel.right)) !== (yield* host.realPath(host.root))) return yield* fail$5(/* @__PURE__ */ new Error(`gtd init must be run from the repository root (${topLevel.right}) or from a directory outside any git repository; the current directory is a repository subdirectory: ${host.root}`));
77231
+ if ((yield* host.realPath(topLevel.right)) !== (yield* host.realPath(host.root))) return yield* fail$6(/* @__PURE__ */ new Error(`gtd init must be run from the repository root (${topLevel.right}) or from a directory outside any git repository; the current directory is a repository subdirectory: ${host.root}`));
77098
77232
  return true;
77099
77233
  });
77100
77234
  /**
@@ -77270,10 +77404,10 @@ const FLAGS = [
77270
77404
  arity: 1,
77271
77405
  repeatable: false,
77272
77406
  scope: (kind) => kind === "judgeRun",
77273
- decode: ([raw]) => raw === "fixed" || raw === "jev" ? right(raw) : left(`gtd: --provider must be one of fixed, jev — got "${raw ?? ""}"`),
77407
+ decode: ([raw]) => raw === "fixed" || raw === "jev" || raw === "llm" ? right(raw) : left(`gtd: --provider must be one of fixed, jev, llm — got "${raw ?? ""}"`),
77274
77408
  scopeError: "gtd: --provider is only valid for `gtd judge run`",
77275
77409
  valueHint: "<name>",
77276
- help: ["(gtd judge run only, required) the answerer: fixed | jev"]
77410
+ help: ["(gtd judge run only) the answerer: fixed | jev | llm;", "omitted: jev when TYPESAFE_API_KEY is set, else llm"]
77277
77411
  },
77278
77412
  {
77279
77413
  name: "--answers",
@@ -77303,11 +77437,11 @@ const FLAGS = [
77303
77437
  name: "--model",
77304
77438
  arity: 1,
77305
77439
  repeatable: false,
77306
- scope: (kind) => kind === "land",
77440
+ scope: (kind) => kind === "land" || kind === "judgeRun",
77307
77441
  decode: ([raw]) => raw === void 0 || raw.trim() === "" || /[\r\n]/.test(raw) ? left("gtd: --model must be a non-empty, single-line value") : right(raw),
77308
- scopeError: "gtd: --model is only valid for `gtd land` — an entry is not a metered agent turn",
77442
+ scopeError: "gtd: --model is only valid for `gtd land` (with --cost) or `gtd judge run`",
77309
77443
  valueHint: "<name>",
77310
- help: ["(gtd land only, with --cost) tag that cost's model"]
77444
+ help: ["(gtd land, with --cost) tag that cost's model", "(gtd judge run, llm answerer) the claude model; default haiku"]
77311
77445
  },
77312
77446
  {
77313
77447
  name: "--entry",
@@ -77663,9 +77797,13 @@ const COMMAND_ROWS = [
77663
77797
  "stdin, write a verdict [{ id, answer, p }] on stdout — what",
77664
77798
  "`gtd judge answer` decodes. --provider fixed answers from",
77665
77799
  "--answers <path> or GTD_JUDGE_ANSWERS; questions the file",
77666
- "does not cover are left out. Needs no repository. Exits 1",
77667
- "on an unreadable or malformed answers file, with nothing",
77668
- "on stdout"
77800
+ "does not cover are left out. --provider jev asks TypeSafe",
77801
+ "(TYPESAFE_API_KEY). --provider llm asks the `claude` CLI",
77802
+ "on PATH (Claude Code only), model haiku unless --model.",
77803
+ "No --provider: jev when TYPESAFE_API_KEY is set and no",
77804
+ "--model is given, else llm. Needs no repository. jev and",
77805
+ "llm exit 1 when they cannot answer every question, with",
77806
+ "nothing on stdout"
77669
77807
  ]
77670
77808
  }
77671
77809
  ];
@@ -77927,14 +78065,16 @@ const parseArgv = (argv) => {
77927
78065
  verbose
77928
78066
  };
77929
78067
  if (kind === "judgeRun") {
77930
- if (bag["--provider"] === void 0) return usagePlan("gtd judge run: --provider <fixed|jev> is required", jsonSeen);
77931
- if (bag["--provider"] === "jev" && bag["--answers"] !== void 0) return usagePlan("gtd judge run: --answers is only valid with --provider fixed", jsonSeen);
78068
+ const provider = bag["--provider"];
78069
+ if (provider !== "fixed" && bag["--answers"] !== void 0) return usagePlan("gtd judge run: --answers is only valid with --provider fixed", jsonSeen);
78070
+ if ((provider === "fixed" || provider === "jev") && bag["--model"] !== void 0) return usagePlan("gtd judge run: --model is only valid with --provider llm (or when it is auto-selected)", jsonSeen);
77932
78071
  return {
77933
78072
  kind: "command",
77934
78073
  command: {
77935
78074
  kind: "judgeRun",
77936
- provider: bag["--provider"],
77937
- ...bag["--answers"] !== void 0 ? { answers: bag["--answers"] } : {}
78075
+ ...provider !== void 0 ? { provider } : {},
78076
+ ...bag["--answers"] !== void 0 ? { answers: bag["--answers"] } : {},
78077
+ ...bag["--model"] !== void 0 ? { model: bag["--model"] } : {}
77938
78078
  },
77939
78079
  json,
77940
78080
  verbose