effect 4.1.2 → 4.1.3
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 +1 -1
- package/ai-docs/tsconfig.json +2 -1
- package/dist/DateTime.d.ts +33 -2
- package/dist/DateTime.d.ts.map +1 -1
- package/dist/DateTime.js +16 -0
- package/dist/DateTime.js.map +1 -1
- package/dist/Match.d.ts +6 -6
- package/dist/Match.d.ts.map +1 -1
- package/dist/Match.js.map +1 -1
- package/dist/Queue.d.ts +2 -1
- package/dist/Queue.d.ts.map +1 -1
- package/dist/Queue.js +16 -9
- package/dist/Queue.js.map +1 -1
- package/dist/Rational.d.ts +1214 -0
- package/dist/Rational.d.ts.map +1 -0
- package/dist/Rational.js +880 -0
- package/dist/Rational.js.map +1 -0
- package/dist/RcMap.d.ts +3 -0
- package/dist/RcMap.d.ts.map +1 -1
- package/dist/RcMap.js +13 -14
- package/dist/RcMap.js.map +1 -1
- package/dist/Runtime.d.ts +75 -3
- package/dist/Runtime.d.ts.map +1 -1
- package/dist/Runtime.js +81 -4
- package/dist/Runtime.js.map +1 -1
- package/dist/Schema.d.ts +131 -29
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +128 -22
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +24 -12
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaParser.js +2 -2
- package/dist/SchemaParser.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +9 -0
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +9 -0
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/ScopedCache.d.ts +7 -0
- package/dist/ScopedCache.d.ts.map +1 -1
- package/dist/ScopedCache.js +18 -1
- package/dist/ScopedCache.js.map +1 -1
- package/dist/ai/AgUi.d.ts +109 -0
- package/dist/ai/AgUi.d.ts.map +1 -0
- package/dist/ai/AgUi.js +543 -0
- package/dist/ai/AgUi.js.map +1 -0
- package/dist/ai/AgUiSchema.d.ts +6965 -0
- package/dist/ai/AgUiSchema.d.ts.map +1 -0
- package/dist/ai/AgUiSchema.js +974 -0
- package/dist/ai/AgUiSchema.js.map +1 -0
- package/dist/ai/AgUiServer.d.ts +6400 -0
- package/dist/ai/AgUiServer.d.ts.map +1 -0
- package/dist/ai/AgUiServer.js +309 -0
- package/dist/ai/AgUiServer.js.map +1 -0
- package/dist/ai/Chat.d.ts +30 -4
- package/dist/ai/Chat.d.ts.map +1 -1
- package/dist/ai/Chat.js +34 -4
- package/dist/ai/Chat.js.map +1 -1
- package/dist/ai/LanguageModel.d.ts +1 -1
- package/dist/ai/LanguageModel.d.ts.map +1 -1
- package/dist/ai/LanguageModel.js +18 -8
- package/dist/ai/LanguageModel.js.map +1 -1
- package/dist/ai/McpClient.d.ts +5 -0
- package/dist/ai/McpClient.d.ts.map +1 -1
- package/dist/ai/McpClient.js +11 -1
- package/dist/ai/McpClient.js.map +1 -1
- package/dist/ai/McpServer.d.ts +18 -1
- package/dist/ai/McpServer.d.ts.map +1 -1
- package/dist/ai/McpServer.js +214 -34
- package/dist/ai/McpServer.js.map +1 -1
- package/dist/ai/Prompt.d.ts +6 -2
- package/dist/ai/Prompt.d.ts.map +1 -1
- package/dist/ai/Prompt.js.map +1 -1
- package/dist/ai/Response.d.ts +5 -2
- package/dist/ai/Response.d.ts.map +1 -1
- package/dist/ai/Response.js +5 -1
- package/dist/ai/Response.js.map +1 -1
- package/dist/ai/Tool.d.ts +265 -69
- package/dist/ai/Tool.d.ts.map +1 -1
- package/dist/ai/Tool.js +19 -2
- package/dist/ai/Tool.js.map +1 -1
- package/dist/ai/Toolkit.d.ts +32 -2
- package/dist/ai/Toolkit.d.ts.map +1 -1
- package/dist/ai/Toolkit.js +61 -8
- package/dist/ai/Toolkit.js.map +1 -1
- package/dist/ai/index.d.ts +15 -0
- package/dist/ai/index.d.ts.map +1 -1
- package/dist/ai/index.js +15 -0
- package/dist/ai/index.js.map +1 -1
- package/dist/ai/internal/mcpCore.d.ts +0 -2
- package/dist/ai/internal/mcpCore.d.ts.map +1 -1
- package/dist/ai/internal/mcpCore.js +2 -8
- package/dist/ai/internal/mcpCore.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2024_11_05.js +6 -11
- package/dist/ai/internal/mcpProtocol/v2024_11_05.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2025_03_26.js +6 -11
- package/dist/ai/internal/mcpProtocol/v2025_03_26.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2025_06_18.js +6 -8
- package/dist/ai/internal/mcpProtocol/v2025_06_18.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2025_11_25.js +6 -8
- package/dist/ai/internal/mcpProtocol/v2025_11_25.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2026_07_28.js +60 -51
- package/dist/ai/internal/mcpProtocol/v2026_07_28.js.map +1 -1
- package/dist/ai/internal/mcpProtocol.js +11 -1
- package/dist/ai/internal/mcpProtocol.js.map +1 -1
- package/dist/ai/internal/mcpProtocolRegistry.js +4 -0
- package/dist/ai/internal/mcpProtocolRegistry.js.map +1 -1
- package/dist/ai/internal/mcpRuntime.js +6 -2
- package/dist/ai/internal/mcpRuntime.js.map +1 -1
- package/dist/ai/internal/mcpSchema/v2024_11_05.js +0 -2
- package/dist/ai/internal/mcpSchema/v2024_11_05.js.map +1 -1
- package/dist/ai/internal/mcpSchema/v2025_03_26.d.ts.map +1 -1
- package/dist/ai/internal/mcpSchema/v2025_03_26.js +0 -2
- package/dist/ai/internal/mcpSchema/v2025_03_26.js.map +1 -1
- package/dist/ai/internal/mcpSchema/v2025_06_18.d.ts.map +1 -1
- package/dist/ai/internal/mcpSchema/v2025_06_18.js +0 -2
- package/dist/ai/internal/mcpSchema/v2025_06_18.js.map +1 -1
- package/dist/ai/internal/mcpSchema/v2025_11_25.d.ts.map +1 -1
- package/dist/ai/internal/mcpSchema/v2025_11_25.js +0 -2
- package/dist/ai/internal/mcpSchema/v2025_11_25.js.map +1 -1
- package/dist/ai/internal/mcpSchema/v2026_07_28.d.ts.map +1 -1
- package/dist/ai/internal/mcpSchema/v2026_07_28.js +0 -2
- package/dist/ai/internal/mcpSchema/v2026_07_28.js.map +1 -1
- package/dist/ai/internal/mcpSkills.js +3 -93
- package/dist/ai/internal/mcpSkills.js.map +1 -1
- package/dist/ai/internal/mcpStatefulRuntime.js +0 -2
- package/dist/ai/internal/mcpStatefulRuntime.js.map +1 -1
- package/dist/ai/internal/structured-output.js +1 -1
- package/dist/ai/internal/structured-output.js.map +1 -1
- package/dist/cli/Argument.d.ts +81 -0
- package/dist/cli/Argument.d.ts.map +1 -1
- package/dist/cli/Argument.js +26 -0
- package/dist/cli/Argument.js.map +1 -1
- package/dist/cli/CliError.d.ts +7 -4
- package/dist/cli/CliError.d.ts.map +1 -1
- package/dist/cli/CliError.js +7 -4
- package/dist/cli/CliError.js.map +1 -1
- package/dist/cli/Command.d.ts +241 -22
- package/dist/cli/Command.d.ts.map +1 -1
- package/dist/cli/Command.js +85 -9
- package/dist/cli/Command.js.map +1 -1
- package/dist/cli/CommandSpec.d.ts +287 -0
- package/dist/cli/CommandSpec.d.ts.map +1 -0
- package/dist/cli/CommandSpec.js +277 -0
- package/dist/cli/CommandSpec.js.map +1 -0
- package/dist/cli/Completions.d.ts +5 -0
- package/dist/cli/Completions.d.ts.map +1 -1
- package/dist/cli/Completions.js.map +1 -1
- package/dist/cli/Flag.d.ts +102 -0
- package/dist/cli/Flag.d.ts.map +1 -1
- package/dist/cli/Flag.js +47 -0
- package/dist/cli/Flag.js.map +1 -1
- package/dist/cli/Param.d.ts +154 -1
- package/dist/cli/Param.d.ts.map +1 -1
- package/dist/cli/Param.js +87 -29
- package/dist/cli/Param.js.map +1 -1
- package/dist/cli/index.d.ts +5 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +5 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/internal/command.d.ts +2 -2
- package/dist/cli/internal/command.d.ts.map +1 -1
- package/dist/cli/internal/command.js +1 -1
- package/dist/cli/internal/command.js.map +1 -1
- package/dist/cli/internal/completions/bash.js +6 -7
- package/dist/cli/internal/completions/bash.js.map +1 -1
- package/dist/cli/internal/completions/descriptor.js +21 -7
- package/dist/cli/internal/completions/descriptor.js.map +1 -1
- package/dist/cli/internal/completions/fish.js +3 -3
- package/dist/cli/internal/completions/fish.js.map +1 -1
- package/dist/cli/internal/completions/powershell.js +2 -2
- package/dist/cli/internal/completions/powershell.js.map +1 -1
- package/dist/cli/internal/completions/zsh.js +2 -2
- package/dist/cli/internal/completions/zsh.js.map +1 -1
- package/dist/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
- package/dist/cluster/ClusterWorkflowEngine.js +15 -13
- package/dist/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/cluster/Entity.d.ts +17 -0
- package/dist/cluster/Entity.d.ts.map +1 -1
- package/dist/cluster/Entity.js +20 -0
- package/dist/cluster/Entity.js.map +1 -1
- package/dist/cluster/MessageRetention.d.ts +71 -0
- package/dist/cluster/MessageRetention.d.ts.map +1 -0
- package/dist/cluster/MessageRetention.js +100 -0
- package/dist/cluster/MessageRetention.js.map +1 -0
- package/dist/cluster/MessageStorage.d.ts +81 -0
- package/dist/cluster/MessageStorage.d.ts.map +1 -1
- package/dist/cluster/MessageStorage.js +34 -2
- package/dist/cluster/MessageStorage.js.map +1 -1
- package/dist/cluster/ShardingConfig.d.ts +24 -2
- 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 +187 -29
- package/dist/cluster/SqlMessageStorage.js.map +1 -1
- package/dist/cluster/index.d.ts +5 -0
- package/dist/cluster/index.d.ts.map +1 -1
- package/dist/cluster/index.js +5 -0
- package/dist/cluster/index.js.map +1 -1
- package/dist/encoding/Base64.d.ts +0 -6
- package/dist/encoding/Base64.d.ts.map +1 -1
- package/dist/encoding/Base64.js +25 -5
- package/dist/encoding/Base64.js.map +1 -1
- package/dist/encoding/Base64Url.d.ts +0 -6
- package/dist/encoding/Base64Url.d.ts.map +1 -1
- package/dist/encoding/Base64Url.js +91 -8
- package/dist/encoding/Base64Url.js.map +1 -1
- package/dist/encoding/Csv.d.ts.map +1 -1
- package/dist/encoding/Csv.js +11 -5
- package/dist/encoding/Csv.js.map +1 -1
- package/dist/encoding/Hex.d.ts.map +1 -1
- package/dist/encoding/Hex.js +51 -34
- package/dist/encoding/Hex.js.map +1 -1
- package/dist/encoding/SchemaBinary.d.ts +14 -2
- package/dist/encoding/SchemaBinary.d.ts.map +1 -1
- package/dist/encoding/SchemaBinary.js +78 -5
- package/dist/encoding/SchemaBinary.js.map +1 -1
- package/dist/encoding/Xml.d.ts +25 -0
- package/dist/encoding/Xml.d.ts.map +1 -1
- package/dist/encoding/Xml.js +44 -19
- package/dist/encoding/Xml.js.map +1 -1
- package/dist/graphql/GraphQL.d.ts.map +1 -1
- package/dist/graphql/GraphQL.js +4 -1
- package/dist/graphql/GraphQL.js.map +1 -1
- package/dist/http/Headers.d.ts +5 -1
- package/dist/http/Headers.d.ts.map +1 -1
- package/dist/http/Headers.js +7 -2
- package/dist/http/Headers.js.map +1 -1
- package/dist/http/HttpClient.d.ts +57 -12
- package/dist/http/HttpClient.d.ts.map +1 -1
- package/dist/http/HttpClient.js +92 -54
- package/dist/http/HttpClient.js.map +1 -1
- package/dist/http/HttpClientError.d.ts +22 -8
- package/dist/http/HttpClientError.d.ts.map +1 -1
- package/dist/http/HttpClientError.js +68 -14
- package/dist/http/HttpClientError.js.map +1 -1
- package/dist/http/HttpEffect.d.ts +63 -4
- package/dist/http/HttpEffect.d.ts.map +1 -1
- package/dist/http/HttpEffect.js +89 -9
- 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/HttpServer.d.ts +80 -0
- package/dist/http/HttpServer.d.ts.map +1 -1
- package/dist/http/HttpServer.js +16 -0
- package/dist/http/HttpServer.js.map +1 -1
- package/dist/http/HttpServerRequest.d.ts.map +1 -1
- package/dist/http/HttpServerRequest.js +1 -14
- package/dist/http/HttpServerRequest.js.map +1 -1
- package/dist/http/HttpStaticServer.js +10 -16
- package/dist/http/HttpStaticServer.js.map +1 -1
- package/dist/http-api/HttpApiBuilder.js +9 -1
- package/dist/http-api/HttpApiBuilder.js.map +1 -1
- package/dist/http-api/HttpApiSchema.d.ts +19 -0
- package/dist/http-api/HttpApiSchema.d.ts.map +1 -1
- package/dist/http-api/HttpApiSchema.js +8 -1
- package/dist/http-api/HttpApiSchema.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/base64.d.ts +2 -0
- package/dist/internal/base64.d.ts.map +1 -0
- package/dist/internal/base64.js +30 -0
- package/dist/internal/base64.js.map +1 -0
- package/dist/internal/core.js +3 -4
- package/dist/internal/core.js.map +1 -1
- package/dist/internal/dateTime.js +18 -10
- package/dist/internal/dateTime.js.map +1 -1
- package/dist/internal/effect.js +41 -17
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/equal.js +7 -0
- package/dist/internal/equal.js.map +1 -1
- package/dist/internal/matcher.js +1 -1
- package/dist/internal/matcher.js.map +1 -1
- package/dist/internal/schema/codegen.js +7 -7
- package/dist/internal/schema/codegen.js.map +1 -1
- package/dist/internal/schema/fromJsonSchemaDocument.js +20 -1
- package/dist/internal/schema/fromJsonSchemaDocument.js.map +1 -1
- package/dist/internal/schema/interpreter.js +10 -10
- package/dist/internal/schema/interpreter.js.map +1 -1
- package/dist/internal/schema/parser.js +9 -4
- package/dist/internal/schema/parser.js.map +1 -1
- package/dist/internal/schema/toEquivalence.js +6 -5
- package/dist/internal/schema/toEquivalence.js.map +1 -1
- package/dist/internal/schema/toFormatter.js +3 -2
- package/dist/internal/schema/toFormatter.js.map +1 -1
- package/dist/internal/version.js +1 -1
- package/dist/observability/OtlpMetrics.js +1 -1
- package/dist/observability/OtlpMetrics.js.map +1 -1
- package/dist/observability/OtlpTracer.js +2 -2
- package/dist/observability/OtlpTracer.js.map +1 -1
- package/dist/persistence/PersistedQueue.d.ts +72 -3
- package/dist/persistence/PersistedQueue.d.ts.map +1 -1
- package/dist/persistence/PersistedQueue.js +142 -29
- package/dist/persistence/PersistedQueue.js.map +1 -1
- package/dist/persistence/RateLimiter.d.ts +12 -2
- package/dist/persistence/RateLimiter.d.ts.map +1 -1
- package/dist/persistence/RateLimiter.js +11 -4
- package/dist/persistence/RateLimiter.js.map +1 -1
- package/dist/process/CommandLine.d.ts +9 -9
- package/dist/process/CommandLine.js +6 -6
- package/dist/process/index.d.ts +1 -1
- package/dist/process/index.js +1 -1
- package/dist/reactivity/Atom.d.ts.map +1 -1
- package/dist/reactivity/Atom.js +24 -3
- package/dist/reactivity/Atom.js.map +1 -1
- package/dist/reactivity/AtomRpc.d.ts +24 -6
- package/dist/reactivity/AtomRpc.d.ts.map +1 -1
- package/dist/reactivity/AtomRpc.js.map +1 -1
- package/dist/rpc/OpenRpc.d.ts +384 -0
- package/dist/rpc/OpenRpc.d.ts.map +1 -0
- package/dist/rpc/OpenRpc.js +490 -0
- package/dist/rpc/OpenRpc.js.map +1 -0
- package/dist/rpc/Rpc.d.ts +22 -3
- package/dist/rpc/Rpc.d.ts.map +1 -1
- package/dist/rpc/Rpc.js.map +1 -1
- package/dist/rpc/RpcClient.d.ts +20 -21
- package/dist/rpc/RpcClient.d.ts.map +1 -1
- package/dist/rpc/RpcClient.js.map +1 -1
- package/dist/rpc/RpcServer.d.ts +23 -2
- package/dist/rpc/RpcServer.d.ts.map +1 -1
- package/dist/rpc/RpcServer.js +67 -25
- package/dist/rpc/RpcServer.js.map +1 -1
- package/dist/rpc/index.d.ts +5 -0
- package/dist/rpc/index.d.ts.map +1 -1
- package/dist/rpc/index.js +5 -0
- package/dist/rpc/index.js.map +1 -1
- package/dist/schema/SchemaCompiler/runtime.js +3 -2
- package/dist/schema/SchemaCompiler/runtime.js.map +1 -1
- package/dist/sql/SqlClient.d.ts +59 -6
- package/dist/sql/SqlClient.d.ts.map +1 -1
- package/dist/sql/SqlClient.js +64 -17
- package/dist/sql/SqlClient.js.map +1 -1
- package/dist/sql/Statement.d.ts +1 -1
- package/dist/sql/Statement.d.ts.map +1 -1
- package/dist/sql/Statement.js +9 -16
- package/dist/sql/Statement.js.map +1 -1
- package/dist/testing/TestClock.d.ts +2 -12
- package/dist/testing/TestClock.d.ts.map +1 -1
- package/dist/testing/TestClock.js +177 -169
- package/dist/testing/TestClock.js.map +1 -1
- package/dist/workflow/DurableClock.d.ts +27 -0
- package/dist/workflow/DurableClock.d.ts.map +1 -1
- package/dist/workflow/DurableClock.js +18 -2
- package/dist/workflow/DurableClock.js.map +1 -1
- package/dist/workflow/Workflow.d.ts.map +1 -1
- package/dist/workflow/Workflow.js +5 -4
- package/dist/workflow/Workflow.js.map +1 -1
- package/dist/workflow/WorkflowEngine.d.ts.map +1 -1
- package/dist/workflow/WorkflowEngine.js +14 -3
- package/dist/workflow/WorkflowEngine.js.map +1 -1
- package/package.json +3 -3
- package/src/DateTime.ts +35 -2
- package/src/Match.ts +10 -8
- package/src/Queue.ts +16 -11
- package/src/Rational.ts +1549 -0
- package/src/RcMap.ts +16 -14
- package/src/Runtime.ts +84 -4
- package/src/Schema.ts +188 -29
- package/src/SchemaAST.ts +29 -13
- package/src/SchemaParser.ts +2 -2
- package/src/SchemaRepresentation.ts +13 -0
- package/src/ScopedCache.ts +18 -1
- package/src/ai/AgUi.ts +485 -0
- package/src/ai/AgUiSchema.ts +1666 -0
- package/src/ai/AgUiServer.ts +451 -0
- package/src/ai/Chat.ts +78 -16
- package/src/ai/LanguageModel.ts +27 -9
- package/src/ai/McpClient.ts +11 -1
- package/src/ai/McpServer.ts +247 -50
- package/src/ai/Prompt.ts +6 -2
- package/src/ai/Response.ts +19 -3
- package/src/ai/Tool.ts +426 -110
- package/src/ai/Toolkit.ts +71 -10
- package/src/ai/index.ts +18 -0
- package/src/ai/internal/mcpCore.ts +11 -15
- package/src/ai/internal/mcpProtocol/v2024_11_05.ts +9 -14
- package/src/ai/internal/mcpProtocol/v2025_03_26.ts +9 -14
- package/src/ai/internal/mcpProtocol/v2025_06_18.ts +9 -11
- package/src/ai/internal/mcpProtocol/v2025_11_25.ts +9 -11
- package/src/ai/internal/mcpProtocol/v2026_07_28.ts +76 -55
- package/src/ai/internal/mcpProtocol.ts +22 -3
- package/src/ai/internal/mcpProtocolRegistry.ts +5 -0
- package/src/ai/internal/mcpRuntime.ts +10 -4
- package/src/ai/internal/mcpSchema/v2024_11_05.ts +0 -2
- package/src/ai/internal/mcpSchema/v2025_03_26.ts +0 -2
- package/src/ai/internal/mcpSchema/v2025_06_18.ts +0 -2
- package/src/ai/internal/mcpSchema/v2025_11_25.ts +0 -2
- package/src/ai/internal/mcpSchema/v2026_07_28.ts +0 -2
- package/src/ai/internal/mcpSkills.ts +3 -86
- package/src/ai/internal/mcpStatefulRuntime.ts +0 -2
- package/src/ai/internal/structured-output.ts +1 -1
- package/src/cli/Argument.ts +86 -0
- package/src/cli/CliError.ts +7 -4
- package/src/cli/Command.ts +261 -35
- package/src/cli/CommandSpec.ts +508 -0
- package/src/cli/Completions.ts +5 -0
- package/src/cli/Flag.ts +106 -0
- package/src/cli/Param.ts +225 -23
- package/src/cli/index.ts +6 -0
- package/src/cli/internal/command.ts +3 -4
- package/src/cli/internal/completions/bash.ts +9 -7
- package/src/cli/internal/completions/descriptor.ts +37 -5
- package/src/cli/internal/completions/fish.ts +9 -3
- package/src/cli/internal/completions/powershell.ts +2 -1
- package/src/cli/internal/completions/zsh.ts +2 -2
- package/src/cluster/ClusterWorkflowEngine.ts +14 -15
- package/src/cluster/Entity.ts +24 -0
- package/src/cluster/MessageRetention.ts +111 -0
- package/src/cluster/MessageStorage.ts +73 -2
- package/src/cluster/ShardingConfig.ts +12 -1
- package/src/cluster/SqlMessageStorage.ts +271 -41
- package/src/cluster/index.ts +6 -0
- package/src/encoding/Base64.ts +26 -5
- package/src/encoding/Base64Url.ts +93 -10
- package/src/encoding/Csv.ts +11 -5
- package/src/encoding/Hex.ts +56 -42
- package/src/encoding/SchemaBinary.ts +76 -5
- package/src/encoding/Xml.ts +65 -16
- package/src/graphql/GraphQL.ts +7 -4
- package/src/http/Headers.ts +7 -2
- package/src/http/HttpClient.ts +118 -68
- package/src/http/HttpClientError.ts +82 -15
- package/src/http/HttpEffect.ts +101 -10
- package/src/http/HttpMiddleware.ts +2 -2
- package/src/http/HttpServer.ts +80 -0
- package/src/http/HttpServerRequest.ts +1 -19
- package/src/http/HttpStaticServer.ts +10 -16
- package/src/http-api/HttpApiBuilder.ts +11 -1
- package/src/http-api/HttpApiSchema.ts +22 -1
- package/src/index.ts +6 -0
- package/src/internal/base64.ts +42 -0
- package/src/internal/core.ts +3 -4
- package/src/internal/dateTime.ts +27 -13
- package/src/internal/effect.ts +45 -18
- package/src/internal/equal.ts +8 -0
- package/src/internal/matcher.ts +7 -3
- package/src/internal/schema/codegen.ts +8 -7
- package/src/internal/schema/fromJsonSchemaDocument.ts +21 -1
- package/src/internal/schema/interpreter.ts +10 -10
- package/src/internal/schema/parser.ts +8 -4
- package/src/internal/schema/toEquivalence.ts +7 -5
- package/src/internal/schema/toFormatter.ts +3 -2
- package/src/internal/version.ts +1 -1
- package/src/observability/OtlpMetrics.ts +1 -1
- package/src/observability/OtlpTracer.ts +2 -2
- package/src/persistence/PersistedQueue.ts +199 -41
- package/src/persistence/RateLimiter.ts +17 -5
- package/src/process/CommandLine.ts +10 -10
- package/src/process/index.ts +1 -1
- package/src/reactivity/Atom.ts +25 -3
- package/src/reactivity/AtomRpc.ts +61 -45
- package/src/rpc/OpenRpc.ts +747 -0
- package/src/rpc/Rpc.ts +38 -6
- package/src/rpc/RpcClient.ts +45 -82
- package/src/rpc/RpcServer.ts +77 -28
- package/src/rpc/index.ts +6 -0
- package/src/schema/SchemaCompiler/runtime.ts +8 -3
- package/src/sql/SqlClient.ts +112 -26
- package/src/sql/Statement.ts +19 -23
- package/src/testing/TestClock.ts +204 -189
- package/src/workflow/DurableClock.ts +20 -3
- package/src/workflow/Workflow.ts +5 -3
- package/src/workflow/WorkflowEngine.ts +20 -5
package/src/ai/Toolkit.ts
CHANGED
|
@@ -14,6 +14,7 @@ import * as Cause from "../Cause.ts"
|
|
|
14
14
|
import * as Context from "../Context.ts"
|
|
15
15
|
import * as Effect from "../Effect.ts"
|
|
16
16
|
import * as Effectable from "../Effectable.ts"
|
|
17
|
+
import * as Exit from "../Exit.ts"
|
|
17
18
|
import * as Fiber from "../Fiber.ts"
|
|
18
19
|
import { identity } from "../Function.ts"
|
|
19
20
|
import * as InternalRecord from "../internal/record.ts"
|
|
@@ -217,9 +218,9 @@ export interface WithHandler<in out Tools extends Record<string, Tool.Any>> {
|
|
|
217
218
|
*/
|
|
218
219
|
name: Name,
|
|
219
220
|
/**
|
|
220
|
-
*
|
|
221
|
+
* JSON-encoded parameters to decode and pass to the tool handler.
|
|
221
222
|
*/
|
|
222
|
-
params:
|
|
223
|
+
params: Schema.Json,
|
|
223
224
|
/**
|
|
224
225
|
* The unique identifier of the tool call.
|
|
225
226
|
*/
|
|
@@ -346,6 +347,51 @@ export const PreliminaryBuffer = Context.Reference<number | "unbounded">("effect
|
|
|
346
347
|
defaultValue: () => "unbounded"
|
|
347
348
|
})
|
|
348
349
|
|
|
350
|
+
/**
|
|
351
|
+
* Controls whether tool call arguments are recorded on the current span.
|
|
352
|
+
*
|
|
353
|
+
* **Details**
|
|
354
|
+
*
|
|
355
|
+
* Defaults to `false`: `Toolkit.handle` records only `gen_ai.tool.name` and,
|
|
356
|
+
* when a call id is given, `gen_ai.tool.call.id`. Provide `true` to also record
|
|
357
|
+
* the arguments as JSON in `gen_ai.tool.call.arguments`. `McpServer` reads the
|
|
358
|
+
* same setting for `tools/call` requests.
|
|
359
|
+
*
|
|
360
|
+
* **Gotchas**
|
|
361
|
+
*
|
|
362
|
+
* Arguments can contain user data. Only enable this where your traces may hold
|
|
363
|
+
* it.
|
|
364
|
+
*
|
|
365
|
+
* **Example** (Recording tool arguments)
|
|
366
|
+
*
|
|
367
|
+
* ```ts import.meta.vitest
|
|
368
|
+
* import { Layer } from "effect"
|
|
369
|
+
* import { Toolkit } from "effect/ai"
|
|
370
|
+
*
|
|
371
|
+
* export const RecordToolArgumentsLive = Layer.succeed(Toolkit.RecordToolArguments, true)
|
|
372
|
+
* ```
|
|
373
|
+
*
|
|
374
|
+
* @stability unstable
|
|
375
|
+
* @category services
|
|
376
|
+
* @since 4.1.3
|
|
377
|
+
*/
|
|
378
|
+
export const RecordToolArguments = Context.Reference<boolean>("effect/ai/Toolkit/RecordToolArguments", {
|
|
379
|
+
defaultValue: () => false
|
|
380
|
+
})
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* Formats tool arguments for the `gen_ai.tool.call.arguments` span attribute.
|
|
384
|
+
*
|
|
385
|
+
* @internal
|
|
386
|
+
*/
|
|
387
|
+
export const stringifyToolArguments = (params: unknown): string => {
|
|
388
|
+
try {
|
|
389
|
+
return JSON.stringify(params) ?? "null"
|
|
390
|
+
} catch {
|
|
391
|
+
return String(params)
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
|
|
349
395
|
const failureCause = <E>(error: E, origin: Tool.FailureOrigin): Cause.Cause<E> =>
|
|
350
396
|
Cause.annotate(Cause.fail(error), Context.make(FailureOrigin, origin))
|
|
351
397
|
|
|
@@ -372,10 +418,10 @@ const Proto = {
|
|
|
372
418
|
if (Predicate.isUndefined(schemas)) {
|
|
373
419
|
const handler = services.mapUnsafe.get(tool.id)! as Tool.Handler<any>
|
|
374
420
|
const decodeParameters = Schema.isSchema(tool.parametersSchema)
|
|
375
|
-
? Schema.decodeUnknownEffect(tool.parametersSchema) as any
|
|
421
|
+
? Schema.decodeUnknownEffect(Schema.toCodecJson(tool.parametersSchema)) as any
|
|
376
422
|
: (u: unknown) => Effect.succeed(u)
|
|
377
|
-
const encodeSuccess = Schema.encodeUnknownEffect(tool.successSchema) as any
|
|
378
|
-
const encodeFailure = Schema.encodeUnknownEffect(Tool.failureResultSchema(tool)) as any
|
|
423
|
+
const encodeSuccess = Schema.encodeUnknownEffect(Schema.toCodecJson(tool.successSchema)) as any
|
|
424
|
+
const encodeFailure = Schema.encodeUnknownEffect(Schema.toCodecJson(Tool.failureResultSchema(tool))) as any
|
|
379
425
|
const encodeResult = (u: unknown, isFailure: boolean) => isFailure ? encodeFailure(u) : encodeSuccess(u)
|
|
380
426
|
schemas = {
|
|
381
427
|
context: handler.context,
|
|
@@ -396,10 +442,13 @@ const Proto = {
|
|
|
396
442
|
) {
|
|
397
443
|
const tool = Object.hasOwn(tools, name) ? tools[name] : undefined
|
|
398
444
|
|
|
399
|
-
yield* Effect.annotateCurrentSpan(
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
}
|
|
445
|
+
yield* Effect.annotateCurrentSpan("gen_ai.tool.name", name)
|
|
446
|
+
if (toolCallId !== undefined) {
|
|
447
|
+
yield* Effect.annotateCurrentSpan("gen_ai.tool.call.id", toolCallId)
|
|
448
|
+
}
|
|
449
|
+
if (yield* RecordToolArguments) {
|
|
450
|
+
yield* Effect.annotateCurrentSpan("gen_ai.tool.call.arguments", stringifyToolArguments(params))
|
|
451
|
+
}
|
|
403
452
|
|
|
404
453
|
if (Predicate.isUndefined(tool)) {
|
|
405
454
|
return yield* AiError.make({
|
|
@@ -412,6 +461,12 @@ const Proto = {
|
|
|
412
461
|
})
|
|
413
462
|
}
|
|
414
463
|
|
|
464
|
+
if (Tool.isClientExecuted(tool)) {
|
|
465
|
+
return yield* Effect.die(
|
|
466
|
+
new Error(`Tool "${name}" is executed by the client and has no handler`)
|
|
467
|
+
)
|
|
468
|
+
}
|
|
469
|
+
|
|
415
470
|
const schemas = getSchemas(tool)
|
|
416
471
|
|
|
417
472
|
const encodeResult = (result: any, isFailure: boolean) =>
|
|
@@ -530,7 +585,13 @@ const Proto = {
|
|
|
530
585
|
}
|
|
531
586
|
return { ...output, encodedResult, modelOutput: tool.toModelOutput(output.result) }
|
|
532
587
|
})),
|
|
533
|
-
Stream.ensuring(
|
|
588
|
+
Stream.ensuring(Effect.flatMap(
|
|
589
|
+
Effect.andThen(Fiber.interrupt(fiber), Fiber.await(fiber)),
|
|
590
|
+
(exit) => {
|
|
591
|
+
const dies = Exit.isFailure(exit) ? exit.cause.reasons.filter(Cause.isDieReason) : []
|
|
592
|
+
return dies.length > 0 ? Effect.failCause(Cause.fromReasons(dies)) : Effect.void
|
|
593
|
+
}
|
|
594
|
+
))
|
|
534
595
|
) satisfies Stream.Stream<Tool.HandlerResult<any>, any>
|
|
535
596
|
})
|
|
536
597
|
|
package/src/ai/index.ts
CHANGED
|
@@ -5,6 +5,24 @@
|
|
|
5
5
|
|
|
6
6
|
// @barrel: Auto-generated exports. Do not edit manually.
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* @stability experimental
|
|
10
|
+
* @since 4.1.0
|
|
11
|
+
*/
|
|
12
|
+
export * as AgUi from "./AgUi.ts"
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @stability experimental
|
|
16
|
+
* @since 4.1.0
|
|
17
|
+
*/
|
|
18
|
+
export * as AgUiSchema from "./AgUiSchema.ts"
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @stability experimental
|
|
22
|
+
* @since 4.1.0
|
|
23
|
+
*/
|
|
24
|
+
export * as AgUiServer from "./AgUiServer.ts"
|
|
25
|
+
|
|
8
26
|
/**
|
|
9
27
|
* @stability unstable
|
|
10
28
|
* @since 4.0.0
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Version-neutral MCP server records and semantic operations.
|
|
3
|
-
*
|
|
4
|
-
* @internal
|
|
5
3
|
*/
|
|
6
4
|
|
|
7
5
|
import * as Arr from "../../Array.ts"
|
|
@@ -185,7 +183,9 @@ export interface ToolRegistration {
|
|
|
185
183
|
readonly visible?: Visible | undefined
|
|
186
184
|
readonly handle: (
|
|
187
185
|
call: typeof McpSchema.CallTool.payloadSchema.Type,
|
|
188
|
-
invocation: McpInvocation
|
|
186
|
+
invocation: McpInvocation,
|
|
187
|
+
// Runs after request-level visibility accepts the tool, and before its handler.
|
|
188
|
+
beforeHandle: Effect.Effect<void, RequestRejected>
|
|
189
189
|
) => Effect.Effect<
|
|
190
190
|
OperationOutcome<McpSchema.CallToolResult>,
|
|
191
191
|
ToolNotFound | InvalidToolInput | InvalidToolContinuation | ToolExecutionError | RequestRejected,
|
|
@@ -203,14 +203,10 @@ export interface Tools {
|
|
|
203
203
|
readonly list: (
|
|
204
204
|
invocation: McpInvocation
|
|
205
205
|
) => Effect.Effect<ReadonlyArray<McpSchema.Tool>, RequestRejected>
|
|
206
|
-
// Skips request-level visibility checks.
|
|
207
|
-
readonly find: (
|
|
208
|
-
name: string,
|
|
209
|
-
profile: NegotiatedProtocolProfile<string>
|
|
210
|
-
) => McpSchema.Tool | undefined
|
|
211
206
|
readonly call: (
|
|
212
207
|
call: typeof McpSchema.CallTool.payloadSchema.Type,
|
|
213
|
-
invocation: McpInvocation
|
|
208
|
+
invocation: McpInvocation,
|
|
209
|
+
beforeHandle?: ((tool: McpSchema.Tool) => Effect.Effect<void, RequestRejected>) | undefined
|
|
214
210
|
) => Effect.Effect<OperationOutcome<McpSchema.CallToolResult>, ToolError>
|
|
215
211
|
}
|
|
216
212
|
|
|
@@ -574,11 +570,7 @@ export const make: Effect.Effect<McpCore> = Effect.sync(() => {
|
|
|
574
570
|
registrations.set(registration.descriptor.name, registration)
|
|
575
571
|
}),
|
|
576
572
|
list: (invocation) => filterList(registrations.values(), invocation),
|
|
577
|
-
|
|
578
|
-
const registration = registrations.get(name)
|
|
579
|
-
return registration !== undefined && registration.isVisible(profile) ? registration.descriptor : undefined
|
|
580
|
-
},
|
|
581
|
-
call: (call, invocation) =>
|
|
573
|
+
call: (call, invocation, beforeHandle) =>
|
|
582
574
|
Effect.suspend((): Effect.Effect<OperationOutcome<McpSchema.CallToolResult>, ToolError> => {
|
|
583
575
|
const registration = registrations.get(call.name)
|
|
584
576
|
if (registration === undefined) {
|
|
@@ -587,7 +579,11 @@ export const make: Effect.Effect<McpCore> = Effect.sync(() => {
|
|
|
587
579
|
if (!registration.isVisible(invocation.protocol)) {
|
|
588
580
|
return new ToolNotFound({ name: call.name })
|
|
589
581
|
}
|
|
590
|
-
return registration.handle(
|
|
582
|
+
return registration.handle(
|
|
583
|
+
call,
|
|
584
|
+
invocation,
|
|
585
|
+
beforeHandle === undefined ? Effect.void : Effect.suspend(() => beforeHandle(registration.descriptor))
|
|
586
|
+
)
|
|
591
587
|
})
|
|
592
588
|
}
|
|
593
589
|
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @internal
|
|
3
|
-
*/
|
|
4
1
|
import * as Effect from "../../../Effect.ts"
|
|
5
2
|
import * as Base64 from "../../../encoding/Base64.ts"
|
|
6
3
|
import * as Match from "../../../Match.ts"
|
|
@@ -10,10 +7,9 @@ import * as McpCore from "../mcpCore.ts"
|
|
|
10
7
|
import * as McpProtocol from "../mcpProtocol.ts"
|
|
11
8
|
import * as McpRuntime from "../mcpRuntime.ts"
|
|
12
9
|
import * as McpSchema from "../mcpSchema/v2024_11_05.ts"
|
|
13
|
-
import * as McpSkills from "../mcpSkills.ts"
|
|
14
10
|
|
|
15
11
|
// Pings can arrive before initialize and do not require a client session.
|
|
16
|
-
const ClientRequestRpcs = McpSchema.ClientRequestRpcs.omit("ping").
|
|
12
|
+
const ClientRequestRpcs = McpSchema.ClientRequestRpcs.omit("ping").middleware(
|
|
17
13
|
PublicMcpSchema.McpServerClientMiddleware
|
|
18
14
|
).add(McpSchema.Ping)
|
|
19
15
|
|
|
@@ -125,7 +121,6 @@ export const protocol = McpProtocol.make({
|
|
|
125
121
|
handlerRpcs: AdapterRpcs,
|
|
126
122
|
makeHandlers: (core, lifecycle) =>
|
|
127
123
|
AdapterRpcs.of({
|
|
128
|
-
...McpSkills.legacyHandlers(core),
|
|
129
124
|
initialize: (request, { client }) =>
|
|
130
125
|
lifecycle.initialize(McpSchema.protocolVersion, profileFromInitialize(request), client.id).pipe(
|
|
131
126
|
Effect.map((result) =>
|
|
@@ -155,11 +150,11 @@ export const protocol = McpProtocol.make({
|
|
|
155
150
|
),
|
|
156
151
|
"notifications/roots/list_changed": (_, { client, headers }) =>
|
|
157
152
|
lifecycle.clientNotification(McpCore.ClientNotification.RootsChanged(), client.id, headers),
|
|
158
|
-
"resources/list": (
|
|
159
|
-
McpProtocol.listForClient(core.resources.list)
|
|
153
|
+
"resources/list": (pageRequest) =>
|
|
154
|
+
McpProtocol.listForClient(core.resources.list, pageRequest?.cursor)
|
|
160
155
|
.pipe(Effect.map((resources) => McpSchema.ListResourcesResult.make({ resources }))),
|
|
161
|
-
"resources/templates/list": (
|
|
162
|
-
McpProtocol.listForClient(core.resources.listTemplates).pipe(
|
|
156
|
+
"resources/templates/list": (pageRequest) =>
|
|
157
|
+
McpProtocol.listForClient(core.resources.listTemplates, pageRequest?.cursor).pipe(
|
|
163
158
|
Effect.map((resourceTemplates) => McpSchema.ListResourceTemplatesResult.make({ resourceTemplates }))
|
|
164
159
|
),
|
|
165
160
|
"resources/read": Effect.fnUntraced(function*({ uri }) {
|
|
@@ -188,8 +183,8 @@ export const protocol = McpProtocol.make({
|
|
|
188
183
|
lifecycle.subscribe(uri, client.id, headers).pipe(Effect.as({})),
|
|
189
184
|
"resources/unsubscribe": ({ uri }, { client, headers }) =>
|
|
190
185
|
lifecycle.unsubscribe(uri, client.id, headers).pipe(Effect.as({})),
|
|
191
|
-
"prompts/list": () =>
|
|
192
|
-
McpProtocol.listForClient(core.prompts.list)
|
|
186
|
+
"prompts/list": (pageRequest) =>
|
|
187
|
+
McpProtocol.listForClient(core.prompts.list, pageRequest?.cursor)
|
|
193
188
|
.pipe(
|
|
194
189
|
Effect.map((prompts) =>
|
|
195
190
|
McpSchema.ListPromptsResult.make({
|
|
@@ -248,8 +243,8 @@ export const protocol = McpProtocol.make({
|
|
|
248
243
|
_meta: result.metadata
|
|
249
244
|
})
|
|
250
245
|
}),
|
|
251
|
-
"tools/list": Effect.fnUntraced(function*() {
|
|
252
|
-
return yield* McpProtocol.listForClient(core.tools.list).pipe(
|
|
246
|
+
"tools/list": Effect.fnUntraced(function*(pageRequest) {
|
|
247
|
+
return yield* McpProtocol.listForClient(core.tools.list, pageRequest?.cursor).pipe(
|
|
253
248
|
Effect.map((tools) =>
|
|
254
249
|
McpSchema.ListToolsResult.make({
|
|
255
250
|
tools: tools.map((tool) =>
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @internal
|
|
3
|
-
*/
|
|
4
1
|
import * as Effect from "../../../Effect.ts"
|
|
5
2
|
import * as Base64 from "../../../encoding/Base64.ts"
|
|
6
3
|
import * as Match from "../../../Match.ts"
|
|
@@ -10,10 +7,9 @@ import * as McpCore from "../mcpCore.ts"
|
|
|
10
7
|
import * as McpProtocol from "../mcpProtocol.ts"
|
|
11
8
|
import * as McpRuntime from "../mcpRuntime.ts"
|
|
12
9
|
import * as McpSchema from "../mcpSchema/v2025_03_26.ts"
|
|
13
|
-
import * as McpSkills from "../mcpSkills.ts"
|
|
14
10
|
|
|
15
11
|
// Pings can arrive before initialize and do not require a client session.
|
|
16
|
-
const ClientRequestRpcs = McpSchema.ClientRequestRpcs.omit("ping").
|
|
12
|
+
const ClientRequestRpcs = McpSchema.ClientRequestRpcs.omit("ping").middleware(
|
|
17
13
|
PublicMcpSchema.McpServerClientMiddleware
|
|
18
14
|
).add(McpSchema.Ping)
|
|
19
15
|
|
|
@@ -128,7 +124,6 @@ export const protocol = McpProtocol.make({
|
|
|
128
124
|
handlerRpcs: AdapterRpcs,
|
|
129
125
|
makeHandlers: (core, lifecycle) =>
|
|
130
126
|
AdapterRpcs.of({
|
|
131
|
-
...McpSkills.legacyHandlers(core),
|
|
132
127
|
initialize: (request, { client }) =>
|
|
133
128
|
lifecycle.initialize(McpSchema.protocolVersion, profileFromInitialize(request), client.id).pipe(
|
|
134
129
|
Effect.map((result) =>
|
|
@@ -167,8 +162,8 @@ export const protocol = McpProtocol.make({
|
|
|
167
162
|
),
|
|
168
163
|
"notifications/roots/list_changed": (_, { client, headers }) =>
|
|
169
164
|
lifecycle.clientNotification(McpCore.ClientNotification.RootsChanged(), client.id, headers),
|
|
170
|
-
"resources/list": (
|
|
171
|
-
McpProtocol.listForClient(core.resources.list)
|
|
165
|
+
"resources/list": (pageRequest) =>
|
|
166
|
+
McpProtocol.listForClient(core.resources.list, pageRequest?.cursor)
|
|
172
167
|
.pipe(
|
|
173
168
|
Effect.map((resources) =>
|
|
174
169
|
McpSchema.ListResourcesResult.make({
|
|
@@ -183,8 +178,8 @@ export const protocol = McpProtocol.make({
|
|
|
183
178
|
})
|
|
184
179
|
)
|
|
185
180
|
),
|
|
186
|
-
"resources/templates/list": (
|
|
187
|
-
McpProtocol.listForClient(core.resources.listTemplates).pipe(
|
|
181
|
+
"resources/templates/list": (pageRequest) =>
|
|
182
|
+
McpProtocol.listForClient(core.resources.listTemplates, pageRequest?.cursor).pipe(
|
|
188
183
|
Effect.map((resourceTemplates) =>
|
|
189
184
|
McpSchema.ListResourceTemplatesResult.make({
|
|
190
185
|
resourceTemplates: resourceTemplates.map((template) => ({
|
|
@@ -211,8 +206,8 @@ export const protocol = McpProtocol.make({
|
|
|
211
206
|
lifecycle.subscribe(uri, client.id, headers).pipe(Effect.as({})),
|
|
212
207
|
"resources/unsubscribe": ({ uri }, { client, headers }) =>
|
|
213
208
|
lifecycle.unsubscribe(uri, client.id, headers).pipe(Effect.as({})),
|
|
214
|
-
"prompts/list": (
|
|
215
|
-
McpProtocol.listForClient(core.prompts.list)
|
|
209
|
+
"prompts/list": (pageRequest) =>
|
|
210
|
+
McpProtocol.listForClient(core.prompts.list, pageRequest?.cursor)
|
|
216
211
|
.pipe(
|
|
217
212
|
Effect.map((prompts) =>
|
|
218
213
|
McpSchema.ListPromptsResult.make({
|
|
@@ -271,8 +266,8 @@ export const protocol = McpProtocol.make({
|
|
|
271
266
|
_meta: result.metadata
|
|
272
267
|
})
|
|
273
268
|
}),
|
|
274
|
-
"tools/list": Effect.fnUntraced(function*() {
|
|
275
|
-
const tools = yield* McpProtocol.listForClient(core.tools.list)
|
|
269
|
+
"tools/list": Effect.fnUntraced(function*(pageRequest) {
|
|
270
|
+
const tools = yield* McpProtocol.listForClient(core.tools.list, pageRequest?.cursor)
|
|
276
271
|
return McpSchema.ListToolsResult.make({
|
|
277
272
|
tools: tools.map((tool) =>
|
|
278
273
|
McpSchema.Tool.make({
|
|
@@ -9,10 +9,9 @@ import * as McpCore from "../mcpCore.ts"
|
|
|
9
9
|
import * as McpProtocol from "../mcpProtocol.ts"
|
|
10
10
|
import * as McpRuntime from "../mcpRuntime.ts"
|
|
11
11
|
import * as McpSchema from "../mcpSchema/v2025_06_18.ts"
|
|
12
|
-
import * as McpSkills from "../mcpSkills.ts"
|
|
13
12
|
|
|
14
13
|
// Pings can arrive before initialize and do not require a client session.
|
|
15
|
-
const ClientRequestRpcs = McpSchema.ClientRequestRpcs.omit("ping").
|
|
14
|
+
const ClientRequestRpcs = McpSchema.ClientRequestRpcs.omit("ping").middleware(
|
|
16
15
|
PublicMcpSchema.McpServerClientMiddleware
|
|
17
16
|
).add(McpSchema.Ping)
|
|
18
17
|
|
|
@@ -144,7 +143,6 @@ export const protocol = McpProtocol.make({
|
|
|
144
143
|
handlerRpcs: AdapterRpcs,
|
|
145
144
|
makeHandlers: (core, lifecycle) =>
|
|
146
145
|
AdapterRpcs.of({
|
|
147
|
-
...McpSkills.legacyHandlers(core),
|
|
148
146
|
initialize: (request, { client }) =>
|
|
149
147
|
lifecycle.initialize(McpSchema.protocolVersion, profileFromInitialize(request), client.id).pipe(
|
|
150
148
|
Effect.map((result) =>
|
|
@@ -183,13 +181,13 @@ export const protocol = McpProtocol.make({
|
|
|
183
181
|
),
|
|
184
182
|
"notifications/roots/list_changed": (_, { client, headers }) =>
|
|
185
183
|
lifecycle.clientNotification(McpCore.ClientNotification.RootsChanged(), client.id, headers),
|
|
186
|
-
"resources/list": (
|
|
187
|
-
McpProtocol.listForClient(core.resources.list)
|
|
184
|
+
"resources/list": (pageRequest) =>
|
|
185
|
+
McpProtocol.listForClient(core.resources.list, pageRequest?.cursor)
|
|
188
186
|
.pipe(
|
|
189
187
|
Effect.map((resources) => McpSchema.ListResourcesResult.make({ resources }))
|
|
190
188
|
),
|
|
191
|
-
"resources/templates/list": (
|
|
192
|
-
McpProtocol.listForClient(core.resources.listTemplates).pipe(
|
|
189
|
+
"resources/templates/list": (pageRequest) =>
|
|
190
|
+
McpProtocol.listForClient(core.resources.listTemplates, pageRequest?.cursor).pipe(
|
|
193
191
|
Effect.map((resourceTemplates) => McpSchema.ListResourceTemplatesResult.make({ resourceTemplates }))
|
|
194
192
|
),
|
|
195
193
|
"resources/read": Effect.fnUntraced(function*({ uri }) {
|
|
@@ -206,8 +204,8 @@ export const protocol = McpProtocol.make({
|
|
|
206
204
|
lifecycle.subscribe(uri, client.id, headers).pipe(Effect.as({})),
|
|
207
205
|
"resources/unsubscribe": ({ uri }, { client, headers }) =>
|
|
208
206
|
lifecycle.unsubscribe(uri, client.id, headers).pipe(Effect.as({})),
|
|
209
|
-
"prompts/list": (
|
|
210
|
-
McpProtocol.listForClient(core.prompts.list)
|
|
207
|
+
"prompts/list": (pageRequest) =>
|
|
208
|
+
McpProtocol.listForClient(core.prompts.list, pageRequest?.cursor)
|
|
211
209
|
.pipe(
|
|
212
210
|
Effect.map((prompts) => McpSchema.ListPromptsResult.make({ prompts }))
|
|
213
211
|
),
|
|
@@ -261,8 +259,8 @@ export const protocol = McpProtocol.make({
|
|
|
261
259
|
_meta: result.metadata
|
|
262
260
|
})
|
|
263
261
|
}),
|
|
264
|
-
"tools/list": Effect.fnUntraced(function*() {
|
|
265
|
-
const tools = yield* McpProtocol.listForClient(core.tools.list)
|
|
262
|
+
"tools/list": Effect.fnUntraced(function*(pageRequest) {
|
|
263
|
+
const tools = yield* McpProtocol.listForClient(core.tools.list, pageRequest?.cursor)
|
|
266
264
|
return McpSchema.ListToolsResult.make({
|
|
267
265
|
tools: tools.map((tool) =>
|
|
268
266
|
McpSchema.Tool.make({
|
|
@@ -8,10 +8,9 @@ import * as McpCore from "../mcpCore.ts"
|
|
|
8
8
|
import * as McpProtocol from "../mcpProtocol.ts"
|
|
9
9
|
import * as McpRuntime from "../mcpRuntime.ts"
|
|
10
10
|
import * as McpSchema from "../mcpSchema/v2025_11_25.ts"
|
|
11
|
-
import * as McpSkills from "../mcpSkills.ts"
|
|
12
11
|
|
|
13
12
|
// Pings can arrive before initialize and do not require a client session.
|
|
14
|
-
const ClientRequestRpcs = McpSchema.ClientRequestRpcs.omit("ping").
|
|
13
|
+
const ClientRequestRpcs = McpSchema.ClientRequestRpcs.omit("ping").middleware(
|
|
15
14
|
PublicMcpSchema.McpServerClientMiddleware
|
|
16
15
|
).add(McpSchema.Ping)
|
|
17
16
|
|
|
@@ -134,7 +133,6 @@ export const protocol = McpProtocol.make({
|
|
|
134
133
|
handlerRpcs: AdapterRpcs,
|
|
135
134
|
makeHandlers: (core, lifecycle) =>
|
|
136
135
|
AdapterRpcs.of({
|
|
137
|
-
...McpSkills.legacyHandlers(core),
|
|
138
136
|
initialize: (request, { client }) =>
|
|
139
137
|
lifecycle.initialize(McpSchema.protocolVersion, {
|
|
140
138
|
protocolVersion: McpSchema.protocolVersion,
|
|
@@ -178,8 +176,8 @@ export const protocol = McpProtocol.make({
|
|
|
178
176
|
),
|
|
179
177
|
"notifications/roots/list_changed": (_, { client, headers }) =>
|
|
180
178
|
lifecycle.clientNotification(McpCore.ClientNotification.RootsChanged(), client.id, headers),
|
|
181
|
-
"resources/list": () =>
|
|
182
|
-
McpProtocol.listForClient(core.resources.list)
|
|
179
|
+
"resources/list": (pageRequest) =>
|
|
180
|
+
McpProtocol.listForClient(core.resources.list, pageRequest?.cursor)
|
|
183
181
|
.pipe(
|
|
184
182
|
Effect.map((resources) =>
|
|
185
183
|
McpSchema.ListResourcesResult.make({
|
|
@@ -187,8 +185,8 @@ export const protocol = McpProtocol.make({
|
|
|
187
185
|
})
|
|
188
186
|
)
|
|
189
187
|
),
|
|
190
|
-
"resources/templates/list": () =>
|
|
191
|
-
McpProtocol.listForClient(core.resources.listTemplates).pipe(
|
|
188
|
+
"resources/templates/list": (pageRequest) =>
|
|
189
|
+
McpProtocol.listForClient(core.resources.listTemplates, pageRequest?.cursor).pipe(
|
|
192
190
|
Effect.map((resourceTemplates) =>
|
|
193
191
|
McpSchema.ListResourceTemplatesResult.make({
|
|
194
192
|
resourceTemplates: resourceTemplates.map((resourceTemplate) =>
|
|
@@ -225,8 +223,8 @@ export const protocol = McpProtocol.make({
|
|
|
225
223
|
lifecycle.subscribe(uri, client.id, headers).pipe(Effect.as({})),
|
|
226
224
|
"resources/unsubscribe": ({ uri }, { client, headers }) =>
|
|
227
225
|
lifecycle.unsubscribe(uri, client.id, headers).pipe(Effect.as({})),
|
|
228
|
-
"prompts/list": () =>
|
|
229
|
-
McpProtocol.listForClient(core.prompts.list)
|
|
226
|
+
"prompts/list": (pageRequest) =>
|
|
227
|
+
McpProtocol.listForClient(core.prompts.list, pageRequest?.cursor)
|
|
230
228
|
.pipe(
|
|
231
229
|
Effect.map((prompts) =>
|
|
232
230
|
McpSchema.ListPromptsResult.make({
|
|
@@ -284,8 +282,8 @@ export const protocol = McpProtocol.make({
|
|
|
284
282
|
_meta: result.metadata
|
|
285
283
|
})
|
|
286
284
|
}),
|
|
287
|
-
"tools/list": Effect.fnUntraced(function*() {
|
|
288
|
-
const tools = yield* McpProtocol.listForClient(core.tools.list)
|
|
285
|
+
"tools/list": Effect.fnUntraced(function*(pageRequest) {
|
|
286
|
+
const tools = yield* McpProtocol.listForClient(core.tools.list, pageRequest?.cursor)
|
|
289
287
|
return McpSchema.ListToolsResult.make({
|
|
290
288
|
tools: tools.map((tool) =>
|
|
291
289
|
McpSchema.Tool.make({
|