@pmelab/gtd 15.7.0 → 15.8.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.
- package/README.md +7 -1
- package/dist/gtd.bundle.mjs +410 -142
- package/package.json +1 -1
- package/src/workflows/health.test.ts +13 -0
- package/src/workflows/health.ts +3 -3
package/dist/gtd.bundle.mjs
CHANGED
|
@@ -2916,7 +2916,7 @@ const isNonEmptyArray = isNonEmptyArray$1;
|
|
|
2916
2916
|
*/
|
|
2917
2917
|
const isNonEmptyReadonlyArray = isNonEmptyArray$1;
|
|
2918
2918
|
const isOutOfBounds = (i, as) => i < 0 || i >= as.length;
|
|
2919
|
-
const clamp = (i, as) => Math.floor(Math.min(Math.max(0, i), as.length));
|
|
2919
|
+
const clamp$1 = (i, as) => Math.floor(Math.min(Math.max(0, i), as.length));
|
|
2920
2920
|
/**
|
|
2921
2921
|
* This function provides a safe way to read a value at a particular index from a `ReadonlyArray`.
|
|
2922
2922
|
*
|
|
@@ -3037,7 +3037,7 @@ const span = /*#__PURE__*/ dual(2, (self, predicate) => splitAt(self, spanIndex(
|
|
|
3037
3037
|
*/
|
|
3038
3038
|
const drop$1 = /*#__PURE__*/ dual(2, (self, n) => {
|
|
3039
3039
|
const input = fromIterable$6(self);
|
|
3040
|
-
return input.slice(clamp(n, input), input.length);
|
|
3040
|
+
return input.slice(clamp$1(n, input), input.length);
|
|
3041
3041
|
});
|
|
3042
3042
|
/**
|
|
3043
3043
|
* Reverse an `Iterable`, creating a new `Array`.
|
|
@@ -5273,7 +5273,7 @@ const empty$21 = /*#__PURE__*/ (() => {
|
|
|
5273
5273
|
return o;
|
|
5274
5274
|
})();
|
|
5275
5275
|
/** @internal */
|
|
5276
|
-
const fail$
|
|
5276
|
+
const fail$11 = (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$
|
|
5356
|
+
onFail: map$14(fail$11),
|
|
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$
|
|
5392
|
+
const map$10 = /*#__PURE__*/ dual(2, (self, f) => flatMap$7(self, (e) => fail$11(f(e))));
|
|
5393
5393
|
/** @internal */
|
|
5394
5394
|
const flatMap$7 = /*#__PURE__*/ dual(2, (self, f) => match$7(self, {
|
|
5395
5395
|
onEmpty: empty$21,
|
|
@@ -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$
|
|
8145
|
-
const failSync = (evaluate) => flatMap$6(sync$2(evaluate), fail$
|
|
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);
|
|
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$
|
|
8164
|
+
b.then((a) => resume(succeed$8(a)), (e) => resume(fail$10(new UnknownException(e, "An unknown error occurred in Effect.andThen"))));
|
|
8165
8165
|
});
|
|
8166
8166
|
return succeed$8(b);
|
|
8167
8167
|
}));
|
|
@@ -8281,7 +8281,7 @@ const tap$1 = /*#__PURE__*/ dual((args) => args.length === 3 || args.length ===
|
|
|
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$
|
|
8284
|
+
b.then((_) => resume(succeed$8(a)), (e) => resume(fail$10(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$
|
|
8577
|
+
return fail$10(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$
|
|
8587
|
+
else if ("Bun" in globalThis) return pretty$1(fail$11(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$
|
|
8664
|
+
const exitFail = (error) => exitFailCause$1(fail$11(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$
|
|
8784
|
+
const deferredFail = /*#__PURE__*/ dual(2, (self, error) => deferredCompleteWith(self, fail$10(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$
|
|
8846
|
+
const fail$9 = fail$11;
|
|
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$
|
|
9144
|
+
const fail$8 = 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`.
|
|
@@ -9257,7 +9257,7 @@ const Order$1 = number;
|
|
|
9257
9257
|
* @since 2.0.0
|
|
9258
9258
|
* @category constructors
|
|
9259
9259
|
*/
|
|
9260
|
-
const parse$
|
|
9260
|
+
const parse$2 = (s) => {
|
|
9261
9261
|
if (s === "NaN") return some$1(NaN);
|
|
9262
9262
|
if (s === "Infinity") return some$1(Infinity);
|
|
9263
9263
|
if (s === "-Infinity") return some$1(-Infinity);
|
|
@@ -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$
|
|
9493
|
+
onNone: () => fail$10(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$
|
|
9552
|
+
case OP_FAIL$1: return fail$10(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$
|
|
9555
|
-
return fail$
|
|
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);
|
|
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$
|
|
9563
|
+
return fail$10(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$
|
|
9583
|
-
if (isLeft(left) && isRight(right$9)) return fail$
|
|
9584
|
-
if (isRight(left) && isLeft(right$9)) return fail$
|
|
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);
|
|
9585
9585
|
if (isRight(left) && isRight(right$9)) {
|
|
9586
9586
|
const path = pipe(prefix, join$4("."));
|
|
9587
9587
|
const fail = fromFlatLoopFail(prefix, path);
|
|
@@ -9852,7 +9852,7 @@ const liveServices = /*#__PURE__*/ pipe(/*#__PURE__*/ empty$19(), /*#__PURE__*/
|
|
|
9852
9852
|
*/
|
|
9853
9853
|
const currentServices = /*#__PURE__*/ globalValue(/*#__PURE__*/ Symbol.for("effect/DefaultServices/currentServices"), () => fiberRefUnsafeMakeContext(liveServices));
|
|
9854
9854
|
/** @internal */
|
|
9855
|
-
const sleep$
|
|
9855
|
+
const sleep$3 = (duration) => {
|
|
9856
9856
|
const decodedDuration = decode$1(duration);
|
|
9857
9857
|
return clockWith((clock) => clock.sleep(decodedDuration));
|
|
9858
9858
|
};
|
|
@@ -10699,7 +10699,7 @@ const failCause$4 = /*#__PURE__*/ makeExit({
|
|
|
10699
10699
|
* @experimental
|
|
10700
10700
|
* @category constructors
|
|
10701
10701
|
*/
|
|
10702
|
-
const fail$
|
|
10702
|
+
const fail$7 = (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$
|
|
11000
|
+
return fail$7(this);
|
|
11001
11001
|
},
|
|
11002
11002
|
toString() {
|
|
11003
11003
|
return this.message ? `${this.name}: ${this.message}` : this.name;
|
|
@@ -11258,7 +11258,7 @@ const match$5 = (concurrency, sequential, unbounded, bounded) => {
|
|
|
11258
11258
|
* @since 2.0.0
|
|
11259
11259
|
* @category constructors
|
|
11260
11260
|
*/
|
|
11261
|
-
const sleep$
|
|
11261
|
+
const sleep$2 = sleep$3;
|
|
11262
11262
|
/**
|
|
11263
11263
|
* @since 2.0.0
|
|
11264
11264
|
* @category constructors
|
|
@@ -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$
|
|
11338
|
+
return fail$10(onFailure ? internalCall(() => onFailure(error)) : new UnknownException(error, "An unknown error occurred in Effect.try"));
|
|
11339
11339
|
}
|
|
11340
11340
|
});
|
|
11341
11341
|
};
|
|
@@ -11408,10 +11408,10 @@ 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$
|
|
11411
|
+
onFailure: fail$10,
|
|
11412
11412
|
onSuccess: succeed$8
|
|
11413
11413
|
});
|
|
11414
|
-
const sleep = sleep$
|
|
11414
|
+
const sleep$1 = sleep$2;
|
|
11415
11415
|
const succeedNone = /*#__PURE__*/ succeed$8(/*#__PURE__*/ none$4());
|
|
11416
11416
|
const summarized = /*#__PURE__*/ dual(3, (self, summary, f) => flatMap$6(summary, (start) => flatMap$6(self, (value) => map$8(summary, (end) => [f(start, end), value]))));
|
|
11417
11417
|
const tapErrorCause$1 = /*#__PURE__*/ dual(2, (self, f) => matchCauseEffect$2(self, {
|
|
@@ -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$
|
|
11429
|
+
const fail = (e) => catcher ? failSync(() => catcher(e)) : fail$10(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$
|
|
11494
|
+
const fail$6 = 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$
|
|
13670
|
+
return fail$10(op.left);
|
|
13671
13671
|
}
|
|
13672
13672
|
["None"](_) {
|
|
13673
|
-
return fail$
|
|
13673
|
+
return fail$10(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$
|
|
13689
|
+
case "Fail": return resume(fail$10(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$
|
|
13949
|
+
if (errored) return reconcile._tag === "Some" ? fail$10(reconcile.value(errors)) : fail$10(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
|
});
|
|
@@ -14815,7 +14815,7 @@ const timeoutFail = /*#__PURE__*/ dual(2, (self, { duration, onTimeout }) => fla
|
|
|
14815
14815
|
duration
|
|
14816
14816
|
})));
|
|
14817
14817
|
/** @internal */
|
|
14818
|
-
const timeoutTo = /*#__PURE__*/ dual(2, (self, { duration, onSuccess, onTimeout }) => fiberIdWith$1((parentFiberId) => uninterruptibleMask$2((restore) => raceFibersWith(restore(self), interruptible$2(sleep(duration)), {
|
|
14818
|
+
const timeoutTo = /*#__PURE__*/ dual(2, (self, { duration, onSuccess, onTimeout }) => fiberIdWith$1((parentFiberId) => uninterruptibleMask$2((restore) => raceFibersWith(restore(self), interruptible$2(sleep$1(duration)), {
|
|
14819
14819
|
onSelfWin: (winner, loser) => flatMap$6(winner.await, (exit) => {
|
|
14820
14820
|
if (exit._tag === "Success") return flatMap$6(winner.inheritAll, () => as$1(interruptAsFiber(loser, parentFiberId), onSuccess(exit.value)));
|
|
14821
14821
|
else return flatMap$6(interruptAsFiber(loser, parentFiberId), () => exitFailCause$1(exit.cause));
|
|
@@ -15934,11 +15934,11 @@ 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$
|
|
15937
|
+
if (isDone(decision)) return setState.pipe(zipRight$3(fail$10(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);
|
|
15941
|
-
return pipe(setState, zipRight$3(updateInfo(this.iterationMeta, now, input, out)), zipRight$3(sleep(duration)), as$1(out));
|
|
15941
|
+
return pipe(setState, zipRight$3(updateInfo(this.iterationMeta, now, input, out)), zipRight$3(sleep$1(duration)), as$1(out));
|
|
15942
15942
|
}))))));
|
|
15943
15943
|
}
|
|
15944
15944
|
};
|
|
@@ -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$
|
|
16075
|
+
onSome: (error) => fail$11(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$
|
|
16080
|
+
const repeat_Effect = /*#__PURE__*/ dual(2, (self, schedule) => repeatOrElse_Effect(self, schedule, (e, _) => fail$10(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$
|
|
16112
|
+
const retry_Effect = /*#__PURE__*/ dual(2, (self, policy) => retryOrElse_Effect(self, policy, (e, _) => fail$10(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$
|
|
16879
|
+
const fail$5 = fail$10;
|
|
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$
|
|
21008
|
+
onFailure: fail$4,
|
|
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$
|
|
21052
|
+
const fail$4 = (error) => failCause$1(fail$9(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$
|
|
22039
|
+
return this.takeWith((cause) => failCause$3(map$7(cause, left)), (elem) => succeed$5(elem), (done) => fail$6(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$
|
|
22090
|
+
onFailure: fail$4,
|
|
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$
|
|
22099
|
+
onFailure: fail$4,
|
|
22100
22100
|
onDone: succeedNow
|
|
22101
22101
|
});
|
|
22102
22102
|
return pipeTo$1(self, reader);
|
|
@@ -22261,7 +22261,7 @@ 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$
|
|
22264
|
+
onFailure: (cause) => isDieType(cause) && isChannelException(cause.defect) && equals$2(cause.defect, channelException) ? fail$4(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);
|
|
@@ -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$
|
|
22431
|
+
onFailure: fail$4,
|
|
22432
22432
|
onDone: () => succeedNow(s)
|
|
22433
22433
|
});
|
|
22434
22434
|
};
|
|
@@ -22534,7 +22534,7 @@ const get$1 = (self_) => {
|
|
|
22534
22534
|
self.state = stateEmpty;
|
|
22535
22535
|
return scopeClose(state.scope, exitVoid$1);
|
|
22536
22536
|
}
|
|
22537
|
-
return sleep(self.idleTimeToLive).pipe(interruptible$2, zipRight$3(suspend$7(() => {
|
|
22537
|
+
return sleep$1(self.idleTimeToLive).pipe(interruptible$2, zipRight$3(suspend$7(() => {
|
|
22538
22538
|
if (self.state._tag === "Acquired" && self.state.refCount === 0) {
|
|
22539
22539
|
self.state = stateEmpty;
|
|
22540
22540
|
return scopeClose(state.scope, exitVoid$1);
|
|
@@ -22652,10 +22652,10 @@ const make$12 = (emit) => {
|
|
|
22652
22652
|
})));
|
|
22653
22653
|
},
|
|
22654
22654
|
end() {
|
|
22655
|
-
return this(fail$
|
|
22655
|
+
return this(fail$5(none$4()));
|
|
22656
22656
|
},
|
|
22657
22657
|
fail(e) {
|
|
22658
|
-
return this(fail$
|
|
22658
|
+
return this(fail$5(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$
|
|
22701
|
+
const end$1 = /*#__PURE__*/ new TakeImpl(/*#__PURE__*/ fail$6(/*#__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$
|
|
22723
|
+
const end = () => fail$5(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$
|
|
22836
|
+
onSome: fail$4
|
|
22837
22837
|
}),
|
|
22838
22838
|
onSuccess: (a) => write$1(of$1(a))
|
|
22839
22839
|
})));
|
|
@@ -22848,7 +22848,7 @@ const pipeThroughChannel = /*#__PURE__*/ dual(2, (self, channel) => new StreamIm
|
|
|
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$
|
|
22851
|
+
onSome: fail$5
|
|
22852
22852
|
}))));
|
|
22853
22853
|
/** @internal */
|
|
22854
22854
|
const run$4 = /*#__PURE__*/ dual(2, (self, sink) => toChannel$2(self).pipe(pipeToOrFail(toChannel$3(sink)), runDrain));
|
|
@@ -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$
|
|
22883
|
+
onFailure: fail$4,
|
|
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$
|
|
22897
|
+
onFailure: fail$4,
|
|
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 = left;
|
|
25448
|
+
const fail$3 = left;
|
|
25449
25449
|
const _try = try_$2;
|
|
25450
25450
|
/**
|
|
25451
25451
|
* @category constructors
|
|
@@ -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(new Type(ast, input));
|
|
26490
|
+
const decodeUnknown = () => (input, _, ast) => is(input) ? succeed(input) : fail$3(new Type(ast, input));
|
|
26491
26491
|
return makeDeclareClass([], new Declaration([], decodeUnknown, decodeUnknown, toASTAnnotations(annotations)));
|
|
26492
26492
|
};
|
|
26493
26493
|
function makeDeclareClass(typeParameters, ast) {
|
|
@@ -27615,7 +27615,7 @@ const nonNegative = (annotations) => greaterThanOrEqualTo(0, {
|
|
|
27615
27615
|
function parseNumber(self) {
|
|
27616
27616
|
return transformOrFail(self, Number$, {
|
|
27617
27617
|
strict: false,
|
|
27618
|
-
decode: (i, _, ast) => fromOption(parse$
|
|
27618
|
+
decode: (i, _, ast) => fromOption(parse$2(i), () => new Type(ast, i, `Unable to decode ${JSON.stringify(i)} into a number`)),
|
|
27619
27619
|
encode: (a) => succeed(String(a))
|
|
27620
27620
|
});
|
|
27621
27621
|
}
|
|
@@ -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(new Type(ast, sym, `Unable to encode a unique symbol ${String(sym)} into a string`)) : succeed(key);
|
|
27654
|
+
return key === void 0 ? fail$3(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(new Type(ast, a, `Unable to encode ${a} into a bigint`)),
|
|
27740
|
+
onNone: () => fail$3(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(new Type(ast, i, `Unable to decode ${JSON.stringify(i)} into a TimeZone`)),
|
|
27964
|
+
onNone: () => fail$3(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(new Type(ast, i, `Unable to decode ${JSON.stringify(i)} into a DateTime.Zoned`)),
|
|
27990
|
+
onNone: () => fail$3(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(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$3(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(new Type(ast, i, `Unable to decode ${JSON.stringify(i)} into a BigDecimal`)),
|
|
28047
|
+
onNone: () => fail$3(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(new Type(ast, input)),
|
|
28169
|
+
decode: () => (input, _, ast) => input instanceof this || fallbackInstanceOf(input) ? succeed(input) : fail$3(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(new Type(ast, u));
|
|
28396
|
+
const causeParse = (decodeUnknown) => (u, options, ast) => isCause(u) ? toComposite(decodeUnknown(causeEncode(u), options), causeDecode, ast, u) : fail$3(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$
|
|
28415
|
+
case "Fail": return fail$9(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));
|
|
@@ -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$
|
|
28998
|
+
if (err) resume(fail$5(onError ? onError(err, args) : err));
|
|
28999
28999
|
else resume(succeed$3(result));
|
|
29000
29000
|
});
|
|
29001
29001
|
} catch (err) {
|
|
29002
|
-
resume(onSyncError ? fail$
|
|
29002
|
+
resume(onSyncError ? fail$5(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$
|
|
29023
|
+
exists: (path) => pipe(impl.access(path), as(true), catchTag("SystemError", (e) => e.reason === "NotFound" ? succeed$3(false) : fail$5(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$
|
|
29843
|
+
if (response[1] === 2) return DeferredTypeId in mailbox ? fail$8(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$
|
|
30147
|
+
if (bytesWritten === 0) return fail$5(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$
|
|
30183
|
+
if (err) resume(fail$5(handleErrnoException("FileSystem", "readFile")(err, [path])));
|
|
30184
30184
|
else resume(succeed$3(data));
|
|
30185
30185
|
});
|
|
30186
30186
|
} catch (err) {
|
|
30187
|
-
resume(fail$
|
|
30187
|
+
resume(fail$5(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$
|
|
30241
|
+
onFailure: (err) => err._tag === "SystemError" && err.reason === "NotFound" ? succeed$3(WatchEventRemove({ path })) : fail$5(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$
|
|
30271
|
+
if (err) resume(fail$5(handleErrnoException("FileSystem", "writeFile")(err, [path])));
|
|
30272
30272
|
else resume(_void);
|
|
30273
30273
|
});
|
|
30274
30274
|
} catch (err) {
|
|
30275
|
-
resume(fail$
|
|
30275
|
+
resume(fail$5(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$
|
|
30359
|
+
exit.current = fail$6(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$
|
|
30399
|
+
unsafeDone(deferred, fail$5(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$
|
|
30447
|
+
resume(fail$5(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$
|
|
30461
|
+
if (error) resume(fail$5(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$
|
|
30468
|
+
const killProcess = (handle, signal) => suspend$5(() => handle.kill(signal) ? _void : fail$5(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$
|
|
30483
|
+
return fail$5(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))));
|
|
@@ -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$
|
|
30614
|
+
stdout.write(prompt, (err) => err ? resume(fail$5(new BadArgument({
|
|
30615
30615
|
module: "Terminal",
|
|
30616
30616
|
method: "display",
|
|
30617
30617
|
description: "Failed to write prompt to stdout",
|
|
@@ -40599,7 +40599,7 @@ function serializeChunks(chunks, expandTabs) {
|
|
|
40599
40599
|
* @returns {ParseContext}
|
|
40600
40600
|
* Parser.
|
|
40601
40601
|
*/
|
|
40602
|
-
function parse(options) {
|
|
40602
|
+
function parse$1(options) {
|
|
40603
40603
|
/** @type {ParseContext} */
|
|
40604
40604
|
const parser = {
|
|
40605
40605
|
constructs: combineExtensions([constructs_exports, ...(options || {}).extensions || []]),
|
|
@@ -40914,7 +40914,7 @@ function fromMarkdown(value, encoding, options) {
|
|
|
40914
40914
|
options = encoding;
|
|
40915
40915
|
encoding = void 0;
|
|
40916
40916
|
}
|
|
40917
|
-
return compiler(options)(postprocess(parse(options).document().write(preprocess()(value, encoding, true))));
|
|
40917
|
+
return compiler(options)(postprocess(parse$1(options).document().write(preprocess()(value, encoding, true))));
|
|
40918
40918
|
}
|
|
40919
40919
|
/**
|
|
40920
40920
|
* Note this compiler only understand complete buffering, not streaming.
|
|
@@ -48973,8 +48973,8 @@ const retryQuestion = (comparable) => comparable ? {
|
|
|
48973
48973
|
} : {
|
|
48974
48974
|
id: "verdict",
|
|
48975
48975
|
primitive: "choice",
|
|
48976
|
-
instructions: "state carries tailsNotComparable: one of the two check reports came back empty. There is nothing to compare here; answer from criteria alone.",
|
|
48977
|
-
criteria: "
|
|
48976
|
+
instructions: "state carries tailsNotComparable: one of the two check reports came back empty. There is nothing to compare here; answer from criteria alone. `identical` is FORBIDDEN here.",
|
|
48977
|
+
criteria: "new-failure: a materially different failure than before. progress: still red, but closer to green — the default if genuinely unsure."
|
|
48978
48978
|
};
|
|
48979
48979
|
const sameFailure = async (previous, current) => {
|
|
48980
48980
|
const comparable = current.trim() !== "" && previous.trim() !== "";
|
|
@@ -49622,6 +49622,7 @@ var unified_exports = /* @__PURE__ */ __exportAll({
|
|
|
49622
49622
|
qualityLap: () => qualityLap,
|
|
49623
49623
|
qualityLenses: () => qualityLenses,
|
|
49624
49624
|
reUnwind: () => reUnwind,
|
|
49625
|
+
retryQuestion: () => retryQuestion,
|
|
49625
49626
|
review: () => review,
|
|
49626
49627
|
reviewMissing: () => reviewMissing,
|
|
49627
49628
|
reviewPackage: () => reviewPackage,
|
|
@@ -49858,7 +49859,7 @@ const run$1 = (root, ...args) => scoped$3(gen(function* () {
|
|
|
49858
49859
|
collect(process.stderr),
|
|
49859
49860
|
process.exitCode
|
|
49860
49861
|
], { concurrency: "unbounded" });
|
|
49861
|
-
if (exitCode !== 0) return yield* fail$
|
|
49862
|
+
if (exitCode !== 0) return yield* fail$5(/* @__PURE__ */ new Error(`${args.join(" ")} failed (exit ${exitCode}): ${stderr$3.trim()}`));
|
|
49862
49863
|
return stdout$3;
|
|
49863
49864
|
})).pipe(mapError$1((e) => e instanceof Error ? e : new Error(String(e))));
|
|
49864
49865
|
/**
|
|
@@ -49882,7 +49883,7 @@ var InvalidRefError = class extends Error {
|
|
|
49882
49883
|
* missing one. A separate pure function so this rare branch is unit-testable
|
|
49883
49884
|
* without a real git repository contriving the condition.
|
|
49884
49885
|
*/
|
|
49885
|
-
const resolvedRefOrCorrupted = (ref, hash) => /^[0-9a-f]{40}$/.test(hash) ? succeed$3(hash) : fail$
|
|
49886
|
+
const resolvedRefOrCorrupted = (ref, hash) => /^[0-9a-f]{40}$/.test(hash) ? succeed$3(hash) : fail$5(new InvalidRefError(`Invalid ref: ${ref}`, [`ref: ${ref}`]));
|
|
49886
49887
|
const makeGitImpl = (executor, root) => {
|
|
49887
49888
|
const exec = (...args) => run$1(root, ...args).pipe(provide$2(succeed$2(CommandExecutor, executor)));
|
|
49888
49889
|
return {
|
|
@@ -49960,10 +49961,10 @@ const makeGitImpl = (executor, root) => {
|
|
|
49960
49961
|
},
|
|
49961
49962
|
commitAllWithPrefix: (prefix) => gen(function* () {
|
|
49962
49963
|
yield* exec("git", "add", "-A");
|
|
49963
|
-
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$
|
|
49964
|
+
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)));
|
|
49964
49965
|
}).pipe(asVoid),
|
|
49965
49966
|
softResetTo: (ref) => exec("git", "reset", "--soft", ref).pipe(asVoid),
|
|
49966
|
-
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$
|
|
49967
|
+
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),
|
|
49967
49968
|
discardPending: () => gen(function* () {
|
|
49968
49969
|
yield* exec("git", "add", "-A");
|
|
49969
49970
|
yield* exec("git", "reset", "--hard", "HEAD");
|
|
@@ -57583,7 +57584,7 @@ const load = gen(function* () {
|
|
|
57583
57584
|
const fatal = diagnostics.filter((d) => d.severity === "error");
|
|
57584
57585
|
if (fatal.length > 0) {
|
|
57585
57586
|
const lines = fatal.map(formatDiagnostic);
|
|
57586
|
-
return yield* fail$
|
|
57587
|
+
return yield* fail$5(new GtdError(`gtd config:\n${lines.map((line) => ` - ${line}`).join("\n")}`));
|
|
57587
57588
|
}
|
|
57588
57589
|
const initial = yield* firstStep(loaded, resolveVars(loaded.defaults, compiled.rcVars, {}, host.env), headTree(yield* Workspace));
|
|
57589
57590
|
return {
|
|
@@ -57717,7 +57718,7 @@ const replayToFirstStep = (loaded, vars, tree) => flatMap$4(promise(() => replay
|
|
|
57717
57718
|
})), (outcome) => {
|
|
57718
57719
|
if (outcome.kind === "rest") return succeed$3(outcome.rest.name);
|
|
57719
57720
|
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";
|
|
57720
|
-
return fail$
|
|
57721
|
+
return fail$5(new GtdError(`gtd config:\n - ${loaded.origin}: ${problem}`));
|
|
57721
57722
|
});
|
|
57722
57723
|
/**
|
|
57723
57724
|
* The default entry's first step — where a finished process waits — found the
|
|
@@ -57732,7 +57733,7 @@ const firstStep = (loaded, vars, head) => gen(function* () {
|
|
|
57732
57733
|
if (!empty.read()) return name;
|
|
57733
57734
|
const atHead = yield* replayToFirstStep(loaded, vars, head);
|
|
57734
57735
|
if (atHead === name) return name;
|
|
57735
|
-
return yield* fail$
|
|
57736
|
+
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`));
|
|
57736
57737
|
});
|
|
57737
57738
|
var ConfigService = class ConfigService extends Tag("ConfigService")() {
|
|
57738
57739
|
static Live = succeed$2(ConfigService, { load });
|
|
@@ -57751,6 +57752,203 @@ const renderInitScaffold = () => ({ config: JSON.stringify({
|
|
|
57751
57752
|
modes: MODES_SUGGESTION
|
|
57752
57753
|
}, null, 2) + "\n" });
|
|
57753
57754
|
//#endregion
|
|
57755
|
+
//#region src/judges/providers/fixed.ts
|
|
57756
|
+
const fail$2 = (message) => {
|
|
57757
|
+
throw new Error(`gtd judge run: ${message}`);
|
|
57758
|
+
};
|
|
57759
|
+
const isAnswer = (v) => [
|
|
57760
|
+
"string",
|
|
57761
|
+
"number",
|
|
57762
|
+
"boolean"
|
|
57763
|
+
].includes(typeof v);
|
|
57764
|
+
const isProbability = (v) => typeof v === "number" && v >= 0 && v <= 1;
|
|
57765
|
+
const validate = (entry, index) => {
|
|
57766
|
+
const { id, answer, p } = typeof entry === "object" && entry !== null ? entry : {};
|
|
57767
|
+
if (typeof id !== "string") return fail$2(`answers entry ${index} has no string "id"`);
|
|
57768
|
+
if (!isAnswer(answer)) return fail$2(`answers entry "${id}": "answer" must be a string, number or boolean`);
|
|
57769
|
+
if (!isProbability(p)) return fail$2(`answers entry "${id}": "p" must be a number in [0, 1]`);
|
|
57770
|
+
return {
|
|
57771
|
+
id,
|
|
57772
|
+
answer,
|
|
57773
|
+
p
|
|
57774
|
+
};
|
|
57775
|
+
};
|
|
57776
|
+
const fixed = ({ answersPath, env }) => async (questions) => {
|
|
57777
|
+
const inline = env["GTD_JUDGE_ANSWERS"];
|
|
57778
|
+
let raw;
|
|
57779
|
+
if (answersPath !== void 0) raw = await readFile(answersPath, "utf8").catch((e) => fail$2(`cannot read --answers ${answersPath}: ${e instanceof Error ? e.message : String(e)}`));
|
|
57780
|
+
else if (inline !== void 0 && inline !== "") raw = inline;
|
|
57781
|
+
else return fail$2("provider \"fixed\" needs --answers <path> or GTD_JUDGE_ANSWERS");
|
|
57782
|
+
let parsed;
|
|
57783
|
+
try {
|
|
57784
|
+
parsed = JSON.parse(raw);
|
|
57785
|
+
} catch {
|
|
57786
|
+
return fail$2("the fixed answers are not valid JSON");
|
|
57787
|
+
}
|
|
57788
|
+
if (!Array.isArray(parsed)) return fail$2("the fixed answers must be a JSON array");
|
|
57789
|
+
const asked = new Set(questions.map((q) => q.id));
|
|
57790
|
+
return parsed.flatMap((entry, i) => {
|
|
57791
|
+
const id = entry?.id;
|
|
57792
|
+
if (typeof id === "string" && !asked.has(id)) return [];
|
|
57793
|
+
return [validate(entry, i)];
|
|
57794
|
+
});
|
|
57795
|
+
};
|
|
57796
|
+
//#endregion
|
|
57797
|
+
//#region src/judges/providers/jev.ts
|
|
57798
|
+
const DEFAULT_URL = "https://api.typesafe.ai/v1/systemone";
|
|
57799
|
+
const MODEL = "jev-latest";
|
|
57800
|
+
const RETRIES = 3;
|
|
57801
|
+
const fail$1 = (message) => {
|
|
57802
|
+
throw new Error(`gtd judge run: ${message}`);
|
|
57803
|
+
};
|
|
57804
|
+
const LABEL = /(?:^|\. )([A-Za-z][A-Za-z0-9_-]*): /g;
|
|
57805
|
+
/** Same splitter as gtd-build's `judge_request`: text before the first label is dropped. */
|
|
57806
|
+
const splitLabels = (criteria) => {
|
|
57807
|
+
const hits = [...criteria.matchAll(LABEL)];
|
|
57808
|
+
return hits.map((m, i) => {
|
|
57809
|
+
const start = m.index + m[0].length;
|
|
57810
|
+
const end = hits[i + 1]?.index ?? criteria.length;
|
|
57811
|
+
return [m[1], criteria.slice(start, end).replace(/^ /, "")];
|
|
57812
|
+
});
|
|
57813
|
+
};
|
|
57814
|
+
const translate = (q) => {
|
|
57815
|
+
if (q.primitive === "noul") return {
|
|
57816
|
+
type: "noul",
|
|
57817
|
+
instructions: `${q.instructions}\n\nCriteria: ${q.criteria}`
|
|
57818
|
+
};
|
|
57819
|
+
const levels = splitLabels(q.criteria);
|
|
57820
|
+
if (q.primitive === "choice") {
|
|
57821
|
+
if (levels.length < 2) return fail$1(`question "${q.id}": choice criteria need at least 2 labelled options`);
|
|
57822
|
+
return {
|
|
57823
|
+
type: "choice",
|
|
57824
|
+
instructions: q.instructions,
|
|
57825
|
+
criteria: Object.fromEntries(levels)
|
|
57826
|
+
};
|
|
57827
|
+
}
|
|
57828
|
+
if (q.primitive === "score") {
|
|
57829
|
+
if (levels.length < 2 || levels.length > 10) return fail$1(`question "${q.id}": score criteria need 2 to 10 labelled levels, found ${levels.length}`);
|
|
57830
|
+
return {
|
|
57831
|
+
type: "score",
|
|
57832
|
+
instructions: q.instructions,
|
|
57833
|
+
criteria: levels.map(([, v]) => v)
|
|
57834
|
+
};
|
|
57835
|
+
}
|
|
57836
|
+
return fail$1(`question "${q.id}": unknown primitive "${String(q.primitive)}"`);
|
|
57837
|
+
};
|
|
57838
|
+
const toRequest = (questions, state) => ({
|
|
57839
|
+
model: MODEL,
|
|
57840
|
+
state,
|
|
57841
|
+
questions: Object.fromEntries(questions.map((q) => [q.id, translate(q)]))
|
|
57842
|
+
});
|
|
57843
|
+
const clamp = (n) => Math.min(1, Math.max(0, n));
|
|
57844
|
+
const unreadable = (why) => fail$1(`unreadable jev response: ${why}`);
|
|
57845
|
+
const num = (v, what) => typeof v === "number" && Number.isFinite(v) ? v : unreadable(`${what} is not a finite number`);
|
|
57846
|
+
const probs = (a, id) => {
|
|
57847
|
+
const raw = a["probabilities"];
|
|
57848
|
+
if (typeof raw !== "object" || raw === null) return unreadable(`"${id}" has no probabilities`);
|
|
57849
|
+
return Object.fromEntries(Object.entries(raw).map(([k, v]) => [k, num(v, `"${id}" probability "${k}"`)]));
|
|
57850
|
+
};
|
|
57851
|
+
const toVerdict = (q, a) => {
|
|
57852
|
+
if (a["type"] !== q.primitive) return unreadable(`"${q.id}" answered as ${String(a["type"])}, asked ${q.primitive}`);
|
|
57853
|
+
if (q.primitive === "noul") {
|
|
57854
|
+
const n = num(a["noul"], `"${q.id}" noul`);
|
|
57855
|
+
return n >= .5 ? {
|
|
57856
|
+
id: q.id,
|
|
57857
|
+
answer: "yes",
|
|
57858
|
+
p: clamp(n)
|
|
57859
|
+
} : {
|
|
57860
|
+
id: q.id,
|
|
57861
|
+
answer: "no",
|
|
57862
|
+
p: clamp(1 - n)
|
|
57863
|
+
};
|
|
57864
|
+
}
|
|
57865
|
+
const p = probs(a, q.id);
|
|
57866
|
+
if (q.primitive === "choice") {
|
|
57867
|
+
const choice = a["choice"];
|
|
57868
|
+
if (typeof choice !== "string" || !(choice in p)) return unreadable(`"${q.id}" choice is absent from its probabilities`);
|
|
57869
|
+
return {
|
|
57870
|
+
id: q.id,
|
|
57871
|
+
answer: choice,
|
|
57872
|
+
p: clamp(p[choice])
|
|
57873
|
+
};
|
|
57874
|
+
}
|
|
57875
|
+
const levels = Object.entries(p).map(([k, v]) => [Number(k), v]);
|
|
57876
|
+
if (levels.length === 0 || levels.some(([k]) => !Number.isFinite(k))) return unreadable(`"${q.id}" score probabilities are not numeric levels`);
|
|
57877
|
+
const top = levels.reduce((best, cur) => cur[1] > best[1] || cur[1] === best[1] && cur[0] < best[0] ? cur : best);
|
|
57878
|
+
return {
|
|
57879
|
+
id: q.id,
|
|
57880
|
+
answer: top[0],
|
|
57881
|
+
p: clamp(top[1])
|
|
57882
|
+
};
|
|
57883
|
+
};
|
|
57884
|
+
const toVerdicts = (questions, response) => {
|
|
57885
|
+
const answers = response?.answers;
|
|
57886
|
+
if (typeof answers !== "object" || answers === null || Array.isArray(answers)) return unreadable("no \"answers\" object");
|
|
57887
|
+
const map = answers;
|
|
57888
|
+
const missing = questions.filter((q) => typeof map[q.id] !== "object" || map[q.id] === null);
|
|
57889
|
+
if (missing.length > 0) return fail$1(`jev answered ${questions.length - missing.length} of ${questions.length} questions; missing ${missing.map((q) => q.id).join(", ")}`);
|
|
57890
|
+
return questions.map((q) => toVerdict(q, map[q.id]));
|
|
57891
|
+
};
|
|
57892
|
+
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
57893
|
+
const post = async (url, key, body, delayMs) => {
|
|
57894
|
+
for (let attempt = 0;; attempt++) {
|
|
57895
|
+
const res = await fetch(url, {
|
|
57896
|
+
method: "POST",
|
|
57897
|
+
headers: {
|
|
57898
|
+
Authorization: `Bearer ${key}`,
|
|
57899
|
+
"Content-Type": "application/json"
|
|
57900
|
+
},
|
|
57901
|
+
body,
|
|
57902
|
+
signal: AbortSignal.timeout(18e4)
|
|
57903
|
+
}).catch((e) => fail$1(`jev request failed: ${e instanceof Error ? e.message : String(e)}`));
|
|
57904
|
+
const text = await res.text();
|
|
57905
|
+
if (res.status === 200) return text;
|
|
57906
|
+
if ((res.status === 429 || res.status === 529) && attempt < RETRIES) {
|
|
57907
|
+
await sleep(delayMs);
|
|
57908
|
+
continue;
|
|
57909
|
+
}
|
|
57910
|
+
return fail$1(`jev responded ${res.status}: ${text.slice(0, 2048)}`);
|
|
57911
|
+
}
|
|
57912
|
+
};
|
|
57913
|
+
const parse = (text) => {
|
|
57914
|
+
try {
|
|
57915
|
+
return JSON.parse(text);
|
|
57916
|
+
} catch {
|
|
57917
|
+
return unreadable("not JSON");
|
|
57918
|
+
}
|
|
57919
|
+
};
|
|
57920
|
+
const jev = ({ env, retryDelayMs = 2e3 }) => async (questions, state) => {
|
|
57921
|
+
const key = env["TYPESAFE_API_KEY"];
|
|
57922
|
+
if (key === void 0 || key === "") return fail$1("--provider jev needs TYPESAFE_API_KEY");
|
|
57923
|
+
const url = env["JEV_BASE_URL"] || DEFAULT_URL;
|
|
57924
|
+
const text = await post(url, key, JSON.stringify(toRequest(questions, state)), retryDelayMs);
|
|
57925
|
+
return toVerdicts(questions, parse(text));
|
|
57926
|
+
};
|
|
57927
|
+
//#endregion
|
|
57928
|
+
//#region src/judges/run.ts
|
|
57929
|
+
const fail = (message) => {
|
|
57930
|
+
throw new Error(`gtd judge run: ${message}`);
|
|
57931
|
+
};
|
|
57932
|
+
const answererFor = ({ provider, answers, env }) => {
|
|
57933
|
+
if (provider === "fixed") return fixed({
|
|
57934
|
+
answersPath: answers,
|
|
57935
|
+
env
|
|
57936
|
+
});
|
|
57937
|
+
return jev({ env });
|
|
57938
|
+
};
|
|
57939
|
+
const runJudge = async (opts) => {
|
|
57940
|
+
let doc;
|
|
57941
|
+
try {
|
|
57942
|
+
doc = JSON.parse(opts.input);
|
|
57943
|
+
} catch {
|
|
57944
|
+
return fail("stdin is not valid JSON");
|
|
57945
|
+
}
|
|
57946
|
+
const { questions, state } = doc ?? {};
|
|
57947
|
+
if (!Array.isArray(questions)) return fail("stdin has no \"questions\" array");
|
|
57948
|
+
const verdicts = await answererFor(opts)(questions, typeof state === "object" && state !== null ? state : {});
|
|
57949
|
+
return JSON.stringify(verdicts) + "\n";
|
|
57950
|
+
};
|
|
57951
|
+
//#endregion
|
|
57754
57952
|
//#region node_modules/@trpc/server/dist/codes-DagpWZLc.mjs
|
|
57755
57953
|
/**
|
|
57756
57954
|
* Ensures there are no duplicate keys when building a procedure.
|
|
@@ -62139,7 +62337,7 @@ const generateSelfSignedCert = (request) => gen(function* () {
|
|
|
62139
62337
|
`-addext "extendedKeyUsage=serverAuth"`,
|
|
62140
62338
|
`-addext "basicConstraints=critical,CA:FALSE"`
|
|
62141
62339
|
].join(" ");
|
|
62142
|
-
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$
|
|
62340
|
+
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_({
|
|
62143
62341
|
try: () => ({
|
|
62144
62342
|
cert: readFileSync(certPath, "utf8"),
|
|
62145
62343
|
key: readFileSync(keyPath, "utf8")
|
|
@@ -62171,7 +62369,7 @@ const obtainTailscaleCert = (domain) => gen(function* () {
|
|
|
62171
62369
|
`--key-file ${shellQuote(keyPath)}`,
|
|
62172
62370
|
shellQuote(domain)
|
|
62173
62371
|
].join(" ");
|
|
62174
|
-
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$
|
|
62372
|
+
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_({
|
|
62175
62373
|
try: () => ({
|
|
62176
62374
|
cert: readFileSync(certPath, "utf8"),
|
|
62177
62375
|
key: readFileSync(keyPath, "utf8")
|
|
@@ -62208,7 +62406,7 @@ const TRPC_PATH_PREFIX = "/trpc";
|
|
|
62208
62406
|
*/
|
|
62209
62407
|
const resolveBindHost = (host, config, pickHost = () => pickBindHost(OS.networkInterfaces())) => {
|
|
62210
62408
|
const resolved = host ?? config?.host ?? pickHost();
|
|
62211
|
-
return resolved === void 0 ? fail$
|
|
62409
|
+
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);
|
|
62212
62410
|
};
|
|
62213
62411
|
/**
|
|
62214
62412
|
* `--self-signed`, then a configured pair, then a real `tailscale cert`, then
|
|
@@ -62225,11 +62423,11 @@ const resolveCertPair = (options, config, bindHost, displayHost, tailscaleStatus
|
|
|
62225
62423
|
if (config?.cert !== void 0 && config.key !== void 0) return loadCertPair(config.cert, config.key);
|
|
62226
62424
|
if (config?.cert !== void 0 || config?.key !== void 0) {
|
|
62227
62425
|
const missing = config.cert === void 0 ? "ui.cert" : "ui.key";
|
|
62228
|
-
return fail$
|
|
62426
|
+
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"]));
|
|
62229
62427
|
}
|
|
62230
62428
|
const certDomain = tailscaleStatus?.certDomains[0];
|
|
62231
62429
|
if (certDomain !== void 0) return obtainTailscaleCert(certDomain);
|
|
62232
|
-
return fail$
|
|
62430
|
+
return fail$5(new GtdError("gtd ui: HTTPS is mandatory and no certificate is configured", [
|
|
62233
62431
|
"pass --self-signed for a throwaway certificate",
|
|
62234
62432
|
"or configure ui.cert and ui.key",
|
|
62235
62433
|
"or join a tailnet with HTTPS certs enabled for an automatic one"
|
|
@@ -62250,7 +62448,7 @@ var UiListener = class UiListener extends Tag("UiListener")() {
|
|
|
62250
62448
|
key: tls.key
|
|
62251
62449
|
}, handler) : http.createServer(handler);
|
|
62252
62450
|
server.once("error", (err) => {
|
|
62253
|
-
resume(fail$
|
|
62451
|
+
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}`)));
|
|
62254
62452
|
});
|
|
62255
62453
|
server.listen(port, host, () => {
|
|
62256
62454
|
const address = server.address();
|
|
@@ -62309,7 +62507,7 @@ const readDevTemplate = (fs, root) => fs.readFileString(join(root, "src/web/inde
|
|
|
62309
62507
|
*/
|
|
62310
62508
|
const rebuildDevClientScript = (runner, fs, root) => gen(function* () {
|
|
62311
62509
|
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}`)));
|
|
62312
|
-
if (outcome.status !== 0) return yield* fail$
|
|
62510
|
+
if (outcome.status !== 0) return yield* fail$5(new GtdError("gtd ui --dev: rebuilding the client failed", outcome.output.trim().split("\n").filter(Boolean)));
|
|
62313
62511
|
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}`)));
|
|
62314
62512
|
});
|
|
62315
62513
|
/**
|
|
@@ -62320,7 +62518,7 @@ const rebuildDevClientScript = (runner, fs, root) => gen(function* () {
|
|
|
62320
62518
|
*/
|
|
62321
62519
|
const rebuildDevClientCss = (runner, fs, root) => gen(function* () {
|
|
62322
62520
|
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}`)));
|
|
62323
|
-
if (outcome.status !== 0) return yield* fail$
|
|
62521
|
+
if (outcome.status !== 0) return yield* fail$5(new GtdError("gtd ui --dev: rebuilding the stylesheet failed", outcome.output.trim().split("\n").filter(Boolean)));
|
|
62324
62522
|
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}`)));
|
|
62325
62523
|
});
|
|
62326
62524
|
/** 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. */
|
|
@@ -62588,7 +62786,7 @@ const resolveListener = (args) => gen(function* () {
|
|
|
62588
62786
|
const runUiCommand = (options, config, out) => gen(function* () {
|
|
62589
62787
|
const cwd = yield* Host;
|
|
62590
62788
|
const step = yield* promise(() => readStep({ path: cwd.root }, liveBeatDeps));
|
|
62591
|
-
if (step.status === "broken" || !isRenderable(step)) return yield* fail$
|
|
62789
|
+
if (step.status === "broken" || !isRenderable(step)) return yield* fail$5(refusalFor(step));
|
|
62592
62790
|
const servedState = step.state;
|
|
62593
62791
|
const servedLabel = step.label;
|
|
62594
62792
|
const runner = yield* CommandRunner;
|
|
@@ -63420,11 +63618,11 @@ const restAt = (ref) => gen(function* () {
|
|
|
63420
63618
|
};
|
|
63421
63619
|
const outcome = yield* promise(() => replayFor(setup));
|
|
63422
63620
|
const error = replayError(outcome);
|
|
63423
|
-
if (error !== void 0 || outcome.kind !== "rest") return yield* fail$
|
|
63621
|
+
if (error !== void 0 || outcome.kind !== "rest") return yield* fail$5(error ?? /* @__PURE__ */ new Error("gtd: replay found no rest"));
|
|
63424
63622
|
const step = outcome.rest;
|
|
63425
63623
|
yield* (yield* Narrator).narrate(`rest resolved: ${step.name} (awaits ${step.actor})`);
|
|
63426
63624
|
const stepDef = stepDefOf(step);
|
|
63427
|
-
if (stepDef.mode !== void 0 && def.modes[stepDef.mode] === void 0) return yield* fail$
|
|
63625
|
+
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(", ")})`));
|
|
63428
63626
|
const changes = ref === void 0 ? (yield* git.changedPaths()).map((e) => ({
|
|
63429
63627
|
status: normalizeStatus(e.status),
|
|
63430
63628
|
path: e.path
|
|
@@ -63538,7 +63736,7 @@ const decideLanding = (rest, verdicts) => gen(function* () {
|
|
|
63538
63736
|
kind: "refusal",
|
|
63539
63737
|
message: outcome.message
|
|
63540
63738
|
};
|
|
63541
|
-
if (outcome.kind === "divergence" || outcome.kind === "failed") return yield* fail$
|
|
63739
|
+
if (outcome.kind === "divergence" || outcome.kind === "failed") return yield* fail$5(new Error(outcome.message));
|
|
63542
63740
|
const to = outcome.kind === "rest" ? outcome.rest.name : rest.def.initial;
|
|
63543
63741
|
if (rest.changes.length === 0 && rest.stepDef.kind === "script" && to === rest.state) return {
|
|
63544
63742
|
kind: "noop",
|
|
@@ -76172,7 +76370,7 @@ var SelectorUsageError = class extends Error {};
|
|
|
76172
76370
|
const writeSelection = (out, fields, path) => gen(function* () {
|
|
76173
76371
|
const selection = selectPath(fields, path);
|
|
76174
76372
|
if (selection.kind === "value") out.write(`${selection.text}\n`);
|
|
76175
|
-
else if (selection.kind === "unknown") return yield* fail$
|
|
76373
|
+
else if (selection.kind === "unknown") return yield* fail$5(new SelectorUsageError(`gtd: unknown --json selector "${selection.path}" — see \`gtd --help\``));
|
|
76176
76374
|
});
|
|
76177
76375
|
/** `needs: "none"` skips the repo-root guard — the server is keyed on file name, not workflow state. */
|
|
76178
76376
|
const runLspCommand = () => startLspServer();
|
|
@@ -76192,7 +76390,7 @@ const runInitCommand = (out) => gen(function* () {
|
|
|
76192
76390
|
const git = yield* GitService;
|
|
76193
76391
|
const host = yield* Host;
|
|
76194
76392
|
const inRepo = yield* assertInitLocation(git, host);
|
|
76195
|
-
if (yield* configPresentAt(host.root)) return yield* fail$
|
|
76393
|
+
if (yield* configPresentAt(host.root)) return yield* fail$5(/* @__PURE__ */ new Error("gtd init: a gtd config already exists — remove it before re-initializing"));
|
|
76196
76394
|
const scaffold = renderInitScaffold();
|
|
76197
76395
|
yield* (yield* Workspace).write(".gtdrc.json", scaffold.config);
|
|
76198
76396
|
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";
|
|
@@ -76221,7 +76419,7 @@ const EMPTY_TREE = "4b825dc642cb6eb9a060e54bf8d69288fbee4904";
|
|
|
76221
76419
|
const planLanding = (opts = {}) => gen(function* () {
|
|
76222
76420
|
const rest = yield* currentRest;
|
|
76223
76421
|
const outcome = planStep(yield* snapshotFromRest(rest, opts.judge), opts);
|
|
76224
|
-
if (outcome.kind === "refusal") return yield* fail$
|
|
76422
|
+
if (outcome.kind === "refusal") return yield* fail$5(new Error(outcome.message));
|
|
76225
76423
|
if (outcome.kind === "noop") {
|
|
76226
76424
|
const required = ScriptSurface.render([{
|
|
76227
76425
|
kind: "outcome",
|
|
@@ -76260,13 +76458,13 @@ const planLanding = (opts = {}) => gen(function* () {
|
|
|
76260
76458
|
*/
|
|
76261
76459
|
const runSummaryCommand = (out) => gen(function* () {
|
|
76262
76460
|
const rendered = yield* summaryFor(yield* summaryRun);
|
|
76263
|
-
if (rendered === void 0) return yield* fail$
|
|
76461
|
+
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"));
|
|
76264
76462
|
out.write(rendered.endsWith("\n") ? rendered : rendered + "\n");
|
|
76265
76463
|
});
|
|
76266
76464
|
/** 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. */
|
|
76267
76465
|
const runBaseCommand = (out) => gen(function* () {
|
|
76268
76466
|
const rest = yield* currentRest;
|
|
76269
|
-
if (rest.run.trace.length === 0) return yield* fail$
|
|
76467
|
+
if (rest.run.trace.length === 0) return yield* fail$5(/* @__PURE__ */ new Error("gtd base: refused — no process is underway at HEAD"));
|
|
76270
76468
|
const base = reviewBaseFor(rest);
|
|
76271
76469
|
out.write(`${base}\n`);
|
|
76272
76470
|
});
|
|
@@ -76274,7 +76472,7 @@ const runBaseCommand = (out) => gen(function* () {
|
|
|
76274
76472
|
const runJudgeCommand = (json, out) => gen(function* () {
|
|
76275
76473
|
const rest = yield* currentRest;
|
|
76276
76474
|
const rendered = yield* renderRest(rest);
|
|
76277
|
-
if (rendered.judge === void 0) return yield* fail$
|
|
76475
|
+
if (rendered.judge === void 0) return yield* fail$5(/* @__PURE__ */ new Error(`gtd judge: refused — the resolved rest ("${rest.state}") declares no "judge:"`));
|
|
76278
76476
|
const document = rendered.judge.endsWith("\n") ? rendered.judge : `${rendered.judge}\n`;
|
|
76279
76477
|
if (json.kind === "select") {
|
|
76280
76478
|
const selection = selectPath(yield* try_({
|
|
@@ -76282,7 +76480,7 @@ const runJudgeCommand = (json, out) => gen(function* () {
|
|
|
76282
76480
|
catch: () => new SelectorUsageError("gtd judge: the resolved rest's \"judge:\" template did not render valid JSON")
|
|
76283
76481
|
}), json.path);
|
|
76284
76482
|
if (selection.kind === "value") out.write(`${selection.text}\n`);
|
|
76285
|
-
else if (selection.kind === "unknown") return yield* fail$
|
|
76483
|
+
else if (selection.kind === "unknown") return yield* fail$5(new SelectorUsageError(`gtd: unknown --json selector "${selection.path}" — see \`gtd --help\``));
|
|
76286
76484
|
return;
|
|
76287
76485
|
}
|
|
76288
76486
|
out.write(document);
|
|
@@ -76304,6 +76502,21 @@ const readStdin = () => tryPromise({
|
|
|
76304
76502
|
},
|
|
76305
76503
|
catch: (e) => e instanceof Error ? e : new Error(String(e))
|
|
76306
76504
|
});
|
|
76505
|
+
/** Stdout is written once, after the answerer resolves — a rejection leaves it empty. */
|
|
76506
|
+
const runJudgeRunCommand = (command, out) => gen(function* () {
|
|
76507
|
+
const host = yield* Host;
|
|
76508
|
+
const input = yield* readStdin();
|
|
76509
|
+
const verdict = yield* tryPromise({
|
|
76510
|
+
try: () => runJudge({
|
|
76511
|
+
provider: command.provider,
|
|
76512
|
+
answers: command.answers,
|
|
76513
|
+
env: host.env,
|
|
76514
|
+
input
|
|
76515
|
+
}),
|
|
76516
|
+
catch: (e) => e instanceof Error ? e : new Error(String(e))
|
|
76517
|
+
});
|
|
76518
|
+
out.write(verdict);
|
|
76519
|
+
});
|
|
76307
76520
|
/** A verdict's own `answer` shape covers every `judge:` primitive (`noul` → boolean, `choice` → string, `score` → number) without gtd itself interpreting which one applies — that's a driver/judge-model concern, not this decode's. */
|
|
76308
76521
|
const VerdictAnswer = Union(String$, Number$, Boolean$);
|
|
76309
76522
|
/**
|
|
@@ -76328,7 +76541,7 @@ const verdictSchemaFor = (ids) => Array$(Struct({
|
|
|
76328
76541
|
const runJudgeAnswerCommand = (json, out) => gen(function* () {
|
|
76329
76542
|
const rest = yield* currentRest;
|
|
76330
76543
|
const rendered = yield* renderRest(rest);
|
|
76331
|
-
if (rendered.judge === void 0) return yield* fail$
|
|
76544
|
+
if (rendered.judge === void 0) return yield* fail$5(/* @__PURE__ */ new Error(`gtd judge answer: refused — the resolved rest ("${rest.state}") declares no "judge:"`));
|
|
76332
76545
|
const ids = (yield* parseJudgeDocument(rendered.judge)).questions.map((q) => q.id);
|
|
76333
76546
|
const raw = yield* readStdin();
|
|
76334
76547
|
const parsed = yield* try_({
|
|
@@ -76374,7 +76587,7 @@ const runEntryCommand = (actor, entryState, varOverrides, out, commandLabel) =>
|
|
|
76374
76587
|
commandLabel,
|
|
76375
76588
|
vars: varOverrides
|
|
76376
76589
|
});
|
|
76377
|
-
if (plan.kind === "refusal") return yield* fail$
|
|
76590
|
+
if (plan.kind === "refusal") return yield* fail$5(new Error(plan.message));
|
|
76378
76591
|
out.write(landingScript(ScriptSurface.render(plan.steps)));
|
|
76379
76592
|
});
|
|
76380
76593
|
/**
|
|
@@ -76403,7 +76616,7 @@ const runAbandonCommand = (out) => gen(function* () {
|
|
|
76403
76616
|
return;
|
|
76404
76617
|
}
|
|
76405
76618
|
const restState = run.trace[run.trace.length - 1].state;
|
|
76406
|
-
if (run.startParentHash === EMPTY_TREE) return yield* fail$
|
|
76619
|
+
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`));
|
|
76407
76620
|
const required = emitScripts([
|
|
76408
76621
|
{
|
|
76409
76622
|
kind: "gitWrite",
|
|
@@ -76429,13 +76642,13 @@ const runAbandonCommand = (out) => gen(function* () {
|
|
|
76429
76642
|
*/
|
|
76430
76643
|
const runRestoreCommand = (out) => gen(function* () {
|
|
76431
76644
|
const git = yield* GitService;
|
|
76432
|
-
if ((yield* currentRest).changes.length > 0) return yield* fail$
|
|
76645
|
+
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."));
|
|
76433
76646
|
const retained = yield* readRetainedHistory(git);
|
|
76434
|
-
if (isNone(retained)) return yield* fail$
|
|
76647
|
+
if (isNone(retained)) return yield* fail$5(/* @__PURE__ */ new Error("gtd restore: no retained history to restore."));
|
|
76435
76648
|
const tip = retained.value;
|
|
76436
76649
|
const headHash = yield* git.resolveRef("HEAD");
|
|
76437
76650
|
const check = yield* restorability(git, headHash, tip);
|
|
76438
|
-
if (!check.ok) return yield* fail$
|
|
76651
|
+
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)}.`));
|
|
76439
76652
|
const after = yield* restAt(tip);
|
|
76440
76653
|
const required = emitScripts([
|
|
76441
76654
|
{
|
|
@@ -76479,7 +76692,7 @@ const resolveValidateScript = (rest) => gen(function* () {
|
|
|
76479
76692
|
const mode = rest.stepDef.mode;
|
|
76480
76693
|
if (file === void 0 || mode === void 0) return void 0;
|
|
76481
76694
|
const resolved = resolveMode(rest.def, rest.state, mode);
|
|
76482
|
-
if (resolved.kind === "unknown") return yield* fail$
|
|
76695
|
+
if (resolved.kind === "unknown") return yield* fail$5(new Error(resolved.message));
|
|
76483
76696
|
const { script } = yield* validateScriptFor(resolved, file);
|
|
76484
76697
|
return {
|
|
76485
76698
|
file,
|
|
@@ -76535,23 +76748,23 @@ const formatFinding = (file, finding) => {
|
|
|
76535
76748
|
*/
|
|
76536
76749
|
const runCheckCommand = (mode, file, openQuestions, openThreadsFlag) => gen(function* () {
|
|
76537
76750
|
const format = steeringFormatFor(mode);
|
|
76538
|
-
if (format === void 0) return yield* fail$
|
|
76751
|
+
if (format === void 0) return yield* fail$5(/* @__PURE__ */ new Error(`gtd check: unknown mode "${mode}" — known modes: ${BUILT_IN_MODE_NAMES.join(", ")}`));
|
|
76539
76752
|
if (openThreadsFlag) {
|
|
76540
|
-
if (openQuestions) return yield* fail$
|
|
76753
|
+
if (openQuestions) return yield* fail$5(/* @__PURE__ */ new Error("gtd check: --open-threads and --open-questions are mutually exclusive"));
|
|
76541
76754
|
if (format.openThreads === void 0) {
|
|
76542
76755
|
const accepted = BUILT_IN_MODE_NAMES.filter((name) => steeringFormatFor(name)?.openThreads !== void 0);
|
|
76543
|
-
return yield* fail$
|
|
76756
|
+
return yield* fail$5(/* @__PURE__ */ new Error(`gtd check: --open-threads only applies to modes ${accepted.join(", ")} — got "${mode}"`));
|
|
76544
76757
|
}
|
|
76545
76758
|
return yield* runOpenThreadsCheckCommand(format, file);
|
|
76546
76759
|
}
|
|
76547
76760
|
if (openQuestions) {
|
|
76548
|
-
if (mode !== "qa") return yield* fail$
|
|
76761
|
+
if (mode !== "qa") return yield* fail$5(/* @__PURE__ */ new Error(`gtd check: --open-questions only applies to mode "qa" — got "${mode}"`));
|
|
76549
76762
|
return yield* runOpenQuestionsCheckCommand(format, file);
|
|
76550
76763
|
}
|
|
76551
76764
|
const content = (yield* Workspace).atPath(file);
|
|
76552
76765
|
const errors = content !== void 0 ? format.validate(content).map((finding) => formatFinding(file, finding)) : [];
|
|
76553
76766
|
if (errors.length === 0) return;
|
|
76554
|
-
return yield* fail$
|
|
76767
|
+
return yield* fail$5(/* @__PURE__ */ new Error(`gtd check: ${file} is not valid under mode "${mode}" (${errors.length} finding(s)):\n` + errors.join("\n")));
|
|
76555
76768
|
});
|
|
76556
76769
|
/**
|
|
76557
76770
|
* The bare `gtd check --open-threads`: code-comment threads in the files the
|
|
@@ -76568,15 +76781,15 @@ const runCodeThreadsCheckCommand = () => gen(function* () {
|
|
|
76568
76781
|
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}`)];
|
|
76569
76782
|
});
|
|
76570
76783
|
if (lines.length === 0) return;
|
|
76571
|
-
return yield* fail$
|
|
76784
|
+
return yield* fail$5(new Error(lines.join("\n")));
|
|
76572
76785
|
});
|
|
76573
76786
|
/** Prints one `file:line: [^name]: <first H entry>` line per open thread; a missing file fails, like `--open-questions`. */
|
|
76574
76787
|
const runOpenThreadsCheckCommand = (format, file) => gen(function* () {
|
|
76575
76788
|
const content = (yield* Workspace).atPath(file);
|
|
76576
|
-
if (content === void 0) return yield* fail$
|
|
76789
|
+
if (content === void 0) return yield* fail$5(/* @__PURE__ */ new Error(`gtd check: ${file} does not exist`));
|
|
76577
76790
|
const errors = openThreads(format, content).map((t) => `${file}:${t.line + 1}: [^${t.name}]: ${t.firstMe}`);
|
|
76578
76791
|
if (errors.length === 0) return;
|
|
76579
|
-
return yield* fail$
|
|
76792
|
+
return yield* fail$5(/* @__PURE__ */ new Error(`gtd check: ${errors.length} open thread(s) in ${file}:\n` + errors.join("\n")));
|
|
76580
76793
|
});
|
|
76581
76794
|
/**
|
|
76582
76795
|
* Runs the SAME `unansweredQuestions` predicate a flow's `openQuestions()`
|
|
@@ -76585,10 +76798,10 @@ const runOpenThreadsCheckCommand = (format, file) => gen(function* () {
|
|
|
76585
76798
|
*/
|
|
76586
76799
|
const runOpenQuestionsCheckCommand = (format, file) => gen(function* () {
|
|
76587
76800
|
const content = (yield* Workspace).atPath(file);
|
|
76588
|
-
if (content === void 0) return yield* fail$
|
|
76801
|
+
if (content === void 0) return yield* fail$5(/* @__PURE__ */ new Error(`gtd check: ${file} does not exist`));
|
|
76589
76802
|
const errors = unansweredQuestions(format, content).map((q) => `${file}:${q.headingLine + 1}: ${q.question}`);
|
|
76590
76803
|
if (errors.length === 0) return;
|
|
76591
|
-
return yield* fail$
|
|
76804
|
+
return yield* fail$5(/* @__PURE__ */ new Error(`gtd check: ${errors.length} open question(s) unanswered in ${file}:\n` + errors.join("\n")));
|
|
76592
76805
|
});
|
|
76593
76806
|
/**
|
|
76594
76807
|
* Clears the `review` format's ticks in `<file>`, writing back only when the
|
|
@@ -76665,11 +76878,11 @@ const runUiCliCommand = (command, out) => gen(function* () {
|
|
|
76665
76878
|
*/
|
|
76666
76879
|
const assertRunningFromRepoRoot = (git, host) => gen(function* () {
|
|
76667
76880
|
const topLevel = yield* git.topLevel();
|
|
76668
|
-
if ((yield* host.realPath(topLevel)) !== (yield* host.realPath(host.root))) return yield* fail$
|
|
76881
|
+
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}`));
|
|
76669
76882
|
});
|
|
76670
76883
|
/** A command that derives workflow state needs at least one commit too — a commitless repository has no HEAD to resolve a `Rest` at. */
|
|
76671
76884
|
const assertRepositoryHasCommits = (git) => gen(function* () {
|
|
76672
|
-
if (!(yield* git.hasCommits())) return yield* fail$
|
|
76885
|
+
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"));
|
|
76673
76886
|
});
|
|
76674
76887
|
/**
|
|
76675
76888
|
* `gtd init` may run either at a repository root or in a directory outside
|
|
@@ -76682,7 +76895,7 @@ const assertRepositoryHasCommits = (git) => gen(function* () {
|
|
|
76682
76895
|
const assertInitLocation = (git, host) => gen(function* () {
|
|
76683
76896
|
const topLevel = yield* either(git.topLevel());
|
|
76684
76897
|
if (topLevel._tag === "Left") return false;
|
|
76685
|
-
if ((yield* host.realPath(topLevel.right)) !== (yield* host.realPath(host.root))) return yield* fail$
|
|
76898
|
+
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}`));
|
|
76686
76899
|
return true;
|
|
76687
76900
|
});
|
|
76688
76901
|
/**
|
|
@@ -76695,7 +76908,8 @@ const assertInitLocation = (git, host) => gen(function* () {
|
|
|
76695
76908
|
const needsOf = (kind) => {
|
|
76696
76909
|
switch (kind) {
|
|
76697
76910
|
case "lsp":
|
|
76698
|
-
case "install":
|
|
76911
|
+
case "install":
|
|
76912
|
+
case "judgeRun": return "none";
|
|
76699
76913
|
case "init":
|
|
76700
76914
|
case "check":
|
|
76701
76915
|
case "uncheck": return "fs";
|
|
@@ -76732,6 +76946,7 @@ const dispatchVoidCommand = (command, json, out) => {
|
|
|
76732
76946
|
case "base": return runBaseCommand(out);
|
|
76733
76947
|
case "judge": return runJudgeCommand(json, out);
|
|
76734
76948
|
case "judgeAnswer": return runJudgeAnswerCommand(json, out);
|
|
76949
|
+
case "judgeRun": return runJudgeRunCommand(command, out);
|
|
76735
76950
|
}
|
|
76736
76951
|
};
|
|
76737
76952
|
/**
|
|
@@ -76851,6 +77066,30 @@ const FLAGS = [
|
|
|
76851
77066
|
valueHint: "",
|
|
76852
77067
|
help: ["(gtd ui only) run against local development sources", "instead of the packaged build"]
|
|
76853
77068
|
},
|
|
77069
|
+
{
|
|
77070
|
+
name: "--provider",
|
|
77071
|
+
arity: 1,
|
|
77072
|
+
repeatable: false,
|
|
77073
|
+
scope: (kind) => kind === "judgeRun",
|
|
77074
|
+
decode: ([raw]) => raw === "fixed" || raw === "jev" ? right(raw) : left(`gtd: --provider must be one of fixed, jev — got "${raw ?? ""}"`),
|
|
77075
|
+
scopeError: "gtd: --provider is only valid for `gtd judge run`",
|
|
77076
|
+
valueHint: "<name>",
|
|
77077
|
+
help: ["(gtd judge run only, required) the answerer: fixed | jev"]
|
|
77078
|
+
},
|
|
77079
|
+
{
|
|
77080
|
+
name: "--answers",
|
|
77081
|
+
arity: 1,
|
|
77082
|
+
repeatable: false,
|
|
77083
|
+
scope: (kind) => kind === "judgeRun",
|
|
77084
|
+
decode: ([raw]) => raw === void 0 || raw === "" ? left("gtd: --answers must be a non-empty path") : right(raw),
|
|
77085
|
+
scopeError: "gtd: --answers is only valid for `gtd judge run`",
|
|
77086
|
+
valueHint: "<path>",
|
|
77087
|
+
help: [
|
|
77088
|
+
"(gtd judge run --provider fixed only) a JSON verdict array",
|
|
77089
|
+
"[{ id, answer, p }]; else the GTD_JUDGE_ANSWERS env var",
|
|
77090
|
+
"(inline JSON) is read"
|
|
77091
|
+
]
|
|
77092
|
+
},
|
|
76854
77093
|
{
|
|
76855
77094
|
name: "--cost",
|
|
76856
77095
|
arity: 1,
|
|
@@ -77215,6 +77454,20 @@ const COMMAND_ROWS = [
|
|
|
77215
77454
|
"selector) when stdin isn't valid JSON or the verdict",
|
|
77216
77455
|
"doesn't decode against the pending question ids."
|
|
77217
77456
|
]
|
|
77457
|
+
},
|
|
77458
|
+
{
|
|
77459
|
+
token: "judge run",
|
|
77460
|
+
kind: "judgeRun",
|
|
77461
|
+
arity: "none",
|
|
77462
|
+
details: [
|
|
77463
|
+
"Answer a judgment: read the `gtd judge --json` document off",
|
|
77464
|
+
"stdin, write a verdict [{ id, answer, p }] on stdout — what",
|
|
77465
|
+
"`gtd judge answer` decodes. --provider fixed answers from",
|
|
77466
|
+
"--answers <path> or GTD_JUDGE_ANSWERS; questions the file",
|
|
77467
|
+
"does not cover are left out. Needs no repository. Exits 1",
|
|
77468
|
+
"on an unreadable or malformed answers file, with nothing",
|
|
77469
|
+
"on stdout"
|
|
77470
|
+
]
|
|
77218
77471
|
}
|
|
77219
77472
|
];
|
|
77220
77473
|
const commandByToken = (token) => COMMAND_ROWS.find((r) => r.token === token);
|
|
@@ -77399,14 +77652,15 @@ const parseArgv = (argv) => {
|
|
|
77399
77652
|
const row = first === void 0 ? void 0 : commandByToken(first);
|
|
77400
77653
|
const judgeAnswer = row?.kind === "judge" && positionals[1] === "answer";
|
|
77401
77654
|
const selectsEntry = entryPresent && first === void 0;
|
|
77402
|
-
const
|
|
77655
|
+
const judgeRun = row?.kind === "judge" && positionals[1] === "run";
|
|
77656
|
+
const kind = selectsEntry ? "entry" : judgeAnswer ? "judgeAnswer" : judgeRun ? "judgeRun" : row?.kind;
|
|
77403
77657
|
if (row === void 0 && !selectsEntry) {
|
|
77404
77658
|
const violation = scopeViolation(void 0, present);
|
|
77405
77659
|
if (violation !== void 0) return usagePlan(violation, jsonSeen);
|
|
77406
77660
|
if (first === void 0) return usagePlan("gtd: missing command — gtd decides and prints, a driver executes; run `gtd install`, or copy one from https://github.com/pmelab/gtd/blob/main/docs/driver.md's \"A complete minimal driver\" section and run that, or see usage above (`gtd --help`)", jsonSeen, renderHelp());
|
|
77407
77661
|
return usagePlan(`unknown command '${first}'`, jsonSeen);
|
|
77408
77662
|
}
|
|
77409
|
-
const restPositionals = first === void 0 ? positionals : positionals.slice(judgeAnswer ? 2 : 1);
|
|
77663
|
+
const restPositionals = first === void 0 ? positionals : positionals.slice(judgeAnswer || judgeRun ? 2 : 1);
|
|
77410
77664
|
if (kind === "entry" && first === void 0) {
|
|
77411
77665
|
if (restPositionals.length > 0) return usagePlan(`gtd: too many arguments — expected none, got: ${restPositionals.join(", ")}`, jsonSeen);
|
|
77412
77666
|
} else {
|
|
@@ -77473,6 +77727,20 @@ const parseArgv = (argv) => {
|
|
|
77473
77727
|
json,
|
|
77474
77728
|
verbose
|
|
77475
77729
|
};
|
|
77730
|
+
if (kind === "judgeRun") {
|
|
77731
|
+
if (bag["--provider"] === void 0) return usagePlan("gtd judge run: --provider <fixed|jev> is required", jsonSeen);
|
|
77732
|
+
if (bag["--provider"] === "jev" && bag["--answers"] !== void 0) return usagePlan("gtd judge run: --answers is only valid with --provider fixed", jsonSeen);
|
|
77733
|
+
return {
|
|
77734
|
+
kind: "command",
|
|
77735
|
+
command: {
|
|
77736
|
+
kind: "judgeRun",
|
|
77737
|
+
provider: bag["--provider"],
|
|
77738
|
+
...bag["--answers"] !== void 0 ? { answers: bag["--answers"] } : {}
|
|
77739
|
+
},
|
|
77740
|
+
json,
|
|
77741
|
+
verbose
|
|
77742
|
+
};
|
|
77743
|
+
}
|
|
77476
77744
|
if (kind === "uncheck") return {
|
|
77477
77745
|
kind: "command",
|
|
77478
77746
|
command: {
|