@artinet/sdk 0.5.18 → 0.6.0-preview.2
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/README.md +36 -617
- package/dist/browser/browser.d.ts +1 -1
- package/dist/browser/browser.js +1 -1
- package/dist/browser/client/a2a-client.d.ts +19 -18
- package/dist/browser/client/a2a-client.js +20 -8
- package/dist/browser/config/index.d.ts +158 -0
- package/dist/browser/config/index.js +155 -0
- package/dist/browser/config/observability.d.ts +119 -0
- package/dist/browser/config/observability.js +35 -0
- package/dist/browser/create/agentcard-builder.d.ts +47 -0
- package/dist/browser/create/agentcard-builder.js +65 -0
- package/dist/browser/create/base.d.ts +4 -0
- package/dist/browser/create/describe.d.ts +8 -0
- package/dist/browser/create/describe.js +8 -0
- package/dist/browser/create/message-builder.d.ts +78 -0
- package/dist/browser/create/message-builder.js +108 -0
- package/dist/browser/create/part-builder.d.ts +60 -0
- package/dist/browser/create/part-builder.js +81 -0
- package/dist/browser/create/task-builder.d.ts +251 -0
- package/dist/browser/create/task-builder.js +379 -0
- package/dist/browser/transport/rpc/parser.d.ts +2 -2
- package/dist/browser/transport/rpc/parser.js +7 -6
- package/dist/browser/transport/rpc/rpc-client.d.ts +5 -5
- package/dist/browser/transport/rpc/rpc-client.js +6 -6
- package/dist/browser/transport/streaming/event-stream.d.ts +3 -3
- package/dist/browser/transport/streaming/event-stream.js +11 -10
- package/dist/browser/types/a2a/a2a.d.ts +382 -0
- package/dist/browser/types/a2a/a2a.js +14 -0
- package/dist/browser/types/a2a/index.d.ts +5 -0
- package/dist/browser/types/a2a/index.js +1 -0
- package/dist/browser/types/{interfaces/client.d.ts → client.d.ts} +25 -27
- package/dist/browser/types/core/core.d.ts +31 -0
- package/dist/browser/types/core/index.d.ts +1 -0
- package/dist/browser/types/core/index.js +1 -0
- package/dist/browser/types/index.d.ts +6 -3
- package/dist/browser/types/index.js +6 -3
- package/dist/browser/types/mcp/index.d.ts +1 -0
- package/dist/browser/types/mcp/index.js +1 -0
- package/dist/{types/interfaces/services/mcp/service.d.ts → browser/types/mcp/mcp.d.ts} +4 -3
- package/dist/browser/types/{interfaces/services/a2a/builder.js → mcp/mcp.js} +1 -1
- package/dist/browser/types/storage.d.ts +21 -0
- package/dist/browser/utils/common/constants.d.ts +2 -7
- package/dist/browser/utils/common/constants.js +5 -32
- package/dist/browser/utils/common/errors.d.ts +74 -18
- package/dist/browser/utils/common/errors.js +81 -28
- package/dist/browser/utils/common/utils.d.ts +23 -0
- package/dist/browser/utils/common/utils.js +32 -0
- package/dist/client/a2a-client.d.ts +19 -18
- package/dist/client/a2a-client.js +20 -8
- package/dist/config/default.d.ts +50 -0
- package/dist/config/default.js +62 -0
- package/dist/config/index.d.ts +158 -0
- package/dist/config/index.js +155 -0
- package/dist/config/observability.d.ts +119 -0
- package/dist/config/observability.js +35 -0
- package/dist/create/agent-builder.d.ts +77 -0
- package/dist/create/agent-builder.js +20 -0
- package/dist/create/agentcard-builder.d.ts +47 -0
- package/dist/create/agentcard-builder.js +66 -0
- package/dist/create/base.d.ts +4 -0
- package/dist/create/base.js +1 -0
- package/dist/create/create.d.ts +762 -0
- package/dist/create/create.js +556 -0
- package/dist/create/describe.d.ts +8 -0
- package/dist/create/describe.js +8 -0
- package/dist/create/index.d.ts +4 -0
- package/dist/create/index.js +4 -0
- package/dist/create/message-builder.d.ts +78 -0
- package/dist/create/message-builder.js +110 -0
- package/dist/create/part-builder.d.ts +60 -0
- package/dist/create/part-builder.js +84 -0
- package/dist/create/status-builder.d.ts +26 -0
- package/dist/create/status-builder.js +46 -0
- package/dist/create/task-builder.d.ts +251 -0
- package/dist/create/task-builder.js +384 -0
- package/dist/create/transform.d.ts +16 -0
- package/dist/create/transform.js +106 -0
- package/dist/extensions/otel.d.ts +98 -0
- package/dist/extensions/otel.js +190 -0
- package/dist/extensions/pino.d.ts +44 -0
- package/dist/extensions/pino.js +107 -0
- package/dist/extensions/winston.d.ts +47 -0
- package/dist/extensions/winston.js +114 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/server/express/errors.js +7 -11
- package/dist/server/express/middeware.d.ts +2 -2
- package/dist/server/express/middeware.js +26 -40
- package/dist/server/express/server.d.ts +14 -56
- package/dist/server/express/server.js +46 -35
- package/dist/services/a2a/execute.d.ts +11 -0
- package/dist/services/a2a/execute.js +32 -0
- package/dist/services/a2a/factory/context.d.ts +15 -128
- package/dist/services/a2a/factory/context.js +30 -136
- package/dist/services/a2a/factory/handler.d.ts +6 -0
- package/dist/services/a2a/factory/handler.js +14 -0
- package/dist/services/a2a/factory/index.d.ts +1 -3
- package/dist/services/a2a/factory/index.js +1 -3
- package/dist/services/a2a/factory/service.d.ts +20 -7
- package/dist/services/a2a/factory/service.js +5 -5
- package/dist/services/a2a/factory/state-machine.d.ts +11 -0
- package/dist/services/a2a/factory/state-machine.js +88 -0
- package/dist/services/a2a/handlers/artifact.d.ts +7 -0
- package/dist/services/a2a/handlers/artifact.js +28 -0
- package/dist/services/a2a/handlers/cancel-task.d.ts +11 -0
- package/dist/services/a2a/handlers/cancel-task.js +35 -0
- package/dist/services/a2a/handlers/get-task.d.ts +11 -0
- package/dist/services/a2a/handlers/get-task.js +13 -0
- package/dist/services/a2a/handlers/resubscribe-task.d.ts +19 -0
- package/dist/services/a2a/handlers/resubscribe-task.js +59 -0
- package/dist/services/a2a/handlers/send-message.d.ts +11 -0
- package/dist/services/a2a/handlers/send-message.js +31 -0
- package/dist/services/a2a/handlers/stream-message.d.ts +19 -0
- package/dist/services/a2a/handlers/stream-message.js +23 -0
- package/dist/services/a2a/handlers/update.d.ts +17 -0
- package/dist/services/a2a/handlers/update.js +119 -0
- package/dist/services/a2a/helpers/content.d.ts +6 -2
- package/dist/services/a2a/helpers/content.js +9 -1
- package/dist/services/a2a/helpers/history.d.ts +6 -2
- package/dist/services/a2a/helpers/history.js +4 -0
- package/dist/services/a2a/helpers/index.d.ts +3 -3
- package/dist/services/a2a/helpers/index.js +3 -3
- package/dist/services/a2a/helpers/part.d.ts +9 -9
- package/dist/services/a2a/helpers/references.d.ts +6 -0
- package/dist/services/a2a/helpers/references.js +22 -0
- package/dist/services/a2a/index.d.ts +9 -5
- package/dist/services/a2a/index.js +8 -5
- package/dist/services/a2a/managers.d.ts +23 -0
- package/dist/services/a2a/managers.js +101 -0
- package/dist/services/a2a/messenger.d.ts +35 -0
- package/dist/services/{core/managers/command.js → a2a/messenger.js} +27 -31
- package/dist/services/a2a/service.d.ts +45 -372
- package/dist/services/a2a/service.js +232 -84
- package/dist/services/a2a/state-machine.d.ts +18 -0
- package/dist/services/a2a/state-machine.js +78 -0
- package/dist/services/a2a/streams.d.ts +22 -0
- package/dist/services/a2a/streams.js +98 -0
- package/dist/services/core/index.d.ts +1 -2
- package/dist/services/core/index.js +1 -2
- package/dist/services/core/manager.d.ts +15 -0
- package/dist/services/core/manager.js +42 -0
- package/dist/services/mcp/service.d.ts +11 -15
- package/dist/services/mcp/service.js +16 -15
- package/dist/transport/index.d.ts +0 -1
- package/dist/transport/index.js +1 -1
- package/dist/transport/rpc/parser.d.ts +2 -2
- package/dist/transport/rpc/parser.js +7 -6
- package/dist/transport/rpc/rpc-client.d.ts +5 -5
- package/dist/transport/rpc/rpc-client.js +6 -6
- package/dist/transport/streaming/event-stream.d.ts +3 -3
- package/dist/transport/streaming/event-stream.js +11 -10
- package/dist/transport/trpc/a2a/factory/router.d.ts +479 -871
- package/dist/transport/trpc/a2a/factory/router.js +2 -2
- package/dist/transport/trpc/a2a/routes/info.d.ts +108 -8
- package/dist/transport/trpc/a2a/routes/info.js +6 -2
- package/dist/transport/trpc/a2a/routes/message/route.d.ts +113 -162
- package/dist/transport/trpc/a2a/routes/message/route.js +7 -13
- package/dist/transport/trpc/a2a/routes/tasks/route.d.ts +114 -212
- package/dist/transport/trpc/a2a/routes/tasks/route.js +16 -19
- package/dist/transport/trpc/a2a/trpc.d.ts +9 -253
- package/dist/types/a2a/a2a.d.ts +382 -0
- package/dist/types/a2a/a2a.js +14 -0
- package/dist/types/a2a/index.d.ts +5 -0
- package/dist/types/a2a/index.js +1 -0
- package/dist/types/{interfaces/client.d.ts → client.d.ts} +25 -27
- package/dist/types/core/core.d.ts +31 -0
- package/dist/types/core/core.js +1 -0
- package/dist/types/core/index.d.ts +1 -0
- package/dist/types/core/index.js +1 -0
- package/dist/types/index.d.ts +6 -3
- package/dist/types/index.js +6 -3
- package/dist/types/mcp/index.d.ts +1 -0
- package/dist/types/mcp/index.js +1 -0
- package/dist/{browser/types/interfaces/services/mcp/service.d.ts → types/mcp/mcp.d.ts} +4 -3
- package/dist/{browser/types/interfaces/services/a2a/context.js → types/mcp/mcp.js} +1 -1
- package/dist/types/storage.d.ts +21 -0
- package/dist/utils/common/constants.d.ts +2 -7
- package/dist/utils/common/constants.js +5 -32
- package/dist/utils/common/errors.d.ts +74 -18
- package/dist/utils/common/errors.js +81 -28
- package/dist/utils/common/parse.d.ts +7 -0
- package/dist/utils/common/parse.js +14 -0
- package/dist/utils/common/schema-validation.d.ts +2 -2
- package/dist/utils/common/schema-validation.js +7 -7
- package/dist/utils/common/utils.d.ts +23 -0
- package/dist/utils/common/utils.js +32 -0
- package/dist/utils/common/zAsyncIterable-v3.d.ts +1 -1
- package/dist/utils/common/zAsyncIterable-v3.js +2 -1
- package/dist/utils/index.d.ts +2 -3
- package/dist/utils/index.js +2 -3
- package/dist/utils/storage/file.d.ts +8 -17
- package/dist/utils/storage/file.js +44 -73
- package/package.json +76 -13
- package/dist/browser/services/a2a/helpers/message-builder.d.ts +0 -12
- package/dist/browser/services/a2a/helpers/message-builder.js +0 -61
- package/dist/browser/types/ext.d.ts +0 -13
- package/dist/browser/types/ext.js +0 -10
- package/dist/browser/types/interfaces/index.d.ts +0 -3
- package/dist/browser/types/interfaces/index.js +0 -3
- package/dist/browser/types/interfaces/services/a2a/builder.d.ts +0 -37
- package/dist/browser/types/interfaces/services/a2a/context.d.ts +0 -162
- package/dist/browser/types/interfaces/services/a2a/engine.d.ts +0 -7
- package/dist/browser/types/interfaces/services/a2a/engine.js +0 -5
- package/dist/browser/types/interfaces/services/a2a/index.d.ts +0 -5
- package/dist/browser/types/interfaces/services/a2a/index.js +0 -5
- package/dist/browser/types/interfaces/services/a2a/legacy.d.ts +0 -93
- package/dist/browser/types/interfaces/services/a2a/legacy.js +0 -5
- package/dist/browser/types/interfaces/services/a2a/service.d.ts +0 -413
- package/dist/browser/types/interfaces/services/a2a/service.js +0 -5
- package/dist/browser/types/interfaces/services/core/context/command.d.ts +0 -25
- package/dist/browser/types/interfaces/services/core/context/command.js +0 -5
- package/dist/browser/types/interfaces/services/core/context/context.d.ts +0 -207
- package/dist/browser/types/interfaces/services/core/context/context.js +0 -5
- package/dist/browser/types/interfaces/services/core/context/index.d.ts +0 -3
- package/dist/browser/types/interfaces/services/core/context/index.js +0 -3
- package/dist/browser/types/interfaces/services/core/context/types.d.ts +0 -11
- package/dist/browser/types/interfaces/services/core/context/types.js +0 -5
- package/dist/browser/types/interfaces/services/core/execution/engine.d.ts +0 -106
- package/dist/browser/types/interfaces/services/core/execution/engine.js +0 -5
- package/dist/browser/types/interfaces/services/core/execution/environment.d.ts +0 -11
- package/dist/browser/types/interfaces/services/core/execution/environment.js +0 -5
- package/dist/browser/types/interfaces/services/core/execution/execute.d.ts +0 -7
- package/dist/browser/types/interfaces/services/core/execution/execute.js +0 -5
- package/dist/browser/types/interfaces/services/core/execution/index.d.ts +0 -3
- package/dist/browser/types/interfaces/services/core/execution/index.js +0 -3
- package/dist/browser/types/interfaces/services/core/index.d.ts +0 -4
- package/dist/browser/types/interfaces/services/core/index.js +0 -4
- package/dist/browser/types/interfaces/services/core/managers/cancellation.d.ts +0 -9
- package/dist/browser/types/interfaces/services/core/managers/cancellation.js +0 -5
- package/dist/browser/types/interfaces/services/core/managers/connection.d.ts +0 -9
- package/dist/browser/types/interfaces/services/core/managers/connection.js +0 -5
- package/dist/browser/types/interfaces/services/core/managers/context.d.ts +0 -17
- package/dist/browser/types/interfaces/services/core/managers/context.js +0 -5
- package/dist/browser/types/interfaces/services/core/managers/event.d.ts +0 -328
- package/dist/browser/types/interfaces/services/core/managers/event.js +0 -5
- package/dist/browser/types/interfaces/services/core/managers/index.d.ts +0 -6
- package/dist/browser/types/interfaces/services/core/managers/index.js +0 -6
- package/dist/browser/types/interfaces/services/core/managers/stream.d.ts +0 -217
- package/dist/browser/types/interfaces/services/core/managers/stream.js +0 -5
- package/dist/browser/types/interfaces/services/core/managers/task.d.ts +0 -9
- package/dist/browser/types/interfaces/services/core/service.d.ts +0 -115
- package/dist/browser/types/interfaces/services/core/service.js +0 -5
- package/dist/browser/types/interfaces/services/index.d.ts +0 -4
- package/dist/browser/types/interfaces/services/index.js +0 -4
- package/dist/browser/types/interfaces/services/mcp/index.d.ts +0 -1
- package/dist/browser/types/interfaces/services/mcp/index.js +0 -1
- package/dist/browser/types/interfaces/services/mcp/service.js +0 -5
- package/dist/browser/types/interfaces/storage.d.ts +0 -8
- package/dist/browser/types/schemas/a2a/agent.d.ts +0 -2583
- package/dist/browser/types/schemas/a2a/agent.js +0 -323
- package/dist/browser/types/schemas/a2a/auth.d.ts +0 -908
- package/dist/browser/types/schemas/a2a/auth.js +0 -283
- package/dist/browser/types/schemas/a2a/error.d.ts +0 -396
- package/dist/browser/types/schemas/a2a/error.js +0 -163
- package/dist/browser/types/schemas/a2a/index.d.ts +0 -11
- package/dist/browser/types/schemas/a2a/index.js +0 -11
- package/dist/browser/types/schemas/a2a/kind.d.ts +0 -11
- package/dist/browser/types/schemas/a2a/kind.js +0 -20
- package/dist/browser/types/schemas/a2a/message.d.ts +0 -10343
- package/dist/browser/types/schemas/a2a/message.js +0 -130
- package/dist/browser/types/schemas/a2a/notification.d.ts +0 -1517
- package/dist/browser/types/schemas/a2a/notification.js +0 -203
- package/dist/browser/types/schemas/a2a/parameters.d.ts +0 -956
- package/dist/browser/types/schemas/a2a/parameters.js +0 -241
- package/dist/browser/types/schemas/a2a/protocol.d.ts +0 -14363
- package/dist/browser/types/schemas/a2a/protocol.js +0 -59
- package/dist/browser/types/schemas/a2a/rpc.d.ts +0 -182
- package/dist/browser/types/schemas/a2a/rpc.js +0 -126
- package/dist/browser/types/schemas/a2a/task.d.ts +0 -5886
- package/dist/browser/types/schemas/a2a/task.js +0 -134
- package/dist/browser/types/schemas/a2a/transport.d.ts +0 -31
- package/dist/browser/types/schemas/a2a/transport.js +0 -28
- package/dist/browser/types/schemas/index.d.ts +0 -1
- package/dist/browser/types/schemas/index.js +0 -1
- package/dist/browser/utils/logging/index.d.ts +0 -2
- package/dist/browser/utils/logging/index.js +0 -2
- package/dist/browser/utils/logging/log.d.ts +0 -33
- package/dist/browser/utils/logging/log.js +0 -75
- package/dist/browser/utils/logging/logger.d.ts +0 -18
- package/dist/browser/utils/logging/logger.js +0 -18
- package/dist/services/a2a/factory/builder.d.ts +0 -351
- package/dist/services/a2a/factory/builder.js +0 -365
- package/dist/services/a2a/factory/event.d.ts +0 -58
- package/dist/services/a2a/factory/event.js +0 -177
- package/dist/services/a2a/factory/method.d.ts +0 -6
- package/dist/services/a2a/factory/method.js +0 -14
- package/dist/services/a2a/helpers/agentcard-builder.d.ts +0 -7
- package/dist/services/a2a/helpers/agentcard-builder.js +0 -23
- package/dist/services/a2a/helpers/message-builder.d.ts +0 -12
- package/dist/services/a2a/helpers/message-builder.js +0 -61
- package/dist/services/a2a/managers/cancellation.d.ts +0 -11
- package/dist/services/a2a/managers/cancellation.js +0 -16
- package/dist/services/a2a/managers/connection.d.ts +0 -11
- package/dist/services/a2a/managers/connection.js +0 -16
- package/dist/services/a2a/managers/context.d.ts +0 -11
- package/dist/services/a2a/managers/context.js +0 -16
- package/dist/services/a2a/managers/index.d.ts +0 -5
- package/dist/services/a2a/managers/index.js +0 -5
- package/dist/services/a2a/managers/task.d.ts +0 -11
- package/dist/services/a2a/managers/task.js +0 -16
- package/dist/services/a2a/methods/cancel-task.d.ts +0 -7
- package/dist/services/a2a/methods/cancel-task.js +0 -43
- package/dist/services/a2a/methods/get-task.d.ts +0 -112
- package/dist/services/a2a/methods/get-task.js +0 -16
- package/dist/services/a2a/methods/resubscribe-task.d.ts +0 -7
- package/dist/services/a2a/methods/resubscribe-task.js +0 -80
- package/dist/services/a2a/methods/send-message.d.ts +0 -7
- package/dist/services/a2a/methods/send-message.js +0 -36
- package/dist/services/a2a/methods/stream-message.d.ts +0 -8
- package/dist/services/a2a/methods/stream-message.js +0 -21
- package/dist/services/a2a/state/index.d.ts +0 -3
- package/dist/services/a2a/state/index.js +0 -3
- package/dist/services/a2a/state/load.d.ts +0 -14
- package/dist/services/a2a/state/load.js +0 -71
- package/dist/services/a2a/state/process.d.ts +0 -7
- package/dist/services/a2a/state/process.js +0 -13
- package/dist/services/a2a/state/update/artifact.d.ts +0 -10
- package/dist/services/a2a/state/update/artifact.js +0 -39
- package/dist/services/a2a/state/update/index.d.ts +0 -2
- package/dist/services/a2a/state/update/index.js +0 -2
- package/dist/services/a2a/state/update/update.d.ts +0 -23
- package/dist/services/a2a/state/update/update.js +0 -123
- package/dist/services/core/execution/execute.d.ts +0 -6
- package/dist/services/core/execution/execute.js +0 -25
- package/dist/services/core/execution/index.d.ts +0 -1
- package/dist/services/core/execution/index.js +0 -1
- package/dist/services/core/managers/command.d.ts +0 -39
- package/dist/services/core/managers/event.d.ts +0 -18
- package/dist/services/core/managers/event.js +0 -56
- package/dist/services/core/managers/index.d.ts +0 -3
- package/dist/services/core/managers/index.js +0 -3
- package/dist/services/core/managers/stream.d.ts +0 -20
- package/dist/services/core/managers/stream.js +0 -77
- package/dist/types/ext.d.ts +0 -13
- package/dist/types/ext.js +0 -10
- package/dist/types/interfaces/index.d.ts +0 -3
- package/dist/types/interfaces/index.js +0 -3
- package/dist/types/interfaces/services/a2a/builder.d.ts +0 -37
- package/dist/types/interfaces/services/a2a/builder.js +0 -5
- package/dist/types/interfaces/services/a2a/context.d.ts +0 -162
- package/dist/types/interfaces/services/a2a/context.js +0 -5
- package/dist/types/interfaces/services/a2a/engine.d.ts +0 -7
- package/dist/types/interfaces/services/a2a/engine.js +0 -5
- package/dist/types/interfaces/services/a2a/index.d.ts +0 -5
- package/dist/types/interfaces/services/a2a/index.js +0 -5
- package/dist/types/interfaces/services/a2a/legacy.d.ts +0 -93
- package/dist/types/interfaces/services/a2a/legacy.js +0 -5
- package/dist/types/interfaces/services/a2a/service.d.ts +0 -413
- package/dist/types/interfaces/services/a2a/service.js +0 -5
- package/dist/types/interfaces/services/core/context/command.d.ts +0 -25
- package/dist/types/interfaces/services/core/context/command.js +0 -5
- package/dist/types/interfaces/services/core/context/context.d.ts +0 -207
- package/dist/types/interfaces/services/core/context/context.js +0 -5
- package/dist/types/interfaces/services/core/context/index.d.ts +0 -3
- package/dist/types/interfaces/services/core/context/index.js +0 -3
- package/dist/types/interfaces/services/core/context/types.d.ts +0 -11
- package/dist/types/interfaces/services/core/context/types.js +0 -5
- package/dist/types/interfaces/services/core/execution/engine.d.ts +0 -106
- package/dist/types/interfaces/services/core/execution/engine.js +0 -5
- package/dist/types/interfaces/services/core/execution/environment.d.ts +0 -11
- package/dist/types/interfaces/services/core/execution/environment.js +0 -5
- package/dist/types/interfaces/services/core/execution/execute.d.ts +0 -7
- package/dist/types/interfaces/services/core/execution/execute.js +0 -5
- package/dist/types/interfaces/services/core/execution/index.d.ts +0 -3
- package/dist/types/interfaces/services/core/execution/index.js +0 -3
- package/dist/types/interfaces/services/core/index.d.ts +0 -4
- package/dist/types/interfaces/services/core/index.js +0 -4
- package/dist/types/interfaces/services/core/managers/cancellation.d.ts +0 -9
- package/dist/types/interfaces/services/core/managers/cancellation.js +0 -5
- package/dist/types/interfaces/services/core/managers/connection.d.ts +0 -9
- package/dist/types/interfaces/services/core/managers/connection.js +0 -5
- package/dist/types/interfaces/services/core/managers/context.d.ts +0 -17
- package/dist/types/interfaces/services/core/managers/context.js +0 -5
- package/dist/types/interfaces/services/core/managers/event.d.ts +0 -328
- package/dist/types/interfaces/services/core/managers/event.js +0 -5
- package/dist/types/interfaces/services/core/managers/index.d.ts +0 -6
- package/dist/types/interfaces/services/core/managers/index.js +0 -6
- package/dist/types/interfaces/services/core/managers/stream.d.ts +0 -217
- package/dist/types/interfaces/services/core/managers/stream.js +0 -5
- package/dist/types/interfaces/services/core/managers/task.d.ts +0 -9
- package/dist/types/interfaces/services/core/service.d.ts +0 -115
- package/dist/types/interfaces/services/core/service.js +0 -5
- package/dist/types/interfaces/services/index.d.ts +0 -4
- package/dist/types/interfaces/services/index.js +0 -4
- package/dist/types/interfaces/services/mcp/index.d.ts +0 -1
- package/dist/types/interfaces/services/mcp/index.js +0 -1
- package/dist/types/interfaces/services/mcp/service.js +0 -5
- package/dist/types/interfaces/storage.d.ts +0 -8
- package/dist/types/schemas/a2a/agent.d.ts +0 -2583
- package/dist/types/schemas/a2a/agent.js +0 -323
- package/dist/types/schemas/a2a/auth.d.ts +0 -908
- package/dist/types/schemas/a2a/auth.js +0 -283
- package/dist/types/schemas/a2a/error.d.ts +0 -396
- package/dist/types/schemas/a2a/error.js +0 -163
- package/dist/types/schemas/a2a/index.d.ts +0 -11
- package/dist/types/schemas/a2a/index.js +0 -11
- package/dist/types/schemas/a2a/kind.d.ts +0 -11
- package/dist/types/schemas/a2a/kind.js +0 -20
- package/dist/types/schemas/a2a/message.d.ts +0 -10343
- package/dist/types/schemas/a2a/message.js +0 -130
- package/dist/types/schemas/a2a/notification.d.ts +0 -1517
- package/dist/types/schemas/a2a/notification.js +0 -203
- package/dist/types/schemas/a2a/parameters.d.ts +0 -956
- package/dist/types/schemas/a2a/parameters.js +0 -241
- package/dist/types/schemas/a2a/protocol.d.ts +0 -14363
- package/dist/types/schemas/a2a/protocol.js +0 -59
- package/dist/types/schemas/a2a/rpc.d.ts +0 -182
- package/dist/types/schemas/a2a/rpc.js +0 -126
- package/dist/types/schemas/a2a/task.d.ts +0 -5886
- package/dist/types/schemas/a2a/task.js +0 -134
- package/dist/types/schemas/a2a/transport.d.ts +0 -31
- package/dist/types/schemas/a2a/transport.js +0 -28
- package/dist/types/schemas/index.d.ts +0 -1
- package/dist/types/schemas/index.js +0 -1
- package/dist/utils/logging/index.d.ts +0 -2
- package/dist/utils/logging/index.js +0 -2
- package/dist/utils/logging/log.d.ts +0 -33
- package/dist/utils/logging/log.js +0 -75
- package/dist/utils/logging/logger.d.ts +0 -18
- package/dist/utils/logging/logger.js +0 -18
- package/dist/utils/storage/memory.d.ts +0 -25
- package/dist/utils/storage/memory.js +0 -47
- /package/dist/browser/{types/interfaces/services/core/managers/task.js → create/base.js} +0 -0
- /package/dist/browser/types/{interfaces/client.js → client.js} +0 -0
- /package/dist/{types/interfaces/services/core/managers/task.js → browser/types/core/core.js} +0 -0
- /package/dist/browser/types/{interfaces/services/protocol.d.ts → protocol.d.ts} +0 -0
- /package/dist/browser/types/{interfaces/services/protocol.js → protocol.js} +0 -0
- /package/dist/browser/types/{interfaces/storage.js → storage.js} +0 -0
- /package/dist/services/a2a/{methods → handlers}/index.d.ts +0 -0
- /package/dist/services/a2a/{methods → handlers}/index.js +0 -0
- /package/dist/types/{interfaces/client.js → client.js} +0 -0
- /package/dist/types/{interfaces/services/protocol.d.ts → protocol.d.ts} +0 -0
- /package/dist/types/{interfaces/services/protocol.js → protocol.js} +0 -0
- /package/dist/types/{interfaces/storage.js → storage.js} +0 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright 2025 The Artinet Project
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
|
-
import type {
|
|
5
|
+
import type { A2A, MCP } from "../../types/index.js";
|
|
6
6
|
/**
|
|
7
7
|
* Creates a JSON-RPC request body with the specified method and parameters.
|
|
8
8
|
*, ErrorCodeParseError
|
|
@@ -11,7 +11,7 @@ import type { JSONRPCRequest, JSONRPCResponse, A2ARequest } from "../../types/in
|
|
|
11
11
|
* @param requestId Optional request ID (generates a UUID v4 if not provided)
|
|
12
12
|
* @returns A properly formatted JSON-RPC request object
|
|
13
13
|
*/
|
|
14
|
-
export declare function createJsonRpcRequest<Req extends A2ARequest>(method: Req["method"], params: Req["params"], requestId?: string | number): JSONRPCRequest;
|
|
14
|
+
export declare function createJsonRpcRequest<Req extends A2A.A2ARequest>(method: Req["method"], params: Req["params"], requestId?: string | number): MCP.JSONRPCRequest;
|
|
15
15
|
/**
|
|
16
16
|
* Sends a JSON-RPC request to the specified endpoint.
|
|
17
17
|
*
|
|
@@ -23,7 +23,7 @@ export declare function createJsonRpcRequest<Req extends A2ARequest>(method: Req
|
|
|
23
23
|
* @returns A Promise resolving to the fetch Response object
|
|
24
24
|
* @throws RpcError if there's a network error
|
|
25
25
|
*/
|
|
26
|
-
export declare function sendJsonRpcRequest<Req extends A2ARequest>(baseUrl: URL, method: Req["method"], params: Req["params"], headers?: Record<string, string>, acceptHeader?: "application/json" | "text/event-stream"): Promise<Response>;
|
|
26
|
+
export declare function sendJsonRpcRequest<Req extends A2A.A2ARequest>(baseUrl: URL, method: Req["method"], params: Req["params"], headers?: Record<string, string>, acceptHeader?: "application/json" | "text/event-stream"): Promise<Response>;
|
|
27
27
|
/**
|
|
28
28
|
* Sends a GET request to the specified endpoint.
|
|
29
29
|
* This is used for non-JSON-RPC calls like agent card retrieval.
|
|
@@ -43,7 +43,7 @@ export declare function sendGetRequest(url: URL, headers?: Record<string, string
|
|
|
43
43
|
* @returns A promise resolving to the result payload
|
|
44
44
|
* @throws RpcError if there's an error in the response
|
|
45
45
|
*/
|
|
46
|
-
export declare function handleJsonRpcResponse<Res extends
|
|
46
|
+
export declare function handleJsonRpcResponse<Res extends MCP.JSONRPCResultResponse>(response: Response, expectedMethod?: string): Promise<NonNullable<Res["result"]>>;
|
|
47
47
|
/**
|
|
48
48
|
* Processes a JSON response from a regular GET request.
|
|
49
49
|
* Handles error checking and returns the parsed JSON.
|
|
@@ -66,7 +66,7 @@ export declare function handleJsonResponse<T>(response: Response, endpoint?: str
|
|
|
66
66
|
* @returns A Promise resolving to the result payload
|
|
67
67
|
* @throws RpcError if there's a network error or error in the response
|
|
68
68
|
*/
|
|
69
|
-
export declare function executeJsonRpcRequest<Req extends A2ARequest, Res extends
|
|
69
|
+
export declare function executeJsonRpcRequest<Req extends A2A.A2ARequest, Res extends MCP.JSONRPCResultResponse>(baseUrl: URL, method: Req["method"], params: Req["params"], headers?: Record<string, string>, acceptHeader?: "application/json" | "text/event-stream"): Promise<NonNullable<Res["result"]>>;
|
|
70
70
|
/**
|
|
71
71
|
* Sends a GET request and processes the JSON response.
|
|
72
72
|
* Helper for non-RPC REST endpoints.
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import { v4 as uuidv4 } from "uuid";
|
|
10
10
|
import { SystemError, INTERNAL_ERROR, PARSE_ERROR, } from "../../utils/common/errors.js";
|
|
11
11
|
import { parseResponse } from "./parser.js";
|
|
12
|
-
import {
|
|
12
|
+
import { logger } from "../../config/index.js";
|
|
13
13
|
/**
|
|
14
14
|
* Creates a JSON-RPC request body with the specified method and parameters.
|
|
15
15
|
*, ErrorCodeParseError
|
|
@@ -55,7 +55,7 @@ export async function sendJsonRpcRequest(baseUrl, method, params, headers = {},
|
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
57
|
catch (networkError) {
|
|
58
|
-
|
|
58
|
+
logger.error("SendJsonRpcRequest: Network error during RPC call:", networkError);
|
|
59
59
|
// Wrap network errors into a standard error format
|
|
60
60
|
throw INTERNAL_ERROR(networkError);
|
|
61
61
|
}
|
|
@@ -80,7 +80,7 @@ export async function sendGetRequest(url, headers = {}) {
|
|
|
80
80
|
});
|
|
81
81
|
}
|
|
82
82
|
catch (networkError) {
|
|
83
|
-
|
|
83
|
+
logger.error("SendGetRequest: Network error during GET request:", networkError);
|
|
84
84
|
throw INTERNAL_ERROR(networkError);
|
|
85
85
|
}
|
|
86
86
|
}
|
|
@@ -105,7 +105,7 @@ export async function handleJsonRpcResponse(response, expectedMethod) {
|
|
|
105
105
|
// But the HTTP status was not OK, so we throw a generic error
|
|
106
106
|
}
|
|
107
107
|
catch (parseError) {
|
|
108
|
-
|
|
108
|
+
logger.warn("handleJsonRpcResponse", "Error parsing JSON-RPC response:", parseError);
|
|
109
109
|
}
|
|
110
110
|
// Throw a generic HTTP error if we couldn't extract an RPC error
|
|
111
111
|
throw new Error(`HTTP error ${response.status}: ${response.statusText}${responseBody ? ` - ${responseBody}` : ""}`);
|
|
@@ -119,7 +119,7 @@ export async function handleJsonRpcResponse(response, expectedMethod) {
|
|
|
119
119
|
return jsonResponse.result;
|
|
120
120
|
}
|
|
121
121
|
catch (error) {
|
|
122
|
-
|
|
122
|
+
logger.error(`handleJsonRpcResponse: Error processing response [${expectedMethod}]:`, error);
|
|
123
123
|
// Re-throw RpcError instances directly, wrap others
|
|
124
124
|
if (error instanceof SystemError) {
|
|
125
125
|
throw error;
|
|
@@ -148,7 +148,7 @@ export async function handleJsonResponse(response, endpoint) {
|
|
|
148
148
|
return JSON.parse(responseBody);
|
|
149
149
|
}
|
|
150
150
|
catch (error) {
|
|
151
|
-
|
|
151
|
+
logger.error(`handleJsonResponse: Error processing response for ${endpoint || "unknown endpoint"}:`, error);
|
|
152
152
|
if (error instanceof SystemError) {
|
|
153
153
|
throw error;
|
|
154
154
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright 2025 The Artinet Project
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
|
-
import
|
|
5
|
+
import { A2A, MCP } from "../../types/index.js";
|
|
6
6
|
/**
|
|
7
7
|
* Creates an async generator for processing task events from an SSE stream
|
|
8
8
|
*
|
|
@@ -10,7 +10,7 @@ import type { JSONRPCResponse, A2ARequest } from "../../types/index.js";
|
|
|
10
10
|
* @param response The fetch Response object containing the event stream
|
|
11
11
|
* @returns An async generator yielding the specified type of task events from StreamingResponse
|
|
12
12
|
*/
|
|
13
|
-
export declare function handleEventStream<StreamRes extends
|
|
13
|
+
export declare function handleEventStream<StreamRes extends MCP.JSONRPCResultResponse>(response: Response): AsyncGenerator<NonNullable<StreamRes["result"]>>;
|
|
14
14
|
/**
|
|
15
15
|
* Executes a streaming JSON-RPC request and yields events as they arrive
|
|
16
16
|
*
|
|
@@ -22,4 +22,4 @@ export declare function handleEventStream<StreamRes extends JSONRPCResponse>(res
|
|
|
22
22
|
* @param customHeaders Any custom headers to include in the request
|
|
23
23
|
* @returns An AsyncIterable yielding events from the stream
|
|
24
24
|
*/
|
|
25
|
-
export declare function executeStreamEvents<Req extends A2ARequest, StreamRes extends
|
|
25
|
+
export declare function executeStreamEvents<Req extends A2A.A2ARequest, StreamRes extends MCP.JSONRPCResultResponse>(baseUrl: URL, method: Req["method"], params: Req["params"], customHeaders: Record<string, string>): AsyncIterable<NonNullable<StreamRes["result"]>>;
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import { parseResponse } from "../rpc/parser.js";
|
|
9
9
|
import { createParser, } from "eventsource-parser";
|
|
10
10
|
import { sendJsonRpcRequest } from "../rpc/rpc-client.js";
|
|
11
|
-
import {
|
|
11
|
+
import { logger } from "../../config/index.js";
|
|
12
12
|
/**
|
|
13
13
|
* Creates an async generator for processing task events from an SSE stream
|
|
14
14
|
*
|
|
@@ -23,8 +23,9 @@ export async function* handleEventStream(response) {
|
|
|
23
23
|
errorText = await response.text();
|
|
24
24
|
}
|
|
25
25
|
catch (_) { }
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
const err = new Error(`HTTP error [${response.status}:${response.statusText}] - ${errorText}`);
|
|
27
|
+
logger.error(`handleEventStream: HTTP error [${response.status}:${response.statusText}] - ${errorText}`, err);
|
|
28
|
+
throw err;
|
|
28
29
|
}
|
|
29
30
|
// Use eventsource-parser to process the SSE stream
|
|
30
31
|
const reader = response.body.getReader();
|
|
@@ -34,7 +35,7 @@ export async function* handleEventStream(response) {
|
|
|
34
35
|
onEvent: (event) => {
|
|
35
36
|
if (event.data) {
|
|
36
37
|
if (event.event === "close") {
|
|
37
|
-
|
|
38
|
+
logger.debug("handleEventStream", "Stream closed");
|
|
38
39
|
return;
|
|
39
40
|
}
|
|
40
41
|
try {
|
|
@@ -44,7 +45,7 @@ export async function* handleEventStream(response) {
|
|
|
44
45
|
events.push(eventResult);
|
|
45
46
|
}
|
|
46
47
|
else {
|
|
47
|
-
|
|
48
|
+
logger.warn("handleEventStream", "Failed to parse SSE data", parsedData);
|
|
48
49
|
}
|
|
49
50
|
// if (parsedData.final && parsedData.final === true) {
|
|
50
51
|
// logDebug("handleEventStream", "Stream completed");
|
|
@@ -52,15 +53,15 @@ export async function* handleEventStream(response) {
|
|
|
52
53
|
// }
|
|
53
54
|
}
|
|
54
55
|
catch (e) {
|
|
55
|
-
|
|
56
|
+
logger.warn("handleEventStream", "Failed to parse SSE data", e);
|
|
56
57
|
}
|
|
57
58
|
}
|
|
58
59
|
},
|
|
59
60
|
onError: (error) => {
|
|
60
|
-
|
|
61
|
+
logger.error("handleEventStream: Error parsing SSE data", error);
|
|
61
62
|
},
|
|
62
63
|
onRetry: (retry) => {
|
|
63
|
-
|
|
64
|
+
logger.warn("handleEventStream", "Retrying SSE connection", retry);
|
|
64
65
|
},
|
|
65
66
|
});
|
|
66
67
|
try {
|
|
@@ -91,9 +92,9 @@ export async function* handleEventStream(response) {
|
|
|
91
92
|
* @returns An AsyncIterable yielding events from the stream
|
|
92
93
|
*/
|
|
93
94
|
export async function* executeStreamEvents(baseUrl, method, params, customHeaders) {
|
|
94
|
-
|
|
95
|
+
logger.debug("executeStreamEvents", `Sending streaming request to: ${baseUrl.toString()}, method: ${method}`);
|
|
95
96
|
const responsePromise = sendJsonRpcRequest(baseUrl, method, params, customHeaders, "text/event-stream");
|
|
96
97
|
const response = await responsePromise;
|
|
97
|
-
|
|
98
|
+
logger.debug("executeStreamEvents", "Response", response);
|
|
98
99
|
yield* handleEventStream(response);
|
|
99
100
|
}
|
|
@@ -0,0 +1,382 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 The Artinet Project
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
import { AgentCard, Message, Task, AgentExtension, TaskQueryParams, TaskIdParams, MessageSendParams, SendMessageSuccessResult } from "@artinet/types/a2a";
|
|
6
|
+
import { core } from "../core/index.js";
|
|
7
|
+
import { z } from "zod/v4";
|
|
8
|
+
export type AgentCardParams = (Partial<AgentCard> & Required<Pick<AgentCard, "name">>) | string;
|
|
9
|
+
export declare const UpdateSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
10
|
+
role: z.ZodEnum<{
|
|
11
|
+
user: "user";
|
|
12
|
+
agent: "agent";
|
|
13
|
+
}>;
|
|
14
|
+
parts: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
15
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
16
|
+
kind: z.ZodLiteral<"text">;
|
|
17
|
+
text: z.ZodString;
|
|
18
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
19
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
20
|
+
kind: z.ZodLiteral<"file">;
|
|
21
|
+
file: z.ZodUnion<readonly [z.ZodObject<{
|
|
22
|
+
name: z.ZodOptional<z.ZodString>;
|
|
23
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
24
|
+
bytes: z.ZodString;
|
|
25
|
+
uri: z.ZodOptional<z.ZodNever>;
|
|
26
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
27
|
+
name: z.ZodOptional<z.ZodString>;
|
|
28
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
29
|
+
uri: z.ZodString;
|
|
30
|
+
bytes: z.ZodOptional<z.ZodNever>;
|
|
31
|
+
}, z.core.$strip>]>;
|
|
32
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
33
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
34
|
+
kind: z.ZodLiteral<"data">;
|
|
35
|
+
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
36
|
+
}, z.core.$strip>]>>;
|
|
37
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
38
|
+
extensions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
39
|
+
referenceTaskIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
40
|
+
messageId: z.ZodString;
|
|
41
|
+
taskId: z.ZodOptional<z.ZodString>;
|
|
42
|
+
contextId: z.ZodOptional<z.ZodString>;
|
|
43
|
+
kind: z.ZodLiteral<"message">;
|
|
44
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
45
|
+
id: z.ZodString;
|
|
46
|
+
contextId: z.ZodString;
|
|
47
|
+
status: z.ZodObject<{
|
|
48
|
+
state: z.ZodEnum<{
|
|
49
|
+
failed: "failed";
|
|
50
|
+
unknown: "unknown";
|
|
51
|
+
completed: "completed";
|
|
52
|
+
canceled: "canceled";
|
|
53
|
+
rejected: "rejected";
|
|
54
|
+
working: "working";
|
|
55
|
+
submitted: "submitted";
|
|
56
|
+
"input-required": "input-required";
|
|
57
|
+
"auth-required": "auth-required";
|
|
58
|
+
}>;
|
|
59
|
+
message: z.ZodOptional<z.ZodObject<{
|
|
60
|
+
role: z.ZodEnum<{
|
|
61
|
+
user: "user";
|
|
62
|
+
agent: "agent";
|
|
63
|
+
}>;
|
|
64
|
+
parts: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
65
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
66
|
+
kind: z.ZodLiteral<"text">;
|
|
67
|
+
text: z.ZodString;
|
|
68
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
69
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
70
|
+
kind: z.ZodLiteral<"file">;
|
|
71
|
+
file: z.ZodUnion<readonly [z.ZodObject<{
|
|
72
|
+
name: z.ZodOptional<z.ZodString>;
|
|
73
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
74
|
+
bytes: z.ZodString;
|
|
75
|
+
uri: z.ZodOptional<z.ZodNever>;
|
|
76
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
77
|
+
name: z.ZodOptional<z.ZodString>;
|
|
78
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
79
|
+
uri: z.ZodString;
|
|
80
|
+
bytes: z.ZodOptional<z.ZodNever>;
|
|
81
|
+
}, z.core.$strip>]>;
|
|
82
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
83
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
84
|
+
kind: z.ZodLiteral<"data">;
|
|
85
|
+
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
86
|
+
}, z.core.$strip>]>>;
|
|
87
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
88
|
+
extensions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
89
|
+
referenceTaskIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
90
|
+
messageId: z.ZodString;
|
|
91
|
+
taskId: z.ZodOptional<z.ZodString>;
|
|
92
|
+
contextId: z.ZodOptional<z.ZodString>;
|
|
93
|
+
kind: z.ZodLiteral<"message">;
|
|
94
|
+
}, z.core.$strip>>;
|
|
95
|
+
timestamp: z.ZodOptional<z.ZodISODateTime>;
|
|
96
|
+
}, z.core.$strip>;
|
|
97
|
+
history: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
98
|
+
role: z.ZodEnum<{
|
|
99
|
+
user: "user";
|
|
100
|
+
agent: "agent";
|
|
101
|
+
}>;
|
|
102
|
+
parts: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
103
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
104
|
+
kind: z.ZodLiteral<"text">;
|
|
105
|
+
text: z.ZodString;
|
|
106
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
107
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
108
|
+
kind: z.ZodLiteral<"file">;
|
|
109
|
+
file: z.ZodUnion<readonly [z.ZodObject<{
|
|
110
|
+
name: z.ZodOptional<z.ZodString>;
|
|
111
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
112
|
+
bytes: z.ZodString;
|
|
113
|
+
uri: z.ZodOptional<z.ZodNever>;
|
|
114
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
115
|
+
name: z.ZodOptional<z.ZodString>;
|
|
116
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
117
|
+
uri: z.ZodString;
|
|
118
|
+
bytes: z.ZodOptional<z.ZodNever>;
|
|
119
|
+
}, z.core.$strip>]>;
|
|
120
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
121
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
122
|
+
kind: z.ZodLiteral<"data">;
|
|
123
|
+
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
124
|
+
}, z.core.$strip>]>>;
|
|
125
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
126
|
+
extensions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
127
|
+
referenceTaskIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
128
|
+
messageId: z.ZodString;
|
|
129
|
+
taskId: z.ZodOptional<z.ZodString>;
|
|
130
|
+
contextId: z.ZodOptional<z.ZodString>;
|
|
131
|
+
kind: z.ZodLiteral<"message">;
|
|
132
|
+
}, z.core.$strip>>>;
|
|
133
|
+
artifacts: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
134
|
+
artifactId: z.ZodString;
|
|
135
|
+
name: z.ZodOptional<z.ZodString>;
|
|
136
|
+
description: z.ZodOptional<z.ZodString>;
|
|
137
|
+
parts: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
138
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
139
|
+
kind: z.ZodLiteral<"text">;
|
|
140
|
+
text: z.ZodString;
|
|
141
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
142
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
143
|
+
kind: z.ZodLiteral<"file">;
|
|
144
|
+
file: z.ZodUnion<readonly [z.ZodObject<{
|
|
145
|
+
name: z.ZodOptional<z.ZodString>;
|
|
146
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
147
|
+
bytes: z.ZodString;
|
|
148
|
+
uri: z.ZodOptional<z.ZodNever>;
|
|
149
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
150
|
+
name: z.ZodOptional<z.ZodString>;
|
|
151
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
152
|
+
uri: z.ZodString;
|
|
153
|
+
bytes: z.ZodOptional<z.ZodNever>;
|
|
154
|
+
}, z.core.$strip>]>;
|
|
155
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
156
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
157
|
+
kind: z.ZodLiteral<"data">;
|
|
158
|
+
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
159
|
+
}, z.core.$strip>]>>;
|
|
160
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
161
|
+
extension: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
162
|
+
}, z.core.$strip>>>;
|
|
163
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
164
|
+
kind: z.ZodLiteral<"task">;
|
|
165
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
166
|
+
taskId: z.ZodString;
|
|
167
|
+
contextId: z.ZodString;
|
|
168
|
+
kind: z.ZodLiteral<"status-update">;
|
|
169
|
+
status: z.ZodObject<{
|
|
170
|
+
state: z.ZodEnum<{
|
|
171
|
+
failed: "failed";
|
|
172
|
+
unknown: "unknown";
|
|
173
|
+
completed: "completed";
|
|
174
|
+
canceled: "canceled";
|
|
175
|
+
rejected: "rejected";
|
|
176
|
+
working: "working";
|
|
177
|
+
submitted: "submitted";
|
|
178
|
+
"input-required": "input-required";
|
|
179
|
+
"auth-required": "auth-required";
|
|
180
|
+
}>;
|
|
181
|
+
message: z.ZodOptional<z.ZodObject<{
|
|
182
|
+
role: z.ZodEnum<{
|
|
183
|
+
user: "user";
|
|
184
|
+
agent: "agent";
|
|
185
|
+
}>;
|
|
186
|
+
parts: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
187
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
188
|
+
kind: z.ZodLiteral<"text">;
|
|
189
|
+
text: z.ZodString;
|
|
190
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
191
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
192
|
+
kind: z.ZodLiteral<"file">;
|
|
193
|
+
file: z.ZodUnion<readonly [z.ZodObject<{
|
|
194
|
+
name: z.ZodOptional<z.ZodString>;
|
|
195
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
196
|
+
bytes: z.ZodString;
|
|
197
|
+
uri: z.ZodOptional<z.ZodNever>;
|
|
198
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
199
|
+
name: z.ZodOptional<z.ZodString>;
|
|
200
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
201
|
+
uri: z.ZodString;
|
|
202
|
+
bytes: z.ZodOptional<z.ZodNever>;
|
|
203
|
+
}, z.core.$strip>]>;
|
|
204
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
205
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
206
|
+
kind: z.ZodLiteral<"data">;
|
|
207
|
+
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
208
|
+
}, z.core.$strip>]>>;
|
|
209
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
210
|
+
extensions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
211
|
+
referenceTaskIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
212
|
+
messageId: z.ZodString;
|
|
213
|
+
taskId: z.ZodOptional<z.ZodString>;
|
|
214
|
+
contextId: z.ZodOptional<z.ZodString>;
|
|
215
|
+
kind: z.ZodLiteral<"message">;
|
|
216
|
+
}, z.core.$strip>>;
|
|
217
|
+
timestamp: z.ZodOptional<z.ZodISODateTime>;
|
|
218
|
+
}, z.core.$strip>;
|
|
219
|
+
final: z.ZodBoolean;
|
|
220
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
221
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
222
|
+
taskId: z.ZodString;
|
|
223
|
+
contextId: z.ZodString;
|
|
224
|
+
kind: z.ZodLiteral<"artifact-update">;
|
|
225
|
+
artifact: z.ZodObject<{
|
|
226
|
+
artifactId: z.ZodString;
|
|
227
|
+
name: z.ZodOptional<z.ZodString>;
|
|
228
|
+
description: z.ZodOptional<z.ZodString>;
|
|
229
|
+
parts: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
230
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
231
|
+
kind: z.ZodLiteral<"text">;
|
|
232
|
+
text: z.ZodString;
|
|
233
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
234
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
235
|
+
kind: z.ZodLiteral<"file">;
|
|
236
|
+
file: z.ZodUnion<readonly [z.ZodObject<{
|
|
237
|
+
name: z.ZodOptional<z.ZodString>;
|
|
238
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
239
|
+
bytes: z.ZodString;
|
|
240
|
+
uri: z.ZodOptional<z.ZodNever>;
|
|
241
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
242
|
+
name: z.ZodOptional<z.ZodString>;
|
|
243
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
244
|
+
uri: z.ZodString;
|
|
245
|
+
bytes: z.ZodOptional<z.ZodNever>;
|
|
246
|
+
}, z.core.$strip>]>;
|
|
247
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
248
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
249
|
+
kind: z.ZodLiteral<"data">;
|
|
250
|
+
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
251
|
+
}, z.core.$strip>]>>;
|
|
252
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
253
|
+
extension: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
254
|
+
}, z.core.$strip>;
|
|
255
|
+
append: z.ZodOptional<z.ZodBoolean>;
|
|
256
|
+
lastChunk: z.ZodOptional<z.ZodBoolean>;
|
|
257
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
258
|
+
}, z.core.$strip>]>;
|
|
259
|
+
export type Update = z.output<typeof UpdateSchema>;
|
|
260
|
+
export type Engine = (context: Context) => AsyncGenerator<Update, void, unknown>;
|
|
261
|
+
export interface BaseContext extends core.Context<Task> {
|
|
262
|
+
readonly service: Service;
|
|
263
|
+
/**
|
|
264
|
+
* Considering ommit OnStart & OnComplete from Context consumers.
|
|
265
|
+
* That way the user cannot inadvertently trigger a start/completion out of band.
|
|
266
|
+
*/
|
|
267
|
+
readonly publisher: EventPublisher;
|
|
268
|
+
}
|
|
269
|
+
export interface Context extends BaseContext {
|
|
270
|
+
readonly taskId: string;
|
|
271
|
+
readonly userMessage: Message;
|
|
272
|
+
readonly messages: MessageConsumerProxy;
|
|
273
|
+
extensions?: AgentExtension[];
|
|
274
|
+
references?: Task[];
|
|
275
|
+
getTask: () => Promise<Task>;
|
|
276
|
+
}
|
|
277
|
+
export type ContextParams = Omit<BaseContext, "publisher" | "isCancelled" | "getState" | "abortSignal"> & Omit<Partial<Context>, "userMessage" | "taskId"> & {
|
|
278
|
+
messenger: MessageConsumerProxy;
|
|
279
|
+
task: Task;
|
|
280
|
+
overrides?: Partial<Omit<EventConsumer, "contextId">>;
|
|
281
|
+
abortSignal?: AbortSignal;
|
|
282
|
+
};
|
|
283
|
+
export interface Contexts extends core.Contexts<Context> {
|
|
284
|
+
create: (params: ContextParams) => Promise<Context>;
|
|
285
|
+
list: () => Promise<Context[]>;
|
|
286
|
+
}
|
|
287
|
+
export interface Tasks extends core.Manager<Task> {
|
|
288
|
+
update: (context: Context, update: Update) => Promise<Task>;
|
|
289
|
+
create: (params: Partial<Task>) => Promise<Task>;
|
|
290
|
+
has: (id: string) => Promise<boolean>;
|
|
291
|
+
}
|
|
292
|
+
export interface Cancellations extends Omit<core.Manager<void>, "get"> {
|
|
293
|
+
has: (id: string) => Promise<boolean>;
|
|
294
|
+
}
|
|
295
|
+
export interface Connections extends Omit<core.Manager<void>, "get"> {
|
|
296
|
+
}
|
|
297
|
+
export interface ServiceOptions {
|
|
298
|
+
abortSignal?: AbortSignal;
|
|
299
|
+
}
|
|
300
|
+
export interface RequestHandler {
|
|
301
|
+
getTask: (input: TaskQueryParams, context?: Context, options?: ServiceOptions) => Promise<Task>;
|
|
302
|
+
cancelTask: (input: TaskIdParams, context?: Context, options?: ServiceOptions) => Promise<Task>;
|
|
303
|
+
sendMessage: (message: MessageSendParams, context?: Context, options?: ServiceOptions) => Promise<SendMessageSuccessResult>;
|
|
304
|
+
streamMessage: (message: MessageSendParams, context?: Context, options?: ServiceOptions) => AsyncGenerator<Update>;
|
|
305
|
+
resubscribe: (input: TaskIdParams, context?: Context, options?: ServiceOptions) => AsyncGenerator<Update>;
|
|
306
|
+
getAgentCard: () => Promise<AgentCard>;
|
|
307
|
+
}
|
|
308
|
+
export interface ExtendedHandler extends RequestHandler {
|
|
309
|
+
getAuthenticatedExtendedCard: () => Promise<AgentCard>;
|
|
310
|
+
}
|
|
311
|
+
export interface Stream {
|
|
312
|
+
readonly contextId: string;
|
|
313
|
+
isAlive: boolean;
|
|
314
|
+
kill: () => Promise<void>;
|
|
315
|
+
updates: Update[];
|
|
316
|
+
context: Context;
|
|
317
|
+
run: (params: {
|
|
318
|
+
service: Service;
|
|
319
|
+
}) => AsyncGenerator<Update>;
|
|
320
|
+
subscribe: () => AsyncGenerator<Update>;
|
|
321
|
+
}
|
|
322
|
+
export interface Streams extends Omit<core.Manager<Stream>, "set"> {
|
|
323
|
+
create: (params: core.Optional<Stream> & {
|
|
324
|
+
context: Context;
|
|
325
|
+
}) => Promise<Stream>;
|
|
326
|
+
has: (id: string) => Promise<boolean>;
|
|
327
|
+
}
|
|
328
|
+
export interface Service extends core.Service<{
|
|
329
|
+
engine: Engine;
|
|
330
|
+
context: Context;
|
|
331
|
+
}>, RequestHandler {
|
|
332
|
+
readonly events?: Events;
|
|
333
|
+
readonly connections: Connections;
|
|
334
|
+
readonly cancellations: Cancellations;
|
|
335
|
+
readonly tasks: Tasks;
|
|
336
|
+
readonly contexts: Contexts;
|
|
337
|
+
readonly streams: Streams;
|
|
338
|
+
engine: Engine;
|
|
339
|
+
agentCard: AgentCard;
|
|
340
|
+
}
|
|
341
|
+
export interface MessageProducer {
|
|
342
|
+
isOpen: boolean;
|
|
343
|
+
send: (message: MessageSendParams) => Promise<void>;
|
|
344
|
+
}
|
|
345
|
+
export type MessageMap = {
|
|
346
|
+
message: [MessageSendParams];
|
|
347
|
+
close: [];
|
|
348
|
+
};
|
|
349
|
+
export interface MessageConsumer extends core.Consumer<MessageSendParams, MessageMap> {
|
|
350
|
+
message: MessageSendParams;
|
|
351
|
+
messages: MessageSendParams[];
|
|
352
|
+
close: () => Promise<void>;
|
|
353
|
+
next: () => Promise<IteratorResult<MessageSendParams>>;
|
|
354
|
+
return: (value: MessageSendParams) => Promise<IteratorResult<MessageSendParams>>;
|
|
355
|
+
}
|
|
356
|
+
export type MessageConsumerProxy = MessageConsumer & MessageSendParams;
|
|
357
|
+
export interface EventConsumer {
|
|
358
|
+
readonly contextId: string;
|
|
359
|
+
readonly onStart?: (context: Context) => Promise<Task>;
|
|
360
|
+
readonly onCancel: (update: Update, current: Task) => Promise<void>;
|
|
361
|
+
readonly onUpdate: (update: Update, current: Task) => Promise<Task>;
|
|
362
|
+
readonly onError: (error: any, current: Task) => Promise<void>;
|
|
363
|
+
onComplete: (current: Task) => Promise<void>;
|
|
364
|
+
}
|
|
365
|
+
export type Emissions = {
|
|
366
|
+
start: [MessageSendParams, Task];
|
|
367
|
+
cancel: [Update];
|
|
368
|
+
update: [Task, Update];
|
|
369
|
+
error: [any, Task];
|
|
370
|
+
complete: [Task];
|
|
371
|
+
};
|
|
372
|
+
export interface EventPublisher extends Omit<EventConsumer, "onComplete" | "onCancel" | "onError" | "onUpdate">, core.Publisher<Emissions> {
|
|
373
|
+
readonly onStart?: (context: Context) => Promise<Task>;
|
|
374
|
+
readonly onCancel: (update: Update) => Promise<void>;
|
|
375
|
+
readonly onUpdate: (update: Update) => Promise<Task>;
|
|
376
|
+
readonly onError: (error: any) => Promise<void>;
|
|
377
|
+
onComplete: () => Promise<void>;
|
|
378
|
+
}
|
|
379
|
+
export interface Events extends core.Manager<EventPublisher> {
|
|
380
|
+
create: (params: core.Optional<EventPublisher>) => Promise<EventPublisher>;
|
|
381
|
+
}
|
|
382
|
+
export * from "@artinet/types/a2a";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 The Artinet Project
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
//lets stay really granular with the imports
|
|
6
|
+
import { TaskArtifactUpdateEventSchema, MessageSchema, TaskSchema, TaskStatusUpdateEventSchema, } from "@artinet/types/a2a";
|
|
7
|
+
import { z } from "zod/v4";
|
|
8
|
+
export const UpdateSchema = z.discriminatedUnion("kind", [
|
|
9
|
+
MessageSchema,
|
|
10
|
+
TaskSchema,
|
|
11
|
+
TaskStatusUpdateEventSchema,
|
|
12
|
+
TaskArtifactUpdateEventSchema,
|
|
13
|
+
]);
|
|
14
|
+
export * from "@artinet/types/a2a";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as A2A from "./a2a.js";
|