effect 4.1.2 → 4.1.4
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 +26 -3
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +13 -2
- 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 +31 -5
- 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 +24 -5
- package/dist/ai/LanguageModel.d.ts.map +1 -1
- package/dist/ai/LanguageModel.js +26 -12
- package/dist/ai/LanguageModel.js.map +1 -1
- package/dist/ai/McpSchema.d.ts +110 -110
- package/dist/ai/McpSchema.d.ts.map +1 -1
- package/dist/ai/McpServer.d.ts +15 -0
- package/dist/ai/McpServer.d.ts.map +1 -1
- package/dist/ai/McpServer.js +211 -33
- 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/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 +20 -0
- package/dist/ai/index.d.ts.map +1 -1
- package/dist/ai/index.js +20 -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 +5 -8
- package/dist/ai/internal/mcpProtocol/v2024_11_05.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2025_03_26.js +5 -8
- package/dist/ai/internal/mcpProtocol/v2025_03_26.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2025_06_18.js +5 -5
- package/dist/ai/internal/mcpProtocol/v2025_06_18.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2025_11_25.js +5 -5
- 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 +2 -0
- 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 +5 -17
- 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 +5 -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 +88 -10
- 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/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/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.d.ts.map +1 -1
- package/dist/http/HttpMiddleware.js +5 -3
- 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/internal/requestState.js +15 -0
- package/dist/http/internal/requestState.js.map +1 -1
- package/dist/http-api/HttpApi.d.ts +47 -0
- package/dist/http-api/HttpApi.d.ts.map +1 -1
- package/dist/http-api/HttpApi.js +66 -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 +18 -2
- 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 +5 -1
- package/dist/http-api/HttpApiClient.js.map +1 -1
- package/dist/http-api/HttpApiSchema.d.ts +85 -0
- package/dist/http-api/HttpApiSchema.d.ts.map +1 -1
- package/dist/http-api/HttpApiSchema.js +74 -2
- 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 +161 -36
- 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/toCodeDocument.js +3 -0
- package/dist/internal/schema/toCodeDocument.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 +179 -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 +31 -3
- 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 +87 -19
- package/src/ai/LanguageModel.ts +97 -23
- package/src/ai/McpServer.ts +244 -49
- 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/WorkloadIdentity.ts +318 -0
- package/src/ai/index.ts +24 -0
- package/src/ai/internal/mcpCore.ts +11 -15
- package/src/ai/internal/mcpProtocol/v2024_11_05.ts +8 -11
- package/src/ai/internal/mcpProtocol/v2025_03_26.ts +8 -11
- package/src/ai/internal/mcpProtocol/v2025_06_18.ts +8 -8
- package/src/ai/internal/mcpProtocol/v2025_11_25.ts +8 -8
- 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 +4 -2
- 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 +5 -20
- package/src/ai/internal/mcpStatefulRuntime.ts +0 -2
- package/src/ai/internal/structured-output.ts +7 -2
- package/src/cli/Argument.ts +86 -0
- package/src/cli/CliError.ts +7 -4
- package/src/cli/Command.ts +266 -36
- 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/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/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 +15 -4
- package/src/http/HttpServer.ts +80 -0
- package/src/http/HttpServerRequest.ts +1 -19
- package/src/http/HttpStaticServer.ts +10 -16
- package/src/http/internal/requestState.ts +20 -0
- package/src/http-api/HttpApi.ts +80 -0
- package/src/http-api/HttpApiBuilder.ts +20 -2
- package/src/http-api/HttpApiClient.ts +13 -2
- package/src/http-api/HttpApiSchema.ts +90 -3
- 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 +175 -35
- package/src/internal/schema/interpreter.ts +10 -10
- package/src/internal/schema/parser.ts +8 -4
- package/src/internal/schema/toCodeDocument.ts +8 -0
- 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
|
@@ -0,0 +1,974 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Defines schemas for the Agent User Interaction (AG-UI) protocol.
|
|
3
|
+
*
|
|
4
|
+
* AG-UI connects an agent backend to a user-facing application: the
|
|
5
|
+
* application posts a `RunAgentInput` and the agent answers with a stream of
|
|
6
|
+
* events describing the run. These schemas follow the AG-UI 1.0 specification
|
|
7
|
+
* and describe the request body, the conversation messages it carries, and
|
|
8
|
+
* every event type. Converting to and from `effect/ai` values lives in `AgUi`,
|
|
9
|
+
* and the HTTP binding lives in `AgUiServer`.
|
|
10
|
+
*
|
|
11
|
+
* @see https://docs.ag-ui.com
|
|
12
|
+
*
|
|
13
|
+
* @stability experimental
|
|
14
|
+
* @since 4.1.0
|
|
15
|
+
*/
|
|
16
|
+
import * as Effect from "../Effect.js";
|
|
17
|
+
import { identity } from "../Function.js";
|
|
18
|
+
import * as Predicate from "../Predicate.js";
|
|
19
|
+
import * as Schema from "../Schema.js";
|
|
20
|
+
import * as SchemaTransformation from "../SchemaTransformation.js";
|
|
21
|
+
/**
|
|
22
|
+
* AG-UI protocol version implemented by these schemas.
|
|
23
|
+
*
|
|
24
|
+
* @stability experimental
|
|
25
|
+
* @category constants
|
|
26
|
+
* @since 4.1.0
|
|
27
|
+
*/
|
|
28
|
+
export const protocolVersion = "1.0";
|
|
29
|
+
// =============================================================================
|
|
30
|
+
// Shared
|
|
31
|
+
// =============================================================================
|
|
32
|
+
/**
|
|
33
|
+
* Schema for open-ended metadata attached to events, messages, tools, and
|
|
34
|
+
* other protocol values.
|
|
35
|
+
*
|
|
36
|
+
* **Details**
|
|
37
|
+
*
|
|
38
|
+
* The `ag-ui` key is reserved for the protocol's own use.
|
|
39
|
+
*
|
|
40
|
+
* @stability experimental
|
|
41
|
+
* @category schemas
|
|
42
|
+
* @since 4.1.0
|
|
43
|
+
*/
|
|
44
|
+
export const Metadata = /*#__PURE__*/Schema.Record(Schema.String, Schema.Unknown);
|
|
45
|
+
const baseEventFields = {
|
|
46
|
+
timestamp: /*#__PURE__*/Schema.optionalKey(Schema.Int),
|
|
47
|
+
rawEvent: /*#__PURE__*/Schema.optionalKey(Schema.Unknown),
|
|
48
|
+
metadata: /*#__PURE__*/Schema.optionalKey(Metadata)
|
|
49
|
+
};
|
|
50
|
+
const subagentEventFields = {
|
|
51
|
+
...baseEventFields,
|
|
52
|
+
subagentRunId: /*#__PURE__*/Schema.optionalKey(Schema.String)
|
|
53
|
+
};
|
|
54
|
+
const TokenCount = /*#__PURE__*/Schema.Int.check(/*#__PURE__*/Schema.isGreaterThanOrEqualTo(0));
|
|
55
|
+
// AG-UI consumers remove list elements they do not recognise, such as union
|
|
56
|
+
// members or closed-set values added by a newer protocol version, instead of
|
|
57
|
+
// rejecting the value holding them. Recognised but malformed elements still
|
|
58
|
+
// fail to decode.
|
|
59
|
+
const withoutUnknownMembers = (item, isUnknown) => {
|
|
60
|
+
// Accepts only unrecognised material, so it never hides a malformed item.
|
|
61
|
+
// JSON Schema and OpenAPI document the canonical model: a union splices in
|
|
62
|
+
// a member that is only an `anyOf`, so an empty one leaves just the item's
|
|
63
|
+
// variants and generated clients keep their discriminated types.
|
|
64
|
+
const Unrecognised = Schema.Any.check(Schema.makeFilter(isUnknown, {
|
|
65
|
+
toJsonSchema: () => ({
|
|
66
|
+
anyOf: []
|
|
67
|
+
})
|
|
68
|
+
}));
|
|
69
|
+
return Schema.Array(Schema.Union([item, Unrecognised])).pipe(Schema.decodeTo(Schema.Array(Schema.toType(item)), SchemaTransformation.transform({
|
|
70
|
+
decode: values => values.filter(value => !isUnknown(value)),
|
|
71
|
+
encode: identity
|
|
72
|
+
})));
|
|
73
|
+
};
|
|
74
|
+
// Only a string outside the closed set is unrecognised; a missing or
|
|
75
|
+
// mistyped value is malformed
|
|
76
|
+
const hasUnknownTag = (value, key, tags) => Predicate.isObject(value) && typeof value[key] === "string" && !tags.has(value[key]);
|
|
77
|
+
// =============================================================================
|
|
78
|
+
// Content
|
|
79
|
+
// =============================================================================
|
|
80
|
+
/**
|
|
81
|
+
* Schema for media bytes carried inline as base64 data.
|
|
82
|
+
*
|
|
83
|
+
* @stability experimental
|
|
84
|
+
* @category schemas
|
|
85
|
+
* @since 4.1.0
|
|
86
|
+
*/
|
|
87
|
+
export const DataSource = /*#__PURE__*/Schema.Struct({
|
|
88
|
+
type: /*#__PURE__*/Schema.Literal("data"),
|
|
89
|
+
value: Schema.String,
|
|
90
|
+
mimeType: Schema.String
|
|
91
|
+
});
|
|
92
|
+
/**
|
|
93
|
+
* Schema for media bytes referenced by URL.
|
|
94
|
+
*
|
|
95
|
+
* @stability experimental
|
|
96
|
+
* @category schemas
|
|
97
|
+
* @since 4.1.0
|
|
98
|
+
*/
|
|
99
|
+
export const UrlSource = /*#__PURE__*/Schema.Struct({
|
|
100
|
+
type: /*#__PURE__*/Schema.Literal("url"),
|
|
101
|
+
value: Schema.String,
|
|
102
|
+
mimeType: /*#__PURE__*/Schema.optionalKey(Schema.String)
|
|
103
|
+
});
|
|
104
|
+
/**
|
|
105
|
+
* Schema for media bytes already stored at a provider and named by a handle
|
|
106
|
+
* that provider issued.
|
|
107
|
+
*
|
|
108
|
+
* @stability experimental
|
|
109
|
+
* @category schemas
|
|
110
|
+
* @since 4.1.0
|
|
111
|
+
*/
|
|
112
|
+
export const FileSource = /*#__PURE__*/Schema.Struct({
|
|
113
|
+
type: /*#__PURE__*/Schema.Literal("file"),
|
|
114
|
+
value: Schema.String,
|
|
115
|
+
provider: /*#__PURE__*/Schema.optionalKey(Schema.String),
|
|
116
|
+
mimeType: /*#__PURE__*/Schema.optionalKey(Schema.String)
|
|
117
|
+
});
|
|
118
|
+
/**
|
|
119
|
+
* Schema for the source of a media content part.
|
|
120
|
+
*
|
|
121
|
+
* @stability experimental
|
|
122
|
+
* @category schemas
|
|
123
|
+
* @since 4.1.0
|
|
124
|
+
*/
|
|
125
|
+
export const PartSource = /*#__PURE__*/Schema.Union([DataSource, UrlSource, FileSource]);
|
|
126
|
+
/**
|
|
127
|
+
* Schema for a text content part.
|
|
128
|
+
*
|
|
129
|
+
* @stability experimental
|
|
130
|
+
* @category schemas
|
|
131
|
+
* @since 4.1.0
|
|
132
|
+
*/
|
|
133
|
+
export const TextPart = /*#__PURE__*/Schema.Struct({
|
|
134
|
+
type: /*#__PURE__*/Schema.Literal("text"),
|
|
135
|
+
id: /*#__PURE__*/Schema.optionalKey(Schema.String),
|
|
136
|
+
text: Schema.String,
|
|
137
|
+
metadata: /*#__PURE__*/Schema.optionalKey(Schema.Unknown)
|
|
138
|
+
});
|
|
139
|
+
const mediaPart = type => Schema.Struct({
|
|
140
|
+
type: Schema.Literal(type),
|
|
141
|
+
id: Schema.optionalKey(Schema.String),
|
|
142
|
+
source: PartSource,
|
|
143
|
+
metadata: Schema.optionalKey(Schema.Unknown)
|
|
144
|
+
});
|
|
145
|
+
/**
|
|
146
|
+
* Schema for an image content part.
|
|
147
|
+
*
|
|
148
|
+
* @stability experimental
|
|
149
|
+
* @category schemas
|
|
150
|
+
* @since 4.1.0
|
|
151
|
+
*/
|
|
152
|
+
export const ImagePart = /*#__PURE__*/mediaPart("image");
|
|
153
|
+
/**
|
|
154
|
+
* Schema for an audio content part.
|
|
155
|
+
*
|
|
156
|
+
* @stability experimental
|
|
157
|
+
* @category schemas
|
|
158
|
+
* @since 4.1.0
|
|
159
|
+
*/
|
|
160
|
+
export const AudioPart = /*#__PURE__*/mediaPart("audio");
|
|
161
|
+
/**
|
|
162
|
+
* Schema for a video content part.
|
|
163
|
+
*
|
|
164
|
+
* @stability experimental
|
|
165
|
+
* @category schemas
|
|
166
|
+
* @since 4.1.0
|
|
167
|
+
*/
|
|
168
|
+
export const VideoPart = /*#__PURE__*/mediaPart("video");
|
|
169
|
+
/**
|
|
170
|
+
* Schema for a document content part.
|
|
171
|
+
*
|
|
172
|
+
* @stability experimental
|
|
173
|
+
* @category schemas
|
|
174
|
+
* @since 4.1.0
|
|
175
|
+
*/
|
|
176
|
+
export const DocumentPart = /*#__PURE__*/mediaPart("document");
|
|
177
|
+
/**
|
|
178
|
+
* Schema for any content part of a user or tool message.
|
|
179
|
+
*
|
|
180
|
+
* @stability experimental
|
|
181
|
+
* @category schemas
|
|
182
|
+
* @since 4.1.0
|
|
183
|
+
*/
|
|
184
|
+
export const ContentPart = /*#__PURE__*/Schema.Union([TextPart, ImagePart, AudioPart, VideoPart, DocumentPart]);
|
|
185
|
+
const contentPartTypes = /*#__PURE__*/new Set(["text", "image", "audio", "video", "document"]);
|
|
186
|
+
const partSourceTypes = /*#__PURE__*/new Set(["data", "url", "file"]);
|
|
187
|
+
const mediaPartTypes = /*#__PURE__*/new Set(["image", "audio", "video", "document"]);
|
|
188
|
+
// A recognised media part whose required source is unrecognised is removed
|
|
189
|
+
// with it
|
|
190
|
+
const isUnknownContentPart = value => hasUnknownTag(value, "type", contentPartTypes) || Predicate.isObject(value) && mediaPartTypes.has(value.type) && hasUnknownTag(value.source, "type", partSourceTypes);
|
|
191
|
+
const Content = /*#__PURE__*/Schema.Union([Schema.String, /*#__PURE__*/withoutUnknownMembers(ContentPart, isUnknownContentPart)]);
|
|
192
|
+
// =============================================================================
|
|
193
|
+
// Messages
|
|
194
|
+
// =============================================================================
|
|
195
|
+
const messageFields = {
|
|
196
|
+
subagentRunId: /*#__PURE__*/Schema.optionalKey(Schema.String),
|
|
197
|
+
id: Schema.String,
|
|
198
|
+
metadata: /*#__PURE__*/Schema.optionalKey(Metadata)
|
|
199
|
+
};
|
|
200
|
+
/**
|
|
201
|
+
* Schema for instructions from the application developer.
|
|
202
|
+
*
|
|
203
|
+
* @stability experimental
|
|
204
|
+
* @category schemas
|
|
205
|
+
* @since 4.1.0
|
|
206
|
+
*/
|
|
207
|
+
export const DeveloperMessage = /*#__PURE__*/Schema.Struct({
|
|
208
|
+
...messageFields,
|
|
209
|
+
role: /*#__PURE__*/Schema.Literal("developer"),
|
|
210
|
+
name: /*#__PURE__*/Schema.optionalKey(Schema.String),
|
|
211
|
+
encryptedValue: /*#__PURE__*/Schema.optionalKey(Schema.String),
|
|
212
|
+
content: Schema.String
|
|
213
|
+
});
|
|
214
|
+
/**
|
|
215
|
+
* Schema for instructions from the system.
|
|
216
|
+
*
|
|
217
|
+
* @stability experimental
|
|
218
|
+
* @category schemas
|
|
219
|
+
* @since 4.1.0
|
|
220
|
+
*/
|
|
221
|
+
export const SystemMessage = /*#__PURE__*/Schema.Struct({
|
|
222
|
+
...messageFields,
|
|
223
|
+
role: /*#__PURE__*/Schema.Literal("system"),
|
|
224
|
+
name: /*#__PURE__*/Schema.optionalKey(Schema.String),
|
|
225
|
+
encryptedValue: /*#__PURE__*/Schema.optionalKey(Schema.String),
|
|
226
|
+
content: Schema.String
|
|
227
|
+
});
|
|
228
|
+
/**
|
|
229
|
+
* Schema for a tool call made by an assistant message.
|
|
230
|
+
*
|
|
231
|
+
* **Details**
|
|
232
|
+
*
|
|
233
|
+
* `function.arguments` is the JSON text of the call's arguments.
|
|
234
|
+
*
|
|
235
|
+
* @stability experimental
|
|
236
|
+
* @category schemas
|
|
237
|
+
* @since 4.1.0
|
|
238
|
+
*/
|
|
239
|
+
export const ToolCall = /*#__PURE__*/Schema.Struct({
|
|
240
|
+
id: Schema.String,
|
|
241
|
+
type: /*#__PURE__*/Schema.Literal("function"),
|
|
242
|
+
function: /*#__PURE__*/Schema.Struct({
|
|
243
|
+
name: Schema.String,
|
|
244
|
+
arguments: Schema.String
|
|
245
|
+
}),
|
|
246
|
+
encryptedValue: /*#__PURE__*/Schema.optionalKey(Schema.String),
|
|
247
|
+
metadata: /*#__PURE__*/Schema.optionalKey(Metadata)
|
|
248
|
+
});
|
|
249
|
+
const toolCallTypes = /*#__PURE__*/new Set(["function"]);
|
|
250
|
+
/**
|
|
251
|
+
* Schema for a message from the agent.
|
|
252
|
+
*
|
|
253
|
+
* @stability experimental
|
|
254
|
+
* @category schemas
|
|
255
|
+
* @since 4.1.0
|
|
256
|
+
*/
|
|
257
|
+
export const AssistantMessage = /*#__PURE__*/Schema.Struct({
|
|
258
|
+
...messageFields,
|
|
259
|
+
role: /*#__PURE__*/Schema.Literal("assistant"),
|
|
260
|
+
name: /*#__PURE__*/Schema.optionalKey(Schema.String),
|
|
261
|
+
encryptedValue: /*#__PURE__*/Schema.optionalKey(Schema.String),
|
|
262
|
+
content: /*#__PURE__*/Schema.optionalKey(Schema.String),
|
|
263
|
+
toolCalls: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/withoutUnknownMembers(ToolCall, value => hasUnknownTag(value, "type", toolCallTypes)))
|
|
264
|
+
});
|
|
265
|
+
/**
|
|
266
|
+
* Schema for a message from the person using the application.
|
|
267
|
+
*
|
|
268
|
+
* @stability experimental
|
|
269
|
+
* @category schemas
|
|
270
|
+
* @since 4.1.0
|
|
271
|
+
*/
|
|
272
|
+
export const UserMessage = /*#__PURE__*/Schema.Struct({
|
|
273
|
+
...messageFields,
|
|
274
|
+
role: /*#__PURE__*/Schema.Literal("user"),
|
|
275
|
+
name: /*#__PURE__*/Schema.optionalKey(Schema.String),
|
|
276
|
+
encryptedValue: /*#__PURE__*/Schema.optionalKey(Schema.String),
|
|
277
|
+
content: Content
|
|
278
|
+
});
|
|
279
|
+
/**
|
|
280
|
+
* Schema for the result of a tool call, as a message in the conversation.
|
|
281
|
+
*
|
|
282
|
+
* **Details**
|
|
283
|
+
*
|
|
284
|
+
* `error` is present when the tool call failed.
|
|
285
|
+
*
|
|
286
|
+
* @stability experimental
|
|
287
|
+
* @category schemas
|
|
288
|
+
* @since 4.1.0
|
|
289
|
+
*/
|
|
290
|
+
export const ToolMessage = /*#__PURE__*/Schema.Struct({
|
|
291
|
+
...messageFields,
|
|
292
|
+
role: /*#__PURE__*/Schema.Literal("tool"),
|
|
293
|
+
content: Content,
|
|
294
|
+
toolCallId: Schema.String,
|
|
295
|
+
error: /*#__PURE__*/Schema.optionalKey(Schema.String),
|
|
296
|
+
encryptedValue: /*#__PURE__*/Schema.optionalKey(Schema.String)
|
|
297
|
+
});
|
|
298
|
+
/**
|
|
299
|
+
* Schema for structured progress kept in the conversation as a message.
|
|
300
|
+
*
|
|
301
|
+
* @stability experimental
|
|
302
|
+
* @category schemas
|
|
303
|
+
* @since 4.1.0
|
|
304
|
+
*/
|
|
305
|
+
export const ActivityMessage = /*#__PURE__*/Schema.Struct({
|
|
306
|
+
...messageFields,
|
|
307
|
+
role: /*#__PURE__*/Schema.Literal("activity"),
|
|
308
|
+
activityType: Schema.String,
|
|
309
|
+
content: /*#__PURE__*/Schema.Record(Schema.String, Schema.Unknown)
|
|
310
|
+
});
|
|
311
|
+
/**
|
|
312
|
+
* Schema for a span of the agent's reasoning, kept in the conversation as a
|
|
313
|
+
* message.
|
|
314
|
+
*
|
|
315
|
+
* @stability experimental
|
|
316
|
+
* @category schemas
|
|
317
|
+
* @since 4.1.0
|
|
318
|
+
*/
|
|
319
|
+
export const ReasoningMessage = /*#__PURE__*/Schema.Struct({
|
|
320
|
+
...messageFields,
|
|
321
|
+
role: /*#__PURE__*/Schema.Literal("reasoning"),
|
|
322
|
+
content: Schema.String,
|
|
323
|
+
encryptedValue: /*#__PURE__*/Schema.optionalKey(Schema.String)
|
|
324
|
+
});
|
|
325
|
+
/**
|
|
326
|
+
* Schema for any message in an AG-UI conversation, discriminated by `role`.
|
|
327
|
+
*
|
|
328
|
+
* @stability experimental
|
|
329
|
+
* @category schemas
|
|
330
|
+
* @since 4.1.0
|
|
331
|
+
*/
|
|
332
|
+
export const Message = /*#__PURE__*/Schema.Union([DeveloperMessage, SystemMessage, AssistantMessage, UserMessage, ToolMessage, ActivityMessage, ReasoningMessage]);
|
|
333
|
+
const messageRoles = /*#__PURE__*/new Set(["developer", "system", "assistant", "user", "tool", "activity", "reasoning"]);
|
|
334
|
+
const Messages = /*#__PURE__*/withoutUnknownMembers(Message, value => hasUnknownTag(value, "role", messageRoles));
|
|
335
|
+
// =============================================================================
|
|
336
|
+
// Run input
|
|
337
|
+
// =============================================================================
|
|
338
|
+
/**
|
|
339
|
+
* Schema for a tool the application offers to the agent.
|
|
340
|
+
*
|
|
341
|
+
* **Details**
|
|
342
|
+
*
|
|
343
|
+
* `parameters` is a JSON Schema describing the tool's arguments.
|
|
344
|
+
*
|
|
345
|
+
* @stability experimental
|
|
346
|
+
* @category schemas
|
|
347
|
+
* @since 4.1.0
|
|
348
|
+
*/
|
|
349
|
+
export const Tool = /*#__PURE__*/Schema.Struct({
|
|
350
|
+
name: Schema.String,
|
|
351
|
+
description: Schema.String,
|
|
352
|
+
parameters: /*#__PURE__*/Schema.optionalKey(Schema.Unknown),
|
|
353
|
+
metadata: /*#__PURE__*/Schema.optionalKey(Metadata)
|
|
354
|
+
});
|
|
355
|
+
/**
|
|
356
|
+
* Schema for a named piece of ambient information given to the agent for a
|
|
357
|
+
* run.
|
|
358
|
+
*
|
|
359
|
+
* @stability experimental
|
|
360
|
+
* @category schemas
|
|
361
|
+
* @since 4.1.0
|
|
362
|
+
*/
|
|
363
|
+
export const Context = /*#__PURE__*/Schema.Struct({
|
|
364
|
+
description: Schema.String,
|
|
365
|
+
value: Schema.String
|
|
366
|
+
});
|
|
367
|
+
/**
|
|
368
|
+
* Schema for an answer to an interrupt, sent on the run that continues from
|
|
369
|
+
* it.
|
|
370
|
+
*
|
|
371
|
+
* @stability experimental
|
|
372
|
+
* @category schemas
|
|
373
|
+
* @since 4.1.0
|
|
374
|
+
*/
|
|
375
|
+
export const ResumeEntry = /*#__PURE__*/Schema.Struct({
|
|
376
|
+
interruptId: Schema.String,
|
|
377
|
+
status: /*#__PURE__*/Schema.Literals(["resolved", "cancelled"]),
|
|
378
|
+
payload: /*#__PURE__*/Schema.optionalKey(Schema.Unknown),
|
|
379
|
+
metadata: /*#__PURE__*/Schema.optionalKey(Metadata)
|
|
380
|
+
});
|
|
381
|
+
const resumeStatuses = /*#__PURE__*/new Set(["resolved", "cancelled"]);
|
|
382
|
+
/**
|
|
383
|
+
* Schema for the request body that starts an agent run.
|
|
384
|
+
*
|
|
385
|
+
* **Details**
|
|
386
|
+
*
|
|
387
|
+
* `messages` is the complete conversation so far, which lets an agent serve
|
|
388
|
+
* runs without keeping its own history. Missing `tools` and `context` decode
|
|
389
|
+
* to empty arrays. As AG-UI requires, messages, content parts, tool calls,
|
|
390
|
+
* and resume entries of kinds or statuses this version does not recognise are
|
|
391
|
+
* removed during decoding rather than rejected.
|
|
392
|
+
*
|
|
393
|
+
* **Gotchas**
|
|
394
|
+
*
|
|
395
|
+
* Every field comes from the client. Treat messages, tools, and context as
|
|
396
|
+
* untrusted input.
|
|
397
|
+
*
|
|
398
|
+
* @stability experimental
|
|
399
|
+
* @category schemas
|
|
400
|
+
* @since 4.1.0
|
|
401
|
+
*/
|
|
402
|
+
export const RunAgentInput = /*#__PURE__*/Schema.Struct({
|
|
403
|
+
threadId: Schema.String,
|
|
404
|
+
runId: Schema.String,
|
|
405
|
+
protocolVersion: /*#__PURE__*/Schema.optionalKey(Schema.String),
|
|
406
|
+
parentRunId: /*#__PURE__*/Schema.optionalKey(Schema.String),
|
|
407
|
+
state: /*#__PURE__*/Schema.optionalKey(Schema.Unknown),
|
|
408
|
+
messages: Messages,
|
|
409
|
+
tools: /*#__PURE__*/Schema.Array(Tool).pipe(/*#__PURE__*/Schema.withDecodingDefaultTypeKey(/*#__PURE__*/Effect.succeed([]))),
|
|
410
|
+
context: /*#__PURE__*/Schema.Array(Context).pipe(/*#__PURE__*/Schema.withDecodingDefaultTypeKey(/*#__PURE__*/Effect.succeed([]))),
|
|
411
|
+
forwardedProps: /*#__PURE__*/Schema.optionalKey(Schema.Unknown),
|
|
412
|
+
resume: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/withoutUnknownMembers(ResumeEntry, value => hasUnknownTag(value, "status", resumeStatuses)))
|
|
413
|
+
});
|
|
414
|
+
// =============================================================================
|
|
415
|
+
// Text message events
|
|
416
|
+
// =============================================================================
|
|
417
|
+
/**
|
|
418
|
+
* Schema for the role of a streamed text message.
|
|
419
|
+
*
|
|
420
|
+
* @stability experimental
|
|
421
|
+
* @category schemas
|
|
422
|
+
* @since 4.1.0
|
|
423
|
+
*/
|
|
424
|
+
export const TextMessageRole = /*#__PURE__*/Schema.Literals(["developer", "system", "assistant", "user"]);
|
|
425
|
+
/**
|
|
426
|
+
* Schema for the event that opens a streamed text message.
|
|
427
|
+
*
|
|
428
|
+
* @stability experimental
|
|
429
|
+
* @category schemas
|
|
430
|
+
* @since 4.1.0
|
|
431
|
+
*/
|
|
432
|
+
export const TextMessageStartEvent = /*#__PURE__*/Schema.Struct({
|
|
433
|
+
type: /*#__PURE__*/Schema.Literal("TEXT_MESSAGE_START"),
|
|
434
|
+
...subagentEventFields,
|
|
435
|
+
messageId: Schema.String,
|
|
436
|
+
role: /*#__PURE__*/Schema.optionalKey(TextMessageRole),
|
|
437
|
+
name: /*#__PURE__*/Schema.optionalKey(Schema.String)
|
|
438
|
+
});
|
|
439
|
+
/**
|
|
440
|
+
* Schema for the event that appends a fragment to a streamed text message.
|
|
441
|
+
*
|
|
442
|
+
* @stability experimental
|
|
443
|
+
* @category schemas
|
|
444
|
+
* @since 4.1.0
|
|
445
|
+
*/
|
|
446
|
+
export const TextMessageContentEvent = /*#__PURE__*/Schema.Struct({
|
|
447
|
+
type: /*#__PURE__*/Schema.Literal("TEXT_MESSAGE_CONTENT"),
|
|
448
|
+
...subagentEventFields,
|
|
449
|
+
messageId: Schema.String,
|
|
450
|
+
delta: Schema.String
|
|
451
|
+
});
|
|
452
|
+
/**
|
|
453
|
+
* Schema for the event that closes a streamed text message.
|
|
454
|
+
*
|
|
455
|
+
* @stability experimental
|
|
456
|
+
* @category schemas
|
|
457
|
+
* @since 4.1.0
|
|
458
|
+
*/
|
|
459
|
+
export const TextMessageEndEvent = /*#__PURE__*/Schema.Struct({
|
|
460
|
+
type: /*#__PURE__*/Schema.Literal("TEXT_MESSAGE_END"),
|
|
461
|
+
...subagentEventFields,
|
|
462
|
+
messageId: Schema.String
|
|
463
|
+
});
|
|
464
|
+
/**
|
|
465
|
+
* Schema for the shorthand event that stands in for a text message's start,
|
|
466
|
+
* content, and end sequence.
|
|
467
|
+
*
|
|
468
|
+
* @stability experimental
|
|
469
|
+
* @category schemas
|
|
470
|
+
* @since 4.1.0
|
|
471
|
+
*/
|
|
472
|
+
export const TextMessageChunkEvent = /*#__PURE__*/Schema.Struct({
|
|
473
|
+
type: /*#__PURE__*/Schema.Literal("TEXT_MESSAGE_CHUNK"),
|
|
474
|
+
...subagentEventFields,
|
|
475
|
+
messageId: /*#__PURE__*/Schema.optionalKey(Schema.String),
|
|
476
|
+
role: /*#__PURE__*/Schema.optionalKey(TextMessageRole),
|
|
477
|
+
delta: /*#__PURE__*/Schema.optionalKey(Schema.String),
|
|
478
|
+
name: /*#__PURE__*/Schema.optionalKey(Schema.String)
|
|
479
|
+
});
|
|
480
|
+
// =============================================================================
|
|
481
|
+
// Tool call events
|
|
482
|
+
// =============================================================================
|
|
483
|
+
/**
|
|
484
|
+
* Schema for the event that opens a tool call.
|
|
485
|
+
*
|
|
486
|
+
* @stability experimental
|
|
487
|
+
* @category schemas
|
|
488
|
+
* @since 4.1.0
|
|
489
|
+
*/
|
|
490
|
+
export const ToolCallStartEvent = /*#__PURE__*/Schema.Struct({
|
|
491
|
+
type: /*#__PURE__*/Schema.Literal("TOOL_CALL_START"),
|
|
492
|
+
...subagentEventFields,
|
|
493
|
+
toolCallId: Schema.String,
|
|
494
|
+
toolCallName: Schema.String,
|
|
495
|
+
parentMessageId: /*#__PURE__*/Schema.optionalKey(Schema.String)
|
|
496
|
+
});
|
|
497
|
+
/**
|
|
498
|
+
* Schema for the event that appends a fragment of a tool call's JSON
|
|
499
|
+
* arguments.
|
|
500
|
+
*
|
|
501
|
+
* @stability experimental
|
|
502
|
+
* @category schemas
|
|
503
|
+
* @since 4.1.0
|
|
504
|
+
*/
|
|
505
|
+
export const ToolCallArgsEvent = /*#__PURE__*/Schema.Struct({
|
|
506
|
+
type: /*#__PURE__*/Schema.Literal("TOOL_CALL_ARGS"),
|
|
507
|
+
...subagentEventFields,
|
|
508
|
+
toolCallId: Schema.String,
|
|
509
|
+
delta: Schema.String
|
|
510
|
+
});
|
|
511
|
+
/**
|
|
512
|
+
* Schema for the event that closes a tool call once its arguments are
|
|
513
|
+
* complete.
|
|
514
|
+
*
|
|
515
|
+
* @stability experimental
|
|
516
|
+
* @category schemas
|
|
517
|
+
* @since 4.1.0
|
|
518
|
+
*/
|
|
519
|
+
export const ToolCallEndEvent = /*#__PURE__*/Schema.Struct({
|
|
520
|
+
type: /*#__PURE__*/Schema.Literal("TOOL_CALL_END"),
|
|
521
|
+
...subagentEventFields,
|
|
522
|
+
toolCallId: Schema.String
|
|
523
|
+
});
|
|
524
|
+
/**
|
|
525
|
+
* Schema for the shorthand event that stands in for a tool call's start,
|
|
526
|
+
* arguments, and end sequence.
|
|
527
|
+
*
|
|
528
|
+
* @stability experimental
|
|
529
|
+
* @category schemas
|
|
530
|
+
* @since 4.1.0
|
|
531
|
+
*/
|
|
532
|
+
export const ToolCallChunkEvent = /*#__PURE__*/Schema.Struct({
|
|
533
|
+
type: /*#__PURE__*/Schema.Literal("TOOL_CALL_CHUNK"),
|
|
534
|
+
...subagentEventFields,
|
|
535
|
+
toolCallId: /*#__PURE__*/Schema.optionalKey(Schema.String),
|
|
536
|
+
toolCallName: /*#__PURE__*/Schema.optionalKey(Schema.String),
|
|
537
|
+
parentMessageId: /*#__PURE__*/Schema.optionalKey(Schema.String),
|
|
538
|
+
delta: /*#__PURE__*/Schema.optionalKey(Schema.String)
|
|
539
|
+
});
|
|
540
|
+
/**
|
|
541
|
+
* Schema for the event that delivers the result of a tool call as a new tool
|
|
542
|
+
* message.
|
|
543
|
+
*
|
|
544
|
+
* @stability experimental
|
|
545
|
+
* @category schemas
|
|
546
|
+
* @since 4.1.0
|
|
547
|
+
*/
|
|
548
|
+
export const ToolCallResultEvent = /*#__PURE__*/Schema.Struct({
|
|
549
|
+
type: /*#__PURE__*/Schema.Literal("TOOL_CALL_RESULT"),
|
|
550
|
+
...subagentEventFields,
|
|
551
|
+
messageId: Schema.String,
|
|
552
|
+
toolCallId: Schema.String,
|
|
553
|
+
content: Content,
|
|
554
|
+
role: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.Literal("tool"))
|
|
555
|
+
});
|
|
556
|
+
// =============================================================================
|
|
557
|
+
// State and activity events
|
|
558
|
+
// =============================================================================
|
|
559
|
+
/**
|
|
560
|
+
* Schema for one RFC 6902 JSON Patch operation.
|
|
561
|
+
*
|
|
562
|
+
* @stability experimental
|
|
563
|
+
* @category schemas
|
|
564
|
+
* @since 4.1.0
|
|
565
|
+
*/
|
|
566
|
+
export const JsonPatchOperation = /*#__PURE__*/Schema.Union([/*#__PURE__*/Schema.Struct({
|
|
567
|
+
op: /*#__PURE__*/Schema.Literal("add"),
|
|
568
|
+
path: Schema.String,
|
|
569
|
+
value: Schema.Unknown
|
|
570
|
+
}), /*#__PURE__*/Schema.Struct({
|
|
571
|
+
op: /*#__PURE__*/Schema.Literal("remove"),
|
|
572
|
+
path: Schema.String
|
|
573
|
+
}), /*#__PURE__*/Schema.Struct({
|
|
574
|
+
op: /*#__PURE__*/Schema.Literal("replace"),
|
|
575
|
+
path: Schema.String,
|
|
576
|
+
value: Schema.Unknown
|
|
577
|
+
}), /*#__PURE__*/Schema.Struct({
|
|
578
|
+
op: /*#__PURE__*/Schema.Literal("move"),
|
|
579
|
+
from: Schema.String,
|
|
580
|
+
path: Schema.String
|
|
581
|
+
}), /*#__PURE__*/Schema.Struct({
|
|
582
|
+
op: /*#__PURE__*/Schema.Literal("copy"),
|
|
583
|
+
from: Schema.String,
|
|
584
|
+
path: Schema.String
|
|
585
|
+
}), /*#__PURE__*/Schema.Struct({
|
|
586
|
+
op: /*#__PURE__*/Schema.Literal("test"),
|
|
587
|
+
path: Schema.String,
|
|
588
|
+
value: Schema.Unknown
|
|
589
|
+
})]);
|
|
590
|
+
/**
|
|
591
|
+
* Schema for the event that replaces the agent state.
|
|
592
|
+
*
|
|
593
|
+
* @stability experimental
|
|
594
|
+
* @category schemas
|
|
595
|
+
* @since 4.1.0
|
|
596
|
+
*/
|
|
597
|
+
export const StateSnapshotEvent = /*#__PURE__*/Schema.Struct({
|
|
598
|
+
type: /*#__PURE__*/Schema.Literal("STATE_SNAPSHOT"),
|
|
599
|
+
...subagentEventFields,
|
|
600
|
+
snapshot: Schema.Unknown
|
|
601
|
+
});
|
|
602
|
+
/**
|
|
603
|
+
* Schema for the event that applies a JSON Patch to the agent state.
|
|
604
|
+
*
|
|
605
|
+
* @stability experimental
|
|
606
|
+
* @category schemas
|
|
607
|
+
* @since 4.1.0
|
|
608
|
+
*/
|
|
609
|
+
export const StateDeltaEvent = /*#__PURE__*/Schema.Struct({
|
|
610
|
+
type: /*#__PURE__*/Schema.Literal("STATE_DELTA"),
|
|
611
|
+
...subagentEventFields,
|
|
612
|
+
delta: /*#__PURE__*/Schema.Array(JsonPatchOperation)
|
|
613
|
+
});
|
|
614
|
+
/**
|
|
615
|
+
* Schema for the event that replaces the conversation the agent owns.
|
|
616
|
+
*
|
|
617
|
+
* @stability experimental
|
|
618
|
+
* @category schemas
|
|
619
|
+
* @since 4.1.0
|
|
620
|
+
*/
|
|
621
|
+
export const MessagesSnapshotEvent = /*#__PURE__*/Schema.Struct({
|
|
622
|
+
type: /*#__PURE__*/Schema.Literal("MESSAGES_SNAPSHOT"),
|
|
623
|
+
...baseEventFields,
|
|
624
|
+
messages: Messages
|
|
625
|
+
});
|
|
626
|
+
/**
|
|
627
|
+
* Schema for the event that sets the content of an activity message.
|
|
628
|
+
*
|
|
629
|
+
* @stability experimental
|
|
630
|
+
* @category schemas
|
|
631
|
+
* @since 4.1.0
|
|
632
|
+
*/
|
|
633
|
+
export const ActivitySnapshotEvent = /*#__PURE__*/Schema.Struct({
|
|
634
|
+
type: /*#__PURE__*/Schema.Literal("ACTIVITY_SNAPSHOT"),
|
|
635
|
+
...subagentEventFields,
|
|
636
|
+
messageId: Schema.String,
|
|
637
|
+
activityType: Schema.String,
|
|
638
|
+
content: /*#__PURE__*/Schema.Record(Schema.String, Schema.Unknown),
|
|
639
|
+
replace: /*#__PURE__*/Schema.optionalKey(Schema.Boolean)
|
|
640
|
+
});
|
|
641
|
+
/**
|
|
642
|
+
* Schema for the event that applies a JSON Patch to an activity message.
|
|
643
|
+
*
|
|
644
|
+
* @stability experimental
|
|
645
|
+
* @category schemas
|
|
646
|
+
* @since 4.1.0
|
|
647
|
+
*/
|
|
648
|
+
export const ActivityDeltaEvent = /*#__PURE__*/Schema.Struct({
|
|
649
|
+
type: /*#__PURE__*/Schema.Literal("ACTIVITY_DELTA"),
|
|
650
|
+
...subagentEventFields,
|
|
651
|
+
messageId: Schema.String,
|
|
652
|
+
activityType: Schema.String,
|
|
653
|
+
patch: /*#__PURE__*/Schema.Array(JsonPatchOperation)
|
|
654
|
+
});
|
|
655
|
+
// =============================================================================
|
|
656
|
+
// Special events
|
|
657
|
+
// =============================================================================
|
|
658
|
+
/**
|
|
659
|
+
* Schema for the event that passes through an event from an external system.
|
|
660
|
+
*
|
|
661
|
+
* @stability experimental
|
|
662
|
+
* @category schemas
|
|
663
|
+
* @since 4.1.0
|
|
664
|
+
*/
|
|
665
|
+
export const RawEvent = /*#__PURE__*/Schema.Struct({
|
|
666
|
+
type: /*#__PURE__*/Schema.Literal("RAW"),
|
|
667
|
+
...subagentEventFields,
|
|
668
|
+
event: Schema.Unknown,
|
|
669
|
+
source: /*#__PURE__*/Schema.optionalKey(Schema.String)
|
|
670
|
+
});
|
|
671
|
+
/**
|
|
672
|
+
* Schema for an application-defined event.
|
|
673
|
+
*
|
|
674
|
+
* @stability experimental
|
|
675
|
+
* @category schemas
|
|
676
|
+
* @since 4.1.0
|
|
677
|
+
*/
|
|
678
|
+
export const CustomEvent = /*#__PURE__*/Schema.Struct({
|
|
679
|
+
type: /*#__PURE__*/Schema.Literal("CUSTOM"),
|
|
680
|
+
...subagentEventFields,
|
|
681
|
+
name: Schema.String,
|
|
682
|
+
value: Schema.Unknown
|
|
683
|
+
});
|
|
684
|
+
// =============================================================================
|
|
685
|
+
// Lifecycle events
|
|
686
|
+
// =============================================================================
|
|
687
|
+
/**
|
|
688
|
+
* Schema for the event that opens a run.
|
|
689
|
+
*
|
|
690
|
+
* @stability experimental
|
|
691
|
+
* @category schemas
|
|
692
|
+
* @since 4.1.0
|
|
693
|
+
*/
|
|
694
|
+
export const RunStartedEvent = /*#__PURE__*/Schema.Struct({
|
|
695
|
+
type: /*#__PURE__*/Schema.Literal("RUN_STARTED"),
|
|
696
|
+
...baseEventFields,
|
|
697
|
+
threadId: Schema.String,
|
|
698
|
+
runId: Schema.String,
|
|
699
|
+
protocolVersion: /*#__PURE__*/Schema.optionalKey(Schema.String),
|
|
700
|
+
parentRunId: /*#__PURE__*/Schema.optionalKey(Schema.String),
|
|
701
|
+
input: /*#__PURE__*/Schema.optionalKey(RunAgentInput)
|
|
702
|
+
});
|
|
703
|
+
/**
|
|
704
|
+
* Schema for something a run needs from outside before it can continue, such
|
|
705
|
+
* as an approval.
|
|
706
|
+
*
|
|
707
|
+
* @stability experimental
|
|
708
|
+
* @category schemas
|
|
709
|
+
* @since 4.1.0
|
|
710
|
+
*/
|
|
711
|
+
export const Interrupt = /*#__PURE__*/Schema.Struct({
|
|
712
|
+
subagentRunId: /*#__PURE__*/Schema.optionalKey(Schema.String),
|
|
713
|
+
id: Schema.String,
|
|
714
|
+
reason: Schema.String,
|
|
715
|
+
message: /*#__PURE__*/Schema.optionalKey(Schema.String),
|
|
716
|
+
toolCallId: /*#__PURE__*/Schema.optionalKey(Schema.String),
|
|
717
|
+
responseSchema: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.Record(Schema.String, Schema.Unknown)),
|
|
718
|
+
expiresAt: /*#__PURE__*/Schema.optionalKey(Schema.String),
|
|
719
|
+
metadata: /*#__PURE__*/Schema.optionalKey(Metadata)
|
|
720
|
+
});
|
|
721
|
+
/**
|
|
722
|
+
* Schema for why a run ended.
|
|
723
|
+
*
|
|
724
|
+
* **Details**
|
|
725
|
+
*
|
|
726
|
+
* A `success` outcome may name frontend tool calls the application still has
|
|
727
|
+
* to answer. An `interrupt` outcome pauses the run until a later run resumes
|
|
728
|
+
* it.
|
|
729
|
+
*
|
|
730
|
+
* @stability experimental
|
|
731
|
+
* @category schemas
|
|
732
|
+
* @since 4.1.0
|
|
733
|
+
*/
|
|
734
|
+
export const RunFinishedOutcome = /*#__PURE__*/Schema.Union([/*#__PURE__*/Schema.Struct({
|
|
735
|
+
type: /*#__PURE__*/Schema.Literal("success"),
|
|
736
|
+
pendingToolCallIds: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.Array(Schema.String))
|
|
737
|
+
}), /*#__PURE__*/Schema.Struct({
|
|
738
|
+
type: /*#__PURE__*/Schema.Literal("interrupt"),
|
|
739
|
+
interrupts: /*#__PURE__*/Schema.NonEmptyArray(Interrupt)
|
|
740
|
+
}), /*#__PURE__*/Schema.Struct({
|
|
741
|
+
type: /*#__PURE__*/Schema.Literal("cancelled")
|
|
742
|
+
})]);
|
|
743
|
+
/**
|
|
744
|
+
* Schema for token counts reported for one provider and model.
|
|
745
|
+
*
|
|
746
|
+
* @stability experimental
|
|
747
|
+
* @category schemas
|
|
748
|
+
* @since 4.1.0
|
|
749
|
+
*/
|
|
750
|
+
export const TokenUsage = /*#__PURE__*/Schema.Struct({
|
|
751
|
+
provider: /*#__PURE__*/Schema.optionalKey(Schema.String),
|
|
752
|
+
model: /*#__PURE__*/Schema.optionalKey(Schema.String),
|
|
753
|
+
inputTokens: /*#__PURE__*/Schema.optionalKey(TokenCount),
|
|
754
|
+
outputTokens: /*#__PURE__*/Schema.optionalKey(TokenCount),
|
|
755
|
+
totalTokens: /*#__PURE__*/Schema.optionalKey(TokenCount),
|
|
756
|
+
reasoningTokens: /*#__PURE__*/Schema.optionalKey(TokenCount),
|
|
757
|
+
cachedInputTokens: /*#__PURE__*/Schema.optionalKey(TokenCount),
|
|
758
|
+
cacheWriteInputTokens: /*#__PURE__*/Schema.optionalKey(TokenCount)
|
|
759
|
+
});
|
|
760
|
+
/**
|
|
761
|
+
* Schema for the event that closes a run that did not fail.
|
|
762
|
+
*
|
|
763
|
+
* @stability experimental
|
|
764
|
+
* @category schemas
|
|
765
|
+
* @since 4.1.0
|
|
766
|
+
*/
|
|
767
|
+
export const RunFinishedEvent = /*#__PURE__*/Schema.Struct({
|
|
768
|
+
type: /*#__PURE__*/Schema.Literal("RUN_FINISHED"),
|
|
769
|
+
...baseEventFields,
|
|
770
|
+
threadId: Schema.String,
|
|
771
|
+
runId: Schema.String,
|
|
772
|
+
result: /*#__PURE__*/Schema.optionalKey(Schema.Unknown),
|
|
773
|
+
outcome: /*#__PURE__*/Schema.optionalKey(RunFinishedOutcome),
|
|
774
|
+
usage: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.Array(TokenUsage))
|
|
775
|
+
});
|
|
776
|
+
/**
|
|
777
|
+
* Schema for the event that ends a run that failed.
|
|
778
|
+
*
|
|
779
|
+
* @stability experimental
|
|
780
|
+
* @category schemas
|
|
781
|
+
* @since 4.1.0
|
|
782
|
+
*/
|
|
783
|
+
export const RunErrorEvent = /*#__PURE__*/Schema.Struct({
|
|
784
|
+
type: /*#__PURE__*/Schema.Literal("RUN_ERROR"),
|
|
785
|
+
...baseEventFields,
|
|
786
|
+
message: Schema.String,
|
|
787
|
+
code: /*#__PURE__*/Schema.optionalKey(Schema.String),
|
|
788
|
+
usage: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.Array(TokenUsage))
|
|
789
|
+
});
|
|
790
|
+
/**
|
|
791
|
+
* Schema for the event that opens a named step within a run.
|
|
792
|
+
*
|
|
793
|
+
* @stability experimental
|
|
794
|
+
* @category schemas
|
|
795
|
+
* @since 4.1.0
|
|
796
|
+
*/
|
|
797
|
+
export const StepStartedEvent = /*#__PURE__*/Schema.Struct({
|
|
798
|
+
type: /*#__PURE__*/Schema.Literal("STEP_STARTED"),
|
|
799
|
+
...subagentEventFields,
|
|
800
|
+
stepName: Schema.String
|
|
801
|
+
});
|
|
802
|
+
/**
|
|
803
|
+
* Schema for the event that closes a named step.
|
|
804
|
+
*
|
|
805
|
+
* @stability experimental
|
|
806
|
+
* @category schemas
|
|
807
|
+
* @since 4.1.0
|
|
808
|
+
*/
|
|
809
|
+
export const StepFinishedEvent = /*#__PURE__*/Schema.Struct({
|
|
810
|
+
type: /*#__PURE__*/Schema.Literal("STEP_FINISHED"),
|
|
811
|
+
...subagentEventFields,
|
|
812
|
+
stepName: Schema.String
|
|
813
|
+
});
|
|
814
|
+
// =============================================================================
|
|
815
|
+
// Reasoning events
|
|
816
|
+
// =============================================================================
|
|
817
|
+
/**
|
|
818
|
+
* Schema for the event that opens a span of reasoning.
|
|
819
|
+
*
|
|
820
|
+
* @stability experimental
|
|
821
|
+
* @category schemas
|
|
822
|
+
* @since 4.1.0
|
|
823
|
+
*/
|
|
824
|
+
export const ReasoningStartEvent = /*#__PURE__*/Schema.Struct({
|
|
825
|
+
type: /*#__PURE__*/Schema.Literal("REASONING_START"),
|
|
826
|
+
...subagentEventFields,
|
|
827
|
+
messageId: Schema.String
|
|
828
|
+
});
|
|
829
|
+
/**
|
|
830
|
+
* Schema for the event that opens a streamed reasoning message.
|
|
831
|
+
*
|
|
832
|
+
* @stability experimental
|
|
833
|
+
* @category schemas
|
|
834
|
+
* @since 4.1.0
|
|
835
|
+
*/
|
|
836
|
+
export const ReasoningMessageStartEvent = /*#__PURE__*/Schema.Struct({
|
|
837
|
+
type: /*#__PURE__*/Schema.Literal("REASONING_MESSAGE_START"),
|
|
838
|
+
...subagentEventFields,
|
|
839
|
+
messageId: Schema.String,
|
|
840
|
+
role: /*#__PURE__*/Schema.Literal("reasoning")
|
|
841
|
+
});
|
|
842
|
+
/**
|
|
843
|
+
* Schema for the event that appends a fragment to a streamed reasoning
|
|
844
|
+
* message.
|
|
845
|
+
*
|
|
846
|
+
* @stability experimental
|
|
847
|
+
* @category schemas
|
|
848
|
+
* @since 4.1.0
|
|
849
|
+
*/
|
|
850
|
+
export const ReasoningMessageContentEvent = /*#__PURE__*/Schema.Struct({
|
|
851
|
+
type: /*#__PURE__*/Schema.Literal("REASONING_MESSAGE_CONTENT"),
|
|
852
|
+
...subagentEventFields,
|
|
853
|
+
messageId: Schema.String,
|
|
854
|
+
delta: Schema.String
|
|
855
|
+
});
|
|
856
|
+
/**
|
|
857
|
+
* Schema for the event that closes a streamed reasoning message.
|
|
858
|
+
*
|
|
859
|
+
* @stability experimental
|
|
860
|
+
* @category schemas
|
|
861
|
+
* @since 4.1.0
|
|
862
|
+
*/
|
|
863
|
+
export const ReasoningMessageEndEvent = /*#__PURE__*/Schema.Struct({
|
|
864
|
+
type: /*#__PURE__*/Schema.Literal("REASONING_MESSAGE_END"),
|
|
865
|
+
...subagentEventFields,
|
|
866
|
+
messageId: Schema.String
|
|
867
|
+
});
|
|
868
|
+
/**
|
|
869
|
+
* Schema for the shorthand event that stands in for a reasoning message's
|
|
870
|
+
* start, content, and end sequence.
|
|
871
|
+
*
|
|
872
|
+
* @stability experimental
|
|
873
|
+
* @category schemas
|
|
874
|
+
* @since 4.1.0
|
|
875
|
+
*/
|
|
876
|
+
export const ReasoningMessageChunkEvent = /*#__PURE__*/Schema.Struct({
|
|
877
|
+
type: /*#__PURE__*/Schema.Literal("REASONING_MESSAGE_CHUNK"),
|
|
878
|
+
...subagentEventFields,
|
|
879
|
+
messageId: /*#__PURE__*/Schema.optionalKey(Schema.String),
|
|
880
|
+
delta: /*#__PURE__*/Schema.optionalKey(Schema.String)
|
|
881
|
+
});
|
|
882
|
+
/**
|
|
883
|
+
* Schema for the event that closes a span of reasoning.
|
|
884
|
+
*
|
|
885
|
+
* @stability experimental
|
|
886
|
+
* @category schemas
|
|
887
|
+
* @since 4.1.0
|
|
888
|
+
*/
|
|
889
|
+
export const ReasoningEndEvent = /*#__PURE__*/Schema.Struct({
|
|
890
|
+
type: /*#__PURE__*/Schema.Literal("REASONING_END"),
|
|
891
|
+
...subagentEventFields,
|
|
892
|
+
messageId: Schema.String
|
|
893
|
+
});
|
|
894
|
+
/**
|
|
895
|
+
* Schema for the event that attaches provider-encrypted reasoning to a message
|
|
896
|
+
* or tool call.
|
|
897
|
+
*
|
|
898
|
+
* @stability experimental
|
|
899
|
+
* @category schemas
|
|
900
|
+
* @since 4.1.0
|
|
901
|
+
*/
|
|
902
|
+
export const ReasoningEncryptedValueEvent = /*#__PURE__*/Schema.Struct({
|
|
903
|
+
type: /*#__PURE__*/Schema.Literal("REASONING_ENCRYPTED_VALUE"),
|
|
904
|
+
...subagentEventFields,
|
|
905
|
+
subtype: /*#__PURE__*/Schema.Literals(["tool-call", "message"]),
|
|
906
|
+
entityId: Schema.String,
|
|
907
|
+
encryptedValue: Schema.String
|
|
908
|
+
});
|
|
909
|
+
// =============================================================================
|
|
910
|
+
// Subagent events
|
|
911
|
+
// =============================================================================
|
|
912
|
+
/**
|
|
913
|
+
* Schema for the event that opens a subagent invocation within a run.
|
|
914
|
+
*
|
|
915
|
+
* @stability experimental
|
|
916
|
+
* @category schemas
|
|
917
|
+
* @since 4.1.0
|
|
918
|
+
*/
|
|
919
|
+
export const SubagentStartedEvent = /*#__PURE__*/Schema.Struct({
|
|
920
|
+
type: /*#__PURE__*/Schema.Literal("SUBAGENT_STARTED"),
|
|
921
|
+
...baseEventFields,
|
|
922
|
+
subagentRunId: Schema.String,
|
|
923
|
+
name: Schema.String,
|
|
924
|
+
description: /*#__PURE__*/Schema.optionalKey(Schema.String),
|
|
925
|
+
parentSubagentRunId: /*#__PURE__*/Schema.optionalKey(Schema.String),
|
|
926
|
+
parentToolCallId: /*#__PURE__*/Schema.optionalKey(Schema.String),
|
|
927
|
+
parentMessageId: /*#__PURE__*/Schema.optionalKey(Schema.String)
|
|
928
|
+
});
|
|
929
|
+
/**
|
|
930
|
+
* Schema for the event that closes a subagent invocation that did not fail.
|
|
931
|
+
*
|
|
932
|
+
* @stability experimental
|
|
933
|
+
* @category schemas
|
|
934
|
+
* @since 4.1.0
|
|
935
|
+
*/
|
|
936
|
+
export const SubagentFinishedEvent = /*#__PURE__*/Schema.Struct({
|
|
937
|
+
type: /*#__PURE__*/Schema.Literal("SUBAGENT_FINISHED"),
|
|
938
|
+
...baseEventFields,
|
|
939
|
+
subagentRunId: Schema.String,
|
|
940
|
+
result: /*#__PURE__*/Schema.optionalKey(Schema.Unknown),
|
|
941
|
+
outcome: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.Union([/*#__PURE__*/Schema.Struct({
|
|
942
|
+
type: /*#__PURE__*/Schema.Literal("success")
|
|
943
|
+
}), /*#__PURE__*/Schema.Struct({
|
|
944
|
+
type: /*#__PURE__*/Schema.Literal("suspended"),
|
|
945
|
+
interruptIds: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.Array(Schema.String))
|
|
946
|
+
})]))
|
|
947
|
+
});
|
|
948
|
+
/**
|
|
949
|
+
* Schema for the event that reports a failed subagent invocation without
|
|
950
|
+
* ending the run.
|
|
951
|
+
*
|
|
952
|
+
* @stability experimental
|
|
953
|
+
* @category schemas
|
|
954
|
+
* @since 4.1.0
|
|
955
|
+
*/
|
|
956
|
+
export const SubagentErrorEvent = /*#__PURE__*/Schema.Struct({
|
|
957
|
+
type: /*#__PURE__*/Schema.Literal("SUBAGENT_ERROR"),
|
|
958
|
+
...baseEventFields,
|
|
959
|
+
subagentRunId: Schema.String,
|
|
960
|
+
message: Schema.String,
|
|
961
|
+
code: /*#__PURE__*/Schema.optionalKey(Schema.String)
|
|
962
|
+
});
|
|
963
|
+
// =============================================================================
|
|
964
|
+
// Events
|
|
965
|
+
// =============================================================================
|
|
966
|
+
/**
|
|
967
|
+
* Schema for any AG-UI event, discriminated by `type`.
|
|
968
|
+
*
|
|
969
|
+
* @stability experimental
|
|
970
|
+
* @category schemas
|
|
971
|
+
* @since 4.1.0
|
|
972
|
+
*/
|
|
973
|
+
export const Event = /*#__PURE__*/Schema.Union([TextMessageStartEvent, TextMessageContentEvent, TextMessageEndEvent, TextMessageChunkEvent, ToolCallStartEvent, ToolCallArgsEvent, ToolCallEndEvent, ToolCallChunkEvent, ToolCallResultEvent, StateSnapshotEvent, StateDeltaEvent, MessagesSnapshotEvent, ActivitySnapshotEvent, ActivityDeltaEvent, RawEvent, CustomEvent, RunStartedEvent, RunFinishedEvent, RunErrorEvent, StepStartedEvent, StepFinishedEvent, ReasoningStartEvent, ReasoningMessageStartEvent, ReasoningMessageContentEvent, ReasoningMessageEndEvent, ReasoningMessageChunkEvent, ReasoningEndEvent, ReasoningEncryptedValueEvent, SubagentStartedEvent, SubagentFinishedEvent, SubagentErrorEvent]);
|
|
974
|
+
//# sourceMappingURL=AgUiSchema.js.map
|