@artinet/sdk 0.5.18 → 0.6.0-preview.1
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 +18 -6
- 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/services/a2a/helpers/message-builder.d.ts +13 -8
- package/dist/browser/services/a2a/helpers/message-builder.js +5 -0
- package/dist/browser/transport/rpc/parser.d.ts +2 -2
- package/dist/browser/transport/rpc/parser.js +6 -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 +378 -0
- package/dist/browser/types/a2a/a2a.js +14 -0
- package/dist/browser/types/a2a/builder.d.ts +43 -0
- package/dist/browser/types/a2a/index.d.ts +3 -0
- package/dist/browser/types/a2a/index.js +2 -0
- package/dist/{types/interfaces → browser/types}/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/browser/types/{interfaces/services/mcp/service.d.ts → mcp/mcp.d.ts} +4 -3
- package/dist/browser/types/{interfaces/services/a2a/context.js → mcp/mcp.js} +1 -1
- package/dist/browser/types/storage.d.ts +21 -0
- package/dist/browser/utils/common/constants.d.ts +7 -7
- package/dist/browser/utils/common/constants.js +9 -9
- package/dist/browser/utils/common/errors.d.ts +18 -18
- package/dist/browser/utils/common/errors.js +14 -14
- 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 +18 -6
- 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/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 +2 -0
- package/dist/index.js +2 -0
- package/dist/server/express/errors.js +3 -3
- package/dist/server/express/middeware.d.ts +2 -2
- package/dist/server/express/middeware.js +11 -4
- package/dist/server/express/server.d.ts +9 -56
- package/dist/server/express/server.js +21 -28
- package/dist/services/a2a/execute.d.ts +6 -0
- package/dist/services/a2a/execute.js +25 -0
- package/dist/services/a2a/factory/builder.d.ts +21 -80
- package/dist/services/a2a/factory/builder.js +20 -15
- package/dist/services/a2a/factory/context.d.ts +15 -128
- package/dist/services/a2a/factory/context.js +31 -136
- package/dist/services/a2a/factory/handler.d.ts +6 -0
- package/dist/services/a2a/factory/{method.js → handler.js} +2 -2
- package/dist/services/a2a/factory/index.d.ts +1 -2
- package/dist/services/a2a/factory/index.js +1 -2
- package/dist/services/a2a/factory/service.d.ts +20 -7
- package/dist/services/a2a/factory/service.js +4 -4
- package/dist/services/a2a/factory/state-machine.d.ts +11 -0
- package/dist/services/a2a/factory/state-machine.js +66 -0
- package/dist/services/a2a/{state/update → handlers}/artifact.d.ts +4 -4
- package/dist/services/a2a/handlers/cancel-task.d.ts +11 -0
- package/dist/services/a2a/handlers/cancel-task.js +33 -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 +11 -0
- package/dist/services/a2a/handlers/resubscribe-task.js +56 -0
- package/dist/services/a2a/handlers/send-message.d.ts +11 -0
- package/dist/services/a2a/handlers/send-message.js +35 -0
- package/dist/services/a2a/handlers/stream-message.d.ts +11 -0
- package/dist/services/a2a/handlers/stream-message.js +19 -0
- package/dist/services/a2a/handlers/update.d.ts +17 -0
- package/dist/services/a2a/handlers/update.js +114 -0
- package/dist/services/a2a/helpers/agentcard-builder.d.ts +9 -5
- package/dist/services/a2a/helpers/agentcard-builder.js +4 -0
- package/dist/services/a2a/helpers/content.d.ts +2 -2
- package/dist/services/a2a/helpers/content.js +4 -0
- 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 +2 -2
- package/dist/services/a2a/helpers/index.js +2 -2
- package/dist/services/a2a/helpers/message-builder.d.ts +13 -8
- package/dist/services/a2a/helpers/message-builder.js +5 -0
- 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 +95 -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 +41 -372
- package/dist/services/a2a/service.js +238 -83
- package/dist/services/a2a/state-machine.d.ts +18 -0
- package/dist/services/a2a/state-machine.js +76 -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 +6 -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 +378 -0
- package/dist/types/a2a/a2a.js +14 -0
- package/dist/types/a2a/builder.d.ts +43 -0
- package/dist/types/a2a/index.d.ts +3 -0
- package/dist/types/a2a/index.js +2 -0
- package/dist/{browser/types/interfaces → types}/client.d.ts +25 -27
- package/dist/types/core/core.d.ts +31 -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/types/{interfaces/services/mcp/service.d.ts → mcp/mcp.d.ts} +4 -3
- package/dist/{browser/types/interfaces/services/a2a/engine.js → types/mcp/mcp.js} +1 -1
- package/dist/types/storage.d.ts +21 -0
- package/dist/utils/common/constants.d.ts +7 -7
- package/dist/utils/common/constants.js +9 -9
- package/dist/utils/common/errors.d.ts +18 -18
- package/dist/utils/common/errors.js +14 -14
- 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 +1 -1
- 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 +73 -13
- 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/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/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/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/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/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/a2a → a2a}/builder.js +0 -0
- /package/dist/browser/types/{interfaces/client.js → client.js} +0 -0
- /package/dist/browser/types/{interfaces/services/core/managers/task.js → 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/{state/update → handlers}/artifact.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/services/a2a → a2a}/builder.js +0 -0
- /package/dist/types/{interfaces/client.js → client.js} +0 -0
- /package/dist/types/{interfaces/services/core/managers/task.js → core/core.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
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 The Artinet Project
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
import { MessageSendParams, DataPart, FilePart, TextPart } from "@artinet/types/a2a";
|
|
6
|
+
import { Context } from "./a2a.js";
|
|
7
|
+
/**
|
|
8
|
+
* Restricting to command for now, but could be extended to other types of commands in the future.
|
|
9
|
+
* When we shift to CoreCommand, move this into core.
|
|
10
|
+
*/
|
|
11
|
+
export interface StepArgs {
|
|
12
|
+
message: MessageSendParams;
|
|
13
|
+
context: Context;
|
|
14
|
+
skip: () => Promise<void> | void;
|
|
15
|
+
}
|
|
16
|
+
export type BaseArgs = Record<string, unknown>;
|
|
17
|
+
export type EmptyArgs = Record<string, never>;
|
|
18
|
+
export type StepParams<TInboundArgs extends BaseArgs = EmptyArgs> = StepArgs & Partial<{
|
|
19
|
+
content: string;
|
|
20
|
+
args: TInboundArgs;
|
|
21
|
+
}>;
|
|
22
|
+
export type PartContent = DataPart["data"] | FilePart["file"] | TextPart["text"];
|
|
23
|
+
export type StepOutput<TPart extends PartContent> = {
|
|
24
|
+
parts: Array<TPart> | TPart;
|
|
25
|
+
};
|
|
26
|
+
export type StepOutputWithForwardArgs<TPart extends PartContent, TForwardArgs extends BaseArgs = EmptyArgs> = StepOutput<TPart> & {
|
|
27
|
+
args: TForwardArgs;
|
|
28
|
+
};
|
|
29
|
+
export type OutputType<TPart extends PartContent, TForwardArgs extends BaseArgs = EmptyArgs> = StepOutput<TPart> | StepOutputWithForwardArgs<TPart, TForwardArgs> | Array<TPart> | TPart;
|
|
30
|
+
export type Step<TPart extends PartContent = TextPart["text"], TInboundArgs extends BaseArgs = EmptyArgs, TForwardArgs extends BaseArgs = EmptyArgs, TOutput extends OutputType<TPart, TForwardArgs> = OutputType<TPart, TForwardArgs>> = (params: StepParams<TInboundArgs>) => Promise<TOutput> | TOutput;
|
|
31
|
+
export type StepWithKind<TPart extends PartContent = TextPart["text"], TInboundArgs extends BaseArgs = EmptyArgs, TForwardArgs extends BaseArgs = EmptyArgs, TOutput extends OutputType<TPart, TForwardArgs> = OutputType<TPart, TForwardArgs>, TKind extends "text" | "file" | "data" = "text"> = {
|
|
32
|
+
step: Step<TPart, TInboundArgs, TForwardArgs, TOutput>;
|
|
33
|
+
kind: TKind;
|
|
34
|
+
};
|
|
35
|
+
export type OutArgsOf<O> = O extends StepOutputWithForwardArgs<any, infer A> ? A : EmptyArgs;
|
|
36
|
+
export interface StepBuilder<TInboundArgs extends BaseArgs = EmptyArgs> {
|
|
37
|
+
/**
|
|
38
|
+
* Add a step to the builder.
|
|
39
|
+
* @param step - The step to add.
|
|
40
|
+
* @returns A new builder with the step added.
|
|
41
|
+
*/
|
|
42
|
+
addStep<TPart extends PartContent = TextPart["text"], TForwardArgs extends BaseArgs = EmptyArgs, TOutput extends OutputType<TPart, TForwardArgs> = OutputType<TPart, TForwardArgs>, TKind extends "text" | "file" | "data" = "text">(step: StepWithKind<TPart, TInboundArgs, TForwardArgs, TOutput, TKind>): StepBuilder<OutArgsOf<TOutput>>;
|
|
43
|
+
}
|
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
* Copyright 2025 The Artinet Project
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
6
|
-
import type { AgentCard, TaskQueryParams, MessageSendParams, Message } from "../schemas/a2a/index.js";
|
|
7
|
-
import { UpdateEvent } from "./services/a2a/index.js";
|
|
5
|
+
import { A2A } from "./a2a/index.js";
|
|
8
6
|
/**
|
|
9
7
|
* @interface Client
|
|
10
8
|
* @description Defines the standard contract for an A2A (Agent-to-Agent) client implementation.
|
|
@@ -19,24 +17,24 @@ export interface Client {
|
|
|
19
17
|
* The AgentCard contains essential information about the agent, such as its capabilities and endpoints.
|
|
20
18
|
* @param {string} wellKnownPath The standard path (e.g., "/.well-known/a2a") to look for the AgentCard.
|
|
21
19
|
* @param {string} fallbackPath An alternative path to check if the well-known path fails.
|
|
22
|
-
* @returns {Promise<AgentCard>} A promise that resolves with the AgentCard object.
|
|
20
|
+
* @returns {Promise<A2A.AgentCard>} A promise that resolves with the AgentCard object.
|
|
23
21
|
* @async
|
|
24
22
|
*/
|
|
25
|
-
agentCard(): Promise<AgentCard>;
|
|
23
|
+
agentCard(): Promise<A2A.AgentCard>;
|
|
26
24
|
/**
|
|
27
25
|
* @description Refreshes the cached AgentCard information by re-fetching it from the server.
|
|
28
26
|
* Useful when the agent's capabilities or configuration might have changed.
|
|
29
|
-
* @returns {Promise<AgentCard>} A promise that resolves with the updated AgentCard object.
|
|
27
|
+
* @returns {Promise<A2A.AgentCard>} A promise that resolves with the updated AgentCard object.
|
|
30
28
|
* @async
|
|
31
29
|
*/
|
|
32
|
-
refreshAgentCard(): Promise<AgentCard>;
|
|
30
|
+
refreshAgentCard(): Promise<A2A.AgentCard>;
|
|
33
31
|
/**
|
|
34
32
|
* @description Sends a task request to the agent server.
|
|
35
|
-
* @param {MessageSendParams} params Parameters required to send the task, including the task definition and metadata.
|
|
36
|
-
* @returns {Promise<Task | null>} A promise that resolves with the initial Task object representing the submitted task, or null if the submission failed.
|
|
33
|
+
* @param {A2A.MessageSendParams} params Parameters required to send the task, including the task definition and metadata.
|
|
34
|
+
* @returns {Promise<A2A.Task | null>} A promise that resolves with the initial Task object representing the submitted task, or null if the submission failed.
|
|
37
35
|
* @async
|
|
38
36
|
*/
|
|
39
|
-
sendMessage(params: MessageSendParams): Promise<Message | Task | null>;
|
|
37
|
+
sendMessage(params: A2A.MessageSendParams): Promise<A2A.Message | A2A.Task | null>;
|
|
40
38
|
/**
|
|
41
39
|
* @deprecated Will be removed in v6.Use sendMessage instead.
|
|
42
40
|
* @description Sends a task request to the agent server.
|
|
@@ -44,7 +42,7 @@ export interface Client {
|
|
|
44
42
|
* @returns {Promise<Task | null>} A promise that resolves with the initial Task object representing the submitted task, or null if the submission failed.
|
|
45
43
|
* @async
|
|
46
44
|
*/
|
|
47
|
-
sendTask(params: MessageSendParams): Promise<Message | Task | null>;
|
|
45
|
+
sendTask(params: A2A.MessageSendParams): Promise<A2A.Message | A2A.Task | null>;
|
|
48
46
|
/**
|
|
49
47
|
* @description Sends a task request and subscribes to real-time updates (status changes, artifact updates) for that task.
|
|
50
48
|
* This uses a streaming connection if available.
|
|
@@ -52,7 +50,7 @@ export interface Client {
|
|
|
52
50
|
* @returns {AsyncIterable<UpdateEvent>} An async iterable that yields task status and artifact updates.
|
|
53
51
|
* @async
|
|
54
52
|
*/
|
|
55
|
-
sendStreamingMessage(params: MessageSendParams): AsyncIterable<
|
|
53
|
+
sendStreamingMessage(params: A2A.MessageSendParams): AsyncIterable<A2A.Update>;
|
|
56
54
|
/**
|
|
57
55
|
* @deprecated Will be removed in v6Use sendStreamingMessage instead.
|
|
58
56
|
* @description Sends a task request and subscribes to real-time updates (status changes, artifact updates) for that task.
|
|
@@ -61,45 +59,45 @@ export interface Client {
|
|
|
61
59
|
* @returns {AsyncIterable<UpdateEvent>} An async iterable that yields task status and artifact updates.
|
|
62
60
|
* @async
|
|
63
61
|
*/
|
|
64
|
-
sendTaskSubscribe(params: MessageSendParams): AsyncIterable<
|
|
62
|
+
sendTaskSubscribe(params: A2A.MessageSendParams): AsyncIterable<A2A.Update>;
|
|
65
63
|
/**
|
|
66
64
|
* @description Retrieves the current state of a specific task by its ID.
|
|
67
|
-
* @param {TaskQueryParams} params Parameters containing the task ID to query.
|
|
68
|
-
* @returns {Promise<Task | null>} A promise that resolves with the Task object, or null if the task is not found.
|
|
65
|
+
* @param {A2A.TaskQueryParams} params Parameters containing the task ID to query.
|
|
66
|
+
* @returns {Promise<A2A.Task | null>} A promise that resolves with the Task object, or null if the task is not found.
|
|
69
67
|
* @async
|
|
70
68
|
*/
|
|
71
|
-
getTask(params: TaskQueryParams): Promise<Task | null>;
|
|
69
|
+
getTask(params: A2A.TaskQueryParams): Promise<A2A.Task | null>;
|
|
72
70
|
/**
|
|
73
71
|
* @description Sends a request to cancel an ongoing task.
|
|
74
|
-
* @param {TaskIdParams} params Parameters containing the ID of the task to cancel.
|
|
75
|
-
* @returns {Promise<Task | null>} A promise that resolves with the final state of the cancelled Task object, or null if cancellation failed or the task wasn't found.
|
|
72
|
+
* @param {A2A.TaskIdParams} params Parameters containing the ID of the task to cancel.
|
|
73
|
+
* @returns {Promise<A2A.Task | null>} A promise that resolves with the final state of the cancelled Task object, or null if cancellation failed or the task wasn't found.
|
|
76
74
|
* @async
|
|
77
75
|
*/
|
|
78
|
-
cancelTask(params: TaskIdParams): Promise<Task | null>;
|
|
76
|
+
cancelTask(params: A2A.TaskIdParams): Promise<A2A.Task | null>;
|
|
79
77
|
/**
|
|
80
78
|
* @description Configures push notifications for a specific task. This allows the client
|
|
81
79
|
* to receive updates asynchronously via a specified webhook URL.
|
|
82
80
|
* Requires the agent to support the 'pushNotifications' capability.
|
|
83
|
-
* @param {TaskPushNotificationConfig} params The configuration details for the push notification, including the task ID and webhook URL.
|
|
84
|
-
* @returns {Promise<TaskPushNotificationConfig | null>} A promise that resolves with the applied configuration, or null if the configuration failed.
|
|
81
|
+
* @param {A2A.TaskPushNotificationConfig} params The configuration details for the push notification, including the task ID and webhook URL.
|
|
82
|
+
* @returns {Promise<A2A.TaskPushNotificationConfig | null>} A promise that resolves with the applied configuration, or null if the configuration failed.
|
|
85
83
|
* @async
|
|
86
84
|
*/
|
|
87
|
-
setTaskPushNotification(params: TaskPushNotificationConfig): Promise<TaskPushNotificationConfig | null>;
|
|
85
|
+
setTaskPushNotification(params: A2A.TaskPushNotificationConfig): Promise<A2A.TaskPushNotificationConfig | null>;
|
|
88
86
|
/**
|
|
89
87
|
* @description Retrieves the current push notification configuration for a specific task.
|
|
90
|
-
* @param {TaskIdParams} params Parameters containing the task ID.
|
|
91
|
-
* @returns {Promise<TaskPushNotificationConfig | null>} A promise that resolves with the push notification configuration, or null if not configured or not found.
|
|
88
|
+
* @param {A2A.TaskIdParams} params Parameters containing the task ID.
|
|
89
|
+
* @returns {Promise<A2A.TaskPushNotificationConfig | null>} A promise that resolves with the push notification configuration, or null if not configured or not found.
|
|
92
90
|
* @async
|
|
93
91
|
*/
|
|
94
|
-
getTaskPushNotification(params: TaskIdParams): Promise<TaskPushNotificationConfig | null>;
|
|
92
|
+
getTaskPushNotification(params: A2A.TaskIdParams): Promise<A2A.TaskPushNotificationConfig | null>;
|
|
95
93
|
/**
|
|
96
94
|
* @description Resubscribes to updates for an existing task, potentially after a connection drop or client restart.
|
|
97
95
|
* This allows resuming the stream of status and artifact updates.
|
|
98
|
-
* @param {TaskQueryParams} params Parameters containing the task ID to resubscribe to.
|
|
96
|
+
* @param {A2A.TaskQueryParams} params Parameters containing the task ID to resubscribe to.
|
|
99
97
|
* @returns {AsyncIterable<UpdateEvent>} An async iterable that yields task status and artifact updates.
|
|
100
98
|
* @async
|
|
101
99
|
*/
|
|
102
|
-
resubscribeTask(params: TaskQueryParams): AsyncIterable<
|
|
100
|
+
resubscribeTask(params: A2A.TaskQueryParams): AsyncIterable<A2A.Update>;
|
|
103
101
|
/**
|
|
104
102
|
* @description Checks if the agent server supports a specific capability.
|
|
105
103
|
* @param {"streaming" | "pushNotifications" | "stateTransitionHistory"} capability The capability to check for.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { EventEmitter } from "events";
|
|
2
|
+
export interface Service<Params extends object = object, Result extends unknown = void> {
|
|
3
|
+
execute: (params: Params) => Promise<Result>;
|
|
4
|
+
stop: () => Promise<void>;
|
|
5
|
+
}
|
|
6
|
+
export interface Context<State extends object = object> {
|
|
7
|
+
readonly contextId: string;
|
|
8
|
+
readonly isCancelled: () => Promise<boolean>;
|
|
9
|
+
readonly abortSignal: AbortSignal;
|
|
10
|
+
readonly messages?: AsyncIterable<unknown>;
|
|
11
|
+
readonly publisher?: Publisher;
|
|
12
|
+
readonly getState: (args?: string) => Promise<State | undefined>;
|
|
13
|
+
metadata?: Record<string, unknown>;
|
|
14
|
+
readonly hooks?: Record<string, (...args: unknown[]) => Promise<unknown>>;
|
|
15
|
+
}
|
|
16
|
+
export interface Manager<T = object> {
|
|
17
|
+
get: (id: string) => Promise<T | undefined>;
|
|
18
|
+
set: (id: string, data?: T) => Promise<void>;
|
|
19
|
+
delete: (id: string) => Promise<void>;
|
|
20
|
+
has?: (id: string) => Promise<boolean>;
|
|
21
|
+
list?: () => Promise<T[]>;
|
|
22
|
+
}
|
|
23
|
+
export type Optional<T extends object = object> = Partial<T> & {
|
|
24
|
+
contextId: string;
|
|
25
|
+
};
|
|
26
|
+
export interface Contexts<T extends Context = Context> extends Manager<T> {
|
|
27
|
+
}
|
|
28
|
+
export interface Publisher<EventMap extends Record<string, any[]> = Record<string, any[]>> extends EventEmitter<EventMap> {
|
|
29
|
+
}
|
|
30
|
+
export interface Consumer<Received extends unknown, EventMap extends Record<string, any[]> = Record<string, any[]>> extends AsyncIterable<Received, Received, Received | undefined>, Publisher<EventMap> {
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as core from "./core.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as core from "./core.js";
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
export * from "./
|
|
2
|
-
export * from "./
|
|
3
|
-
export * from "./
|
|
1
|
+
export * from "./a2a/index.js";
|
|
2
|
+
export * from "./core/index.js";
|
|
3
|
+
export * from "./mcp/index.js";
|
|
4
|
+
export * from "./client.js";
|
|
5
|
+
export * from "./protocol.js";
|
|
6
|
+
export * from "./storage.js";
|
|
4
7
|
export * from "./utils/index.js";
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
export * from "./
|
|
2
|
-
export * from "./
|
|
3
|
-
export * from "./
|
|
1
|
+
export * from "./a2a/index.js";
|
|
2
|
+
export * from "./core/index.js";
|
|
3
|
+
export * from "./mcp/index.js";
|
|
4
|
+
export * from "./client.js";
|
|
5
|
+
export * from "./protocol.js";
|
|
6
|
+
export * from "./storage.js";
|
|
4
7
|
export * from "./utils/index.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as MCP from "./mcp.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as MCP from "./mcp.js";
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
* managing service lifecycle.
|
|
11
11
|
*
|
|
12
12
|
* @module MCPService
|
|
13
|
-
* @version 0.
|
|
13
|
+
* @version 0.6.0-preview
|
|
14
14
|
* @since 0.5.7
|
|
15
15
|
* @author The Artinet Project
|
|
16
16
|
*/
|
|
17
|
-
import {
|
|
17
|
+
import { core } from "../core/index.js";
|
|
18
18
|
/**
|
|
19
19
|
* Main interface for MCP service implementations.
|
|
20
20
|
*
|
|
@@ -40,10 +40,11 @@ import { ServiceInterface } from "../core/index.js";
|
|
|
40
40
|
* @public
|
|
41
41
|
* @since 0.5.7
|
|
42
42
|
*/
|
|
43
|
-
export interface
|
|
43
|
+
export interface Service extends Omit<core.Service, "execute"> {
|
|
44
44
|
/**
|
|
45
45
|
* Registers tools for the MCP service.
|
|
46
46
|
* @param uri - The URI of the agent card resource.
|
|
47
47
|
*/
|
|
48
48
|
registerTools?: (uri: string) => void;
|
|
49
49
|
}
|
|
50
|
+
export * from "@artinet/types/mcp";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 The Artinet Project
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Interface for a store of data.
|
|
7
|
+
* @deprecated Use IStore instead
|
|
8
|
+
* @template T - The type of data to store
|
|
9
|
+
*/
|
|
10
|
+
export interface Store<T> {
|
|
11
|
+
set(data: T, id?: string): Promise<void>;
|
|
12
|
+
get(id: string): Promise<T | undefined>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Interface for a store of data.
|
|
16
|
+
* @template T - The type of data to store
|
|
17
|
+
*/
|
|
18
|
+
export interface IStore<T> {
|
|
19
|
+
set(id: string, data: T): Promise<void>;
|
|
20
|
+
get(id: string): Promise<T | undefined>;
|
|
21
|
+
}
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* Copyright 2025 The Artinet Project
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
6
|
-
export declare const STATUS_UPDATE: (taskId: string, contextId: string, status: TaskState, message?: Message, timestamp?: string, final?: boolean) => TaskStatusUpdateEvent;
|
|
7
|
-
export declare const WORKING_UPDATE: (taskId: string, contextId: string, message?: Message, timestamp?: string) => TaskStatusUpdateEvent;
|
|
8
|
-
export declare const CANCEL_UPDATE: (taskId: string, contextId: string, message?: Message, timestamp?: string) => TaskStatusUpdateEvent;
|
|
9
|
-
export declare const SUBMITTED_UPDATE: (taskId: string, contextId: string, message?: Message, timestamp?: string) => TaskStatusUpdateEvent;
|
|
10
|
-
export declare const FAILED_UPDATE_EVENT: (taskId: string, contextId: string, message?: Message, timestamp?: string) => TaskStatusUpdateEvent;
|
|
11
|
-
export declare const FINAL_STATES: TaskState[];
|
|
5
|
+
import { A2A } from "../../types/index.js";
|
|
6
|
+
export declare const STATUS_UPDATE: (taskId: string, contextId: string, status: A2A.TaskState, message?: A2A.Message, timestamp?: string, final?: boolean) => A2A.TaskStatusUpdateEvent;
|
|
7
|
+
export declare const WORKING_UPDATE: (taskId: string, contextId: string, message?: A2A.Message, timestamp?: string) => A2A.TaskStatusUpdateEvent;
|
|
8
|
+
export declare const CANCEL_UPDATE: (taskId: string, contextId: string, message?: A2A.Message, timestamp?: string) => A2A.TaskStatusUpdateEvent;
|
|
9
|
+
export declare const SUBMITTED_UPDATE: (taskId: string, contextId: string, message?: A2A.Message, timestamp?: string) => A2A.TaskStatusUpdateEvent;
|
|
10
|
+
export declare const FAILED_UPDATE_EVENT: (taskId: string, contextId: string, message?: A2A.Message, timestamp?: string) => A2A.TaskStatusUpdateEvent;
|
|
11
|
+
export declare const FINAL_STATES: A2A.TaskState[];
|
|
@@ -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 } from "../../types/index.js";
|
|
6
6
|
import { getCurrentTimestamp } from "./utils.js";
|
|
7
7
|
//todo: protocol specific so move to a2a folder
|
|
8
8
|
export const STATUS_UPDATE = (taskId, contextId, status, message, timestamp = getCurrentTimestamp(), final = false) => {
|
|
@@ -19,20 +19,20 @@ export const STATUS_UPDATE = (taskId, contextId, status, message, timestamp = ge
|
|
|
19
19
|
};
|
|
20
20
|
};
|
|
21
21
|
export const WORKING_UPDATE = (taskId, contextId, message, timestamp) => {
|
|
22
|
-
return STATUS_UPDATE(taskId, contextId, TaskState.working, message, timestamp);
|
|
22
|
+
return STATUS_UPDATE(taskId, contextId, A2A.TaskState.working, message, timestamp);
|
|
23
23
|
};
|
|
24
24
|
export const CANCEL_UPDATE = (taskId, contextId, message, timestamp) => {
|
|
25
|
-
return STATUS_UPDATE(taskId, contextId, TaskState.canceled, message, timestamp, true);
|
|
25
|
+
return STATUS_UPDATE(taskId, contextId, A2A.TaskState.canceled, message, timestamp, true);
|
|
26
26
|
};
|
|
27
27
|
export const SUBMITTED_UPDATE = (taskId, contextId, message, timestamp) => {
|
|
28
|
-
return STATUS_UPDATE(taskId, contextId, TaskState.submitted, message, timestamp);
|
|
28
|
+
return STATUS_UPDATE(taskId, contextId, A2A.TaskState.submitted, message, timestamp);
|
|
29
29
|
};
|
|
30
30
|
export const FAILED_UPDATE_EVENT = (taskId, contextId, message, timestamp) => {
|
|
31
|
-
return STATUS_UPDATE(taskId, contextId, TaskState.failed, message, timestamp, true);
|
|
31
|
+
return STATUS_UPDATE(taskId, contextId, A2A.TaskState.failed, message, timestamp, true);
|
|
32
32
|
};
|
|
33
33
|
export const FINAL_STATES = [
|
|
34
|
-
TaskState.completed,
|
|
35
|
-
TaskState.failed,
|
|
36
|
-
TaskState.canceled,
|
|
37
|
-
TaskState.rejected,
|
|
34
|
+
A2A.TaskState.completed,
|
|
35
|
+
A2A.TaskState.failed,
|
|
36
|
+
A2A.TaskState.canceled,
|
|
37
|
+
A2A.TaskState.rejected,
|
|
38
38
|
];
|
|
@@ -2,23 +2,23 @@
|
|
|
2
2
|
* Copyright 2025 The Artinet Project
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
6
|
-
export declare class SystemError<T extends JSONRPCError> extends Error {
|
|
5
|
+
import { A2A, MCP } from "../../types/index.js";
|
|
6
|
+
export declare class SystemError<T extends MCP.JSONRPCError> extends Error {
|
|
7
7
|
message: string;
|
|
8
|
-
code: T["code"];
|
|
9
|
-
data: T["data"];
|
|
10
|
-
constructor(message: string, code: T["code"], data: T["data"]);
|
|
8
|
+
code: T["error"]["code"];
|
|
9
|
+
data: T["error"]["data"];
|
|
10
|
+
constructor(message: string, code: T["error"]["code"], data: T["error"]["data"]);
|
|
11
11
|
}
|
|
12
|
-
export declare const PARSE_ERROR: <T extends JSONParseError>(data: T["data"]) => SystemError<T>;
|
|
13
|
-
export declare const INVALID_REQUEST: <T extends InvalidRequestError>(data: T["data"]) => SystemError<T>;
|
|
14
|
-
export declare const METHOD_NOT_FOUND: <T extends MethodNotFoundError>(data: T["data"]) => SystemError<T>;
|
|
15
|
-
export declare const INVALID_PARAMS: <T extends InvalidParamsError>(data: T["data"]) => SystemError<T>;
|
|
16
|
-
export declare const INTERNAL_ERROR: <T extends InternalError>(data: T["data"]) => SystemError<T>;
|
|
17
|
-
export declare const TASK_NOT_FOUND: <T extends TaskNotFoundError>(data: T["data"]) => SystemError<T>;
|
|
18
|
-
export declare const TASK_NOT_CANCELABLE: <T extends TaskNotCancelableError>(data: T["data"]) => SystemError<T>;
|
|
19
|
-
export declare const PUSH_NOTIFICATION_NOT_SUPPORTED: <T extends A2AError>(data: T["data"]) => SystemError<T>;
|
|
20
|
-
export declare const AUTHENTICATED_EXTENDED_CARD_NOT_CONFIGURED: <T extends AuthenticatedExtendedCardNotConfiguredError>(data: T["data"]) => SystemError<T>;
|
|
21
|
-
export declare const UNSUPPORTED_OPERATION: <T extends A2AError>(data: T["data"]) => SystemError<T>;
|
|
22
|
-
export declare const CONTENT_TYPE_NOT_SUPPORTED: <T extends ContentTypeNotSupportedError>(data: T["data"]) => SystemError<T>;
|
|
23
|
-
export declare const INVALID_AGENT_RESPONSE: <T extends InvalidAgentResponseError>(data: T["data"]) => SystemError<T>;
|
|
24
|
-
export declare const FAILED_UPDATE: (taskId: string, contextId: string, messageId: string | undefined, errMessage: string) => TaskStatusUpdateEvent;
|
|
12
|
+
export declare const PARSE_ERROR: <T extends A2A.JSONParseError>(data: T["error"]["data"]) => SystemError<T>;
|
|
13
|
+
export declare const INVALID_REQUEST: <T extends A2A.InvalidRequestError>(data: T["error"]["data"]) => SystemError<T>;
|
|
14
|
+
export declare const METHOD_NOT_FOUND: <T extends A2A.MethodNotFoundError>(data: T["error"]["data"]) => SystemError<T>;
|
|
15
|
+
export declare const INVALID_PARAMS: <T extends A2A.InvalidParamsError>(data: T["error"]["data"]) => SystemError<T>;
|
|
16
|
+
export declare const INTERNAL_ERROR: <T extends A2A.InternalError>(data: T["error"]["data"]) => SystemError<T>;
|
|
17
|
+
export declare const TASK_NOT_FOUND: <T extends A2A.TaskNotFoundError>(data: T["error"]["data"]) => SystemError<T>;
|
|
18
|
+
export declare const TASK_NOT_CANCELABLE: <T extends A2A.TaskNotCancelableError>(data: T["error"]["data"]) => SystemError<T>;
|
|
19
|
+
export declare const PUSH_NOTIFICATION_NOT_SUPPORTED: <T extends A2A.A2AError>(data: T["error"]["data"]) => SystemError<T>;
|
|
20
|
+
export declare const AUTHENTICATED_EXTENDED_CARD_NOT_CONFIGURED: <T extends A2A.AuthenticatedExtendedCardNotConfiguredError>(data: T["error"]["data"]) => SystemError<T>;
|
|
21
|
+
export declare const UNSUPPORTED_OPERATION: <T extends A2A.A2AError>(data: T["error"]["data"]) => SystemError<T>;
|
|
22
|
+
export declare const CONTENT_TYPE_NOT_SUPPORTED: <T extends A2A.ContentTypeNotSupportedError>(data: T["error"]["data"]) => SystemError<T>;
|
|
23
|
+
export declare const INVALID_AGENT_RESPONSE: <T extends A2A.InvalidAgentResponseError>(data: T["error"]["data"]) => SystemError<T>;
|
|
24
|
+
export declare const FAILED_UPDATE: (taskId: string, contextId: string, messageId: string | undefined, errMessage: string) => A2A.TaskStatusUpdateEvent;
|
|
@@ -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 } from "../../types/index.js";
|
|
6
6
|
export class SystemError extends Error {
|
|
7
7
|
constructor(message, code, data) {
|
|
8
8
|
super(message);
|
|
@@ -13,25 +13,25 @@ export class SystemError extends Error {
|
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
// Factory methods for common errors
|
|
16
|
-
export const PARSE_ERROR = (data) => new SystemError("Invalid JSON payload", ErrorCodeParseError, data);
|
|
17
|
-
export const INVALID_REQUEST = (data) => new SystemError("Request payload validation error", ErrorCodeInvalidRequest, data);
|
|
18
|
-
export const METHOD_NOT_FOUND = (data) => new SystemError("Method not found", ErrorCodeMethodNotFound, data);
|
|
19
|
-
export const INVALID_PARAMS = (data) => new SystemError("Invalid parameters", ErrorCodeInvalidParams, data);
|
|
20
|
-
export const INTERNAL_ERROR = (data) => new SystemError("Internal error", ErrorCodeInternalError, data);
|
|
21
|
-
export const TASK_NOT_FOUND = (data) => new SystemError("Task not found", ErrorCodeTaskNotFound, data);
|
|
22
|
-
export const TASK_NOT_CANCELABLE = (data) => new SystemError("Task cannot be canceled", ErrorCodeTaskNotCancelable, data);
|
|
23
|
-
export const PUSH_NOTIFICATION_NOT_SUPPORTED = (data) => new SystemError("Push Notifications is not supported", ErrorCodePushNotificationNotSupported, data);
|
|
24
|
-
export const AUTHENTICATED_EXTENDED_CARD_NOT_CONFIGURED = (data) => new SystemError("Authenticated Extended Card is not configured", ErrorCodeAuthenticatedExtendedCardNotConfigured, data);
|
|
25
|
-
export const UNSUPPORTED_OPERATION = (data) => new SystemError("This operation is not supported", ErrorCodeUnsupportedOperation, data);
|
|
26
|
-
export const CONTENT_TYPE_NOT_SUPPORTED = (data) => new SystemError("Content type not supported", ErrorCodeContentTypeNotSupported, data);
|
|
27
|
-
export const INVALID_AGENT_RESPONSE = (data) => new SystemError("Invalid agent response", ErrorCodeInvalidAgentResponse, data);
|
|
16
|
+
export const PARSE_ERROR = (data) => new SystemError("Invalid JSON payload", A2A.ErrorCodeParseError, data);
|
|
17
|
+
export const INVALID_REQUEST = (data) => new SystemError("Request payload validation error", A2A.ErrorCodeInvalidRequest, data);
|
|
18
|
+
export const METHOD_NOT_FOUND = (data) => new SystemError("Method not found", A2A.ErrorCodeMethodNotFound, data);
|
|
19
|
+
export const INVALID_PARAMS = (data) => new SystemError("Invalid parameters", A2A.ErrorCodeInvalidParams, data);
|
|
20
|
+
export const INTERNAL_ERROR = (data) => new SystemError("Internal error", A2A.ErrorCodeInternalError, data);
|
|
21
|
+
export const TASK_NOT_FOUND = (data) => new SystemError("Task not found", A2A.ErrorCodeTaskNotFound, data);
|
|
22
|
+
export const TASK_NOT_CANCELABLE = (data) => new SystemError("Task cannot be canceled", A2A.ErrorCodeTaskNotCancelable, data);
|
|
23
|
+
export const PUSH_NOTIFICATION_NOT_SUPPORTED = (data) => new SystemError("Push Notifications is not supported", A2A.ErrorCodePushNotificationNotSupported, data);
|
|
24
|
+
export const AUTHENTICATED_EXTENDED_CARD_NOT_CONFIGURED = (data) => new SystemError("Authenticated Extended Card is not configured", A2A.ErrorCodeAuthenticatedExtendedCardNotConfigured, data);
|
|
25
|
+
export const UNSUPPORTED_OPERATION = (data) => new SystemError("This operation is not supported", A2A.ErrorCodeUnsupportedOperation, data);
|
|
26
|
+
export const CONTENT_TYPE_NOT_SUPPORTED = (data) => new SystemError("Content type not supported", A2A.ErrorCodeContentTypeNotSupported, data);
|
|
27
|
+
export const INVALID_AGENT_RESPONSE = (data) => new SystemError("Invalid agent response", A2A.ErrorCodeInvalidAgentResponse, data);
|
|
28
28
|
export const FAILED_UPDATE = (taskId, contextId, messageId = "failed-update", errMessage) => ({
|
|
29
29
|
taskId,
|
|
30
30
|
contextId,
|
|
31
31
|
kind: "status-update",
|
|
32
32
|
final: true,
|
|
33
33
|
status: {
|
|
34
|
-
state: TaskState.failed,
|
|
34
|
+
state: A2A.TaskState.failed,
|
|
35
35
|
message: {
|
|
36
36
|
messageId,
|
|
37
37
|
role: "agent",
|
|
@@ -7,3 +7,26 @@
|
|
|
7
7
|
* @returns The current timestamp as a string.
|
|
8
8
|
*/
|
|
9
9
|
export declare function getCurrentTimestamp(): string;
|
|
10
|
+
/**
|
|
11
|
+
* Sleeps for a given number of milliseconds.
|
|
12
|
+
* @param ms - The number of milliseconds to sleep.
|
|
13
|
+
* @returns A promise that resolves when the sleep is complete.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* await sleep(1000);
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare function sleep(ms: number): Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* Formats a JSON object into a string with indentation.
|
|
23
|
+
* @param json - The JSON object to format.
|
|
24
|
+
* @returns A string representation of the JSON object.
|
|
25
|
+
*/
|
|
26
|
+
export declare function formatJson(json: object): string;
|
|
27
|
+
/**
|
|
28
|
+
* Formats an error into a standard error object for logging.
|
|
29
|
+
* @param error - The error to format.
|
|
30
|
+
* @returns A standard error object.
|
|
31
|
+
*/
|
|
32
|
+
export declare function formatError(error: unknown): Error;
|
|
@@ -9,3 +9,35 @@
|
|
|
9
9
|
export function getCurrentTimestamp() {
|
|
10
10
|
return new Date().toISOString();
|
|
11
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* Sleeps for a given number of milliseconds.
|
|
14
|
+
* @param ms - The number of milliseconds to sleep.
|
|
15
|
+
* @returns A promise that resolves when the sleep is complete.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* await sleep(1000);
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export function sleep(ms) {
|
|
23
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Formats a JSON object into a string with indentation.
|
|
27
|
+
* @param json - The JSON object to format.
|
|
28
|
+
* @returns A string representation of the JSON object.
|
|
29
|
+
*/
|
|
30
|
+
export function formatJson(json) {
|
|
31
|
+
return JSON.stringify(json, null, 2);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Formats an error into a standard error object for logging.
|
|
35
|
+
* @param error - The error to format.
|
|
36
|
+
* @returns A standard error object.
|
|
37
|
+
*/
|
|
38
|
+
export function formatError(error) {
|
|
39
|
+
if (error instanceof Error) {
|
|
40
|
+
return error;
|
|
41
|
+
}
|
|
42
|
+
return new Error(String(error));
|
|
43
|
+
}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Copyright 2025 The Artinet Project
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
|
-
import
|
|
6
|
-
import type { Client } from "../types/
|
|
5
|
+
import { A2A } from "../types/index.js";
|
|
6
|
+
import type { Client } from "../types/client.js";
|
|
7
7
|
/**
|
|
8
8
|
* A2AClient is the main client class for interacting with Agent2Agent (A2A) protocol-compliant services.
|
|
9
9
|
* It provides methods for sending tasks, retrieving statuses, canceling operations, and handling streaming responses.
|
|
@@ -35,68 +35,69 @@ export declare class A2AClient implements Client {
|
|
|
35
35
|
* Caches the result after the first successful fetch.
|
|
36
36
|
* @returns A promise resolving to the AgentCard.
|
|
37
37
|
*/
|
|
38
|
-
agentCard(): Promise<AgentCard>;
|
|
38
|
+
agentCard(): Promise<A2A.AgentCard>;
|
|
39
39
|
/**
|
|
40
|
-
*
|
|
41
|
-
* @returns A promise resolving to the
|
|
40
|
+
* Retrieves the AgentCard from the A2A server.
|
|
41
|
+
* @returns A promise resolving to the AgentCard.
|
|
42
42
|
*/
|
|
43
|
-
|
|
43
|
+
getAgentCard(): Promise<A2A.AgentCard>;
|
|
44
44
|
/**
|
|
45
|
-
*
|
|
46
|
-
* @
|
|
47
|
-
* @returns A promise resolving to Message/Task response from the agent server or null.
|
|
45
|
+
* Refreshes the cached AgentCard by fetching it again from the server.
|
|
46
|
+
* @returns A promise resolving to the updated AgentCard.
|
|
48
47
|
*/
|
|
49
|
-
|
|
48
|
+
refreshAgentCard(): Promise<A2A.AgentCard>;
|
|
49
|
+
sendMessage(params: A2A.MessageSendParams): Promise<A2A.Message | A2A.Task | null>;
|
|
50
|
+
sendMessage(params: string | A2A.MessageSendParams["message"]): Promise<A2A.Message | A2A.Task | null>;
|
|
50
51
|
/**
|
|
51
52
|
* @deprecated Use sendMessage instead.
|
|
52
53
|
* Sends a task request to the agent (non-streaming).
|
|
53
54
|
* @param params The parameters for the message/send method.
|
|
54
55
|
* @returns A promise resolving to the Task object or null.
|
|
55
56
|
*/
|
|
56
|
-
sendTask(params: MessageSendParams): Promise<Message | Task | null>;
|
|
57
|
+
sendTask(params: A2A.MessageSendParams): Promise<A2A.Message | A2A.Task | null>;
|
|
57
58
|
/**
|
|
58
59
|
* Sends a Message and returns a stream of status and artifact updates.
|
|
59
60
|
* @param params Task parameters for the request
|
|
60
61
|
* @returns An AsyncIterable that yields TaskStatusUpdateEvent/TaskArtifactUpdateEvent/Task/Message payloads.
|
|
61
62
|
*/
|
|
62
|
-
sendStreamingMessage(params: MessageSendParams | string): AsyncIterable<
|
|
63
|
+
sendStreamingMessage(params: A2A.MessageSendParams | string): AsyncIterable<A2A.Update>;
|
|
63
64
|
/**
|
|
64
65
|
* @deprecated Use sendStreamingMessage instead.
|
|
65
66
|
* Sends a task and returns a subscription to status and artifact updates.
|
|
66
67
|
* @param params Task parameters for the request
|
|
67
68
|
* @returns An AsyncIterable that yields TaskStatusUpdateEvent or TaskArtifactUpdateEvent payloads.
|
|
68
69
|
*/
|
|
69
|
-
sendTaskSubscribe(params: MessageSendParams): AsyncIterable<
|
|
70
|
+
sendTaskSubscribe(params: A2A.MessageSendParams): AsyncIterable<A2A.Update>;
|
|
70
71
|
/**
|
|
71
72
|
* Retrieves the current state of a task.
|
|
72
73
|
* @param params The parameters for the tasks/get method.
|
|
73
74
|
* @returns A promise resolving to the Task object or null.
|
|
74
75
|
*/
|
|
75
|
-
getTask(params: TaskQueryParams): Promise<Task | null>;
|
|
76
|
+
getTask(params: A2A.TaskQueryParams): Promise<A2A.Task | null>;
|
|
76
77
|
/**
|
|
77
78
|
* Cancels a currently running task.
|
|
78
79
|
* @param params The parameters for the tasks/cancel method.
|
|
79
80
|
* @returns A promise resolving to the updated Task object (usually canceled state) or null.
|
|
80
81
|
*/
|
|
81
|
-
cancelTask(params: TaskIdParams): Promise<Task | null>;
|
|
82
|
+
cancelTask(params: A2A.TaskIdParams): Promise<A2A.Task | null>;
|
|
82
83
|
/**
|
|
83
84
|
* Sets or updates the push notification config for a task.
|
|
84
85
|
* @param params The parameters for the tasks/pushNotificationConfig/set method (which is TaskPushNotificationConfig).
|
|
85
86
|
* @returns A promise resolving to the confirmed TaskPushNotificationConfig or null.
|
|
86
87
|
*/
|
|
87
|
-
setTaskPushNotification(params: TaskPushNotificationConfig): Promise<TaskPushNotificationConfig | null>;
|
|
88
|
+
setTaskPushNotification(params: A2A.TaskPushNotificationConfig): Promise<A2A.TaskPushNotificationConfig | null>;
|
|
88
89
|
/**
|
|
89
90
|
* Retrieves the currently configured push notification config for a task.
|
|
90
91
|
* @param params The parameters for the tasks/pushNotificationConfig/get method.
|
|
91
92
|
* @returns A promise resolving to the TaskPushNotificationConfig or null.
|
|
92
93
|
*/
|
|
93
|
-
getTaskPushNotification(params: TaskIdParams): Promise<TaskPushNotificationConfig | null>;
|
|
94
|
+
getTaskPushNotification(params: A2A.TaskIdParams): Promise<A2A.TaskPushNotificationConfig | null>;
|
|
94
95
|
/**
|
|
95
96
|
* Resubscribes to an existing task's update stream.
|
|
96
97
|
* @param params Parameters identifying the task to resubscribe to
|
|
97
98
|
* @returns An AsyncIterable that yields TaskStatusUpdateEvent or TaskArtifactUpdateEvent payloads.
|
|
98
99
|
*/
|
|
99
|
-
resubscribeTask(params: TaskQueryParams): AsyncIterable<
|
|
100
|
+
resubscribeTask(params: A2A.TaskQueryParams): AsyncIterable<A2A.Update>;
|
|
100
101
|
/**
|
|
101
102
|
* Checks if the server supports a specific capability based on the agent card.
|
|
102
103
|
* @param capability The capability to check (e.g., 'streaming', 'pushNotifications').
|