diff --git a/.opencode/node_modules/effect/dist/internal/schema/schema.js b/.opencode/node_modules/effect/dist/internal/schema/schema.js
index 86481f8005b800574e360a5574cd0343966d2795..d8634e2d3a8b495df04c4770ee387726b1eca526 100644
--- a/.opencode/node_modules/effect/dist/internal/schema/schema.js
+++ b/.opencode/node_modules/effect/dist/internal/schema/schema.js
@@ -1,8 +1,8 @@
import * as Effect from "../../Effect.js";
import { flow } from "../../Function.js";
import * as Pipeable from "../../Pipeable.js";
-import * as AST from "../../SchemaAST.js";
-import * as Parser from "../../SchemaParser.js";
+import * as SchemaAST from "../../SchemaAST.js";
+import * as SchemaParser from "../../SchemaParser.js";
/** @internal */
export const TypeId = "~effect/Schema/Schema";
const SchemaProto = {
@@ -11,13 +11,13 @@ const SchemaProto = {
return Pipeable.pipeArguments(this, arguments);
},
annotate(annotations) {
- return this.rebuild(AST.annotate(this.ast, annotations));
+ return this.rebuild(SchemaAST.annotate(this.ast, annotations));
},
annotateKey(annotations) {
- return this.rebuild(AST.annotateKey(this.ast, annotations));
+ return this.rebuild(SchemaAST.annotateKey(this.ast, annotations));
},
check(...checks) {
- return this.rebuild(AST.appendChecks(this.ast, checks));
+ return this.rebuild(SchemaAST.appendChecks(this.ast, checks));
}
};
/** @internal */
@@ -28,9 +28,9 @@ export function make(ast, options) {
}
self.ast = ast;
self.rebuild = ast => make(ast, options);
- self.makeEffect = flow(Parser.makeEffect(self), Effect.mapErrorEager(issue => new SchemaError(issue)));
- self.make = Parser.makeUnsafe(self);
- self.makeOption = Parser.makeOption(self);
+ self.makeEffect = flow(SchemaParser.makeEffect(self), Effect.mapErrorEager(issue => new SchemaError(issue)));
+ self.make = SchemaParser.make(self);
+ self.makeOption = SchemaParser.makeOption(self);
return self;
}
/** @internal */
@@ -69,12 +69,12 @@ export function makeReorder(getPriority) {
// Create a map of original indices for O(1) lookup
const indexMap = new Map();
for (let i = 0; i < types.length; i++) {
- indexMap.set(AST.toEncoded(types[i]), i);
+ indexMap.set(SchemaAST.toEncoded(types[i]), i);
}
// Create a sorted copy of the types array
const sortedTypes = [...types].sort((a, b) => {
- a = AST.toEncoded(a);
- b = AST.toEncoded(b);
+ a = SchemaAST.toEncoded(a);
+ b = SchemaAST.toEncoded(b);
const pa = getPriority(a);
const pb = getPriority(b);
if (pa !== pb) return pa - pb;
diff --git a/.opencode/node_modules/effect/dist/internal/schema/schema.js.map b/.opencode/node_modules/effect/dist/internal/schema/schema.js.map
index e2554bbf518cff1f213f6febf519485048577ed3..f2ab2d6e8d68cc1a10c18c2f97ac7ec5bb2926be 100644
--- a/.opencode/node_modules/effect/dist/internal/schema/schema.js.map
+++ b/.opencode/node_modules/effect/dist/internal/schema/schema.js.map
@@ -1 +1 @@
-{"version":3,"file":"schema.js","names":["Effect","flow","Pipeable","AST","Parser","TypeId","SchemaProto","pipe","pipeArguments","arguments","annotate","annotations","rebuild","ast","annotateKey","check","checks","appendChecks","make","options","self","Object","create","assign","makeEffect","mapErrorEager","issue","SchemaError","makeUnsafe","makeOption","SchemaErrorTypeId","_tag","name","constructor","message","toString","jsonReorder","makeReorder","getJsonPriority","getPriority","types","indexMap","Map","i","length","set","toEncoded","sortedTypes","sort","a","b","pa","pb","get","orderChanged","some","index"],"sources":["../../../src/internal/schema/schema.ts"],"sourcesContent":[null],"mappings":"AAAA,OAAO,KAAKA,MAAM,MAAM,iBAAiB;AACzC,SAASC,IAAI,QAAQ,mBAAmB;AACxC,OAAO,KAAKC,QAAQ,MAAM,mBAAmB;AAE7C,OAAO,KAAKC,GAAG,MAAM,oBAAoB;AAEzC,OAAO,KAAKC,MAAM,MAAM,uBAAuB;AAE/C;AACA,OAAO,MAAMC,MAAM,GAAG,uBAAuB;AAE7C,MAAMC,WAAW,GAAG;EAClB,CAACD,MAAM,GAAGA,MAAM;EAChBE,IAAIA,CAAA;IACF,OAAOL,QAAQ,CAACM,aAAa,CAAC,IAAI,EAAEC,SAAS,CAAC;EAChD,CAAC;EACDC,QAAQA,CAAmBC,WAA2C;IACpE,OAAO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Y,GAAG,CAACJ,CAAC,CAAE,GAAGR,QAAQ,CAACY,GAAG,CAACH,CAAC,CAAE;IAC5C,CAAC,CAAC;IAEF;IACA,MAAMI,YAAY,GAAGP,WAAW,CAACQ,IAAI,CAAC,CAAC1C,GAAG,EAAE2C,KAAK,KAAK3C,GAAG,KAAK2B,KAAK,CAACgB,KAAK,CAAC,CAAC;IAE3E,IAAI,CAACF,YAAY,EAAE,OAAOd,KAAK;IAC/B,OAAOO,WAAW;EACpB,CAAC;AACH","ignoreList":[]}
\ No newline at end of file
+{"version":3,"file":"schema.js","names":["Effect","flow","Pipeable","SchemaAST","SchemaParser","TypeId","SchemaProto","pipe","pipeArguments","arguments","annotate","annotations","rebuild","ast","annotateKey","check","checks","appendChecks","make","options","self","Object","create","assign","makeEffect","mapErrorEager","issue","SchemaError","makeOption","SchemaErrorTypeId","_tag","name","constructor","message","toString","jsonReorder","makeReorder","getJsonPriority","getPriority","types","indexMap","Map","i","length","set","toEncoded","sortedTypes","sort","a","b","pa","pb","get","orderChanged","some","index"],"sources":["../../../src/internal/schema/schema.ts"],"sourcesContent":[null],"mappings":"AAAA,OAAO,KAAKA,MAAM,MAAM,iBAAiB;AACzC,SAASC,IAAI,QAAQ,mBAAmB;AACxC,OAAO,KAAKC,QAAQ,MAAM,mBAAmB;AAE7C,OAAO,KAAKC,SAAS,MAAM,oBAAoB;AAE/C,OAAO,KAAKC,YAAY,MAAM,uBAAuB;AAErD;AACA,OAAO,MAAMC,MAAM,GAAG,uBAAuB;AAE7C,MAAMC,WAAW,GAAG;EAClB,CAACD,MAAM,GAAGA,MAAM;EAChBE,IAAIA,CAAA;IACF,OAAOL,QAAQ,CAACM,aAAa,CAAC,IAAI,EAAEC,SAAS,CAAC;EAChD,CAAC;EACDC,QAAQA,CAAmBC,WAA2C;IACpE,OAAO,IAAI,CAACC,OAAO,CAACT,SAAS,CAACO,QAAQ,CAAC,IAAI,CAACG,GAAG,EAAEF,WAAW,CAAC,CAAC;EAChE,CAAC;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MI,YAAY,GAAGP,WAAW,CAACQ,IAAI,CAAC,CAACzC,GAAG,EAAE0C,KAAK,KAAK1C,GAAG,KAAK0B,KAAK,CAACgB,KAAK,CAAC,CAAC;IAE3E,IAAI,CAACF,YAAY,EAAE,OAAOd,KAAK;IAC/B,OAAOO,WAAW;EACpB,CAAC;AACH","ignoreList":[]}
\ No newline at end of file
diff --git a/.opencode/node_modules/effect/dist/testing/FastCheck.d.ts b/.opencode/node_modules/effect/dist/testing/FastCheck.d.ts
index f7fc4c9deb021c93a7028c09d390da542a93fc56..5598097a6e1845804eb13035874c0a52e30e9f8d 100644
--- a/.opencode/node_modules/effect/dist/testing/FastCheck.d.ts
+++ b/.opencode/node_modules/effect/dist/testing/FastCheck.d.ts
@@ -1,11 +1,10 @@
/**
- * This module provides a re-export of the fast-check library for property-based testing.
- * Fast-check is a property-based testing framework that generates random test cases
- * to validate that properties hold true for a wide range of inputs.
+ * Re-exports `fast-check` for property-based testing.
*
- * Property-based testing is a testing methodology where you specify properties that
- * should hold true for your functions, and the framework generates many random test
- * cases to try to find counterexamples.
+ * Property-based tests describe a rule that should hold for many inputs, and
+ * `fast-check` generates random examples to look for counterexamples. This
+ * module exposes the library from `effect/testing` so tests can use it alongside
+ * the other Effect testing helpers.
*
* @since 3.10.0
*/
@@ -18,9 +17,10 @@
* true for your functions, rather than writing specific test cases. The library
* then generates many random inputs to verify these properties.
*
- * @example
+ * **Example** (Checking an array reversal property)
+ *
* ```ts
- * import * as FastCheck from "effect/testing/FastCheck"
+ * import { FastCheck } from "effect/testing"
*
* // Property: reverse of reverse should equal original
* const reverseProp = FastCheck.property(
@@ -36,9 +36,10 @@
* FastCheck.assert(reverseProp)
* ```
*
- * @example
+ * **Example** (Checking string concatenation properties)
+ *
* ```ts
- * import * as FastCheck from "effect/testing/FastCheck"
+ * import { FastCheck } from "effect/testing"
*
* // Test string concatenation properties
* const concatProp = FastCheck.property(
@@ -55,9 +56,10 @@
* FastCheck.assert(concatProp)
* ```
*
- * @example
+ * **Example** (Generating record data for properties)
+ *
* ```ts
- * import * as FastCheck from "effect/testing/FastCheck"
+ * import { FastCheck } from "effect/testing"
*
* // Generate random data for testing
* const personArbitrary = FastCheck.record({
diff --git a/.opencode/node_modules/effect/dist/testing/FastCheck.d.ts.map b/.opencode/node_modules/effect/dist/testing/FastCheck.d.ts.map
index 529453509b4956c8fd1b45d96c600d7dcc8a34cc..2468b3dee861f2296ee8d1982eb249c2f7e40307 100644
--- a/.opencode/node_modules/effect/dist/testing/FastCheck.d.ts.map
+++ b/.opencode/node_modules/effect/dist/testing/FastCheck.d.ts.map
@@ -1 +1 @@
-{"version":3,"file":"FastCheck.d.ts","sourceRoot":"","sources":["../../src/testing/FastCheck.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyEG;AACH,cAAc,YAAY,CAAA"}
\ No newline at end of file
+{"version":3,"file":"FastCheck.d.ts","sourceRoot":"","sources":["../../src/testing/FastCheck.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4EG;AACH,cAAc,YAAY,CAAA"}
\ No newline at end of file
diff --git a/.opencode/node_modules/effect/dist/testing/FastCheck.js b/.opencode/node_modules/effect/dist/testing/FastCheck.js
index 51d9655deefec81b7d9076b03cf84463dccac737..e48cef5082d0a897978330af44d24c788382f70b 100644
--- a/.opencode/node_modules/effect/dist/testing/FastCheck.js
+++ b/.opencode/node_modules/effect/dist/testing/FastCheck.js
@@ -1,11 +1,10 @@
/**
- * This module provides a re-export of the fast-check library for property-based testing.
- * Fast-check is a property-based testing framework that generates random test cases
- * to validate that properties hold true for a wide range of inputs.
+ * Re-exports `fast-check` for property-based testing.
*
- * Property-based testing is a testing methodology where you specify properties that
- * should hold true for your functions, and the framework generates many random test
- * cases to try to find counterexamples.
+ * Property-based tests describe a rule that should hold for many inputs, and
+ * `fast-check` generates random examples to look for counterexamples. This
+ * module exposes the library from `effect/testing` so tests can use it alongside
+ * the other Effect testing helpers.
*
* @since 3.10.0
*/
@@ -18,9 +17,10 @@
* true for your functions, rather than writing specific test cases. The library
* then generates many random inputs to verify these properties.
*
- * @example
+ * **Example** (Checking an array reversal property)
+ *
* ```ts
- * import * as FastCheck from "effect/testing/FastCheck"
+ * import { FastCheck } from "effect/testing"
*
* // Property: reverse of reverse should equal original
* const reverseProp = FastCheck.property(
@@ -36,9 +36,10 @@
* FastCheck.assert(reverseProp)
* ```
*
- * @example
+ * **Example** (Checking string concatenation properties)
+ *
* ```ts
- * import * as FastCheck from "effect/testing/FastCheck"
+ * import { FastCheck } from "effect/testing"
*
* // Test string concatenation properties
* const concatProp = FastCheck.property(
@@ -55,9 +56,10 @@
* FastCheck.assert(concatProp)
* ```
*
- * @example
+ * **Example** (Generating record data for properties)
+ *
* ```ts
- * import * as FastCheck from "effect/testing/FastCheck"
+ * import { FastCheck } from "effect/testing"
*
* // Generate random data for testing
* const personArbitrary = FastCheck.record({
diff --git a/.opencode/node_modules/effect/dist/testing/FastCheck.js.map b/.opencode/node_modules/effect/dist/testing/FastCheck.js.map
index 3d1c72092db75c783fec565539343513f24ac07a..456da89de2272afc684321b007d03984ff7b7ae9 100644
--- a/.opencode/node_modules/effect/dist/testing/FastCheck.js.map
+++ b/.opencode/node_modules/effect/dist/testing/FastCheck.js.map
@@ -1 +1 @@
-{"version":3,"file":"FastCheck.js","names":[],"sources":["../../src/testing/FastCheck.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;AAYA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0EA,cAAc,YAAY","ignoreList":[]}
\ No newline at end of file
+{"version":3,"file":"FastCheck.js","names":[],"sources":["../../src/testing/FastCheck.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;AAWA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6EA,cAAc,YAAY","ignoreList":[]}
\ No newline at end of file
diff --git a/.opencode/node_modules/effect/dist/testing/TestClock.d.ts b/.opencode/node_modules/effect/dist/testing/TestClock.d.ts
index a767cf1a8ee1b8f2b629927bc63647c944a4b350..8abcda6fc853570e7b73d0593c22c68484f43556 100644
--- a/.opencode/node_modules/effect/dist/testing/TestClock.d.ts
+++ b/.opencode/node_modules/effect/dist/testing/TestClock.d.ts
@@ -4,16 +4,26 @@ import * as Effect from "../Effect.ts";
import * as Latch from "../Latch.ts";
import * as Layer from "../Layer.ts";
/**
- * A `TestClock` simplifies deterministically and efficiently testing effects
- * which involve the passage of time.
+ * A `TestClock` simplifies deterministic and efficient testing of effects that
+ * involve the passage of time.
+ *
+ * **Details**
*
* Instead of waiting for actual time to pass, `sleep` and methods implemented
- * in terms of it schedule effects to take place at a given clock time. Users
- * can adjust the clock time using the `adjust` and `setTime` methods, and all
- * effects scheduled to take place on or before that time will automatically be
- * run in order.
+ * in terms of it schedule effects to take place at a given clock time. Use
+ * `adjust` and `setTime` to move clock time, and all effects scheduled to take
+ * place on or before that time will automatically run in order.
+ *
+ * **Gotchas**
+ *
+ * Calls to `sleep` and methods derived from it will semantically block until
+ * the time is set to on or after the time they are scheduled to run. Fork the
+ * effect being tested, then adjust the clock time, and finally verify that the
+ * expected effects have been performed.
+ *
+ * **Example** (Testing timeouts deterministically)
*
- * For example, here is how we can test `Effect.timeout` using `TestClock`:
+ * Tests `Effect.timeout` using `TestClock`.
*
* ```ts
* import { Effect, Fiber, Option, pipe } from "effect"
@@ -32,15 +42,8 @@ import * as Layer from "../Layer.ts";
* })
* ```
*
- * Note how we forked the fiber that `sleep` was invoked on. Calls to `sleep`
- * and methods derived from it will semantically block until the time is set to
- * on or after the time they are scheduled to run. If we didn't fork the fiber
- * on which we called sleep we would never get to set the time on the line
- * below. Thus, a useful pattern when using `TestClock` is to fork the effect
- * being tested, then adjust the clock time, and finally verify that the
- * expected effects have been performed.
+ * **Example** (Advancing time deterministically)
*
- * @example
* ```ts
* import { Effect } from "effect"
* import { TestClock } from "effect/testing"
@@ -62,8 +65,8 @@ import * as Layer from "../Layer.ts";
* })
* ```
*
- * @since 2.0.0
* @category models
+ * @since 2.0.0
*/
export interface TestClock extends Clock.Clock {
/**
@@ -84,7 +87,10 @@ export interface TestClock extends Clock.Clock {
withLive(effect: Effect.Effect): Effect.Effect;
}
/**
- * @example
+ * Namespace containing `TestClock` configuration and state types.
+ *
+ * **Example** (Configuring a test clock)
+ *
* ```ts
* import { Effect } from "effect"
* import { TestClock } from "effect/testing"
@@ -101,12 +107,16 @@ export interface TestClock extends Clock.Clock {
* })
* ```
*
- * @since 4.0.0
- * @category models
+ * @since 2.0.0
*/
export declare namespace TestClock {
/**
- * @example
+ * Options used when constructing a `TestClock`. `warningDelay` controls how
+ * long the live clock waits before logging a warning when a test uses time
+ * without advancing the test clock.
+ *
+ * **Example** (Configuring the warning delay)
+ *
* ```ts
* import { Effect } from "effect"
* import { TestClock } from "effect/testing"
@@ -122,8 +132,8 @@ export declare namespace TestClock {
* })
* ```
*
+ * @category options
* @since 4.0.0
- * @category models
*/
interface Options {
/**
@@ -133,24 +143,12 @@ export declare namespace TestClock {
readonly warningDelay?: Duration.Input;
}
/**
- * @example
- * ```ts
- * import { Effect } from "effect"
- * import { TestClock } from "effect/testing"
+ * Represents the state tracked by a `TestClock`, including the current
+ * millisecond timestamp and the sleeps scheduled to resume when the clock
+ * reaches their target time.
*
- * const program = Effect.gen(function*() {
- * const testClock = yield* TestClock.make()
- *
- * // The state represents the current timestamp and scheduled sleeps
- * const timestamp = testClock.currentTimeMillisUnsafe()
- * console.log(timestamp) // Current test time
- *
- * // Internal state structure: { timestamp: number, sleeps: Array<[number, Latch.Latch]> }
- * })
- * ```
- *
- * @since 4.0.0
* @category models
+ * @since 4.0.0
*/
interface State {
readonly timestamp: number;
@@ -160,7 +158,8 @@ export declare namespace TestClock {
/**
* Creates a `TestClock` with optional configuration.
*
- * @example
+ * **Example** (Creating a test clock)
+ *
* ```ts
* import { Effect } from "effect"
* import { TestClock } from "effect/testing"
@@ -181,23 +180,24 @@ export declare namespace TestClock {
* })
* ```
*
- * @since 4.0.0
* @category constructors
+ * @since 4.0.0
*/
export declare const make: (options?: TestClock.Options | undefined) => Effect.Effect<{
currentTimeMillisUnsafe: () => number;
currentTimeNanosUnsafe: () => bigint;
currentTimeMillis: Effect.Effect;
currentTimeNanos: Effect.Effect;
- adjust: (duration: Duration.Input) => Effect.Effect;
- setTime: (timestamp: number) => Effect.Effect;
+ adjust: (duration: Duration.Input) => Effect.Effect;
+ setTime: (timestamp: number) => Effect.Effect;
sleep: (duration: Duration.Duration) => Effect.Effect;
withLive: (effect: Effect.Effect) => Effect.Effect>;
}, never, import("../Scope.ts").Scope>;
/**
* Creates a `Layer` which constructs a `TestClock`.
*
- * @example
+ * **Example** (Providing a test clock layer)
+ *
* ```ts
* import { Effect } from "effect"
* import { TestClock } from "effect/testing"
@@ -216,15 +216,16 @@ export declare const make: (options?: TestClock.Options | undefined) => Effect.E
* }).pipe(Effect.provide(testClockLayer))
* ```
*
- * @since 4.0.0
* @category layers
+ * @since 4.0.0
*/
export declare const layer: (options?: TestClock.Options) => Layer.Layer;
/**
* Retrieves the `TestClock` service for this test and uses it to run the
* specified workflow.
*
- * @example
+ * **Example** (Accessing the test clock)
+ *
* ```ts
* import { Effect } from "effect"
* import { TestClock } from "effect/testing"
@@ -242,8 +243,8 @@ export declare const layer: (options?: TestClock.Options) => Layer.Layer(f: (testClock: TestClock) => Effect.Effect) => Effect.Effect;
/**
@@ -251,7 +252,8 @@ export declare const testClockWith: (f: (testClock: TestClock) => Effec
* by the specified duration, running any actions scheduled for on or before
* the new time in order.
*
- * @example
+ * **Example** (Advancing the test clock)
+ *
* ```ts
* import { Effect } from "effect"
* import { TestClock } from "effect/testing"
@@ -273,15 +275,16 @@ export declare const testClockWith: (f: (testClock: TestClock) => Effec
* })
* ```
*
+ * @category testing
* @since 2.0.0
- * @category utils
*/
export declare const adjust: (duration: Duration.Input) => Effect.Effect;
/**
* Sets the current clock time to the specified `timestamp`. Any effects that
* were scheduled to occur on or before the new time will be run in order.
*
- * @example
+ * **Example** (Setting the test clock time)
+ *
* ```ts
* import { Duration, Effect } from "effect"
* import { TestClock } from "effect/testing"
@@ -304,15 +307,16 @@ export declare const adjust: (duration: Duration.Input) => Effect.Effect;
* })
* ```
*
+ * @category testing
* @since 2.0.0
- * @category utils
*/
export declare const setTime: (timestamp: number) => Effect.Effect;
/**
* Executes the specified effect with the live `Clock` instead of the
* `TestClock`.
*
- * @example
+ * **Example** (Running with the live clock)
+ *
* ```ts
* import { Clock, Effect } from "effect"
* import { TestClock } from "effect/testing"
@@ -335,8 +339,8 @@ export declare const setTime: (timestamp: number) => Effect.Effect;
* })
* ```
*
- * @since 2.0.0
- * @category utils
+ * @category testing
+ * @since 4.0.0
*/
export declare const withLive: (effect: Effect.Effect) => Effect.Effect;
//# sourceMappingURL=TestClock.d.ts.map
\ No newline at end of file
diff --git a/.opencode/node_modules/effect/dist/testing/TestClock.d.ts.map b/.opencode/node_modules/effect/dist/testing/TestClock.d.ts.map
index 3743ca2b83526fc0f9e8f49ac1209644ee3ed8dc..01b0ba5027ee968b0b8b2063238faed23f1584ae 100644
--- a/.opencode/node_modules/effect/dist/testing/TestClock.d.ts.map
+++ b/.opencode/node_modules/effect/dist/testing/TestClock.d.ts.map
@@ -1 +1 @@
-{"version":3,"file":"TestClock.d.ts","sourceRoot":"","sources":["../../src/testing/TestClock.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,aAAa,CAAA;AAEpC,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAA;AAC1C,OAAO,KAAK,MAAM,MA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/TestClock.js
index e537fb940284a7abcb39efba98aa11222240f17a..5353b242589645ee05f3029df210c6a1bf3eade0 100644
--- a/.opencode/node_modules/effect/dist/testing/TestClock.js
+++ b/.opencode/node_modules/effect/dist/testing/TestClock.js
@@ -1,4 +1,13 @@
/**
+ * Controllable `Clock` service for tests.
+ *
+ * Instead of waiting for real time to pass, effects that use `Effect.sleep`,
+ * timeouts, schedules, retries, and other time-based operators can be driven by
+ * advancing the test clock. This makes time-based tests deterministic and fast.
+ * The module also includes helpers for moving test time, temporarily using the
+ * live clock, and warning when a test appears to be waiting on time without
+ * advancing it.
+ *
* @since 2.0.0
*/
import * as Arr from "../Array.js";
@@ -27,7 +36,8 @@ const SleepOrder = /*#__PURE__*/Order.flip(/*#__PURE__*/Order.Struct({
/**
* Creates a `TestClock` with optional configuration.
*
- * @example
+ * **Example** (Creating a test clock)
+ *
* ```ts
* import { Effect } from "effect"
* import { TestClock } from "effect/testing"
@@ -48,8 +58,8 @@ const SleepOrder = /*#__PURE__*/Order.flip(/*#__PURE__*/Order.Struct({
* })
* ```
*
- * @since 4.0.0
* @category constructors
+ * @since 4.0.0
*/
export const make = /*#__PURE__*/Effect.fnUntraced(function* (options) {
const config = Object.assign({}, defaultOptions, options);
@@ -120,7 +130,7 @@ export const make = /*#__PURE__*/Effect.fnUntraced(function* (options) {
});
const runSemaphore = yield* Semaphore.make(1);
const run = Effect.fnUntraced(function* (step) {
- yield* Fiber.await(yield* Effect.forkScoped(Effect.yieldNow));
+ yield* Fiber.await(yield* Effect.forkChild(Effect.yieldNow));
const endTimestamp = step(currentTimestamp);
while (Arr.isArrayNonEmpty(sleeps)) {
if (Arr.lastNonEmpty(sleeps).timestamp > endTimestamp) break;
@@ -153,7 +163,8 @@ export const make = /*#__PURE__*/Effect.fnUntraced(function* (options) {
/**
* Creates a `Layer` which constructs a `TestClock`.
*
- * @example
+ * **Example** (Providing a test clock layer)
+ *
* ```ts
* import { Effect } from "effect"
* import { TestClock } from "effect/testing"
@@ -172,15 +183,16 @@ export const make = /*#__PURE__*/Effect.fnUntraced(function* (options) {
* }).pipe(Effect.provide(testClockLayer))
* ```
*
- * @since 4.0.0
* @category layers
+ * @since 4.0.0
*/
export const layer = /*#__PURE__*/flow(make, /*#__PURE__*/Layer.effect(Clock.Clock));
/**
* Retrieves the `TestClock` service for this test and uses it to run the
* specified workflow.
*
- * @example
+ * **Example** (Accessing the test clock)
+ *
* ```ts
* import { Effect } from "effect"
* import { TestClock } from "effect/testing"
@@ -198,8 +210,8 @@ export const layer = /*#__PURE__*/flow(make, /*#__PURE__*/Layer.effect(Clock.Clo
* })
* ```
*
+ * @category testing
* @since 2.0.0
- * @category utils
*/
export const testClockWith = f => Effect.withFiber(fiber => f(fiber.getRef(Clock.Clock)));
/**
@@ -207,7 +219,8 @@ export const testClockWith = f => Effect.withFiber(fiber => f(fiber.getRef(Clock
* by the specified duration, running any actions scheduled for on or before
* the new time in order.
*
- * @example
+ * **Example** (Advancing the test clock)
+ *
* ```ts
* import { Effect } from "effect"
* import { TestClock } from "effect/testing"
@@ -229,15 +242,16 @@ export const testClockWith = f => Effect.withFiber(fiber => f(fiber.getRef(Clock
* })
* ```
*
+ * @category testing
* @since 2.0.0
- * @category utils
*/
export const adjust = duration => testClockWith(testClock => testClock.adjust(duration));
/**
* Sets the current clock time to the specified `timestamp`. Any effects that
* were scheduled to occur on or before the new time will be run in order.
*
- * @example
+ * **Example** (Setting the test clock time)
+ *
* ```ts
* import { Duration, Effect } from "effect"
* import { TestClock } from "effect/testing"
@@ -260,15 +274,16 @@ export const adjust = duration => testClockWith(testClock => testClock.adjust(du
* })
* ```
*
+ * @category testing
* @since 2.0.0
- * @category utils
*/
export const setTime = timestamp => testClockWith(testClock => testClock.setTime(timestamp));
/**
* Executes the specified effect with the live `Clock` instead of the
* `TestClock`.
*
- * @example
+ * **Example** (Running with the live clock)
+ *
* ```ts
* import { Clock, Effect } from "effect"
* import { TestClock } from "effect/testing"
@@ -291,8 +306,8 @@ export const setTime = timestamp => testClockWith(testClock => testClock.setTime
* })
* ```
*
- * @since 2.0.0
- * @category utils
+ * @category testing
+ * @since 4.0.0
*/
export const withLive = effect => testClockWith(testClock => testClock.withLive(effect));
const WarningState = /*#__PURE__*/Data.taggedEnum();
diff --git a/.opencode/node_modules/effect/dist/testing/TestClock.js.map b/.opencode/node_modules/effect/dist/testing/TestClock.js.map
index 13781f048f0200764cc89aacd6f538a2f7a37cc4..1df56dd17abf1c5944499801ae3d7cc03d5597d8 100644
--- a/.opencode/node_modules/effect/dist/testing/TestClock.js.map
+++ b/.opencode/node_modules/effect/dist/testing/TestClock.js.map
@@ -1 +1 @@
-{"version":3,"file":"TestClock.js","names":["Arr","Clock","Data","Duration","Effect","Fiber","flow","Latch","Layer","Order","Semaphore","warningMessage","defaultOptions","warningDelay","SleepOrder","flip","Struct","timestamp","Number","sequence","make","fnUntraced","options","config","Object","assign","sleeps","liveClock","clockWith","succeed","warningSemaphore","currentTimestamp","Date","getTime","warningState","WarningState","Start","currentTimeMillisUnsafe","currentTimeNanosUnsafe","BigInt","Math","floor","currentTimeMillis","sync","currentTimeNanos","withLive","effect","provideService","warningStart","withPermits","suspend","_tag","logWarning","pipe","delay","forkChild","interruptible","flatMap","fiber","Pending","void","warningDone","interrupt","andThen","Done","sleep","duration","millis","toMillis","end","latch","makeUnsafe","push","sort","await","runSemaphore","run","step","forkScoped","yieldNow","endTimestamp","isArrayNonEmpty","lastNonEmpty","entry","pop","openUnsafe","adjust","fromInputUnsafe","setTime","addFinalizer","layer","testClockWith","f","withFiber","getRef","testClock","taggedEnum"],"sources":["../../src/testing/TestClock.ts"],"sourcesContent":[null],"mappings":"AAAA;;;AAGA,OAAO,KAAKA,GAAG,MAAM,aAAa;AAClC,OAAO,KAAKC,KAAK,MAAM,aAAa;AACpC,OAAO,KAAKC,IAAI,MAAM,YAAY;AAClC,OAAO,KAAKC,QAAQ,MAAM,gBAAgB;AAC1C,OAAO,KAAKC,MAAM,MAAM,cAAc;AACtC,OAAO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;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,OAAO,MAAMqF,MAAM,GAAIpB,QAAwB,IAC7CyB,aAAa,CAAEI,SAAS,IAAKA,SAAS,CAACT,MAAM,CAACpB,QAAQ,CAAC,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,OAAO,MAAMsB,OAAO,GAAIvE,SAAiB,IACvC0E,aAAa,CAAEI,SAAS,IAAKA,SAAS,CAACP,OAAO,CAACvE,SAAS,CAAC,CAAC;AAE5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,OAAO,MAAM4B,QAAQ,GAAaC,MAA8B,IAC9D6C,aAAa,CAAEI,SAAS,IAAKA,SAAS,CAAClD,QAAQ,CAACC,MAAM,CAAC,CAAC;AAiC1D,MAAMX,YAAY,gBAAGjC,IAAI,CAAC8F,UAAU,EAAgB","ignoreList":[]}
\ No newline at end of file
+{"version":3,"file":"TestClock.js","names":["Arr","Clock","Data","Duration","Effect","Fiber","flow","Latch","Layer","Order","Semaphore","warningMessage","defaultOptions","warningDelay","SleepOrder","flip","Struct","timestamp","Number","sequence","make","fnUntraced","options","config","Object","assign","sleeps","liveClock","clockWith","succeed","warningSemaphore","currentTimestamp","Date","getTime","warningState","WarningState","Start","currentTimeMillisUnsafe","currentTimeNanosUnsafe","BigInt","Math","floor","currentTimeMillis","sync","currentTimeNanos","withLive","effect","provideService","warningStart","withPermits","suspend","_tag","logWarning","pipe","delay","forkChild","interruptible","flatMap","fiber","Pending","void","warningDone","interrupt","andThen","Done","sleep","duration","millis","toMillis","end","latch","makeUnsafe","push","sort","await","runSemaphore","run","step","yieldNow","endTimestamp","isArrayNonEmpty","lastNonEmpty","entry","pop","openUnsafe","adjust","fromInputUnsafe","setTime","addFinalizer","layer","testClockWith","f","withFiber","getRef","testClock","taggedEnum"],"sources":["../../src/testing/TestClock.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;AAYA,OAAO,KAAKA,GAAG,MAA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OAAO,MAAMyF,aAAa,GACxBC,CAAmD,IACxBvF,MAAM,CAACwF,SAAS,CAAElC,KAAK,IAAKiC,CAAC,CAACjC,KAAK,CAACmC,MAAM,CAAC5F,KAAK,CAACA,KAAK,CAAc,CAAC,CAAC;AAEnG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,OAAO,MAAMoF,MAAM,GAAInB,QAAwB,IAC7CwB,aAAa,CAAEI,SAAS,IAAKA,SAAS,CAACT,MAAM,CAACnB,QAAQ,CAAC,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,OAAO,MAAMqB,OAAO,GAAItE,SAAiB,IACvCyE,aAAa,CAAEI,SAAS,IAAKA,SAAS,CAACP,OAAO,CAACtE,SAAS,CAAC,CAAC;AAE5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,OAAO,MAAM4B,QAAQ,GAAaC,MAA8B,IAC9D4C,aAAa,CAAEI,SAAS,IAAKA,SAAS,CAACjD,QAAQ,CAACC,MAAM,CAAC,CAAC;AAiC1D,MAAMX,YAAY,gBAAGjC,IAAI,CAAC6F,UAAU,EAAgB","ignoreList":[]}
\ No newline at end of file
diff --git a/.opencode/node_modules/effect/dist/testing/TestConsole.d.ts b/.opencode/node_modules/effect/dist/testing/TestConsole.d.ts
index 46899e63464ecb048107208f7593d0db6d5a646a..15afb3bbccafaa968827ab51468d07aad20ca94e 100644
--- a/.opencode/node_modules/effect/dist/testing/TestConsole.d.ts
+++ b/.opencode/node_modules/effect/dist/testing/TestConsole.d.ts
@@ -6,13 +6,21 @@ import * as Layer from "../Layer.ts";
* It captures all console output for testing purposes while maintaining full
* compatibility with the standard Console API.
*
+ * **When to use**
+ *
+ * Use to provide a console implementation that records calls for assertions in
+ * tests.
+ *
+ * **Details**
+ *
* This interface extends the standard Console interface and adds methods to
* retrieve logged messages for verification in tests.
*
- * @example
+ * **Example** (Capturing console output in tests)
+ *
* ```ts
* import { Console, Effect } from "effect"
- * import * as TestConsole from "effect/testing/TestConsole"
+ * import { TestConsole } from "effect/testing"
*
* const program = Effect.gen(function*() {
* yield* Console.log("Hello, World!")
@@ -26,18 +34,32 @@ import * as Layer from "../Layer.ts";
* }).pipe(Effect.provide(TestConsole.layer))
* ```
*
- * @since 4.0.0
+ * @see {@link layer} for providing `TestConsole` to an effect
+ * @see {@link logLines} for reading captured `Console.log` calls
+ * @see {@link errorLines} for reading captured `Console.error` calls
+ *
* @category models
+ * @since 4.0.0
*/
export interface TestConsole extends Console.Console {
/**
* Returns an array of all items that have been logged by the program using
* `Console.log` thus far.
+ *
+ * **When to use**
+ *
+ * Use to inspect captured `Console.log` calls through a `TestConsole`
+ * instance.
*/
readonly logLines: Effect.Effect>;
/**
* Returns an array of all items that have been logged by the program using
* `Console.error` thus far.
+ *
+ * **When to use**
+ *
+ * Use to inspect captured `Console.error` calls through a `TestConsole`
+ * instance.
*/
readonly errorLines: Effect.Effect>;
}
@@ -45,45 +67,60 @@ export interface TestConsole extends Console.Console {
* The `TestConsole` namespace provides types and utilities for working with
* test console implementations.
*
- * @example
- * ```ts
- * // The TestConsole namespace provides types for testing
- * // Use TestConsole.make to create a test console instance
- * // Use TestConsole.layer to provide the service in tests
- * ```
+ * **When to use**
+ *
+ * Use when referring to types nested under the `TestConsole` namespace.
*
* @since 4.0.0
- * @category models
*/
export declare namespace TestConsole {
/**
* Represents a console method name that can be invoked on the TestConsole.
* This type includes all methods available on the Console interface.
*
- * @example
+ * **When to use**
+ *
+ * Use to type the console method name recorded in a captured test console
+ * entry.
+ *
+ * **Example** (Typing captured console methods)
+ *
* ```ts
- * // Method represents console method names like:
- * // "log", "error", "warn", "debug", "info", etc.
- * // All methods from the Console interface are supported
+ * import type { TestConsole } from "effect/testing"
+ *
+ * const method: TestConsole.TestConsole.Method = "log"
+ *
+ * console.log(method) // "log"
* ```
*
- * @since 4.0.0
* @category models
+ * @since 4.0.0
*/
type Method = keyof Console.Console;
/**
* Represents a single console method invocation captured by the TestConsole.
* Each entry contains the method name and the parameters passed to it.
*
- * @example
+ * **When to use**
+ *
+ * Use to inspect or type one captured console invocation.
+ *
+ * **Example** (Typing captured console entries)
+ *
* ```ts
- * // Entry represents captured console calls with their method and parameters
- * // Each entry contains: { method: string, parameters: ReadonlyArray }
- * // Used internally by TestConsole to track all console operations
+ * import type { TestConsole } from "effect/testing"
+ *
+ * const entry: TestConsole.TestConsole.Entry = {
+ * method: "error",
+ * parameters: ["not found"]
+ * }
+ *
+ * console.log(entry.method) // "error"
+ * console.log(entry.parameters) // ["not found"]
* ```
*
- * @since 4.0.0
* @category models
+ * @since 4.0.0
*/
interface Entry {
readonly method: Method;
@@ -95,10 +132,15 @@ export declare namespace TestConsole {
* The returned TestConsole implements the Console interface and provides
* additional methods to retrieve logged messages.
*
- * @example
+ * **When to use**
+ *
+ * Use to construct a test console service value directly.
+ *
+ * **Example** (Creating a test console)
+ *
* ```ts
* import { Console, Effect } from "effect"
- * import * as TestConsole from "effect/testing/TestConsole"
+ * import { TestConsole } from "effect/testing"
*
* const program = Effect.gen(function*() {
* yield* Console.log("Debug message")
@@ -112,18 +154,25 @@ export declare namespace TestConsole {
* }).pipe(Effect.provide(TestConsole.layer))
* ```
*
- * @since 4.0.0
+ * @see {@link layer} for providing a `TestConsole` as a `Layer`
+ *
* @category constructors
+ * @since 4.0.0
*/
export declare const make: Effect.Effect;
/**
* Retrieves the `TestConsole` service for this test and uses it to run the
* specified workflow.
*
- * @example
+ * **When to use**
+ *
+ * Use to access the provided test console service inside an effect.
+ *
+ * **Example** (Accessing the test console service)
+ *
* ```ts
* import { Effect } from "effect"
- * import * as TestConsole from "effect/testing/TestConsole"
+ * import { TestConsole } from "effect/testing"
*
* const program = TestConsole.testConsoleWith((testConsole) =>
* Effect.gen(function*() {
@@ -139,8 +188,12 @@ export declare const make: Effect.Effect;
* ).pipe(Effect.provide(TestConsole.layer))
* ```
*
+ * @see {@link layer} for providing the test console service
+ * @see {@link logLines} for reading captured `Console.log` calls directly
+ * @see {@link errorLines} for reading captured `Console.error` calls directly
+ *
+ * @category testing
* @since 4.0.0
- * @category utils
*/
export declare const testConsoleWith: (f: (console: TestConsole) => Effect.Effect) => Effect.Effect;
/**
@@ -148,10 +201,15 @@ export declare const testConsoleWith: (f: (console: TestConsole) => Eff
* This layer can be used to provide a TestConsole implementation
* for testing purposes.
*
- * @example
+ * **When to use**
+ *
+ * Use to run an effect with console calls captured by `TestConsole`.
+ *
+ * **Example** (Providing a test console layer)
+ *
* ```ts
* import { Console, Effect } from "effect"
- * import * as TestConsole from "effect/testing/TestConsole"
+ * import { TestConsole } from "effect/testing"
*
* const program = Effect.gen(function*() {
* yield* Console.log("This will be captured")
@@ -165,18 +223,27 @@ export declare const testConsoleWith: (f: (console: TestConsole) => Eff
* }).pipe(Effect.provide(TestConsole.layer))
* ```
*
- * @since 4.0.0
+ * @see {@link make} for constructing the service value directly
+ * @see {@link testConsoleWith} for accessing the provided test console service
+ *
* @category layers
+ * @since 4.0.0
*/
export declare const layer: Layer.Layer;
/**
* Returns an array of all items that have been logged by the program using
* `Console.log` thus far.
*
- * @example
+ * **When to use**
+ *
+ * Use to assert on captured `Console.log` output from a program provided with
+ * `TestConsole.layer`.
+ *
+ * **Example** (Reading captured log lines)
+ *
* ```ts
* import { Console, Effect } from "effect"
- * import * as TestConsole from "effect/testing/TestConsole"
+ * import { TestConsole } from "effect/testing"
*
* const program = Effect.gen(function*() {
* yield* Console.log("First message")
@@ -194,18 +261,27 @@ export declare const layer: Layer.Layer;
* }).pipe(Effect.provide(TestConsole.layer))
* ```
*
+ * @see {@link errorLines} for reading captured `Console.error` output
+ * @see {@link layer} for capturing console calls during a test
+ *
+ * @category testing
* @since 4.0.0
- * @category utils
*/
export declare const logLines: Effect.Effect, never, never>;
/**
* Returns an array of all items that have been logged by the program using
* `Console.error` thus far.
*
- * @example
+ * **When to use**
+ *
+ * Use to assert on captured `Console.error` output from a program provided
+ * with `TestConsole.layer`.
+ *
+ * **Example** (Reading captured error lines)
+ *
* ```ts
* import { Console, Effect } from "effect"
- * import * as TestConsole from "effect/testing/TestConsole"
+ * import { TestConsole } from "effect/testing"
*
* const program = Effect.gen(function*() {
* yield* Console.error("Error message")
@@ -221,8 +297,11 @@ export declare const logLines: Effect.Effect, never, neve
* }).pipe(Effect.provide(TestConsole.layer))
* ```
*
+ * @see {@link logLines} for reading captured `Console.log` output
+ * @see {@link layer} for capturing console calls during a test
+ *
+ * @category testing
* @since 4.0.0
- * @category utils
*/
export declare const errorLines: Effect.Effect, never, never>;
//# sourceMappingURL=TestConsole.d.ts.map
\ No newline at end of file
diff --git a/.opencode/node_modules/effect/dist/testing/TestConsole.d.ts.map b/.opencode/node_modules/effect/dist/testing/TestConsole.d.ts.map
index f4d14d429050c56a4ac1953e31db254eca5474f6..01d0211548541f41d846aa23a8fadd2eaf9ad9d3 100644
--- a/.opencode/node_modules/effect/dist/testing/TestConsole.d.ts.map
+++ b/.opencode/node_modules/effect/dist/testing/TestConsole.d.ts.map
@@ -1 +1 @@
-{"version":3,"file":"TestConsole.d.ts","sourceRoot":"","sources":["../../src/testing/TestConsole.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,OAAO,MAAM,eAAe,CAAA;AACxC,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;AACtC,OAAO,KAAK,KAAK,MAAM,aAAa,CAAA;AAEpC;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,WAAW,WAAY,SAAQ,OAAO,CAAC,OAAO;IAClD;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAA;IACxD;;;OAGG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAA;CAC3D;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,OAAO,WAAW,WAAW,CAAC;IACnC;;;;;;;;;;;;;OA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,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,KAAK,CAExE,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,KAAK,CAE1E,CAAA"}
\ No newline at end of file
diff --git a/.opencode/node_modules/effect/dist/testing/TestConsole.js b/.opencode/node_modules/effect/dist/testing/TestConsole.js
index ed4e816d264b947cbaff07c23fef3e915fe15aa3..893f534b2e0d652567091d3937fa5a84fb3556e1 100644
--- a/.opencode/node_modules/effect/dist/testing/TestConsole.js
+++ b/.opencode/node_modules/effect/dist/testing/TestConsole.js
@@ -1,4 +1,12 @@
/**
+ * Provides a test implementation of the Effect `Console` service.
+ *
+ * When the test layer is provided, calls made through the Effect console APIs
+ * are captured in memory instead of being written to the host console. Tests can
+ * then assert on logged values deterministically. This module includes the
+ * console layer, helpers for reading captured `Console.log` and `Console.error`
+ * arguments, and access to the provided test console service.
+ *
* @since 4.0.0
*/
import * as Array from "../Array.js";
@@ -10,10 +18,15 @@ import * as Layer from "../Layer.js";
* The returned TestConsole implements the Console interface and provides
* additional methods to retrieve logged messages.
*
- * @example
+ * **When to use**
+ *
+ * Use to construct a test console service value directly.
+ *
+ * **Example** (Creating a test console)
+ *
* ```ts
* import { Console, Effect } from "effect"
- * import * as TestConsole from "effect/testing/TestConsole"
+ * import { TestConsole } from "effect/testing"
*
* const program = Effect.gen(function*() {
* yield* Console.log("Debug message")
@@ -27,8 +40,10 @@ import * as Layer from "../Layer.js";
* }).pipe(Effect.provide(TestConsole.layer))
* ```
*
- * @since 4.0.0
+ * @see {@link layer} for providing a `TestConsole` as a `Layer`
+ *
* @category constructors
+ * @since 4.0.0
*/
export const make = /*#__PURE__*/Effect.gen(function* () {
const entries = [];
@@ -70,10 +85,15 @@ export const make = /*#__PURE__*/Effect.gen(function* () {
* Retrieves the `TestConsole` service for this test and uses it to run the
* specified workflow.
*
- * @example
+ * **When to use**
+ *
+ * Use to access the provided test console service inside an effect.
+ *
+ * **Example** (Accessing the test console service)
+ *
* ```ts
* import { Effect } from "effect"
- * import * as TestConsole from "effect/testing/TestConsole"
+ * import { TestConsole } from "effect/testing"
*
* const program = TestConsole.testConsoleWith((testConsole) =>
* Effect.gen(function*() {
@@ -89,8 +109,12 @@ export const make = /*#__PURE__*/Effect.gen(function* () {
* ).pipe(Effect.provide(TestConsole.layer))
* ```
*
+ * @see {@link layer} for providing the test console service
+ * @see {@link logLines} for reading captured `Console.log` calls directly
+ * @see {@link errorLines} for reading captured `Console.error` calls directly
+ *
+ * @category testing
* @since 4.0.0
- * @category utils
*/
export const testConsoleWith = f => Console.consoleWith(console => f(console));
/**
@@ -98,10 +122,15 @@ export const testConsoleWith = f => Console.consoleWith(console => f(console));
* This layer can be used to provide a TestConsole implementation
* for testing purposes.
*
- * @example
+ * **When to use**
+ *
+ * Use to run an effect with console calls captured by `TestConsole`.
+ *
+ * **Example** (Providing a test console layer)
+ *
* ```ts
* import { Console, Effect } from "effect"
- * import * as TestConsole from "effect/testing/TestConsole"
+ * import { TestConsole } from "effect/testing"
*
* const program = Effect.gen(function*() {
* yield* Console.log("This will be captured")
@@ -115,18 +144,27 @@ export const testConsoleWith = f => Console.consoleWith(console => f(console));
* }).pipe(Effect.provide(TestConsole.layer))
* ```
*
- * @since 4.0.0
+ * @see {@link make} for constructing the service value directly
+ * @see {@link testConsoleWith} for accessing the provided test console service
+ *
* @category layers
+ * @since 4.0.0
*/
export const layer = /*#__PURE__*/Layer.effect(Console.Console)(make);
/**
* Returns an array of all items that have been logged by the program using
* `Console.log` thus far.
*
- * @example
+ * **When to use**
+ *
+ * Use to assert on captured `Console.log` output from a program provided with
+ * `TestConsole.layer`.
+ *
+ * **Example** (Reading captured log lines)
+ *
* ```ts
* import { Console, Effect } from "effect"
- * import * as TestConsole from "effect/testing/TestConsole"
+ * import { TestConsole } from "effect/testing"
*
* const program = Effect.gen(function*() {
* yield* Console.log("First message")
@@ -144,18 +182,27 @@ export const layer = /*#__PURE__*/Layer.effect(Console.Console)(make);
* }).pipe(Effect.provide(TestConsole.layer))
* ```
*
+ * @see {@link errorLines} for reading captured `Console.error` output
+ * @see {@link layer} for capturing console calls during a test
+ *
+ * @category testing
* @since 4.0.0
- * @category utils
*/
export const logLines = /*#__PURE__*/testConsoleWith(console => console.logLines);
/**
* Returns an array of all items that have been logged by the program using
* `Console.error` thus far.
*
- * @example
+ * **When to use**
+ *
+ * Use to assert on captured `Console.error` output from a program provided
+ * with `TestConsole.layer`.
+ *
+ * **Example** (Reading captured error lines)
+ *
* ```ts
* import { Console, Effect } from "effect"
- * import * as TestConsole from "effect/testing/TestConsole"
+ * import { TestConsole } from "effect/testing"
*
* const program = Effect.gen(function*() {
* yield* Console.error("Error message")
@@ -171,8 +218,11 @@ export const logLines = /*#__PURE__*/testConsoleWith(console => console.logLines
* }).pipe(Effect.provide(TestConsole.layer))
* ```
*
+ * @see {@link logLines} for reading captured `Console.log` output
+ * @see {@link layer} for capturing console calls during a test
+ *
+ * @category testing
* @since 4.0.0
- * @category utils
*/
export const errorLines = /*#__PURE__*/testConsoleWith(console => console.errorLines);
//# sourceMappingURL=TestConsole.js.map
\ No newline at end of file
diff --git a/.opencode/node_modules/effect/dist/testing/TestConsole.js.map b/.opencode/node_modules/effect/dist/testing/TestConsole.js.map
index 7b5034c589354e12b074ae0944907587ca91a393..83d52e9ec206557f1b2ccbe13c9593a14c5bbd96 100644
--- a/.opencode/node_modules/effect/dist/testing/TestConsole.js.map
+++ b/.opencode/node_modules/effect/dist/testing/TestConsole.js.map
@@ -1 +1 @@
-{"version":3,"file":"TestConsole.js","names":["Array","Console","Effect","Layer","make","gen","entries","createEntryUnsafe","method","parameters","push","logLines","sync","flatMap","entry","errorLines","assert","clear","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn","testConsoleWith","f","consoleWith","console","layer","effect"],"sources":["../../src/testing/TestConsole.ts"],"sourcesContent":[null],"mappings":"AAAA;;;AAGA,OAAO,KAAKA,KAAK,MAAM,aAAa;AACpC,OAAO,KAAKC,OAAO,MAAM,eAAe;AACxC,OAAO,KAAKC,MAAM,MAAM,cAAc;AACtC,OAAO,KAAKC,KAAK,MAAM,aAAa;AA8FpC;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,OAAO,MAAMC,IAAI,gBAAGF,MAAM,CAACG,GAAG,CAAC,aAAS;EACtC,MAAMC,OAAO,GAA6B,EAAE;EAE5C,SAASC,iBAAiBA,CAACC,MAA0B;IACnD,OAAO,CAAC,GAAGC,UAA8B,KAAU;MACjDH,OAAO,CAACI,IAAI,CAAC;QAAEF,MAAM;QAAEC;MAAU,CAAE,CAAC;IACtC,CAAC;EACH;EAEA,MAAME,QAAQ,GAAGT,MAAM,CAACU,IAAI,CAAC,MAAMZ,KAAK,CAACa,OAAO,CAACP,OAAO,EAAGQ,KAAK,IAAKA,KAAK,CAACN,MAAM,KAAK,KAAK,GAAGM,KAAK,CAACL,UAAU,GAAG,EAAE,CAAC,CAAC;EAErH,MAAMM,UAAU,GAAGb,MAAM,CAACU,IAAI,CAAC,MAC7BZ,KAAK,CAACa,OAAO,CAACP,OAAO,EAAGQ,KAAK,IAAKA,KAAK,CAACN,MAAM,KAAK,OAAO,GAAGM,KAAK,CAACL,UAAU,GAAG,EAAE,CAAC,CACpF;EAED,OAAO;IACLO,MAAM,EAAET,iBAAiB,CAAC,QAAQ,CAAC;IACnCU,KAAK,EAAEV,iBAAiB,CAAC,OAAO,CAAC;IACjCW,KAAK,EAAEX,iBAAiB,CAAC,OAAO,CAAC;IACjCY,UAAU,EAAEZ,iBAAiB,CAAC,YAAY,CAAC;IAC3Ca,KAAK,EAAEb,iBAAiB,CAAC,OAAO,CAAC;IACjCc,GAAG,EAAEd,iBAAiB,CAAC,KAAK,CAAC;IAC7Be,MAAM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AChC","ignoreList":[]}
\ No newline at end of file
+{"version":3,"file":"TestConsole.js","names":["Array","Console","Effect","Layer","make","gen","entries","createEntryUnsafe","method","parameters","push","logLines","sync","flatMap","entry","errorLines","assert","clear","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn","testConsoleWith","f","consoleWith","console","layer","effect"],"sources":["../../src/testing/TestConsole.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;AAWA,OAAO,KAAKA,KAAK,MAAM,aAAa;AACpC,OAAO,KAAKC,OAAO,MAAM,eAAe;AACxC,OAAO,KAAKC,MAAM,MAAM,cAAc;AACtC,OAAO,KAAKC,KAAK,MAAM,aAAa;AAmIpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,OAAO,MAAMC,IAAI,gBAAGF,MAAM,CAACG,GAAG,CAAC,aAAS;EACtC,MAAMC,OAAO,GAA6B,EAAE;EAE5C,SAASC,iBAAiBA,CAACC,MAA0B;IACnD,OAAO,CAAC,GAAGC,UAA8B,KAAU;MACjDH,OAAO,CAACI,IAAI,CAAC;QAAEF,MAAM;QAAEC;MAAU,CAAE,CAAC;IACtC,CAAC;EACH;EAEA,MAAME,QAAQ,GAAGT,MAAM,CAACU,IAAI,CAAC,MAAMZ,KAAK,CAACa,OAAO,CAACP,OAAO,EAAGQ,KAAK,IAAKA,KAAK,CAACN,MAAM,KAAK,KAAK,GAAGM,KAAK,CAACL,UAAU,GAAG,EAAE,CAAC,CAAC;EAErH,MAAMM,UAAU,GAAGb,MAAM,CAACU,IAAI,CAAC,MAC7BZ,KAAK,CAACa,OAAO,CAACP,OAAO,EAAGQ,KAAK,IAAKA,KAAK,CAACN,MAAM,KAAK,OAAO,GAAGM,KAAK,CAACL,UAAU,GAAG,EAAE,CAAC,CACpF;EAED,OAAO;IACLO,MAAM,EAAET,iBAAiB,CAAC,QAAQ,CAAC;IACnCU,KAAK,EAAEV,iBAAiB,CAAC,OAA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;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,OAAO,MAAMO,QAAQ,gBAAwDwB,eAAe,CACzFG,OAAO,IAAKA,OAAO,CAAC3B,QAAQ,CAC9B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,OAAO,MAAMI,UAAU,gBAAwDoB,eAAe,CAC3FG,OAAO,IAAKA,OAAO,CAACvB,UAAU,CAChC","ignoreList":[]}
\ No newline at end of file
diff --git a/.opencode/node_modules/effect/dist/testing/TestSchema.d.ts b/.opencode/node_modules/effect/dist/testing/TestSchema.d.ts
index ccb564786df58157a8eb975c61775a605423cab0..8ac3e409f96da7ec4b7a6450e1a2c337c9bd17aa 100644
--- a/.opencode/node_modules/effect/dist/testing/TestSchema.d.ts
+++ b/.opencode/node_modules/effect/dist/testing/TestSchema.d.ts
@@ -1,18 +1,15 @@
import type * as Context from "../Context.ts";
import * as Effect from "../Effect.ts";
import * as Schema from "../Schema.ts";
-import * as AST from "../SchemaAST.ts";
-import type * as Issue from "../SchemaIssue.ts";
+import * as SchemaAST from "../SchemaAST.ts";
+import type * as SchemaIssue from "../SchemaIssue.ts";
import * as FastCheck from "../testing/FastCheck.ts";
/**
- * Entry point for schema test assertions. Wraps a schema and exposes
- * operation-specific helpers: {@link Decoding}, {@link Encoding}, make,
- * arbitrary generation, and round-trip verification.
+ * Provides schema test assertions for decoding, encoding, make, arbitrary generation, and round-trip verification.
*
- * When to use:
- * - You are writing unit tests for a schema's decoding, encoding, or
- * construction behavior.
- * - You want property-based round-trip or generation checks.
+ * **When to use**
+ *
+ * Use when writing schema unit tests for decoding, encoding, construction, property-based round-trip, or generation behavior.
*
* **Example** (Decoding and encoding a struct)
*
@@ -32,18 +29,21 @@ import * as FastCheck from "../testing/FastCheck.ts";
*
* @see {@link Decoding}
* @see {@link Encoding}
- *
+ * @category testing
* @since 4.0.0
*/
export declare class Asserts {
/**
- * Static helpers for comparing schema AST structures. Useful when you need
- * to assert that two field or element definitions produce the same AST.
+ * Static helpers for comparing schema AST structures.
+ *
+ * **When to use**
*
- * - `ast.fields.equals(a, b)` – compares struct field ASTs via
- * `assert.deepStrictEqual`.
- * - `ast.elements.equals(a, b)` – compares tuple element ASTs via
- * `assert.deepStrictEqual`.
+ * Use to assert that two schema field or tuple element definitions produce
+ * the same AST structure.
+ *
+ * **Details**
+ *
+ * `ast.fields.equals(a, b)` compares struct field ASTs via `assert.deepStrictEqual`. `ast.elements.equals(a, b)` compares tuple element ASTs via `assert.deepStrictEqual`.
*
* **Example** (Comparing struct fields)
*
@@ -67,12 +67,16 @@ export declare class Asserts {
readonly schema: S;
constructor(schema: S);
/**
- * Returns an object with `succeed` and `fail` helpers for testing the
- * schema's `make` operation.
+ * Returns an object with `succeed` and `fail` helpers for testing the schema's `make` operation.
+ *
+ * **When to use**
*
- * - `succeed(input)` – asserts make returns the input unchanged.
- * - `succeed(input, expected)` – asserts make returns `expected`.
- * - `fail(input, message)` – asserts make fails with `message`.
+ * Use to assert how `Schema.make` accepts, transforms, or rejects
+ * construction input for this schema.
+ *
+ * **Details**
+ *
+ * `succeed(input)` asserts make returns the input unchanged. `succeed(input, expected)` asserts make returns `expected`. `fail(input, message)` asserts make fails with `message`.
*
* **Example** (Testing make)
*
@@ -84,6 +88,9 @@ export declare class Asserts {
* const asserts = new TestSchema.Asserts(schema)
* await asserts.make().succeed("hello")
* ```
+ *
+ * @see {@link decoding} for assertions against decoded input
+ * @see {@link encoding} for assertions against encoded output
*/
make(options?: Schema.MakeOptions): {
succeed: {
@@ -93,13 +100,16 @@ export declare class Asserts {
fail(input: unknown, message: string): Promise;
};
/**
- * Runs a property-based test that encodes arbitrary values and then decodes
- * them, asserting the decoded value equals the original. Useful for verifying
- * that a codec is lossless (encode followed by decode is identity).
+ * Runs a property-based test that encodes arbitrary values and then decodes them, asserting the decoded value equals the original.
+ *
+ * **When to use**
+ *
+ * Use to verify that generated schema values survive an encode-then-decode
+ * round trip.
*
- * - Uses FastCheck to generate arbitrary values matching the schema's Type.
- * - Fails the test if any generated value does not round-trip.
- * - Pass `options.params` to control FastCheck parameters (e.g. `numRuns`).
+ * **Details**
+ *
+ * FastCheck generates arbitrary values matching the schema's `Type`. The assertion fails if any generated value does not round-trip. Pass `options.params` to control FastCheck parameters such as `numRuns`.
*
* **Example** (Round-trip verification)
*
@@ -110,15 +120,22 @@ export declare class Asserts {
* const asserts = new TestSchema.Asserts(Schema.NumberFromString)
* await asserts.verifyLosslessTransformation()
* ```
+ *
+ * @see {@link arbitrary} for checking that generated values satisfy the schema
*/
verifyLosslessTransformation>(this: Asserts, options?: {
readonly params?: FastCheck.Parameters<[S["Type"]]>;
}): Promise;
/**
- * Returns a {@link Decoding} instance for this schema, providing `succeed`
- * and `fail` helpers to test decoding behavior.
+ * Returns a {@link Decoding} instance for this schema with helpers for decoding assertions.
+ *
+ * **When to use**
+ *
+ * Use to test how unknown input is decoded into the schema's type.
+ *
+ * **Details**
*
- * - Pass `parseOptions` to control error reporting (e.g. `{ errors: "all" }`).
+ * Pass `parseOptions` to control error reporting, for example `{ errors: "all" }`.
*
* **Example** (Decoding assertions)
*
@@ -133,15 +150,21 @@ export declare class Asserts {
* ```
*
* @see {@link Decoding}
+ * @see {@link encoding} for assertions in the opposite direction
*/
decoding(options?: {
- readonly parseOptions?: AST.ParseOptions | undefined;
+ readonly parseOptions?: SchemaAST.ParseOptions | undefined;
}): Decoding;
/**
- * Returns an {@link Encoding} instance for this schema, providing `succeed`
- * and `fail` helpers to test encoding behavior.
+ * Returns an {@link Encoding} instance for this schema with helpers for encoding assertions.
*
- * - Pass `parseOptions` to control error reporting (e.g. `{ errors: "all" }`).
+ * **When to use**
+ *
+ * Use to test how schema values are encoded into their external form.
+ *
+ * **Details**
+ *
+ * Pass `parseOptions` to control error reporting, for example `{ errors: "all" }`.
*
* **Example** (Encoding assertions)
*
@@ -155,17 +178,22 @@ export declare class Asserts {
* ```
*
* @see {@link Encoding}
+ * @see {@link decoding} for assertions in the opposite direction
*/
encoding(options?: {
- readonly parseOptions?: AST.ParseOptions | undefined;
+ readonly parseOptions?: SchemaAST.ParseOptions | undefined;
}): Encoding;
/**
- * Returns an object with property-based testing helpers for the schema's
- * arbitrary generator.
+ * Returns an object with property-based testing helpers for the schema's arbitrary generator.
+ *
+ * **When to use**
+ *
+ * Use to verify that arbitrary values generated for this schema satisfy the
+ * schema's predicate.
*
- * - `verifyGeneration()` – generates arbitrary values and asserts each
- * satisfies the schema's `is` predicate. Defaults to 20 runs.
- * - Pass `options.params` to override FastCheck parameters.
+ * **Details**
+ *
+ * `verifyGeneration()` generates arbitrary values and asserts each value satisfies the schema's `is` predicate. It defaults to 20 runs. Pass `options.params` to override FastCheck parameters.
*
* **Example** (Verifying arbitrary generation)
*
@@ -176,6 +204,8 @@ export declare class Asserts {
* const asserts = new TestSchema.Asserts(Schema.String)
* asserts.arbitrary().verifyGeneration()
* ```
+ *
+ * @see {@link verifyLosslessTransformation} for property-based round-trip checks
*/
arbitrary>(this: Asserts): {
verifyGeneration(options?: {
@@ -184,22 +214,15 @@ export declare class Asserts {
};
}
/**
- * Decoding test helper. Wraps a schema and exposes `succeed` and `fail`
- * methods that run the schema's decoder and compare the result.
+ * Provides decoding test assertions through `succeed` and `fail` methods that run the schema's decoder and compare the result.
+ *
+ * **When to use**
*
- * When to use:
- * - You want to assert that specific inputs decode to expected values.
- * - You want to assert that invalid inputs produce specific error messages.
- * - You need to provide services required by the schema's decoding pipeline.
+ * Use when you want to assert that specific inputs decode to expected values, invalid inputs produce specific error messages, or schemas receive required decoding services.
*
- * Behavior:
- * - All assertions are async and use `assert.deepStrictEqual` internally.
- * - `succeed(input)` asserts the decoded output equals `input` (identity).
- * - `succeed(input, expected)` asserts the decoded output equals `expected`.
- * - `fail(input, message)` asserts decoding fails and the stringified issue
- * equals `message`.
- * - `provide(key, impl)` returns a new `Decoding` with the service injected
- * into the decoding context.
+ * **Details**
+ *
+ * All assertions are async and use `assert.deepStrictEqual` internally. `succeed(input)` asserts the decoded output equals `input`; `succeed(input, expected)` asserts it equals `expected`; `fail(input, message)` asserts decoding fails and the stringified issue equals `message`. `provide(key, impl)` returns a new `Decoding` with the service injected into the decoding context.
*
* **Example** (Decoding with service provision)
*
@@ -214,23 +237,27 @@ export declare class Asserts {
*
* @see {@link Asserts}
* @see {@link Encoding}
- *
+ * @category testing
* @since 4.0.0
*/
export declare class Decoding {
readonly schema: S;
- readonly decodeUnknownEffect: (input: unknown, options?: AST.ParseOptions) => Effect.Effect;
+ readonly decodeUnknownEffect: (input: unknown, options?: SchemaAST.ParseOptions) => Effect.Effect;
readonly options?: {
- readonly parseOptions?: AST.ParseOptions | undefined;
+ readonly parseOptions?: SchemaAST.ParseOptions | undefined;
} | undefined;
constructor(schema: S, options?: {
- readonly parseOptions?: AST.ParseOptions | undefined;
+ readonly parseOptions?: SchemaAST.ParseOptions | undefined;
});
/**
* Asserts that decoding `input` succeeds. With one argument, asserts the
* output equals the input. With two arguments, asserts the output equals
* `expected`.
*
+ * **When to use**
+ *
+ * Use to verify successful decoding for one input case.
+ *
* **Example** (Identity and transformed decoding)
*
* ```ts
@@ -240,6 +267,8 @@ export declare class Decoding {
* const decoding = new TestSchema.Asserts(Schema.NumberFromString).decoding()
* await decoding.succeed("1", 1) // transformed
* ```
+ *
+ * @see {@link fail} for asserting decoding failures
*/
succeed>(this: Decoding, input: unknown): Promise;
succeed>(this: Decoding, input: unknown, expected: S["Type"]): Promise;
@@ -247,6 +276,10 @@ export declare class Decoding {
* Asserts that decoding `input` fails and the stringified issue equals
* `message`.
*
+ * **When to use**
+ *
+ * Use to verify that invalid decoding input produces the expected issue text.
+ *
* **Example** (Asserting a decoding failure)
*
* ```ts
@@ -256,37 +289,31 @@ export declare class Decoding {
* const decoding = new TestSchema.Asserts(Schema.String).decoding()
* await decoding.fail(42, "Expected string, got 42")
* ```
+ *
+ * @see {@link succeed} for asserting successful decoding
*/
fail>(this: Decoding, input: unknown, message: string): Promise;
/**
- * Returns a new {@link Decoding} instance with the given service injected
- * into the decoding effect context. Use this when the schema's decoder
- * requires a service dependency.
+ * Returns a new {@link Decoding} instance with the given service injected into the decoding effect context.
*
- * - Does not mutate the current instance; returns a new one.
+ * **When to use**
+ *
+ * Use when the schema's decoder requires a service dependency.
*
* @see {@link Encoding.provide}
*/
provide(service: Context.Key, implementation: Service): Decoding>>;
}
/**
- * Encoding test helper. Mirrors {@link Decoding} but exercises the schema's
- * encoder direction.
+ * Provides encoding test assertions through `succeed` and `fail` methods that run the schema's encoder and compare the result.
+ *
+ * **When to use**
+ *
+ * Use when you want to assert that specific values encode to expected outputs, invalid inputs produce specific error messages, or schemas receive required encoding services.
*
- * When to use:
- * - You want to assert that specific values encode to expected outputs.
- * - You want to assert that invalid inputs produce specific error messages
- * during encoding.
- * - You need to provide services required by the schema's encoding pipeline.
+ * **Details**
*
- * Behavior:
- * - All assertions are async and use `assert.deepStrictEqual` internally.
- * - `succeed(input)` asserts the encoded output equals `input` (identity).
- * - `succeed(input, expected)` asserts the encoded output equals `expected`.
- * - `fail(input, message)` asserts encoding fails and the stringified issue
- * equals `message`.
- * - `provide(key, impl)` returns a new `Encoding` with the service injected
- * into the encoding context.
+ * All assertions are async and use `assert.deepStrictEqual` internally. `succeed(input)` asserts the encoded output equals `input`; `succeed(input, expected)` asserts it equals `expected`; `fail(input, message)` asserts encoding fails and the stringified issue equals `message`. `provide(key, impl)` returns a new `Encoding` with the service injected into the encoding context.
*
* **Example** (Encoding assertions)
*
@@ -301,22 +328,27 @@ export declare class Decoding {
* @see {@link Asserts}
* @see {@link Decoding}
*
+ * @category testing
* @since 4.0.0
*/
-declare class Encoding {
+export declare class Encoding {
readonly schema: S;
- readonly encodeUnknownEffect: (input: unknown, options?: AST.ParseOptions) => Effect.Effect;
+ readonly encodeUnknownEffect: (input: unknown, options?: SchemaAST.ParseOptions) => Effect.Effect;
readonly options?: {
- readonly parseOptions?: AST.ParseOptions | undefined;
+ readonly parseOptions?: SchemaAST.ParseOptions | undefined;
} | undefined;
constructor(schema: S, options?: {
- readonly parseOptions?: AST.ParseOptions | undefined;
+ readonly parseOptions?: SchemaAST.ParseOptions | undefined;
});
/**
* Asserts that encoding `input` succeeds. With one argument, asserts the
* output equals the input. With two arguments, asserts the output equals
* `expected`.
*
+ * **When to use**
+ *
+ * Use to verify successful encoding for one input case.
+ *
* **Example** (Identity and transformed encoding)
*
* ```ts
@@ -326,6 +358,8 @@ declare class Encoding {
* const encoding = new TestSchema.Asserts(Schema.NumberFromString).encoding()
* await encoding.succeed(1, "1") // transformed
* ```
+ *
+ * @see {@link fail} for asserting encoding failures
*/
succeed>(this: Encoding, input: unknown): Promise;
succeed>(this: Encoding, input: unknown, expected: S["Encoded"]): Promise;
@@ -333,6 +367,10 @@ declare class Encoding {
* Asserts that encoding `input` fails and the stringified issue equals
* `message`.
*
+ * **When to use**
+ *
+ * Use to verify that invalid encoding input produces the expected issue text.
+ *
* **Example** (Asserting an encoding failure)
*
* ```ts
@@ -342,18 +380,19 @@ declare class Encoding {
* const encoding = new TestSchema.Asserts(Schema.NumberFromString).encoding()
* await encoding.fail("not-a-number", "Expected number, got \"not-a-number\"")
* ```
+ *
+ * @see {@link succeed} for asserting successful encoding
*/
fail>(this: Encoding, input: unknown, message: string): Promise;
/**
- * Returns a new {@link Encoding} instance with the given service injected
- * into the encoding effect context. Use this when the schema's encoder
- * requires a service dependency.
+ * Returns a new {@link Encoding} instance with the given service injected into the encoding effect context.
+ *
+ * **When to use**
*
- * - Does not mutate the current instance; returns a new one.
+ * Use when the schema's encoder requires a service dependency.
*
* @see {@link Decoding.provide}
*/
provide(service: Context.Key, implementation: Service): Encoding>>;
}
-export {};
//# sourceMappingURL=TestSchema.d.ts.map
\ No newline at end of file
diff --git a/.opencode/node_modules/effect/dist/testing/TestSchema.d.ts.map b/.opencode/node_modules/effect/dist/testing/TestSchema.d.ts.map
index f5ffb1a13b6d7659997b475ce60a5411e0cc2c3f..a7423be7c597a1485dabfbf005fea055260ccea6 100644
--- a/.opencode/node_modules/effect/dist/testing/TestSchema.d.ts.map
+++ b/.opencode/node_modules/effect/dist/testing/TestSchema.d.ts.map
@@ -1 +1 @@
-{"version":3,"file":"TestSchema.d.ts","sourceRoot":"","sources":["../../src/testing/TestSchema.ts"],"names":[],"mappings":"AAqEA,OAAO,KAAK,KAAK,OAAO,MAAM,eAAe,CAAA;AAC7C,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;AAGtC,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;AACtC,OAAO,KAAK,GAAG,MAAM,iBAAiB,CAAA;AACtC,OAAO,KAAK,KAAK,KAAK,MAAM,mBAAmB,CAAA;AAE/C,OAAO,KAAK,SAAS,MAAM,yBAAyB,CAAA;AAEpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,qBAAa,OAAO,CAAC,CAAC,SAAS,MAAM,CAAC,GAAG;IACvC;;;;;;;;;;;;;;;;;;;OAmBG;IACH,MAAM,CAAC,GAAG;;iCAEM,MAAM,CAAC,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,MAAM;;;iCAK7C,MAAM,CAAC,KAAK,CAAC,QAAQ,KAAK,MAAM,CAAC,KAAK,CAAC,QAAQ;;MAIrD;IAEV,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAA;gBACN,MAAM,EAAE,CAAC;IAGrB;;;;;;;;;;;;;;;;;;OAkBG;IACH,IAAI,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,WAAW;;oBAED,CAAC,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;oBACzB,CAAC,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;;oBAajE,OAAO,WAAW,MAAM;;IAW9C;;;;;;;;;;;;;;;;;;OAkBG;IACH,4BAA4B,CAAC,CAAC,SAAS,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC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ACH,OAAO,CAAC,EAAE,EAAE,OAAO,EACjB,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,EAAE,OAAO,CAAC,EACjC,cAAc,EAAE,OAAO,GACtB,QAAQ,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,kBAAkB,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;CAM9E"}
\ No newline at end of file
diff --git a/.opencode/node_modules/effect/dist/testing/TestSchema.js b/.opencode/node_modules/effect/dist/testing/TestSchema.js
index 32eb95ac220a39af54a131c6beb3596a6176f91a..c02c24dfbc0c12cfbf9f5882fdbefe5829e2d1ff 100644
--- a/.opencode/node_modules/effect/dist/testing/TestSchema.js
+++ b/.opencode/node_modules/effect/dist/testing/TestSchema.js
@@ -1,68 +1,11 @@
/**
- * Testing utilities for asserting Schema decoding, encoding, make, and
- * arbitrary-generation behavior. Used in unit tests to verify that schemas
- * accept, reject, and round-trip values correctly.
+ * Provides helpers for testing Schema behavior.
*
- * ## Mental model
- *
- * - **Asserts** – entry point: wraps a schema and exposes helpers grouped by
- * operation (decoding, encoding, make, arbitrary, round-trip).
- * - **Decoding** – returned by `asserts.decoding()`; has `succeed` / `fail`
- * helpers that run the schema's decoder and compare the result.
- * - **Encoding** – returned by `asserts.encoding()`; mirrors {@link Decoding}
- * but exercises the encoder direction.
- * - Every assertion is async (`Promise`) because parsing may involve
- * effectful schemas.
- * - `succeed` with one argument asserts identity (output equals input);
- * with two arguments asserts a specific expected output.
- * - `fail` always takes the input and the expected error message string.
- *
- * ## Common tasks
- *
- * - Assert decoding succeeds / fails → `new Asserts(schema).decoding().succeed(…)` / `.fail(…)`
- * - Assert encoding succeeds / fails → `new Asserts(schema).encoding().succeed(…)` / `.fail(…)`
- * - Assert make succeeds / fails → `new Asserts(schema).make().succeed(…)` / `.fail(…)`
- * - Verify round-trip (encode then decode) → `new Asserts(schema).verifyLosslessTransformation()`
- * - Verify arbitrary generation → `new Asserts(schema).arbitrary().verifyGeneration()`
- * - Compare AST of struct fields → `Asserts.ast.fields.equals(a, b)`
- * - Provide a service dependency for decoding → `asserts.decoding().provide(key, impl)`
- *
- * ## Gotchas
- *
- * - `succeed` uses `assert.deepStrictEqual`, so reference equality is not
- * required but structural equality is.
- * - `fail` compares against the stringified `Issue`, not the `Issue` object
- * itself. Pass the exact multiline string the issue produces.
- * - `verifyLosslessTransformation` and `arbitrary().verifyGeneration` run
- * property-based tests via FastCheck; default run count is 20 for
- * `verifyGeneration`.
- *
- * ## Quickstart
- *
- * **Example** (Basic decoding and encoding assertions)
- *
- * ```ts
- * import { Schema } from "effect"
- * import { TestSchema } from "effect/testing"
- *
- * const schema = Schema.NumberFromString
- * const asserts = new TestSchema.Asserts(schema)
- *
- * // decoding
- * const decoding = asserts.decoding()
- * await decoding.succeed("1", 1)
- * await decoding.fail(null, "Expected string, got null")
- *
- * // encoding
- * const encoding = asserts.encoding()
- * await encoding.succeed(1, "1")
- * ```
- *
- * ## See also
- *
- * - {@link Asserts}
- * - {@link Decoding}
- * - {@link Encoding}
+ * These utilities assert how schemas construct values, decode input, encode
+ * output, generate arbitrary values, and round-trip between encoded and decoded
+ * forms. The `Asserts` class groups the common checks for one schema, while
+ * `Decoding` and `Encoding` can be used directly when a test only needs one
+ * direction.
*
* @since 4.0.0
*/
@@ -71,18 +14,15 @@ import * as Effect from "../Effect.js";
import * as Record from "../Record.js";
import * as Result from "../Result.js";
import * as Schema from "../Schema.js";
-import * as AST from "../SchemaAST.js";
-import * as Parser from "../SchemaParser.js";
+import * as SchemaAST from "../SchemaAST.js";
+import * as SchemaParser from "../SchemaParser.js";
import * as FastCheck from "../testing/FastCheck.js";
/**
- * Entry point for schema test assertions. Wraps a schema and exposes
- * operation-specific helpers: {@link Decoding}, {@link Encoding}, make,
- * arbitrary generation, and round-trip verification.
+ * Provides schema test assertions for decoding, encoding, make, arbitrary generation, and round-trip verification.
+ *
+ * **When to use**
*
- * When to use:
- * - You are writing unit tests for a schema's decoding, encoding, or
- * construction behavior.
- * - You want property-based round-trip or generation checks.
+ * Use when writing schema unit tests for decoding, encoding, construction, property-based round-trip, or generation behavior.
*
* **Example** (Decoding and encoding a struct)
*
@@ -102,18 +42,21 @@ import * as FastCheck from "../testing/FastCheck.js";
*
* @see {@link Decoding}
* @see {@link Encoding}
- *
+ * @category testing
* @since 4.0.0
*/
export class Asserts {
/**
- * Static helpers for comparing schema AST structures. Useful when you need
- * to assert that two field or element definitions produce the same AST.
+ * Static helpers for comparing schema AST structures.
+ *
+ * **When to use**
+ *
+ * Use to assert that two schema field or tuple element definitions produce
+ * the same AST structure.
+ *
+ * **Details**
*
- * - `ast.fields.equals(a, b)` – compares struct field ASTs via
- * `assert.deepStrictEqual`.
- * - `ast.elements.equals(a, b)` – compares tuple element ASTs via
- * `assert.deepStrictEqual`.
+ * `ast.fields.equals(a, b)` compares struct field ASTs via `assert.deepStrictEqual`. `ast.elements.equals(a, b)` compares tuple element ASTs via `assert.deepStrictEqual`.
*
* **Example** (Comparing struct fields)
*
@@ -129,12 +72,12 @@ export class Asserts {
static ast = {
fields: {
equals: (a, b) => {
- assert.deepStrictEqual(Record.map(a, AST.getAST), Record.map(b, AST.getAST));
+ assert.deepStrictEqual(Record.map(a, SchemaAST.getAST), Record.map(b, SchemaAST.getAST));
}
},
elements: {
equals: (a, b) => {
- assert.deepStrictEqual(a.map(AST.getAST), b.map(AST.getAST));
+ assert.deepStrictEqual(a.map(SchemaAST.getAST), b.map(SchemaAST.getAST));
}
}
};
@@ -143,12 +86,16 @@ export class Asserts {
this.schema = schema;
}
/**
- * Returns an object with `succeed` and `fail` helpers for testing the
- * schema's `make` operation.
+ * Returns an object with `succeed` and `fail` helpers for testing the schema's `make` operation.
+ *
+ * **When to use**
+ *
+ * Use to assert how `Schema.make` accepts, transforms, or rejects
+ * construction input for this schema.
+ *
+ * **Details**
*
- * - `succeed(input)` – asserts make returns the input unchanged.
- * - `succeed(input, expected)` – asserts make returns `expected`.
- * - `fail(input, message)` – asserts make fails with `message`.
+ * `succeed(input)` asserts make returns the input unchanged. `succeed(input, expected)` asserts make returns `expected`. `fail(input, message)` asserts make fails with `message`.
*
* **Example** (Testing make)
*
@@ -160,30 +107,36 @@ export class Asserts {
* const asserts = new TestSchema.Asserts(schema)
* await asserts.make().succeed("hello")
* ```
+ *
+ * @see {@link decoding} for assertions against decoded input
+ * @see {@link encoding} for assertions against encoded output
*/
make(options) {
- const makeEffect = Parser.makeEffect(this.schema);
+ const makeEffect = SchemaParser.makeEffect(this.schema);
async function succeed(input, expected) {
- const r = await Effect.runPromise(makeEffect(input, options).pipe(Effect.mapError(issue => issue.toString()), Effect.result));
+ const r = await Effect.runPromise(makeEffect(input, options).pipe(Effect.mapErrorEager(issue => issue.toString()), Effect.result));
expected = arguments.length === 1 ? input : expected;
assert.deepStrictEqual(r, Result.succeed(expected));
}
return {
succeed,
async fail(input, message) {
- const r = await Effect.runPromise(makeEffect(input, options).pipe(Effect.mapError(issue => issue.toString()), Effect.result));
+ const r = await Effect.runPromise(makeEffect(input, options).pipe(Effect.mapErrorEager(issue => issue.toString()), Effect.result));
assert.deepStrictEqual(r, Result.fail(message));
}
};
}
/**
- * Runs a property-based test that encodes arbitrary values and then decodes
- * them, asserting the decoded value equals the original. Useful for verifying
- * that a codec is lossless (encode followed by decode is identity).
+ * Runs a property-based test that encodes arbitrary values and then decodes them, asserting the decoded value equals the original.
+ *
+ * **When to use**
+ *
+ * Use to verify that generated schema values survive an encode-then-decode
+ * round trip.
+ *
+ * **Details**
*
- * - Uses FastCheck to generate arbitrary values matching the schema's Type.
- * - Fails the test if any generated value does not round-trip.
- * - Pass `options.params` to control FastCheck parameters (e.g. `numRuns`).
+ * FastCheck generates arbitrary values matching the schema's `Type`. The assertion fails if any generated value does not round-trip. Pass `options.params` to control FastCheck parameters such as `numRuns`.
*
* **Example** (Round-trip verification)
*
@@ -194,21 +147,28 @@ export class Asserts {
* const asserts = new TestSchema.Asserts(Schema.NumberFromString)
* await asserts.verifyLosslessTransformation()
* ```
+ *
+ * @see {@link arbitrary} for checking that generated values satisfy the schema
*/
verifyLosslessTransformation(options) {
- const decodeUnknownEffect = Parser.decodeUnknownEffect(this.schema);
- const encodeEffect = Parser.encodeEffect(this.schema);
+ const decodeUnknownEffect = SchemaParser.decodeUnknownEffect(this.schema);
+ const encodeEffect = SchemaParser.encodeEffect(this.schema);
const arbitrary = Schema.toArbitrary(this.schema);
return FastCheck.assert(FastCheck.asyncProperty(arbitrary, async t => {
- const r = await Effect.runPromise(encodeEffect(t).pipe(Effect.flatMap(e => decodeUnknownEffect(e)), Effect.mapError(issue => issue.toString()), Effect.result));
+ const r = await Effect.runPromise(encodeEffect(t).pipe(Effect.flatMapEager(e => decodeUnknownEffect(e)), Effect.mapErrorEager(issue => issue.toString()), Effect.result));
assert.deepStrictEqual(r, Result.succeed(t));
}), options?.params);
}
/**
- * Returns a {@link Decoding} instance for this schema, providing `succeed`
- * and `fail` helpers to test decoding behavior.
+ * Returns a {@link Decoding} instance for this schema with helpers for decoding assertions.
+ *
+ * **When to use**
+ *
+ * Use to test how unknown input is decoded into the schema's type.
*
- * - Pass `parseOptions` to control error reporting (e.g. `{ errors: "all" }`).
+ * **Details**
+ *
+ * Pass `parseOptions` to control error reporting, for example `{ errors: "all" }`.
*
* **Example** (Decoding assertions)
*
@@ -223,15 +183,21 @@ export class Asserts {
* ```
*
* @see {@link Decoding}
+ * @see {@link encoding} for assertions in the opposite direction
*/
decoding(options) {
return new Decoding(this.schema, options);
}
/**
- * Returns an {@link Encoding} instance for this schema, providing `succeed`
- * and `fail` helpers to test encoding behavior.
+ * Returns an {@link Encoding} instance for this schema with helpers for encoding assertions.
+ *
+ * **When to use**
+ *
+ * Use to test how schema values are encoded into their external form.
+ *
+ * **Details**
*
- * - Pass `parseOptions` to control error reporting (e.g. `{ errors: "all" }`).
+ * Pass `parseOptions` to control error reporting, for example `{ errors: "all" }`.
*
* **Example** (Encoding assertions)
*
@@ -245,17 +211,22 @@ export class Asserts {
* ```
*
* @see {@link Encoding}
+ * @see {@link decoding} for assertions in the opposite direction
*/
encoding(options) {
return new Encoding(this.schema, options);
}
/**
- * Returns an object with property-based testing helpers for the schema's
- * arbitrary generator.
+ * Returns an object with property-based testing helpers for the schema's arbitrary generator.
+ *
+ * **When to use**
+ *
+ * Use to verify that arbitrary values generated for this schema satisfy the
+ * schema's predicate.
+ *
+ * **Details**
*
- * - `verifyGeneration()` – generates arbitrary values and asserts each
- * satisfies the schema's `is` predicate. Defaults to 20 runs.
- * - Pass `options.params` to override FastCheck parameters.
+ * `verifyGeneration()` generates arbitrary values and asserts each value satisfies the schema's `is` predicate. It defaults to 20 runs. Pass `options.params` to override FastCheck parameters.
*
* **Example** (Verifying arbitrary generation)
*
@@ -266,6 +237,8 @@ export class Asserts {
* const asserts = new TestSchema.Asserts(Schema.String)
* asserts.arbitrary().verifyGeneration()
* ```
+ *
+ * @see {@link verifyLosslessTransformation} for property-based round-trip checks
*/
arbitrary() {
const schema = this.schema;
@@ -283,22 +256,15 @@ export class Asserts {
}
}
/**
- * Decoding test helper. Wraps a schema and exposes `succeed` and `fail`
- * methods that run the schema's decoder and compare the result.
+ * Provides decoding test assertions through `succeed` and `fail` methods that run the schema's decoder and compare the result.
+ *
+ * **When to use**
*
- * When to use:
- * - You want to assert that specific inputs decode to expected values.
- * - You want to assert that invalid inputs produce specific error messages.
- * - You need to provide services required by the schema's decoding pipeline.
+ * Use when you want to assert that specific inputs decode to expected values, invalid inputs produce specific error messages, or schemas receive required decoding services.
*
- * Behavior:
- * - All assertions are async and use `assert.deepStrictEqual` internally.
- * - `succeed(input)` asserts the decoded output equals `input` (identity).
- * - `succeed(input, expected)` asserts the decoded output equals `expected`.
- * - `fail(input, message)` asserts decoding fails and the stringified issue
- * equals `message`.
- * - `provide(key, impl)` returns a new `Decoding` with the service injected
- * into the decoding context.
+ * **Details**
+ *
+ * All assertions are async and use `assert.deepStrictEqual` internally. `succeed(input)` asserts the decoded output equals `input`; `succeed(input, expected)` asserts it equals `expected`; `fail(input, message)` asserts decoding fails and the stringified issue equals `message`. `provide(key, impl)` returns a new `Decoding` with the service injected into the decoding context.
*
* **Example** (Decoding with service provision)
*
@@ -313,7 +279,7 @@ export class Asserts {
*
* @see {@link Asserts}
* @see {@link Encoding}
- *
+ * @category testing
* @since 4.0.0
*/
export class Decoding {
@@ -322,11 +288,11 @@ export class Decoding {
options;
constructor(schema, options) {
this.schema = schema;
- this.decodeUnknownEffect = Parser.decodeUnknownEffect(schema);
+ this.decodeUnknownEffect = SchemaParser.decodeUnknownEffect(schema);
this.options = options;
}
async succeed(input, expected) {
- const r = await Effect.runPromise(this.decodeUnknownEffect(input, this.options?.parseOptions).pipe(Effect.mapError(issue => issue.toString()), Effect.result));
+ const r = await Effect.runPromise(this.decodeUnknownEffect(input, this.options?.parseOptions).pipe(Effect.mapErrorEager(issue => issue.toString()), Effect.result));
expected = arguments.length === 1 ? input : expected;
assert.deepStrictEqual(r, Result.succeed(expected));
}
@@ -334,6 +300,10 @@ export class Decoding {
* Asserts that decoding `input` fails and the stringified issue equals
* `message`.
*
+ * **When to use**
+ *
+ * Use to verify that invalid decoding input produces the expected issue text.
+ *
* **Example** (Asserting a decoding failure)
*
* ```ts
@@ -343,17 +313,19 @@ export class Decoding {
* const decoding = new TestSchema.Asserts(Schema.String).decoding()
* await decoding.fail(42, "Expected string, got 42")
* ```
+ *
+ * @see {@link succeed} for asserting successful decoding
*/
async fail(input, message) {
- const r = await Effect.runPromise(this.decodeUnknownEffect(input, this.options?.parseOptions).pipe(Effect.mapError(issue => issue.toString()), Effect.result));
+ const r = await Effect.runPromise(this.decodeUnknownEffect(input, this.options?.parseOptions).pipe(Effect.mapErrorEager(issue => issue.toString()), Effect.result));
assert.deepStrictEqual(r, Result.fail(message));
}
/**
- * Returns a new {@link Decoding} instance with the given service injected
- * into the decoding effect context. Use this when the schema's decoder
- * requires a service dependency.
+ * Returns a new {@link Decoding} instance with the given service injected into the decoding effect context.
*
- * - Does not mutate the current instance; returns a new one.
+ * **When to use**
+ *
+ * Use when the schema's decoder requires a service dependency.
*
* @see {@link Encoding.provide}
*/
@@ -362,23 +334,15 @@ export class Decoding {
}
}
/**
- * Encoding test helper. Mirrors {@link Decoding} but exercises the schema's
- * encoder direction.
+ * Provides encoding test assertions through `succeed` and `fail` methods that run the schema's encoder and compare the result.
+ *
+ * **When to use**
*
- * When to use:
- * - You want to assert that specific values encode to expected outputs.
- * - You want to assert that invalid inputs produce specific error messages
- * during encoding.
- * - You need to provide services required by the schema's encoding pipeline.
+ * Use when you want to assert that specific values encode to expected outputs, invalid inputs produce specific error messages, or schemas receive required encoding services.
*
- * Behavior:
- * - All assertions are async and use `assert.deepStrictEqual` internally.
- * - `succeed(input)` asserts the encoded output equals `input` (identity).
- * - `succeed(input, expected)` asserts the encoded output equals `expected`.
- * - `fail(input, message)` asserts encoding fails and the stringified issue
- * equals `message`.
- * - `provide(key, impl)` returns a new `Encoding` with the service injected
- * into the encoding context.
+ * **Details**
+ *
+ * All assertions are async and use `assert.deepStrictEqual` internally. `succeed(input)` asserts the encoded output equals `input`; `succeed(input, expected)` asserts it equals `expected`; `fail(input, message)` asserts encoding fails and the stringified issue equals `message`. `provide(key, impl)` returns a new `Encoding` with the service injected into the encoding context.
*
* **Example** (Encoding assertions)
*
@@ -393,19 +357,20 @@ export class Decoding {
* @see {@link Asserts}
* @see {@link Decoding}
*
+ * @category testing
* @since 4.0.0
*/
-class Encoding {
+export class Encoding {
schema;
encodeUnknownEffect;
options;
constructor(schema, options) {
this.schema = schema;
- this.encodeUnknownEffect = Parser.encodeUnknownEffect(schema);
+ this.encodeUnknownEffect = SchemaParser.encodeUnknownEffect(schema);
this.options = options;
}
async succeed(input, expected) {
- const r = await Effect.runPromise(this.encodeUnknownEffect(input, this.options?.parseOptions).pipe(Effect.mapError(issue => issue.toString()), Effect.result));
+ const r = await Effect.runPromise(this.encodeUnknownEffect(input, this.options?.parseOptions).pipe(Effect.mapErrorEager(issue => issue.toString()), Effect.result));
expected = arguments.length === 1 ? input : expected;
assert.deepStrictEqual(r, Result.succeed(expected));
}
@@ -413,6 +378,10 @@ class Encoding {
* Asserts that encoding `input` fails and the stringified issue equals
* `message`.
*
+ * **When to use**
+ *
+ * Use to verify that invalid encoding input produces the expected issue text.
+ *
* **Example** (Asserting an encoding failure)
*
* ```ts
@@ -422,17 +391,19 @@ class Encoding {
* const encoding = new TestSchema.Asserts(Schema.NumberFromString).encoding()
* await encoding.fail("not-a-number", "Expected number, got \"not-a-number\"")
* ```
+ *
+ * @see {@link succeed} for asserting successful encoding
*/
async fail(input, message) {
- const r = await Effect.runPromise(this.encodeUnknownEffect(input, this.options?.parseOptions).pipe(Effect.mapError(issue => issue.toString()), Effect.result));
+ const r = await Effect.runPromise(this.encodeUnknownEffect(input, this.options?.parseOptions).pipe(Effect.mapErrorEager(issue => issue.toString()), Effect.result));
assert.deepStrictEqual(r, Result.fail(message));
}
/**
- * Returns a new {@link Encoding} instance with the given service injected
- * into the encoding effect context. Use this when the schema's encoder
- * requires a service dependency.
+ * Returns a new {@link Encoding} instance with the given service injected into the encoding effect context.
+ *
+ * **When to use**
*
- * - Does not mutate the current instance; returns a new one.
+ * Use when the schema's encoder requires a service dependency.
*
* @see {@link Decoding.provide}
*/
diff --git a/.opencode/node_modules/effect/dist/testing/TestSchema.js.map b/.opencode/node_modules/effect/dist/testing/TestSchema.js.map
index b436ca4ed4349ce99bd6763ee9daf18a861401e7..e48fca770e3c8e97d64eafbb140e4f2da4678e06 100644
--- a/.opencode/node_modules/effect/dist/testing/TestSchema.js.map
+++ b/.opencode/node_modules/effect/dist/testing/TestSchema.js.map
@@ -1 +1 @@
-{"version":3,"file":"TestSchema.js","names":["assert","Effect","Record","Result","Schema","AST","Parser","FastCheck","Asserts","ast","fields","equals","a","b","deepStrictEqual","map","getAST","elements","schema","constructor","make","options","makeEffect","succeed","input","expected","r","runPromise","pipe","mapError","issue","toString","result","arguments","length","fail","message","verifyLosslessTransformation","decodeUnknownEffect","encodeEffect","arbitrary","toArbitrary","asyncProperty","t","flatMap","e","params","decoding","Decoding","encoding","Encoding","verifyGeneration","is","arb","property","numRuns","parseOptions","provide","service","implementation","middlewareDecoding","provideService","encodeUnknownEffect","middlewareEncoding"],"sources":["../../src/testing/TestSchema.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoEA,OAAO,KAAKA,MAAM,MAAM,aAAa;AAErC,OAAO,KAAKC,MAAM,MAAM,cAAc;AACtC,OAAO,KAAKC,MAAM,MAAM,cAAc;AACtC,OAAO,KAAKC,MAAM,MAAM,cAAc;AACtC,OAAO,KAAKC,MAAM,MAAM,cAAc;AACtC,OAAO,KAAKC,GAAG,MAAM,iBAAiB;AAEtC,OAAO,KAAKC,MAAM,MAAM,oBAAoB;AAC5C,OAAO,KAAKC,SAAS,MAAM,yBAAyB;AAEpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,OAAM,MAAOC,OAAO;EAClB;;;;;;;;;;;;;;;;;;;;EAoBA,OAAOC,GAAG,GAAG;IACXC,MAAM,EAAE;MACNC,MAAM,EAAEA,CAACC,CAAuB,EAAEC,CAAuB,KAAI;QAC3Db,MAAM,CAACc,eAAe,CAACZ,MAAM,CAACa,GAAG,CAACH,CAAC,EAAEP,GAAG,CAACW,MAAM,CAAC,EAAEd,MAAM,CAACa,GAAG,CAACF,CAAC,EAAER,GAAG,CAACW,MAAM,CAAC,CAAC;MAC9E;KACD;IACDC,QAAQ,EAAE;MACRN,MAAM,EAAEA,CAACC,CAAwB,EAAEC,CAAwB,KAAI;QAC7Db,MAAM,CAACc,eAAe,CAACF,CAAC,CAACG,GAAG,CAACV,GAAG,CAACW,MAAM,CAAC,EAAEH,CAAC,CAACE,GAAG,CAACV,GAAG,CAACW,MAAM,CAAC,CAAC;MAC9D;;GAEM;EAEDE,MAAM;EACfC,YAA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AM,CAACc,eAAe,CAACY,CAAC,EAAEvB,MAAM,CAACoB,OAAO,CAACE,QAAQ,CAAC,CAAC;EACrD;EACA;;;;;;;;;;;;;;EAcA,MAAMU,IAAIA,CAERX,KAAc,EACdY,OAAe;IAEf,MAAMV,CAAC,GAAG,MAAMzB,MAAM,CAAC0B,UAAU,CAC/B,IAAI,CAACmC,mBAAmB,CAACtC,KAAK,EAAE,IAAI,CAACH,OAAO,EAAEmC,YAAY,CAAC,CAAC5B,IAAI,CAC9D3B,MAAM,CAAC4B,QAAQ,CAAEC,KAAK,IAAKA,KAAK,CAACC,QAAQ,EAAE,CAAC,EAC5C9B,MAAM,CAAC+B,MAAM,CACd,CACF;IACDhC,MAAM,CAACc,eAAe,CAACY,CAAC,EAAEvB,MAAM,CAACgC,IAAI,CAACC,OAAO,CAAC,CAAC;EACjD;EACA;;;;;;;;;EASAqB,OAAOA,CACLC,OAAiC,EACjCC,cAAuB;IAEvB,OAAO,IAAIT,QAAQ,CACjB,IAAI,CAAChC,MAAM,CAACU,IAAI,CAACxB,MAAM,CAAC2D,kBAAkB,CAAC9D,MAAM,CAAC4D,cAAc,CAACH,OAAO,EAAEC,cAAc,CAAC,CAAC,CAAC,EAC3F,IAAI,CAACtC,OAAO,CACb;EACH","ignoreList":[]}
\ No newline at end of file
+{"version":3,"file":"TestSchema.js","names":["assert","Effect","Record","Result","Schema","SchemaAST","SchemaParser","FastCheck","Asserts","ast","fields","equals","a","b","deepStrictEqual","map","getAST","elements","schema","constructor","make","options","makeEffect","succeed","input","expected","r","runPromise","pipe","mapErrorEager","issue","toString","result","arguments","length","fail","message","verifyLosslessTransformation","decodeUnknownEffect","encodeEffect","arbitrary","toArbitrary","asyncProperty","t","flatMapEager","e","params","decoding","Decoding","encoding","Encoding","verifyGeneration","is","arb","property","numRuns","parseOptions","provide","service","implementation","middlewareDecoding","provideService","encodeUnknownEffect","middlewareEncoding"],"sources":["../../src/testing/TestSchema.ts"],"sourcesContent":[null],"mappings":"AAAA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,CAACH,OAAO,EAAEmC,YAAY,CAAC,CAAC5B,IAAI,CAC9D3B,MAAM,CAAC4B,aAAa,CAAEC,KAAK,IAAKA,KAAK,CAACC,QAAQ,EAAE,CAAC,EACjD9B,MAAM,CAAC+B,MAAM,CACd,CACF;IACDhC,MAAM,CAACc,eAAe,CAACY,CAAC,EAAEvB,MAAM,CAACgC,IAAI,CAACC,OAAO,CAAC,CAAC;EACjD;EACA;;;;;;;;;EASAqB,OAAOA,CACLC,OAAiC,EACjCC,cAAuB;IAEvB,OAAO,IAAIT,QAAQ,CACjB,IAAI,CAAChC,MAAM,CAACU,IAAI,CAACxB,MAAM,CAAC2D,kBAAkB,CAAC9D,MAAM,CAAC4D,cAAc,CAACH,OAAO,EAAEC,cAAc,CAAC,CAAC,CAAC,EAC3F,IAAI,CAACtC,OAAO,CACb;EACH","ignoreList":[]}
\ No newline at end of file
diff --git a/.opencode/node_modules/effect/dist/testing/index.d.ts b/.opencode/node_modules/effect/dist/testing/index.d.ts
index eedf928a01aa595e400152ead5c8cfb6b7a51e3c..d41f7c72d3ae50d379b4b8673172b6de89e99a66 100644
--- a/.opencode/node_modules/effect/dist/testing/index.d.ts
+++ b/.opencode/node_modules/effect/dist/testing/index.d.ts
@@ -2,14 +2,6 @@
* @since 4.0.0
*/
/**
- * This module provides a re-export of the fast-check library for property-based testing.
- * Fast-check is a property-based testing framework that generates random test cases
- * to validate that properties hold true for a wide range of inputs.
- *
- * Property-based testing is a testing methodology where you specify properties that
- * should hold true for your functions, and the framework generates many random test
- * cases to try to find counterexamples.
- *
* @since 3.10.0
*/
export * as FastCheck from "./FastCheck.ts";
@@ -22,71 +14,6 @@ export * as TestClock from "./TestClock.ts";
*/
export * as TestConsole from "./TestConsole.ts";
/**
- * Testing utilities for asserting Schema decoding, encoding, make, and
- * arbitrary-generation behavior. Used in unit tests to verify that schemas
- * accept, reject, and round-trip values correctly.
- *
- * ## Mental model
- *
- * - **Asserts** – entry point: wraps a schema and exposes helpers grouped by
- * operation (decoding, encoding, make, arbitrary, round-trip).
- * - **Decoding** – returned by `asserts.decoding()`; has `succeed` / `fail`
- * helpers that run the schema's decoder and compare the result.
- * - **Encoding** – returned by `asserts.encoding()`; mirrors {@link Decoding}
- * but exercises the encoder direction.
- * - Every assertion is async (`Promise`) because parsing may involve
- * effectful schemas.
- * - `succeed` with one argument asserts identity (output equals input);
- * with two arguments asserts a specific expected output.
- * - `fail` always takes the input and the expected error message string.
- *
- * ## Common tasks
- *
- * - Assert decoding succeeds / fails → `new Asserts(schema).decoding().succeed(…)` / `.fail(…)`
- * - Assert encoding succeeds / fails → `new Asserts(schema).encoding().succeed(…)` / `.fail(…)`
- * - Assert make succeeds / fails → `new Asserts(schema).make().succeed(…)` / `.fail(…)`
- * - Verify round-trip (encode then decode) → `new Asserts(schema).verifyLosslessTransformation()`
- * - Verify arbitrary generation → `new Asserts(schema).arbitrary().verifyGeneration()`
- * - Compare AST of struct fields → `Asserts.ast.fields.equals(a, b)`
- * - Provide a service dependency for decoding → `asserts.decoding().provide(key, impl)`
- *
- * ## Gotchas
- *
- * - `succeed` uses `assert.deepStrictEqual`, so reference equality is not
- * required but structural equality is.
- * - `fail` compares against the stringified `Issue`, not the `Issue` object
- * itself. Pass the exact multiline string the issue produces.
- * - `verifyLosslessTransformation` and `arbitrary().verifyGeneration` run
- * property-based tests via FastCheck; default run count is 20 for
- * `verifyGeneration`.
- *
- * ## Quickstart
- *
- * **Example** (Basic decoding and encoding assertions)
- *
- * ```ts
- * import { Schema } from "effect"
- * import { TestSchema } from "effect/testing"
- *
- * const schema = Schema.NumberFromString
- * const asserts = new TestSchema.Asserts(schema)
- *
- * // decoding
- * const decoding = asserts.decoding()
- * await decoding.succeed("1", 1)
- * await decoding.fail(null, "Expected string, got null")
- *
- * // encoding
- * const encoding = asserts.encoding()
- * await encoding.succeed(1, "1")
- * ```
- *
- * ## See also
- *
- * - {@link Asserts}
- * - {@link Decoding}
- * - {@link Encoding}
- *
* @since 4.0.0
*/
export * as TestSchema from "./TestSchema.ts";
diff --git a/.opencode/node_modules/effect/dist/testing/index.d.ts.map b/.opencode/node_modules/effect/dist/testing/index.d.ts.map
index 531b8a79df5c9e91e26fd2e0ed623da8ab6d024c..07dc34a474213c3b08682bf55b4bd5f844e198d1 100644
--- a/.opencode/node_modules/effect/dist/testing/index.d.ts.map
+++ b/.opencode/node_modules/effect/dist/testing/index.d.ts.map
@@ -1 +1 @@
-{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;;;;;;;;;GAUG;AACH,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAA;AAE3C;;GAEG;AACH,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAA;AAE3C;;GAEG;AACH,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAA;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmEG;AACH,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA"}
\ No newline at end of file
+{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;GAEG;AACH,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAA;AAE3C;;GAEG;AACH,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAA;AAE3C;;GAEG;AACH,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAA;AAE/C;;GAEG;AACH,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA"}
\ No newline at end of file
diff --git a/.opencode/node_modules/effect/dist/testing/index.js b/.opencode/node_modules/effect/dist/testing/index.js
index 2b807840163992be71f46311b4cddb2cfc1ed521..875d1b4bd437af0633824a3c36eb26fcf1638a20 100644
--- a/.opencode/node_modules/effect/dist/testing/index.js
+++ b/.opencode/node_modules/effect/dist/testing/index.js
@@ -3,14 +3,6 @@
*/
// @barrel: Auto-generated exports. Do not edit manually.
/**
- * This module provides a re-export of the fast-check library for property-based testing.
- * Fast-check is a property-based testing framework that generates random test cases
- * to validate that properties hold true for a wide range of inputs.
- *
- * Property-based testing is a testing methodology where you specify properties that
- * should hold true for your functions, and the framework generates many random test
- * cases to try to find counterexamples.
- *
* @since 3.10.0
*/
export * as FastCheck from "./FastCheck.js";
@@ -23,71 +15,6 @@ export * as TestClock from "./TestClock.js";
*/
export * as TestConsole from "./TestConsole.js";
/**
- * Testing utilities for asserting Schema decoding, encoding, make, and
- * arbitrary-generation behavior. Used in unit tests to verify that schemas
- * accept, reject, and round-trip values correctly.
- *
- * ## Mental model
- *
- * - **Asserts** – entry point: wraps a schema and exposes helpers grouped by
- * operation (decoding, encoding, make, arbitrary, round-trip).
- * - **Decoding** – returned by `asserts.decoding()`; has `succeed` / `fail`
- * helpers that run the schema's decoder and compare the result.
- * - **Encoding** – returned by `asserts.encoding()`; mirrors {@link Decoding}
- * but exercises the encoder direction.
- * - Every assertion is async (`Promise`) because parsing may involve
- * effectful schemas.
- * - `succeed` with one argument asserts identity (output equals input);
- * with two arguments asserts a specific expected output.
- * - `fail` always takes the input and the expected error message string.
- *
- * ## Common tasks
- *
- * - Assert decoding succeeds / fails → `new Asserts(schema).decoding().succeed(…)` / `.fail(…)`
- * - Assert encoding succeeds / fails → `new Asserts(schema).encoding().succeed(…)` / `.fail(…)`
- * - Assert make succeeds / fails → `new Asserts(schema).make().succeed(…)` / `.fail(…)`
- * - Verify round-trip (encode then decode) → `new Asserts(schema).verifyLosslessTransformation()`
- * - Verify arbitrary generation → `new Asserts(schema).arbitrary().verifyGeneration()`
- * - Compare AST of struct fields → `Asserts.ast.fields.equals(a, b)`
- * - Provide a service dependency for decoding → `asserts.decoding().provide(key, impl)`
- *
- * ## Gotchas
- *
- * - `succeed` uses `assert.deepStrictEqual`, so reference equality is not
- * required but structural equality is.
- * - `fail` compares against the stringified `Issue`, not the `Issue` object
- * itself. Pass the exact multiline string the issue produces.
- * - `verifyLosslessTransformation` and `arbitrary().verifyGeneration` run
- * property-based tests via FastCheck; default run count is 20 for
- * `verifyGeneration`.
- *
- * ## Quickstart
- *
- * **Example** (Basic decoding and encoding assertions)
- *
- * ```ts
- * import { Schema } from "effect"
- * import { TestSchema } from "effect/testing"
- *
- * const schema = Schema.NumberFromString
- * const asserts = new TestSchema.Asserts(schema)
- *
- * // decoding
- * const decoding = asserts.decoding()
- * await decoding.succeed("1", 1)
- * await decoding.fail(null, "Expected string, got null")
- *
- * // encoding
- * const encoding = asserts.encoding()
- * await encoding.succeed(1, "1")
- * ```
- *
- * ## See also
- *
- * - {@link Asserts}
- * - {@link Decoding}
- * - {@link Encoding}
- *
* @since 4.0.0
*/
export * as TestSchema from "./TestSchema.js";
diff --git a/.opencode/node_modules/effect/dist/testing/index.js.map b/.opencode/node_modules/effect/dist/testing/index.js.map
index c70dcbcb98691e7db5dc51e39bca9cbc69d8a2d1..f029f848fe6713db64f58f550419550647f122d1 100644
--- a/.opencode/node_modules/effect/dist/testing/index.js.map
+++ b/.opencode/node_modules/effect/dist/testing/index.js.map
@@ -1 +1 @@
-{"version":3,"file":"index.js","names":["FastCheck","TestClock","TestConsole","TestSchema"],"sources":["../../src/testing/index.ts"],"sourcesContent":[null],"mappings":"AAAA;;;AAIA;AAEA;;;;;;;;;;;AAWA,OAAO,KAAKA,SAAS,MAAM,gBAAgB;AAE3C;;;AAGA,OAAO,KAAKC,SAAS,MAAM,gBAAgB;AAE3C;;;AAGA,OAAO,KAAKC,WAAW,MAAM,kBAAkB;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoEA,OAAO,KAAKC,UAAU,MAAM,iBAAiB","ignoreList":[]}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["FastCheck","TestClock","TestConsole","TestSchema"],"sources":["../../src/testing/index.ts"],"sourcesContent":[null],"mappings":"AAAA;;;AAIA;AAEA;;;AAGA,OAAO,KAAKA,SAAS,MAAM,gBAAgB;AAE3C;;;AAGA,OAAO,KAAKC,SAAS,MAAM,gBAAgB;AAE3C;;;AAGA,OAAO,KAAKC,WAAW,MAAM,kBAAkB;AAE/C;;;AAGA,OAAO,KAAKC,UAAU,MAAM,iBAAiB","ignoreList":[]}
\ No newline at end of file
diff --git a/.opencode/node_modules/effect/dist/unstable/ai/AiError.d.ts b/.opencode/node_modules/effect/dist/unstable/ai/AiError.d.ts
index ecbc1c5440f0dbbf2017690ab1891b6894cfd3b6..566fa542c48165ca7024c15e93eb4b555a5de9c8 100644
--- a/.opencode/node_modules/effect/dist/unstable/ai/AiError.d.ts
+++ b/.opencode/node_modules/effect/dist/unstable/ai/AiError.d.ts
@@ -1,82 +1,15 @@
/**
- * The `AiError` module provides comprehensive, provider-agnostic error handling
- * for AI operations.
- *
- * This module uses the `reason` pattern where `AiError` is a top-level
- * wrapper error containing `module`, `method`, and a `reason` field that holds
- * the semantic error. This design enables ergonomic error handling while
- * preserving rich context about failures.
- *
- * ## Semantic Error Categories
- *
- * - **RateLimitError** - Request throttled (429s, provider-specific limits)
- * - **QuotaExhaustedError** - Account/billing limits reached
- * - **AuthenticationError** - Invalid/expired credentials
- * - **ContentPolicyError** - Input/output violated content policy
- * - **InvalidRequestError** - Malformed request parameters
- * - **InvalidUserInputError** - Prompt contains unsupported content
- * - **InternalProviderError** - Provider-side failures (5xx)
- * - **NetworkError** - Transport-level failures
- * - **InvalidOutputError** - LLM output parsing/validation failures
- * - **StructuredOutputError** - LLM generated text that doesn't conform to structured output schema
- * - **UnsupportedSchemaError** - Codec transformer rejected a schema with unsupported constructs
- * - **UnknownError** - Catch-all for unknown errors
- *
- * ## Tool Call Errors
- *
- * - **ToolNotFoundError** - Model requested non-existent tool
- * - **ToolParameterValidationError** - Tool call params failed validation
- * - **InvalidToolResultError** - Tool handler returned invalid result
- * - **ToolResultEncodingError** - Tool result encoding failed
- * - **ToolConfigurationError** - Provider tool misconfigured
- *
- * ## Retryability
- *
- * Each reason type has an `isRetryable` getter indicating whether the error is
- * transient. Some errors also provide a `retryAfter` duration hint.
- *
- * @example
- * ```ts
- * import { Effect, Match } from "effect"
- * import type { AiError } from "effect/unstable/ai"
- *
- * // Handle errors using Match on the reason
- * const handleAiError = Match.type().pipe(
- * Match.when(
- * { reason: { _tag: "RateLimitError" } },
- * (err) => Effect.logWarning(`Rate limited, retry after ${err.retryAfter}`)
- * ),
- * Match.when(
- * { reason: { _tag: "AuthenticationError" } },
- * (err) => Effect.logError(`Auth failed: ${err.reason.kind}`)
- * ),
- * Match.when(
- * { reason: { isRetryable: true } },
- * (err) => Effect.logWarning(`Transient error, retrying: ${err.message}`)
- * ),
- * Match.orElse((err) => Effect.logError(`Permanent error: ${err.message}`))
- * )
- * ```
+ * Defines shared errors for AI operations.
*
- * @example
- * ```ts
- * import { Duration, Effect } from "effect"
- * import { AiError } from "effect/unstable/ai"
- *
- * // Create an AiError with a reason
- * const error = AiError.make({
- * module: "OpenAI",
- * method: "completion",
- * reason: new AiError.RateLimitError({
- * retryAfter: Duration.seconds(60)
- * })
- * })
+ * `AiError` records where a failure happened and stores the detailed reason in a
+ * `reason` field. Those reasons cover transport problems, provider responses,
+ * rate limits, authentication, content policy failures, invalid requests,
+ * invalid output, unsupported schemas, tool failures, invalid user input, and
+ * unknown failures. This module also includes metadata schemas, guards,
+ * constructors, and helpers for converting HTTP response information into AI
+ * error reasons.
*
- * console.log(error.isRetryable) // true
- * console.log(error.message) // "OpenAI.completion: Rate limit exceeded. Retry after 1 minute"
- * ```
- *
- * @since 1.0.0
+ * @since 4.0.0
*/
import * as Duration from "../../Duration.ts";
import * as Schema from "../../Schema.ts";
@@ -97,11 +30,14 @@ declare const NetworkError_base: Schema.Class": {
- * // Provider-specific metadata (e.g. errorCode, requestId, etc.)
- * }
+ * Provider-specific metadata is namespaced by provider name. Each provider
+ * value can contain arbitrary mutable JSON metadata or `null`.
+ *
+ * **Example** (Metadata shape)
+ *
+ * ```ts
+ * const metadata = {
+ * openai: {
+ * errorCode: "rate_limit_exceeded",
+ * requestId: "req_123"
+ * },
+ * anthropic: null
* }
* ```
*
- * @since 1.0.0
* @category schemas
+ * @since 4.0.0
*/
export declare const ProviderMetadata: Schema.$Record>>;
/**
- * @since 1.0.0
+ * Type of provider-specific metadata attached to AI error reasons.
+ *
+ * **Details**
+ *
+ * Metadata is keyed by provider name, and each provider value is either mutable
+ * JSON metadata or `null`.
+ *
* @category models
+ * @since 4.0.0
*/
export type ProviderMetadata = typeof ProviderMetadata.Type;
/**
* Provider-specific metadata attached to `RateLimitError`.
*
- * @since 1.0.0
- * @category provider options
+ * @category configuration
+ * @since 4.0.0
*/
export interface RateLimitErrorMetadata extends ProviderMetadata {
}
/**
* Provider-specific metadata attached to `QuotaExhaustedError`.
*
- * @since 1.0.0
- * @category provider options
+ * @category configuration
+ * @since 4.0.0
*/
export interface QuotaExhaustedErrorMetadata extends ProviderMetadata {
}
/**
* Provider-specific metadata attached to `AuthenticationError`.
*
- * @since 1.0.0
- * @category provider options
+ * @category configuration
+ * @since 4.0.0
*/
export interface AuthenticationErrorMetadata extends ProviderMetadata {
}
/**
* Provider-specific metadata attached to `ContentPolicyError`.
*
- * @since 1.0.0
- * @category provider options
+ * @category configuration
+ * @since 4.0.0
*/
export interface ContentPolicyErrorMetadata extends ProviderMetadata {
}
/**
* Provider-specific metadata attached to `InvalidRequestError`.
*
- * @since 1.0.0
- * @category provider options
+ * @category configuration
+ * @since 4.0.0
*/
export interface InvalidRequestErrorMetadata extends ProviderMetadata {
}
/**
* Provider-specific metadata attached to `InternalProviderError`.
*
- * @since 1.0.0
- * @category provider options
+ * @category configuration
+ * @since 4.0.0
*/
export interface InternalProviderErrorMetadata extends ProviderMetadata {
}
/**
* Provider-specific metadata attached to `InvalidOutputError`.
*
- * @since 1.0.0
- * @category provider options
+ * @category configuration
+ * @since 4.0.0
*/
export interface InvalidOutputErrorMetadata extends ProviderMetadata {
}
/**
* Provider-specific metadata attached to `StructuredOutputError`.
*
- * @since 1.0.0
- * @category provider options
+ * @category configuration
+ * @since 4.0.0
*/
export interface StructuredOutputErrorMetadata extends ProviderMetadata {
}
/**
* Provider-specific metadata attached to `UnsupportedSchemaError`.
*
- * @since 1.0.0
- * @category provider options
+ * @category configuration
+ * @since 4.0.0
*/
export interface UnsupportedSchemaErrorMetadata extends ProviderMetadata {
}
/**
* Provider-specific metadata attached to `UnknownError`.
*
- * @since 1.0.0
- * @category provider options
+ * @category configuration
+ * @since 4.0.0
*/
export interface UnknownErrorMetadata extends ProviderMetadata {
}
/**
- * Token usage information from AI operations.
+ * Schema for token usage information from AI operations.
+ *
+ * **Details**
+ *
+ * Schema for optional provider-reported token counts for prompt tokens,
+ * completion tokens, and total tokens.
*
- * @since 1.0.0
* @category schemas
+ * @since 4.0.0
*/
export declare const UsageInfo: Schema.Struct<{
readonly promptTokens: Schema.optional;
@@ -269,10 +226,23 @@ export declare const UsageInfo: Schema.Struct<{
readonly totalTokens: Schema.optional;
}>;
/**
- * Combined HTTP context for error reporting.
+ * Schema for the combined HTTP context used in error reporting.
+ *
+ * **When to use**
+ *
+ * Use to attach request details, optional response details, and optional body
+ * text to AI provider errors.
+ *
+ * **Details**
+ *
+ * Includes the required request details plus optional response details and raw
+ * response body.
+ *
+ * @see {@link HttpRequestDetails} for captured request details
+ * @see {@link HttpResponseDetails} for captured response details
*
- * @since 1.0.0
* @category schemas
+ * @since 4.0.0
*/
export declare const HttpContext: Schema.Struct<{
readonly request: Schema.Struct<{
@@ -291,7 +261,7 @@ export declare const HttpContext: Schema.Struct<{
declare const RateLimitError_base: Schema.Class;
readonly retryAfter: Schema.optional;
- readonly metadata: Schema.withDecodingDefault>> & Schema.Schema>>;
+ readonly metadata: Schema.withDecodingDefault>> & Schema.Schema>, never>;
readonly http: Schema.optional;
@@ -310,10 +280,13 @@ declare const RateLimitError_base: Schema.Class;
readonly resetAt: Schema.optional;
- readonly metadata: Schema.withDecodingDefault>> & Schema.Schema>>;
+ readonly metadata: Schema.withDecodingDefault>> & Schema.Schema>, never>;
readonly http: Schema.optional;
@@ -364,9 +339,12 @@ declare const QuotaExhaustedError_base: Schema.Class;
readonly kind: Schema.Literals;
- readonly metadata: Schema.withDecodingDefault>> & Schema.Schema>>;
+ readonly metadata: Schema.withDecodingDefault>> & Schema.Schema>, never>;
readonly http: Schema.optional;
@@ -415,9 +395,12 @@ declare const AuthenticationError_base: Schema.Class;
readonly description: Schema.String;
- readonly metadata: Schema.withDecodingDefault>> & Schema.Schema>>;
+ readonly metadata: Schema.withDecodingDefault>> & Schema.Schema>, never>;
readonly http: Schema.optional;
@@ -468,9 +453,12 @@ declare const ContentPolicyError_base: Schema.Class;
readonly constraint: Schema.optional;
readonly description: Schema.optional;
- readonly metadata: Schema.withDecodingDefault>> & Schema.Schema>>;
+ readonly metadata: Schema.withDecodingDefault>> & Schema.Schema>, never>;
readonly http: Schema.optional;
@@ -523,9 +513,12 @@ declare const InvalidRequestError_base: Schema.Class;
readonly description: Schema.String;
- readonly metadata: Schema.withDecodingDefault>> & Schema.Schema>>;
+ readonly metadata: Schema.withDecodingDefault>> & Schema.Schema>, never>;
readonly http: Schema.optional;
@@ -578,9 +573,12 @@ declare const InternalProviderError_base: Schema.Class;
readonly description: Schema.String;
- readonly metadata: Schema.withDecodingDefault>> & Schema.Schema>>;
+ readonly metadata: Schema.withDecodingDefault>> & Schema.Schema>, never>;
readonly usage: Schema.optional;
readonly completionTokens: Schema.optional;
@@ -622,9 +622,12 @@ declare const InvalidOutputError_base: Schema.Class;
readonly description: Schema.String;
readonly responseText: Schema.String;
- readonly metadata: Schema.withDecodingDefault>> & Schema.Schema>>;
+ readonly metadata: Schema.withDecodingDefault>> & Schema.Schema>, never>;
readonly usage: Schema.optional;
readonly completionTokens: Schema.optional;
@@ -685,9 +690,12 @@ declare const StructuredOutputError_base: Schema.Class;
readonly description: Schema.String;
- readonly metadata: Schema.withDecodingDefault>> & Schema.Schema>>;
+ readonly metadata: Schema.withDecodingDefault>> & Schema.Schema>, never>;
}>, import("../../Cause.ts").YieldableError>;
/**
* Error indicating a codec transformer rejected a schema because it contains
* unsupported constructs.
*
+ * **Details**
+ *
* Unsupported schema errors are not retryable because they indicate a
* programmer error where the schema is incompatible with the provider.
*
- * @example
+ * **Example** (Creating an unsupported schema error)
+ *
* ```ts
* import { AiError } from "effect/unstable/ai"
*
@@ -760,18 +773,20 @@ declare const UnsupportedSchemaError_base: Schema.Class;
readonly description: Schema.optional;
- readonly metadata: Schema.withDecodingDefault>> & Schema.Schema>>;
+ readonly metadata: Schema.withDecodingDefault>> & Schema.Schema>, never>;
readonly http: Schema.optional;
@@ -796,11 +811,14 @@ declare const UnknownError_base: Schema.Class>;
}>, import("../../Cause.ts").YieldableError>;
/**
- * Catch-all error for unknown or unexpected errors.
+ * Error data for unknown or unexpected AI failures.
+ *
+ * **Details**
*
* Unknown errors are not retryable by default since the cause is unknown.
*
- * @example
+ * **Example** (Creating an unknown error)
+ *
* ```ts
* import { AiError } from "effect/unstable/ai"
*
@@ -813,18 +831,20 @@ declare const UnknownError_base: Schema.Class;
}>, import("../../Cause.ts").YieldableError>;
/**
- * Top-level AI error wrapper using the `reason` pattern.
+ * Schema for the top-level AI error wrapper using the `reason` pattern.
*
- * This error wraps semantic error reasons and provides:
- * - `module` and `method` context for where the error occurred
- * - `reason` field containing the semantic error type
- * - Delegated `isRetryable` and `retryAfter` to the underlying reason
+ * **When to use**
*
- * Use with `Effect.catchReason` for ergonomic error handling:
+ * Use when you need AI errors that can be handled by semantic reason with
+ * `Effect.catchReason`.
+ *
+ * **Details**
+ *
+ * This error stores `module` and `method` context, the semantic `reason`, and
+ * delegates `isRetryable` and `retryAfter` to the underlying reason.
+ *
+ * **Example** (Handling an AI error by tag)
*
- * @example
* ```ts
* import { Effect } from "effect"
* import { AiError } from "effect/unstable/ai"
@@ -1193,8 +1262,8 @@ declare const AiError_base: Schema.Class u is AiError;
/**
* Type guard to check if a value is an `AiErrorReason`.
*
- * @param u - The value to check
- * @returns `true` if the value is an `AiErrorReason`, `false` otherwise
+ * **Example** (Checking for an AI error reason)
*
- * @example
* ```ts
* import { AiError } from "effect/unstable/ai"
*
@@ -1262,14 +1327,15 @@ export declare const isAiError: (u: unknown) => u is AiError;
* console.log(AiError.isAiErrorReason(genericError)) // false
* ```
*
- * @since 1.0.0
* @category guards
+ * @since 4.0.0
*/
export declare const isAiErrorReason: (u: unknown) => u is AiErrorReason;
/**
* Creates an `AiError` with the given reason.
*
- * @example
+ * **Example** (Creating an AI error)
+ *
* ```ts
* import { Duration } from "effect"
* import { AiError } from "effect/unstable/ai"
@@ -1286,8 +1352,8 @@ export declare const isAiErrorReason: (u: unknown) => u is AiErrorReason;
* // "OpenAI.completion: Rate limit exceeded. Retry after 1 minute"
* ```
*
- * @since 1.0.0
* @category constructors
+ * @since 4.0.0
*/
export declare const make: (params: {
readonly module: string;
@@ -1297,9 +1363,13 @@ export declare const make: (params: {
/**
* Maps HTTP status codes to semantic error reasons.
*
- * Provider packages can use this as a base for provider-specific mapping.
+ * **When to use**
+ *
+ * Use as the base mapping when provider packages translate HTTP status codes into
+ * provider-specific error reasons.
+ *
+ * **Example** (Mapping an HTTP status to a reason)
*
- * @example
* ```ts
* import { AiError } from "effect/unstable/ai"
*
@@ -1311,8 +1381,8 @@ export declare const make: (params: {
* console.log(reason._tag) // "RateLimitError"
* ```
*
- * @since 1.0.0
* @category constructors
+ * @since 4.0.0
*/
export declare const reasonFromHttpStatus: (params: {
readonly status: number;
diff --git a/.opencode/node_modules/effect/dist/unstable/ai/AiError.d.ts.map b/.opencode/node_modules/effect/dist/unstable/ai/AiError.d.ts.map
index 6fe18b329db4edeb249f4143e0029a53cc049b56..abe4c3e0e8cdc0e80882ea0c75ce24a71931cbe1 100644
--- a/.opencode/node_modules/effect/dist/unstable/ai/AiError.d.ts.map
+++ b/.opencode/node_modules/effect/dist/unstable/ai/AiError.d.ts.map
@@ -1 +1 @@
-{"version":3,"file":"AiError.d.ts","sourceRoot":"","sources":["../../../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AAI,CAAC,EAAE,OAAO,WAAW,CAAC,IAAI,CAAA;IACvC,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,gBAAgB,CAAC,IAAI,CAAA;IAChD,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC1C,KAAG,aAsBH,CAAA"}
\ No newline at end of file
diff --git a/.opencode/node_modules/effect/dist/unstable/ai/AiError.js b/.opencode/node_modules/effect/dist/unstable/ai/AiError.js
index 366205913f0db4059f78722d72eabb24b4aa2c0f..c514daf741720fcd3c965c4ce2241d07efed852c 100644
--- a/.opencode/node_modules/effect/dist/unstable/ai/AiError.js
+++ b/.opencode/node_modules/effect/dist/unstable/ai/AiError.js
@@ -1,82 +1,15 @@
/**
- * The `AiError` module provides comprehensive, provider-agnostic error handling
- * for AI operations.
- *
- * This module uses the `reason` pattern where `AiError` is a top-level
- * wrapper error containing `module`, `method`, and a `reason` field that holds
- * the semantic error. This design enables ergonomic error handling while
- * preserving rich context about failures.
- *
- * ## Semantic Error Categories
- *
- * - **RateLimitError** - Request throttled (429s, provider-specific limits)
- * - **QuotaExhaustedError** - Account/billing limits reached
- * - **AuthenticationError** - Invalid/expired credentials
- * - **ContentPolicyError** - Input/output violated content policy
- * - **InvalidRequestError** - Malformed request parameters
- * - **InvalidUserInputError** - Prompt contains unsupported content
- * - **InternalProviderError** - Provider-side failures (5xx)
- * - **NetworkError** - Transport-level failures
- * - **InvalidOutputError** - LLM output parsing/validation failures
- * - **StructuredOutputError** - LLM generated text that doesn't conform to structured output schema
- * - **UnsupportedSchemaError** - Codec transformer rejected a schema with unsupported constructs
- * - **UnknownError** - Catch-all for unknown errors
- *
- * ## Tool Call Errors
- *
- * - **ToolNotFoundError** - Model requested non-existent tool
- * - **ToolParameterValidationError** - Tool call params failed validation
- * - **InvalidToolResultError** - Tool handler returned invalid result
- * - **ToolResultEncodingError** - Tool result encoding failed
- * - **ToolConfigurationError** - Provider tool misconfigured
- *
- * ## Retryability
- *
- * Each reason type has an `isRetryable` getter indicating whether the error is
- * transient. Some errors also provide a `retryAfter` duration hint.
- *
- * @example
- * ```ts
- * import { Effect, Match } from "effect"
- * import type { AiError } from "effect/unstable/ai"
- *
- * // Handle errors using Match on the reason
- * const handleAiError = Match.type().pipe(
- * Match.when(
- * { reason: { _tag: "RateLimitError" } },
- * (err) => Effect.logWarning(`Rate limited, retry after ${err.retryAfter}`)
- * ),
- * Match.when(
- * { reason: { _tag: "AuthenticationError" } },
- * (err) => Effect.logError(`Auth failed: ${err.reason.kind}`)
- * ),
- * Match.when(
- * { reason: { isRetryable: true } },
- * (err) => Effect.logWarning(`Transient error, retrying: ${err.message}`)
- * ),
- * Match.orElse((err) => Effect.logError(`Permanent error: ${err.message}`))
- * )
- * ```
- *
- * @example
- * ```ts
- * import { Duration, Effect } from "effect"
- * import { AiError } from "effect/unstable/ai"
- *
- * // Create an AiError with a reason
- * const error = AiError.make({
- * module: "OpenAI",
- * method: "completion",
- * reason: new AiError.RateLimitError({
- * retryAfter: Duration.seconds(60)
- * })
- * })
+ * Defines shared errors for AI operations.
*
- * console.log(error.isRetryable) // true
- * console.log(error.message) // "OpenAI.completion: Rate limit exceeded. Retry after 1 minute"
- * ```
+ * `AiError` records where a failure happened and stores the detailed reason in a
+ * `reason` field. Those reasons cover transport problems, provider responses,
+ * rate limits, authentication, content policy failures, invalid requests,
+ * invalid output, unsupported schemas, tool failures, invalid user input, and
+ * unknown failures. This module also includes metadata schemas, guards,
+ * constructors, and helpers for converting HTTP response information into AI
+ * error reasons.
*
- * @since 1.0.0
+ * @since 4.0.0
*/
import * as Duration from "../../Duration.js";
import * as Effect from "../../Effect.js";
@@ -103,11 +36,14 @@ const redactHeaders = headers => {
/**
* Error indicating a network-level failure before receiving a response.
*
+ * **Details**
+ *
* This error is raised when issues arise before receiving an HTTP response,
* such as network connectivity problems, request encoding issues, or invalid
* URLs.
*
- * @example
+ * **Example** (Creating a network error)
+ *
* ```ts
* import { AiError } from "effect/unstable/ai"
*
@@ -128,8 +64,8 @@ const redactHeaders = headers => {
* // "Transport: Connection timeout after 30 seconds (POST https://api.openai.com/v1/completions)"
* ```
*
- * @since 1.0.0
* @category reason
+ * @since 4.0.0
*/
export class NetworkError extends /*#__PURE__*/Schema.ErrorClass("effect/ai/AiError/NetworkError")({
_tag: /*#__PURE__*/Schema.tag("NetworkError"),
@@ -138,13 +74,15 @@ export class NetworkError extends /*#__PURE__*/Schema.ErrorClass("effect/ai/AiEr
description: /*#__PURE__*/Schema.optional(Schema.String)
}) {
/**
- * @since 1.0.0
+ * Marks `NetworkError` as a semantic AI error reason for runtime guards.
+ *
+ * @since 4.0.0
*/
[ReasonTypeId] = ReasonTypeId;
/**
* Transport errors are retryable; encoding and URL errors are not.
*
- * @since 1.0.0
+ * @since 4.0.0
*/
get isRetryable() {
return this.reason === "TransportError";
@@ -152,7 +90,8 @@ export class NetworkError extends /*#__PURE__*/Schema.ErrorClass("effect/ai/AiEr
/**
* Creates a NetworkError from a platform HttpClientError.RequestError.
*
- * @example
+ * **Example** (Creating a network error from a request error)
+ *
* ```ts
* import { AiError } from "effect/unstable/ai"
* import type { HttpClientError } from "effect/unstable/http"
@@ -162,8 +101,7 @@ export class NetworkError extends /*#__PURE__*/Schema.ErrorClass("effect/ai/AiEr
* const aiError = AiError.NetworkError.fromRequestError(platformError)
* ```
*
- * @since 1.0.0
- * @category constructors
+ * @since 4.0.0
*/
static fromRequestError(error) {
return new NetworkError({
@@ -214,25 +152,37 @@ export class NetworkError extends /*#__PURE__*/Schema.ErrorClass("effect/ai/AiEr
/**
* Schema for provider-specific metadata which can be attached to error reasons.
*
- * Provider-specific metadata is namespaced by provider and has the structure:
+ * **Details**
*
- * ```
- * {
- * "": {
- * // Provider-specific metadata (e.g. errorCode, requestId, etc.)
- * }
+ * Provider-specific metadata is namespaced by provider name. Each provider
+ * value can contain arbitrary mutable JSON metadata or `null`.
+ *
+ * **Example** (Metadata shape)
+ *
+ * ```ts
+ * const metadata = {
+ * openai: {
+ * errorCode: "rate_limit_exceeded",
+ * requestId: "req_123"
+ * },
+ * anthropic: null
* }
* ```
*
- * @since 1.0.0
* @category schemas
+ * @since 4.0.0
*/
export const ProviderMetadata = /*#__PURE__*/Schema.Record(Schema.String, /*#__PURE__*/Schema.NullOr(Schema.MutableJson));
/**
- * Token usage information from AI operations.
+ * Schema for token usage information from AI operations.
+ *
+ * **Details**
+ *
+ * Schema for optional provider-reported token counts for prompt tokens,
+ * completion tokens, and total tokens.
*
- * @since 1.0.0
* @category schemas
+ * @since 4.0.0
*/
export const UsageInfo = /*#__PURE__*/Schema.Struct({
promptTokens: Schema.optional(Schema.Number),
@@ -242,10 +192,23 @@ export const UsageInfo = /*#__PURE__*/Schema.Struct({
identifier: "UsageInfo"
});
/**
- * Combined HTTP context for error reporting.
+ * Schema for the combined HTTP context used in error reporting.
+ *
+ * **When to use**
+ *
+ * Use to attach request details, optional response details, and optional body
+ * text to AI provider errors.
+ *
+ * **Details**
+ *
+ * Includes the required request details plus optional response details and raw
+ * response body.
+ *
+ * @see {@link HttpRequestDetails} for captured request details
+ * @see {@link HttpResponseDetails} for captured response details
*
- * @since 1.0.0
* @category schemas
+ * @since 4.0.0
*/
export const HttpContext = /*#__PURE__*/Schema.Struct({
request: HttpRequestDetails,
@@ -260,10 +223,13 @@ export const HttpContext = /*#__PURE__*/Schema.Struct({
/**
* Error indicating the request was rate limited.
*
+ * **Details**
+ *
* Rate limit errors are always retryable. When `retryAfter` is provided,
* callers should wait that duration before retrying.
*
- * @example
+ * **Example** (Creating a rate limit error)
+ *
* ```ts
* import { Duration } from "effect"
* import { AiError } from "effect/unstable/ai"
@@ -276,8 +242,8 @@ export const HttpContext = /*#__PURE__*/Schema.Struct({
* console.log(rateLimitError.message) // "Rate limit exceeded. Retry after 1 minute"
* ```
*
- * @since 1.0.0
* @category reason
+ * @since 4.0.0
*/
export class RateLimitError extends /*#__PURE__*/Schema.ErrorClass("effect/ai/AiError/RateLimitError")({
_tag: /*#__PURE__*/Schema.tag("RateLimitError"),
@@ -286,13 +252,15 @@ export class RateLimitError extends /*#__PURE__*/Schema.ErrorClass("effect/ai/Ai
http: /*#__PURE__*/Schema.optional(HttpContext)
}) {
/**
- * @since 1.0.0
+ * Marks `RateLimitError` as a semantic AI error reason for runtime guards.
+ *
+ * @since 4.0.0
*/
[ReasonTypeId] = ReasonTypeId;
/**
* Rate limit errors are always retryable.
*
- * @since 1.0.0
+ * @since 4.0.0
*/
get isRetryable() {
return true;
@@ -306,9 +274,12 @@ export class RateLimitError extends /*#__PURE__*/Schema.ErrorClass("effect/ai/Ai
/**
* Error indicating account or billing limits have been reached.
*
+ * **Details**
+ *
* Quota exhausted errors are not retryable without user action.
*
- * @example
+ * **Example** (Creating a quota exhausted error)
+ *
* ```ts
* import { AiError } from "effect/unstable/ai"
*
@@ -319,8 +290,8 @@ export class RateLimitError extends /*#__PURE__*/Schema.ErrorClass("effect/ai/Ai
* // "Quota exhausted. Check your account billing and usage limits."
* ```
*
- * @since 1.0.0
* @category reason
+ * @since 4.0.0
*/
export class QuotaExhaustedError extends /*#__PURE__*/Schema.ErrorClass("effect/ai/AiError/QuotaExhaustedError")({
_tag: /*#__PURE__*/Schema.tag("QuotaExhaustedError"),
@@ -329,13 +300,15 @@ export class QuotaExhaustedError extends /*#__PURE__*/Schema.ErrorClass("effect/
http: /*#__PURE__*/Schema.optional(HttpContext)
}) {
/**
- * @since 1.0.0
+ * Marks `QuotaExhaustedError` as a semantic AI error reason for runtime guards.
+ *
+ * @since 4.0.0
*/
[ReasonTypeId] = ReasonTypeId;
/**
* Quota exhausted errors require user action and are not retryable.
*
- * @since 1.0.0
+ * @since 4.0.0
*/
get isRetryable() {
return false;
@@ -349,9 +322,12 @@ export class QuotaExhaustedError extends /*#__PURE__*/Schema.ErrorClass("effect/
/**
* Error indicating authentication or authorization failure.
*
+ * **Details**
+ *
* Authentication errors are never retryable without credential changes.
*
- * @example
+ * **Example** (Creating an authentication error)
+ *
* ```ts
* import { AiError } from "effect/unstable/ai"
*
@@ -364,8 +340,8 @@ export class QuotaExhaustedError extends /*#__PURE__*/Schema.ErrorClass("effect/
* // "InvalidKey: Verify your API key is correct"
* ```
*
- * @since 1.0.0
* @category reason
+ * @since 4.0.0
*/
export class AuthenticationError extends /*#__PURE__*/Schema.ErrorClass("effect/ai/AiError/AuthenticationError")({
_tag: /*#__PURE__*/Schema.tag("AuthenticationError"),
@@ -374,13 +350,15 @@ export class AuthenticationError extends /*#__PURE__*/Schema.ErrorClass("effect/
http: /*#__PURE__*/Schema.optional(HttpContext)
}) {
/**
- * @since 1.0.0
+ * Marks `AuthenticationError` as a semantic AI error reason for runtime guards.
+ *
+ * @since 4.0.0
*/
[ReasonTypeId] = ReasonTypeId;
/**
* Authentication errors require credential changes and are not retryable.
*
- * @since 1.0.0
+ * @since 4.0.0
*/
get isRetryable() {
return false;
@@ -399,9 +377,12 @@ export class AuthenticationError extends /*#__PURE__*/Schema.ErrorClass("effect/
/**
* Error indicating content policy violation.
*
+ * **Details**
+ *
* Content policy errors are never retryable without content changes.
*
- * @example
+ * **Example** (Creating a content policy error)
+ *
* ```ts
* import { AiError } from "effect/unstable/ai"
*
@@ -414,8 +395,8 @@ export class AuthenticationError extends /*#__PURE__*/Schema.ErrorClass("effect/
* // "Content policy violation: Input contains prohibited content"
* ```
*
- * @since 1.0.0
* @category reason
+ * @since 4.0.0
*/
export class ContentPolicyError extends /*#__PURE__*/Schema.ErrorClass("effect/ai/AiError/ContentPolicyError")({
_tag: /*#__PURE__*/Schema.tag("ContentPolicyError"),
@@ -424,13 +405,15 @@ export class ContentPolicyError extends /*#__PURE__*/Schema.ErrorClass("effect/a
http: /*#__PURE__*/Schema.optional(HttpContext)
}) {
/**
- * @since 1.0.0
+ * Marks `ContentPolicyError` as a semantic AI error reason for runtime guards.
+ *
+ * @since 4.0.0
*/
[ReasonTypeId] = ReasonTypeId;
/**
* Content policy errors require content changes and are not retryable.
*
- * @since 1.0.0
+ * @since 4.0.0
*/
get isRetryable() {
return false;
@@ -442,9 +425,12 @@ export class ContentPolicyError extends /*#__PURE__*/Schema.ErrorClass("effect/a
/**
* Error indicating the request had invalid or malformed parameters.
*
+ * **Details**
+ *
* Invalid request errors require fixing the request and are not retryable.
*
- * @example
+ * **Example** (Creating an invalid request error)
+ *
* ```ts
* import { AiError } from "effect/unstable/ai"
*
@@ -459,8 +445,8 @@ export class ContentPolicyError extends /*#__PURE__*/Schema.ErrorClass("effect/a
* // "Invalid request: parameter 'temperature' must be between 0 and 2. Temperature value 5 is out of range"
* ```
*
- * @since 1.0.0
* @category reason
+ * @since 4.0.0
*/
export class InvalidRequestError extends /*#__PURE__*/Schema.ErrorClass("effect/ai/AiError/InvalidRequestError")({
_tag: /*#__PURE__*/Schema.tag("InvalidRequestError"),
@@ -471,13 +457,15 @@ export class InvalidRequestError extends /*#__PURE__*/Schema.ErrorClass("effect/
http: /*#__PURE__*/Schema.optional(HttpContext)
}) {
/**
- * @since 1.0.0
+ * Marks `InvalidRequestError` as a semantic AI error reason for runtime guards.
+ *
+ * @since 4.0.0
*/
[ReasonTypeId] = ReasonTypeId;
/**
* Invalid request errors require fixing the request and are not retryable.
*
- * @since 1.0.0
+ * @since 4.0.0
*/
get isRetryable() {
return false;
@@ -493,9 +481,12 @@ export class InvalidRequestError extends /*#__PURE__*/Schema.ErrorClass("effect/
/**
* Error indicating the AI provider experienced an internal error.
*
+ * **Details**
+ *
* Internal provider errors are typically transient and are retryable.
*
- * @example
+ * **Example** (Creating an internal provider error)
+ *
* ```ts
* import { AiError } from "effect/unstable/ai"
*
@@ -508,8 +499,8 @@ export class InvalidRequestError extends /*#__PURE__*/Schema.ErrorClass("effect/
* // "Internal provider error: Server encountered an unexpected error"
* ```
*
- * @since 1.0.0
* @category reason
+ * @since 4.0.0
*/
export class InternalProviderError extends /*#__PURE__*/Schema.ErrorClass("effect/ai/AiError/InternalProviderError")({
_tag: /*#__PURE__*/Schema.tag("InternalProviderError"),
@@ -518,13 +509,15 @@ export class InternalProviderError extends /*#__PURE__*/Schema.ErrorClass("effec
http: /*#__PURE__*/Schema.optional(HttpContext)
}) {
/**
- * @since 1.0.0
+ * Marks `InternalProviderError` as a semantic AI error reason for runtime guards.
+ *
+ * @since 4.0.0
*/
[ReasonTypeId] = ReasonTypeId;
/**
* Internal provider errors are typically transient and are retryable.
*
- * @since 1.0.0
+ * @since 4.0.0
*/
get isRetryable() {
return true;
@@ -536,9 +529,12 @@ export class InternalProviderError extends /*#__PURE__*/Schema.ErrorClass("effec
/**
* Error indicating failure to parse or validate LLM output.
*
+ * **Details**
+ *
* Invalid output errors are retryable since LLM outputs are non-deterministic.
*
- * @example
+ * **Example** (Creating an invalid output error)
+ *
* ```ts
* import { AiError } from "effect/unstable/ai"
*
@@ -551,8 +547,8 @@ export class InternalProviderError extends /*#__PURE__*/Schema.ErrorClass("effec
* // "Invalid output: Expected a string but received a number"
* ```
*
- * @since 1.0.0
* @category reason
+ * @since 4.0.0
*/
export class InvalidOutputError extends /*#__PURE__*/Schema.ErrorClass("effect/ai/AiError/InvalidOutputError")({
_tag: /*#__PURE__*/Schema.tag("InvalidOutputError"),
@@ -561,13 +557,15 @@ export class InvalidOutputError extends /*#__PURE__*/Schema.ErrorClass("effect/a
usage: /*#__PURE__*/Schema.optional(UsageInfo)
}) {
/**
- * @since 1.0.0
+ * Marks `InvalidOutputError` as a semantic AI error reason for runtime guards.
+ *
+ * @since 4.0.0
*/
[ReasonTypeId] = ReasonTypeId;
/**
* Invalid output errors are retryable since LLM outputs are non-deterministic.
*
- * @since 1.0.0
+ * @since 4.0.0
*/
get isRetryable() {
return true;
@@ -575,7 +573,8 @@ export class InvalidOutputError extends /*#__PURE__*/Schema.ErrorClass("effect/a
/**
* Creates an InvalidOutputError from a Schema error.
*
- * @example
+ * **Example** (Creating an invalid output error from a schema error)
+ *
* ```ts
* import { Schema } from "effect"
* import { AiError } from "effect/unstable/ai"
@@ -585,8 +584,7 @@ export class InvalidOutputError extends /*#__PURE__*/Schema.ErrorClass("effect/a
* const parseError = AiError.InvalidOutputError.fromSchemaError(schemaError)
* ```
*
- * @since 1.0.0
- * @category constructors
+ * @since 4.0.0
*/
static fromSchemaError(error) {
return new InvalidOutputError({
@@ -601,9 +599,12 @@ export class InvalidOutputError extends /*#__PURE__*/Schema.ErrorClass("effect/a
* Error indicating the LLM generated text that does not conform to the
* requested structured output schema.
*
+ * **Details**
+ *
* Structured output errors are retryable since LLM outputs are non-deterministic.
*
- * @example
+ * **Example** (Creating a structured output error)
+ *
* ```ts
* import { AiError } from "effect/unstable/ai"
*
@@ -617,8 +618,8 @@ export class InvalidOutputError extends /*#__PURE__*/Schema.ErrorClass("effect/a
* // "Structured output validation failed: Expected a valid JSON object"
* ```
*
- * @since 1.0.0
* @category reason
+ * @since 4.0.0
*/
export class StructuredOutputError extends /*#__PURE__*/Schema.ErrorClass("effect/ai/AiError/StructuredOutputError")({
_tag: /*#__PURE__*/Schema.tag("StructuredOutputError"),
@@ -628,13 +629,15 @@ export class StructuredOutputError extends /*#__PURE__*/Schema.ErrorClass("effec
usage: /*#__PURE__*/Schema.optional(UsageInfo)
}) {
/**
- * @since 1.0.0
+ * Marks `StructuredOutputError` as a semantic AI error reason for runtime guards.
+ *
+ * @since 4.0.0
*/
[ReasonTypeId] = ReasonTypeId;
/**
* Structured output errors are retryable since LLM outputs are non-deterministic.
*
- * @since 1.0.0
+ * @since 4.0.0
*/
get isRetryable() {
return true;
@@ -642,7 +645,8 @@ export class StructuredOutputError extends /*#__PURE__*/Schema.ErrorClass("effec
/**
* Creates a StructuredOutputError from a Schema error.
*
- * @example
+ * **Example** (Creating a structured output error from a schema error)
+ *
* ```ts
* import { Schema } from "effect"
* import { AiError } from "effect/unstable/ai"
@@ -653,8 +657,7 @@ export class StructuredOutputError extends /*#__PURE__*/Schema.ErrorClass("effec
* const parseError = AiError.StructuredOutputError.fromSchemaError(schemaError, rawText)
* ```
*
- * @since 1.0.0
- * @category constructors
+ * @since 4.0.0
*/
static fromSchemaError(error, responseText) {
return new StructuredOutputError({
@@ -670,10 +673,13 @@ export class StructuredOutputError extends /*#__PURE__*/Schema.ErrorClass("effec
* Error indicating a codec transformer rejected a schema because it contains
* unsupported constructs.
*
+ * **Details**
+ *
* Unsupported schema errors are not retryable because they indicate a
* programmer error where the schema is incompatible with the provider.
*
- * @example
+ * **Example** (Creating an unsupported schema error)
+ *
* ```ts
* import { AiError } from "effect/unstable/ai"
*
@@ -686,8 +692,8 @@ export class StructuredOutputError extends /*#__PURE__*/Schema.ErrorClass("effec
* // "Unsupported schema: Unions are not supported in Anthropic structured output"
* ```
*
- * @since 1.0.0
* @category reason
+ * @since 4.0.0
*/
export class UnsupportedSchemaError extends /*#__PURE__*/Schema.ErrorClass("effect/ai/AiError/UnsupportedSchemaError")({
_tag: /*#__PURE__*/Schema.tag("UnsupportedSchemaError"),
@@ -695,13 +701,15 @@ export class UnsupportedSchemaError extends /*#__PURE__*/Schema.ErrorClass("effe
metadata: /*#__PURE__*/providerMetadataWithDefaults()
}) {
/**
- * @since 1.0.0
+ * Marks `UnsupportedSchemaError` as a semantic AI error reason for runtime guards.
+ *
+ * @since 4.0.0
*/
[ReasonTypeId] = ReasonTypeId;
/**
* Unsupported schema errors are not retryable because they indicate a programmer error.
*
- * @since 1.0.0
+ * @since 4.0.0
*/
get isRetryable() {
return false;
@@ -711,11 +719,14 @@ export class UnsupportedSchemaError extends /*#__PURE__*/Schema.ErrorClass("effe
}
}
/**
- * Catch-all error for unknown or unexpected errors.
+ * Error data for unknown or unexpected AI failures.
+ *
+ * **Details**
*
* Unknown errors are not retryable by default since the cause is unknown.
*
- * @example
+ * **Example** (Creating an unknown error)
+ *
* ```ts
* import { AiError } from "effect/unstable/ai"
*
@@ -728,8 +739,8 @@ export class UnsupportedSchemaError extends /*#__PURE__*/Schema.ErrorClass("effe
* // "An unexpected error occurred"
* ```
*
- * @since 1.0.0
* @category reason
+ * @since 4.0.0
*/
export class UnknownError extends /*#__PURE__*/Schema.ErrorClass("effect/ai/AiError/UnknownError")({
_tag: /*#__PURE__*/Schema.tag("UnknownError"),
@@ -738,13 +749,15 @@ export class UnknownError extends /*#__PURE__*/Schema.ErrorClass("effect/ai/AiEr
http: /*#__PURE__*/Schema.optional(HttpContext)
}) {
/**
- * @since 1.0.0
+ * Marks `UnknownError` as a semantic AI error reason for runtime guards.
+ *
+ * @since 4.0.0
*/
[ReasonTypeId] = ReasonTypeId;
/**
* Unknown errors are not retryable by default.
*
- * @since 1.0.0
+ * @since 4.0.0
*/
get isRetryable() {
return false;
@@ -759,10 +772,13 @@ export class UnknownError extends /*#__PURE__*/Schema.ErrorClass("effect/ai/AiEr
/**
* Error indicating the model requested a tool that doesn't exist in the toolkit.
*
+ * **Details**
+ *
* This error is retryable because the model may self-correct when provided
* with the list of available tools.
*
- * @example
+ * **Example** (Creating a tool not found error)
+ *
* ```ts
* import { AiError } from "effect/unstable/ai"
*
@@ -776,8 +792,8 @@ export class UnknownError extends /*#__PURE__*/Schema.ErrorClass("effect/ai/AiEr
* // "Tool 'unknownTool' not found. Available tools: GetWeather, GetTime"
* ```
*
- * @since 1.0.0
* @category reason
+ * @since 4.0.0
*/
export class ToolNotFoundError extends /*#__PURE__*/Schema.ErrorClass("effect/ai/AiError/ToolNotFoundError")({
_tag: /*#__PURE__*/Schema.tag("ToolNotFoundError"),
@@ -785,13 +801,15 @@ export class ToolNotFoundError extends /*#__PURE__*/Schema.ErrorClass("effect/ai
availableTools: /*#__PURE__*/Schema.Array(Schema.String)
}) {
/**
- * @since 1.0.0
+ * Marks `ToolNotFoundError` as a semantic AI error reason for runtime guards.
+ *
+ * @since 4.0.0
*/
[ReasonTypeId] = ReasonTypeId;
/**
* Tool not found errors are retryable because the model may self-correct.
*
- * @since 1.0.0
+ * @since 4.0.0
*/
get isRetryable() {
return true;
@@ -804,10 +822,13 @@ export class ToolNotFoundError extends /*#__PURE__*/Schema.ErrorClass("effect/ai
/**
* Error indicating the model's tool call parameters failed schema validation.
*
+ * **Details**
+ *
* This error is retryable because the model may correct its parameters
* on subsequent attempts.
*
- * @example
+ * **Example** (Creating a tool parameter validation error)
+ *
* ```ts
* import { AiError } from "effect/unstable/ai"
*
@@ -822,8 +843,8 @@ export class ToolNotFoundError extends /*#__PURE__*/Schema.ErrorClass("effect/ai
* // "Invalid parameters for tool 'GetWeather': Expected string, got number"
* ```
*
- * @since 1.0.0
* @category reason
+ * @since 4.0.0
*/
export class ToolParameterValidationError extends /*#__PURE__*/Schema.ErrorClass("effect/ai/AiError/ToolParameterValidationError")({
_tag: /*#__PURE__*/Schema.tag("ToolParameterValidationError"),
@@ -832,13 +853,15 @@ export class ToolParameterValidationError extends /*#__PURE__*/Schema.ErrorClass
description: Schema.String
}) {
/**
- * @since 1.0.0
+ * Marks `ToolParameterValidationError` as a semantic AI error reason for runtime guards.
+ *
+ * @since 4.0.0
*/
[ReasonTypeId] = ReasonTypeId;
/**
* Parameter validation errors are retryable because the model may correct parameters.
*
- * @since 1.0.0
+ * @since 4.0.0
*/
get isRetryable() {
return true;
@@ -851,10 +874,13 @@ export class ToolParameterValidationError extends /*#__PURE__*/Schema.ErrorClass
* Error indicating the tool handler returned an invalid result that does not
* match the tool's schema.
*
+ * **Details**
+ *
* This error is not retryable because invalid results indicate a bug in the
* tool handler implementation.
*
- * @example
+ * **Example** (Creating an invalid tool result error)
+ *
* ```ts
* import { AiError } from "effect/unstable/ai"
*
@@ -868,8 +894,8 @@ export class ToolParameterValidationError extends /*#__PURE__*/Schema.ErrorClass
* // "Tool 'GetWeather' returned invalid result: missing 'temperature' field"
* ```
*
- * @since 1.0.0
* @category reason
+ * @since 4.0.0
*/
export class InvalidToolResultError extends /*#__PURE__*/Schema.ErrorClass("effect/ai/AiError/InvalidToolResultError")({
_tag: /*#__PURE__*/Schema.tag("InvalidToolResultError"),
@@ -877,13 +903,15 @@ export class InvalidToolResultError extends /*#__PURE__*/Schema.ErrorClass("effe
description: Schema.String
}) {
/**
- * @since 1.0.0
+ * Marks `InvalidToolResultError` as a semantic AI error reason for runtime guards.
+ *
+ * @since 4.0.0
*/
[ReasonTypeId] = ReasonTypeId;
/**
* Invalid tool result errors are not retryable because they indicate a bug in the handler.
*
- * @since 1.0.0
+ * @since 4.0.0
*/
get isRetryable() {
return false;
@@ -895,26 +923,29 @@ export class InvalidToolResultError extends /*#__PURE__*/Schema.ErrorClass("effe
/**
* Error indicating the tool result cannot be encoded for sending back to the model.
*
+ * **Details**
+ *
* This error is not retryable because encoding failures indicate a bug in the
* tool schema definitions.
*
- * @example
+ * **Example** (Creating a tool result encoding error)
+ *
* ```ts
* import { AiError } from "effect/unstable/ai"
*
* const error = new AiError.ToolResultEncodingError({
* toolName: "GetWeather",
- * toolResult: { circular: "ref" },
- * description: "Cannot encode circular reference"
+ * toolResult: { temperature: 72n },
+ * description: "Cannot encode bigint values as JSON"
* })
*
* console.log(error.isRetryable) // false
* console.log(error.message)
- * // "Failed to encode result for tool 'GetWeather': Cannot encode circular reference"
+ * // "Failed to encode result for tool 'GetWeather': Cannot encode bigint values as JSON"
* ```
*
- * @since 1.0.0
* @category reason
+ * @since 4.0.0
*/
export class ToolResultEncodingError extends /*#__PURE__*/Schema.ErrorClass("effect/ai/AiError/ToolResultEncodingError")({
_tag: /*#__PURE__*/Schema.tag("ToolResultEncodingError"),
@@ -923,13 +954,15 @@ export class ToolResultEncodingError extends /*#__PURE__*/Schema.ErrorClass("eff
description: Schema.String
}) {
/**
- * @since 1.0.0
+ * Marks `ToolResultEncodingError` as a semantic AI error reason for runtime guards.
+ *
+ * @since 4.0.0
*/
[ReasonTypeId] = ReasonTypeId;
/**
* Encoding errors are not retryable because they indicate a code bug.
*
- * @since 1.0.0
+ * @since 4.0.0
*/
get isRetryable() {
return false;
@@ -941,10 +974,13 @@ export class ToolResultEncodingError extends /*#__PURE__*/Schema.ErrorClass("eff
/**
* Error indicating a provider-defined tool was configured with invalid arguments.
*
+ * **Details**
+ *
* This error is not retryable because it indicates a programming error in the
* tool configuration that must be fixed in code.
*
- * @example
+ * **Example** (Creating a tool configuration error)
+ *
* ```ts
* import { AiError } from "effect/unstable/ai"
*
@@ -958,8 +994,8 @@ export class ToolResultEncodingError extends /*#__PURE__*/Schema.ErrorClass("eff
* // "Invalid configuration for tool 'OpenAiCodeInterpreter': Invalid container ID format"
* ```
*
- * @since 1.0.0
* @category reason
+ * @since 4.0.0
*/
export class ToolConfigurationError extends /*#__PURE__*/Schema.ErrorClass("effect/ai/AiError/ToolConfigurationError")({
_tag: /*#__PURE__*/Schema.tag("ToolConfigurationError"),
@@ -967,13 +1003,15 @@ export class ToolConfigurationError extends /*#__PURE__*/Schema.ErrorClass("effe
description: Schema.String
}) {
/**
- * @since 1.0.0
+ * Marks `ToolConfigurationError` as a semantic AI error reason for runtime guards.
+ *
+ * @since 4.0.0
*/
[ReasonTypeId] = ReasonTypeId;
/**
* Configuration errors are not retryable because they indicate a code bug.
*
- * @since 1.0.0
+ * @since 4.0.0
*/
get isRetryable() {
return false;
@@ -985,10 +1023,13 @@ export class ToolConfigurationError extends /*#__PURE__*/Schema.ErrorClass("effe
/**
* Error indicating an operation requires a toolkit but none was provided.
*
+ * **Details**
+ *
* This error occurs when tool approval responses are present in the prompt
* but no toolkit was provided to resolve them.
*
- * @example
+ * **Example** (Creating a toolkit required error)
+ *
* ```ts
* import { AiError } from "effect/unstable/ai"
*
@@ -1001,8 +1042,8 @@ export class ToolConfigurationError extends /*#__PURE__*/Schema.ErrorClass("effe
* // "Toolkit required to resolve pending tool approvals: GetWeather, SendEmail"
* ```
*
- * @since 1.0.0
* @category reason
+ * @since 4.0.0
*/
export class ToolkitRequiredError extends /*#__PURE__*/Schema.ErrorClass("effect/ai/AiError/ToolkitRequiredError")({
_tag: /*#__PURE__*/Schema.tag("ToolkitRequiredError"),
@@ -1010,13 +1051,15 @@ export class ToolkitRequiredError extends /*#__PURE__*/Schema.ErrorClass("effect
description: /*#__PURE__*/Schema.optional(Schema.String)
}) {
/**
- * @since 1.0.0
+ * Marks `ToolkitRequiredError` as a semantic AI error reason for runtime guards.
+ *
+ * @since 4.0.0
*/
[ReasonTypeId] = ReasonTypeId;
/**
* Toolkit required errors are not retryable without providing a toolkit.
*
- * @since 1.0.0
+ * @since 4.0.0
*/
get isRetryable() {
return false;
@@ -1029,38 +1072,43 @@ export class ToolkitRequiredError extends /*#__PURE__*/Schema.ErrorClass("effect
/**
* Error indicating the user provided invalid input in their prompt.
*
+ * **Details**
+ *
* This error is raised when the prompt contains content that is structurally
* valid but not supported by the provider (e.g., unsupported media types,
* unsupported file formats, etc.).
*
- * @example
+ * **Example** (Creating an invalid user input error)
+ *
* ```ts
* import { AiError } from "effect/unstable/ai"
*
* const error = new AiError.InvalidUserInputError({
- * description: "Unsupported media type 'video/mp4'. Supported types: image/*, application/pdf, text/plain"
+ * description: "Unsupported media type 'video/mp4'. Supported types include images, application/pdf, text/plain"
* })
*
* console.log(error.isRetryable) // false
* console.log(error.message)
- * // "Invalid user input: Unsupported media type 'video/mp4'. Supported types: image/*, application/pdf, text/plain"
+ * // "Invalid user input: Unsupported media type 'video/mp4'. Supported types include images, application/pdf, text/plain"
* ```
*
- * @since 1.0.0
* @category reason
+ * @since 4.0.0
*/
export class InvalidUserInputError extends /*#__PURE__*/Schema.ErrorClass("effect/ai/AiError/InvalidUserInputError")({
_tag: /*#__PURE__*/Schema.tag("InvalidUserInputError"),
description: Schema.String
}) {
/**
- * @since 1.0.0
+ * Marks `InvalidUserInputError` as a semantic AI error reason for runtime guards.
+ *
+ * @since 4.0.0
*/
[ReasonTypeId] = ReasonTypeId;
/**
* Invalid user input errors require fixing the input and are not retryable.
*
- * @since 1.0.0
+ * @since 4.0.0
*/
get isRetryable() {
return false;
@@ -1072,8 +1120,18 @@ export class InvalidUserInputError extends /*#__PURE__*/Schema.ErrorClass("effec
/**
* Schema for validating and parsing AI error reasons.
*
- * @since 1.0.0
+ * **When to use**
+ *
+ * Use when decoding or validating unknown AI error reason values with Schema.
+ *
+ * **Details**
+ *
+ * This runtime schema is the union of the concrete AI error reason classes.
+ *
+ * @see {@link isAiErrorReason} for checking an existing value without Schema decoding
+ *
* @category schemas
+ * @since 4.0.0
*/
export const AiErrorReason = /*#__PURE__*/Schema.Union([RateLimitError, QuotaExhaustedError, AuthenticationError, ContentPolicyError, InvalidRequestError, InternalProviderError, NetworkError, InvalidOutputError, StructuredOutputError, UnsupportedSchemaError, UnknownError, ToolNotFoundError, ToolParameterValidationError, InvalidToolResultError, ToolResultEncodingError, ToolConfigurationError, ToolkitRequiredError, InvalidUserInputError]);
// =============================================================================
@@ -1081,16 +1139,20 @@ export const AiErrorReason = /*#__PURE__*/Schema.Union([RateLimitError, QuotaExh
// =============================================================================
const TypeId = "~effect/unstable/ai/AiError/AiError";
/**
- * Top-level AI error wrapper using the `reason` pattern.
+ * Schema for the top-level AI error wrapper using the `reason` pattern.
*
- * This error wraps semantic error reasons and provides:
- * - `module` and `method` context for where the error occurred
- * - `reason` field containing the semantic error type
- * - Delegated `isRetryable` and `retryAfter` to the underlying reason
+ * **When to use**
*
- * Use with `Effect.catchReason` for ergonomic error handling:
+ * Use when you need AI errors that can be handled by semantic reason with
+ * `Effect.catchReason`.
+ *
+ * **Details**
+ *
+ * This error stores `module` and `method` context, the semantic `reason`, and
+ * delegates `isRetryable` and `retryAfter` to the underlying reason.
+ *
+ * **Example** (Handling an AI error by tag)
*
- * @example
* ```ts
* import { Effect } from "effect"
* import { AiError } from "effect/unstable/ai"
@@ -1108,8 +1170,8 @@ const TypeId = "~effect/unstable/ai/AiError/AiError";
* )
* ```
*
- * @since 1.0.0
* @category schemas
+ * @since 4.0.0
*/
export class AiError extends /*#__PURE__*/Schema.ErrorClass("effect/ai/AiError/AiError")({
_tag: /*#__PURE__*/Schema.tag("AiError"),
@@ -1122,7 +1184,7 @@ export class AiError extends /*#__PURE__*/Schema.ErrorClass("effect/ai/AiError/A
/**
* Delegates to the underlying reason's `isRetryable` getter.
*
- * @since 1.0.0
+ * @since 4.0.0
*/
get isRetryable() {
return this.reason.isRetryable;
@@ -1130,7 +1192,7 @@ export class AiError extends /*#__PURE__*/Schema.ErrorClass("effect/ai/AiError/A
/**
* Delegates to the underlying reason's `retryAfter` if present.
*
- * @since 1.0.0
+ * @since 4.0.0
*/
get retryAfter() {
return "retryAfter" in this.reason ? this.reason.retryAfter : undefined;
@@ -1142,10 +1204,8 @@ export class AiError extends /*#__PURE__*/Schema.ErrorClass("effect/ai/AiError/A
/**
* Type guard to check if a value is an `AiError`.
*
- * @param u - The value to check
- * @returns `true` if the value is an `AiError`, `false` otherwise
+ * **Example** (Checking for an AI error)
*
- * @example
* ```ts
* import { AiError } from "effect/unstable/ai"
*
@@ -1160,17 +1220,15 @@ export class AiError extends /*#__PURE__*/Schema.ErrorClass("effect/ai/AiError/A
* console.log(AiError.isAiError(aiError)) // true
* ```
*
- * @since 1.0.0
* @category guards
+ * @since 4.0.0
*/
export const isAiError = u => Predicate.hasProperty(u, TypeId);
/**
* Type guard to check if a value is an `AiErrorReason`.
*
- * @param u - The value to check
- * @returns `true` if the value is an `AiErrorReason`, `false` otherwise
+ * **Example** (Checking for an AI error reason)
*
- * @example
* ```ts
* import { AiError } from "effect/unstable/ai"
*
@@ -1181,14 +1239,15 @@ export const isAiError = u => Predicate.hasProperty(u, TypeId);
* console.log(AiError.isAiErrorReason(genericError)) // false
* ```
*
- * @since 1.0.0
* @category guards
+ * @since 4.0.0
*/
export const isAiErrorReason = u => Predicate.hasProperty(u, ReasonTypeId);
/**
* Creates an `AiError` with the given reason.
*
- * @example
+ * **Example** (Creating an AI error)
+ *
* ```ts
* import { Duration } from "effect"
* import { AiError } from "effect/unstable/ai"
@@ -1205,16 +1264,20 @@ export const isAiErrorReason = u => Predicate.hasProperty(u, ReasonTypeId);
* // "OpenAI.completion: Rate limit exceeded. Retry after 1 minute"
* ```
*
- * @since 1.0.0
* @category constructors
+ * @since 4.0.0
*/
export const make = params => new AiError(params);
/**
* Maps HTTP status codes to semantic error reasons.
*
- * Provider packages can use this as a base for provider-specific mapping.
+ * **When to use**
+ *
+ * Use as the base mapping when provider packages translate HTTP status codes into
+ * provider-specific error reasons.
+ *
+ * **Example** (Mapping an HTTP status to a reason)
*
- * @example
* ```ts
* import { AiError } from "effect/unstable/ai"
*
@@ -1226,8 +1289,8 @@ export const make = params => new AiError(params);
* console.log(reason._tag) // "RateLimitError"
* ```
*
- * @since 1.0.0
* @category constructors
+ * @since 4.0.0
*/
export const reasonFromHttpStatus = params => {
const {
diff --git a/.opencode/node_modules/effect/dist/unstable/ai/AiError.js.map b/.opencode/node_modules/effect/dist/unstable/ai/AiError.js.map
index c16693b468ea4d08f86ca5c51140f66e2d647f23..c57c5f899b00067072dc12b849cc93a62cf68c3f 100644
--- a/.opencode/node_modules/effect/dist/unstable/ai/AiError.js.map
+++ b/.opencode/node_modules/effect/dist/unstable/ai/AiError.js.map
@@ -1 +1 @@
-{"version":3,"file":"AiError.js","names":["Duration","Effect","Option","Predicate","redact","Redacted","Schema","HttpRequestDetails","HttpResponseDetails","ReasonTypeId","providerMetadataWithDefaults","ProviderMetadata","pipe","withConstructorDefault","succeed","withDecodingDefault","redactHeaders","headers","redacted","result","key","value","isRedacted","toString","NetworkError","ErrorClass","_tag","tag","reason","Literals","request","description","optional","String","isRetryable","fromRequestError","error","hash","getOrUndefined","method","url","urlParams","Array","from","message","methodAndUrl","baseMessage","suggestion","Record","NullOr","MutableJson","UsageInfo","Struct","promptTokens","Number","completionTokens","totalTokens","annotate","identifier","HttpContext","response","body","RateLimitError","retryAfter","metadata","http","msg","format","QuotaExhaustedError","resetAt","DateTimeUtc","AuthenticationError","kind","suggestions","InvalidKey","ExpiredKey","MissingKey","InsufficientPermissions","Unknown","ContentPolicyError","InvalidRequestError","parameter","constraint","InternalProviderError","InvalidOutputError","usage","fromSchemaError","StructuredOutputError","responseText","UnsupportedSchemaError","UnknownError","ToolNotFoundError","toolName","availableTools","length","join","ToolParameterValidationError","toolParams","Json","InvalidToolResultError","ToolResultEncodingError","toolResult","ToolConfigurationError","ToolkitRequiredError","pendingApprovals","tools","InvalidUserInputError","AiErrorReason","Union","TypeId","AiError","module","cause","undefined","isAiError","u","hasProperty","isAiErrorReason","make","params","reasonFromHttpStatus","status","common"],"sources":["../../../src/unstable/ai/AiError.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgFA,OAAO,KAAKA,QAAQ,MAAM,mBAAmB;AAC7C,OAAO,KAAKC,MAAM,MAAM,iBAAiB;AACzC,OAAO,KAAKC,MAAM,MAAM,iBAAiB;AACzC,OAAO,KAAKC,SAAS,MAAM,oBAAoB;AAC/C,SAASC,MAAM,QAAQ,qBAAqB;AAC5C,OAAO,KAAKC,QAAQ,MAAM,mBAAmB;AAC7C,OAAO,KAAKC,MAAM,MAAM,iBAAiB;AAEzC,SAASC,kBAAkB,EAAEC,mBAAmB,QAAQ,eAAe;AAEvE,MAAMC,YAAY,GAAG,oCAA6C;AAElE,MAAMC,4BAA4B,GAAGA,CAAA,KAClCC,gBAAiF,CAACC,IAAI,CACrFN,MAAM,CAACO,sBAAsB,CAACZ,MAAM,CAACa,OAAO,CAAC,EAAE,CAAC,CAAC,EACjDR,MAAM,CAACS,mBAAmB,CAACd,MAAM,CAACa,OAAO,CAAC,EAAE,CAAC,CAAC,CAC/C;AAEH,MAAME,aAAa,GAAIC,OAA+B,IAA4B;EAChF,MAAMC,QAAQ,GAAGd,MAAM,CAACa,OAAO,CAA+C;EAC9E,MAAME,MAAM,GAA2B,EAAE;EACzC,KAAK,MAAMC,GAAG,IAAIF,QAAQ,EAAE;IAC1B,MAAMG,KAAK,GAAGH,QAAQ,CAACE,GAAG,CAAC;IAC3BD,MAAM,CAACC,GAAG,CAAC,GAAGf,QAAQ,CAACiB,UAAU,CAACD,KAAK,CAAC,GAAGA,KAAK,CAACE,QAAQ,EAAE,GAAGF,KAAK;EACrE;EACA,OAAOF,MAAM;AACf,CAAC;AAED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C0C,MAAM,CAAC;IACxC,KAAK,GAAG;MACN,OAAO,IAAInD,mBAAmB,CAAC;QAAEC,IAAI,EAAE,YAAY;QAAE,GAAGkD;MAAM,CAAE,CAAC;IACnE,KAAK,GAAG;MACN,OAAO,IAAInD,mBAAmB,CAAC;QAAEC,IAAI,EAAE,yBAAyB;QAAE,GAAGkD;MAAM,CAAE,CAAC;IAChF,KAAK,GAAG;MACN,OAAO,IAAI5D,cAAc,CAAC4D,MAAM,CAAC;IACnC;MACE,IAAID,MAAM,IAAI,GAAG,EAAE;QACjB,OAAO,IAAItC,qBAAqB,CAAC;UAAEpD,WAAW,EAAE,cAAc;UAAE,GAAG2F;QAAM,CAAE,CAAC;MAC9E;MACA,OAAO,IAAIhC,YAAY,CAACgC,MAAM,CAAC;EACnC;AACF,CAAC","ignoreList":[]}
\ No newline at end of file
+{"version":3,"file":"AiError.js","names":["Duration","Effect","Option","Predicate","redact","Redacted","Schema","HttpRequestDetails","HttpResponseDetails","ReasonTypeId","providerMetadataWithDefaults","ProviderMetadata","pipe","withConstructorDefault","succeed","withDecodingDefault","redactHeaders","headers","redacted","result","key","value","isRedacted","toString","NetworkError","ErrorClass","_tag","tag","reason","Literals","request","description","optional","String","isRetryable","fromRequestError","error","hash","getOrUndefined","method","url","urlParams","Array","from","message","methodAndUrl","baseMessage","suggestion","Record","NullOr","MutableJson","UsageInfo","Struct","promptTokens","Number","completionTokens","totalTokens","annotate","identifier","HttpContext","response","body","RateLimitError","retryAfter","metadata","http","msg","format","QuotaExhaustedError","resetAt","DateTimeUtc","AuthenticationError","kind","suggestions","InvalidKey","ExpiredKey","MissingKey","InsufficientPermissions","Unknown","ContentPolicyError","InvalidRequestError","parameter","constraint","InternalProviderError","InvalidOutputError","usage","fromSchemaError","StructuredOutputError","responseText","UnsupportedSchemaError","UnknownError","ToolNotFoundError","toolName","availableTools","length","join","ToolParameterValidationError","toolParams","Json","InvalidToolResultError","ToolResultEncodingError","toolResult","ToolConfigurationError","ToolkitRequiredError","pendingApprovals","tools","InvalidUserInputError","AiErrorReason","Union","TypeId","AiError","module","cause","undefined","isAiError","u","hasProperty","isAiErrorReason","make","params","reasonFromHttpStatus","status","common"],"sources":["../../../src/unstable/ai/AiError.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;;AAaA,OAAO,KAAKA,QAAQ,MAAM,mBAAmB;AAC7C,OAAO,KAAKC,MAAM,MAAM,iBAAiB;AACzC,OAAO,KAAKC,MAAM,MAAM,iBAAiB;AACzC,OAAO,KAAKC,SAAS,MAAM,oBAAoB;AAC/C,SAASC,MAAM,QAAQ,qBAAqB;AAC5C,OAAO,KAAKC,QAAQ,MAAM,mBAAmB;AAC7C,OAAO,KAAKC,MAAM,MAAM,iBAAiB;AAEzC,SAASC,kBAAkB,EAAEC,mBAAmB,QAAQ,eAAe;AAEvE,MAAMC,YAAY,GAAG,oCAA6C;AAElE,MAAMC,4BAA4B,GAAGA,CAAA,KAClCC,gBAAiF,CAACC,IAAI,CACrFN,MAAM,CAACO,sBAAsB,CAACZ,MAAM,CAACa,OAAO,CAAC,EAAE,CAAC,CAAC,EACjDR,MAAM,CAACS,mBAAmB,CAACd,MAAM,CAACa,OAAO,CAAC,EAAE,CAAC,CAAC,CAC/C;AAEH,MAAME,aAAa,GAAIC,OAA+B,IAA4B;EAChF,MAAMC,QAAQ,GAAGd,MAAM,CAACa,OAAO,CAA+C;EAC9E,MAAME,MAAM,GAA2B,EAAE;EACzC,KAAK,MAAMC,GAAG,IAAIF,QAAQ,EAAE;IAC1B,MAAMG,KAAK,GAAGH,QAAQ,CAACE,GAAG,CAAC;IAC3BD,MAAM,CAACC,GAAG,CAAC,GAAGf,QAAQ,CAACiB,UAAU,CAACD,KAAK,CAAC,GAAGA,KAAK,CAACE,QAAQ,EAAE,GAAGF,KAAK;EACrE;EACA,OAAOF,MAAM;AACf,CAAC;AAED;AACA;AACA;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,OAAM,MA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GkF,SAAS;GAC9C;EACD,QAAQQ,MAAM;IACZ,KAAK,GAAG;MACN,OAAO,IAAIzC,mBAAmB,CAAC0C,MAAM,CAAC;IACxC,KAAK,GAAG;MACN,OAAO,IAAInD,mBAAmB,CAAC;QAAEC,IAAI,EAAE,YAAY;QAAE,GAAGkD;MAAM,CAAE,CAAC;IACnE,KAAK,GAAG;MACN,OAAO,IAAInD,mBAAmB,CAAC;QAAEC,IAAI,EAAE,yBAAyB;QAAE,GAAGkD;MAAM,CAAE,CAAC;IAChF,KAAK,GAAG;MACN,OAAO,IAAI5D,cAAc,CAAC4D,MAAM,CAAC;IACnC;MACE,IAAID,MAAM,IAAI,GAAG,EAAE;QACjB,OAAO,IAAItC,qBAAqB,CAAC;UAAEpD,WAAW,EAAE,cAAc;UAAE,GAAG2F;QAAM,CAAE,CAAC;MAC9E;MACA,OAAO,IAAIhC,YAAY,CAACgC,MAAM,CAAC;EACnC;AACF,CAAC","ignoreList":[]}
\ No newline at end of file
diff --git a/.opencode/node_modules/effect/dist/unstable/ai/AnthropicStructuredOutput.d.ts b/.opencode/node_modules/effect/dist/unstable/ai/AnthropicStructuredOutput.d.ts
index 32b7048976291c61a0bd80ad59aaef4766fb2c5b..5198ebb56c52a196d95cdd00edbd4fc641541ac4 100644
--- a/.opencode/node_modules/effect/dist/unstable/ai/AnthropicStructuredOutput.d.ts
+++ b/.opencode/node_modules/effect/dist/unstable/ai/AnthropicStructuredOutput.d.ts
@@ -1,29 +1,35 @@
import * as JsonSchema from "../../JsonSchema.ts";
import * as Schema from "../../Schema.ts";
/**
- * Transforms a `Schema.Codec` into a form compatible with Anthropic's
- * structured output constraints.
- *
- * The transformation walks the schema AST and rewrites constructs that
- * Anthropic does not support natively:
- *
- * - **Tuples** are converted to objects with numeric string keys (e.g.
- * `"0"`, `"1"`) since Anthropic does not support tuple schemas. Rest
- * elements are placed under a `"__rest__"` key.
- * - **Optional properties** are replaced with `T | null` unions, because
- * Anthropic requires all properties to be present.
- * - **Records** (index signatures) are converted to arrays of `[key, value]`
- * pairs.
- * - **`oneOf` unions** are rewritten as `anyOf` unions.
- * - **Filters and annotations** are preserved where compatible (e.g.
- * `description`, supported `format` values like `"date-time"`, `"email"`,
- * `"uuid"`, etc.), and stripped otherwise.
- *
- * If the schema is already compatible, the original codec is returned
- * unchanged.
- *
- * @since 1.0.0
+ * Converts a `Schema.Codec` to Anthropic structured-output JSON Schema and a
+ * matching codec for model output.
+ *
+ * **When to use**
+ *
+ * Use when you send Effect Schema-backed structured output requests to
+ * Anthropic and need provider-compatible JSON Schema without losing the decoded
+ * application type.
+ *
+ * **Details**
+ *
+ * Returns the JSON Schema to include in the request and the codec to use when
+ * decoding the model response. If the input schema already fits Anthropic's
+ * supported JSON Schema subset, the original codec is returned unchanged.
+ *
+ * **Gotchas**
+ *
+ * - Some schemas use a provider-safe encoded shape: tuples become objects with
+ * numeric string keys, records become arrays of `[key, value]` pairs, and
+ * optional properties become required nullable properties.
+ * - `oneOf` unions are emitted as `anyOf` unions.
+ * - Unsupported schema kinds throw during conversion instead of producing a
+ * lossy schema.
+ *
+ * @see {@link LanguageModel.CodecTransformer} for the structured-output transformer contract
+ * @see {@link OpenAiStructuredOutput.toCodecOpenAI} for the OpenAI-specific transformer
+ *
* @category Codec Transformation
+ * @since 4.0.0
*/
export declare function toCodecAnthropic(schema: Schema.Codec): {
readonly codec: Schema.Codec;
diff --git a/.opencode/node_modules/effect/dist/unstable/ai/AnthropicStructuredOutput.d.ts.map b/.opencode/node_modules/effect/dist/unstable/ai/AnthropicStructuredOutput.d.ts.map
index 0b0ccdc32b786984285c25dbedb9fdae58de9027..806e4b6ca13fb1bec6c90f7bca2c86f3897176b9 100644
--- a/.opencode/node_modules/effect/dist/unstable/ai/AnthropicStructuredOutput.d.ts.map
+++ b/.opencode/node_modules/effect/dist/unstable/ai/AnthropicStructuredOutput.d.ts.map
@@ -1 +1 @@
-{"version":3,"file":"AnthropicStructuredOutput.d.ts","sourceRoot":"","sources":["../../../src/unstable/ai/AnthropicStructuredOutput.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,UAAU,MAAM,qBAAqB,CAAA;AAGjD,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAA;AAKzC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAC3C,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,GACjC;IACD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,CAAC,CAAA;IAChD,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC,UAAU,CAAA;CAC3C,CAUA"}
\ No newline at end of file
+{"version":3,"file":"AnthropicStructuredOutput.d.ts","sourceRoot":"","sources":["../../../src/unstable/ai/AnthropicStructuredOutput.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,UAAU,MAAM,qBAAqB,CAAA;AAGjD,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAA;AAOzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAC3C,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,GACjC;IACD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,CAAC,CAAA;IAChD,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC,UAAU,CAAA;CAC3C,CAYA"}
\ No newline at end of file
diff --git a/.opencode/node_modules/effect/dist/unstable/ai/AnthropicStructuredOutput.js b/.opencode/node_modules/effect/dist/unstable/ai/AnthropicStructuredOutput.js
index 98dc7a8cd354aaac6315dbe1349377d92e8bf3c6..854db1df7014cae52a6f29d6b20c84204cf20f82 100644
--- a/.opencode/node_modules/effect/dist/unstable/ai/AnthropicStructuredOutput.js
+++ b/.opencode/node_modules/effect/dist/unstable/ai/AnthropicStructuredOutput.js
@@ -1,57 +1,61 @@
/**
- * Provides a codec transformation for Anthropic structured output.
+ * Adapts Effect Schema codecs to the JSON Schema subset accepted by Anthropic
+ * structured output.
*
- * Anthropic's API has specific constraints on JSON schema support that differ
- * from the full JSON Schema specification. This module transforms Effect
- * `Schema.Codec` types into a form compatible with Anthropic's structured
- * output requirements by:
+ * The main entry point returns the JSON Schema to send to Anthropic and a codec
+ * for decoding the model response back into the original application type. When
+ * Anthropic cannot express the original schema shape directly, the conversion
+ * rewrites supported cases such as tuples, records, optional properties, and
+ * `oneOf` unions. Schema kinds that cannot be represented throw during
+ * conversion instead of producing a lossy schema.
*
- * - Converting tuples to objects with string keys (tuples are unsupported)
- * - Converting optional properties to nullable unions (`T | null`)
- * - Converting index signatures (records) to arrays of key-value pairs
- * - Converting `oneOf` unions to `anyOf` unions
- * - Stripping unsupported annotations and preserving only Anthropic-compatible
- * formats and descriptions
- *
- * @since 1.0.0
+ * @since 4.0.0
*/
import * as Arr from "../../Array.js";
import * as JsonSchema from "../../JsonSchema.js";
import * as Option from "../../Option.js";
import * as Predicate from "../../Predicate.js";
import * as Schema from "../../Schema.js";
-import * as AST from "../../SchemaAST.js";
-import * as Transformation from "../../SchemaTransformation.js";
+import * as SchemaAST from "../../SchemaAST.js";
+import * as SchemaTransformation from "../../SchemaTransformation.js";
+import * as LanguageModel from "./LanguageModel.js";
+import * as OpenAiStructuredOutput from "./OpenAiStructuredOutput.js";
import * as Tool from "./Tool.js";
/**
- * Transforms a `Schema.Codec` into a form compatible with Anthropic's
- * structured output constraints.
+ * Converts a `Schema.Codec` to Anthropic structured-output JSON Schema and a
+ * matching codec for model output.
+ *
+ * **When to use**
+ *
+ * Use when you send Effect Schema-backed structured output requests to
+ * Anthropic and need provider-compatible JSON Schema without losing the decoded
+ * application type.
+ *
+ * **Details**
+ *
+ * Returns the JSON Schema to include in the request and the codec to use when
+ * decoding the model response. If the input schema already fits Anthropic's
+ * supported JSON Schema subset, the original codec is returned unchanged.
*
- * The transformation walks the schema AST and rewrites constructs that
- * Anthropic does not support natively:
+ * **Gotchas**
*
- * - **Tuples** are converted to objects with numeric string keys (e.g.
- * `"0"`, `"1"`) since Anthropic does not support tuple schemas. Rest
- * elements are placed under a `"__rest__"` key.
- * - **Optional properties** are replaced with `T | null` unions, because
- * Anthropic requires all properties to be present.
- * - **Records** (index signatures) are converted to arrays of `[key, value]`
- * pairs.
- * - **`oneOf` unions** are rewritten as `anyOf` unions.
- * - **Filters and annotations** are preserved where compatible (e.g.
- * `description`, supported `format` values like `"date-time"`, `"email"`,
- * `"uuid"`, etc.), and stripped otherwise.
+ * - Some schemas use a provider-safe encoded shape: tuples become objects with
+ * numeric string keys, records become arrays of `[key, value]` pairs, and
+ * optional properties become required nullable properties.
+ * - `oneOf` unions are emitted as `anyOf` unions.
+ * - Unsupported schema kinds throw during conversion instead of producing a
+ * lossy schema.
*
- * If the schema is already compatible, the original codec is returned
- * unchanged.
+ * @see {@link LanguageModel.CodecTransformer} for the structured-output transformer contract
+ * @see {@link OpenAiStructuredOutput.toCodecOpenAI} for the OpenAI-specific transformer
*
- * @since 1.0.0
* @category Codec Transformation
+ * @since 4.0.0
*/
export function toCodecAnthropic(schema) {
const to = schema.ast;
- const from = recur(AST.toEncoded(to));
- const codec = from === to ? schema : Schema.make(AST.decodeTo(from, to, Transformation.passthrough()));
+ const from = recur(SchemaAST.toEncoded(to));
+ const codec = from === to ? schema : Schema.make(SchemaAST.decodeTo(from, to, SchemaTransformation.passthrough()));
const document = JsonSchema.resolveTopLevel$ref(Schema.toJsonSchemaDocument(codec));
const jsonSchema = {
...document.schema
@@ -90,7 +94,7 @@ function recur(ast) {
filters
} = get(ast);
if (annotations !== undefined || filters !== undefined) {
- return new AST.String(annotations, filters);
+ return new SchemaAST.String(annotations, filters);
}
return ast;
}
@@ -101,7 +105,7 @@ function recur(ast) {
filters
} = get(ast);
if (annotations !== undefined || filters !== undefined) {
- return new AST.Number(annotations, filters);
+ return new SchemaAST.Number(annotations, filters);
}
return ast;
}
@@ -116,7 +120,7 @@ function recur(ast) {
filters
} = get(ast);
if (annotations !== undefined || filters !== undefined) {
- return new AST.Literal(ast.literal, annotations, filters);
+ return new SchemaAST.Literal(ast.literal, annotations, filters);
}
return ast;
}
@@ -125,15 +129,15 @@ function recur(ast) {
case "Union":
{
if (ast.mode === "oneOf") {
- return new AST.Union(ast.types, "anyOf", ast.annotations, ast.checks);
+ return new SchemaAST.Union(ast.types, "anyOf", ast.annotations, ast.checks);
}
- const types = AST.mapOrSame(ast.types, recur);
+ const types = SchemaAST.mapOrSame(ast.types, recur);
const {
annotations,
filters
} = get(ast);
if (types !== ast.types || annotations !== undefined || filters !== undefined) {
- return new AST.Union(types, "anyOf", annotations, filters);
+ return new SchemaAST.Union(types, "anyOf", annotations, filters);
}
return ast;
}
@@ -155,12 +159,12 @@ function recur(ast) {
annotations.description = TUPLE_DESCRIPTION;
}
const propertySignatures = ast.elements.map((e, i) => {
- return new AST.PropertySignature(String(i), e);
+ return new SchemaAST.PropertySignature(String(i), e);
});
if (ast.rest.length === 1) {
- propertySignatures.push(new AST.PropertySignature(REST_PROPERTY_NAME, new AST.Arrays(false, [], ast.rest)));
+ propertySignatures.push(new SchemaAST.PropertySignature(REST_PROPERTY_NAME, new SchemaAST.Arrays(false, [], ast.rest)));
}
- return AST.decodeTo(recur(new AST.Objects(propertySignatures, [], annotations, filters)), ast, Transformation.transform({
+ return SchemaAST.decodeTo(recur(new SchemaAST.Objects(propertySignatures, [], annotations, filters)), ast, SchemaTransformation.transform({
decode: o => {
let t = [];
for (let i = 0; i < ast.elements.length; i++) {
@@ -188,9 +192,9 @@ function recur(ast) {
}
}));
} else {
- const rest = AST.mapOrSame(ast.rest, recur);
+ const rest = SchemaAST.mapOrSame(ast.rest, recur);
if (rest !== ast.rest || annotations !== undefined || filters !== undefined) {
- return new AST.Arrays(false, [], rest, annotations, filters);
+ return new SchemaAST.Arrays(false, [], rest, annotations, filters);
}
return ast;
}
@@ -202,14 +206,14 @@ function recur(ast) {
filters
} = get(ast);
if (ast.indexSignatures.length === 0) {
- const propertySignatures = AST.mapOrSame(ast.propertySignatures, ps => {
+ const propertySignatures = SchemaAST.mapOrSame(ast.propertySignatures, ps => {
if (typeof ps.name !== "string") {
throw new Error(`${errorPrefix}: Property names must be strings (got ${typeof ps.name})`);
}
let type = recur(ps.type);
// opttional properties are not supported by Anthropic, so we translate them to nullable unions
- if (AST.isOptional(ps.type)) {
- type = AST.decodeTo(new AST.Union([type, AST.null], "anyOf"), AST.optionalKey(type), Transformation.transformOptional({
+ if (SchemaAST.isOptional(ps.type)) {
+ type = SchemaAST.decodeTo(new SchemaAST.Union([type, SchemaAST.null], "anyOf"), SchemaAST.optionalKey(type), SchemaTransformation.transformOptional({
decode: Option.filter(Predicate.isNotNull),
encode: Option.orElseSome(() => null)
}));
@@ -217,10 +221,10 @@ function recur(ast) {
if (type === ps.type) {
return ps;
}
- return new AST.PropertySignature(ps.name, type);
+ return new SchemaAST.PropertySignature(ps.name, type);
});
if (propertySignatures !== ast.propertySignatures || annotations !== undefined || filters !== undefined) {
- return new AST.Objects(propertySignatures, [], annotations, filters);
+ return new SchemaAST.Objects(propertySignatures, [], annotations, filters);
}
} else if (ast.indexSignatures.length === 1 && ast.propertySignatures.length === 0) {
const is = ast.indexSignatures[0];
@@ -234,7 +238,7 @@ function recur(ast) {
annotations ??= {};
annotations.description = RECORD_DESCRIPTION;
}
- return AST.decodeTo(recur(new AST.Arrays(false, [], [new AST.Arrays(false, [is.parameter, is.type], [])], annotations)), ast, Transformation.transform({
+ return SchemaAST.decodeTo(recur(new SchemaAST.Arrays(false, [], [new SchemaAST.Arrays(false, [is.parameter, is.type], [])], annotations)), ast, SchemaTransformation.transform({
decode: Object.fromEntries,
encode: Object.entries
}));
diff --git a/.opencode/node_modules/effect/dist/unstable/ai/AnthropicStructuredOutput.js.map b/.opencode/node_modules/effect/dist/unstable/ai/AnthropicStructuredOutput.js.map
index 688e64565bd7a455ac2d2176af958a25da4da95b..f50a486855c0ca7031b2541e2592db016928c252 100644
--- a/.opencode/node_modules/effect/dist/unstable/ai/AnthropicStructuredOutput.js.map
+++ b/.opencode/node_modules/effect/dist/unstable/ai/AnthropicStructuredOutput.js.map
@@ -1 +1 @@
-{"version":3,"file":"AnthropicStructuredOutput.js","names":["Arr","JsonSchema","Option","Predicate","Schema","AST","Transformation","Tool","toCodecAnthropic","schema","to","ast","from","recur","toEncoded","codec","make","decodeTo","passthrough","document","resolveTopLevel$ref","toJsonSchemaDocument","jsonSchema","Object","keys","definitions","length","$defs","_tag","unsupportedAst","annotations","filters","get","undefined","String","Number","literal","Literal","Error","errorPrefix","mode","Union","types","checks","mapOrSame","rest","elements","description","TUPLE_DESCRIPTION","propertySignatures","map","e","i","PropertySignature","push","REST_PROPERTY_NAME","Arrays","Objects","transform","decode","o","t","k","encode","slice","indexSignatures","ps","name","type","isOptional","null","optionalKey","transformOptional","filter","isNotNull","orElseSome","is","isEmptyParamsRecord","RECORD_DESCRIPTION","parameter","fromEntries","entries","details","base","full","getChecks","check","format","isArrayNonEmpty","getFilters","getAnnotations","out","meta","expected","formats","includes","getFilter","concat","resetFilter","regExp","RegExp","annotate","title","flatMap"],"sources":["../../../src/unstable/ai/AnthropicStructuredOutput.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;;;;;;AAiBA,OAAO,KAAKA,GAAG,MAAM,gBAAgB;AACrC,OAAO,KAAKC,UAAU,MAAM,qBAAqB;AACjD,OAAO,KAAKC,MAAM,MAAM,iBAAiB;AACzC,OAAO,KAAKC,SAAS,MAAM,oBAAoB;AAC/C,OAAO,KAAKC,MAAM,MAAM,iBAAiB;AACzC,OAAO,KAAKC,GAAG,MAAM,oBAA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names":["Arr","JsonSchema","Option","Predicate","Schema","SchemaAST","SchemaTransformation","LanguageModel","OpenAiStructuredOutput","Tool","toCodecAnthropic","schema","to","ast","from","recur","toEncoded","codec","make","decodeTo","passthrough","document","resolveTopLevel$ref","toJsonSchemaDocument","jsonSchema","Object","keys","definitions","length","$defs","_tag","unsupportedAst","annotations","filters","get","undefined","String","Number","literal","Literal","Error","errorPrefix","mode","Union","types","checks","mapOrSame","rest","elements","description","TUPLE_DESCRIPTION","propertySignatures","map","e","i","PropertySignature","push","REST_PROPERTY_NAME","Arrays","Objects","transform","decode","o","t","k","encode","slice","indexSignatures","ps","name","type","isOptional","null","optionalKey","transformOptional","filter","isNotNull","orElseSome","is","isEmptyParamsRecord","RECORD_DESCRIPTION","parameter","fromEntries","entries","details","base","full","getChecks","check","format","isArrayNonEmpty","getFilters","getAnnotations","out","meta","expected","formats","includes","getFilter","concat","resetFilter","regExp","RegExp","annotate","title","flatMap"],"sources":["../../../src/unstable/ai/AnthropicStructuredOutput.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;;AAaA,OAAO,KAAKA,GAAG,MAAM,gBAAgB;AACrC,OAAO,KAAKC,UAAU,MAAM,qBAAqB;AACjD,OAAO,KAAKC,MAAM,MAAM,iBAAiB;AACzC,OAAO,KAAKC,SAAS,MAAM,oBAAoB;AAC/C,OAAO,KAAKC,MAAM,MAAM,iBAAiB;AACzC,OAAO,KAAKC,SAAS,MAAM,oBAAoB;AAC/C,OAAO,KAAKC,oBAAoB,MAAM,+BAA+B;AACrE,OAAO,KAAKC,aAAa,MAAM,oBAAoB;AACnD,OAAO,KAAKC,sBAAsB,MAAM,6BAA6B;AACrE,OAAO,KAAKC,IAAI,MAAM,WAAW;AAEjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,OAAM,SAAUC,gBAAgBA,CAC9BC,MAAkC;EAKlC,MAAMC,EAAE,GAAGD,MAAM,CAACE,GAAG;EACrB,MAAMC,IAAI,GAAGC,K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,CAAC;UACzD;QACF;MACA;QAAS;UACPkB,GAAG,GAAGA,GAAG,CAACM,MAAM,CAACnE,WAAW,CAAC;UAC7B;QACF;IACF;IACA,IAAI,QAAQ,IAAI8D,IAAI,IAAIA,IAAI,CAACO,MAAM,YAAYC,MAAM,EAAE;MACrDT,GAAG,CAACrC,IAAI,CAAC;QAAE1B,IAAI,EAAE,QAAQ;QAAE6C,MAAM,EAAEyB,WAAW,CAACzB,MAAM;MAAC,CAAE,CAAC;IAC3D;EACF;EACA,OAAOkB,GAAG;AACZ;AAEA,SAASO,WAAWA,CAACzB,MAA6B;EAChD,OAAOA,MAAM,CAAC4B,QAAQ,CAAC;IACrBtD,WAAW,EAAEd,SAAS;IACtB4D,QAAQ,EAAE5D,SAAS;IACnBqE,KAAK,EAAErE,SAAS;IAChBsD,MAAM,EAAEtD;GACT,CAAC;AACJ;AAEA,SAASwD,UAAUA,CAAC9C,MAAkE;EACpF,OAAOA,MAAM,CAAC4D,OAAO,CAAEjB,KAAK,IAAI;IAC9B,QAAQA,KAAK,CAAC1D,IAAI;MAChB,KAAK,QAAQ;QACX,OAAOoE,SAAS,CAACV,KAAK,CAAC;MACzB,KAAK,aAAa;QAChB,OAAOG,UAAU,CAACH,KAAK,CAAC3C,MAAM,CAAC;IACnC;EACF,CAAC,CAAC;AACJ;AAEA,MAAMmD,OAAO,GAAG,CACd,WAAW,EACX,MAAM,EACN,MAAM,EACN,UAAU,EACV,OAAO,EACP,UAAU,EACV,MAAM,EACN,MAAM,EACN,MAAM,CACP","ignoreList":[]}
\ No newline at end of file
diff --git a/.opencode/node_modules/effect/dist/unstable/ai/Chat.d.ts b/.opencode/node_modules/effect/dist/unstable/ai/Chat.d.ts
index 7117d05bc358f89bcca9d62aaa9c5c533d0bfc1a..0771585066442453da3304641568614a1a6e8c7d 100644
--- a/.opencode/node_modules/effect/dist/unstable/ai/Chat.d.ts
+++ b/.opencode/node_modules/effect/dist/unstable/ai/Chat.d.ts
@@ -15,13 +15,21 @@ import type * as Response from "./Response.ts";
import type * as Tool from "./Tool.ts";
declare const Chat_base: Context.ServiceClass;
/**
- * The `Chat` service tag for dependency injection.
+ * Service tag for stateful AI conversation sessions.
+ *
+ * **When to use**
+ *
+ * Use to access or provide conversational AI sessions through the Effect
+ * context.
+ *
+ * **Details**
*
* This tag provides access to chat functionality throughout your application,
* enabling persistent conversational AI interactions with full context
* management.
*
- * @example
+ * **Example** (Using the Chat service)
+ *
* ```ts
* import { Effect } from "effect"
* import { Chat } from "effect/unstable/ai"
@@ -35,25 +43,37 @@ declare const Chat_base: Context.ServiceClass;
* })
* ```
*
- * @since 4.0.0
* @category services
+ * @since 4.0.0
*/
export declare class Chat extends Chat_base {
}
/**
* Represents the interface that the `Chat` service provides.
*
- * @since 4.0.0
+ * **When to use**
+ *
+ * Use as the service contract for code that receives or constructs a stateful
+ * chat session and needs history, export, text generation, streaming, and
+ * structured-output operations.
+ *
+ * @see {@link Chat} for the context tag that provides this service
+ * @see {@link Persisted} for the persistence-backed extension
+ *
* @category models
+ * @since 4.0.0
*/
export interface Service {
/**
* Reference to the chat history.
*
+ * **Details**
+ *
* Provides direct access to the conversation history for advanced use cases
* like custom history manipulation or inspection.
*
- * @example
+ * **Example** (Inspecting chat history)
+ *
* ```ts
* import { Effect, Ref } from "effect"
* import { Chat } from "effect/unstable/ai"
@@ -70,10 +90,13 @@ export interface Service {
/**
* Exports the chat history into a structured format.
*
+ * **Details**
+ *
* Returns the complete conversation history as a structured object
* that can be stored, transmitted, or processed by other systems.
*
- * @example
+ * **Example** (Exporting chat history)
+ *
* ```ts
* import { Effect } from "effect"
* import { Chat } from "effect/unstable/ai"
@@ -93,10 +116,13 @@ export interface Service {
/**
* Exports the chat history as a JSON string.
*
+ * **Details**
+ *
* Provides a convenient way to serialize the entire conversation
* for storage or transmission in JSON format.
*
- * @example
+ * **Example** (Exporting chat history as JSON)
+ *
* ```ts
* import { Effect } from "effect"
* import { Chat } from "effect/unstable/ai"
@@ -118,11 +144,14 @@ export interface Service {
/**
* Generate text using a language model for the specified prompt.
*
+ * **Details**
+ *
* If a toolkit is specified, the language model will have access to tools
* for function calling and enhanced capabilities. Both input and output
* messages are automatically added to the chat history.
*
- * @example
+ * **Example** (Generating chat responses)
+ *
* ```ts
* import { Effect } from "effect"
* import { Chat } from "effect/unstable/ai"
@@ -160,10 +189,13 @@ export interface Service {
/**
* Generate text using a language model with streaming output.
*
+ * **Details**
+ *
* Returns a stream of response parts that are emitted as soon as they're
* available from the model. Supports tool calling and maintains chat history.
*
- * @example
+ * **Example** (Streaming chat responses)
+ *
* ```ts
* import { Effect, Stream } from "effect"
* import { Chat } from "effect/unstable/ai"
@@ -200,11 +232,14 @@ export interface Service {
/**
* Generate a structured object using a language model and schema.
*
+ * **Details**
+ *
* Forces the model to return data that conforms to the specified schema,
* enabling structured data extraction and type-safe responses. The
* conversation history is maintained across calls.
*
- * @example
+ * **Example** (Generating structured objects)
+ *
* ```ts
* import { Effect, Schema } from "effect"
* import { Chat } from "effect/unstable/ai"
@@ -235,10 +270,13 @@ export interface Service {
/**
* Creates a new Chat service with empty conversation history.
*
- * This is the most common way to start a fresh chat session without
- * any initial context or system prompts.
+ * **When to use**
+ *
+ * Use when you need to start a fresh chat session without initial context or
+ * system prompts.
+ *
+ * **Example** (Creating an empty chat)
*
- * @example
* ```ts
* import { Effect } from "effect"
* import { Chat } from "effect/unstable/ai"
@@ -256,17 +294,20 @@ export interface Service {
* })
* ```
*
- * @since 4.0.0
* @category constructors
+ * @since 4.0.0
*/
export declare const empty: Effect.Effect;
/**
* Creates a new Chat service from an initial prompt.
*
+ * **Details**
+ *
* This is the primary constructor for creating chat instances. It initializes
* a new conversation with the provided prompt as the starting context.
*
- * @example
+ * **Example** (Creating a chat from a system prompt)
+ *
* ```ts
* import { Effect } from "effect"
* import { Chat } from "effect/unstable/ai"
@@ -285,7 +326,8 @@ export declare const empty: Effect.Effect;
* })
* ```
*
- * @example
+ * **Example** (Restoring chat history from a prompt)
+ *
* ```ts
* import { Effect } from "effect"
* import { Chat } from "effect/unstable/ai"
@@ -315,54 +357,70 @@ export declare const empty: Effect.Effect;
* })
* ```
*
- * @since 4.0.0
* @category constructors
+ * @since 4.0.0
*/
export declare const fromPrompt: (prompt: Prompt.RawInput) => Effect.Effect;
/**
* Creates a Chat service from previously exported chat data.
*
+ * **Details**
+ *
* Restores a chat session from structured data that was previously exported
* using the `export` method. Useful for persisting and restoring conversation
* state.
*
- * @example
+ * **Example** (Restoring chat data)
+ *
* ```ts
- * import { Effect } from "effect"
+ * import { Effect, Ref } from "effect"
* import { Chat } from "effect/unstable/ai"
*
- * declare const loadFromDatabase: (sessionId: string) => Effect.Effect
- *
* const restoreChat = Effect.gen(function*() {
- * // Assume we have previously exported data
- * const savedData = yield* loadFromDatabase("chat-session-123")
+ * const originalChat = yield* Chat.fromPrompt([
+ * {
+ * role: "user",
+ * content: "Which library are we using?"
+ * },
+ * {
+ * role: "assistant",
+ * content: "The project uses Effect."
+ * }
+ * ])
*
- * const restoredChat = yield* Chat.fromExport(savedData)
+ * const exported = yield* originalChat.export
+ * const restoredChat = yield* Chat.fromExport(exported)
+ * const restoredHistory = yield* Ref.get(restoredChat.history)
*
- * // Continue the conversation from where it left off
- * const response = yield* restoredChat.generateText({
- * prompt: "Let's continue our discussion"
- * })
- * }).pipe(
- * Effect.catchTag("SchemaError", (error) => {
- * console.log("Failed to restore chat:", error.message)
- * return Effect.void
- * })
- * )
+ * console.log(restoredHistory.content.map((message) => message.role))
+ * // ["user", "assistant"]
+ *
+ * const restoredResponse = restoredHistory.content[1]
+ * if (restoredResponse?.role === "assistant") {
+ * const restoredText = restoredResponse.content[0]
+ * if (restoredText?.type === "text") {
+ * console.log(restoredText.text)
+ * // "The project uses Effect."
+ * }
+ * }
+ * })
* ```
*
- * @since 4.0.0
* @category constructors
+ * @since 4.0.0
*/
export declare const fromExport: (data: unknown) => Effect.Effect;
/**
* Creates a Chat service from previously exported JSON chat data.
*
+ * **Details**
+ *
* Restores a chat session from JSON string that was previously exported
* using the `exportJson` method. This is the most convenient way to
* persist and restore chat sessions to/from storage systems.
*
- * @example
+ * **Example** (Restoring chat history from JSON)
+ *
* ```ts
* import { Effect } from "effect"
* import { Chat } from "effect/unstable/ai"
@@ -388,8 +446,8 @@ export declare const fromExport: (data: unknown) => Effect.Effect Effect.Effect;
declare const ChatNotFoundError_base: Schema.Class, import("../../Cause.ts").YieldableError>;
/**
- * An error that occurs when attempting to retrieve a persisted `Chat` that
+ * Represents an error that occurs when attempting to retrieve a persisted `Chat` that
* does not exist in the backing persistence store.
*
- * @since 4.0.0
+ * **When to use**
+ *
+ * Use to represent a missing persisted conversation when lookup by id cannot
+ * find stored history.
+ *
* @category errors
+ * @since 4.0.0
*/
export declare class ChatNotFoundError extends ChatNotFoundError_base {
}
declare const Persistence_base: Context.ServiceClass;
/**
- * The context tag for chat persistence.
+ * Service tag for persistence-backed AI conversation storage.
+ *
+ * **When to use**
+ *
+ * Use to provide the storage operations needed by persisted conversation
+ * sessions.
*
- * @since 4.0.0
* @category services
+ * @since 4.0.0
*/
export declare class Persistence extends Persistence_base {
}
/**
+ * Namespace containing the service contract for chat persistence.
+ *
* @since 4.0.0
- * @category models
*/
export declare namespace Persistence {
/**
* Represents the backing persistence for a persisted `Chat`. Allows for
* creating and retrieving chats that have been saved to a persistence store.
*
- * @since 4.0.0
* @category models
+ * @since 4.0.0
*/
interface Service {
/**
@@ -449,12 +518,14 @@ export declare namespace Persistence {
/**
* Represents a `Chat` that is backed by persistence.
*
+ * **Details**
+ *
* When calling a text generation method (e.g. `generateText`), the previous
* chat history as well as the relevent response parts will be saved to the
* backing persistence store.
*
- * @since 4.0.0
* @category models
+ * @since 4.0.0
*/
export interface Persisted extends Service {
/**
@@ -469,23 +540,41 @@ export interface Persisted extends Service {
/**
* Creates a new chat persistence service.
*
+ * **When to use**
+ *
+ * Use when you need programmatic persisted chat creation and retrieval backed
+ * by the current `BackingPersistence`.
+ *
+ * **Details**
+ *
* The provided store identifier will be used to indicate which "store" the
* backing persistence should load chats from.
*
- * @since 4.0.0
+ * @see {@link layerPersisted} for the `Layer`-based constructor
+ *
* @category constructors
+ * @since 4.0.0
*/
export declare const makePersisted: (options: {
readonly storeId: string;
}) => Effect.Effect;
/**
- * Creates a `Layer` new chat persistence service.
+ * Creates a `Layer` for a new chat persistence service.
+ *
+ * **When to use**
+ *
+ * Use to provide `Chat.Persistence` from a configured `BackingPersistence` when
+ * your application needs persisted chat sessions backed by a named store.
+ *
+ * **Details**
*
* The provided store identifier will be used to indicate which "store" the
* backing persistence should load chats from.
*
- * @since 4.0.0
+ * @see {@link makePersisted} for the effect constructor when building the service directly instead of providing it as a layer
+ *
* @category constructors
+ * @since 4.0.0
*/
export declare const layerPersisted: (options: {
readonly storeId: string;
diff --git a/.opencode/node_modules/effect/dist/unstable/ai/Chat.d.ts.map b/.opencode/node_modules/effect/dist/unstable/ai/Chat.d.ts.map
index 1554a15f0f1c6ddb32d76777b911346a8a144b50..afc41497404dbbd375d0de4deb9cc373ea2f997d 100644
--- a/.opencode/node_modules/effect/dist/unstable/ai/Chat.d.ts.map
+++ b/.opencode/node_modules/effect/dist/unstable/ai/Chat.d.ts.map
@@ -1 +1 @@
-{"version":3,"file":"Chat.d.ts","sourceRoot":"","sources":["../../../src/unstable/ai/Chat.ts"],"names":[],"mappings":"AAgDA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAA;AAC3C,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAA;AAC7C,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAA;AACzC,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAA;AAGvC,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AACnC,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAA;AAEzC,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAA;AACzC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AACxD,OAAO,KAAK,EAAE,gBAAgB,EA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AAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,GAAG,gBAAgB,CAAC,CAAA;CACvE;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,aAAa;sBACN,MAAM;oGA6IxB,CAAA;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,cAAc,GAAI,SAAS;IACtC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CACzB,KAAG,KAAK,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,EAAE,kBAAkB,CAAsD,CAAA"}
\ No newline at end of file
diff --git a/.opencode/node_modules/effect/dist/unstable/ai/Chat.js b/.opencode/node_modules/effect/dist/unstable/ai/Chat.js
index 929562388b47fee6697e919656b0ffd78cff13bb..c166b4a77246dd7a251c9b71177d519b8500161e 100644
--- a/.opencode/node_modules/effect/dist/unstable/ai/Chat.js
+++ b/.opencode/node_modules/effect/dist/unstable/ai/Chat.js
@@ -1,46 +1,12 @@
/**
- * The `Chat` module provides a stateful conversation interface for AI language
- * models.
+ * Stateful conversation sessions on top of a language model.
*
- * This module enables persistent chat sessions that maintain conversation
- * history, support tool calling, and offer both streaming and non-streaming
- * text generation. It integrates seamlessly with the Effect AI ecosystem,
- * providing type-safe conversational AI capabilities.
- *
- * @example
- * ```ts
- * import { Effect } from "effect"
- * import { Chat } from "effect/unstable/ai"
- *
- * // Create a new chat session
- * const program = Effect.gen(function*() {
- * const chat = yield* Chat.empty
- *
- * // Send a message and get response
- * const response = yield* chat.generateText({
- * prompt: "Hello! What can you help me with?"
- * })
- *
- * console.log(response.content)
- *
- * return response
- * })
- * ```
- *
- * @example
- * ```ts
- * import { Effect, Stream } from "effect"
- * import { Chat } from "effect/unstable/ai"
- *
- * // Streaming chat with tool support
- * const streamingChat = Effect.gen(function*() {
- * const chat = yield* Chat.empty
- *
- * yield* chat.streamText({
- * prompt: "Generate a creative story"
- * }).pipe(Stream.runForEach((part) => Effect.sync(() => console.log(part))))
- * })
- * ```
+ * A `Chat` keeps `Prompt` history in a `Ref` and reuses it for text generation,
+ * streaming, and structured output. Each generation call combines the current
+ * history with the caller's new prompt, invokes the active language model, and
+ * appends the response parts back into history. Constructors create fresh
+ * sessions, seed sessions from prompts, restore exported history, or connect a
+ * chat to persistence.
*
* @since 4.0.0
*/
@@ -62,13 +28,21 @@ import * as IdGenerator from "./IdGenerator.js";
import * as LanguageModel from "./LanguageModel.js";
import * as Prompt from "./Prompt.js";
/**
- * The `Chat` service tag for dependency injection.
+ * Service tag for stateful AI conversation sessions.
+ *
+ * **When to use**
+ *
+ * Use to access or provide conversational AI sessions through the Effect
+ * context.
+ *
+ * **Details**
*
* This tag provides access to chat functionality throughout your application,
* enabling persistent conversational AI interactions with full context
* management.
*
- * @example
+ * **Example** (Using the Chat service)
+ *
* ```ts
* import { Effect } from "effect"
* import { Chat } from "effect/unstable/ai"
@@ -82,8 +56,8 @@ import * as Prompt from "./Prompt.js";
* })
* ```
*
- * @since 4.0.0
* @category services
+ * @since 4.0.0
*/
export class Chat extends /*#__PURE__*/Context.Service()("effect/ai/Chat") {}
const decodeHistory = /*#__PURE__*/Schema.decodeUnknownEffect(Prompt.Prompt);
@@ -155,10 +129,13 @@ const makeUnsafe = history => {
/**
* Creates a new Chat service with empty conversation history.
*
- * This is the most common way to start a fresh chat session without
- * any initial context or system prompts.
+ * **When to use**
+ *
+ * Use when you need to start a fresh chat session without initial context or
+ * system prompts.
+ *
+ * **Example** (Creating an empty chat)
*
- * @example
* ```ts
* import { Effect } from "effect"
* import { Chat } from "effect/unstable/ai"
@@ -176,17 +153,20 @@ const makeUnsafe = history => {
* })
* ```
*
- * @since 4.0.0
* @category constructors
+ * @since 4.0.0
*/
export const empty = /*#__PURE__*/Effect.sync(() => makeUnsafe(Ref.makeUnsafe(Prompt.empty)));
/**
* Creates a new Chat service from an initial prompt.
*
+ * **Details**
+ *
* This is the primary constructor for creating chat instances. It initializes
* a new conversation with the provided prompt as the starting context.
*
- * @example
+ * **Example** (Creating a chat from a system prompt)
+ *
* ```ts
* import { Effect } from "effect"
* import { Chat } from "effect/unstable/ai"
@@ -205,7 +185,8 @@ export const empty = /*#__PURE__*/Effect.sync(() => makeUnsafe(Ref.makeUnsafe(Pr
* })
* ```
*
- * @example
+ * **Example** (Restoring chat history from a prompt)
+ *
* ```ts
* import { Effect } from "effect"
* import { Chat } from "effect/unstable/ai"
@@ -235,54 +216,70 @@ export const empty = /*#__PURE__*/Effect.sync(() => makeUnsafe(Ref.makeUnsafe(Pr
* })
* ```
*
- * @since 4.0.0
* @category constructors
+ * @since 4.0.0
*/
export const fromPrompt = prompt => Effect.sync(() => makeUnsafe(Ref.makeUnsafe(Prompt.make(prompt))));
/**
* Creates a Chat service from previously exported chat data.
*
+ * **Details**
+ *
* Restores a chat session from structured data that was previously exported
* using the `export` method. Useful for persisting and restoring conversation
* state.
*
- * @example
+ * **Example** (Restoring chat data)
+ *
* ```ts
- * import { Effect } from "effect"
+ * import { Effect, Ref } from "effect"
* import { Chat } from "effect/unstable/ai"
*
- * declare const loadFromDatabase: (sessionId: string) => Effect.Effect
- *
* const restoreChat = Effect.gen(function*() {
- * // Assume we have previously exported data
- * const savedData = yield* loadFromDatabase("chat-session-123")
+ * const originalChat = yield* Chat.fromPrompt([
+ * {
+ * role: "user",
+ * content: "Which library are we using?"
+ * },
+ * {
+ * role: "assistant",
+ * content: "The project uses Effect."
+ * }
+ * ])
*
- * const restoredChat = yield* Chat.fromExport(savedData)
+ * const exported = yield* originalChat.export
+ * const restoredChat = yield* Chat.fromExport(exported)
+ * const restoredHistory = yield* Ref.get(restoredChat.history)
*
- * // Continue the conversation from where it left off
- * const response = yield* restoredChat.generateText({
- * prompt: "Let's continue our discussion"
- * })
- * }).pipe(
- * Effect.catchTag("SchemaError", (error) => {
- * console.log("Failed to restore chat:", error.message)
- * return Effect.void
- * })
- * )
+ * console.log(restoredHistory.content.map((message) => message.role))
+ * // ["user", "assistant"]
+ *
+ * const restoredResponse = restoredHistory.content[1]
+ * if (restoredResponse?.role === "assistant") {
+ * const restoredText = restoredResponse.content[0]
+ * if (restoredText?.type === "text") {
+ * console.log(restoredText.text)
+ * // "The project uses Effect."
+ * }
+ * }
+ * })
* ```
*
- * @since 4.0.0
* @category constructors
+ * @since 4.0.0
*/
export const fromExport = data => Effect.flatMap(decodeHistory(data), fromPrompt);
/**
* Creates a Chat service from previously exported JSON chat data.
*
+ * **Details**
+ *
* Restores a chat session from JSON string that was previously exported
* using the `exportJson` method. This is the most convenient way to
* persist and restore chat sessions to/from storage systems.
*
- * @example
+ * **Example** (Restoring chat history from JSON)
+ *
* ```ts
* import { Effect } from "effect"
* import { Chat } from "effect/unstable/ai"
@@ -308,40 +305,59 @@ export const fromExport = data => Effect.flatMap(decodeHistory(data), fromPrompt
* )
* ```
*
- * @since 4.0.0
* @category constructors
+ * @since 4.0.0
*/
export const fromJson = data => Effect.flatMap(decodeHistoryJson(data), fromPrompt);
// =============================================================================
// Chat Persistence
// =============================================================================
/**
- * An error that occurs when attempting to retrieve a persisted `Chat` that
+ * Represents an error that occurs when attempting to retrieve a persisted `Chat` that
* does not exist in the backing persistence store.
*
- * @since 4.0.0
+ * **When to use**
+ *
+ * Use to represent a missing persisted conversation when lookup by id cannot
+ * find stored history.
+ *
* @category errors
+ * @since 4.0.0
*/
export class ChatNotFoundError extends /*#__PURE__*/Schema.ErrorClass("effect/ai/Chat/ChatNotFoundError")({
_tag: /*#__PURE__*/Schema.tag("ChatNotFoundError"),
chatId: Schema.String
}) {}
/**
- * The context tag for chat persistence.
+ * Service tag for persistence-backed AI conversation storage.
+ *
+ * **When to use**
+ *
+ * Use to provide the storage operations needed by persisted conversation
+ * sessions.
*
- * @since 4.0.0
* @category services
+ * @since 4.0.0
*/
// @effect-diagnostics effect/leakingRequirements:off
export class Persistence extends /*#__PURE__*/Context.Service()("effect/ai/Chat/Persisted") {}
/**
* Creates a new chat persistence service.
*
+ * **When to use**
+ *
+ * Use when you need programmatic persisted chat creation and retrieval backed
+ * by the current `BackingPersistence`.
+ *
+ * **Details**
+ *
* The provided store identifier will be used to indicate which "store" the
* backing persistence should load chats from.
*
- * @since 4.0.0
+ * @see {@link layerPersisted} for the `Layer`-based constructor
+ *
* @category constructors
+ * @since 4.0.0
*/
export const makePersisted = /*#__PURE__*/Effect.fnUntraced(function* (options) {
const persistence = yield* BackingPersistence;
@@ -445,13 +461,22 @@ export const makePersisted = /*#__PURE__*/Effect.fnUntraced(function* (options)
});
});
/**
- * Creates a `Layer` new chat persistence service.
+ * Creates a `Layer` for a new chat persistence service.
+ *
+ * **When to use**
+ *
+ * Use to provide `Chat.Persistence` from a configured `BackingPersistence` when
+ * your application needs persisted chat sessions backed by a named store.
+ *
+ * **Details**
*
* The provided store identifier will be used to indicate which "store" the
* backing persistence should load chats from.
*
- * @since 4.0.0
+ * @see {@link makePersisted} for the effect constructor when building the service directly instead of providing it as a layer
+ *
* @category constructors
+ * @since 4.0.0
*/
export const layerPersisted = options => Layer.effect(Persistence)(makePersisted(options));
//# sourceMappingURL=Chat.js.map
\ No newline at end of file
diff --git a/.opencode/node_modules/effect/dist/unstable/ai/Chat.js.map b/.opencode/node_modules/effect/dist/unstable/ai/Chat.js.map
index 9101dae6f353cfd29f21081c527d19464e52b022..9b38d99879c9244ebfc0f19e20c4a9fafeb6817f 100644
--- a/.opencode/node_modules/effect/dist/unstable/ai/Chat.js.map
+++ b/.opencode/node_modules/effect/dist/unstable/ai/Chat.js.map
@@ -1 +1 @@
-{"version":3,"file":"Chat.js","names":["Channel","Chunk","Context","Duration","Effect","Layer","Option","Predicate","Ref","Schema","Semaphore","Stream","BackingPersistence","AiError","IdGenerator","LanguageModel","Prompt","Chat","Service","decodeHistory","decodeUnknownEffect","encodeHistory","encodeUnknownEffect","decodeHistoryJson","fromJsonString","encodeHistoryJson","makeUnsafe","history","semaphore","of","export","get","pipe","flatMap","catchTag","error","fail","make","module","method","reason","InvalidOutputError","fromSchemaError","withSpan","exportJson","generateText","fnUntraced","options","newPrompt","prompt","oldPrompt","concat","response","newHistory","fromResponseParts","content","set","withPermits","effect","captureStackTrace","streamText","parts","empty","fromChannel","acquireUseRelease","take","map","mapArray","chunk","appendAll","fromArrayUnsafe","toChannel","andThen","Array","from","release","unwrap","generateObject","attributes","objectName","getObjectName","schema","sync","fromPrompt","fromExport","data","fromJson","ChatNotFoundError","ErrorClass","_tag","tag","chatId","String","Persistence","makePersisted","persistence","store","storeId","toPersisted","chat","ttl","idGenerator","serviceOption","getOrElse","defaultIdGenerator","saveChat","prevHistory","lastMessage","length","messageId","undefined","isNotUndefined","role","key","isUndefined","generateId","i","message","exported","orDie","timeToLive","getOrUndefined","fromInput","persisted","id","save","ensuring","stream","createChat","getChat","previousHistory","die","getOrCreate","layerPersisted"],"sources":["../../../src/unstable/ai/Chat.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8CA,OAAO,KAAKA,OAAO,MAAM,kBAAkB;AAC3C,OAAO,KAAKC,KAAK,MAAM,gBAAgB;AACvC,OAAO,KAAKC,OAAO,MAAM,kBAAkB;AAC3C,OAAO,KAAKC,QAAQ,MAAM,mBAAmB;AAC7C,OAAO,KAAKC,MAAM,MAAM,iBAAiB;AACzC,OAAO,KAAKC,KAAK,MAAM,gBAAgB;AACvC,OAAO,KAAKC,MAAM,MAAM,iBAAiB;AACzC,OAAO,KAAKC,SAAS,MAAM,oBAAoB;AAC/C,OAAO,KAAKC,GAAG,MAAM,cAAc;AACnC,OAAO,KAAKC,MAAM,MAAM,iBAAiB;AACzC,OAAO,KAAKC,SAAS,MAAM,oBAAoB;AAC/C,OAAO,KAAKC,MAAM,MAAM,iBAAiB;AAGzC,SAASC,kBAAkB,QAAQ,+BAA+B;AAClE,OAAO,KAAKC,OAAO,MAAM,cAAc;AACvC,OAAO,KAAKC,WAAW,MAAM,kBAAkB;AAC/C,OAAO,KAAKC,aAAa,MAAM,oBAAoB;AACnD,OAAO,KAAKC,MAA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js","names":["Channel","Chunk","Context","Duration","Effect","Layer","Option","Predicate","Ref","Schema","Semaphore","Stream","BackingPersistence","AiError","IdGenerator","LanguageModel","Prompt","Chat","Service","decodeHistory","decodeUnknownEffect","encodeHistory","encodeUnknownEffect","decodeHistoryJson","fromJsonString","encodeHistoryJson","makeUnsafe","history","semaphore","of","export","get","pipe","flatMap","catchTag","error","fail","make","module","method","reason","InvalidOutputError","fromSchemaError","withSpan","exportJson","generateText","fnUntraced","options","newPrompt","prompt","oldPrompt","concat","response","newHistory","fromResponseParts","content","set","withPermits","effect","captureStackTrace","streamText","parts","empty","fromChannel","acquireUseRelease","take","map","mapArray","chunk","appendAll","fromArrayUnsafe","toChannel","andThen","Array","from","release","unwrap","generateObject","attributes","objectName","getObjectName","schema","sync","fromPrompt","fromExport","data","fromJson","ChatNotFoundError","ErrorClass","_tag","tag","chatId","String","Persistence","makePersisted","persistence","store","storeId","toPersisted","chat","ttl","idGenerator","serviceOption","getOrElse","defaultIdGenerator","saveChat","prevHistory","lastMessage","length","messageId","undefined","isNotUndefined","role","key","isUndefined","generateId","i","message","exported","orDie","timeToLive","getOrUndefined","fromInput","persisted","id","save","ensuring","stream","createChat","getChat","previousHistory","die","getOrCreate","layerPersisted"],"sources":["../../../src/unstable/ai/Chat.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;AAYA,OAAO,KAAKA,OAAO,MAAM,kBAAkB;AAC3C,OAAO,KAAKC,KAAK,MAAM,gBAAgB;AACvC,OAAO,KAAKC,OAAO,MAAM,kBAAkB;AAC3C,OAAO,KAAKC,QAAQ,MAAM,mBAAmB;AAC7C,OAAO,KAAKC,MAAM,MAAM,iBAAiB;AACzC,OAAO,KAAKC,KAAK,MAAM,gBAAgB;AACvC,OAAO,KAAKC,MAAM,MAAM,iBAAiB;AACzC,OAAO,KAAKC,SAAS,MAAM,oBAAoB;AAC/C,OAAO,KAAKC,GAAG,MAAM,cAAc;AACnC,OAAO,KAAKC,MAAM,MAAM,iBA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E,2BAA2B,EAAE;IACnDC,iBAAiB,EAAE;GACpB,CAAC,CACL;EAED,OAAOkC,WAAW,CAAChE,EAAE,CAAC;IACpBE,GAAG;IACHqG;GACD,CAAC;AACJ,CAAC,CAAC;AAEF;;;;;;;;;;;;;;;;;;AAkBA,OAAO,MAAMC,cAAc,GAAItF,OAE9B,IAA0D1C,KAAK,CAACqD,MAAM,CAACmC,WAAW,CAAC,CAACC,aAAa,CAAC/C,OAAO,CAAC,CAAC","ignoreList":[]}
\ No newline at end of file
diff --git a/.opencode/node_modules/effect/dist/unstable/ai/EmbeddingModel.d.ts b/.opencode/node_modules/effect/dist/unstable/ai/EmbeddingModel.d.ts
index 41eb90a309453a7719170daf983e9affd949bd44..d27a38c68c209a4b29fafc098c8cc675e43412f3 100644
--- a/.opencode/node_modules/effect/dist/unstable/ai/EmbeddingModel.d.ts
+++ b/.opencode/node_modules/effect/dist/unstable/ai/EmbeddingModel.d.ts
@@ -1,16 +1,12 @@
/**
- * The `EmbeddingModel` module provides provider-agnostic text embedding capabilities.
+ * Defines the provider-neutral service for text embeddings.
*
- * @example
- * ```ts
- * import { Effect } from "effect"
- * import { EmbeddingModel } from "effect/unstable/ai"
- *
- * const program = Effect.gen(function*() {
- * const model = yield* EmbeddingModel.EmbeddingModel
- * return yield* model.embed("hello world")
- * })
- * ```
+ * An `EmbeddingModel` turns text into numeric vectors. It supports single-input
+ * embedding and ordered batch embedding, and represents provider failures as
+ * `AiError` values. This module also includes the embedding dimensions service,
+ * request and response models, usage metadata, provider contracts, and a
+ * constructor that adapts a provider batch implementation into the service.
+ * Single `embed` calls can be batched together internally.
*
* @since 4.0.0
*/
@@ -24,8 +20,17 @@ declare const EmbeddingModel_base: Context.ServiceClass;
}>, {}>;
/**
- * Token usage metadata for embedding operations.
+ * Represents token usage metadata for embedding operations.
+ *
+ * **Details**
+ *
+ * Contains optional provider-reported `inputTokens`. The value may be
+ * `undefined` when the provider does not report usage or when `embedMany([])`
+ * bypasses the provider.
*
- * @since 4.0.0
* @category models
+ * @since 4.0.0
*/
export declare class EmbeddingUsage extends EmbeddingUsage_base {
}
@@ -55,8 +73,8 @@ declare const EmbedResponse_base: Schema.Class, {}>;
/**
- * Response for multiple embeddings.
+ * Response for batch embedding requests containing per-input embeddings and usage
+ * metadata.
+ *
+ * **Details**
+ *
+ * `embeddings` preserves batch order, and `usage` carries token metadata for
+ * the operation.
+ *
+ * @see {@link EmbedResponse} for individual embedding responses
+ * @see {@link EmbeddingUsage} for token usage metadata
*
- * @since 4.0.0
* @category models
+ * @since 4.0.0
*/
export declare class EmbedManyResponse extends EmbedManyResponse_base {
}
/**
* Provider input options for embedding requests.
*
+ * @category options
* @since 4.0.0
- * @category models
*/
export interface ProviderOptions {
readonly inputs: ReadonlyArray;
@@ -84,8 +111,8 @@ export interface ProviderOptions {
/**
* Provider response for batch embedding requests.
*
- * @since 4.0.0
* @category models
+ * @since 4.0.0
*/
export interface ProviderResponse {
readonly results: Array>;
@@ -97,20 +124,29 @@ declare const EmbeddingRequest_base: new , Success
readonly _tag: "EmbeddingRequest";
};
/**
- * Tagged request used by request resolvers for embedding operations.
+ * Represents a tagged request used by request resolvers for embedding operations.
+ *
+ * **When to use**
+ *
+ * Use when you need a typed request for one embedding input while building or
+ * calling a low-level embedding request resolver.
+ *
+ * @see {@link Service} for the resolver-bearing service contract
+ * @see {@link make} for constructing the request resolver from a provider implementation
+ * @see {@link EmbedResponse} for the response produced by this request
*
- * @since 4.0.0
* @category constructors
+ * @since 4.0.0
*/
export declare class EmbeddingRequest extends EmbeddingRequest_base<{
readonly input: string;
}, EmbedResponse, AiError.AiError> {
}
/**
- * Service interface for embedding operations.
+ * Defines the service interface for embedding operations.
*
- * @since 4.0.0
* @category models
+ * @since 4.0.0
*/
export interface Service {
readonly resolver: RequestResolver.RequestResolver;
@@ -120,8 +156,32 @@ export interface Service {
/**
* Creates an EmbeddingModel service from a provider embedMany implementation.
*
- * @since 4.0.0
+ * **When to use**
+ *
+ * Use to adapt a provider's batch embedding implementation into an
+ * `EmbeddingModel.Service` that offers single-input and batch embedding
+ * operations.
+ *
+ * **Details**
+ *
+ * The returned service builds single-input `embed` calls through a request
+ * resolver, so concurrent `embed` requests can be batched into one provider
+ * `embedMany` call. Direct `embedMany` calls pass the input array to the
+ * provider, while `embedMany([])` returns an empty response without calling the
+ * provider.
+ *
+ * **Gotchas**
+ *
+ * Provider responses are interpreted positionally and must contain exactly one
+ * result for each requested input. If the provider returns a different number
+ * of results, `embed` and `embedMany` fail with `AiError.InvalidOutputError`.
+ *
+ * @see {@link Service} for the service shape returned by this constructor
+ * @see {@link ProviderOptions} for the input passed to the provider implementation
+ * @see {@link ProviderResponse} for the provider response contract consumed by this constructor
+ *
* @category constructors
+ * @since 4.0.0
*/
export declare const make: (params: {
readonly embedMany: (options: ProviderOptions) => Effect.Effect;
diff --git a/.opencode/node_modules/effect/dist/unstable/ai/EmbeddingModel.d.ts.map b/.opencode/node_modules/effect/dist/unstable/ai/EmbeddingModel.d.ts.map
index 30c99a8b2bfb643b043547bca956f4c5b2fc3514..9f7776f7e3e85f9b6a8b66b0a0e0a4f7c5517ed6 100644
--- a/.opencode/node_modules/effect/dist/unstable/ai/EmbeddingModel.d.ts.map
+++ b/.opencode/node_modules/effect/dist/unstable/ai/EmbeddingModel.d.ts.map
@@ -1 +1 @@
-{"version":3,"file":"EmbeddingModel.d.ts","sourceRoot":"","sources":["../../../src/unstable/ai/EmbeddingModel.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAA;AAC3C,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAA;AAEzC,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAA;AAC3C,OAAO,KAAK,eAAe,MAAM,0BAA0B,CAAA;AAC3D,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAA;AACzC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;;AAEvC;;;;;GAKG;AACH,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zC,CAAA;CACF;;;;AAED;;;;;;;;;;;;;;GAcG;AACH,qBAAa,gBAAiB,SAAQ,sBACpC;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAC1B,aAAa,EACb,OAAO,CAAC,OAAO,CAChB;CAAG;AAEJ;;;;;GAKG;AACH,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC,eAAe,CAAC,gBAAgB,CAAC,CAAA;IACpE,QAAQ,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,OAAO,CAAC,OAAO,CAAC,CAAA;IAChF,QAAQ,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,iBAAiB,EAAE,OAAO,CAAC,OAAO,CAAC,CAAA;CACxG;AASD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,eAAO,MAAM,IAAI,EAAE,CAAC,MAAM,EAAE;IAC1B,QAAQ,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,MAAM,CAAC,MAAM,CAAC,gBAAgB,EAAE,OAAO,CAAC,OAAO,CAAC,CAAA;CACnG,KAAK,MAAM,CAAC,MAAM,CAAC,OAAO,CA8CzB,CAAA"}
\ No newline at end of file
diff --git a/.opencode/node_modules/effect/dist/unstable/ai/EmbeddingModel.js b/.opencode/node_modules/effect/dist/unstable/ai/EmbeddingModel.js
index b178d4d03c2e1b6ac4431265945141d06444d63c..0265281b09aae94198d9e000d6739a2006773a5b 100644
--- a/.opencode/node_modules/effect/dist/unstable/ai/EmbeddingModel.js
+++ b/.opencode/node_modules/effect/dist/unstable/ai/EmbeddingModel.js
@@ -1,16 +1,12 @@
/**
- * The `EmbeddingModel` module provides provider-agnostic text embedding capabilities.
+ * Defines the provider-neutral service for text embeddings.
*
- * @example
- * ```ts
- * import { Effect } from "effect"
- * import { EmbeddingModel } from "effect/unstable/ai"
- *
- * const program = Effect.gen(function*() {
- * const model = yield* EmbeddingModel.EmbeddingModel
- * return yield* model.embed("hello world")
- * })
- * ```
+ * An `EmbeddingModel` turns text into numeric vectors. It supports single-input
+ * embedding and ordered batch embedding, and represents provider failures as
+ * `AiError` values. This module also includes the embedding dimensions service,
+ * request and response models, usage metadata, provider contracts, and a
+ * constructor that adapts a provider batch implementation into the service.
+ * Single `embed` calls can be batched together internally.
*
* @since 4.0.0
*/
@@ -24,22 +20,44 @@ import * as AiError from "./AiError.js";
/**
* Service tag for embedding model operations.
*
- * @since 4.0.0
+ * **When to use**
+ *
+ * Use to retrieve or provide the embedding model service for an `Effect`
+ * program that embeds text into vectors.
+ *
+ * @see {@link Service} for the service contract provided by this tag
+ * @see {@link make} for constructing an embedding model service from a provider
+ * @see {@link Dimensions} for the current embedding vector size service
+ *
* @category services
+ * @since 4.0.0
*/
export class EmbeddingModel extends /*#__PURE__*/Context.Service()("effect/unstable/ai/EmbeddingModel") {}
/**
* Service tag that provides the current embedding dimensions.
*
- * @since 4.0.0
+ * **When to use**
+ *
+ * Use to retrieve or provide the configured embedding vector size through
+ * context.
+ *
+ * @see {@link EmbeddingModel} for the embedding service that uses these dimensions
+ *
* @category services
+ * @since 4.0.0
*/
export class Dimensions extends /*#__PURE__*/Context.Service()("effect/unstable/ai/EmbeddingModel/Dimensions") {}
/**
- * Token usage metadata for embedding operations.
+ * Represents token usage metadata for embedding operations.
+ *
+ * **Details**
+ *
+ * Contains optional provider-reported `inputTokens`. The value may be
+ * `undefined` when the provider does not report usage or when `embedMany([])`
+ * bypasses the provider.
*
- * @since 4.0.0
* @category models
+ * @since 4.0.0
*/
export class EmbeddingUsage extends /*#__PURE__*/Schema.Class("effect/ai/EmbeddingModel/EmbeddingUsage")({
inputTokens: /*#__PURE__*/Schema.UndefinedOr(Schema.Finite)
@@ -47,27 +65,45 @@ export class EmbeddingUsage extends /*#__PURE__*/Schema.Class("effect/ai/Embeddi
/**
* Response for a single embedding request.
*
- * @since 4.0.0
* @category models
+ * @since 4.0.0
*/
export class EmbedResponse extends /*#__PURE__*/Schema.Class("effect/ai/EmbeddingModel/EmbedResponse")({
vector: /*#__PURE__*/Schema.Array(Schema.Finite)
}) {}
/**
- * Response for multiple embeddings.
+ * Response for batch embedding requests containing per-input embeddings and usage
+ * metadata.
+ *
+ * **Details**
+ *
+ * `embeddings` preserves batch order, and `usage` carries token metadata for
+ * the operation.
+ *
+ * @see {@link EmbedResponse} for individual embedding responses
+ * @see {@link EmbeddingUsage} for token usage metadata
*
- * @since 4.0.0
* @category models
+ * @since 4.0.0
*/
export class EmbedManyResponse extends /*#__PURE__*/Schema.Class("effect/ai/EmbeddingModel/EmbedManyResponse")({
embeddings: /*#__PURE__*/Schema.Array(EmbedResponse),
usage: EmbeddingUsage
}) {}
/**
- * Tagged request used by request resolvers for embedding operations.
+ * Represents a tagged request used by request resolvers for embedding operations.
+ *
+ * **When to use**
+ *
+ * Use when you need a typed request for one embedding input while building or
+ * calling a low-level embedding request resolver.
+ *
+ * @see {@link Service} for the resolver-bearing service contract
+ * @see {@link make} for constructing the request resolver from a provider implementation
+ * @see {@link EmbedResponse} for the response produced by this request
*
- * @since 4.0.0
* @category constructors
+ * @since 4.0.0
*/
export class EmbeddingRequest extends /*#__PURE__*/Request.TaggedClass("EmbeddingRequest") {}
const invalidProviderResponse = description => AiError.make({
@@ -80,8 +116,32 @@ const invalidProviderResponse = description => AiError.make({
/**
* Creates an EmbeddingModel service from a provider embedMany implementation.
*
- * @since 4.0.0
+ * **When to use**
+ *
+ * Use to adapt a provider's batch embedding implementation into an
+ * `EmbeddingModel.Service` that offers single-input and batch embedding
+ * operations.
+ *
+ * **Details**
+ *
+ * The returned service builds single-input `embed` calls through a request
+ * resolver, so concurrent `embed` requests can be batched into one provider
+ * `embedMany` call. Direct `embedMany` calls pass the input array to the
+ * provider, while `embedMany([])` returns an empty response without calling the
+ * provider.
+ *
+ * **Gotchas**
+ *
+ * Provider responses are interpreted positionally and must contain exactly one
+ * result for each requested input. If the provider returns a different number
+ * of results, `embed` and `embedMany` fail with `AiError.InvalidOutputError`.
+ *
+ * @see {@link Service} for the service shape returned by this constructor
+ * @see {@link ProviderOptions} for the input passed to the provider implementation
+ * @see {@link ProviderResponse} for the provider response contract consumed by this constructor
+ *
* @category constructors
+ * @since 4.0.0
*/
export const make = /*#__PURE__*/Effect.fnUntraced(function* (params) {
const resolver = RequestResolver.make(entries => Effect.flatMap(params.embedMany({
diff --git a/.opencode/node_modules/effect/dist/unstable/ai/EmbeddingModel.js.map b/.opencode/node_modules/effect/dist/unstable/ai/EmbeddingModel.js.map
index ea5ca84e07fee69ebda72c3d7af2ad093a2bb9b9..0debd1da239b132acddc9f28e5b15d8e2e9e9181 100644
--- a/.opencode/node_modules/effect/dist/unstable/ai/EmbeddingModel.js.map
+++ b/.opencode/node_modules/effect/dist/unstable/ai/EmbeddingModel.js.map
@@ -1 +1 @@
-{"version":3,"file":"EmbeddingModel.js","names":["Context","Effect","Exit","Request","RequestResolver","Schema","AiError","EmbeddingModel","Service","Dimensions","EmbeddingUsage","Class","inputTokens","UndefinedOr","Finite","EmbedResponse","vector","Array","EmbedManyResponse","embeddings","usage","EmbeddingRequest","TaggedClass","invalidProviderResponse","description","make","module","method","reason","InvalidOutputError","fnUntraced","params","resolver","entries","flatMap","embedMany","inputs","map","entry","request","input","response","mapProviderResults","length","results","i","completeUnsafe","succeed","pipe","withSpan","of","embed","undefined","inputLength","fail"],"sources":["../../../src/unstable/ai/EmbeddingModel.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;;;;;AAgBA,OAAO,KAAKA,OAAO,MAAM,kBAAkB;AAC3C,OAAO,KAAKC,MAAM,MAAM,iBAAiB;AACzC,OAAO,KAAKC,IAAI,MAAM,eAAe;AACrC,OAAO,KAAKC,OAAO,MAAM,kBAAkB;AAC3C,OAAO,KAAKC,eAAe,MAAM,0BAA0B;AAC3D,O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kB,CAACF,KAAK,CAACG,MAAM,EAAEF,QAAQ,CAACG,OAAO,CAAC,CAACI,IAAI,CACrD/C,MAAM,CAACoC,GAAG,CAAElB,UAAU,IACpB,IAAID,iBAAiB,CAAC;MACpBC,UAAU;MACVC,KAAK,EAAE,IAAIV,cAAc,CAAC;QACxBE,WAAW,EAAE6B,QAAQ,CAACrB,KAAK,CAACR;OAC7B;KACF,CAAC,CACH,CACF,CACF,CACF,EAAEoC,IAAI,CAAC/C,MAAM,CAACgD,QAAQ,CAAC,0BAA0B,CAAC;GACxD,CAAC;AACJ,CAAC,CAAC;AAEF,MAAMP,kBAAkB,GAAGA,CACzBW,WAAmB,EACnBT,OAA6B,KAC2B;EACxD,MAAMzB,UAAU,GAAG,IAAIF,KAAK,CAAgBoC,WAAW,CAAC;EACxD,IAAIT,OAAO,CAACD,MAAM,KAAKU,WAAW,EAAE;IAClC,OAAOpD,MAAM,CAACqD,IAAI,CAChB/B,uBAAuB,CACrB,qBAAqBqB,OAAO,CAACD,MAAM,4BAA4BU,WAAW,EAAE,CAC7E,CACF;EACH;EACA,KAAK,IAAIR,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGD,OAAO,CAACD,MAAM,EAAEE,CAAC,EAAE,EAAE;IACvC,MAAM7B,MAAM,GAAG4B,OAAO,CAACC,CAAC,CAAC;IACzB1B,UAAU,CAAC0B,CAAC,CAAC,GAAG,IAAI9B,aAAa,CAAC;MAAEC;IAAM,CAAE,CAAC;EAC/C;EACA,OAAOf,MAAM,CAAC8C,OAAO,CAAC5B,UAAU,CAAC;AACnC,CAAC","ignoreList":[]}
\ No newline at end of file
+{"version":3,"file":"EmbeddingModel.js","names":["Context","Effect","Exit","Request","RequestResolver","Schema","AiError","EmbeddingModel","Service","Dimensions","EmbeddingUsage","Class","inputTokens","UndefinedOr","Finite","EmbedResponse","vector","Array","EmbedManyResponse","embeddings","usage","EmbeddingRequest","TaggedClass","invalidProviderResponse","description","make","module","method","reason","InvalidOutputError","fnUntraced","params","resolver","entries","flatMap","embedMany","inputs","map","entry","request","input","response","mapProviderResults","length","results","i","completeUnsafe","succeed","pipe","withSpan","of","embed","undefined","inputLength","fail"],"sources":["../../../src/unstable/ai/EmbeddingModel.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;AAYA,OAAO,KAAKA,OAAO,MAAM,kBAAkB;AAC3C,OAAO,KAAKC,MAAM,MAAM,iBAAiB;AACzC,OAAO,KAAKC,IAAI,MAAM,eAAe;AACrC,OAAO,KAAKC,OAAO,MAAM,kBAAkB;AAC3C,OAAO,KAAKC,eAAe,MAAM,0BAA0B;AAC3D,OAAO,KAAKC,MAAM,MAAM,iBAAiB;AACzC,OAAO,KAAKC,OAAO,MAAM,cAAc;AAEvC;;;;;;;;;;;;;;;AAeA,OAAM,MAAOC,cAAe,sBAAQP,OAAO,CAACQ,OAAO,EAA2B,CAC5E,mCAAmC,CACpC;AAED;;;;;;;;;;;;;AAaA,OAAM,MAAOC,UAAW,sBAAQT,OAAO,CAACQ,OAAO,EAAsB,CACnE,8CAA8C,CAC/C;AAED;;;;;;;;;;;;AAYA,OAAM,MAAOE,cAAe,sBAAQL,MAAM,CAACM,KAAK,CAC9C,yCAAyC,CAC1C,CAAC;EACAC,WAAW,eAAEP,MAAM,CAACQ,WAAW,CAACR,MAAM,CAACS,MAAM;CAC9C,CAAC;AAEF;;;;;;AAMA,OAAM,MAAOC,aAAc,sBAAQV,MAAM,CAACM,KAAK,CAC7C,wCAAwC,CACzC,CAAC;EACAK,MAAM,eAAEX,MAAM,CAACY,KAAK,CAACZ,MAAM,CAACS,MAAM;CACnC,CAAC;AAEF;;;;;;;;;;;;;;;AAeA,OAAM,MAAOI,iBAAkB,sBAAQb,MAAM,CAACM,KAAK,CACjD,4CAA4C,CAC7C,CAAC;EACAQ,UAAU,eAAEd,MAAM,CAACY,KAAK,CAACF,aAAa,CAAC;EACvCK,KAAK,EAAEV;CACR,CAAC;AAyBF;;;;;;;;;;;;;;;AAeA,OAA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AAE;IACvC,MAAM7B,MAAM,GAAG4B,OAAO,CAACC,CAAC,CAAC;IACzB1B,UAAU,CAAC0B,CAAC,CAAC,GAAG,IAAI9B,aAAa,CAAC;MAAEC;IAAM,CAAE,CAAC;EAC/C;EACA,OAAOf,MAAM,CAAC8C,OAAO,CAAC5B,UAAU,CAAC;AACnC,CAAC","ignoreList":[]}
\ No newline at end of file
diff --git a/.opencode/node_modules/effect/dist/unstable/ai/IdGenerator.d.ts b/.opencode/node_modules/effect/dist/unstable/ai/IdGenerator.d.ts
index a64ba6f03735a829bd52ddec35beac70e3cf8c51..58633f1b92fa77d3911515d8f953162ef4857e52 100644
--- a/.opencode/node_modules/effect/dist/unstable/ai/IdGenerator.d.ts
+++ b/.opencode/node_modules/effect/dist/unstable/ai/IdGenerator.d.ts
@@ -1,47 +1,11 @@
/**
- * The `IdGenerator` module provides a pluggable system for generating unique identifiers
- * for tool calls and other items in the Effect AI SDKs.
+ * Provides identifier generation for AI features.
*
- * This module offers a flexible and configurable approach to ID generation, supporting
- * custom alphabets, prefixes, separators, and sizes.
- *
- * @example
- * ```ts
- * import { Effect } from "effect"
- * import { IdGenerator } from "effect/unstable/ai"
- *
- * // Using the default ID generator
- * const program = Effect.gen(function*() {
- * const idGen = yield* IdGenerator.IdGenerator
- * const toolCallId = yield* idGen.generateId()
- * console.log(toolCallId) // "id_A7xK9mP2qR5tY8uV"
- * return toolCallId
- * }).pipe(Effect.provideService(
- * IdGenerator.IdGenerator,
- * IdGenerator.defaultIdGenerator
- * ))
- * ```
- *
- * @example
- * ```ts
- * import { Effect } from "effect"
- * import { IdGenerator } from "effect/unstable/ai"
- *
- * // Creating a custom ID generator for AI tool calls
- * const customLayer = IdGenerator.layer({
- * alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
- * prefix: "tool_call",
- * separator: "-",
- * size: 12
- * })
- *
- * const program = Effect.gen(function*() {
- * const idGen = yield* IdGenerator.IdGenerator
- * const id = yield* idGen.generateId()
- * console.log(id) // "tool_call-A7XK9MP2QR5T"
- * return id
- * }).pipe(Effect.provide(customLayer))
- * ```
+ * The `IdGenerator` service exposes one operation, `generateId`, which returns
+ * a string inside `Effect`. AI modules use it for values such as tool call ids
+ * and generated response item ids. This module includes the service tag,
+ * service interface, default generator, configurable custom generator, and layer
+ * for providing the service.
*
* @since 4.0.0
*/
@@ -51,13 +15,21 @@ import * as Effect from "../../Effect.ts";
import * as Layer from "../../Layer.ts";
declare const IdGenerator_base: Context.ServiceClass;
/**
- * The `IdGenerator` service tag for dependency injection.
+ * Service tag for AI identifier generation services.
+ *
+ * **When to use**
+ *
+ * Use to access or provide the service that creates identifiers for AI tool
+ * calls and related generated values.
+ *
+ * **Details**
*
* This tag is used to provide and access ID generation functionality throughout
* the application. It follows Effect's standard service pattern for type-safe
* dependency injection.
*
- * @example
+ * **Example** (Accessing the ID generator service)
+ *
* ```ts
* import { Effect } from "effect"
* import { IdGenerator } from "effect/unstable/ai"
@@ -69,37 +41,41 @@ declare const IdGenerator_base: Context.ServiceClass Effect.succeed(`custom_${Date.now()}`)
+ * generateId: () => Effect.sync(() => `custom_${++nextId}`)
* }
*
* const program = Effect.gen(function*() {
* const id = yield* customService.generateId()
- * console.log(id) // "custom_1234567890"
+ * console.log(id) // "custom_1"
* return id
* })
* ```
*
- * @since 4.0.0
* @category models
+ * @since 4.0.0
*/
export interface Service {
readonly generateId: () => Effect.Effect;
@@ -107,7 +83,8 @@ export interface Service {
/**
* Configuration options for creating custom ID generators.
*
- * @example
+ * **Example** (Configuring generated IDs)
+ *
* ```ts
* import type { IdGenerator } from "effect/unstable/ai"
*
@@ -122,8 +99,8 @@ export interface Service {
* // This will generate IDs like: "tool_A1B2C3D4"
* ```
*
+ * @category options
* @since 4.0.0
- * @category models
*/
export interface MakeOptions {
/**
@@ -146,11 +123,14 @@ export interface MakeOptions {
/**
* Default ID generator service implementation.
*
+ * **Details**
+ *
* Uses the standard configuration with "id" prefix and generates IDs in the
* format "id_XXXXXXXXXXXXXXXX" where X represents random alphanumeric
* characters.
*
- * @example
+ * **Example** (Generating default IDs)
+ *
* ```ts
* import { Effect } from "effect"
* import { IdGenerator } from "effect/unstable/ai"
@@ -170,17 +150,20 @@ export interface MakeOptions {
* )
* ```
*
- * @since 4.0.0
* @category constructors
+ * @since 4.0.0
*/
export declare const defaultIdGenerator: Service;
/**
* Creates a custom ID generator service with the specified options.
*
+ * **Details**
+ *
* Validates the configuration to ensure the separator is not part of the
* alphabet, which would cause ambiguity in parsing generated IDs.
*
- * @example
+ * **Example** (Creating a custom generator)
+ *
* ```ts
* import { Effect } from "effect"
* import { IdGenerator } from "effect/unstable/ai"
@@ -200,7 +183,8 @@ export declare const defaultIdGenerator: Service;
* })
* ```
*
- * @example
+ * **Example** (Handling invalid generator options)
+ *
* ```ts
* import { Effect } from "effect"
* import { IdGenerator } from "effect/unstable/ai"
@@ -223,8 +207,8 @@ export declare const defaultIdGenerator: Service;
* )
* ```
*
- * @since 4.0.0
* @category constructors
+ * @since 4.0.0
*/
export declare const make: (args_0: MakeOptions) => Effect.Effect<{
readonly generateId: () => Effect.Effect;
@@ -233,11 +217,13 @@ export declare const make: (args_0: MakeOptions) => Effect.Effect<{
* Creates a Layer that provides the IdGenerator service with custom
* configuration.
*
- * This is the recommended way to provide ID generation capabilities to your
- * application. The layer will fail during construction if the configuration is
- * invalid.
+ * **When to use**
+ *
+ * Use when you need to provide ID generation capabilities from validated
+ * configuration.
+ *
+ * **Example** (Providing an ID generator layer)
*
- * @example
* ```ts
* import { Effect } from "effect"
* import { IdGenerator } from "effect/unstable/ai"
@@ -258,8 +244,8 @@ export declare const make: (args_0: MakeOptions) => Effect.Effect<{
* }).pipe(Effect.provide(toolCallIdLayer))
* ```
*
- * @since 4.0.0
* @category constructors
+ * @since 4.0.0
*/
export declare const layer: (options: MakeOptions) => Layer.Layer;
export {};
diff --git a/.opencode/node_modules/effect/dist/unstable/ai/IdGenerator.d.ts.map b/.opencode/node_modules/effect/dist/unstable/ai/IdGenerator.d.ts.map
index e447a9190125245515a6738640594016c3bbf145..c196bf664c646e25323764b55785b6a74d16d7c2 100644
--- a/.opencode/node_modules/effect/dist/unstable/ai/IdGenerator.d.ts.map
+++ b/.opencode/node_modules/effect/dist/unstable/ai/IdGenerator.d.ts.map
@@ -1 +1 @@
-{"version":3,"file":"IdGenerator.d.ts","sourceRoot":"","sources":["../../../src/unstable/ai/IdGenerator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAA;AACvC,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAA;AAC3C,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAA;AACzC,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAA;;AAIvC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBAAa,WAAY,SAAQ,gBAEhC;CAAG;AAEJ;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,UAAU,EAAE,MAAM,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;CACjD;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB;;OAEG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACpC;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CACtB;AA2BD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,eAAO,MAAM,kBAAkB,EAAE,OAEhC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,eAAO,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AAM,IAAI;;qCAgBf,CAAA;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,eAAO,MAAM,KAAK,GAAI,SAAS,WAAW,KAAG,KAAK,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,oBAAoB,CACtD,CAAA"}
\ No newline at end of file
diff --git a/.opencode/node_modules/effect/dist/unstable/ai/IdGenerator.js b/.opencode/node_modules/effect/dist/unstable/ai/IdGenerator.js
index af0a787a0e1686074da59cd3c61fb37cfb8beb95..efc94ad20f13c197192253c070336036798ecbb6 100644
--- a/.opencode/node_modules/effect/dist/unstable/ai/IdGenerator.js
+++ b/.opencode/node_modules/effect/dist/unstable/ai/IdGenerator.js
@@ -1,47 +1,11 @@
/**
- * The `IdGenerator` module provides a pluggable system for generating unique identifiers
- * for tool calls and other items in the Effect AI SDKs.
+ * Provides identifier generation for AI features.
*
- * This module offers a flexible and configurable approach to ID generation, supporting
- * custom alphabets, prefixes, separators, and sizes.
- *
- * @example
- * ```ts
- * import { Effect } from "effect"
- * import { IdGenerator } from "effect/unstable/ai"
- *
- * // Using the default ID generator
- * const program = Effect.gen(function*() {
- * const idGen = yield* IdGenerator.IdGenerator
- * const toolCallId = yield* idGen.generateId()
- * console.log(toolCallId) // "id_A7xK9mP2qR5tY8uV"
- * return toolCallId
- * }).pipe(Effect.provideService(
- * IdGenerator.IdGenerator,
- * IdGenerator.defaultIdGenerator
- * ))
- * ```
- *
- * @example
- * ```ts
- * import { Effect } from "effect"
- * import { IdGenerator } from "effect/unstable/ai"
- *
- * // Creating a custom ID generator for AI tool calls
- * const customLayer = IdGenerator.layer({
- * alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
- * prefix: "tool_call",
- * separator: "-",
- * size: 12
- * })
- *
- * const program = Effect.gen(function*() {
- * const idGen = yield* IdGenerator.IdGenerator
- * const id = yield* idGen.generateId()
- * console.log(id) // "tool_call-A7XK9MP2QR5T"
- * return id
- * }).pipe(Effect.provide(customLayer))
- * ```
+ * The `IdGenerator` service exposes one operation, `generateId`, which returns
+ * a string inside `Effect`. AI modules use it for values such as tool call ids
+ * and generated response item ids. This module includes the service tag,
+ * service interface, default generator, configurable custom generator, and layer
+ * for providing the service.
*
* @since 4.0.0
*/
@@ -52,13 +16,21 @@ import * as Layer from "../../Layer.js";
import * as Predicate from "../../Predicate.js";
import * as Random from "../../Random.js";
/**
- * The `IdGenerator` service tag for dependency injection.
+ * Service tag for AI identifier generation services.
+ *
+ * **When to use**
+ *
+ * Use to access or provide the service that creates identifiers for AI tool
+ * calls and related generated values.
+ *
+ * **Details**
*
* This tag is used to provide and access ID generation functionality throughout
* the application. It follows Effect's standard service pattern for type-safe
* dependency injection.
*
- * @example
+ * **Example** (Accessing the ID generator service)
+ *
* ```ts
* import { Effect } from "effect"
* import { IdGenerator } from "effect/unstable/ai"
@@ -70,8 +42,8 @@ import * as Random from "../../Random.js";
* })
* ```
*
+ * @category services
* @since 4.0.0
- * @category models
*/
export class IdGenerator extends /*#__PURE__*/Context.Service()("@effect/ai/IdGenerator") {}
const DEFAULT_ALPHABET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
@@ -100,11 +72,14 @@ const makeGenerator = ({
/**
* Default ID generator service implementation.
*
+ * **Details**
+ *
* Uses the standard configuration with "id" prefix and generates IDs in the
* format "id_XXXXXXXXXXXXXXXX" where X represents random alphanumeric
* characters.
*
- * @example
+ * **Example** (Generating default IDs)
+ *
* ```ts
* import { Effect } from "effect"
* import { IdGenerator } from "effect/unstable/ai"
@@ -124,8 +99,8 @@ const makeGenerator = ({
* )
* ```
*
- * @since 4.0.0
* @category constructors
+ * @since 4.0.0
*/
export const defaultIdGenerator = {
generateId: /*#__PURE__*/makeGenerator({
@@ -135,10 +110,13 @@ export const defaultIdGenerator = {
/**
* Creates a custom ID generator service with the specified options.
*
+ * **Details**
+ *
* Validates the configuration to ensure the separator is not part of the
* alphabet, which would cause ambiguity in parsing generated IDs.
*
- * @example
+ * **Example** (Creating a custom generator)
+ *
* ```ts
* import { Effect } from "effect"
* import { IdGenerator } from "effect/unstable/ai"
@@ -158,7 +136,8 @@ export const defaultIdGenerator = {
* })
* ```
*
- * @example
+ * **Example** (Handling invalid generator options)
+ *
* ```ts
* import { Effect } from "effect"
* import { IdGenerator } from "effect/unstable/ai"
@@ -181,8 +160,8 @@ export const defaultIdGenerator = {
* )
* ```
*
- * @since 4.0.0
* @category constructors
+ * @since 4.0.0
*/
export const make = /*#__PURE__*/Effect.fnUntraced(function* ({
alphabet = DEFAULT_ALPHABET,
@@ -208,11 +187,13 @@ export const make = /*#__PURE__*/Effect.fnUntraced(function* ({
* Creates a Layer that provides the IdGenerator service with custom
* configuration.
*
- * This is the recommended way to provide ID generation capabilities to your
- * application. The layer will fail during construction if the configuration is
- * invalid.
+ * **When to use**
+ *
+ * Use when you need to provide ID generation capabilities from validated
+ * configuration.
+ *
+ * **Example** (Providing an ID generator layer)
*
- * @example
* ```ts
* import { Effect } from "effect"
* import { IdGenerator } from "effect/unstable/ai"
@@ -233,8 +214,8 @@ export const make = /*#__PURE__*/Effect.fnUntraced(function* ({
* }).pipe(Effect.provide(toolCallIdLayer))
* ```
*
- * @since 4.0.0
* @category constructors
+ * @since 4.0.0
*/
export const layer = options => Layer.effect(IdGenerator)(make(options));
//# sourceMappingURL=IdGenerator.js.map
\ No newline at end of file
diff --git a/.opencode/node_modules/effect/dist/unstable/ai/IdGenerator.js.map b/.opencode/node_modules/effect/dist/unstable/ai/IdGenerator.js.map
index d1ca4c6e11312d88ce8c86eaa759053db5d96fa6..a290171ac89ee88c9de86af0a7f7f891990ffad5 100644
--- a/.opencode/node_modules/effect/dist/unstable/ai/IdGenerator.js.map
+++ b/.opencode/node_modules/effect/dist/unstable/ai/IdGenerator.js.map
@@ -1 +1 @@
-{"version":3,"file":"IdGenerator.js","names":["Cause","Context","Effect","Layer","Predicate","Random","IdGenerator","Service","DEFAULT_ALPHABET","DEFAULT_SEPARATOR","DEFAULT_SIZE","makeGenerator","alphabet","prefix","separator","size","alphabetLength","length","fnUntraced","chars","Array","i","index","next","identifier","join","isUndefined","defaultIdGenerator","generateId","make","includes","message","IllegalArgumentError","layer","options","effect"],"sources":["../../../src/unstable/ai/IdGenerator.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,OAAO,KAAKA,KAAK,MAAM,gBAAgB;AACvC,OAAO,KAAKC,OAAO,MAAM,kBAAkB;AAC3C,OAAO,KAAKC,MAAM,MAAM,iBAAiB;AACzC,OAAO,KAAKC,KAAK,MAAM,gBAAgB;AACvC,OAAO,KAAKC,SAAS,MAAM,oBAAoB;AAC/C,OAAO,KAAKC,MAAM,MAAM,iBAAiB;AAEzC;;;;;;;;;;;;;;;;;;;;;;AAsBA,OAAM,MAAOC,WAAY,sBAAQL,OAAO,CAACM,OAAO,EAAwB,CACtE,wBAAwB,CACzB;AAyED,MAAMC,gBAAgB,GAAG,gEAAgE;AACzF,MAAMC,iBAAiB,GAAG,GAAG;AAC7B,MAAMC,YAAY,GAAG,EAAE;AAEvB,MAAMC,aAAa,GAAGA,CAAC;EACrBC,QAAQ,GAAGJ,gBAAgB;EAC3BK,MAAM;EACNC,SAAS,GAAGL,iBAAiB;EAC7BM,IAAI,GAAGL;AAAY,CACE,KAAI;EACzB,MAAMM,cAAc,GAAGJ,QAAQ,CAACK,MAAM;EACtC,OAAOf,MAAM,CAACgB,UAAU,CAAC,aAAS;IAChC,MAAMC,KAAK,GAAG,IAAIC,KAAK,CAACL,IAAI,CAAC;IAC7B,KAAK,IAAIM,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGN,IAAI,EAAEM,CAAC,EAAE,EAAE;MAC7B,MAAMC,KAAK,GAAG,OAAOjB,MAAM,CAACkB,IAAI;MAChCJ,KAAK,CAACE,CAAC,CAAC,GAAGT,QAAQ,CAAEU,KAAK,GAAGN,cAAc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layer","Predicate","Random","IdGenerator","Service","DEFAULT_ALPHABET","DEFAULT_SEPARATOR","DEFAULT_SIZE","makeGenerator","alphabet","prefix","separator","size","alphabetLength","length","fnUntraced","chars","Array","i","index","next","identifier","join","isUndefined","defaultIdGenerator","generateId","make","includes","message","IllegalArgumentError","layer","options","effect"],"sources":["../../../src/unstable/ai/IdGenerator.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;AAWA,OAAO,KAAKA,KAAK,MAAM,gBAAgB;AACvC,OAAO,KAAKC,OAAO,MAAM,kBAAkB;AAC3C,OAAO,KAAKC,MAAM,MAAM,iBAAiB;AACzC,OAAO,KAAKC,KAAK,MAAM,gBAAgB;AACvC,OAAO,KAAKC,SAAS,MAAM,oBAAoB;AAC/C,OAAO,KAAKC,MAAM,MAAM,iBAAiB;AAEzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,OAAM,MAAOC,WAAY,sBAAQL,OAAO,CAACM,OAAO,EAAwB,CACtE,wBAAwB,CACzB;AA8ED,MAAMC,gBAAgB,GAAG,gEAAgE;AACzF,MAAMC,iBAAiB,GAAG,GAAG;AAC7B,MAAMC,YAAY,GAAG,EAAE;AAEvB,MAAMC,aAAa,GAAGA,CAAC;EACrBC,QAAQ,GAAGJ,gBAAgB;EAC3BK,MAAM;EACNC,SAAS,GAAGL,iBAAiB;EAC7BM,IAAI,GAAGL;AAAY,CACE,KAAI;EACzB,MAAMM,cAAc,GAAGJ,QAAQ,CAACK,MAAM;EACtC,OAAOf,MAAM,CAACgB,UAAU,CAAC,aAAS;IAChC,MAAMC,KAAK,GAAG,IAAIC,KAAK,CAACL,IAAI,CAAC;IAC7B,KAAK,IAAIM,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGN,IAAI,EAAEM,CAAC,EAAE,EAAE;MAC7B,MAAMC,KAAK,GAAG,OAAOjB,MAAM,CAACkB,IAAI;MAChCJ,KAAK,CAACE,CAAC,CAAC,GAAGT,QAAQ,CAAEU,KAAK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/effect/dist/unstable/ai/LanguageModel.d.ts b/.opencode/node_modules/effect/dist/unstable/ai/LanguageModel.d.ts
index 2916e5370864b6705eb7d975648b4e95f8bc46dc..8e9d08c1942ee8149ec12dc92326581d5b195f19 100644
--- a/.opencode/node_modules/effect/dist/unstable/ai/LanguageModel.d.ts
+++ b/.opencode/node_modules/effect/dist/unstable/ai/LanguageModel.d.ts
@@ -13,13 +13,15 @@ import type * as Tool from "./Tool.ts";
import * as Toolkit from "./Toolkit.ts";
declare const LanguageModel_base: Context.ServiceClass;
/**
- * The `LanguageModel` service key for dependency injection.
+ * Service tag for AI model services.
*
- * This provides access to language model functionality throughout your
- * application, enabling text generation, streaming, and structured output
- * capabilities.
+ * **When to use**
+ *
+ * Use to access or provide text generation, streaming generation, structured
+ * output, and tool-calling capabilities through the Effect context.
+ *
+ * **Example** (Accessing the language model service)
*
- * @example
* ```ts
* import { Effect } from "effect"
* import { LanguageModel } from "effect/unstable/ai"
@@ -33,19 +35,16 @@ declare const LanguageModel_base: Context.ServiceClass(schema: Schema.Codec) => {
readonly codec: Schema.Codec;
@@ -104,15 +104,29 @@ export type CodecTransformer = (schema: Schema.Codec
* The default codec transformer that passes schemas through without
* provider-specific rewrites.
*
- * @since 4.0.0
+ * **When to use**
+ *
+ * Use as the codec transformer for provider implementations when the provider
+ * accepts the JSON Schema generated from an `Effect` Schema codec without
+ * provider-specific rewrites.
+ *
+ * **Details**
+ *
+ * The transformer returns the original codec, resolves a top-level `$ref`, and
+ * copies schema definitions into `$defs`.
+ *
+ * @see {@link CodecTransformer} for the structured-output transformer contract
+ * @see {@link make} for where this transformer is used as the default
+ *
* @category services
+ * @since 4.0.0
*/
export declare const defaultCodecTransformer: CodecTransformer;
/**
* Configuration options for text generation.
*
+ * @category options
* @since 4.0.0
- * @category models
*/
export interface GenerateTextOptions> {
/**
@@ -147,15 +161,13 @@ export interface GenerateTextOptions> {
*/
readonly concurrency?: Concurrency | undefined;
/**
- * When set to `true`, tool calls requested by the large language model
- * will not be auto-resolved by the framework.
+ * When set to `true`, tool calls requested by the large language model are not auto-resolved by the framework.
+ *
+ * **When to use**
*
- * This option is useful when:
- * 1. The user wants to include tool call definitions from an `AiToolkit`
- * in requests to the large language model so that the model has the
- * capability to call tools
- * 2. The user wants to control the execution of tool call resolvers
- * instead of having the framework handle tool call resolution
+ * Use when you want to include tool call definitions from an `AiToolkit`
+ * in requests to the large language model, while controlling tool call
+ * resolver execution yourself.
*/
readonly disableToolCallResolution?: boolean | undefined;
}
@@ -165,8 +177,8 @@ type GenerateTextOptionsWithoutToolkit = Omit, "toolkit"
/**
* Configuration options for structured object generation.
*
+ * @category options
* @since 4.0.0
- * @category models
*/
export interface GenerateObjectOptions, StructuredOutputSchema extends Schema.Top> extends GenerateTextOptions {
/**
@@ -194,8 +206,8 @@ export interface GenerateObjectOptions, S
* `"required"`, the model **must** call one tool from the allowed subset of
* tools.
*
- * @since 4.0.0
* @category models
+ * @since 4.0.0
*/
export type ToolChoice = "auto" | "none" | "required" | {
readonly tool: ToolName;
@@ -204,13 +216,10 @@ export type ToolChoice = "auto" | "none" | "required" |
readonly oneOf: ReadonlyArray;
};
/**
- * Response class for text generation operations.
+ * Response class for text generation operations, with accessors for extracting text, tool calls, usage information, and other response parts from generated content.
*
- * Contains the generated content and provides convenient accessors for
- * extracting different types of response parts like text, tool calls, and usage
- * information.
+ * **Example** (Inspecting a text response)
*
- * @example
* ```ts
* import { Effect } from "effect"
* import { LanguageModel } from "effect/unstable/ai"
@@ -228,8 +237,8 @@ export type ToolChoice = "auto" | "none" | "required" |
* })
* ```
*
- * @since 4.0.0
* @category models
+ * @since 4.0.0
*/
export declare class GenerateTextResponse> {
readonly content: Array>;
@@ -266,7 +275,8 @@ export declare class GenerateTextResponse
/**
* Response class for structured object generation operations.
*
- * @example
+ * **Example** (Inspecting an object response)
+ *
* ```ts
* import { Effect, Schema } from "effect"
* import { LanguageModel } from "effect/unstable/ai"
@@ -289,8 +299,8 @@ export declare class GenerateTextResponse
* })
* ```
*
- * @since 4.0.0
* @category models
+ * @since 4.0.0
*/
export declare class GenerateObjectResponse, A> extends GenerateTextResponse {
/**
@@ -302,41 +312,45 @@ export declare class GenerateObjectResponse, E = never, R = any> = Tools extends any ? (Toolkit.WithHandler | Effect.Yieldable, Toolkit.WithHandler, E, R>) : never;
+export type ToolkitOption, E = never, R = any> = Tools extends any ? (Toolkit.WithHandler | Effect.Effect, E, R>) : never;
/**
* The supported toolkit input shapes for language model operation options.
*
+ * **Details**
+ *
* Unlike `ToolkitOption`, this type does not distribute over unions. It is
* intended for call-site assignability, while `ToolkitOption` remains the
* distributive helper used for extraction and inference.
*
- * @since 4.0.0
* @category utility types
+ * @since 4.0.0
*/
-export type ToolkitInput, E = never, R = any> = ToolkitOption | Toolkit.WithHandler | Effect.Yieldable, Toolkit.WithHandler, E, R>;
-type ExtractToolsFromToolkitOption = ToolkitValue extends Toolkit.WithHandler ? Tools : ToolkitValue extends Effect.Yieldable, Toolkit.WithHandler, infer _E, infer _R> ? Tools : never;
+export type ToolkitInput, E = never, R = any> = ToolkitOption | Toolkit.WithHandler | Effect.Effect, E, R>;
+type ExtractToolsFromToolkitOption = ToolkitValue extends Toolkit.WithHandler ? Tools : ToolkitValue extends Effect.Effect, infer _E, infer _R> ? _Tools : never;
/**
* Utility type that extracts the toolset from LanguageModel options.
*
- * @since 4.0.0
* @category utility types
+ * @since 4.0.0
*/
export type ExtractTools = Options extends {
readonly toolkit: infer ToolkitValue;
} ? ExtractToolsFromToolkitOption> : {};
-type ExtractErrorFromToolkitOption = ToolkitValue extends Toolkit.WithHandler ? AiError.AiError | (DisableToolCallResolution extends true ? never : Tool.HandlerError) : ToolkitValue extends Effect.Yieldable, Toolkit.WithHandler, infer E, infer _R> ? AiError.AiError | E | (DisableToolCallResolution extends true ? never : Tool.HandlerError) : AiError.AiError;
-type ExtractServicesFromToolkitOption = ToolkitValue extends Toolkit.WithHandler ? Tool.HandlerServices | Tool.ResultDecodingServices : ToolkitValue extends Effect.Yieldable, Toolkit.WithHandler, infer _E, infer R> ? Tool.HandlerServices | Tool.ResultDecodingServices | R : never;
+type ExtractErrorFromToolkitOption