effect 4.1.3 → 4.1.5
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/THIRD_PARTY_NOTICES.md +88 -0
- package/ai-docs/package.json +2 -2
- package/dist/Arbitrary.d.ts +44 -2
- package/dist/Arbitrary.d.ts.map +1 -1
- package/dist/Arbitrary.js +9 -1
- package/dist/Arbitrary.js.map +1 -1
- package/dist/BigInt.d.ts +200 -1
- package/dist/BigInt.d.ts.map +1 -1
- package/dist/BigInt.js +105 -9
- package/dist/BigInt.js.map +1 -1
- package/dist/Cache.d.ts.map +1 -1
- package/dist/Cache.js +4 -2
- package/dist/Cache.js.map +1 -1
- package/dist/Cause.d.ts +3 -3
- package/dist/Cause.js +1 -1
- package/dist/Chunk.d.ts +5 -0
- package/dist/Chunk.d.ts.map +1 -1
- package/dist/Chunk.js +7 -2
- package/dist/Chunk.js.map +1 -1
- package/dist/Clock.d.ts +5 -2
- package/dist/Clock.d.ts.map +1 -1
- package/dist/Clock.js +2 -1
- package/dist/Clock.js.map +1 -1
- package/dist/Codegen.d.ts +295 -0
- package/dist/Codegen.d.ts.map +1 -0
- package/dist/Codegen.js +521 -0
- package/dist/Codegen.js.map +1 -0
- package/dist/Config.d.ts +31 -2
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +12 -1
- package/dist/Config.js.map +1 -1
- package/dist/ConfigProvider.d.ts +11 -1
- package/dist/ConfigProvider.d.ts.map +1 -1
- package/dist/ConfigProvider.js +17 -6
- package/dist/ConfigProvider.js.map +1 -1
- package/dist/Effect.d.ts +869 -109
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +400 -47
- package/dist/Effect.js.map +1 -1
- package/dist/Equivalence.d.ts +11 -9
- package/dist/Equivalence.d.ts.map +1 -1
- package/dist/Equivalence.js +15 -12
- package/dist/Equivalence.js.map +1 -1
- package/dist/Fiber.d.ts +58 -8
- package/dist/Fiber.d.ts.map +1 -1
- package/dist/Fiber.js +28 -4
- package/dist/Fiber.js.map +1 -1
- package/dist/FiberHandle.d.ts +81 -10
- package/dist/FiberHandle.d.ts.map +1 -1
- package/dist/FiberHandle.js +40 -8
- package/dist/FiberHandle.js.map +1 -1
- package/dist/FiberMap.d.ts +80 -10
- package/dist/FiberMap.d.ts.map +1 -1
- package/dist/FiberMap.js +37 -6
- package/dist/FiberMap.js.map +1 -1
- package/dist/FiberSet.d.ts +93 -8
- package/dist/FiberSet.d.ts.map +1 -1
- package/dist/FiberSet.js +46 -4
- package/dist/FiberSet.js.map +1 -1
- package/dist/Formatter.d.ts +2 -0
- package/dist/Formatter.d.ts.map +1 -1
- package/dist/Formatter.js +2 -0
- package/dist/Formatter.js.map +1 -1
- package/dist/LayerMap.d.ts +12 -3
- package/dist/LayerMap.d.ts.map +1 -1
- package/dist/LayerMap.js +12 -2
- package/dist/LayerMap.js.map +1 -1
- package/dist/LayerRef.d.ts +2 -2
- package/dist/Match.d.ts +12 -0
- package/dist/Match.d.ts.map +1 -1
- package/dist/Match.js +16 -0
- package/dist/Match.js.map +1 -1
- package/dist/Metric.js +1 -1
- package/dist/Metric.js.map +1 -1
- package/dist/Option.d.ts +4 -1
- package/dist/Option.d.ts.map +1 -1
- package/dist/Option.js +6 -2
- package/dist/Option.js.map +1 -1
- package/dist/Order.d.ts +7 -5
- package/dist/Order.d.ts.map +1 -1
- package/dist/Order.js +7 -2
- package/dist/Order.js.map +1 -1
- package/dist/Pool.d.ts +4 -3
- package/dist/Pool.d.ts.map +1 -1
- package/dist/Pool.js +21 -18
- package/dist/Pool.js.map +1 -1
- package/dist/Predicate.d.ts +4 -1
- package/dist/Predicate.d.ts.map +1 -1
- package/dist/Predicate.js +5 -1
- package/dist/Predicate.js.map +1 -1
- package/dist/Queue.d.ts +69 -22
- package/dist/Queue.d.ts.map +1 -1
- package/dist/Queue.js +40 -18
- package/dist/Queue.js.map +1 -1
- package/dist/Rational.d.ts +179 -0
- package/dist/Rational.d.ts.map +1 -1
- package/dist/Rational.js +63 -0
- package/dist/Rational.js.map +1 -1
- package/dist/Request.d.ts +20 -0
- package/dist/Request.d.ts.map +1 -1
- package/dist/Request.js +20 -0
- package/dist/Request.js.map +1 -1
- package/dist/Result.d.ts +3 -1
- package/dist/Result.d.ts.map +1 -1
- package/dist/Result.js +5 -2
- package/dist/Result.js.map +1 -1
- package/dist/Schema.d.ts +49 -19
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +44 -27
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +11 -4
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaGetter.d.ts +5 -6
- package/dist/SchemaGetter.d.ts.map +1 -1
- package/dist/SchemaGetter.js +14 -10
- package/dist/SchemaGetter.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +36 -67
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +5 -30
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/SchemaTransformation.d.ts +11 -10
- package/dist/SchemaTransformation.d.ts.map +1 -1
- package/dist/SchemaTransformation.js +12 -11
- package/dist/SchemaTransformation.js.map +1 -1
- package/dist/Scope.d.ts +12 -6
- package/dist/Scope.d.ts.map +1 -1
- package/dist/Scope.js +12 -6
- package/dist/Scope.js.map +1 -1
- package/dist/ScopedCache.d.ts.map +1 -1
- package/dist/ScopedCache.js +2 -1
- package/dist/ScopedCache.js.map +1 -1
- package/dist/Semaphore.d.ts.map +1 -1
- package/dist/Semaphore.js +18 -4
- package/dist/Semaphore.js.map +1 -1
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +55 -14
- package/dist/Stream.js.map +1 -1
- package/dist/String.d.ts +57 -3
- package/dist/String.d.ts.map +1 -1
- package/dist/String.js +62 -4
- package/dist/String.js.map +1 -1
- package/dist/Struct.d.ts +135 -1
- package/dist/Struct.d.ts.map +1 -1
- package/dist/Struct.js +64 -5
- package/dist/Struct.js.map +1 -1
- package/dist/TextDiff.d.ts +105 -0
- package/dist/TextDiff.d.ts.map +1 -1
- package/dist/TextDiff.js +137 -24
- package/dist/TextDiff.js.map +1 -1
- package/dist/TxPriorityQueue.js +2 -2
- package/dist/TxPriorityQueue.js.map +1 -1
- package/dist/ai/Chat.d.ts +1 -1
- package/dist/ai/Chat.d.ts.map +1 -1
- package/dist/ai/Chat.js.map +1 -1
- package/dist/ai/LanguageModel.d.ts +23 -4
- package/dist/ai/LanguageModel.d.ts.map +1 -1
- package/dist/ai/LanguageModel.js +9 -5
- package/dist/ai/LanguageModel.js.map +1 -1
- package/dist/ai/McpClient.d.ts +0 -5
- package/dist/ai/McpClient.d.ts.map +1 -1
- package/dist/ai/McpClient.js +1 -11
- package/dist/ai/McpClient.js.map +1 -1
- package/dist/ai/McpSchema.d.ts +128 -128
- package/dist/ai/McpSchema.d.ts.map +1 -1
- package/dist/ai/McpServer.d.ts +48 -5
- package/dist/ai/McpServer.d.ts.map +1 -1
- package/dist/ai/McpServer.js +136 -19
- package/dist/ai/McpServer.js.map +1 -1
- package/dist/ai/Tool.d.ts +3 -2
- package/dist/ai/Tool.d.ts.map +1 -1
- package/dist/ai/Tool.js +3 -2
- package/dist/ai/Tool.js.map +1 -1
- package/dist/ai/Toolkit.d.ts.map +1 -1
- package/dist/ai/Toolkit.js +5 -1
- package/dist/ai/Toolkit.js.map +1 -1
- package/dist/ai/WorkloadIdentity.d.ts +111 -0
- package/dist/ai/WorkloadIdentity.d.ts.map +1 -0
- package/dist/ai/WorkloadIdentity.js +227 -0
- package/dist/ai/WorkloadIdentity.js.map +1 -0
- package/dist/ai/index.d.ts +5 -0
- package/dist/ai/index.d.ts.map +1 -1
- package/dist/ai/index.js +5 -0
- package/dist/ai/index.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2024_11_05.js +3 -1
- package/dist/ai/internal/mcpProtocol/v2024_11_05.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2025_03_26.js +3 -1
- package/dist/ai/internal/mcpProtocol/v2025_03_26.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2025_06_18.js +3 -1
- package/dist/ai/internal/mcpProtocol/v2025_06_18.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2025_11_25.js +3 -1
- package/dist/ai/internal/mcpProtocol/v2025_11_25.js.map +1 -1
- package/dist/ai/internal/mcpRuntime.js +2 -4
- package/dist/ai/internal/mcpRuntime.js.map +1 -1
- package/dist/ai/internal/mcpSkills.js +80 -2
- package/dist/ai/internal/mcpSkills.js.map +1 -1
- package/dist/ai/internal/structured-output.js +5 -1
- package/dist/ai/internal/structured-output.js.map +1 -1
- package/dist/chat/Chat.d.ts +90 -0
- package/dist/chat/Chat.d.ts.map +1 -0
- package/dist/chat/Chat.js +127 -0
- package/dist/chat/Chat.js.map +1 -0
- package/dist/chat/ChatAdapter.d.ts +386 -0
- package/dist/chat/ChatAdapter.d.ts.map +1 -0
- package/dist/chat/ChatAdapter.js +110 -0
- package/dist/chat/ChatAdapter.js.map +1 -0
- package/dist/chat/ChatError.d.ts +500 -0
- package/dist/chat/ChatError.d.ts.map +1 -0
- package/dist/chat/ChatError.js +521 -0
- package/dist/chat/ChatError.js.map +1 -0
- package/dist/chat/ChatEvent.d.ts +321 -0
- package/dist/chat/ChatEvent.d.ts.map +1 -0
- package/dist/chat/ChatEvent.js +163 -0
- package/dist/chat/ChatEvent.js.map +1 -0
- package/dist/chat/ChatHandler.d.ts +81 -0
- package/dist/chat/ChatHandler.d.ts.map +1 -0
- package/dist/chat/ChatHandler.js +85 -0
- package/dist/chat/ChatHandler.js.map +1 -0
- package/dist/chat/ChatInteraction.d.ts +1519 -0
- package/dist/chat/ChatInteraction.d.ts.map +1 -0
- package/dist/chat/ChatInteraction.js +1052 -0
- package/dist/chat/ChatInteraction.js.map +1 -0
- package/dist/chat/ChatMarkdown.d.ts +280 -0
- package/dist/chat/ChatMarkdown.d.ts.map +1 -0
- package/dist/chat/ChatMarkdown.js +1172 -0
- package/dist/chat/ChatMarkdown.js.map +1 -0
- package/dist/chat/ChatMessage.d.ts +224 -0
- package/dist/chat/ChatMessage.d.ts.map +1 -0
- package/dist/chat/ChatMessage.js +172 -0
- package/dist/chat/ChatMessage.js.map +1 -0
- package/dist/chat/ChatTest.d.ts +407 -0
- package/dist/chat/ChatTest.d.ts.map +1 -0
- package/dist/chat/ChatTest.js +2145 -0
- package/dist/chat/ChatTest.js.map +1 -0
- package/dist/chat/ChatThread.d.ts +92 -0
- package/dist/chat/ChatThread.d.ts.map +1 -0
- package/dist/chat/ChatThread.js +116 -0
- package/dist/chat/ChatThread.js.map +1 -0
- package/dist/chat/ChatUi.d.ts +362 -0
- package/dist/chat/ChatUi.d.ts.map +1 -0
- package/dist/chat/ChatUi.js +209 -0
- package/dist/chat/ChatUi.js.map +1 -0
- package/dist/chat/index.d.ts +60 -0
- package/dist/chat/index.d.ts.map +1 -0
- package/dist/chat/index.js +61 -0
- package/dist/chat/index.js.map +1 -0
- package/dist/chat/internal/retries.d.ts +2 -0
- package/dist/chat/internal/retries.d.ts.map +1 -0
- package/dist/chat/internal/retries.js +7 -0
- package/dist/chat/internal/retries.js.map +1 -0
- package/dist/cli/CliOutput.d.ts.map +1 -1
- package/dist/cli/CliOutput.js +6 -7
- package/dist/cli/CliOutput.js.map +1 -1
- package/dist/cli/Command.d.ts +20 -2
- package/dist/cli/Command.d.ts.map +1 -1
- package/dist/cli/Command.js +7 -1
- package/dist/cli/Command.js.map +1 -1
- package/dist/cli/Prompt.d.ts +5 -6
- package/dist/cli/Prompt.d.ts.map +1 -1
- package/dist/cli/Prompt.js +9 -4
- package/dist/cli/Prompt.js.map +1 -1
- package/dist/cli/internal/command.d.ts +1 -1
- package/dist/cli/internal/command.d.ts.map +1 -1
- package/dist/cli/internal/config.d.ts +1 -1
- package/dist/cli/internal/config.d.ts.map +1 -1
- package/dist/cli/internal/config.js +3 -3
- package/dist/cli/internal/config.js.map +1 -1
- package/dist/cli/internal/lexer.js +13 -0
- package/dist/cli/internal/lexer.js.map +1 -1
- package/dist/cli/internal/parser.js +23 -16
- package/dist/cli/internal/parser.js.map +1 -1
- package/dist/cli/internal/wizard.d.ts.map +1 -1
- package/dist/cli/internal/wizard.js +4 -0
- package/dist/cli/internal/wizard.js.map +1 -1
- package/dist/cluster/ClusterCron.d.ts +21 -1
- package/dist/cluster/ClusterCron.d.ts.map +1 -1
- package/dist/cluster/ClusterCron.js +24 -6
- package/dist/cluster/ClusterCron.js.map +1 -1
- package/dist/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
- package/dist/cluster/ClusterWorkflowEngine.js +30 -22
- package/dist/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/cluster/Sharding.d.ts.map +1 -1
- package/dist/cluster/Sharding.js +15 -3
- package/dist/cluster/Sharding.js.map +1 -1
- package/dist/cluster/ShardingConfig.d.ts +6 -0
- package/dist/cluster/ShardingConfig.d.ts.map +1 -1
- package/dist/cluster/ShardingConfig.js.map +1 -1
- package/dist/cluster/SqlMessageStorage.d.ts.map +1 -1
- package/dist/cluster/SqlMessageStorage.js +13 -15
- package/dist/cluster/SqlMessageStorage.js.map +1 -1
- package/dist/cluster/SqlRunnerStorage.d.ts.map +1 -1
- package/dist/cluster/SqlRunnerStorage.js +18 -8
- package/dist/cluster/SqlRunnerStorage.js.map +1 -1
- package/dist/cluster/internal/entityManager.js +12 -8
- package/dist/cluster/internal/entityManager.js.map +1 -1
- package/dist/cluster/internal/entityReaper.js +1 -1
- package/dist/cluster/internal/entityReaper.js.map +1 -1
- package/dist/crypto/Kdf.d.ts +2 -1
- package/dist/crypto/Kdf.d.ts.map +1 -1
- package/dist/crypto/Kdf.js +2 -1
- package/dist/crypto/Kdf.js.map +1 -1
- package/dist/crypto/Password.d.ts +162 -0
- package/dist/crypto/Password.d.ts.map +1 -0
- package/dist/crypto/Password.js +217 -0
- package/dist/crypto/Password.js.map +1 -0
- package/dist/crypto/index.d.ts +5 -0
- package/dist/crypto/index.d.ts.map +1 -1
- package/dist/crypto/index.js +5 -0
- package/dist/crypto/index.js.map +1 -1
- package/dist/encoding/Base64.d.ts +63 -0
- package/dist/encoding/Base64.d.ts.map +1 -1
- package/dist/encoding/Base64.js +77 -0
- package/dist/encoding/Base64.js.map +1 -1
- package/dist/encoding/Base64Url.d.ts +1 -0
- package/dist/encoding/Base64Url.d.ts.map +1 -1
- package/dist/encoding/Base64Url.js +1 -0
- package/dist/encoding/Base64Url.js.map +1 -1
- package/dist/encoding/Csv.d.ts.map +1 -1
- package/dist/encoding/Csv.js +44 -16
- package/dist/encoding/Csv.js.map +1 -1
- package/dist/encoding/Hex.d.ts +5 -0
- package/dist/encoding/Hex.d.ts.map +1 -1
- package/dist/encoding/Hex.js +5 -0
- package/dist/encoding/Hex.js.map +1 -1
- package/dist/encoding/SchemaBinary.d.ts.map +1 -1
- package/dist/encoding/SchemaBinary.js +13 -124
- package/dist/encoding/SchemaBinary.js.map +1 -1
- package/dist/encoding/Sse.d.ts +1 -0
- package/dist/encoding/Sse.d.ts.map +1 -1
- package/dist/encoding/Sse.js +7 -5
- package/dist/encoding/Sse.js.map +1 -1
- package/dist/encoding/Xml.d.ts +117 -11
- package/dist/encoding/Xml.d.ts.map +1 -1
- package/dist/encoding/Xml.js +332 -42
- package/dist/encoding/Xml.js.map +1 -1
- package/dist/eventlog/EventJournal.d.ts.map +1 -1
- package/dist/eventlog/EventJournal.js +3 -8
- package/dist/eventlog/EventJournal.js.map +1 -1
- package/dist/eventlog/SqlEventLogServerEncrypted.js +6 -8
- package/dist/eventlog/SqlEventLogServerEncrypted.js.map +1 -1
- package/dist/http/FindMyWay/internal/router.js +163 -116
- package/dist/http/FindMyWay/internal/router.js.map +1 -1
- package/dist/http/FindMyWay.d.ts +99 -0
- package/dist/http/FindMyWay.d.ts.map +1 -1
- package/dist/http/FindMyWay.js +39 -0
- package/dist/http/FindMyWay.js.map +1 -1
- package/dist/http/HttpClient.d.ts.map +1 -1
- package/dist/http/HttpClient.js +1 -1
- package/dist/http/HttpClient.js.map +1 -1
- package/dist/http/HttpMiddleware.d.ts.map +1 -1
- package/dist/http/HttpMiddleware.js +18 -9
- package/dist/http/HttpMiddleware.js.map +1 -1
- package/dist/http/HttpRouter.d.ts +49 -1
- package/dist/http/HttpRouter.d.ts.map +1 -1
- package/dist/http/HttpRouter.js +70 -20
- package/dist/http/HttpRouter.js.map +1 -1
- package/dist/http/HttpServerResponse.d.ts.map +1 -1
- package/dist/http/HttpServerResponse.js +24 -58
- package/dist/http/HttpServerResponse.js.map +1 -1
- package/dist/http/Mime.d.ts.map +1 -1
- package/dist/http/Mime.js +3 -2
- package/dist/http/Mime.js.map +1 -1
- package/dist/http/internal/compression.d.ts.map +1 -1
- package/dist/http/internal/compression.js +2 -2
- package/dist/http/internal/compression.js.map +1 -1
- package/dist/http/internal/mediaType.d.ts.map +1 -0
- package/dist/{http-api → http}/internal/mediaType.js +4 -0
- package/dist/{http-api → http}/internal/mediaType.js.map +1 -1
- package/dist/http/internal/redactedPath.d.ts +2 -0
- package/dist/http/internal/redactedPath.d.ts.map +1 -0
- package/dist/http/internal/redactedPath.js +138 -0
- package/dist/http/internal/redactedPath.js.map +1 -0
- package/dist/http/internal/requestState.js +16 -0
- package/dist/http/internal/requestState.js.map +1 -1
- package/dist/http-api/HttpApi.d.ts +58 -0
- package/dist/http-api/HttpApi.d.ts.map +1 -1
- package/dist/http-api/HttpApi.js +80 -0
- package/dist/http-api/HttpApi.js.map +1 -1
- package/dist/http-api/HttpApiBuilder.d.ts.map +1 -1
- package/dist/http-api/HttpApiBuilder.js +12 -3
- package/dist/http-api/HttpApiBuilder.js.map +1 -1
- package/dist/http-api/HttpApiClient.d.ts +1 -1
- package/dist/http-api/HttpApiClient.d.ts.map +1 -1
- package/dist/http-api/HttpApiClient.js +11 -7
- package/dist/http-api/HttpApiClient.js.map +1 -1
- package/dist/http-api/HttpApiEndpoint.d.ts.map +1 -1
- package/dist/http-api/HttpApiEndpoint.js +1 -1
- package/dist/http-api/HttpApiEndpoint.js.map +1 -1
- package/dist/http-api/HttpApiScalar.d.ts +4 -0
- package/dist/http-api/HttpApiScalar.d.ts.map +1 -1
- package/dist/http-api/HttpApiScalar.js +10 -1
- package/dist/http-api/HttpApiScalar.js.map +1 -1
- package/dist/http-api/HttpApiSchema.d.ts +66 -0
- package/dist/http-api/HttpApiSchema.d.ts.map +1 -1
- package/dist/http-api/HttpApiSchema.js +67 -2
- package/dist/http-api/HttpApiSchema.js.map +1 -1
- package/dist/http-api/OpenApi.d.ts +2 -0
- package/dist/http-api/OpenApi.d.ts.map +1 -1
- package/dist/http-api/internal/httpApiScalar.js +5 -2
- package/dist/http-api/internal/httpApiScalar.js.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/internal/arbitrary/model.js +0 -5
- package/dist/internal/arbitrary/model.js.map +1 -1
- package/dist/internal/arbitrary/regexp.js +2 -1
- package/dist/internal/arbitrary/regexp.js.map +1 -1
- package/dist/internal/arbitrary/runner.d.ts.map +1 -1
- package/dist/internal/arbitrary/runner.js +21 -16
- package/dist/internal/arbitrary/runner.js.map +1 -1
- package/dist/internal/arbitrary/schema.js +140 -23
- package/dist/internal/arbitrary/schema.js.map +1 -1
- package/dist/internal/codegen.d.ts +2 -0
- package/dist/internal/codegen.d.ts.map +1 -0
- package/dist/internal/codegen.js +59 -0
- package/dist/internal/codegen.js.map +1 -0
- package/dist/internal/core.js +3 -3
- package/dist/internal/core.js.map +1 -1
- package/dist/internal/dateTime.js +26 -12
- package/dist/internal/dateTime.js.map +1 -1
- package/dist/internal/effect.js +21 -7
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/hashMap.js +7 -7
- package/dist/internal/hashMap.js.map +1 -1
- package/dist/internal/matcher.js +2 -1
- package/dist/internal/matcher.js.map +1 -1
- package/dist/internal/record.js +18 -4
- package/dist/internal/record.js.map +1 -1
- package/dist/internal/result.js +1 -1
- package/dist/internal/result.js.map +1 -1
- package/dist/internal/schema/codeExpression.d.ts +4 -0
- package/dist/internal/schema/codeExpression.d.ts.map +1 -0
- package/dist/internal/schema/codeExpression.js +179 -0
- package/dist/internal/schema/codeExpression.js.map +1 -0
- package/dist/internal/schema/codeImports.d.ts +8 -0
- package/dist/internal/schema/codeImports.d.ts.map +1 -0
- package/dist/internal/schema/codeImports.js +135 -0
- package/dist/internal/schema/codeImports.js.map +1 -0
- package/dist/internal/schema/codeTokens.d.ts +8 -0
- package/dist/internal/schema/codeTokens.d.ts.map +1 -0
- package/dist/internal/schema/codeTokens.js +17 -0
- package/dist/internal/schema/codeTokens.js.map +1 -0
- package/dist/internal/schema/fromJsonSchemaDocument.js +141 -35
- package/dist/internal/schema/fromJsonSchemaDocument.js.map +1 -1
- package/dist/internal/schema/passthrough.d.ts +2 -0
- package/dist/internal/schema/passthrough.d.ts.map +1 -0
- package/dist/internal/schema/passthrough.js +8 -0
- package/dist/internal/schema/passthrough.js.map +1 -0
- package/dist/internal/schema/schemaCodegen.d.ts +2 -0
- package/dist/internal/schema/schemaCodegen.d.ts.map +1 -0
- package/dist/internal/schema/schemaCodegen.js +377 -0
- package/dist/internal/schema/schemaCodegen.js.map +1 -0
- package/dist/internal/schema/toJsonSchemaDocument.js +11 -4
- package/dist/internal/schema/toJsonSchemaDocument.js.map +1 -1
- package/dist/internal/trie.js +51 -64
- package/dist/internal/trie.js.map +1 -1
- package/dist/internal/utf8.d.ts +2 -0
- package/dist/internal/utf8.d.ts.map +1 -0
- package/dist/internal/utf8.js +151 -0
- package/dist/internal/utf8.js.map +1 -0
- package/dist/internal/version.js +1 -1
- package/dist/jose/Jwks.d.ts +13 -0
- package/dist/jose/Jwks.d.ts.map +1 -1
- package/dist/jose/Jwks.js +10 -2
- package/dist/jose/Jwks.js.map +1 -1
- package/dist/observability/OtlpExporter.d.ts.map +1 -1
- package/dist/observability/OtlpExporter.js +12 -10
- package/dist/observability/OtlpExporter.js.map +1 -1
- package/dist/observability/OtlpLogger.d.ts.map +1 -1
- package/dist/observability/OtlpLogger.js +5 -3
- package/dist/observability/OtlpLogger.js.map +1 -1
- package/dist/observability/internal/otlpProtobuf.d.ts +4 -2
- package/dist/observability/internal/otlpProtobuf.d.ts.map +1 -1
- package/dist/observability/internal/otlpProtobuf.js +238 -156
- package/dist/observability/internal/otlpProtobuf.js.map +1 -1
- package/dist/persistence/PersistedQueue.d.ts.map +1 -1
- package/dist/persistence/PersistedQueue.js +20 -3
- package/dist/persistence/PersistedQueue.js.map +1 -1
- package/dist/protobuf/ProtobufDescriptor.d.ts +377 -0
- package/dist/protobuf/ProtobufDescriptor.d.ts.map +1 -0
- package/dist/protobuf/ProtobufDescriptor.js +135 -0
- package/dist/protobuf/ProtobufDescriptor.js.map +1 -0
- package/dist/protobuf/ProtobufDescriptorProto.d.ts +2083 -0
- package/dist/protobuf/ProtobufDescriptorProto.d.ts.map +1 -0
- package/dist/protobuf/ProtobufDescriptorProto.js +2674 -0
- package/dist/protobuf/ProtobufDescriptorProto.js.map +1 -0
- package/dist/protobuf/ProtobufMessage.d.ts +183 -0
- package/dist/protobuf/ProtobufMessage.d.ts.map +1 -0
- package/dist/protobuf/ProtobufMessage.js +232 -0
- package/dist/protobuf/ProtobufMessage.js.map +1 -0
- package/dist/protobuf/ProtobufReader.d.ts +350 -0
- package/dist/protobuf/ProtobufReader.d.ts.map +1 -0
- package/dist/protobuf/ProtobufReader.js +698 -0
- package/dist/protobuf/ProtobufReader.js.map +1 -0
- package/dist/protobuf/ProtobufWriter.d.ts +224 -0
- package/dist/protobuf/ProtobufWriter.d.ts.map +1 -0
- package/dist/protobuf/ProtobufWriter.js +483 -0
- package/dist/protobuf/ProtobufWriter.js.map +1 -0
- package/dist/protobuf/index.d.ts +30 -0
- package/dist/protobuf/index.d.ts.map +1 -0
- package/dist/protobuf/index.js +31 -0
- package/dist/protobuf/index.js.map +1 -0
- package/dist/protobuf/internal/binary.d.ts +2 -0
- package/dist/protobuf/internal/binary.d.ts.map +1 -0
- package/dist/protobuf/internal/binary.js +966 -0
- package/dist/protobuf/internal/binary.js.map +1 -0
- package/dist/protobuf/internal/resolve.d.ts +2 -0
- package/dist/protobuf/internal/resolve.d.ts.map +1 -0
- package/dist/protobuf/internal/resolve.js +463 -0
- package/dist/protobuf/internal/resolve.js.map +1 -0
- package/dist/protobuf/internal/wireType.d.ts +2 -0
- package/dist/protobuf/internal/wireType.d.ts.map +1 -0
- package/dist/protobuf/internal/wireType.js +10 -0
- package/dist/protobuf/internal/wireType.js.map +1 -0
- package/dist/reactivity/AsyncResult.d.ts +3 -0
- package/dist/reactivity/AsyncResult.d.ts.map +1 -1
- package/dist/reactivity/AsyncResult.js +4 -1
- package/dist/reactivity/AsyncResult.js.map +1 -1
- package/dist/reactivity/Atom.d.ts +10 -4
- package/dist/reactivity/Atom.d.ts.map +1 -1
- package/dist/reactivity/Atom.js +38 -13
- package/dist/reactivity/Atom.js.map +1 -1
- package/dist/reactivity/AtomHttpApi.d.ts +5 -0
- package/dist/reactivity/AtomHttpApi.d.ts.map +1 -1
- package/dist/reactivity/AtomHttpApi.js +5 -1
- package/dist/reactivity/AtomHttpApi.js.map +1 -1
- package/dist/reactivity/AtomRegistry.js +13 -0
- package/dist/reactivity/AtomRegistry.js.map +1 -1
- package/dist/reactivity/AtomRpc.d.ts +5 -0
- package/dist/reactivity/AtomRpc.d.ts.map +1 -1
- package/dist/reactivity/AtomRpc.js +6 -1
- package/dist/reactivity/AtomRpc.js.map +1 -1
- package/dist/rpc/Rpc.d.ts +25 -0
- package/dist/rpc/Rpc.d.ts.map +1 -1
- package/dist/rpc/Rpc.js +18 -0
- package/dist/rpc/Rpc.js.map +1 -1
- package/dist/rpc/RpcClient.d.ts.map +1 -1
- package/dist/rpc/RpcClient.js +38 -21
- package/dist/rpc/RpcClient.js.map +1 -1
- package/dist/rpc/RpcGroup.d.ts +5 -0
- package/dist/rpc/RpcGroup.d.ts.map +1 -1
- package/dist/rpc/RpcGroup.js.map +1 -1
- package/dist/rpc/RpcMiddleware.d.ts +9 -0
- package/dist/rpc/RpcMiddleware.d.ts.map +1 -1
- package/dist/rpc/RpcMiddleware.js.map +1 -1
- package/dist/rpc/RpcSerialization.d.ts +7 -1
- package/dist/rpc/RpcSerialization.d.ts.map +1 -1
- package/dist/rpc/RpcSerialization.js +22 -5
- package/dist/rpc/RpcSerialization.js.map +1 -1
- package/dist/rpc/RpcServer.d.ts.map +1 -1
- package/dist/rpc/RpcServer.js +33 -18
- package/dist/rpc/RpcServer.js.map +1 -1
- package/dist/schema/SchemaCompiler/runtime.js +2 -1
- package/dist/schema/SchemaCompiler/runtime.js.map +1 -1
- package/dist/schema/VariantSchema.d.ts +10 -2
- package/dist/schema/VariantSchema.d.ts.map +1 -1
- package/dist/schema/VariantSchema.js +7 -1
- package/dist/schema/VariantSchema.js.map +1 -1
- package/dist/socket/Socket.d.ts +24 -10
- package/dist/socket/Socket.d.ts.map +1 -1
- package/dist/socket/Socket.js +52 -17
- package/dist/socket/Socket.js.map +1 -1
- package/dist/sql/Migrator.d.ts +3 -0
- package/dist/sql/Migrator.d.ts.map +1 -1
- package/dist/sql/Migrator.js +10 -1
- package/dist/sql/Migrator.js.map +1 -1
- package/dist/sql/SqlModel.d.ts.map +1 -1
- package/dist/sql/SqlModel.js +1 -0
- package/dist/sql/SqlModel.js.map +1 -1
- package/dist/testing/TestClock.js +3 -1
- package/dist/testing/TestClock.js.map +1 -1
- package/dist/testing/TestConsole.d.ts +96 -0
- package/dist/testing/TestConsole.d.ts.map +1 -1
- package/dist/testing/TestConsole.js +78 -6
- package/dist/testing/TestConsole.js.map +1 -1
- package/dist/testing/TestSchema.d.ts +5 -1
- package/dist/testing/TestSchema.d.ts.map +1 -1
- package/dist/testing/TestSchema.js +7 -2
- package/dist/testing/TestSchema.js.map +1 -1
- package/dist/workers/SharedMemory.d.ts +115 -0
- package/dist/workers/SharedMemory.d.ts.map +1 -0
- package/dist/workers/SharedMemory.js +149 -0
- package/dist/workers/SharedMemory.js.map +1 -0
- package/dist/workers/Transferable.d.ts.map +1 -1
- package/dist/workers/Transferable.js +1 -4
- package/dist/workers/Transferable.js.map +1 -1
- package/dist/workers/index.d.ts +5 -0
- package/dist/workers/index.d.ts.map +1 -1
- package/dist/workers/index.js +5 -0
- package/dist/workers/index.js.map +1 -1
- package/dist/workflow/WorkflowEngine.d.ts.map +1 -1
- package/dist/workflow/WorkflowEngine.js +3 -1
- package/dist/workflow/WorkflowEngine.js.map +1 -1
- package/package.json +7 -4
- package/src/Arbitrary.ts +60 -3
- package/src/BigInt.ts +247 -9
- package/src/Cache.ts +4 -2
- package/src/Cause.ts +3 -3
- package/src/Chunk.ts +7 -3
- package/src/Clock.ts +5 -2
- package/src/Codegen.ts +741 -0
- package/src/Config.ts +35 -4
- package/src/ConfigProvider.ts +24 -7
- package/src/Effect.ts +871 -109
- package/src/Equivalence.ts +16 -13
- package/src/Fiber.ts +58 -8
- package/src/FiberHandle.ts +86 -12
- package/src/FiberMap.ts +83 -10
- package/src/FiberSet.ts +96 -8
- package/src/Formatter.ts +2 -0
- package/src/LayerMap.ts +14 -4
- package/src/LayerRef.ts +2 -2
- package/src/Match.ts +16 -0
- package/src/Metric.ts +1 -1
- package/src/Option.ts +9 -5
- package/src/Order.ts +9 -4
- package/src/Pool.ts +22 -17
- package/src/Predicate.ts +7 -3
- package/src/Queue.ts +84 -31
- package/src/Rational.ts +198 -0
- package/src/Request.ts +20 -0
- package/src/Result.ts +9 -6
- package/src/Schema.ts +69 -32
- package/src/SchemaAST.ts +15 -4
- package/src/SchemaGetter.ts +17 -10
- package/src/SchemaRepresentation.ts +37 -77
- package/src/SchemaTransformation.ts +12 -11
- package/src/Scope.ts +12 -6
- package/src/ScopedCache.ts +2 -1
- package/src/Semaphore.ts +18 -4
- package/src/Stream.ts +66 -20
- package/src/String.ts +83 -6
- package/src/Struct.ts +138 -5
- package/src/TextDiff.ts +186 -30
- package/src/TxPriorityQueue.ts +2 -2
- package/src/ai/Chat.ts +9 -3
- package/src/ai/LanguageModel.ts +72 -15
- package/src/ai/McpClient.ts +1 -11
- package/src/ai/McpServer.ts +146 -25
- package/src/ai/Tool.ts +3 -2
- package/src/ai/Toolkit.ts +3 -1
- package/src/ai/WorkloadIdentity.ts +318 -0
- package/src/ai/index.ts +6 -0
- package/src/ai/internal/mcpProtocol/v2024_11_05.ts +3 -1
- package/src/ai/internal/mcpProtocol/v2025_03_26.ts +3 -1
- package/src/ai/internal/mcpProtocol/v2025_06_18.ts +3 -1
- package/src/ai/internal/mcpProtocol/v2025_11_25.ts +3 -1
- package/src/ai/internal/mcpRuntime.ts +2 -6
- package/src/ai/internal/mcpSkills.ts +70 -2
- package/src/ai/internal/structured-output.ts +6 -1
- package/src/chat/Chat.ts +164 -0
- package/src/chat/ChatAdapter.ts +444 -0
- package/src/chat/ChatError.ts +684 -0
- package/src/chat/ChatEvent.ts +221 -0
- package/src/chat/ChatHandler.ts +102 -0
- package/src/chat/ChatInteraction.ts +1979 -0
- package/src/chat/ChatMarkdown.ts +1406 -0
- package/src/chat/ChatMessage.ts +213 -0
- package/src/chat/ChatTest.ts +2606 -0
- package/src/chat/ChatThread.ts +132 -0
- package/src/chat/ChatUi.ts +320 -0
- package/src/chat/index.ts +72 -0
- package/src/chat/internal/retries.ts +7 -0
- package/src/cli/CliOutput.ts +4 -5
- package/src/cli/Command.ts +25 -3
- package/src/cli/Prompt.ts +15 -9
- package/src/cli/internal/config.ts +8 -8
- package/src/cli/internal/lexer.ts +14 -0
- package/src/cli/internal/parser.ts +28 -20
- package/src/cli/internal/wizard.ts +4 -0
- package/src/cluster/ClusterCron.ts +33 -10
- package/src/cluster/ClusterWorkflowEngine.ts +42 -23
- package/src/cluster/Sharding.ts +17 -3
- package/src/cluster/ShardingConfig.ts +3 -0
- package/src/cluster/SqlMessageStorage.ts +16 -20
- package/src/cluster/SqlRunnerStorage.ts +21 -8
- package/src/cluster/internal/entityManager.ts +19 -10
- package/src/cluster/internal/entityReaper.ts +1 -1
- package/src/crypto/Kdf.ts +2 -1
- package/src/crypto/Password.ts +258 -0
- package/src/crypto/index.ts +6 -0
- package/src/encoding/Base64.ts +79 -0
- package/src/encoding/Base64Url.ts +1 -0
- package/src/encoding/Csv.ts +47 -20
- package/src/encoding/Hex.ts +5 -0
- package/src/encoding/SchemaBinary.ts +13 -79
- package/src/encoding/Sse.ts +7 -5
- package/src/encoding/Xml.ts +394 -47
- package/src/eventlog/EventJournal.ts +3 -8
- package/src/eventlog/SqlEventLogServerEncrypted.ts +9 -9
- package/src/http/FindMyWay/internal/router.ts +181 -129
- package/src/http/FindMyWay.ts +106 -0
- package/src/http/HttpClient.ts +2 -1
- package/src/http/HttpMiddleware.ts +34 -10
- package/src/http/HttpRouter.ts +84 -20
- package/src/http/HttpServerResponse.ts +33 -61
- package/src/http/Mime.ts +3 -2
- package/src/http/internal/compression.ts +2 -2
- package/src/{http-api → http}/internal/mediaType.ts +4 -0
- package/src/http/internal/redactedPath.ts +144 -0
- package/src/http/internal/requestState.ts +22 -0
- package/src/http-api/HttpApi.ts +103 -0
- package/src/http-api/HttpApiBuilder.ts +14 -3
- package/src/http-api/HttpApiClient.ts +23 -8
- package/src/http-api/HttpApiEndpoint.ts +1 -1
- package/src/http-api/HttpApiScalar.ts +9 -1
- package/src/http-api/HttpApiSchema.ts +69 -3
- package/src/http-api/OpenApi.ts +2 -0
- package/src/http-api/internal/httpApiScalar.ts +5 -1
- package/src/index.ts +6 -0
- package/src/internal/arbitrary/model.ts +3 -9
- package/src/internal/arbitrary/regexp.ts +3 -1
- package/src/internal/arbitrary/runner.ts +28 -14
- package/src/internal/arbitrary/schema.ts +140 -35
- package/src/internal/codegen.ts +53 -0
- package/src/internal/core.ts +3 -3
- package/src/internal/dateTime.ts +30 -13
- package/src/internal/effect.ts +25 -9
- package/src/internal/hashMap.ts +8 -7
- package/src/internal/matcher.ts +2 -1
- package/src/internal/record.ts +19 -4
- package/src/internal/result.ts +1 -1
- package/src/internal/schema/codeExpression.ts +179 -0
- package/src/internal/schema/codeImports.ts +142 -0
- package/src/internal/schema/codeTokens.ts +39 -0
- package/src/internal/schema/fromJsonSchemaDocument.ts +154 -34
- package/src/internal/schema/passthrough.ts +8 -0
- package/src/internal/schema/schemaCodegen.ts +543 -0
- package/src/internal/schema/toJsonSchemaDocument.ts +13 -4
- package/src/internal/trie.ts +46 -60
- package/src/internal/utf8.ts +106 -0
- package/src/internal/version.ts +1 -1
- package/src/jose/Jwks.ts +23 -4
- package/src/observability/OtlpExporter.ts +12 -10
- package/src/observability/OtlpLogger.ts +5 -3
- package/src/observability/internal/otlpProtobuf.ts +386 -457
- package/src/persistence/PersistedQueue.ts +21 -4
- package/src/protobuf/ProtobufDescriptor.ts +503 -0
- package/src/protobuf/ProtobufDescriptorProto.ts +3611 -0
- package/src/protobuf/ProtobufMessage.ts +277 -0
- package/src/protobuf/ProtobufReader.ts +756 -0
- package/src/protobuf/ProtobufWriter.ts +530 -0
- package/src/protobuf/index.ts +36 -0
- package/src/protobuf/internal/binary.ts +1215 -0
- package/src/protobuf/internal/resolve.ts +533 -0
- package/src/protobuf/internal/wireType.ts +9 -0
- package/src/reactivity/AsyncResult.ts +6 -1
- package/src/reactivity/Atom.ts +55 -16
- package/src/reactivity/AtomHttpApi.ts +10 -1
- package/src/reactivity/AtomRegistry.ts +16 -0
- package/src/reactivity/AtomRpc.ts +11 -1
- package/src/rpc/Rpc.ts +31 -0
- package/src/rpc/RpcClient.ts +30 -21
- package/src/rpc/RpcGroup.ts +5 -0
- package/src/rpc/RpcMiddleware.ts +9 -0
- package/src/rpc/RpcSerialization.ts +26 -6
- package/src/rpc/RpcServer.ts +33 -20
- package/src/schema/SchemaCompiler/runtime.ts +2 -3
- package/src/schema/VariantSchema.ts +12 -4
- package/src/socket/Socket.ts +67 -20
- package/src/sql/Migrator.ts +8 -1
- package/src/sql/SqlModel.ts +4 -0
- package/src/testing/TestClock.ts +1 -1
- package/src/testing/TestConsole.ts +119 -9
- package/src/testing/TestSchema.ts +8 -3
- package/src/workers/SharedMemory.ts +227 -0
- package/src/workers/Transferable.ts +1 -5
- package/src/workers/index.ts +6 -0
- package/src/workflow/WorkflowEngine.ts +3 -1
- package/dist/http-api/internal/mediaType.d.ts.map +0 -1
- package/dist/internal/schema/toCodeDocument.d.ts +0 -2
- package/dist/internal/schema/toCodeDocument.d.ts.map +0 -1
- package/dist/internal/schema/toCodeDocument.js +0 -444
- package/dist/internal/schema/toCodeDocument.js.map +0 -1
- package/dist/observability/internal/protobuf.d.ts +0 -2
- package/dist/observability/internal/protobuf.d.ts.map +0 -1
- package/dist/observability/internal/protobuf.js +0 -169
- package/dist/observability/internal/protobuf.js.map +0 -1
- package/src/internal/schema/toCodeDocument.ts +0 -570
- package/src/observability/internal/protobuf.ts +0 -225
- /package/dist/{http-api → http}/internal/mediaType.d.ts +0 -0
package/src/TextDiff.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The `TextDiff` module computes edit scripts for arrays and text, applies and
|
|
3
|
-
* inverts them,
|
|
3
|
+
* inverts them, groups line differences into hunks, and formats them as
|
|
4
|
+
* unified diffs.
|
|
4
5
|
*
|
|
5
6
|
* Scripts are computed with Myers' O(ND) algorithm in linear space, after
|
|
6
7
|
* trimming common prefixes and suffixes. Scripts are minimal unless the
|
|
@@ -71,6 +72,58 @@ export interface EditDelete<A> {
|
|
|
71
72
|
readonly items: ReadonlyArray<A>
|
|
72
73
|
}
|
|
73
74
|
|
|
75
|
+
/**
|
|
76
|
+
* A changed region of a line diff, with the unchanged lines around it.
|
|
77
|
+
*
|
|
78
|
+
* **Details**
|
|
79
|
+
*
|
|
80
|
+
* `beforeStart` and `afterStart` are zero-based line indexes in `before` and
|
|
81
|
+
* `after` where the hunk starts, and `beforeLines` and `afterLines` are how
|
|
82
|
+
* many lines of each it spans. Within each change, its `Delete` lines come
|
|
83
|
+
* before its `Insert` lines.
|
|
84
|
+
*
|
|
85
|
+
* @see {@link hunks} to group a line diff into hunks
|
|
86
|
+
* @stability experimental
|
|
87
|
+
* @category models
|
|
88
|
+
* @since 4.1.4
|
|
89
|
+
*/
|
|
90
|
+
export interface Hunk {
|
|
91
|
+
readonly beforeStart: number
|
|
92
|
+
readonly beforeLines: number
|
|
93
|
+
readonly afterStart: number
|
|
94
|
+
readonly afterLines: number
|
|
95
|
+
readonly lines: ReadonlyArray<HunkLine>
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* One line of a {@link Hunk}.
|
|
100
|
+
*
|
|
101
|
+
* **Details**
|
|
102
|
+
*
|
|
103
|
+
* `text` is the line as it appears in its string, with its line break when it
|
|
104
|
+
* has one. With the `inline` option of {@link hunks}, the deleted and inserted
|
|
105
|
+
* lines of a change are paired by position when there are as many of each, and
|
|
106
|
+
* `ranges` holds the UTF-16 ranges `[start, end)` of `text` that differ from
|
|
107
|
+
* its counterpart. The final `\n` is not compared.
|
|
108
|
+
*
|
|
109
|
+
* **Gotchas**
|
|
110
|
+
*
|
|
111
|
+
* - `ranges` is `undefined` when `inline` is off or the line is not paired,
|
|
112
|
+
* and empty when a pair differs only in its final `\n`, so an empty array
|
|
113
|
+
* does not mean the lines are identical.
|
|
114
|
+
* - A `\r` before the `\n` is compared, so `"a\r\n"` against `"a\n"` reports
|
|
115
|
+
* the `\r` as a range.
|
|
116
|
+
*
|
|
117
|
+
* @stability experimental
|
|
118
|
+
* @category models
|
|
119
|
+
* @since 4.1.4
|
|
120
|
+
*/
|
|
121
|
+
export interface HunkLine {
|
|
122
|
+
readonly _tag: "Equal" | "Delete" | "Insert"
|
|
123
|
+
readonly text: string
|
|
124
|
+
readonly ranges?: ReadonlyArray<readonly [start: number, end: number]> | undefined
|
|
125
|
+
}
|
|
126
|
+
|
|
74
127
|
/**
|
|
75
128
|
* Error returned when an edit script does not fit the input it is applied to.
|
|
76
129
|
*
|
|
@@ -446,51 +499,59 @@ export const invert = <A>(edits: ReadonlyArray<Edit<A>>): Array<Edit<A>> => {
|
|
|
446
499
|
}
|
|
447
500
|
|
|
448
501
|
/**
|
|
449
|
-
*
|
|
502
|
+
* Groups a line edit script into hunks: its changes with the unchanged lines
|
|
503
|
+
* around them.
|
|
450
504
|
*
|
|
451
505
|
* **Details**
|
|
452
506
|
*
|
|
453
507
|
* The script must come from {@link lines}, or otherwise hold one line per
|
|
454
|
-
* item.
|
|
455
|
-
* overlap
|
|
456
|
-
* ``. When `fromFile` or `toFile` is set, both
|
|
457
|
-
* header lines are emitted and an unset name falls back to the other. A script
|
|
458
|
-
* without changes produces an empty string.
|
|
508
|
+
* item. Hunks are grouped as by `diff -u`: changes whose context would touch
|
|
509
|
+
* or overlap share a hunk. A script without changes has no hunks.
|
|
459
510
|
*
|
|
460
511
|
* **Gotchas**
|
|
461
512
|
*
|
|
462
|
-
*
|
|
463
|
-
*
|
|
513
|
+
* With `inline`, each pair of lines gets a minimal code point diff with no
|
|
514
|
+
* similarity cutoff, so unrelated lines yield many short ranges. Deciding
|
|
515
|
+
* whether to highlight them, for example by how much of the line they cover,
|
|
516
|
+
* is up to the caller. Set `inlineMaxEdits` when lines can be long or
|
|
517
|
+
* untrusted.
|
|
464
518
|
*
|
|
465
|
-
* **Example** (
|
|
519
|
+
* **Example** (Grouping a line diff)
|
|
466
520
|
*
|
|
467
521
|
* ```ts import.meta.vitest
|
|
468
522
|
* import { TextDiff } from "effect"
|
|
469
523
|
*
|
|
470
|
-
* TextDiff.
|
|
524
|
+
* TextDiff.hunks(TextDiff.lines("a\nb\nc\n", "a\nB\nc\n"), { context: 0, inline: true }) // => [{ beforeStart: 1, beforeLines: 1, afterStart: 1, afterLines: 1, lines: [{ _tag: "Delete", text: "b\n", ranges: [[0, 1]] }, { _tag: "Insert", text: "B\n", ranges: [[0, 1]] }] }]
|
|
471
525
|
* ```
|
|
472
526
|
*
|
|
473
527
|
* @see {@link lines} to compute a line diff
|
|
528
|
+
* @see {@link unified} to format a line diff as text
|
|
474
529
|
* @stability experimental
|
|
475
|
-
* @category
|
|
476
|
-
* @since 4.
|
|
530
|
+
* @category combinators
|
|
531
|
+
* @since 4.1.4
|
|
477
532
|
*/
|
|
478
|
-
export const
|
|
533
|
+
export const hunks = (edits: ReadonlyArray<Edit<string>>, options?: {
|
|
479
534
|
/**
|
|
480
|
-
* Number of unchanged lines
|
|
535
|
+
* Number of unchanged lines kept around each change.
|
|
481
536
|
*
|
|
482
537
|
* @default 3
|
|
483
538
|
*/
|
|
484
539
|
readonly context?: number | undefined
|
|
485
540
|
/**
|
|
486
|
-
*
|
|
541
|
+
* Whether paired lines carry the `ranges` that differ from their
|
|
542
|
+
* counterpart, see {@link HunkLine}.
|
|
543
|
+
*
|
|
544
|
+
* @default false
|
|
487
545
|
*/
|
|
488
|
-
readonly
|
|
546
|
+
readonly inline?: boolean | undefined
|
|
489
547
|
/**
|
|
490
|
-
*
|
|
548
|
+
* The `maxEdits` of the code point diff of each pair of lines, see
|
|
549
|
+
* {@link codePoints}. Has no effect without `inline`.
|
|
550
|
+
*
|
|
551
|
+
* @default Infinity
|
|
491
552
|
*/
|
|
492
|
-
readonly
|
|
493
|
-
}):
|
|
553
|
+
readonly inlineMaxEdits?: number | undefined
|
|
554
|
+
}): Array<Hunk> => {
|
|
494
555
|
const a: Array<string> = []
|
|
495
556
|
const b: Array<string> = []
|
|
496
557
|
// Group consecutive deletions and insertions between Equal runs.
|
|
@@ -518,13 +579,10 @@ export const unified = (edits: ReadonlyArray<Edit<string>>, options?: {
|
|
|
518
579
|
change.b1 = b.length
|
|
519
580
|
}
|
|
520
581
|
}
|
|
521
|
-
if (changes.length === 0) return ""
|
|
522
582
|
|
|
523
583
|
const context = Math.max(0, Math.floor(options?.context ?? 3))
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
out += `--- ${options.fromFile ?? options.toFile}\n+++ ${options.toFile ?? options.fromFile}\n`
|
|
527
|
-
}
|
|
584
|
+
const inline = options?.inline === true
|
|
585
|
+
const out: Array<Hunk> = []
|
|
528
586
|
let start = 0
|
|
529
587
|
while (start < changes.length) {
|
|
530
588
|
let end = start + 1
|
|
@@ -535,21 +593,92 @@ export const unified = (edits: ReadonlyArray<Edit<string>>, options?: {
|
|
|
535
593
|
const b0 = first.b0 - (first.a0 - a0)
|
|
536
594
|
const a1 = Math.min(a.length, last.a1 + context)
|
|
537
595
|
const b1 = last.b1 + (a1 - last.a1)
|
|
538
|
-
|
|
596
|
+
const lines: Array<HunkLine> = []
|
|
539
597
|
let line = a0
|
|
540
598
|
for (let c = start; c < end; c++) {
|
|
541
599
|
const change = changes[c]
|
|
542
|
-
for (; line < change.a0; line++)
|
|
543
|
-
|
|
544
|
-
|
|
600
|
+
for (; line < change.a0; line++) lines.push({ _tag: "Equal", text: a[line] })
|
|
601
|
+
if (inline && change.a1 - change.a0 === change.b1 - change.b0) {
|
|
602
|
+
const inserts: Array<HunkLine> = []
|
|
603
|
+
for (let k = change.a0, l = change.b0; k < change.a1; k++, l++) {
|
|
604
|
+
const [deleted, inserted] = inlineRanges(a[k], b[l], options?.inlineMaxEdits)
|
|
605
|
+
lines.push({ _tag: "Delete", text: a[k], ranges: deleted })
|
|
606
|
+
inserts.push({ _tag: "Insert", text: b[l], ranges: inserted })
|
|
607
|
+
}
|
|
608
|
+
for (const insert of inserts) lines.push(insert)
|
|
609
|
+
} else {
|
|
610
|
+
for (let k = change.a0; k < change.a1; k++) lines.push({ _tag: "Delete", text: a[k] })
|
|
611
|
+
for (let k = change.b0; k < change.b1; k++) lines.push({ _tag: "Insert", text: b[k] })
|
|
612
|
+
}
|
|
545
613
|
line = change.a1
|
|
546
614
|
}
|
|
547
|
-
for (; line < a1; line++)
|
|
615
|
+
for (; line < a1; line++) lines.push({ _tag: "Equal", text: a[line] })
|
|
616
|
+
out.push({ beforeStart: a0, beforeLines: a1 - a0, afterStart: b0, afterLines: b1 - b0, lines })
|
|
548
617
|
start = end
|
|
549
618
|
}
|
|
550
619
|
return out
|
|
551
620
|
}
|
|
552
621
|
|
|
622
|
+
/**
|
|
623
|
+
* Formats a line edit script as a unified diff.
|
|
624
|
+
*
|
|
625
|
+
* **Details**
|
|
626
|
+
*
|
|
627
|
+
* The script must come from {@link lines}, or otherwise hold one line per
|
|
628
|
+
* item. The output follows `diff -u`: hunks whose context would touch or
|
|
629
|
+
* overlap are merged, and a final line without a newline is followed by
|
|
630
|
+
* ``. When `fromFile` or `toFile` is set, both
|
|
631
|
+
* header lines are emitted and an unset name falls back to the other. A script
|
|
632
|
+
* without changes produces an empty string.
|
|
633
|
+
*
|
|
634
|
+
* **Gotchas**
|
|
635
|
+
*
|
|
636
|
+
* Among equally small diffs, hunks can differ from those of GNU diff or Git,
|
|
637
|
+
* which apply extra heuristics.
|
|
638
|
+
*
|
|
639
|
+
* **Example** (Formatting a unified diff)
|
|
640
|
+
*
|
|
641
|
+
* ```ts import.meta.vitest
|
|
642
|
+
* import { TextDiff } from "effect"
|
|
643
|
+
*
|
|
644
|
+
* TextDiff.unified(TextDiff.lines("a\nb\n", "a\nc\n")) // => "@@ -1,2 +1,2 @@\n a\n-b\n+c\n"
|
|
645
|
+
* ```
|
|
646
|
+
*
|
|
647
|
+
* @see {@link lines} to compute a line diff
|
|
648
|
+
* @see {@link hunks} for the same hunks as data
|
|
649
|
+
* @stability experimental
|
|
650
|
+
* @category formatting
|
|
651
|
+
* @since 4.0.6
|
|
652
|
+
*/
|
|
653
|
+
export const unified = (edits: ReadonlyArray<Edit<string>>, options?: {
|
|
654
|
+
/**
|
|
655
|
+
* Number of unchanged lines shown around each change.
|
|
656
|
+
*
|
|
657
|
+
* @default 3
|
|
658
|
+
*/
|
|
659
|
+
readonly context?: number | undefined
|
|
660
|
+
/**
|
|
661
|
+
* Name shown in the `---` header line.
|
|
662
|
+
*/
|
|
663
|
+
readonly fromFile?: string | undefined
|
|
664
|
+
/**
|
|
665
|
+
* Name shown in the `+++` header line.
|
|
666
|
+
*/
|
|
667
|
+
readonly toFile?: string | undefined
|
|
668
|
+
}): string => {
|
|
669
|
+
const found = hunks(edits, { context: options?.context })
|
|
670
|
+
if (found.length === 0) return ""
|
|
671
|
+
let out = ""
|
|
672
|
+
if (options?.fromFile !== undefined || options?.toFile !== undefined) {
|
|
673
|
+
out += `--- ${options.fromFile ?? options.toFile}\n+++ ${options.toFile ?? options.fromFile}\n`
|
|
674
|
+
}
|
|
675
|
+
for (const hunk of found) {
|
|
676
|
+
out += `@@ -${range(hunk.beforeStart, hunk.beforeLines)} +${range(hunk.afterStart, hunk.afterLines)} @@\n`
|
|
677
|
+
for (const line of hunk.lines) out += formatLine(prefixes[line._tag], line.text)
|
|
678
|
+
}
|
|
679
|
+
return out
|
|
680
|
+
}
|
|
681
|
+
|
|
553
682
|
// -----------------------------------------------------------------------------
|
|
554
683
|
// internal
|
|
555
684
|
// -----------------------------------------------------------------------------
|
|
@@ -589,9 +718,36 @@ const splitLines = (text: string): Array<string> => text.match(/[^\n]*\n|[^\n]+$
|
|
|
589
718
|
const range = (start: number, count: number): string =>
|
|
590
719
|
count === 0 ? `${start},0` : count === 1 ? `${start + 1}` : `${start + 1},${count}`
|
|
591
720
|
|
|
721
|
+
const prefixes = { Equal: " ", Delete: "-", Insert: "+" } as const
|
|
722
|
+
|
|
592
723
|
const formatLine = (prefix: string, line: string): string =>
|
|
593
724
|
line.endsWith("\n") ? prefix + line : `${prefix}${line}\n\\n`
|
|
594
725
|
|
|
726
|
+
const withoutBreak = (line: string): string => line.endsWith("\n") ? line.slice(0, -1) : line
|
|
727
|
+
|
|
728
|
+
// The UTF-16 ranges of each line that differ from the other, ignoring a final `\n`
|
|
729
|
+
const inlineRanges = (before: string, after: string, maxEdits: number | undefined) => {
|
|
730
|
+
const inBefore: Array<readonly [number, number]> = []
|
|
731
|
+
const inAfter: Array<readonly [number, number]> = []
|
|
732
|
+
let i = 0
|
|
733
|
+
let j = 0
|
|
734
|
+
for (const edit of codePoints(withoutBreak(before), withoutBreak(after), { maxEdits })) {
|
|
735
|
+
let length = 0
|
|
736
|
+
for (const item of edit.items) length += item.length
|
|
737
|
+
if (edit._tag === "Equal") {
|
|
738
|
+
i += length
|
|
739
|
+
j += length
|
|
740
|
+
} else if (edit._tag === "Delete") {
|
|
741
|
+
inBefore.push([i, i + length])
|
|
742
|
+
i += length
|
|
743
|
+
} else {
|
|
744
|
+
inAfter.push([j, j + length])
|
|
745
|
+
j += length
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
return [inBefore, inAfter] as const
|
|
749
|
+
}
|
|
750
|
+
|
|
595
751
|
// Interns the tokens so the search compares integers instead of strings
|
|
596
752
|
const diffStrings = (a: ReadonlyArray<string>, b: ReadonlyArray<string>, maxEdits?: number) => {
|
|
597
753
|
const ids = new Map<string, number>()
|
package/src/TxPriorityQueue.ts
CHANGED
|
@@ -119,7 +119,7 @@ const mergeSorted = <A>(chunk: Chunk<A>, values: ReadonlyArray<A>, ord: Order<A>
|
|
|
119
119
|
out[k++] = value
|
|
120
120
|
}
|
|
121
121
|
for (; i < arr.length; i++) out[k++] = arr[i]
|
|
122
|
-
return C.
|
|
122
|
+
return C.fromArrayUnsafe(out)
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
/**
|
|
@@ -181,7 +181,7 @@ export function fromIterable<A>(
|
|
|
181
181
|
}
|
|
182
182
|
const arr = Array.from(iterable).sort((a, b) => order(a, b))
|
|
183
183
|
return Effect.map(
|
|
184
|
-
TxRef.make<Chunk<A>>(C.
|
|
184
|
+
TxRef.make<Chunk<A>>(C.fromArrayUnsafe(arr)),
|
|
185
185
|
(ref) => makeTxPriorityQueue(ref, order)
|
|
186
186
|
)
|
|
187
187
|
}
|
package/src/ai/Chat.ts
CHANGED
|
@@ -423,13 +423,19 @@ export interface Chat {
|
|
|
423
423
|
readonly generateObject: <
|
|
424
424
|
ObjectEncoded extends Record<string, any>,
|
|
425
425
|
ObjectSchema extends Schema.Encoder<ObjectEncoded, unknown>,
|
|
426
|
-
Options extends NoExcessProperties<LanguageModel.GenerateObjectOptions<any, ObjectSchema>, Options>
|
|
426
|
+
Options extends NoExcessProperties<LanguageModel.GenerateObjectOptions<any, ObjectSchema, boolean>, Options>
|
|
427
427
|
>(
|
|
428
|
-
options:
|
|
428
|
+
options:
|
|
429
|
+
& Options
|
|
430
|
+
& LanguageModel.GenerateObjectOptions<
|
|
431
|
+
LanguageModel.ExtractTools<Options>,
|
|
432
|
+
ObjectSchema,
|
|
433
|
+
false | Extract<Options["allowEmpty" & keyof Options], boolean>
|
|
434
|
+
>
|
|
429
435
|
) => Effect.Effect<
|
|
430
436
|
LanguageModel.GenerateObjectResponse<
|
|
431
437
|
LanguageModel.ExtractTools<Options>,
|
|
432
|
-
ObjectSchema["Type"]
|
|
438
|
+
LanguageModel.ExtractObjectValue<Options, ObjectSchema["Type"]>,
|
|
433
439
|
LanguageModel.ExtractToolParametersMode<Options>
|
|
434
440
|
>,
|
|
435
441
|
LanguageModel.ExtractError<Options>,
|
package/src/ai/LanguageModel.ts
CHANGED
|
@@ -161,14 +161,24 @@ export interface LanguageModel {
|
|
|
161
161
|
ObjectEncoded extends Record<string, any>,
|
|
162
162
|
StructuredOutputSchema extends Schema.Encoder<ObjectEncoded, unknown>,
|
|
163
163
|
Options extends NoExcessProperties<
|
|
164
|
-
GenerateObjectOptions<any, StructuredOutputSchema>,
|
|
164
|
+
GenerateObjectOptions<any, StructuredOutputSchema, boolean>,
|
|
165
165
|
Options
|
|
166
166
|
>,
|
|
167
167
|
Tools extends Record<string, Tool.Any> = {}
|
|
168
168
|
>(
|
|
169
|
-
options:
|
|
169
|
+
options:
|
|
170
|
+
& Options
|
|
171
|
+
& GenerateObjectOptions<
|
|
172
|
+
Tools,
|
|
173
|
+
StructuredOutputSchema,
|
|
174
|
+
false | Extract<Options["allowEmpty" & keyof Options], boolean>
|
|
175
|
+
>
|
|
170
176
|
) => Effect.Effect<
|
|
171
|
-
GenerateObjectResponse<
|
|
177
|
+
GenerateObjectResponse<
|
|
178
|
+
Tools,
|
|
179
|
+
ExtractObjectValue<Options, StructuredOutputSchema["Type"]>,
|
|
180
|
+
ExtractToolParametersMode<Options>
|
|
181
|
+
>,
|
|
172
182
|
ExtractError<Options>,
|
|
173
183
|
ExtractServices<Options> | StructuredOutputSchema["DecodingServices"]
|
|
174
184
|
>
|
|
@@ -343,7 +353,8 @@ type GenerateTextOptionsWithoutToolkit = Omit<GenerateTextOptions<{}>, "toolkit"
|
|
|
343
353
|
*/
|
|
344
354
|
export interface GenerateObjectOptions<
|
|
345
355
|
Tools extends Record<string, Tool.Any>,
|
|
346
|
-
StructuredOutputSchema extends Schema.Top
|
|
356
|
+
StructuredOutputSchema extends Schema.Top,
|
|
357
|
+
AllowEmpty extends boolean = false
|
|
347
358
|
> extends GenerateTextOptions<Tools> {
|
|
348
359
|
/**
|
|
349
360
|
* The name of the structured output that should be generated. Used by some
|
|
@@ -351,6 +362,14 @@ export interface GenerateObjectOptions<
|
|
|
351
362
|
*/
|
|
352
363
|
readonly objectName?: string | undefined
|
|
353
364
|
|
|
365
|
+
/**
|
|
366
|
+
* Whether to return `None` for empty or whitespace-only text and `Some` for
|
|
367
|
+
* valid output. Defaults to `false`; invalid nonempty output still fails.
|
|
368
|
+
* Use literal `true` for an `Option<A>` value; a widened boolean yields
|
|
369
|
+
* `A | Option<A>`.
|
|
370
|
+
*/
|
|
371
|
+
readonly allowEmpty?: AllowEmpty | undefined
|
|
372
|
+
|
|
354
373
|
/**
|
|
355
374
|
* The schema to be used to specify the structure of the object to generate.
|
|
356
375
|
*/
|
|
@@ -523,7 +542,7 @@ export class GenerateObjectResponse<
|
|
|
523
542
|
ParametersMode extends Response.ToolParametersMode = "decoded"
|
|
524
543
|
> extends GenerateTextResponse<Tools, ParametersMode> {
|
|
525
544
|
/**
|
|
526
|
-
* The
|
|
545
|
+
* The decoded schema value, wrapped in an `Option` when `allowEmpty` is enabled.
|
|
527
546
|
*/
|
|
528
547
|
readonly value: A
|
|
529
548
|
|
|
@@ -604,6 +623,18 @@ export type ExtractTools<Options> = Options extends {
|
|
|
604
623
|
} ? ExtractToolsFromToolkitOption<Exclude<ToolkitValue, undefined>>
|
|
605
624
|
: {}
|
|
606
625
|
|
|
626
|
+
/**
|
|
627
|
+
* Resolves to `Option<A>` when `allowEmpty` is true, `A` when false or absent,
|
|
628
|
+
* or their union when the flag may be enabled.
|
|
629
|
+
*
|
|
630
|
+
* @stability unstable
|
|
631
|
+
* @category utility types
|
|
632
|
+
* @since 4.1.4
|
|
633
|
+
*/
|
|
634
|
+
export type ExtractObjectValue<Options, A> = Options extends { readonly allowEmpty: true } ? Option.Option<A>
|
|
635
|
+
: true extends Options["allowEmpty" & keyof Options] ? A | Option.Option<A>
|
|
636
|
+
: A
|
|
637
|
+
|
|
607
638
|
/**
|
|
608
639
|
* Resolves to `"deferred"` when tool call resolution may be disabled with
|
|
609
640
|
* deferred tool call validation. Otherwise resolves to `"encoded"` when tool
|
|
@@ -953,14 +984,24 @@ export const make: (params: {
|
|
|
953
984
|
ObjectEncoded extends Record<string, any>,
|
|
954
985
|
StructuredOutputSchema extends Schema.Encoder<ObjectEncoded, unknown>,
|
|
955
986
|
Options extends NoExcessProperties<
|
|
956
|
-
GenerateObjectOptions<any, StructuredOutputSchema>,
|
|
987
|
+
GenerateObjectOptions<any, StructuredOutputSchema, boolean>,
|
|
957
988
|
Options
|
|
958
989
|
>,
|
|
959
990
|
Tools extends Record<string, Tool.Any> = {}
|
|
960
991
|
>(
|
|
961
|
-
options:
|
|
992
|
+
options:
|
|
993
|
+
& Options
|
|
994
|
+
& GenerateObjectOptions<
|
|
995
|
+
Tools,
|
|
996
|
+
StructuredOutputSchema,
|
|
997
|
+
false | Extract<Options["allowEmpty" & keyof Options], boolean>
|
|
998
|
+
>
|
|
962
999
|
): Effect.Effect<
|
|
963
|
-
GenerateObjectResponse<
|
|
1000
|
+
GenerateObjectResponse<
|
|
1001
|
+
Tools,
|
|
1002
|
+
ExtractObjectValue<Options, StructuredOutputSchema["Type"]>,
|
|
1003
|
+
ExtractToolParametersMode<Options>
|
|
1004
|
+
>,
|
|
964
1005
|
ExtractError<Options>,
|
|
965
1006
|
ExtractServices<Options> | StructuredOutputSchema["DecodingServices"]
|
|
966
1007
|
> => {
|
|
@@ -1009,7 +1050,7 @@ export const make: (params: {
|
|
|
1009
1050
|
})
|
|
1010
1051
|
})
|
|
1011
1052
|
|
|
1012
|
-
const value = yield* resolveStructuredOutput(content as any, codec)
|
|
1053
|
+
const value = yield* resolveStructuredOutput(content as any, codec, options.allowEmpty ?? false)
|
|
1013
1054
|
|
|
1014
1055
|
return new GenerateObjectResponse(value, content)
|
|
1015
1056
|
},
|
|
@@ -1611,7 +1652,8 @@ export const make: (params: {
|
|
|
1611
1652
|
}) :
|
|
1612
1653
|
identity
|
|
1613
1654
|
)
|
|
1614
|
-
)
|
|
1655
|
+
),
|
|
1656
|
+
Stream.prepend(preResolvedStreamParts)
|
|
1615
1657
|
) as Stream.Stream<
|
|
1616
1658
|
Response.StreamPart<Tools>,
|
|
1617
1659
|
AiError.AiError | Schema.SchemaError,
|
|
@@ -1948,15 +1990,21 @@ export const generateObject = <
|
|
|
1948
1990
|
ObjectEncoded extends Record<string, any>,
|
|
1949
1991
|
StructuredOutputSchema extends Schema.Encoder<ObjectEncoded, unknown>,
|
|
1950
1992
|
Options extends NoExcessProperties<
|
|
1951
|
-
GenerateObjectOptions<any, StructuredOutputSchema>,
|
|
1993
|
+
GenerateObjectOptions<any, StructuredOutputSchema, boolean>,
|
|
1952
1994
|
Options
|
|
1953
1995
|
>
|
|
1954
1996
|
>(
|
|
1955
|
-
options:
|
|
1997
|
+
options:
|
|
1998
|
+
& Options
|
|
1999
|
+
& GenerateObjectOptions<
|
|
2000
|
+
ExtractTools<Options>,
|
|
2001
|
+
StructuredOutputSchema,
|
|
2002
|
+
false | Extract<Options["allowEmpty" & keyof Options], boolean>
|
|
2003
|
+
>
|
|
1956
2004
|
): Effect.Effect<
|
|
1957
2005
|
GenerateObjectResponse<
|
|
1958
2006
|
ExtractTools<Options>,
|
|
1959
|
-
StructuredOutputSchema["Type"]
|
|
2007
|
+
ExtractObjectValue<Options, StructuredOutputSchema["Type"]>,
|
|
1960
2008
|
ExtractToolParametersMode<Options>
|
|
1961
2009
|
>,
|
|
1962
2010
|
ExtractError<Options>,
|
|
@@ -2609,7 +2657,11 @@ export const getObjectName = <StructuredOutputSchema extends Schema.Constraint>(
|
|
|
2609
2657
|
|
|
2610
2658
|
const resolveStructuredOutput = Effect.fnUntraced(function*<
|
|
2611
2659
|
StructuredOutputSchema extends Schema.Constraint
|
|
2612
|
-
>(
|
|
2660
|
+
>(
|
|
2661
|
+
response: ReadonlyArray<Response.AllParts<any>>,
|
|
2662
|
+
schema: StructuredOutputSchema,
|
|
2663
|
+
allowEmpty: boolean
|
|
2664
|
+
) {
|
|
2613
2665
|
const texts: Array<string> = []
|
|
2614
2666
|
for (const part of response) {
|
|
2615
2667
|
if (part.type === "text") {
|
|
@@ -2619,6 +2671,10 @@ const resolveStructuredOutput = Effect.fnUntraced(function*<
|
|
|
2619
2671
|
|
|
2620
2672
|
const text = texts.join("")
|
|
2621
2673
|
|
|
2674
|
+
if (allowEmpty && text.trim().length === 0) {
|
|
2675
|
+
return Option.none()
|
|
2676
|
+
}
|
|
2677
|
+
|
|
2622
2678
|
if (text.length === 0) {
|
|
2623
2679
|
return yield* AiError.make({
|
|
2624
2680
|
module: "LanguageModel",
|
|
@@ -2631,12 +2687,13 @@ const resolveStructuredOutput = Effect.fnUntraced(function*<
|
|
|
2631
2687
|
}
|
|
2632
2688
|
|
|
2633
2689
|
const decode = Schema.decodeEffect(Schema.fromJsonString(schema))
|
|
2634
|
-
|
|
2690
|
+
const value = yield* Effect.mapError(decode(text), (error) =>
|
|
2635
2691
|
AiError.make({
|
|
2636
2692
|
module: "LanguageModel",
|
|
2637
2693
|
method: "generateObject",
|
|
2638
2694
|
reason: AiError.StructuredOutputError.fromSchemaError(error, text)
|
|
2639
2695
|
}))
|
|
2696
|
+
return allowEmpty ? Option.some(value) : value
|
|
2640
2697
|
})
|
|
2641
2698
|
|
|
2642
2699
|
const applySpanTransformer = (
|
package/src/ai/McpClient.ts
CHANGED
|
@@ -259,11 +259,6 @@ export const isMcpClient = (value: unknown): value is McpClient => Predicate.has
|
|
|
259
259
|
* `crypto.subtle`.
|
|
260
260
|
* Schema decoding requires the schema's services from the caller.
|
|
261
261
|
*
|
|
262
|
-
* **Gotchas**
|
|
263
|
-
*
|
|
264
|
-
* The Skills extension requires protocol 2026-07-28. With `skills: true` on an
|
|
265
|
-
* earlier protocol, construction fails with an `UnsupportedError`.
|
|
266
|
-
*
|
|
267
262
|
* @stability experimental
|
|
268
263
|
* @category constructors
|
|
269
264
|
* @since 4.0.6
|
|
@@ -296,12 +291,6 @@ export const make: (options: {
|
|
|
296
291
|
const protocol = transport.protocol
|
|
297
292
|
const version = protocol.protocolVersion
|
|
298
293
|
const modern = version === "2026-07-28"
|
|
299
|
-
const skillsEnabled = options.extensions?.skills === true
|
|
300
|
-
if (skillsEnabled && !modern) {
|
|
301
|
-
return yield* fail(
|
|
302
|
-
new UnsupportedError({ description: "The MCP Skills extension requires at least protocol 2026-07-28" })
|
|
303
|
-
)
|
|
304
|
-
}
|
|
305
294
|
const timeout = options.timeout ?? DEFAULT_TIMEOUT
|
|
306
295
|
const discoveryLimits = yield* resolveDiscoveryLimits(options.discoveryLimits, DEFAULT_DISCOVERY_LIMITS)
|
|
307
296
|
const closed = yield* Deferred.make<never, McpClientError>()
|
|
@@ -321,6 +310,7 @@ export const make: (options: {
|
|
|
321
310
|
|
|
322
311
|
// Modern requests carry the client identity in every request.
|
|
323
312
|
// https://modelcontextprotocol.io/specification/2026-07-28/basic/index
|
|
313
|
+
const skillsEnabled = options.extensions?.skills === true
|
|
324
314
|
const clientCapabilities = skillsEnabled ? { extensions: { [McpSkills.EXTENSION_ID]: {} } } : {}
|
|
325
315
|
const meta = {
|
|
326
316
|
"io.modelcontextprotocol/protocolVersion": version,
|