effect 4.1.5 → 4.1.7
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/ai-docs/package.json +2 -2
- package/dist/Channel.d.ts +104 -7
- package/dist/Channel.d.ts.map +1 -1
- package/dist/Channel.js +73 -4
- package/dist/Channel.js.map +1 -1
- package/dist/Codegen.d.ts +7 -2
- package/dist/Codegen.d.ts.map +1 -1
- package/dist/Codegen.js +7 -2
- package/dist/Codegen.js.map +1 -1
- package/dist/Config.d.ts +1 -1
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +5 -3
- package/dist/Config.js.map +1 -1
- package/dist/Context.d.ts.map +1 -1
- package/dist/Context.js +79 -31
- package/dist/Context.js.map +1 -1
- package/dist/Cron.d.ts.map +1 -1
- package/dist/Cron.js +10 -9
- package/dist/Cron.js.map +1 -1
- package/dist/Effect.d.ts +139 -18
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +10 -2
- package/dist/Effect.js.map +1 -1
- package/dist/Equal.d.ts +4 -4
- package/dist/Equal.d.ts.map +1 -1
- package/dist/Equal.js +78 -66
- package/dist/Equal.js.map +1 -1
- package/dist/Formatter.js +4 -4
- package/dist/Formatter.js.map +1 -1
- package/dist/Hash.d.ts.map +1 -1
- package/dist/Hash.js +34 -41
- package/dist/Hash.js.map +1 -1
- package/dist/LayerRef.d.ts +1 -1
- package/dist/LayerRef.d.ts.map +1 -1
- package/dist/LayerRef.js +3 -3
- package/dist/LayerRef.js.map +1 -1
- package/dist/Logger.d.ts +37 -13
- package/dist/Logger.d.ts.map +1 -1
- package/dist/Logger.js +39 -10
- package/dist/Logger.js.map +1 -1
- package/dist/Match.d.ts +23 -23
- package/dist/Match.d.ts.map +1 -1
- package/dist/Match.js.map +1 -1
- package/dist/Metric.d.ts.map +1 -1
- package/dist/Metric.js +3 -4
- package/dist/Metric.js.map +1 -1
- package/dist/Order.js +1 -1
- package/dist/Order.js.map +1 -1
- package/dist/Pool.d.ts.map +1 -1
- package/dist/Pool.js +49 -21
- package/dist/Pool.js.map +1 -1
- package/dist/Predicate.d.ts.map +1 -1
- package/dist/Predicate.js +2 -1
- package/dist/Predicate.js.map +1 -1
- package/dist/Scheduler.d.ts.map +1 -1
- package/dist/Scheduler.js +15 -9
- package/dist/Scheduler.js.map +1 -1
- package/dist/Schema.d.ts +41 -0
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +51 -390
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +2 -2
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +199 -98
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaParser.d.ts.map +1 -1
- package/dist/SchemaParser.js +29 -50
- package/dist/SchemaParser.js.map +1 -1
- package/dist/ScopedCache.d.ts.map +1 -1
- package/dist/ScopedCache.js +6 -4
- package/dist/ScopedCache.js.map +1 -1
- package/dist/Stream.d.ts +128 -5
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +124 -29
- package/dist/Stream.js.map +1 -1
- package/dist/String.js +1 -1
- package/dist/String.js.map +1 -1
- package/dist/Tracer.d.ts +10 -0
- package/dist/Tracer.d.ts.map +1 -1
- package/dist/Tracer.js +3 -4
- package/dist/Tracer.js.map +1 -1
- package/dist/ai/McpClient.d.ts +68 -4
- package/dist/ai/McpClient.d.ts.map +1 -1
- package/dist/ai/McpClient.js +100 -17
- package/dist/ai/McpClient.js.map +1 -1
- package/dist/ai/McpClientError.d.ts +46 -4
- package/dist/ai/McpClientError.d.ts.map +1 -1
- package/dist/ai/McpClientError.js +38 -3
- package/dist/ai/McpClientError.js.map +1 -1
- package/dist/ai/McpServer.d.ts +158 -7
- package/dist/ai/McpServer.d.ts.map +1 -1
- package/dist/ai/McpServer.js +103 -49
- package/dist/ai/McpServer.js.map +1 -1
- package/dist/ai/Prompt.d.ts +3 -1
- package/dist/ai/Prompt.d.ts.map +1 -1
- package/dist/ai/Prompt.js +17 -3
- package/dist/ai/Prompt.js.map +1 -1
- package/dist/ai/Skill.d.ts +172 -0
- package/dist/ai/Skill.d.ts.map +1 -0
- package/dist/ai/Skill.js +209 -0
- package/dist/ai/Skill.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 +9 -7
- package/dist/ai/internal/mcpProtocol/v2024_11_05.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2025_03_26.js +12 -11
- package/dist/ai/internal/mcpProtocol/v2025_03_26.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2025_06_18.js +18 -17
- package/dist/ai/internal/mcpProtocol/v2025_06_18.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2025_11_25.js +19 -18
- package/dist/ai/internal/mcpProtocol/v2025_11_25.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2026_07_28.js +1 -1
- package/dist/ai/internal/mcpProtocol/v2026_07_28.js.map +1 -1
- package/dist/ai/internal/mcpProtocol.js +11 -0
- package/dist/ai/internal/mcpProtocol.js.map +1 -1
- package/dist/ai/internal/mcpRuntime.js +29 -17
- package/dist/ai/internal/mcpRuntime.js.map +1 -1
- package/dist/ai/internal/mcpSchema/v2024_11_05.js +2 -1
- package/dist/ai/internal/mcpSchema/v2024_11_05.js.map +1 -1
- package/dist/ai/internal/mcpSchema/v2025_03_26.js +1 -8
- package/dist/ai/internal/mcpSchema/v2025_03_26.js.map +1 -1
- package/dist/ai/internal/mcpSchema/v2025_06_18.js +5 -9
- package/dist/ai/internal/mcpSchema/v2025_06_18.js.map +1 -1
- package/dist/ai/internal/mcpSchema/v2025_11_25.js +1 -8
- package/dist/ai/internal/mcpSchema/v2025_11_25.js.map +1 -1
- package/dist/ai/internal/mcpSchema/v2026_07_28.js +4 -3
- package/dist/ai/internal/mcpSchema/v2026_07_28.js.map +1 -1
- package/dist/cluster/ClusterCron.d.ts +5 -20
- package/dist/cluster/ClusterCron.d.ts.map +1 -1
- package/dist/cluster/ClusterCron.js +16 -4
- package/dist/cluster/ClusterCron.js.map +1 -1
- package/dist/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
- package/dist/cluster/ClusterWorkflowEngine.js +155 -83
- package/dist/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/cluster/MessageStorage.d.ts +56 -0
- package/dist/cluster/MessageStorage.d.ts.map +1 -1
- package/dist/cluster/MessageStorage.js +18 -2
- package/dist/cluster/MessageStorage.js.map +1 -1
- package/dist/cluster/SqlMessageStorage.d.ts.map +1 -1
- package/dist/cluster/SqlMessageStorage.js +48 -23
- package/dist/cluster/SqlMessageStorage.js.map +1 -1
- package/dist/cluster/internal/entityActivation.js +2 -0
- package/dist/cluster/internal/entityActivation.js.map +1 -1
- package/dist/cluster/internal/entityManager.js +8 -5
- package/dist/cluster/internal/entityManager.js.map +1 -1
- package/dist/encoding/Base64.js +5 -1
- package/dist/encoding/Base64.js.map +1 -1
- package/dist/encoding/Base64Url.d.ts.map +1 -1
- package/dist/encoding/Base64Url.js +6 -1
- package/dist/encoding/Base64Url.js.map +1 -1
- package/dist/encoding/Hex.js +7 -5
- package/dist/encoding/Hex.js.map +1 -1
- package/dist/encoding/Xml.d.ts +38 -9
- package/dist/encoding/Xml.d.ts.map +1 -1
- package/dist/encoding/Xml.js +63 -31
- package/dist/encoding/Xml.js.map +1 -1
- package/dist/http/FetchHttpClient.d.ts +2 -1
- package/dist/http/FetchHttpClient.d.ts.map +1 -1
- package/dist/http/FetchHttpClient.js +14 -10
- package/dist/http/FetchHttpClient.js.map +1 -1
- package/dist/http/Headers.d.ts +201 -3
- package/dist/http/Headers.d.ts.map +1 -1
- package/dist/http/Headers.js +205 -3
- package/dist/http/Headers.js.map +1 -1
- package/dist/http/HttpClient.d.ts.map +1 -1
- package/dist/http/HttpClient.js +11 -7
- package/dist/http/HttpClient.js.map +1 -1
- package/dist/http/HttpClientError.d.ts +1 -0
- package/dist/http/HttpClientError.d.ts.map +1 -1
- package/dist/http/HttpClientError.js +32 -9
- package/dist/http/HttpClientError.js.map +1 -1
- package/dist/http/HttpClientRequest.d.ts +46 -0
- package/dist/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/http/HttpClientRequest.js +15 -0
- package/dist/http/HttpClientRequest.js.map +1 -1
- package/dist/http/HttpClientResponse.d.ts +132 -0
- package/dist/http/HttpClientResponse.d.ts.map +1 -1
- package/dist/http/HttpClientResponse.js +83 -0
- package/dist/http/HttpClientResponse.js.map +1 -1
- package/dist/http/HttpEffect.d.ts.map +1 -1
- package/dist/http/HttpEffect.js +31 -2
- package/dist/http/HttpEffect.js.map +1 -1
- package/dist/http/HttpMiddleware.js +1 -1
- package/dist/http/HttpMiddleware.js.map +1 -1
- package/dist/http/HttpServerError.d.ts +1 -1
- package/dist/http/HttpServerError.js +1 -1
- package/dist/http/HttpServerResponse.d.ts +118 -0
- package/dist/http/HttpServerResponse.d.ts.map +1 -1
- package/dist/http/HttpServerResponse.js +43 -0
- package/dist/http/HttpServerResponse.js.map +1 -1
- package/dist/http/Multipart.d.ts.map +1 -1
- package/dist/http/Multipart.js +0 -5
- package/dist/http/Multipart.js.map +1 -1
- package/dist/http/MultipartParser/internal/contentType.d.ts +6 -0
- package/dist/http/MultipartParser/internal/contentType.d.ts.map +1 -1
- package/dist/http/MultipartParser/internal/contentType.js +1 -1
- package/dist/http/MultipartParser/internal/contentType.js.map +1 -1
- package/dist/http/internal/clientPath.d.ts +2 -0
- package/dist/http/internal/clientPath.d.ts.map +1 -0
- package/dist/http/internal/clientPath.js +24 -0
- package/dist/http/internal/clientPath.js.map +1 -0
- package/dist/http/internal/redactedPath.js +2 -0
- package/dist/http/internal/redactedPath.js.map +1 -1
- package/dist/http/internal/tracing.js +5 -3
- package/dist/http/internal/tracing.js.map +1 -1
- package/dist/http-api/HttpApi.d.ts +2 -2
- package/dist/http-api/HttpApi.d.ts.map +1 -1
- package/dist/http-api/HttpApi.js +30 -7
- 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 +5 -2
- package/dist/http-api/HttpApiBuilder.js.map +1 -1
- package/dist/http-api/HttpApiClient.d.ts.map +1 -1
- package/dist/http-api/HttpApiClient.js +23 -6
- package/dist/http-api/HttpApiClient.js.map +1 -1
- package/dist/http-api/internal/redactedKeys.d.ts +2 -0
- package/dist/http-api/internal/redactedKeys.d.ts.map +1 -0
- package/dist/http-api/internal/redactedKeys.js +37 -0
- package/dist/http-api/internal/redactedKeys.js.map +1 -0
- package/dist/internal/base64.js +34 -2
- package/dist/internal/base64.js.map +1 -1
- package/dist/internal/core.js +60 -43
- package/dist/internal/core.js.map +1 -1
- package/dist/internal/dateTime.js +35 -17
- package/dist/internal/dateTime.js.map +1 -1
- package/dist/internal/effect.js +60 -52
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/equal.js +44 -13
- package/dist/internal/equal.js.map +1 -1
- package/dist/internal/fiberCachedKeys.d.ts +2 -0
- package/dist/internal/fiberCachedKeys.d.ts.map +1 -0
- package/dist/internal/fiberCachedKeys.js +48 -0
- package/dist/internal/fiberCachedKeys.js.map +1 -0
- package/dist/internal/hashMap.js +1 -1
- package/dist/internal/hashMap.js.map +1 -1
- package/dist/internal/matcher.js +17 -17
- package/dist/internal/matcher.js.map +1 -1
- package/dist/internal/predicate.d.ts +2 -0
- package/dist/internal/predicate.d.ts.map +1 -0
- package/dist/internal/predicate.js +10 -0
- package/dist/internal/predicate.js.map +1 -0
- package/dist/internal/references.js +8 -11
- package/dist/internal/references.js.map +1 -1
- package/dist/internal/schema/schemaCodegen.js +3 -2
- package/dist/internal/schema/schemaCodegen.js.map +1 -1
- package/dist/internal/schema/schemaCodegenBuiltIns.d.ts +2 -0
- package/dist/internal/schema/schemaCodegenBuiltIns.d.ts.map +1 -0
- package/dist/internal/schema/schemaCodegenBuiltIns.js +425 -0
- package/dist/internal/schema/schemaCodegenBuiltIns.js.map +1 -0
- package/dist/internal/schema/toEquivalence.js +3 -4
- package/dist/internal/schema/toEquivalence.js.map +1 -1
- package/dist/internal/version.js +1 -1
- package/dist/jose/JoseError.d.ts +51 -1
- package/dist/jose/JoseError.d.ts.map +1 -1
- package/dist/jose/JoseError.js +25 -18
- package/dist/jose/JoseError.js.map +1 -1
- package/dist/jose/internal/compact.js +10 -5
- package/dist/jose/internal/compact.js.map +1 -1
- package/dist/observability/Otlp.d.ts +19 -0
- package/dist/observability/Otlp.d.ts.map +1 -1
- package/dist/observability/Otlp.js +10 -0
- package/dist/observability/Otlp.js.map +1 -1
- package/dist/observability/OtlpExporter.d.ts +49 -13
- package/dist/observability/OtlpExporter.d.ts.map +1 -1
- package/dist/observability/OtlpExporter.js +135 -54
- package/dist/observability/OtlpExporter.js.map +1 -1
- package/dist/observability/OtlpLogger.d.ts +14 -0
- package/dist/observability/OtlpLogger.d.ts.map +1 -1
- package/dist/observability/OtlpLogger.js +10 -2
- package/dist/observability/OtlpLogger.js.map +1 -1
- package/dist/observability/OtlpMetrics.d.ts.map +1 -1
- package/dist/observability/OtlpMetrics.js +2 -0
- package/dist/observability/OtlpMetrics.js.map +1 -1
- package/dist/observability/OtlpTracer.d.ts +14 -0
- package/dist/observability/OtlpTracer.d.ts.map +1 -1
- package/dist/observability/OtlpTracer.js +10 -2
- package/dist/observability/OtlpTracer.js.map +1 -1
- package/dist/persistence/KeyValueStore.d.ts.map +1 -1
- package/dist/persistence/KeyValueStore.js +6 -4
- package/dist/persistence/KeyValueStore.js.map +1 -1
- package/dist/reactivity/Atom.d.ts.map +1 -1
- package/dist/reactivity/Atom.js +10 -9
- package/dist/reactivity/Atom.js.map +1 -1
- package/dist/rpc/RpcClient.d.ts.map +1 -1
- package/dist/rpc/RpcClient.js +32 -1
- package/dist/rpc/RpcClient.js.map +1 -1
- package/dist/rpc/RpcGroup.d.ts +1 -1
- package/dist/rpc/RpcGroup.d.ts.map +1 -1
- package/dist/rpc/RpcGroup.js +4 -0
- package/dist/rpc/RpcGroup.js.map +1 -1
- package/dist/sql/Migrator.d.ts.map +1 -1
- package/dist/sql/Migrator.js +2 -5
- package/dist/sql/Migrator.js.map +1 -1
- package/dist/sql/SqlClient.d.ts.map +1 -1
- package/dist/sql/SqlClient.js +5 -1
- package/dist/sql/SqlClient.js.map +1 -1
- package/dist/sql/Statement.d.ts +23 -0
- package/dist/sql/Statement.d.ts.map +1 -1
- package/dist/sql/Statement.js +30 -5
- package/dist/sql/Statement.js.map +1 -1
- package/dist/workers/Worker.d.ts +21 -0
- package/dist/workers/Worker.d.ts.map +1 -1
- package/dist/workers/Worker.js +23 -0
- package/dist/workers/Worker.js.map +1 -1
- package/dist/workflow/Activity.d.ts +18 -0
- package/dist/workflow/Activity.d.ts.map +1 -1
- package/dist/workflow/Activity.js +13 -4
- package/dist/workflow/Activity.js.map +1 -1
- package/dist/workflow/Workflow.d.ts +10 -9
- package/dist/workflow/Workflow.d.ts.map +1 -1
- package/dist/workflow/Workflow.js +33 -22
- package/dist/workflow/Workflow.js.map +1 -1
- package/dist/workflow/WorkflowEngine.d.ts.map +1 -1
- package/dist/workflow/WorkflowEngine.js +26 -12
- package/dist/workflow/WorkflowEngine.js.map +1 -1
- package/dist/workflow/internal/retry.d.ts +2 -0
- package/dist/workflow/internal/retry.d.ts.map +1 -0
- package/dist/workflow/internal/retry.js +11 -0
- package/dist/workflow/internal/retry.js.map +1 -0
- package/dist/workflow/internal/scope.d.ts +2 -0
- package/dist/workflow/internal/scope.d.ts.map +1 -0
- package/dist/workflow/internal/scope.js +26 -0
- package/dist/workflow/internal/scope.js.map +1 -0
- package/package.json +3 -3
- package/src/Channel.ts +105 -8
- package/src/Codegen.ts +7 -2
- package/src/Config.ts +6 -3
- package/src/Context.ts +108 -50
- package/src/Cron.ts +11 -10
- package/src/Effect.ts +224 -48
- package/src/Equal.ts +93 -80
- package/src/Formatter.ts +4 -4
- package/src/Hash.ts +49 -48
- package/src/LayerRef.ts +6 -4
- package/src/Logger.ts +68 -25
- package/src/Match.ts +78 -50
- package/src/Metric.ts +4 -4
- package/src/Order.ts +1 -1
- package/src/Pool.ts +62 -33
- package/src/Predicate.ts +2 -5
- package/src/Scheduler.ts +27 -10
- package/src/Schema.ts +79 -296
- package/src/SchemaAST.ts +231 -157
- package/src/SchemaParser.ts +40 -57
- package/src/ScopedCache.ts +6 -4
- package/src/Stream.ts +167 -33
- package/src/String.ts +1 -1
- package/src/Tracer.ts +11 -2
- package/src/ai/McpClient.ts +157 -15
- package/src/ai/McpClientError.ts +55 -4
- package/src/ai/McpServer.ts +318 -91
- package/src/ai/Prompt.ts +20 -3
- package/src/ai/Skill.ts +236 -0
- package/src/ai/index.ts +6 -0
- package/src/ai/internal/mcpProtocol/v2024_11_05.ts +8 -13
- package/src/ai/internal/mcpProtocol/v2025_03_26.ts +13 -15
- package/src/ai/internal/mcpProtocol/v2025_06_18.ts +21 -23
- package/src/ai/internal/mcpProtocol/v2025_11_25.ts +22 -24
- package/src/ai/internal/mcpProtocol/v2026_07_28.ts +1 -1
- package/src/ai/internal/mcpProtocol.ts +15 -0
- package/src/ai/internal/mcpRuntime.ts +36 -13
- package/src/ai/internal/mcpSchema/v2024_11_05.ts +2 -1
- package/src/ai/internal/mcpSchema/v2025_03_26.ts +1 -9
- package/src/ai/internal/mcpSchema/v2025_06_18.ts +3 -10
- package/src/ai/internal/mcpSchema/v2025_11_25.ts +1 -9
- package/src/ai/internal/mcpSchema/v2026_07_28.ts +6 -8
- package/src/cluster/ClusterCron.ts +31 -20
- package/src/cluster/ClusterWorkflowEngine.ts +172 -96
- package/src/cluster/MessageStorage.ts +51 -2
- package/src/cluster/SqlMessageStorage.ts +88 -36
- package/src/cluster/internal/entityActivation.ts +6 -0
- package/src/cluster/internal/entityManager.ts +8 -4
- package/src/encoding/Base64.ts +5 -1
- package/src/encoding/Base64Url.ts +6 -1
- package/src/encoding/Hex.ts +5 -5
- package/src/encoding/Xml.ts +96 -26
- package/src/http/FetchHttpClient.ts +8 -5
- package/src/http/Headers.ts +309 -3
- package/src/http/HttpClient.ts +19 -7
- package/src/http/HttpClientError.ts +42 -9
- package/src/http/HttpClientRequest.ts +51 -0
- package/src/http/HttpClientResponse.ts +156 -0
- package/src/http/HttpEffect.ts +23 -3
- package/src/http/HttpMiddleware.ts +1 -1
- package/src/http/HttpServerError.ts +1 -1
- package/src/http/HttpServerResponse.ts +126 -0
- package/src/http/Multipart.ts +0 -5
- package/src/http/MultipartParser/internal/contentType.ts +1 -1
- package/src/http/internal/clientPath.ts +39 -0
- package/src/http/internal/redactedPath.ts +4 -0
- package/src/http/internal/tracing.ts +6 -3
- package/src/http-api/HttpApi.ts +29 -8
- package/src/http-api/HttpApiBuilder.ts +7 -2
- package/src/http-api/HttpApiClient.ts +30 -7
- package/src/http-api/internal/redactedKeys.ts +40 -0
- package/src/internal/base64.ts +57 -2
- package/src/internal/core.ts +80 -44
- package/src/internal/dateTime.ts +43 -24
- package/src/internal/effect.ts +115 -157
- package/src/internal/equal.ts +73 -17
- package/src/internal/fiberCachedKeys.ts +81 -0
- package/src/internal/hashMap.ts +1 -1
- package/src/internal/matcher.ts +34 -113
- package/src/internal/predicate.ts +10 -0
- package/src/internal/references.ts +21 -14
- package/src/internal/schema/schemaCodegen.ts +5 -4
- package/src/internal/schema/schemaCodegenBuiltIns.ts +343 -0
- package/src/internal/schema/toEquivalence.ts +3 -5
- package/src/internal/version.ts +1 -1
- package/src/jose/JoseError.ts +34 -0
- package/src/jose/internal/compact.ts +14 -5
- package/src/observability/Otlp.ts +29 -0
- package/src/observability/OtlpExporter.ts +206 -75
- package/src/observability/OtlpLogger.ts +24 -2
- package/src/observability/OtlpMetrics.ts +2 -0
- package/src/observability/OtlpTracer.ts +24 -3
- package/src/persistence/KeyValueStore.ts +17 -14
- package/src/reactivity/Atom.ts +12 -18
- package/src/rpc/RpcClient.ts +26 -1
- package/src/rpc/RpcGroup.ts +4 -1
- package/src/sql/Migrator.ts +2 -11
- package/src/sql/SqlClient.ts +14 -8
- package/src/sql/Statement.ts +48 -12
- package/src/workers/Worker.ts +25 -0
- package/src/workflow/Activity.ts +28 -4
- package/src/workflow/Workflow.ts +68 -44
- package/src/workflow/WorkflowEngine.ts +38 -15
- package/src/workflow/internal/retry.ts +12 -0
- package/src/workflow/internal/scope.ts +36 -0
- package/dist/internal/hash.d.ts +0 -2
- package/dist/internal/hash.d.ts.map +0 -1
- package/dist/internal/hash.js +0 -11
- package/dist/internal/hash.js.map +0 -1
- package/dist/internal/metric.d.ts +0 -2
- package/dist/internal/metric.d.ts.map +0 -1
- package/dist/internal/metric.js +0 -3
- package/dist/internal/metric.js.map +0 -1
- package/src/internal/hash.ts +0 -11
- package/src/internal/metric.ts +0 -2
package/dist/ai/McpServer.js
CHANGED
|
@@ -59,6 +59,7 @@ import * as InternalStructuredOutput from "./internal/structured-output.js";
|
|
|
59
59
|
import * as McpSchema from "./McpSchema.js";
|
|
60
60
|
import { CallToolResult, ElicitationDeclined, EnabledWhen, GetPromptResult, InternalError, InvalidParams, InvalidRequest, isParam, McpRequestContext, McpServerClient, McpServerClientMiddleware, MethodNotFound, Prompt, Resource, ResourceTemplate, ServerNotificationRpcs, TextContent, Tool as McpTool, ToolJson } from "./McpSchema.js";
|
|
61
61
|
import * as AiPrompt from "./Prompt.js";
|
|
62
|
+
import * as Skill from "./Skill.js";
|
|
62
63
|
import * as Tool from "./Tool.js";
|
|
63
64
|
import * as Toolkit from "./Toolkit.js";
|
|
64
65
|
const internalState = /*#__PURE__*/new WeakMap();
|
|
@@ -530,6 +531,7 @@ export class McpServer extends /*#__PURE__*/Context.Service()("effect/ai/McpServ
|
|
|
530
531
|
*/
|
|
531
532
|
static make = /*#__PURE__*/Effect.gen(function* () {
|
|
532
533
|
const internalCore = yield* McpCore.make;
|
|
534
|
+
const toolIndex = new Map();
|
|
533
535
|
const tools = Arr.empty();
|
|
534
536
|
const resources = [];
|
|
535
537
|
const resourceTemplates = [];
|
|
@@ -650,10 +652,9 @@ export class McpServer extends /*#__PURE__*/Context.Service()("effect/ai/McpServ
|
|
|
650
652
|
return tools;
|
|
651
653
|
},
|
|
652
654
|
addTool: Effect.fnUntraced(function* (options) {
|
|
653
|
-
const existingIndex =
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
if (existingIndex === -1) {
|
|
655
|
+
const existingIndex = toolIndex.get(options.tool.name);
|
|
656
|
+
if (existingIndex === undefined) {
|
|
657
|
+
toolIndex.set(options.tool.name, tools.length);
|
|
657
658
|
tools.push(options);
|
|
658
659
|
} else {
|
|
659
660
|
tools[existingIndex] = options;
|
|
@@ -662,10 +663,12 @@ export class McpServer extends /*#__PURE__*/Context.Service()("effect/ai/McpServ
|
|
|
662
663
|
invoke,
|
|
663
664
|
visible
|
|
664
665
|
} = makeInvoke(options.services, globalMiddleware);
|
|
666
|
+
const title = options.tool.title ?? options.tool.annotations?.title;
|
|
665
667
|
yield* internalCore.tools.register({
|
|
666
|
-
descriptor
|
|
668
|
+
// Reuse a validated descriptor whose title is already resolved.
|
|
669
|
+
descriptor: options.tool instanceof McpTool && title === options.tool.title ? options.tool : new McpTool({
|
|
667
670
|
...options.tool,
|
|
668
|
-
title
|
|
671
|
+
title
|
|
669
672
|
}),
|
|
670
673
|
visible: visible("tools/list", options.tool.name),
|
|
671
674
|
isVisible: isEnabled(options.annotations),
|
|
@@ -918,19 +921,25 @@ const requestSpanOptions = (method, request, options) => {
|
|
|
918
921
|
case "tools/call":
|
|
919
922
|
{
|
|
920
923
|
attributes["gen_ai.operation.name"] = "execute_tool";
|
|
921
|
-
|
|
922
|
-
|
|
924
|
+
const registered = options.server.tools.find(({
|
|
925
|
+
tool
|
|
926
|
+
}) => tool.name === params?.name);
|
|
927
|
+
if (registered !== undefined) {
|
|
928
|
+
target = registered.tool.name;
|
|
923
929
|
attributes["gen_ai.tool.name"] = target;
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
930
|
+
if (options.recordToolArguments && params?.arguments !== undefined) {
|
|
931
|
+
attributes["gen_ai.tool.call.arguments"] = Toolkit.stringifyToolArguments(params.arguments);
|
|
932
|
+
}
|
|
927
933
|
}
|
|
928
934
|
break;
|
|
929
935
|
}
|
|
930
936
|
case "prompts/get":
|
|
931
937
|
{
|
|
932
|
-
|
|
933
|
-
|
|
938
|
+
const registered = options.server.prompts.find(({
|
|
939
|
+
prompt
|
|
940
|
+
}) => prompt.name === params?.name);
|
|
941
|
+
if (registered !== undefined) {
|
|
942
|
+
target = registered.prompt.name;
|
|
934
943
|
attributes["gen_ai.prompt.name"] = target;
|
|
935
944
|
}
|
|
936
945
|
break;
|
|
@@ -939,8 +948,11 @@ const requestSpanOptions = (method, request, options) => {
|
|
|
939
948
|
case "resources/subscribe":
|
|
940
949
|
case "resources/unsubscribe":
|
|
941
950
|
{
|
|
942
|
-
// Resource URIs
|
|
943
|
-
|
|
951
|
+
// Resource URIs stay out of span names; only registered static URIs are bounded enough to record.
|
|
952
|
+
const registered = options.server.resources.find(({
|
|
953
|
+
resource
|
|
954
|
+
}) => resource.uri === params?.uri);
|
|
955
|
+
if (registered !== undefined) attributes["mcp.resource.uri"] = registered.resource.uri;
|
|
944
956
|
break;
|
|
945
957
|
}
|
|
946
958
|
}
|
|
@@ -1021,11 +1033,12 @@ const normalizeCacheHints = cacheHints => {
|
|
|
1021
1033
|
*
|
|
1022
1034
|
* Each request handled by the server runs in a server span that follows the
|
|
1023
1035
|
* OpenTelemetry MCP semantic conventions. Spans are named after the JSON-RPC
|
|
1024
|
-
* method, with the tool or prompt name appended for `tools/call`
|
|
1025
|
-
* `prompts/get` (for example `tools/call get_weather`).
|
|
1026
|
-
* `
|
|
1027
|
-
*
|
|
1028
|
-
*
|
|
1036
|
+
* method, with the tool or prompt name appended for registered `tools/call`
|
|
1037
|
+
* and `prompts/get` targets (for example `tools/call get_weather`).
|
|
1038
|
+
* `mcp.resource.uri` is recorded only for registered static resources. A W3C
|
|
1039
|
+
* `traceparent` in `params._meta` becomes the span's parent, and the transport
|
|
1040
|
+
* span (such as the HTTP server span) is linked. Tool arguments are recorded
|
|
1041
|
+
* only for registered tools when `Toolkit.RecordToolArguments` is `true`.
|
|
1029
1042
|
*
|
|
1030
1043
|
* @stability unstable
|
|
1031
1044
|
* @category running
|
|
@@ -1059,7 +1072,8 @@ const runWithRuntime = /*#__PURE__*/Effect.fnUntraced(function* (options, runtim
|
|
|
1059
1072
|
protocolVersion: runtime.protocolForInternalTag(request.tag).protocolVersion,
|
|
1060
1073
|
networkTransport,
|
|
1061
1074
|
sessionId: isHttp ? Context.getOrUndefined(fiber.context, HttpServerRequest.HttpServerRequest)?.headers[MCP_SESSION_ID_HEADER] : undefined,
|
|
1062
|
-
recordToolArguments: fiber.getRef(Toolkit.RecordToolArguments)
|
|
1075
|
+
recordToolArguments: fiber.getRef(Toolkit.RecordToolArguments),
|
|
1076
|
+
server
|
|
1063
1077
|
});
|
|
1064
1078
|
const ambientParent = Context.getOrUndefined(fiber.context, Tracer.ParentSpan);
|
|
1065
1079
|
return Effect.flatMap(Effect.makeSpan(name, {
|
|
@@ -1932,10 +1946,9 @@ const addMcpHttpRoutes = /*#__PURE__*/Effect.fnUntraced(function* (options, http
|
|
|
1932
1946
|
const runtime = yield* McpRuntime.ServerRuntime;
|
|
1933
1947
|
const router = yield* HttpRouter.HttpRouter;
|
|
1934
1948
|
const allowSessionTermination = options.allowSessionTermination === true && runtime.protocols.some(protocol => protocol.runtime._tag === "Stateful");
|
|
1935
|
-
const
|
|
1936
|
-
|
|
1937
|
-
}));
|
|
1938
|
-
const withAllowedOrigin = handler => request => isAllowedMcpOrigin(request, options.allowedOrigins) ? handler(request) : forbidden;
|
|
1949
|
+
const unsupportedContentType = Effect.succeed(mcpTransportRejection(415, "Content-Type must be application/json"));
|
|
1950
|
+
const notAcceptable = Effect.succeed(mcpTransportRejection(406, "Accept header must include both application/json and text/event-stream"));
|
|
1951
|
+
const withAllowedOrigin = handler => request => isAllowedMcpOrigin(request, options.allowedOrigins) ? handler(request) : Effect.succeed(mcpTransportRejection(403, `Origin '${request.headers["origin"]}' is not allowed`));
|
|
1939
1952
|
const methodNotAllowedResponse = Effect.succeed(HttpServerResponse.empty({
|
|
1940
1953
|
status: 405,
|
|
1941
1954
|
headers: {
|
|
@@ -1947,22 +1960,13 @@ const addMcpHttpRoutes = /*#__PURE__*/Effect.fnUntraced(function* (options, http
|
|
|
1947
1960
|
yield* router.add(method, options.path, methodNotAllowed);
|
|
1948
1961
|
}
|
|
1949
1962
|
yield* router.add("DELETE", options.path, allowSessionTermination ? withAllowedOrigin(request => runtime.terminateHttpSession(request.headers)) : methodNotAllowed);
|
|
1950
|
-
yield* router.add("POST", options.path, request => {
|
|
1951
|
-
if (!isAllowedMcpOrigin(request, options.allowedOrigins)) {
|
|
1952
|
-
return Effect.succeed(HttpServerResponse.empty({
|
|
1953
|
-
status: 403
|
|
1954
|
-
}));
|
|
1955
|
-
}
|
|
1963
|
+
yield* router.add("POST", options.path, withAllowedOrigin(request => {
|
|
1956
1964
|
if (mcpMediaTypes(request.headers["content-type"])[0] !== "application/json") {
|
|
1957
|
-
return
|
|
1958
|
-
status: 415
|
|
1959
|
-
}));
|
|
1965
|
+
return unsupportedContentType;
|
|
1960
1966
|
}
|
|
1961
1967
|
const accepted = mcpMediaTypes(request.headers["accept"]);
|
|
1962
1968
|
if (!accepted.includes("application/json") || !accepted.includes("text/event-stream")) {
|
|
1963
|
-
return
|
|
1964
|
-
status: 406
|
|
1965
|
-
}));
|
|
1969
|
+
return notAcceptable;
|
|
1966
1970
|
}
|
|
1967
1971
|
return Effect.gen(function* () {
|
|
1968
1972
|
const parsed = yield* Effect.result(Effect.flatMap(request.text, Schema.decodeEffect(Schema.UnknownFromJsonString)));
|
|
@@ -1991,7 +1995,7 @@ const addMcpHttpRoutes = /*#__PURE__*/Effect.fnUntraced(function* (options, http
|
|
|
1991
1995
|
})) : Effect.die(new Error("MCP request ended without writing its response"));
|
|
1992
1996
|
});
|
|
1993
1997
|
});
|
|
1994
|
-
});
|
|
1998
|
+
}));
|
|
1995
1999
|
});
|
|
1996
2000
|
const mcpHttpSerialization = /*#__PURE__*/(() => {
|
|
1997
2001
|
const serialization = /*#__PURE__*/mcpJsonRpcSerialization();
|
|
@@ -2102,6 +2106,10 @@ const isAllowedMcpOrigin = (request, allowedOrigins) => {
|
|
|
2102
2106
|
const origin = request.headers["origin"];
|
|
2103
2107
|
return origin === undefined || (allowedOrigins ?? []).includes(origin);
|
|
2104
2108
|
};
|
|
2109
|
+
const mcpTransportRejection = (status, message) => McpRuntime.jsonRpcError(status, {
|
|
2110
|
+
code: McpSchema.INVALID_REQUEST_ERROR_CODE,
|
|
2111
|
+
message
|
|
2112
|
+
});
|
|
2105
2113
|
const mcpMediaTypes = header => header === undefined ? [] : header.split(",").flatMap(part => {
|
|
2106
2114
|
const [mediaType, ...parameters] = part.split(";");
|
|
2107
2115
|
const quality = parameters.map(parameter => parameter.trim().toLowerCase()).find(parameter => parameter.startsWith("q="));
|
|
@@ -2278,6 +2286,9 @@ export const registerToolkit = /*#__PURE__*/Effect.fnUntraced(function* (toolkit
|
|
|
2278
2286
|
message: error.reason.message
|
|
2279
2287
|
}));
|
|
2280
2288
|
}
|
|
2289
|
+
if (origin === "handler" && isInvalidParams(error)) {
|
|
2290
|
+
return Effect.fail(error);
|
|
2291
|
+
}
|
|
2281
2292
|
if (origin === "handler" && isDeclaredFailure(error)) {
|
|
2282
2293
|
return Effect.catchCause(declaredFailureResult(error), internalToolError);
|
|
2283
2294
|
}
|
|
@@ -2286,25 +2297,41 @@ export const registerToolkit = /*#__PURE__*/Effect.fnUntraced(function* (toolkit
|
|
|
2286
2297
|
};
|
|
2287
2298
|
const content = options?.content;
|
|
2288
2299
|
const mapper = content && Object.hasOwn(content, tool.name) ? content[tool.name] : undefined;
|
|
2289
|
-
|
|
2290
|
-
const inputSchema =
|
|
2300
|
+
// Decoding copies a caller-owned raw schema, so later mutation does not change the descriptor.
|
|
2301
|
+
const inputSchema = rawJsonSchema === undefined ? toolJsonSchema(tool.parametersSchema, strict) : yield* Effect.catch(Schema.decodeUnknownEffect(ToolJson)(rawJsonSchema), cause => Effect.die(`McpServer cannot register tool '${tool.name}': its raw JSON Schema must have an object root ` + `(type: "object").\n\n${cause.message}`));
|
|
2302
|
+
const title = Context.getOrUndefined(tool.annotations, Tool.Title);
|
|
2291
2303
|
const readOnlyHint = Context.get(tool.annotations, Tool.Readonly);
|
|
2292
|
-
const
|
|
2304
|
+
const fields = {
|
|
2293
2305
|
name: tool.name,
|
|
2306
|
+
title,
|
|
2294
2307
|
description: Tool.getDescription(tool),
|
|
2295
|
-
inputSchema,
|
|
2296
|
-
outputSchema,
|
|
2308
|
+
inputSchema: inputSchema,
|
|
2309
|
+
outputSchema: mapper ? undefined : toolJsonSchema(tool.successSchema, false),
|
|
2297
2310
|
annotations: {
|
|
2298
|
-
...
|
|
2311
|
+
...(title !== undefined ? {
|
|
2299
2312
|
title
|
|
2300
|
-
}
|
|
2313
|
+
} : undefined),
|
|
2301
2314
|
readOnlyHint,
|
|
2302
2315
|
destructiveHint: Context.getOrUndefined(tool.annotations, Tool.Destructive) ?? !readOnlyHint,
|
|
2303
2316
|
idempotentHint: Context.get(tool.annotations, Tool.Idempotent),
|
|
2304
2317
|
openWorldHint: Context.get(tool.annotations, Tool.OpenWorld)
|
|
2305
2318
|
},
|
|
2306
|
-
_meta: toolMeta
|
|
2307
|
-
|
|
2319
|
+
_meta: Predicate.isReadonlyObject(toolMeta) ? {
|
|
2320
|
+
...toolMeta
|
|
2321
|
+
} : toolMeta
|
|
2322
|
+
};
|
|
2323
|
+
let mcpTool;
|
|
2324
|
+
if (isValidTool(fields)) {
|
|
2325
|
+
mcpTool = Schema.makeClassTrusted(McpTool, fields);
|
|
2326
|
+
} else {
|
|
2327
|
+
try {
|
|
2328
|
+
mcpTool = new McpTool(fields);
|
|
2329
|
+
} catch (error) {
|
|
2330
|
+
// Name the tool when the input schema lacks an object root; rethrow anything else.
|
|
2331
|
+
yield* Effect.catch(Schema.decodeUnknownEffect(ToolJson)(inputSchema), cause => Effect.die(`McpServer cannot register tool '${tool.name}': its parameters must encode to a JSON Schema with an ` + `object root (type: "object"), such as a Schema.Struct. Use Tool.EmptyParams for a tool without ` + `parameters.\n\n${cause.message}`));
|
|
2332
|
+
throw error;
|
|
2333
|
+
}
|
|
2334
|
+
}
|
|
2308
2335
|
registrations.push({
|
|
2309
2336
|
tool: mcpTool,
|
|
2310
2337
|
annotations,
|
|
@@ -2346,7 +2373,29 @@ export const registerToolkit = /*#__PURE__*/Effect.fnUntraced(function* (toolkit
|
|
|
2346
2373
|
yield* registry.addTool(registration);
|
|
2347
2374
|
}
|
|
2348
2375
|
});
|
|
2376
|
+
const isInvalidParams = /*#__PURE__*/Schema.is(InvalidParams);
|
|
2349
2377
|
const isParameterValidationError = error => AiError.isAiError(error) && error.reason._tag === "ToolParameterValidationError";
|
|
2378
|
+
// Shallow check of the `McpTool` fields `registerToolkit` sets. Passing descriptors
|
|
2379
|
+
// skip schema validation; the rest go through the checked constructor.
|
|
2380
|
+
const isValidTool = fields => {
|
|
2381
|
+
const {
|
|
2382
|
+
annotations,
|
|
2383
|
+
inputSchema
|
|
2384
|
+
} = fields;
|
|
2385
|
+
if (!Predicate.isReadonlyObject(inputSchema)) return false;
|
|
2386
|
+
const {
|
|
2387
|
+
properties,
|
|
2388
|
+
required
|
|
2389
|
+
} = inputSchema;
|
|
2390
|
+
return typeof fields.name === "string" && (fields.title === undefined || typeof fields.title === "string") && (fields.description === undefined || typeof fields.description === "string") && inputSchema.type === "object" && (properties === undefined || Predicate.isReadonlyObject(properties) && Object.values(properties).every(value => typeof value === "boolean" || Predicate.isReadonlyObject(value))) && (required === undefined || Array.isArray(required) && isStringArray(required)) && (fields.outputSchema === undefined || Predicate.isReadonlyObject(fields.outputSchema)) && typeof annotations.readOnlyHint === "boolean" && typeof annotations.destructiveHint === "boolean" && typeof annotations.idempotentHint === "boolean" && typeof annotations.openWorldHint === "boolean" && (fields._meta === undefined || Predicate.isReadonlyObject(fields._meta));
|
|
2391
|
+
};
|
|
2392
|
+
// Unlike `Array.prototype.every`, this also rejects holes in sparse arrays.
|
|
2393
|
+
const isStringArray = array => {
|
|
2394
|
+
for (let i = 0; i < array.length; i++) {
|
|
2395
|
+
if (typeof array[i] !== "string") return false;
|
|
2396
|
+
}
|
|
2397
|
+
return true;
|
|
2398
|
+
};
|
|
2350
2399
|
// MCP requires an object root. A non-recursive root is compiled inline rather
|
|
2351
2400
|
// than as a definition; a recursive root keeps its definition and the top-level
|
|
2352
2401
|
// `$ref` is inlined.
|
|
@@ -2509,6 +2558,10 @@ const toSkillSourceFile = (path, file) => {
|
|
|
2509
2558
|
mimeType
|
|
2510
2559
|
};
|
|
2511
2560
|
};
|
|
2561
|
+
const toSkillOptions = (skillOrOptions, registration) => skillOrOptions instanceof Skill.Skill ? {
|
|
2562
|
+
...registration,
|
|
2563
|
+
files: Skill.toFiles(skillOrOptions)
|
|
2564
|
+
} : skillOrOptions;
|
|
2512
2565
|
/**
|
|
2513
2566
|
* Registers an Agent Skill under the MCP Skills extension (SEP-2640).
|
|
2514
2567
|
*
|
|
@@ -2536,7 +2589,8 @@ const toSkillSourceFile = (path, file) => {
|
|
|
2536
2589
|
* @category handlers
|
|
2537
2590
|
* @since 4.1.1
|
|
2538
2591
|
*/
|
|
2539
|
-
export const registerSkill =
|
|
2592
|
+
export const registerSkill = (skillOrOptions, registration) => registerSkillFiles(toSkillOptions(skillOrOptions, registration));
|
|
2593
|
+
const registerSkillFiles = /*#__PURE__*/Effect.fnUntraced(function* (options) {
|
|
2540
2594
|
const files = Object.entries(options.files).map(([path, file]) => toSkillSourceFile(path, file));
|
|
2541
2595
|
const skill = yield* McpSkills.makeStaticSkill({
|
|
2542
2596
|
uri: options.uri,
|
|
@@ -2636,7 +2690,7 @@ export const registerSkill = /*#__PURE__*/Effect.fnUntraced(function* (options)
|
|
|
2636
2690
|
* @category layers
|
|
2637
2691
|
* @since 4.1.1
|
|
2638
2692
|
*/
|
|
2639
|
-
export const skill =
|
|
2693
|
+
export const skill = (skillOrOptions, registration) => Layer.effectDiscard(registerSkillFiles(toSkillOptions(skillOrOptions, registration)));
|
|
2640
2694
|
/**
|
|
2641
2695
|
* Registers an MCP prompt from an Effect program.
|
|
2642
2696
|
*
|