@effect/ai-typesafe 4.0.0-rc.116 → 4.0.0-rc.118
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +4 -4
- package/CLAUDE.md +4 -4
- package/ai-docs/package.json +3 -3
- package/ai-docs/src/01_effect/03_services/20_layer-composition.ts +1 -1
- package/ai-docs/src/01_effect/06_running/20_layer-launch.ts +1 -1
- package/ai-docs/src/03_stream/30_encoding.ts +1 -1
- package/ai-docs/src/08_observability/20_otlp-tracing.ts +2 -2
- package/ai-docs/src/08_observability/index.md +1 -1
- package/ai-docs/src/40_sql/10_basics.ts +2 -2
- package/ai-docs/src/40_sql/index.md +1 -1
- package/ai-docs/src/50_http-client/10_basics.ts +1 -1
- package/ai-docs/src/51_http-server/10_basics.ts +2 -2
- package/ai-docs/src/51_http-server/20_testing.ts +2 -2
- package/ai-docs/src/51_http-server/fixtures/api/Api.ts +1 -1
- package/ai-docs/src/51_http-server/fixtures/api/Authorization.ts +1 -1
- package/ai-docs/src/51_http-server/fixtures/api/System.ts +1 -1
- package/ai-docs/src/51_http-server/fixtures/api/Users.ts +1 -1
- package/ai-docs/src/51_http-server/fixtures/domain/User.ts +1 -1
- package/ai-docs/src/51_http-server/fixtures/server/Users/http.ts +1 -1
- package/ai-docs/src/51_http-server/fixtures/server/Users.ts +1 -1
- package/ai-docs/src/60_child-process/10_working-with-child-processes.ts +1 -1
- package/ai-docs/src/60_child-process/index.md +1 -1
- package/ai-docs/src/70_cli/10_basics.ts +1 -1
- package/ai-docs/src/70_cli/index.md +1 -1
- package/ai-docs/src/71_ai/10_language-model.ts +2 -2
- package/ai-docs/src/71_ai/20_tools.ts +2 -2
- package/ai-docs/src/71_ai/30_chat.ts +2 -2
- package/ai-docs/src/80_cluster/10_entities.ts +3 -3
- package/dist/TypeSafeClient.d.ts +2 -2
- package/dist/TypeSafeClient.d.ts.map +1 -1
- package/dist/TypeSafeClient.js +4 -4
- package/dist/TypeSafeClient.js.map +1 -1
- package/dist/TypeSafeConfig.d.ts +1 -1
- package/dist/TypeSafeConfig.d.ts.map +1 -1
- package/dist/TypeSafeDecisionModel.d.ts +5 -4
- package/dist/TypeSafeDecisionModel.d.ts.map +1 -1
- package/dist/TypeSafeDecisionModel.js +6 -4
- package/dist/TypeSafeDecisionModel.js.map +1 -1
- package/dist/internal/errors.d.ts +2 -2
- package/dist/internal/errors.d.ts.map +1 -1
- package/dist/internal/errors.js +1 -1
- package/dist/internal/errors.js.map +1 -1
- package/package.json +3 -3
- package/src/TypeSafeClient.ts +5 -5
- package/src/TypeSafeConfig.ts +1 -1
- package/src/TypeSafeDecisionModel.ts +6 -4
- package/src/internal/errors.ts +3 -3
package/AGENTS.md
CHANGED
|
@@ -302,7 +302,7 @@ Use it when your Effect programs need testable current time, safe parsing, stabl
|
|
|
302
302
|
|
|
303
303
|
Effect has built-in support for structured logging, distributed tracing, and
|
|
304
304
|
metrics. For exporting telemetry, use the lightweight Otlp modules from
|
|
305
|
-
`effect/
|
|
305
|
+
`effect/observability` in new projects, or use
|
|
306
306
|
`@effect/opentelemetry` NodeSdk when integrating with an existing OpenTelemetry
|
|
307
307
|
setup.
|
|
308
308
|
|
|
@@ -344,7 +344,7 @@ if (Predicate.isObject(thing)) {
|
|
|
344
344
|
|
|
345
345
|
## Working with SQL databases
|
|
346
346
|
|
|
347
|
-
Use the `effect/
|
|
347
|
+
Use the `effect/sql` modules together with a driver package such as
|
|
348
348
|
`@effect/sql-sqlite-node` to access SQL databases. Define domain models with
|
|
349
349
|
`Model.Class` to derive schemas for the database and JSON boundaries, run
|
|
350
350
|
migrations, and write type-safe queries.
|
|
@@ -372,13 +372,13 @@ Build http clients with the `HttpClient` module.
|
|
|
372
372
|
|
|
373
373
|
## Working with child processes
|
|
374
374
|
|
|
375
|
-
Use the `effect/
|
|
375
|
+
Use the `effect/process` modules to define child processes and run them with `ChildProcessSpawner`.
|
|
376
376
|
|
|
377
377
|
- **[Working with child processes](./ai-docs/src/60_child-process/10_working-with-child-processes.ts)**: This example shows how to collect process output, compose pipelines, and stream long-running command output.
|
|
378
378
|
|
|
379
379
|
## Building CLI applications
|
|
380
380
|
|
|
381
|
-
Use the "effect/
|
|
381
|
+
Use the "effect/cli" modules to build CLI applications. These modules
|
|
382
382
|
provide utilities for parsing command-line arguments, handling user input, and
|
|
383
383
|
managing the flow of a CLI application.
|
|
384
384
|
|
package/CLAUDE.md
CHANGED
|
@@ -302,7 +302,7 @@ Use it when your Effect programs need testable current time, safe parsing, stabl
|
|
|
302
302
|
|
|
303
303
|
Effect has built-in support for structured logging, distributed tracing, and
|
|
304
304
|
metrics. For exporting telemetry, use the lightweight Otlp modules from
|
|
305
|
-
`effect/
|
|
305
|
+
`effect/observability` in new projects, or use
|
|
306
306
|
`@effect/opentelemetry` NodeSdk when integrating with an existing OpenTelemetry
|
|
307
307
|
setup.
|
|
308
308
|
|
|
@@ -344,7 +344,7 @@ if (Predicate.isObject(thing)) {
|
|
|
344
344
|
|
|
345
345
|
## Working with SQL databases
|
|
346
346
|
|
|
347
|
-
Use the `effect/
|
|
347
|
+
Use the `effect/sql` modules together with a driver package such as
|
|
348
348
|
`@effect/sql-sqlite-node` to access SQL databases. Define domain models with
|
|
349
349
|
`Model.Class` to derive schemas for the database and JSON boundaries, run
|
|
350
350
|
migrations, and write type-safe queries.
|
|
@@ -372,13 +372,13 @@ Build http clients with the `HttpClient` module.
|
|
|
372
372
|
|
|
373
373
|
## Working with child processes
|
|
374
374
|
|
|
375
|
-
Use the `effect/
|
|
375
|
+
Use the `effect/process` modules to define child processes and run them with `ChildProcessSpawner`.
|
|
376
376
|
|
|
377
377
|
- **[Working with child processes](./ai-docs/src/60_child-process/10_working-with-child-processes.ts)**: This example shows how to collect process output, compose pipelines, and stream long-running command output.
|
|
378
378
|
|
|
379
379
|
## Building CLI applications
|
|
380
380
|
|
|
381
|
-
Use the "effect/
|
|
381
|
+
Use the "effect/cli" modules to build CLI applications. These modules
|
|
382
382
|
provide utilities for parsing command-line arguments, handling user input, and
|
|
383
383
|
managing the flow of a CLI application.
|
|
384
384
|
|
package/ai-docs/package.json
CHANGED
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
"@effect/sql-sqlite-wasm": "workspace:*",
|
|
28
28
|
"@effect/vitest": "workspace:*",
|
|
29
29
|
"effect": "workspace:*",
|
|
30
|
-
"hono": "^4.13.
|
|
31
|
-
"nodemailer": "^10.0.
|
|
30
|
+
"hono": "^4.13.9",
|
|
31
|
+
"nodemailer": "^10.0.10"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@types/nodemailer": "^8.0.
|
|
34
|
+
"@types/nodemailer": "^8.0.2"
|
|
35
35
|
}
|
|
36
36
|
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
import { PgClient } from "@effect/sql-pg"
|
|
9
9
|
import { Array, Config, Context, Effect, Layer, type Option, Schema } from "effect"
|
|
10
|
-
import { SqlClient, SqlError } from "effect/
|
|
10
|
+
import { SqlClient, SqlError } from "effect/sql"
|
|
11
11
|
|
|
12
12
|
// Define a layer for the SqlClient service
|
|
13
13
|
export const SqlClientLayer: Layer.Layer<
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { NodeHttpServer, NodeRuntime } from "@effect/platform-node"
|
|
7
7
|
import { Effect, Layer } from "effect"
|
|
8
|
-
import { HttpRouter, HttpServerResponse } from "effect/
|
|
8
|
+
import { HttpRouter, HttpServerResponse } from "effect/http"
|
|
9
9
|
import { createServer } from "node:http"
|
|
10
10
|
|
|
11
11
|
// Build a tiny HTTP app with a health-check endpoint.
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* decode and encode streams of structured data.
|
|
6
6
|
*/
|
|
7
7
|
import { DateTime, Schema, Stream } from "effect"
|
|
8
|
-
import { Ndjson, SchemaBinary } from "effect/
|
|
8
|
+
import { Ndjson, SchemaBinary } from "effect/encoding"
|
|
9
9
|
|
|
10
10
|
// SchemaBinary derives a framed binary decoder directly from a schema.
|
|
11
11
|
export const schemaBinaryDecoder = SchemaBinary.decode(Schema.Struct({
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { NodeRuntime } from "@effect/platform-node"
|
|
7
7
|
import { Context, Effect, Layer } from "effect"
|
|
8
|
-
import { FetchHttpClient } from "effect/
|
|
9
|
-
import { OtlpLogger, OtlpSerialization, OtlpTracer } from "effect/
|
|
8
|
+
import { FetchHttpClient } from "effect/http"
|
|
9
|
+
import { OtlpLogger, OtlpSerialization, OtlpTracer } from "effect/observability"
|
|
10
10
|
|
|
11
11
|
// Configure OTLP span export.
|
|
12
12
|
export const OtlpTracingLayer = OtlpTracer.layer({
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Effect has built-in support for structured logging, distributed tracing, and
|
|
4
4
|
metrics. For exporting telemetry, use the lightweight Otlp modules from
|
|
5
|
-
`effect/
|
|
5
|
+
`effect/observability` in new projects, or use
|
|
6
6
|
`@effect/opentelemetry` NodeSdk when integrating with an existing OpenTelemetry
|
|
7
7
|
setup.
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
import { NodeRuntime } from "@effect/platform-node"
|
|
8
8
|
import { SqliteClient, SqliteMigrator } from "@effect/sql-sqlite-node"
|
|
9
9
|
import { Context, Effect, Layer, Schema } from "effect"
|
|
10
|
-
import { Model } from "effect/
|
|
11
|
-
import { SqlClient, SqlModel, SqlSchema } from "effect/
|
|
10
|
+
import { Model } from "effect/schema"
|
|
11
|
+
import { SqlClient, SqlModel, SqlSchema } from "effect/sql"
|
|
12
12
|
|
|
13
13
|
// Use a branded string for the group id, so it cannot be mixed up with other
|
|
14
14
|
// string ids in the application.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
## Working with SQL databases
|
|
2
2
|
|
|
3
|
-
Use the `effect/
|
|
3
|
+
Use the `effect/sql` modules together with a driver package such as
|
|
4
4
|
`@effect/sql-sqlite-node` to access SQL databases. Define domain models with
|
|
5
5
|
`Model.Class` to derive schemas for the database and JSON boundaries, run
|
|
6
6
|
migrations, and write type-safe queries.
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Define a service that uses the HttpClient module to fetch data from an external API
|
|
5
5
|
*/
|
|
6
6
|
import { Context, Effect, flow, Layer, Schedule, Schema } from "effect"
|
|
7
|
-
import { FetchHttpClient, HttpClient, HttpClientRequest, HttpClientResponse } from "effect/
|
|
7
|
+
import { FetchHttpClient, HttpClient, HttpClientRequest, HttpClientResponse } from "effect/http"
|
|
8
8
|
|
|
9
9
|
class Todo extends Schema.Class<Todo>("Todo")({
|
|
10
10
|
userId: Schema.Int,
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { NodeHttpServer, NodeRuntime } from "@effect/platform-node"
|
|
8
8
|
import { Context, Effect, flow, Layer, Schedule } from "effect"
|
|
9
|
-
import { FetchHttpClient, HttpClient, HttpClientRequest, HttpRouter, HttpServer } from "effect/
|
|
10
|
-
import { HttpApiBuilder, HttpApiClient, HttpApiMiddleware, HttpApiScalar } from "effect/
|
|
9
|
+
import { FetchHttpClient, HttpClient, HttpClientRequest, HttpRouter, HttpServer } from "effect/http"
|
|
10
|
+
import { HttpApiBuilder, HttpApiClient, HttpApiMiddleware, HttpApiScalar } from "effect/http-api"
|
|
11
11
|
import { createServer } from "node:http"
|
|
12
12
|
// Api definitions should **always** be seperate from the server implementation,
|
|
13
13
|
// so that they can be shared between the server and client without leaking
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { assert, layer } from "@effect/vitest"
|
|
8
8
|
import { Effect, Layer } from "effect"
|
|
9
|
-
import { HttpClientRequest, HttpServer } from "effect/
|
|
10
|
-
import { HttpApiMiddleware, HttpApiTest } from "effect/
|
|
9
|
+
import { HttpClientRequest, HttpServer } from "effect/http"
|
|
10
|
+
import { HttpApiMiddleware, HttpApiTest } from "effect/http-api"
|
|
11
11
|
import { Api } from "./fixtures/api/Api.ts"
|
|
12
12
|
import { Authorization } from "./fixtures/api/Authorization.ts"
|
|
13
13
|
import { UserId } from "./fixtures/domain/User.ts"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Context, Schema } from "effect"
|
|
2
|
-
import { HttpApiMiddleware, HttpApiSecurity } from "effect/
|
|
2
|
+
import { HttpApiMiddleware, HttpApiSecurity } from "effect/http-api"
|
|
3
3
|
import type { User } from "../domain/User.ts"
|
|
4
4
|
|
|
5
5
|
export class CurrentUser extends Context.Service<CurrentUser, User>()("acme/HttpApi/Authorization/CurrentUser") {}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Schema } from "effect"
|
|
2
|
-
import { HttpApiEndpoint, HttpApiError, HttpApiGroup, HttpApiSchema, OpenApi } from "effect/
|
|
2
|
+
import { HttpApiEndpoint, HttpApiError, HttpApiGroup, HttpApiSchema, OpenApi } from "effect/http-api"
|
|
3
3
|
import { User, UserId } from "../domain/User.ts"
|
|
4
4
|
import { SearchQueryTooShort, UserNotFound } from "../domain/UserErrors.ts"
|
|
5
5
|
import { Authorization } from "./Authorization.ts"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Effect, Layer } from "effect"
|
|
2
|
-
import { HttpApiBuilder, HttpApiError } from "effect/
|
|
2
|
+
import { HttpApiBuilder, HttpApiError } from "effect/http-api"
|
|
3
3
|
import { Api } from "../../api/Api.ts"
|
|
4
4
|
import { CurrentUser } from "../../api/Authorization.ts"
|
|
5
5
|
import { AuthorizationLayer } from "../Authorization.ts"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SqliteClient, SqliteMigrator } from "@effect/sql-sqlite-node"
|
|
2
2
|
import { Context, Effect, Layer, Schema } from "effect"
|
|
3
|
-
import { SqlClient, SqlModel, SqlSchema } from "effect/
|
|
3
|
+
import { SqlClient, SqlModel, SqlSchema } from "effect/sql"
|
|
4
4
|
import { User } from "../domain/User.ts"
|
|
5
5
|
import type { UserId } from "../domain/User.ts"
|
|
6
6
|
import { SearchQueryTooShort, UserNotFound, UsersError } from "../domain/UserErrors.ts"
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { NodeServices } from "@effect/platform-node"
|
|
7
7
|
import { Console, Context, Effect, Layer, Schema, Stream, String } from "effect"
|
|
8
|
-
import { ChildProcess, ChildProcessSpawner } from "effect/
|
|
8
|
+
import { ChildProcess, ChildProcessSpawner } from "effect/process"
|
|
9
9
|
|
|
10
10
|
export class DevToolsError extends Schema.TaggedError<DevToolsError>()("DevToolsError", {
|
|
11
11
|
cause: Schema.Defect()
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { NodeRuntime, NodeServices } from "@effect/platform-node"
|
|
8
8
|
import { Console, Effect, Option, Schema } from "effect"
|
|
9
|
-
import { Argument, Command, Flag } from "effect/
|
|
9
|
+
import { Argument, Command, Flag } from "effect/cli"
|
|
10
10
|
|
|
11
11
|
// You can define flags outside of commands and reuse them across multiple
|
|
12
12
|
// commands.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
## Building CLI applications
|
|
2
2
|
|
|
3
|
-
Use the "effect/
|
|
3
|
+
Use the "effect/cli" modules to build CLI applications. These modules
|
|
4
4
|
provide utilities for parsing command-line arguments, handling user input, and
|
|
5
5
|
managing the flow of a CLI application.
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
import { AnthropicClient, AnthropicLanguageModel } from "@effect/ai-anthropic"
|
|
8
8
|
import { OpenAiClient, OpenAiLanguageModel } from "@effect/ai-openai"
|
|
9
9
|
import { Config, Context, Effect, ExecutionPlan, Layer, Schema, Stream } from "effect"
|
|
10
|
-
import { AiError, LanguageModel, Model, type Response } from "effect/
|
|
11
|
-
import { FetchHttpClient } from "effect/
|
|
10
|
+
import { AiError, LanguageModel, Model, type Response } from "effect/ai"
|
|
11
|
+
import { FetchHttpClient } from "effect/http"
|
|
12
12
|
import { LaunchPlan } from "./fixtures/domain/LaunchPlan.ts"
|
|
13
13
|
|
|
14
14
|
// You can use Config to create ai clients
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { OpenAiClient, OpenAiLanguageModel, OpenAiTool } from "@effect/ai-openai"
|
|
8
8
|
import { Config, Context, Effect, Layer, Schema } from "effect"
|
|
9
|
-
import { AiError, LanguageModel, Tool, Toolkit } from "effect/
|
|
10
|
-
import { FetchHttpClient } from "effect/
|
|
9
|
+
import { AiError, LanguageModel, Tool, Toolkit } from "effect/ai"
|
|
10
|
+
import { FetchHttpClient } from "effect/http"
|
|
11
11
|
|
|
12
12
|
// ---------------------------------------------------------------------------
|
|
13
13
|
// 1. Defining tools
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { OpenAiClient, OpenAiLanguageModel } from "@effect/ai-openai"
|
|
8
8
|
import { Config, Context, DateTime, Effect, Layer, Ref, Schema } from "effect"
|
|
9
|
-
import { AiError, Chat, Prompt, Tool, Toolkit } from "effect/
|
|
10
|
-
import { FetchHttpClient } from "effect/
|
|
9
|
+
import { AiError, Chat, Prompt, Tool, Toolkit } from "effect/ai"
|
|
10
|
+
import { FetchHttpClient } from "effect/http"
|
|
11
11
|
|
|
12
12
|
// ---------------------------------------------------------------------------
|
|
13
13
|
// Provider setup
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { NodeClusterSocket, NodeRuntime } from "@effect/platform-node"
|
|
7
7
|
import { Effect, Layer, Ref, Schema } from "effect"
|
|
8
|
-
import { ClusterSchema, Entity, TestRunner } from "effect/
|
|
9
|
-
import { Rpc } from "effect/
|
|
10
|
-
import type { SqlClient } from "effect/
|
|
8
|
+
import { ClusterSchema, Entity, TestRunner } from "effect/cluster"
|
|
9
|
+
import { Rpc } from "effect/rpc"
|
|
10
|
+
import type { SqlClient } from "effect/sql"
|
|
11
11
|
|
|
12
12
|
export const Increment = Rpc.make("Increment", {
|
|
13
13
|
payload: { amount: Schema.Int },
|
package/dist/TypeSafeClient.d.ts
CHANGED
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @since 4.0.0
|
|
5
5
|
*/
|
|
6
|
+
import * as AiError from "effect/ai/AiError";
|
|
6
7
|
import * as Config from "effect/Config";
|
|
7
8
|
import * as Context from "effect/Context";
|
|
8
9
|
import * as Effect from "effect/Effect";
|
|
10
|
+
import * as HttpClient from "effect/http/HttpClient";
|
|
9
11
|
import * as Layer from "effect/Layer";
|
|
10
12
|
import * as Redacted from "effect/Redacted";
|
|
11
|
-
import * as AiError from "effect/unstable/ai/AiError";
|
|
12
|
-
import * as HttpClient from "effect/unstable/http/HttpClient";
|
|
13
13
|
import * as TypeSafeSchema from "./TypeSafeSchema.ts";
|
|
14
14
|
/**
|
|
15
15
|
* Low-level TypeSafe operations.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypeSafeClient.d.ts","sourceRoot":"","sources":["../src/TypeSafeClient.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"TypeSafeClient.d.ts","sourceRoot":"","sources":["../src/TypeSafeClient.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,OAAO,MAAM,mBAAmB,CAAA;AAC5C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,OAAO,KAAK,UAAU,MAAM,wBAAwB,CAAA;AAIpD,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAA;AAI3C,OAAO,KAAK,cAAc,MAAM,qBAAqB,CAAA;AAErD;;;;;GAKG;AACH,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,MAAM,EAAE,UAAU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AC,EAAE,CAAC,CAAC,MAAM,EAAE,UAAU,CAAC,UAAU,KAAK,UAAU,CAAC,UAAU,CAAC,GAAG,SAAS,CAAA;CAClG,KAAG,KAAK,CAAC,KAAK,CAAC,cAAc,EAAE,MAAM,CAAC,WAAW,EAAE,UAAU,CAAC,UAAU,CAUtE,CAAA"}
|
package/dist/TypeSafeClient.js
CHANGED
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @since 4.0.0
|
|
5
5
|
*/
|
|
6
|
+
import * as AiError from "effect/ai/AiError";
|
|
6
7
|
import * as Config from "effect/Config";
|
|
7
8
|
import * as Context from "effect/Context";
|
|
8
9
|
import * as Effect from "effect/Effect";
|
|
9
10
|
import { flow, identity } from "effect/Function";
|
|
11
|
+
import * as HttpClient from "effect/http/HttpClient";
|
|
12
|
+
import * as HttpClientRequest from "effect/http/HttpClientRequest";
|
|
13
|
+
import * as HttpClientResponse from "effect/http/HttpClientResponse";
|
|
10
14
|
import * as Layer from "effect/Layer";
|
|
11
15
|
import * as Redacted from "effect/Redacted";
|
|
12
|
-
import * as AiError from "effect/unstable/ai/AiError";
|
|
13
|
-
import * as HttpClient from "effect/unstable/http/HttpClient";
|
|
14
|
-
import * as HttpClientRequest from "effect/unstable/http/HttpClientRequest";
|
|
15
|
-
import * as HttpClientResponse from "effect/unstable/http/HttpClientResponse";
|
|
16
16
|
import * as Errors from "./internal/errors.js";
|
|
17
17
|
import { TypeSafeConfig } from "./TypeSafeConfig.js";
|
|
18
18
|
import * as TypeSafeSchema from "./TypeSafeSchema.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypeSafeClient.js","names":[],"sources":["../src/TypeSafeClient.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;AAKA,OAAO,KAAK,MAAM,MAAM,eAAe;AACvC,OAAO,KAAK,OAAO,MAAM,gBAAgB;AACzC,OAAO,KAAK,MAAM,MAAM,eAAe;AACvC,SAAS,IAAI,EAAE,QAA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Ae,EAAE,WAAW,CAAC,CAAC,CAC5E;IACH,UAAU,EAAE,MAAM,OAAO,CAAC,iBAAiB,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,gBAAgB,EAAE,YAAY;GAC3F,CAAC;AACJ,CAAC,CACF;AAED;;;;;;AAMA,OAAO,MAAM,KAAK,GAAI,OAAgB,IACpC,KAAK,CAAC,MAAM,CAAC,cAAc,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;AAE7C;;;;;;AAMA,OAAO,MAAM,WAAW,GAAI,OAI3B,IACC,KAAK,CAAC,MAAM,CACV,cAAc,EACd,MAAM,CAAC,GAAG,CAAC,aAAS;EAClB,OAAO,OAAO,IAAI,CAAC;IACjB,MAAM,EAAE,OAAQ,OAAO,EAAE,MAAM,IAAI,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAE;IACvE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,OAAO,CAAC,MAAM,GAAG,SAAS;IAC3D,eAAe,EAAE,OAAO,EAAE;GAC3B,CAAC;AACJ,CAAC,CAAC,CACH","ignoreList":[]}
|
package/dist/TypeSafeConfig.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import * as Context from "effect/Context";
|
|
7
7
|
import * as Effect from "effect/Effect";
|
|
8
|
-
import type { HttpClient } from "effect/
|
|
8
|
+
import type { HttpClient } from "effect/http/HttpClient";
|
|
9
9
|
declare const TypeSafeConfig_base: Context.ServiceClass<TypeSafeConfig, "@effect/ai-typesafe/TypeSafeConfig", TypeSafeConfig.Service>;
|
|
10
10
|
/**
|
|
11
11
|
* Scoped configuration read when executing TypeSafe requests.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypeSafeConfig.d.ts","sourceRoot":"","sources":["../src/TypeSafeConfig.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,MAA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CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;CAQvB,CAAA"}
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @since 4.0.0
|
|
5
5
|
*/
|
|
6
|
+
import * as DecisionModel from "effect/ai/DecisionModel";
|
|
7
|
+
import * as AiModel from "effect/ai/Model";
|
|
6
8
|
import * as Effect from "effect/Effect";
|
|
7
9
|
import * as Layer from "effect/Layer";
|
|
8
|
-
import * as DecisionModel from "effect/unstable/ai/DecisionModel";
|
|
9
|
-
import * as AiModel from "effect/unstable/ai/Model";
|
|
10
10
|
import { TypeSafeClient } from "./TypeSafeClient.ts";
|
|
11
11
|
/**
|
|
12
12
|
* Known TypeSafe model identifiers. Constructors also accept custom identifiers.
|
|
@@ -23,8 +23,9 @@ export type Model = "jev-latest" | "jev-preview" | "jev-1.13.0";
|
|
|
23
23
|
*/
|
|
24
24
|
export declare const model: (model: Model | (string & {})) => AiModel.Model<"typesafe", DecisionModel.DecisionModel, TypeSafeClient>;
|
|
25
25
|
/**
|
|
26
|
-
* Builds a decision service.
|
|
27
|
-
* DecisionModel validates distributions and
|
|
26
|
+
* Builds a decision service. Probabilities arrive rounded to two decimals, so
|
|
27
|
+
* DecisionModel rescales small sum drift when it validates distributions and
|
|
28
|
+
* derives rating labels.
|
|
28
29
|
*
|
|
29
30
|
* @category constructors
|
|
30
31
|
* @since 4.0.0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypeSafeDecisionModel.d.ts","sourceRoot":"","sources":["../src/TypeSafeDecisionModel.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"TypeSafeDecisionModel.d.ts","sourceRoot":"","sources":["../src/TypeSafeDecisionModel.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,aAAa,MAAM,yBAAyB,CAAA;AACxD,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAA;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAGpD;;;;;GAKG;AACH,MAAM,MAAM,KAAK,GAAG,YAAY,GAAG,aAAa,GAAG,YAAY,CAAA;AAE/D;;;;;GAKG;AACH,eAAO,MAAM,KAAK,UACT,KAAK,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,KAC3B,OAAO,CAAC,KAAK,CAAC,UAAU,EAAE,aAAa,CAAC,aAAa,EAAE,cAAc,CACrB,CAAA;AAEnD;;;;;;;GAOG;AACH,eAAO,MAAM,IAAI;oBAEc,KAAK,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC;uEAuDnD,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,KAAK,YACP;IAAE,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAA;CAAE,KACjD,KAAK,CAAC,KAAK,CAAC,aAAa,CAAC,aAAa,EAAE,KAAK,EAAE,cAAc,CACP,CAAA"}
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @since 4.0.0
|
|
5
5
|
*/
|
|
6
|
+
import * as DecisionModel from "effect/ai/DecisionModel";
|
|
7
|
+
import * as AiModel from "effect/ai/Model";
|
|
6
8
|
import * as Effect from "effect/Effect";
|
|
7
9
|
import * as Layer from "effect/Layer";
|
|
8
|
-
import * as DecisionModel from "effect/unstable/ai/DecisionModel";
|
|
9
|
-
import * as AiModel from "effect/unstable/ai/Model";
|
|
10
10
|
import { TypeSafeClient } from "./TypeSafeClient.js";
|
|
11
11
|
/**
|
|
12
12
|
* Creates a decision model with TypeSafe provider metadata.
|
|
@@ -18,8 +18,9 @@ export const model = model => AiModel.make("typesafe", model, layer({
|
|
|
18
18
|
model
|
|
19
19
|
}));
|
|
20
20
|
/**
|
|
21
|
-
* Builds a decision service.
|
|
22
|
-
* DecisionModel validates distributions and
|
|
21
|
+
* Builds a decision service. Probabilities arrive rounded to two decimals, so
|
|
22
|
+
* DecisionModel rescales small sum drift when it validates distributions and
|
|
23
|
+
* derives rating labels.
|
|
23
24
|
*
|
|
24
25
|
* @category constructors
|
|
25
26
|
* @since 4.0.0
|
|
@@ -27,6 +28,7 @@ export const model = model => AiModel.make("typesafe", model, layer({
|
|
|
27
28
|
export const make = /*#__PURE__*/Effect.fnUntraced(function* (options) {
|
|
28
29
|
const client = yield* TypeSafeClient;
|
|
29
30
|
return yield* DecisionModel.make({
|
|
31
|
+
probabilityPrecision: 2,
|
|
30
32
|
decide: Effect.fnUntraced(function* ({
|
|
31
33
|
state,
|
|
32
34
|
decisions
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypeSafeDecisionModel.js","names":[],"sources":["../src/TypeSafeDecisionModel.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;AAKA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"TypeSafeDecisionModel.js","names":[],"sources":["../src/TypeSafeDecisionModel.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;AAKA,OAAO,KAAK,aAAa,MAAM,yBAAyB;AACxD,OAAO,KAAK,OAAO,MAAM,iBAAiB;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe;AACvC,OAAO,KAAK,KAAK,MAAM,cAAc;AACrC,SAAS,cAAc,QAAQ,qBAAqB;AAWpD;;;;;;AAMA,OAAO,MAAM,KAAK,GAChB,KAA4B,IAE5B,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC;EAAE;AAAK,CAAE,CAAC,CAAC;AAEnD;;;;;;;;AAQA,OAAO,MAAM,IAAI,gBAAG,MAAM,CAAC,UAAU,CACnC,WACE,OAAkD;EAElD,MAAM,MAAM,GAAG,OAAO,cAAc;EACpC,OAAO,OAAO,aAAa,CAAC,IAAI,CA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 -1,7 +1,7 @@
|
|
|
1
|
+
import * as AiError from "effect/ai/AiError";
|
|
1
2
|
import * as Effect from "effect/Effect";
|
|
3
|
+
import type * as HttpClientError from "effect/http/HttpClientError";
|
|
2
4
|
import * as Schema from "effect/Schema";
|
|
3
|
-
import * as AiError from "effect/unstable/ai/AiError";
|
|
4
|
-
import type * as HttpClientError from "effect/unstable/http/HttpClientError";
|
|
5
5
|
export declare const mapSchemaError: (error: Schema.SchemaError, method: string) => AiError.AiError;
|
|
6
6
|
export declare const mapHttpClientError: (error: HttpClientError.HttpClientError, method: string) => Effect.Effect<never, AiError.AiError, never>;
|
|
7
7
|
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/internal/errors.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/internal/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,mBAAmB,CAAA;AAE5C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,KAAK,eAAe,MAAM,6BAA6B,CAAA;AAKnE,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAmCvC,eAAO,MAAM,cAAc,UAAW,MAAM,CAAC,WAAW,UAAU,MAAM,KAAG,OAAO,CAAC,OAK/E,CAAA;AAEJ,eAAO,MAAM,kBAAkB,0GA8D9B,CAAA"}
|
package/dist/internal/errors.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import * as AiError from "effect/ai/AiError";
|
|
1
2
|
import * as Duration from "effect/Duration";
|
|
2
3
|
import * as Effect from "effect/Effect";
|
|
3
4
|
import * as Num from "effect/Number";
|
|
4
5
|
import * as Option from "effect/Option";
|
|
5
6
|
import * as Redactable from "effect/Redactable";
|
|
6
7
|
import * as Schema from "effect/Schema";
|
|
7
|
-
import * as AiError from "effect/unstable/ai/AiError";
|
|
8
8
|
const requestDetails = request => ({
|
|
9
9
|
method: request.method,
|
|
10
10
|
url: request.url,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","names":[],"sources":["../../src/internal/errors.ts"],"sourcesContent":[null],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,iBAAiB;AAC3C,OAAO,KAAK,MAAM,MAAM,eAAe;
|
|
1
|
+
{"version":3,"file":"errors.js","names":[],"sources":["../../src/internal/errors.ts"],"sourcesContent":[null],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,mBAAmB;AAC5C,OAAO,KAAK,QAAQ,MAAM,iBAAiB;AAC3C,OAAO,KAAK,MAAM,MAAM,eAAe;AAGvC,OAAO,KAAK,GAAG,MAAM,eAAe;AACpC,OAAO,KAAK,MAAM,MAAM,eAAe;AACvC,OAAO,KAAK,UAAU,MAAM,mBAAmB;AAC/C,OAAO,KAAK,MAAM,MAAM,eAAe;AAEvC,MAAM,cAAc,GAAI,OAA4C,KAAM;EACxE,MAAM,EAAE,OAAO,CAAC,MAAM;EACtB,GAAG,EAAE,OAAO,CAAC,GAAG;EAChB,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC;EACxC,IAAI,EAAE,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC;EACzC,OAAO,EAAE,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO;CAC3C,CAAC;AAEF,MAAM,SAAS,gBAAG,MAAM,CAAC,MAAM,CAAC;EAC9B,OAAO,eAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;EACvC,IAAI,eAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;EACpC,IAAI,eAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM;CACpC,CAAC;AAEF,MAAM,eAAe,gBAAG,MAAM,CAAC,mBAAmB,CAAC,SAAS,CAAC;A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json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effect/ai-typesafe",
|
|
3
|
-
"version": "4.0.0-rc.
|
|
3
|
+
"version": "4.0.0-rc.118",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "A TypeSafe DecisionModel provider for Effect",
|
|
@@ -47,10 +47,10 @@
|
|
|
47
47
|
"provenance": true
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"effect": "^4.0.0-rc.
|
|
50
|
+
"effect": "^4.0.0-rc.118"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
|
-
"effect": "^4.0.0-rc.
|
|
53
|
+
"effect": "^4.0.0-rc.118"
|
|
54
54
|
},
|
|
55
55
|
"scripts": {
|
|
56
56
|
"codegen": "effect-utils codegen",
|
package/src/TypeSafeClient.ts
CHANGED
|
@@ -3,18 +3,18 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @since 4.0.0
|
|
5
5
|
*/
|
|
6
|
+
import * as AiError from "effect/ai/AiError"
|
|
6
7
|
import * as Config from "effect/Config"
|
|
7
8
|
import * as Context from "effect/Context"
|
|
8
9
|
import * as Effect from "effect/Effect"
|
|
9
10
|
import { flow, identity } from "effect/Function"
|
|
11
|
+
import * as HttpClient from "effect/http/HttpClient"
|
|
12
|
+
import type * as HttpClientError from "effect/http/HttpClientError"
|
|
13
|
+
import * as HttpClientRequest from "effect/http/HttpClientRequest"
|
|
14
|
+
import * as HttpClientResponse from "effect/http/HttpClientResponse"
|
|
10
15
|
import * as Layer from "effect/Layer"
|
|
11
16
|
import * as Redacted from "effect/Redacted"
|
|
12
17
|
import type * as Schema from "effect/Schema"
|
|
13
|
-
import * as AiError from "effect/unstable/ai/AiError"
|
|
14
|
-
import * as HttpClient from "effect/unstable/http/HttpClient"
|
|
15
|
-
import type * as HttpClientError from "effect/unstable/http/HttpClientError"
|
|
16
|
-
import * as HttpClientRequest from "effect/unstable/http/HttpClientRequest"
|
|
17
|
-
import * as HttpClientResponse from "effect/unstable/http/HttpClientResponse"
|
|
18
18
|
import * as Errors from "./internal/errors.ts"
|
|
19
19
|
import { TypeSafeConfig } from "./TypeSafeConfig.ts"
|
|
20
20
|
import * as TypeSafeSchema from "./TypeSafeSchema.ts"
|
package/src/TypeSafeConfig.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import * as Context from "effect/Context"
|
|
7
7
|
import * as Effect from "effect/Effect"
|
|
8
8
|
import { dual } from "effect/Function"
|
|
9
|
-
import type { HttpClient } from "effect/
|
|
9
|
+
import type { HttpClient } from "effect/http/HttpClient"
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Scoped configuration read when executing TypeSafe requests.
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @since 4.0.0
|
|
5
5
|
*/
|
|
6
|
+
import * as DecisionModel from "effect/ai/DecisionModel"
|
|
7
|
+
import * as AiModel from "effect/ai/Model"
|
|
6
8
|
import * as Effect from "effect/Effect"
|
|
7
9
|
import * as Layer from "effect/Layer"
|
|
8
|
-
import * as DecisionModel from "effect/unstable/ai/DecisionModel"
|
|
9
|
-
import * as AiModel from "effect/unstable/ai/Model"
|
|
10
10
|
import { TypeSafeClient } from "./TypeSafeClient.ts"
|
|
11
11
|
import type * as TypeSafeSchema from "./TypeSafeSchema.ts"
|
|
12
12
|
|
|
@@ -30,8 +30,9 @@ export const model = (
|
|
|
30
30
|
AiModel.make("typesafe", model, layer({ model }))
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
|
-
* Builds a decision service.
|
|
34
|
-
* DecisionModel validates distributions and
|
|
33
|
+
* Builds a decision service. Probabilities arrive rounded to two decimals, so
|
|
34
|
+
* DecisionModel rescales small sum drift when it validates distributions and
|
|
35
|
+
* derives rating labels.
|
|
35
36
|
*
|
|
36
37
|
* @category constructors
|
|
37
38
|
* @since 4.0.0
|
|
@@ -42,6 +43,7 @@ export const make = Effect.fnUntraced(
|
|
|
42
43
|
): Effect.fn.Return<DecisionModel.DecisionModel, never, TypeSafeClient> {
|
|
43
44
|
const client = yield* TypeSafeClient
|
|
44
45
|
return yield* DecisionModel.make({
|
|
46
|
+
probabilityPrecision: 2,
|
|
45
47
|
decide: Effect.fnUntraced(function*({ state, decisions }) {
|
|
46
48
|
const questions: Record<string, typeof TypeSafeSchema.Question.Encoded> = Object.create(null)
|
|
47
49
|
for (const [key, decision] of Object.entries(decisions)) {
|
package/src/internal/errors.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import * as AiError from "effect/ai/AiError"
|
|
1
2
|
import * as Duration from "effect/Duration"
|
|
2
3
|
import * as Effect from "effect/Effect"
|
|
4
|
+
import type * as HttpClientError from "effect/http/HttpClientError"
|
|
5
|
+
import type * as HttpClientRequest from "effect/http/HttpClientRequest"
|
|
3
6
|
import * as Num from "effect/Number"
|
|
4
7
|
import * as Option from "effect/Option"
|
|
5
8
|
import * as Redactable from "effect/Redactable"
|
|
6
9
|
import * as Schema from "effect/Schema"
|
|
7
|
-
import * as AiError from "effect/unstable/ai/AiError"
|
|
8
|
-
import type * as HttpClientError from "effect/unstable/http/HttpClientError"
|
|
9
|
-
import type * as HttpClientRequest from "effect/unstable/http/HttpClientRequest"
|
|
10
10
|
|
|
11
11
|
const requestDetails = (request: HttpClientRequest.HttpClientRequest) => ({
|
|
12
12
|
method: request.method,
|