effect 4.0.0-beta.30 → 4.0.0-beta.32
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/dist/Array.d.ts +87 -86
- package/dist/Array.d.ts.map +1 -1
- package/dist/Array.js +47 -40
- package/dist/Array.js.map +1 -1
- package/dist/BigDecimal.d.ts +46 -45
- package/dist/BigDecimal.d.ts.map +1 -1
- package/dist/BigDecimal.js +35 -38
- package/dist/BigDecimal.js.map +1 -1
- package/dist/BigInt.d.ts +39 -32
- package/dist/BigInt.d.ts.map +1 -1
- package/dist/BigInt.js +32 -29
- package/dist/BigInt.js.map +1 -1
- package/dist/Channel.d.ts +2 -2
- package/dist/Channel.d.ts.map +1 -1
- package/dist/Channel.js.map +1 -1
- package/dist/Chunk.d.ts +58 -57
- package/dist/Chunk.d.ts.map +1 -1
- package/dist/Chunk.js +20 -21
- package/dist/Chunk.js.map +1 -1
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +4 -1
- package/dist/Config.js.map +1 -1
- package/dist/Cron.d.ts +3 -6
- package/dist/Cron.d.ts.map +1 -1
- package/dist/Cron.js +11 -18
- package/dist/Cron.js.map +1 -1
- package/dist/DateTime.d.ts +49 -92
- package/dist/DateTime.d.ts.map +1 -1
- package/dist/DateTime.js +9 -9
- package/dist/DateTime.js.map +1 -1
- package/dist/Deferred.d.ts +7 -5
- package/dist/Deferred.d.ts.map +1 -1
- package/dist/Deferred.js +7 -5
- package/dist/Deferred.js.map +1 -1
- package/dist/Duration.d.ts +55 -25
- package/dist/Duration.d.ts.map +1 -1
- package/dist/Duration.js +100 -70
- package/dist/Duration.js.map +1 -1
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +3 -4
- package/dist/Effect.js.map +1 -1
- package/dist/Fiber.d.ts +2 -1
- package/dist/Fiber.d.ts.map +1 -1
- package/dist/Fiber.js.map +1 -1
- package/dist/FiberHandle.d.ts +9 -8
- package/dist/FiberHandle.d.ts.map +1 -1
- package/dist/FiberHandle.js +8 -7
- package/dist/FiberHandle.js.map +1 -1
- package/dist/FiberMap.d.ts +20 -19
- package/dist/FiberMap.d.ts.map +1 -1
- package/dist/FiberMap.js +6 -6
- package/dist/FiberMap.js.map +1 -1
- package/dist/FileSystem.d.ts +17 -16
- package/dist/FileSystem.d.ts.map +1 -1
- package/dist/FileSystem.js +10 -7
- package/dist/FileSystem.js.map +1 -1
- package/dist/Graph.d.ts +64 -64
- package/dist/Graph.d.ts.map +1 -1
- package/dist/Graph.js +53 -53
- package/dist/Graph.js.map +1 -1
- package/dist/HashMap.d.ts +11 -5
- package/dist/HashMap.d.ts.map +1 -1
- package/dist/HashMap.js +3 -1
- package/dist/HashMap.js.map +1 -1
- package/dist/Iterable.d.ts +11 -11
- package/dist/Iterable.d.ts.map +1 -1
- package/dist/Iterable.js +12 -12
- package/dist/Iterable.js.map +1 -1
- package/dist/Latch.d.ts +69 -3
- package/dist/Latch.d.ts.map +1 -1
- package/dist/Latch.js +58 -0
- package/dist/Latch.js.map +1 -1
- package/dist/Layer.d.ts +181 -2
- package/dist/Layer.d.ts.map +1 -1
- package/dist/Layer.js +35 -2
- package/dist/Layer.js.map +1 -1
- package/dist/Number.d.ts +74 -18
- package/dist/Number.d.ts.map +1 -1
- package/dist/Number.js +34 -15
- package/dist/Number.js.map +1 -1
- package/dist/Option.d.ts +2 -0
- package/dist/Option.d.ts.map +1 -1
- package/dist/Option.js.map +1 -1
- package/dist/PartitionedSemaphore.d.ts +183 -0
- package/dist/PartitionedSemaphore.d.ts.map +1 -0
- package/dist/PartitionedSemaphore.js +231 -0
- package/dist/PartitionedSemaphore.js.map +1 -0
- package/dist/PubSub.d.ts +5 -4
- package/dist/PubSub.d.ts.map +1 -1
- package/dist/PubSub.js +6 -5
- package/dist/PubSub.js.map +1 -1
- package/dist/Queue.d.ts +3 -3
- package/dist/Queue.d.ts.map +1 -1
- package/dist/Queue.js +2 -2
- package/dist/Queue.js.map +1 -1
- package/dist/Record.d.ts +40 -40
- package/dist/Record.d.ts.map +1 -1
- package/dist/Record.js +16 -15
- package/dist/Record.js.map +1 -1
- package/dist/Scheduler.d.ts +25 -123
- package/dist/Scheduler.d.ts.map +1 -1
- package/dist/Scheduler.js +20 -123
- package/dist/Scheduler.js.map +1 -1
- package/dist/Schema.d.ts +2346 -114
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +1359 -68
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +2 -2
- package/dist/SchemaAST.js +2 -2
- package/dist/SchemaGetter.js +6 -4
- package/dist/SchemaGetter.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +2 -2
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/SchemaTransformation.d.ts.map +1 -1
- package/dist/SchemaTransformation.js +32 -27
- package/dist/SchemaTransformation.js.map +1 -1
- package/dist/Semaphore.d.ts +149 -53
- package/dist/Semaphore.d.ts.map +1 -1
- package/dist/Semaphore.js +137 -117
- package/dist/Semaphore.js.map +1 -1
- package/dist/ServiceMap.d.ts +26 -0
- package/dist/ServiceMap.d.ts.map +1 -1
- package/dist/ServiceMap.js +36 -21
- package/dist/ServiceMap.js.map +1 -1
- package/dist/Stream.js +1 -1
- package/dist/Stream.js.map +1 -1
- package/dist/String.d.ts +114 -47
- package/dist/String.d.ts.map +1 -1
- package/dist/String.js +29 -47
- package/dist/String.js.map +1 -1
- package/dist/SubscriptionRef.d.ts +1 -2
- package/dist/SubscriptionRef.d.ts.map +1 -1
- package/dist/SubscriptionRef.js +81 -115
- package/dist/SubscriptionRef.js.map +1 -1
- package/dist/Terminal.d.ts +2 -1
- package/dist/Terminal.d.ts.map +1 -1
- package/dist/Terminal.js.map +1 -1
- package/dist/Tracer.d.ts +5 -4
- package/dist/Tracer.d.ts.map +1 -1
- package/dist/Tracer.js +2 -1
- package/dist/Tracer.js.map +1 -1
- package/dist/Trie.d.ts +26 -14
- package/dist/Trie.d.ts.map +1 -1
- package/dist/Trie.js +8 -4
- package/dist/Trie.js.map +1 -1
- package/dist/TxHashMap.d.ts +77 -59
- package/dist/TxHashMap.d.ts.map +1 -1
- package/dist/TxHashMap.js +25 -19
- package/dist/TxHashMap.js.map +1 -1
- package/dist/TxSemaphore.d.ts +162 -2
- package/dist/TxSemaphore.d.ts.map +1 -1
- package/dist/TxSemaphore.js +16 -2
- package/dist/TxSemaphore.js.map +1 -1
- package/dist/index.d.ts +88 -32
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +88 -32
- package/dist/index.js.map +1 -1
- package/dist/internal/dateTime.js +66 -59
- package/dist/internal/dateTime.js.map +1 -1
- package/dist/internal/effect.js +21 -90
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/hashMap.js +2 -1
- package/dist/internal/hashMap.js.map +1 -1
- package/dist/internal/option.js +6 -0
- package/dist/internal/option.js.map +1 -1
- package/dist/internal/trie.js +3 -3
- package/dist/internal/trie.js.map +1 -1
- package/dist/unstable/ai/AiError.js +1 -1
- package/dist/unstable/ai/AiError.js.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.js +4 -0
- package/dist/unstable/ai/AnthropicStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Chat.d.ts +3 -4
- package/dist/unstable/ai/Chat.d.ts.map +1 -1
- package/dist/unstable/ai/Chat.js +2 -2
- package/dist/unstable/ai/Chat.js.map +1 -1
- package/dist/unstable/ai/LanguageModel.d.ts +30 -16
- package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
- package/dist/unstable/ai/LanguageModel.js +10 -87
- package/dist/unstable/ai/LanguageModel.js.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js +4 -0
- package/dist/unstable/ai/OpenAiStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Tool.d.ts +14 -0
- package/dist/unstable/ai/Tool.d.ts.map +1 -1
- package/dist/unstable/ai/Tool.js +13 -0
- package/dist/unstable/ai/Tool.js.map +1 -1
- package/dist/unstable/cli/Argument.d.ts +2 -4
- package/dist/unstable/cli/Argument.d.ts.map +1 -1
- package/dist/unstable/cli/Argument.js +1 -3
- package/dist/unstable/cli/Argument.js.map +1 -1
- package/dist/unstable/cli/CliOutput.d.ts +3 -2
- package/dist/unstable/cli/CliOutput.d.ts.map +1 -1
- package/dist/unstable/cli/CliOutput.js +4 -3
- package/dist/unstable/cli/CliOutput.js.map +1 -1
- package/dist/unstable/cli/Command.d.ts +3 -2
- package/dist/unstable/cli/Command.d.ts.map +1 -1
- package/dist/unstable/cli/Command.js +3 -3
- package/dist/unstable/cli/Command.js.map +1 -1
- package/dist/unstable/cli/Completions.d.ts +16 -0
- package/dist/unstable/cli/Completions.d.ts.map +1 -0
- package/dist/unstable/cli/Completions.js +23 -0
- package/dist/unstable/cli/Completions.js.map +1 -0
- package/dist/unstable/cli/Flag.d.ts +2 -2
- package/dist/unstable/cli/Flag.d.ts.map +1 -1
- package/dist/unstable/cli/Flag.js +1 -1
- package/dist/unstable/cli/Flag.js.map +1 -1
- package/dist/unstable/cli/GlobalFlag.d.ts.map +1 -1
- package/dist/unstable/cli/GlobalFlag.js +4 -4
- package/dist/unstable/cli/GlobalFlag.js.map +1 -1
- package/dist/unstable/cli/HelpDoc.d.ts +14 -12
- package/dist/unstable/cli/HelpDoc.d.ts.map +1 -1
- package/dist/unstable/cli/Param.d.ts +4 -4
- package/dist/unstable/cli/Param.d.ts.map +1 -1
- package/dist/unstable/cli/Param.js +7 -7
- package/dist/unstable/cli/Param.js.map +1 -1
- package/dist/unstable/cli/Primitive.d.ts +1 -1
- package/dist/unstable/cli/Primitive.d.ts.map +1 -1
- package/dist/unstable/cli/Primitive.js.map +1 -1
- package/dist/unstable/cli/Prompt.js +71 -67
- package/dist/unstable/cli/Prompt.js.map +1 -1
- package/dist/unstable/cli/index.d.ts +4 -0
- package/dist/unstable/cli/index.d.ts.map +1 -1
- package/dist/unstable/cli/index.js +4 -0
- package/dist/unstable/cli/index.js.map +1 -1
- package/dist/unstable/cli/internal/completions/CommandDescriptor.js +9 -2
- package/dist/unstable/cli/internal/completions/CommandDescriptor.js.map +1 -1
- package/dist/unstable/cli/internal/parser.js +8 -3
- package/dist/unstable/cli/internal/parser.js.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts +3 -2
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js +25 -23
- package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/unstable/cluster/DeliverAt.js +1 -1
- package/dist/unstable/cluster/DeliverAt.js.map +1 -1
- package/dist/unstable/cluster/Entity.d.ts +3 -2
- package/dist/unstable/cluster/Entity.d.ts.map +1 -1
- package/dist/unstable/cluster/Entity.js +7 -7
- package/dist/unstable/cluster/Entity.js.map +1 -1
- package/dist/unstable/cluster/Message.d.ts +4 -3
- package/dist/unstable/cluster/Message.d.ts.map +1 -1
- package/dist/unstable/cluster/Message.js +3 -2
- package/dist/unstable/cluster/Message.js.map +1 -1
- package/dist/unstable/cluster/MessageStorage.d.ts +10 -10
- package/dist/unstable/cluster/MessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/MessageStorage.js +12 -12
- package/dist/unstable/cluster/MessageStorage.js.map +1 -1
- package/dist/unstable/cluster/Reply.d.ts +2 -1
- package/dist/unstable/cluster/Reply.d.ts.map +1 -1
- package/dist/unstable/cluster/Reply.js +4 -3
- package/dist/unstable/cluster/Reply.js.map +1 -1
- package/dist/unstable/cluster/RunnerServer.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerServer.js +9 -8
- package/dist/unstable/cluster/RunnerServer.js.map +1 -1
- package/dist/unstable/cluster/Runners.d.ts +2 -1
- package/dist/unstable/cluster/Runners.d.ts.map +1 -1
- package/dist/unstable/cluster/Runners.js +7 -6
- package/dist/unstable/cluster/Runners.js.map +1 -1
- package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
- package/dist/unstable/cluster/Sharding.js +19 -13
- package/dist/unstable/cluster/Sharding.js.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.d.ts +5 -4
- package/dist/unstable/cluster/ShardingConfig.d.ts.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.js +4 -4
- package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.js +19 -18
- package/dist/unstable/cluster/SqlMessageStorage.js.map +1 -1
- package/dist/unstable/cluster/internal/entityManager.js +9 -10
- package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.d.ts +2 -1
- package/dist/unstable/devtools/DevToolsSchema.d.ts.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.js +1 -4
- package/dist/unstable/devtools/DevToolsSchema.js.map +1 -1
- package/dist/unstable/encoding/Ndjson.d.ts +8 -8
- package/dist/unstable/encoding/Ndjson.d.ts.map +1 -1
- package/dist/unstable/encoding/Ndjson.js.map +1 -1
- package/dist/unstable/http/Cookies.d.ts +5 -4
- package/dist/unstable/http/Cookies.d.ts.map +1 -1
- package/dist/unstable/http/Cookies.js +3 -4
- package/dist/unstable/http/Cookies.js.map +1 -1
- package/dist/unstable/http/Etag.d.ts.map +1 -1
- package/dist/unstable/http/Etag.js +5 -1
- package/dist/unstable/http/Etag.js.map +1 -1
- package/dist/unstable/http/Headers.d.ts +3 -2
- package/dist/unstable/http/Headers.d.ts.map +1 -1
- package/dist/unstable/http/Headers.js +2 -1
- package/dist/unstable/http/Headers.js.map +1 -1
- package/dist/unstable/http/HttpClient.d.ts.map +1 -1
- package/dist/unstable/http/HttpClient.js +2 -1
- package/dist/unstable/http/HttpClient.js.map +1 -1
- package/dist/unstable/http/HttpClientRequest.d.ts +4 -3
- package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientRequest.js +8 -6
- package/dist/unstable/http/HttpClientRequest.js.map +1 -1
- package/dist/unstable/http/HttpClientResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientResponse.js +2 -1
- package/dist/unstable/http/HttpClientResponse.js.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.d.ts +3 -2
- package/dist/unstable/http/HttpIncomingMessage.d.ts.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
- package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
- package/dist/unstable/http/HttpMiddleware.js +16 -15
- package/dist/unstable/http/HttpMiddleware.js.map +1 -1
- package/dist/unstable/http/HttpPlatform.d.ts.map +1 -1
- package/dist/unstable/http/HttpPlatform.js +3 -2
- package/dist/unstable/http/HttpPlatform.js.map +1 -1
- package/dist/unstable/http/HttpRouter.d.ts +2 -1
- package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
- package/dist/unstable/http/HttpRouter.js +7 -7
- package/dist/unstable/http/HttpRouter.js.map +1 -1
- package/dist/unstable/http/HttpServer.d.ts.map +1 -1
- package/dist/unstable/http/HttpServer.js +2 -2
- package/dist/unstable/http/HttpServer.js.map +1 -1
- package/dist/unstable/http/HttpServerError.d.ts +2 -1
- package/dist/unstable/http/HttpServerError.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerError.js +2 -1
- package/dist/unstable/http/HttpServerError.js.map +1 -1
- package/dist/unstable/http/HttpServerRequest.d.ts +3 -2
- package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRequest.js +14 -10
- package/dist/unstable/http/HttpServerRequest.js.map +1 -1
- package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerResponse.js +4 -3
- package/dist/unstable/http/HttpServerResponse.js.map +1 -1
- package/dist/unstable/http/HttpTraceContext.d.ts +3 -2
- package/dist/unstable/http/HttpTraceContext.d.ts.map +1 -1
- package/dist/unstable/http/HttpTraceContext.js +27 -15
- package/dist/unstable/http/HttpTraceContext.js.map +1 -1
- package/dist/unstable/http/UrlParams.d.ts +5 -4
- package/dist/unstable/http/UrlParams.d.ts.map +1 -1
- package/dist/unstable/http/UrlParams.js +5 -6
- package/dist/unstable/http/UrlParams.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts +2 -2
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.js +4 -2
- package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.d.ts +15 -0
- package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.js +81 -3
- package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
- package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpExporter.js +2 -2
- package/dist/unstable/observability/OtlpExporter.js.map +1 -1
- package/dist/unstable/observability/OtlpTracer.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpTracer.js +7 -3
- package/dist/unstable/observability/OtlpTracer.js.map +1 -1
- package/dist/unstable/persistence/Persistable.js +1 -1
- package/dist/unstable/persistence/Persistable.js.map +1 -1
- package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
- package/dist/unstable/reactivity/Atom.js +1 -5
- package/dist/unstable/reactivity/Atom.js.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.js +4 -2
- package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
- package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
- package/dist/unstable/rpc/Rpc.js +4 -3
- package/dist/unstable/rpc/Rpc.js.map +1 -1
- package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClient.js +4 -4
- package/dist/unstable/rpc/RpcClient.js.map +1 -1
- package/dist/unstable/rpc/RpcGroup.d.ts +1 -3
- package/dist/unstable/rpc/RpcGroup.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSchema.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSchema.js +3 -2
- package/dist/unstable/rpc/RpcSchema.js.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.js +4 -1
- package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
- package/dist/unstable/rpc/RpcServer.d.ts +1 -1
- package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcServer.js +3 -2
- package/dist/unstable/rpc/RpcServer.js.map +1 -1
- package/dist/unstable/socket/Socket.d.ts.map +1 -1
- package/dist/unstable/socket/Socket.js +2 -1
- package/dist/unstable/socket/Socket.js.map +1 -1
- package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
- package/dist/unstable/sql/SqlClient.js +1 -1
- package/dist/unstable/sql/SqlClient.js.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.js +6 -6
- package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
- package/dist/unstable/workflow/Workflow.d.ts +2 -1
- package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.d.ts +5 -4
- package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js +19 -14
- package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
- package/package.json +1 -1
- package/src/Array.ts +112 -105
- package/src/BigDecimal.ts +63 -66
- package/src/BigInt.ts +49 -41
- package/src/Channel.ts +3 -3
- package/src/Chunk.ts +68 -63
- package/src/Config.ts +4 -1
- package/src/Cron.ts +13 -18
- package/src/DateTime.ts +51 -92
- package/src/Deferred.ts +8 -6
- package/src/Duration.ts +112 -56
- package/src/Effect.ts +3 -4
- package/src/Fiber.ts +2 -1
- package/src/FiberHandle.ts +10 -9
- package/src/FiberMap.ts +22 -22
- package/src/FileSystem.ts +25 -22
- package/src/Graph.ts +105 -105
- package/src/HashMap.ts +11 -5
- package/src/Iterable.ts +13 -13
- package/src/Latch.ts +85 -3
- package/src/Layer.ts +244 -19
- package/src/Number.ts +85 -26
- package/src/Option.ts +2 -0
- package/src/PartitionedSemaphore.ts +414 -0
- package/src/PubSub.ts +7 -6
- package/src/Queue.ts +5 -5
- package/src/Record.ts +52 -47
- package/src/Scheduler.ts +37 -126
- package/src/Schema.ts +2366 -116
- package/src/SchemaAST.ts +2 -2
- package/src/SchemaGetter.ts +4 -4
- package/src/SchemaRepresentation.ts +2 -2
- package/src/SchemaTransformation.ts +27 -27
- package/src/Semaphore.ts +271 -183
- package/src/ServiceMap.ts +83 -31
- package/src/Stream.ts +1 -1
- package/src/String.ts +122 -69
- package/src/SubscriptionRef.ts +96 -117
- package/src/Terminal.ts +2 -1
- package/src/Tracer.ts +6 -5
- package/src/Trie.ts +26 -14
- package/src/TxHashMap.ts +78 -60
- package/src/TxSemaphore.ts +186 -11
- package/src/index.ts +89 -33
- package/src/internal/dateTime.ts +74 -65
- package/src/internal/effect.ts +30 -122
- package/src/internal/hashMap.ts +4 -3
- package/src/internal/option.ts +7 -0
- package/src/internal/trie.ts +6 -6
- package/src/unstable/ai/AiError.ts +1 -1
- package/src/unstable/ai/AnthropicStructuredOutput.ts +4 -0
- package/src/unstable/ai/Chat.ts +17 -15
- package/src/unstable/ai/LanguageModel.ts +148 -97
- package/src/unstable/ai/OpenAiStructuredOutput.ts +4 -0
- package/src/unstable/ai/Tool.ts +20 -0
- package/src/unstable/cli/Argument.ts +2 -4
- package/src/unstable/cli/CliOutput.ts +7 -5
- package/src/unstable/cli/Command.ts +5 -5
- package/src/unstable/cli/Completions.ts +36 -0
- package/src/unstable/cli/Flag.ts +2 -2
- package/src/unstable/cli/GlobalFlag.ts +4 -5
- package/src/unstable/cli/HelpDoc.ts +14 -12
- package/src/unstable/cli/Param.ts +15 -11
- package/src/unstable/cli/Primitive.ts +1 -1
- package/src/unstable/cli/Prompt.ts +81 -83
- package/src/unstable/cli/index.ts +5 -0
- package/src/unstable/cli/internal/completions/CommandDescriptor.ts +3 -2
- package/src/unstable/cli/internal/parser.ts +7 -4
- package/src/unstable/cluster/ClusterWorkflowEngine.ts +35 -30
- package/src/unstable/cluster/DeliverAt.ts +1 -1
- package/src/unstable/cluster/Entity.ts +13 -12
- package/src/unstable/cluster/Message.ts +6 -5
- package/src/unstable/cluster/MessageStorage.ts +26 -25
- package/src/unstable/cluster/Reply.ts +7 -4
- package/src/unstable/cluster/RunnerServer.ts +10 -13
- package/src/unstable/cluster/Runners.ts +8 -7
- package/src/unstable/cluster/Sharding.ts +24 -17
- package/src/unstable/cluster/ShardingConfig.ts +6 -6
- package/src/unstable/cluster/SqlMessageStorage.ts +21 -18
- package/src/unstable/cluster/internal/entityManager.ts +27 -21
- package/src/unstable/devtools/DevToolsSchema.ts +3 -2
- package/src/unstable/encoding/Ndjson.ts +17 -17
- package/src/unstable/http/Cookies.ts +7 -8
- package/src/unstable/http/Etag.ts +5 -3
- package/src/unstable/http/Headers.ts +6 -5
- package/src/unstable/http/HttpClient.ts +2 -1
- package/src/unstable/http/HttpClientRequest.ts +11 -9
- package/src/unstable/http/HttpClientResponse.ts +5 -4
- package/src/unstable/http/HttpIncomingMessage.ts +3 -2
- package/src/unstable/http/HttpMiddleware.ts +16 -15
- package/src/unstable/http/HttpPlatform.ts +3 -2
- package/src/unstable/http/HttpRouter.ts +9 -9
- package/src/unstable/http/HttpServer.ts +3 -9
- package/src/unstable/http/HttpServerError.ts +3 -2
- package/src/unstable/http/HttpServerRequest.ts +29 -25
- package/src/unstable/http/HttpServerResponse.ts +7 -6
- package/src/unstable/http/HttpTraceContext.ts +31 -17
- package/src/unstable/http/UrlParams.ts +11 -14
- package/src/unstable/httpapi/HttpApiBuilder.ts +13 -7
- package/src/unstable/httpapi/HttpApiError.ts +67 -12
- package/src/unstable/observability/OtlpExporter.ts +5 -2
- package/src/unstable/observability/OtlpTracer.ts +8 -4
- package/src/unstable/persistence/Persistable.ts +1 -1
- package/src/unstable/reactivity/Atom.ts +1 -4
- package/src/unstable/reactivity/AtomRegistry.ts +5 -3
- package/src/unstable/rpc/Rpc.ts +4 -3
- package/src/unstable/rpc/RpcClient.ts +10 -9
- package/src/unstable/rpc/RpcGroup.ts +3 -3
- package/src/unstable/rpc/RpcSchema.ts +6 -5
- package/src/unstable/rpc/RpcSerialization.ts +4 -1
- package/src/unstable/rpc/RpcServer.ts +3 -3
- package/src/unstable/socket/Socket.ts +2 -1
- package/src/unstable/sql/SqlClient.ts +5 -3
- package/src/unstable/workflow/DurableDeferred.ts +6 -6
- package/src/unstable/workflow/Workflow.ts +1 -1
- package/src/unstable/workflow/WorkflowEngine.ts +29 -20
- package/dist/NullOr.d.ts +0 -149
- package/dist/NullOr.d.ts.map +0 -1
- package/dist/NullOr.js +0 -152
- package/dist/NullOr.js.map +0 -1
- package/dist/unstable/cli/internal/completions/Completions.d.ts +0 -2
- package/dist/unstable/cli/internal/completions/Completions.d.ts.map +0 -1
- package/dist/unstable/cli/internal/completions/Completions.js +0 -23
- package/dist/unstable/cli/internal/completions/Completions.js.map +0 -1
- package/src/NullOr.ts +0 -204
- package/src/unstable/cli/internal/completions/Completions.ts +0 -31
|
@@ -22,6 +22,7 @@ import * as Predicate from "../../Predicate.ts"
|
|
|
22
22
|
import * as Schema from "../../Schema.ts"
|
|
23
23
|
import * as AST from "../../SchemaAST.ts"
|
|
24
24
|
import * as Transformation from "../../SchemaTransformation.ts"
|
|
25
|
+
import * as Tool from "./Tool.ts"
|
|
25
26
|
|
|
26
27
|
/**
|
|
27
28
|
* Transforms a `Schema.Codec` into a form compatible with Anthropic's
|
|
@@ -225,6 +226,9 @@ function recur(ast: AST.AST): AST.AST {
|
|
|
225
226
|
}
|
|
226
227
|
} else if (ast.indexSignatures.length === 1 && ast.propertySignatures.length === 0) {
|
|
227
228
|
const is = ast.indexSignatures[0]
|
|
229
|
+
if (Tool.isEmptyParamsRecord(is)) {
|
|
230
|
+
return ast
|
|
231
|
+
}
|
|
228
232
|
// records are not supported by Anthropic, so we translate them to arrays of key-value pairs
|
|
229
233
|
if (annotations !== undefined && typeof annotations.description === "string") {
|
|
230
234
|
annotations.description = `${RECORD_DESCRIPTION}; ${annotations.description}`
|
package/src/unstable/ai/Chat.ts
CHANGED
|
@@ -64,7 +64,6 @@ import * as IdGenerator from "./IdGenerator.ts"
|
|
|
64
64
|
import * as LanguageModel from "./LanguageModel.ts"
|
|
65
65
|
import * as Prompt from "./Prompt.ts"
|
|
66
66
|
import type * as Response from "./Response.ts"
|
|
67
|
-
import type * as Tool from "./Tool.ts"
|
|
68
67
|
|
|
69
68
|
/**
|
|
70
69
|
* The `Chat` service tag for dependency injection.
|
|
@@ -200,10 +199,9 @@ export interface Service {
|
|
|
200
199
|
* ```
|
|
201
200
|
*/
|
|
202
201
|
readonly generateText: <
|
|
203
|
-
Options extends NoExcessProperties<LanguageModel.GenerateTextOptions<any>, Options
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
LanguageModel.GenerateTextResponse<Tools>,
|
|
202
|
+
Options extends NoExcessProperties<LanguageModel.GenerateTextOptions<any>, Options>
|
|
203
|
+
>(options: Options & LanguageModel.GenerateTextOptions<LanguageModel.ExtractTools<Options>>) => Effect.Effect<
|
|
204
|
+
LanguageModel.GenerateTextResponse<LanguageModel.ExtractTools<Options>>,
|
|
207
205
|
LanguageModel.ExtractError<Options>,
|
|
208
206
|
LanguageModel.LanguageModel | LanguageModel.ExtractServices<Options>
|
|
209
207
|
>
|
|
@@ -234,10 +232,9 @@ export interface Service {
|
|
|
234
232
|
* ```
|
|
235
233
|
*/
|
|
236
234
|
readonly streamText: <
|
|
237
|
-
Options extends NoExcessProperties<LanguageModel.GenerateTextOptions<any>, Options
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
Response.StreamPart<Tools>,
|
|
235
|
+
Options extends NoExcessProperties<LanguageModel.GenerateTextOptions<any>, Options>
|
|
236
|
+
>(options: Options & LanguageModel.GenerateTextOptions<LanguageModel.ExtractTools<Options>>) => Stream.Stream<
|
|
237
|
+
Response.StreamPart<LanguageModel.ExtractTools<Options>>,
|
|
241
238
|
LanguageModel.ExtractError<Options>,
|
|
242
239
|
LanguageModel.LanguageModel | LanguageModel.ExtractServices<Options>
|
|
243
240
|
>
|
|
@@ -278,10 +275,11 @@ export interface Service {
|
|
|
278
275
|
readonly generateObject: <
|
|
279
276
|
ObjectEncoded extends Record<string, any>,
|
|
280
277
|
ObjectSchema extends Schema.Encoder<ObjectEncoded, unknown>,
|
|
281
|
-
Options extends NoExcessProperties<LanguageModel.GenerateObjectOptions<any, ObjectSchema>, Options
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
278
|
+
Options extends NoExcessProperties<LanguageModel.GenerateObjectOptions<any, ObjectSchema>, Options>
|
|
279
|
+
>(
|
|
280
|
+
options: Options & LanguageModel.GenerateObjectOptions<LanguageModel.ExtractTools<Options>, ObjectSchema>
|
|
281
|
+
) => Effect.Effect<
|
|
282
|
+
LanguageModel.GenerateObjectResponse<LanguageModel.ExtractTools<Options>, ObjectSchema["Type"]>,
|
|
285
283
|
LanguageModel.ExtractError<Options>,
|
|
286
284
|
LanguageModel.ExtractServices<Options> | ObjectSchema["DecodingServices"] | LanguageModel.LanguageModel
|
|
287
285
|
>
|
|
@@ -698,7 +696,9 @@ export const makePersisted = Effect.fnUntraced(function*(options: {
|
|
|
698
696
|
yield* Ref.set(chat.history, history)
|
|
699
697
|
// Export the chat history
|
|
700
698
|
const exported = yield* Effect.orDie(chat.export)
|
|
701
|
-
const timeToLive = Predicate.isNotUndefined(ttl)
|
|
699
|
+
const timeToLive = Predicate.isNotUndefined(ttl)
|
|
700
|
+
? Option.getOrUndefined(Duration.fromInput(ttl))
|
|
701
|
+
: undefined
|
|
702
702
|
// Save the chat to the backing store
|
|
703
703
|
yield* store.set(chatId, exported as object, timeToLive)
|
|
704
704
|
}
|
|
@@ -740,7 +740,9 @@ export const makePersisted = Effect.fnUntraced(function*(options: {
|
|
|
740
740
|
// Export the chat history
|
|
741
741
|
const history = yield* Effect.orDie(chat.export)
|
|
742
742
|
// Save the history for the newly created chat
|
|
743
|
-
const timeToLive = Predicate.isNotUndefined(ttl)
|
|
743
|
+
const timeToLive = Predicate.isNotUndefined(ttl)
|
|
744
|
+
? Option.getOrUndefined(Duration.fromInput(ttl))
|
|
745
|
+
: undefined
|
|
744
746
|
yield* store.set(chatId, history as object, timeToLive)
|
|
745
747
|
// Convert the chat to a persisted chat
|
|
746
748
|
return yield* toPersisted(chatId, chat, ttl)
|
|
@@ -205,15 +205,7 @@ export interface GenerateTextOptions<Tools extends Record<string, Tool.Any>> {
|
|
|
205
205
|
* A toolkit containing both the tools and the tool call handler to use to
|
|
206
206
|
* augment text generation.
|
|
207
207
|
*/
|
|
208
|
-
readonly toolkit?:
|
|
209
|
-
| Toolkit.WithHandler<Tools>
|
|
210
|
-
| Effect.Yieldable<
|
|
211
|
-
Toolkit.Toolkit<Tools>,
|
|
212
|
-
Toolkit.WithHandler<Tools>,
|
|
213
|
-
never,
|
|
214
|
-
any
|
|
215
|
-
>
|
|
216
|
-
| undefined
|
|
208
|
+
readonly toolkit?: ToolkitOption<Tools> | undefined
|
|
217
209
|
|
|
218
210
|
/**
|
|
219
211
|
* The tool choice mode for the language model.
|
|
@@ -467,6 +459,89 @@ export class GenerateObjectResponse<
|
|
|
467
459
|
// Utility Types
|
|
468
460
|
// =============================================================================
|
|
469
461
|
|
|
462
|
+
/**
|
|
463
|
+
* The supported toolkit option shapes for language model operations.
|
|
464
|
+
*
|
|
465
|
+
* @since 4.0.0
|
|
466
|
+
* @category utility types
|
|
467
|
+
*/
|
|
468
|
+
export type ToolkitOption<
|
|
469
|
+
Tools extends Record<string, Tool.Any>,
|
|
470
|
+
E = never,
|
|
471
|
+
R = any
|
|
472
|
+
> = Tools extends any ? (
|
|
473
|
+
| Toolkit.WithHandler<Tools>
|
|
474
|
+
| Effect.Yieldable<
|
|
475
|
+
Toolkit.Toolkit<Tools>,
|
|
476
|
+
Toolkit.WithHandler<Tools>,
|
|
477
|
+
E,
|
|
478
|
+
R
|
|
479
|
+
>
|
|
480
|
+
)
|
|
481
|
+
: never
|
|
482
|
+
|
|
483
|
+
type ExtractToolsFromToolkitOption<ToolkitValue> = ToolkitValue extends Toolkit.WithHandler<infer Tools> ? Tools
|
|
484
|
+
: ToolkitValue extends Effect.Yieldable<
|
|
485
|
+
Toolkit.Toolkit<infer Tools>,
|
|
486
|
+
Toolkit.WithHandler<infer _Tools>,
|
|
487
|
+
infer _E,
|
|
488
|
+
infer _R
|
|
489
|
+
> ? Tools
|
|
490
|
+
: never
|
|
491
|
+
|
|
492
|
+
/**
|
|
493
|
+
* Utility type that extracts the toolset from LanguageModel options.
|
|
494
|
+
*
|
|
495
|
+
* @since 4.0.0
|
|
496
|
+
* @category utility types
|
|
497
|
+
*/
|
|
498
|
+
export type ExtractTools<Options> = Options extends {
|
|
499
|
+
readonly toolkit: infer ToolkitValue
|
|
500
|
+
} ? ExtractToolsFromToolkitOption<Exclude<ToolkitValue, undefined>>
|
|
501
|
+
: {}
|
|
502
|
+
|
|
503
|
+
type ExtractErrorFromToolkitOption<ToolkitValue, DisableToolCallResolution extends boolean> = ToolkitValue extends
|
|
504
|
+
Toolkit.WithHandler<infer Tools> ?
|
|
505
|
+
| AiError.AiError
|
|
506
|
+
| (DisableToolCallResolution extends true ? never : Tool.HandlerError<Tools[keyof Tools]>)
|
|
507
|
+
: ToolkitValue extends Effect.Yieldable<
|
|
508
|
+
Toolkit.Toolkit<infer Tools>,
|
|
509
|
+
Toolkit.WithHandler<infer _Tools>,
|
|
510
|
+
infer E,
|
|
511
|
+
infer _R
|
|
512
|
+
> ? AiError.AiError | E | (DisableToolCallResolution extends true ? never : Tool.HandlerError<Tools[keyof Tools]>)
|
|
513
|
+
: AiError.AiError
|
|
514
|
+
|
|
515
|
+
type ExtractServicesFromToolkitOption<ToolkitValue> = ToolkitValue extends Toolkit.WithHandler<infer Tools> ?
|
|
516
|
+
| Tool.HandlerServices<Tools[keyof Tools]>
|
|
517
|
+
| Tool.ResultDecodingServices<Tools[keyof Tools]>
|
|
518
|
+
: ToolkitValue extends Effect.Yieldable<
|
|
519
|
+
Toolkit.Toolkit<infer Tools>,
|
|
520
|
+
Toolkit.WithHandler<infer _Tools>,
|
|
521
|
+
infer _E,
|
|
522
|
+
infer R
|
|
523
|
+
> ?
|
|
524
|
+
| Tool.HandlerServices<Tools[keyof Tools]>
|
|
525
|
+
| Tool.ResultDecodingServices<Tools[keyof Tools]>
|
|
526
|
+
| R
|
|
527
|
+
: never
|
|
528
|
+
|
|
529
|
+
type ExtractToolkitResolutionError<ToolkitValue> = ToolkitValue extends Effect.Yieldable<
|
|
530
|
+
Toolkit.Toolkit<infer _Tools>,
|
|
531
|
+
Toolkit.WithHandler<infer _Tools>,
|
|
532
|
+
infer E,
|
|
533
|
+
infer _R
|
|
534
|
+
> ? E
|
|
535
|
+
: never
|
|
536
|
+
|
|
537
|
+
type ExtractToolkitResolutionServices<ToolkitValue> = ToolkitValue extends Effect.Yieldable<
|
|
538
|
+
Toolkit.Toolkit<infer _Tools>,
|
|
539
|
+
Toolkit.WithHandler<infer _Tools>,
|
|
540
|
+
infer _E,
|
|
541
|
+
infer R
|
|
542
|
+
> ? R
|
|
543
|
+
: never
|
|
544
|
+
|
|
470
545
|
/**
|
|
471
546
|
* Utility type that extracts the error type from LanguageModel options.
|
|
472
547
|
*
|
|
@@ -477,29 +552,15 @@ export class GenerateObjectResponse<
|
|
|
477
552
|
* @category utility types
|
|
478
553
|
*/
|
|
479
554
|
export type ExtractError<Options> = Options extends {
|
|
480
|
-
readonly toolkit: Toolkit.WithHandler<infer _Tools>
|
|
481
555
|
readonly disableToolCallResolution: true
|
|
482
|
-
|
|
556
|
+
readonly toolkit: infer ToolkitValue
|
|
557
|
+
} ? ExtractErrorFromToolkitOption<Exclude<ToolkitValue, undefined>, true>
|
|
483
558
|
: Options extends {
|
|
484
|
-
readonly toolkit:
|
|
485
|
-
|
|
486
|
-
Toolkit.WithHandler<infer _Tools>,
|
|
487
|
-
infer _E,
|
|
488
|
-
infer _R
|
|
489
|
-
>
|
|
490
|
-
readonly disableToolCallResolution: true
|
|
491
|
-
} ? AiError.AiError | _E
|
|
559
|
+
readonly toolkit: infer ToolkitValue
|
|
560
|
+
} ? ExtractErrorFromToolkitOption<Exclude<ToolkitValue, undefined>, false>
|
|
492
561
|
: Options extends {
|
|
493
|
-
readonly
|
|
494
|
-
} ? AiError.AiError
|
|
495
|
-
: Options extends {
|
|
496
|
-
readonly toolkit: Effect.Yieldable<
|
|
497
|
-
Toolkit.Toolkit<infer _Tools>,
|
|
498
|
-
Toolkit.WithHandler<infer _Tools>,
|
|
499
|
-
infer _E,
|
|
500
|
-
infer _R
|
|
501
|
-
>
|
|
502
|
-
} ? AiError.AiError | Tool.HandlerError<_Tools[keyof _Tools]> | _E
|
|
562
|
+
readonly disableToolCallResolution: true
|
|
563
|
+
} ? AiError.AiError
|
|
503
564
|
: AiError.AiError
|
|
504
565
|
|
|
505
566
|
/**
|
|
@@ -514,27 +575,8 @@ export type ExtractServices<Options> = Options extends {
|
|
|
514
575
|
readonly disableToolCallResolution: true
|
|
515
576
|
} ? never
|
|
516
577
|
: Options extends {
|
|
517
|
-
readonly toolkit:
|
|
518
|
-
}
|
|
519
|
-
// Required for tool call execution
|
|
520
|
-
?
|
|
521
|
-
| Tool.ResultEncodingServices<_Tools[keyof _Tools]>
|
|
522
|
-
// Required for decoding large language model responses
|
|
523
|
-
| Tool.ResultDecodingServices<_Tools[keyof _Tools]>
|
|
524
|
-
: Options extends {
|
|
525
|
-
readonly toolkit: Effect.Yieldable<
|
|
526
|
-
Toolkit.Toolkit<infer _Tools>,
|
|
527
|
-
Toolkit.WithHandler<infer _Tools>,
|
|
528
|
-
infer _E,
|
|
529
|
-
infer _R
|
|
530
|
-
>
|
|
531
|
-
}
|
|
532
|
-
// Required for tool call execution
|
|
533
|
-
?
|
|
534
|
-
| Tool.ResultEncodingServices<_Tools[keyof _Tools]>
|
|
535
|
-
// Required for decoding large language model responses
|
|
536
|
-
| Tool.ResultDecodingServices<_Tools[keyof _Tools]>
|
|
537
|
-
| _R
|
|
578
|
+
readonly toolkit: infer Toolkit
|
|
579
|
+
} ? ExtractServicesFromToolkitOption<Exclude<Toolkit, undefined>>
|
|
538
580
|
: never
|
|
539
581
|
|
|
540
582
|
// =============================================================================
|
|
@@ -1031,21 +1073,11 @@ export const make: (params: {
|
|
|
1031
1073
|
AiError.AiError | Schema.SchemaError,
|
|
1032
1074
|
IdGenerator
|
|
1033
1075
|
>,
|
|
1034
|
-
Options extends {
|
|
1035
|
-
|
|
1036
|
-
Toolkit.WithHandler<Tools>,
|
|
1037
|
-
infer _E,
|
|
1038
|
-
infer _R
|
|
1039
|
-
>
|
|
1040
|
-
} ? _E
|
|
1076
|
+
Options extends { readonly toolkit: infer ToolkitValue } ?
|
|
1077
|
+
ExtractToolkitResolutionError<Exclude<ToolkitValue, undefined>>
|
|
1041
1078
|
: never,
|
|
1042
|
-
Options extends {
|
|
1043
|
-
|
|
1044
|
-
Toolkit.WithHandler<Tools>,
|
|
1045
|
-
infer _E,
|
|
1046
|
-
infer _R
|
|
1047
|
-
>
|
|
1048
|
-
} ? _R
|
|
1079
|
+
Options extends { readonly toolkit: infer ToolkitValue } ?
|
|
1080
|
+
ExtractToolkitResolutionServices<Exclude<ToolkitValue, undefined>>
|
|
1049
1081
|
: never
|
|
1050
1082
|
> = Effect.fnUntraced(function*<
|
|
1051
1083
|
Tools extends Record<string, Tool.Any>,
|
|
@@ -1090,9 +1122,7 @@ export const make: (params: {
|
|
|
1090
1122
|
}
|
|
1091
1123
|
|
|
1092
1124
|
// If there is a toolkit resolve and apply it to the provider options
|
|
1093
|
-
const toolkit =
|
|
1094
|
-
? yield* options.toolkit
|
|
1095
|
-
: options.toolkit
|
|
1125
|
+
const toolkit = yield* resolveToolkit<Tools, any, any>(options.toolkit)
|
|
1096
1126
|
|
|
1097
1127
|
// If the toolkit is empty, return immediately
|
|
1098
1128
|
if (Object.values(toolkit.tools).length === 0) {
|
|
@@ -1335,20 +1365,27 @@ export const make: (params: {
|
|
|
1335
1365
|
* @since 4.0.0
|
|
1336
1366
|
* @category text generation
|
|
1337
1367
|
*/
|
|
1338
|
-
export
|
|
1339
|
-
Options extends NoExcessProperties<GenerateTextOptions<any>, Options
|
|
1340
|
-
Tools extends Record<string, Tool.Any> = {}
|
|
1368
|
+
export function generateText<
|
|
1369
|
+
Options extends NoExcessProperties<GenerateTextOptions<any>, Options>
|
|
1341
1370
|
>(
|
|
1342
|
-
options: Options & GenerateTextOptions<
|
|
1371
|
+
options: Options & GenerateTextOptions<ExtractTools<Options>>
|
|
1343
1372
|
): Effect.Effect<
|
|
1344
|
-
GenerateTextResponse<
|
|
1373
|
+
GenerateTextResponse<ExtractTools<Options>>,
|
|
1345
1374
|
ExtractError<Options>,
|
|
1346
1375
|
LanguageModel | ExtractServices<Options>
|
|
1347
|
-
>
|
|
1348
|
-
|
|
1376
|
+
>
|
|
1377
|
+
export function generateText(
|
|
1378
|
+
options: GenerateTextOptions<any>
|
|
1379
|
+
): Effect.Effect<
|
|
1380
|
+
GenerateTextResponse<any>,
|
|
1381
|
+
AiError.AiError,
|
|
1382
|
+
LanguageModel
|
|
1383
|
+
> {
|
|
1384
|
+
return Effect.flatMap(
|
|
1349
1385
|
Effect.service(LanguageModel),
|
|
1350
|
-
(model) => model.generateText(options)
|
|
1386
|
+
(model) => model.generateText(options as any)
|
|
1351
1387
|
)
|
|
1388
|
+
}
|
|
1352
1389
|
|
|
1353
1390
|
/**
|
|
1354
1391
|
* Generate a structured object from a schema using a language model.
|
|
@@ -1382,25 +1419,32 @@ export const generateText = <
|
|
|
1382
1419
|
* @since 4.0.0
|
|
1383
1420
|
* @category object generation
|
|
1384
1421
|
*/
|
|
1385
|
-
export
|
|
1422
|
+
export function generateObject<
|
|
1386
1423
|
ObjectEncoded extends Record<string, any>,
|
|
1387
1424
|
StructuredOutputSchema extends Schema.Encoder<ObjectEncoded, unknown>,
|
|
1388
1425
|
Options extends NoExcessProperties<
|
|
1389
1426
|
GenerateObjectOptions<any, StructuredOutputSchema>,
|
|
1390
1427
|
Options
|
|
1391
|
-
|
|
1392
|
-
Tools extends Record<string, Tool.Any> = {}
|
|
1428
|
+
>
|
|
1393
1429
|
>(
|
|
1394
|
-
options: Options & GenerateObjectOptions<
|
|
1430
|
+
options: Options & GenerateObjectOptions<ExtractTools<Options>, StructuredOutputSchema>
|
|
1395
1431
|
): Effect.Effect<
|
|
1396
|
-
GenerateObjectResponse<
|
|
1432
|
+
GenerateObjectResponse<ExtractTools<Options>, StructuredOutputSchema["Type"]>,
|
|
1397
1433
|
ExtractError<Options>,
|
|
1398
1434
|
ExtractServices<Options> | StructuredOutputSchema["DecodingServices"] | LanguageModel
|
|
1399
|
-
>
|
|
1400
|
-
|
|
1435
|
+
>
|
|
1436
|
+
export function generateObject(
|
|
1437
|
+
options: GenerateObjectOptions<any, Schema.Top>
|
|
1438
|
+
): Effect.Effect<
|
|
1439
|
+
GenerateObjectResponse<any, any>,
|
|
1440
|
+
AiError.AiError,
|
|
1441
|
+
LanguageModel
|
|
1442
|
+
> {
|
|
1443
|
+
return Effect.flatMap(
|
|
1401
1444
|
Effect.service(LanguageModel),
|
|
1402
|
-
(model) => model.generateObject(options)
|
|
1403
|
-
)
|
|
1445
|
+
(model) => model.generateObject(options as any)
|
|
1446
|
+
) as any
|
|
1447
|
+
}
|
|
1404
1448
|
|
|
1405
1449
|
/**
|
|
1406
1450
|
* Generate text using a language model with streaming output.
|
|
@@ -1426,20 +1470,27 @@ export const generateObject = <
|
|
|
1426
1470
|
* @since 4.0.0
|
|
1427
1471
|
* @category text generation
|
|
1428
1472
|
*/
|
|
1429
|
-
export
|
|
1430
|
-
Options extends NoExcessProperties<GenerateTextOptions<any>, Options
|
|
1431
|
-
Tools extends Record<string, Tool.Any> = {}
|
|
1473
|
+
export function streamText<
|
|
1474
|
+
Options extends NoExcessProperties<GenerateTextOptions<any>, Options>
|
|
1432
1475
|
>(
|
|
1433
|
-
options: Options & GenerateTextOptions<
|
|
1476
|
+
options: Options & GenerateTextOptions<ExtractTools<Options>>
|
|
1434
1477
|
): Stream.Stream<
|
|
1435
|
-
Response.StreamPart<
|
|
1478
|
+
Response.StreamPart<ExtractTools<Options>>,
|
|
1436
1479
|
ExtractError<Options>,
|
|
1437
1480
|
ExtractServices<Options> | LanguageModel
|
|
1438
|
-
>
|
|
1439
|
-
|
|
1481
|
+
>
|
|
1482
|
+
export function streamText(
|
|
1483
|
+
options: GenerateTextOptions<any>
|
|
1484
|
+
): Stream.Stream<
|
|
1485
|
+
Response.StreamPart<any>,
|
|
1486
|
+
AiError.AiError,
|
|
1487
|
+
LanguageModel
|
|
1488
|
+
> {
|
|
1489
|
+
return Stream.unwrap(Effect.map(
|
|
1440
1490
|
Effect.service(LanguageModel),
|
|
1441
|
-
(model) => model.streamText(options)
|
|
1442
|
-
))
|
|
1491
|
+
(model) => model.streamText(options as any)
|
|
1492
|
+
)) as any
|
|
1493
|
+
}
|
|
1443
1494
|
|
|
1444
1495
|
// =============================================================================
|
|
1445
1496
|
// Tool Approval Helpers
|
|
@@ -1816,11 +1867,11 @@ const resolveToolCalls = <Tools extends Record<string, Tool.Any>>(
|
|
|
1816
1867
|
// =============================================================================
|
|
1817
1868
|
|
|
1818
1869
|
const resolveToolkit = <Tools extends Record<string, Tool.Any>, E, R>(
|
|
1819
|
-
toolkit:
|
|
1820
|
-
| Toolkit.WithHandler<Tools>
|
|
1821
|
-
| Effect.Yieldable<Toolkit.Toolkit<any>, Toolkit.WithHandler<Tools>, E, R>
|
|
1870
|
+
toolkit: ToolkitOption<Tools, E, R>
|
|
1822
1871
|
): Effect.Effect<Toolkit.WithHandler<Tools>, E, R> =>
|
|
1823
|
-
"asEffect" in toolkit
|
|
1872
|
+
("asEffect" in toolkit
|
|
1873
|
+
? toolkit.asEffect()
|
|
1874
|
+
: Effect.succeed(toolkit as unknown as Toolkit.WithHandler<Tools>)) as any
|
|
1824
1875
|
|
|
1825
1876
|
/** @internal */
|
|
1826
1877
|
export const getObjectName = <StructuredOutputSchema extends Schema.Top>(
|
|
@@ -11,6 +11,7 @@ import * as Rec from "../../Record.ts"
|
|
|
11
11
|
import * as Schema from "../../Schema.ts"
|
|
12
12
|
import * as AST from "../../SchemaAST.ts"
|
|
13
13
|
import * as Transformation from "../../SchemaTransformation.ts"
|
|
14
|
+
import * as Tool from "./Tool.ts"
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* Transforms a `Schema.Codec` into a form compatible with OpenAI's
|
|
@@ -243,6 +244,9 @@ function recurOpenAI(ast: AST.AST): AST.AST {
|
|
|
243
244
|
}
|
|
244
245
|
} else if (ast.indexSignatures.length === 1 && ast.propertySignatures.length === 0) {
|
|
245
246
|
const is = ast.indexSignatures[0]
|
|
247
|
+
if (Tool.isEmptyParamsRecord(is)) {
|
|
248
|
+
return ast
|
|
249
|
+
}
|
|
246
250
|
// records are not supported by OpenAI, so we translate them to arrays of key-value pairs
|
|
247
251
|
if (annotations !== undefined && typeof annotations.description === "string") {
|
|
248
252
|
annotations.description = `${RECORD_DESCRIPTION}; ${annotations.description}`
|
package/src/unstable/ai/Tool.ts
CHANGED
|
@@ -1129,6 +1129,9 @@ const dynamicProto = <
|
|
|
1129
1129
|
* can call. The tool definition includes parameter validation, success/failure
|
|
1130
1130
|
* schemas, and optional service dependencies.
|
|
1131
1131
|
*
|
|
1132
|
+
* If a tool accepts no parameters but still needs an explicit empty object
|
|
1133
|
+
* schema, use {@link EmptyParams}.
|
|
1134
|
+
*
|
|
1132
1135
|
* @example
|
|
1133
1136
|
* ```ts
|
|
1134
1137
|
* import { Schema } from "effect"
|
|
@@ -1866,3 +1869,20 @@ export const unsafeSecureJsonParse = (text: string): unknown => {
|
|
|
1866
1869
|
Error.stackTraceLimit = stackTraceLimit
|
|
1867
1870
|
}
|
|
1868
1871
|
}
|
|
1872
|
+
|
|
1873
|
+
/**
|
|
1874
|
+
* @since 4.0.0
|
|
1875
|
+
*/
|
|
1876
|
+
export interface EmptyParams extends Schema.$Record<Schema.String, Schema.Never> {}
|
|
1877
|
+
|
|
1878
|
+
/**
|
|
1879
|
+
* A schema for tools that accept no parameters.
|
|
1880
|
+
*
|
|
1881
|
+
* @since 4.0.0
|
|
1882
|
+
*/
|
|
1883
|
+
export const EmptyParams: EmptyParams = Schema.Record(Schema.String, Schema.Never)
|
|
1884
|
+
|
|
1885
|
+
/** @internal */
|
|
1886
|
+
export function isEmptyParamsRecord(indexSignature: AST.IndexSignature): boolean {
|
|
1887
|
+
return indexSignature.parameter === AST.string && AST.isNever(indexSignature.type)
|
|
1888
|
+
}
|
|
@@ -226,9 +226,7 @@ export const fileParse = (
|
|
|
226
226
|
* host: Schema.String
|
|
227
227
|
* })
|
|
228
228
|
*
|
|
229
|
-
* const
|
|
230
|
-
*
|
|
231
|
-
* const config = Argument.fileSchema("config", JsonConfigSchema)
|
|
229
|
+
* const config = Argument.fileSchema("config", ConfigSchema)
|
|
232
230
|
* ```
|
|
233
231
|
*
|
|
234
232
|
* @since 4.0.0
|
|
@@ -236,7 +234,7 @@ export const fileParse = (
|
|
|
236
234
|
*/
|
|
237
235
|
export const fileSchema = <A>(
|
|
238
236
|
name: string,
|
|
239
|
-
schema: Schema.
|
|
237
|
+
schema: Schema.Decoder<A>,
|
|
240
238
|
options?: Primitive.FileSchemaOptions | undefined
|
|
241
239
|
): Argument<A> => Param.fileSchema(Param.argumentKind, name, schema, options)
|
|
242
240
|
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import * as Layer from "../../Layer.ts"
|
|
6
|
+
import * as Option from "../../Option.ts"
|
|
6
7
|
import * as ServiceMap from "../../ServiceMap.ts"
|
|
7
8
|
import type * as CliError from "./CliError.ts"
|
|
8
9
|
import type { HelpDoc } from "./HelpDoc.ts"
|
|
@@ -44,6 +45,7 @@ export interface Formatter {
|
|
|
44
45
|
*
|
|
45
46
|
* @example
|
|
46
47
|
* ```ts
|
|
48
|
+
* import { Option as O } from "effect"
|
|
47
49
|
* import type { HelpDoc } from "effect/unstable/cli"
|
|
48
50
|
* import { CliOutput } from "effect/unstable/cli"
|
|
49
51
|
*
|
|
@@ -55,7 +57,7 @@ export interface Formatter {
|
|
|
55
57
|
* name: "verbose",
|
|
56
58
|
* aliases: ["-v"],
|
|
57
59
|
* type: "boolean",
|
|
58
|
-
* description: "Enable verbose output",
|
|
60
|
+
* description: O.some("Enable verbose output"),
|
|
59
61
|
* required: false
|
|
60
62
|
* }
|
|
61
63
|
* ],
|
|
@@ -63,7 +65,7 @@ export interface Formatter {
|
|
|
63
65
|
* {
|
|
64
66
|
* name: "file",
|
|
65
67
|
* type: "string",
|
|
66
|
-
* description: "Input file to process",
|
|
68
|
+
* description: O.some("Input file to process"),
|
|
67
69
|
* required: true,
|
|
68
70
|
* variadic: false
|
|
69
71
|
* }
|
|
@@ -459,7 +461,7 @@ const formatHelpDocImpl = (doc: HelpDoc, colors: ColorFunctions): string => {
|
|
|
459
461
|
const nameType = `${coloredName} ${coloredType}`
|
|
460
462
|
|
|
461
463
|
const optionalSuffix = arg.required ? "" : colors.dim(" (optional)")
|
|
462
|
-
const description = (arg.description
|
|
464
|
+
const description = Option.getOrElse(arg.description, () => "") + optionalSuffix
|
|
463
465
|
|
|
464
466
|
return {
|
|
465
467
|
left: nameType,
|
|
@@ -491,7 +493,7 @@ const formatHelpDocImpl = (doc: HelpDoc, colors: ColorFunctions): string => {
|
|
|
491
493
|
|
|
492
494
|
return {
|
|
493
495
|
left: namesPart + typePart,
|
|
494
|
-
right: flag.description
|
|
496
|
+
right: Option.getOrElse(flag.description, () => "")
|
|
495
497
|
}
|
|
496
498
|
})
|
|
497
499
|
|
|
@@ -519,7 +521,7 @@ const formatHelpDocImpl = (doc: HelpDoc, colors: ColorFunctions): string => {
|
|
|
519
521
|
|
|
520
522
|
return {
|
|
521
523
|
left: namesPart + typePart,
|
|
522
|
-
right: flag.description
|
|
524
|
+
right: Option.getOrElse(flag.description, () => "")
|
|
523
525
|
}
|
|
524
526
|
})
|
|
525
527
|
|
|
@@ -360,10 +360,10 @@ export interface ParsedTokens {
|
|
|
360
360
|
readonly flags: Record<string, ReadonlyArray<string>>
|
|
361
361
|
readonly arguments: ReadonlyArray<string>
|
|
362
362
|
readonly errors?: ReadonlyArray<CliError.CliError>
|
|
363
|
-
readonly subcommand
|
|
363
|
+
readonly subcommand: Option.Option<{
|
|
364
364
|
readonly name: string
|
|
365
365
|
readonly parsedInput: ParsedTokens
|
|
366
|
-
}
|
|
366
|
+
}>
|
|
367
367
|
}
|
|
368
368
|
|
|
369
369
|
/**
|
|
@@ -939,17 +939,17 @@ export const withSubcommands: {
|
|
|
939
939
|
type InternalInput = NextInput & { readonly [SubcommandStateSymbol]?: SubcommandState }
|
|
940
940
|
|
|
941
941
|
const parse = Effect.fnUntraced(function*(raw: ParsedTokens) {
|
|
942
|
-
if (
|
|
942
|
+
if (Option.isNone(raw.subcommand)) {
|
|
943
943
|
return (yield* impl.parse(raw)) as NextInput
|
|
944
944
|
}
|
|
945
945
|
|
|
946
|
-
const sub = byName.get(raw.subcommand.name)
|
|
946
|
+
const sub = byName.get(raw.subcommand.value.name)
|
|
947
947
|
if (!sub) {
|
|
948
948
|
return (yield* impl.parse(raw)) as NextInput
|
|
949
949
|
}
|
|
950
950
|
|
|
951
951
|
const context = yield* impl.parseContext(raw)
|
|
952
|
-
const result = yield* sub.parse(raw.subcommand.parsedInput)
|
|
952
|
+
const result = yield* sub.parse(raw.subcommand.value.parsedInput)
|
|
953
953
|
return Object.assign({}, context, { [SubcommandStateSymbol]: { name: sub.name, result } }) as NextInput
|
|
954
954
|
})
|
|
955
955
|
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @since 4.0.0
|
|
3
|
+
*/
|
|
4
|
+
import * as Bash from "./internal/completions/bash.ts"
|
|
5
|
+
import type * as CommandDescriptor from "./internal/completions/CommandDescriptor.ts"
|
|
6
|
+
import * as Fish from "./internal/completions/fish.ts"
|
|
7
|
+
import * as Zsh from "./internal/completions/zsh.ts"
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Shell type used to generate completion scripts.
|
|
11
|
+
*
|
|
12
|
+
* @since 4.0.0
|
|
13
|
+
* @category models
|
|
14
|
+
*/
|
|
15
|
+
export type Shell = "bash" | "zsh" | "fish"
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Generates a shell completion script for a command descriptor.
|
|
19
|
+
*
|
|
20
|
+
* @since 4.0.0
|
|
21
|
+
* @category constructors
|
|
22
|
+
*/
|
|
23
|
+
export const generate = (
|
|
24
|
+
executableName: string,
|
|
25
|
+
shell: Shell,
|
|
26
|
+
descriptor: CommandDescriptor.CommandDescriptor
|
|
27
|
+
): string => {
|
|
28
|
+
switch (shell) {
|
|
29
|
+
case "bash":
|
|
30
|
+
return Bash.generate(executableName, descriptor)
|
|
31
|
+
case "zsh":
|
|
32
|
+
return Zsh.generate(executableName, descriptor)
|
|
33
|
+
case "fish":
|
|
34
|
+
return Fish.generate(executableName, descriptor)
|
|
35
|
+
}
|
|
36
|
+
}
|
package/src/unstable/cli/Flag.ts
CHANGED
|
@@ -304,7 +304,7 @@ export const fileParse = (
|
|
|
304
304
|
* const ConfigSchema = Schema.Struct({
|
|
305
305
|
* port: Schema.Number,
|
|
306
306
|
* host: Schema.String
|
|
307
|
-
* })
|
|
307
|
+
* })
|
|
308
308
|
*
|
|
309
309
|
* const config = Flag.fileSchema("config", ConfigSchema, { format: "json" })
|
|
310
310
|
* ```
|
|
@@ -314,7 +314,7 @@ export const fileParse = (
|
|
|
314
314
|
*/
|
|
315
315
|
export const fileSchema = <A>(
|
|
316
316
|
name: string,
|
|
317
|
-
schema: Schema.
|
|
317
|
+
schema: Schema.Decoder<A>,
|
|
318
318
|
options?: Primitive.FileSchemaOptions | undefined
|
|
319
319
|
): Flag<A> => Param.fileSchema(Param.flagKind, name, schema, options)
|
|
320
320
|
|