@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,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,5 @@
|
|
|
2
2
|
* Copyright 2025 The Artinet Project
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
6
|
-
export declare const
|
|
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 FINAL_STATES: A2A.TaskState[];
|
|
@@ -2,37 +2,10 @@
|
|
|
2
2
|
* Copyright 2025 The Artinet Project
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
6
|
-
import { getCurrentTimestamp } from "./utils.js";
|
|
7
|
-
//todo: protocol specific so move to a2a folder
|
|
8
|
-
export const STATUS_UPDATE = (taskId, contextId, status, message, timestamp = getCurrentTimestamp(), final = false) => {
|
|
9
|
-
return {
|
|
10
|
-
taskId: taskId,
|
|
11
|
-
contextId: contextId,
|
|
12
|
-
kind: "status-update",
|
|
13
|
-
status: {
|
|
14
|
-
state: status,
|
|
15
|
-
message: message,
|
|
16
|
-
timestamp: timestamp,
|
|
17
|
-
},
|
|
18
|
-
final: final,
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
export const WORKING_UPDATE = (taskId, contextId, message, timestamp) => {
|
|
22
|
-
return STATUS_UPDATE(taskId, contextId, TaskState.working, message, timestamp);
|
|
23
|
-
};
|
|
24
|
-
export const CANCEL_UPDATE = (taskId, contextId, message, timestamp) => {
|
|
25
|
-
return STATUS_UPDATE(taskId, contextId, TaskState.canceled, message, timestamp, true);
|
|
26
|
-
};
|
|
27
|
-
export const SUBMITTED_UPDATE = (taskId, contextId, message, timestamp) => {
|
|
28
|
-
return STATUS_UPDATE(taskId, contextId, TaskState.submitted, message, timestamp);
|
|
29
|
-
};
|
|
30
|
-
export const FAILED_UPDATE_EVENT = (taskId, contextId, message, timestamp) => {
|
|
31
|
-
return STATUS_UPDATE(taskId, contextId, TaskState.failed, message, timestamp, true);
|
|
32
|
-
};
|
|
5
|
+
import { A2A } from "../../types/index.js";
|
|
33
6
|
export const FINAL_STATES = [
|
|
34
|
-
TaskState.completed,
|
|
35
|
-
TaskState.failed,
|
|
36
|
-
TaskState.canceled,
|
|
37
|
-
TaskState.rejected,
|
|
7
|
+
A2A.TaskState.completed,
|
|
8
|
+
A2A.TaskState.failed,
|
|
9
|
+
A2A.TaskState.canceled,
|
|
10
|
+
A2A.TaskState.rejected,
|
|
38
11
|
];
|
|
@@ -2,23 +2,79 @@
|
|
|
2
2
|
* Copyright 2025 The Artinet Project
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
6
|
-
|
|
5
|
+
import { A2A, MCP } from "../../types/index.js";
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated Use errors from the `@a2a-js/sdk` package instead
|
|
8
|
+
* @since 0.6.0
|
|
9
|
+
*/
|
|
10
|
+
export declare class SystemError<T extends MCP.JSONRPCErrorResponse> extends Error {
|
|
7
11
|
message: string;
|
|
8
|
-
code: T["code"];
|
|
9
|
-
data: T["data"];
|
|
10
|
-
constructor(message: string, code: T["code"], data: T["data"]);
|
|
12
|
+
code: T["error"]["code"];
|
|
13
|
+
data: T["error"]["data"];
|
|
14
|
+
constructor(message: string, code: T["error"]["code"], data: T["error"]["data"]);
|
|
11
15
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export declare const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
export declare const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated Use errors from the `@a2a-js/sdk` package instead
|
|
18
|
+
* @since 0.6.0
|
|
19
|
+
*/
|
|
20
|
+
export declare const PARSE_ERROR: <T extends A2A.JSONParseError>(data: T["error"]["data"]) => SystemError<T>;
|
|
21
|
+
/**
|
|
22
|
+
* @deprecated Use errors from the `@a2a-js/sdk` package instead
|
|
23
|
+
* @since 0.6.0
|
|
24
|
+
*/
|
|
25
|
+
export declare const INVALID_REQUEST: <T extends A2A.InvalidRequestError>(data: T["error"]["data"]) => SystemError<T>;
|
|
26
|
+
/**
|
|
27
|
+
* @deprecated Use errors from the `@a2a-js/sdk` package instead
|
|
28
|
+
* @since 0.6.0
|
|
29
|
+
*/
|
|
30
|
+
export declare const METHOD_NOT_FOUND: <T extends A2A.MethodNotFoundError>(data: T["error"]["data"]) => SystemError<T>;
|
|
31
|
+
/**
|
|
32
|
+
* @deprecated Use errors from the `@a2a-js/sdk` package instead
|
|
33
|
+
* @since 0.6.0
|
|
34
|
+
*/
|
|
35
|
+
export declare const INVALID_PARAMS: <T extends A2A.InvalidParamsError>(data: T["error"]["data"]) => SystemError<T>;
|
|
36
|
+
/**
|
|
37
|
+
* @deprecated Use errors from the `@a2a-js/sdk` package instead
|
|
38
|
+
* @since 0.6.0
|
|
39
|
+
*/
|
|
40
|
+
export declare const INTERNAL_ERROR: <T extends A2A.InternalError>(data: T["error"]["data"]) => SystemError<T>;
|
|
41
|
+
/**
|
|
42
|
+
* @deprecated Use errors from the `@a2a-js/sdk` package instead
|
|
43
|
+
* @since 0.6.0
|
|
44
|
+
*/
|
|
45
|
+
export declare const TASK_NOT_FOUND: <T extends A2A.TaskNotFoundError>(data: T["error"]["data"]) => SystemError<T>;
|
|
46
|
+
/**
|
|
47
|
+
* @deprecated Use errors from the `@a2a-js/sdk` package instead
|
|
48
|
+
* @since 0.6.0
|
|
49
|
+
*/
|
|
50
|
+
export declare const TASK_NOT_CANCELABLE: <T extends A2A.TaskNotCancelableError>(data: T["error"]["data"]) => SystemError<T>;
|
|
51
|
+
/**
|
|
52
|
+
* @deprecated Use errors from the `@a2a-js/sdk` package instead
|
|
53
|
+
* @since 0.6.0
|
|
54
|
+
*/
|
|
55
|
+
export declare const PUSH_NOTIFICATION_NOT_SUPPORTED: <T extends A2A.A2AError>(data: T["error"]["data"]) => SystemError<T>;
|
|
56
|
+
/**
|
|
57
|
+
* @deprecated Use errors from the `@a2a-js/sdk` package instead
|
|
58
|
+
* @since 0.6.0
|
|
59
|
+
*/
|
|
60
|
+
export declare const AUTHENTICATED_EXTENDED_CARD_NOT_CONFIGURED: <T extends A2A.AuthenticatedExtendedCardNotConfiguredError>(data: T["error"]["data"]) => SystemError<T>;
|
|
61
|
+
/**
|
|
62
|
+
* @deprecated Use errors from the `@a2a-js/sdk` package instead
|
|
63
|
+
* @since 0.6.0
|
|
64
|
+
*/
|
|
65
|
+
export declare const UNSUPPORTED_OPERATION: <T extends A2A.A2AError>(data: T["error"]["data"]) => SystemError<T>;
|
|
66
|
+
/**
|
|
67
|
+
* @deprecated Use errors from the `@a2a-js/sdk` package instead
|
|
68
|
+
* @since 0.6.0
|
|
69
|
+
*/
|
|
70
|
+
export declare const CONTENT_TYPE_NOT_SUPPORTED: <T extends A2A.ContentTypeNotSupportedError>(data: T["error"]["data"]) => SystemError<T>;
|
|
71
|
+
/**
|
|
72
|
+
* @deprecated Use errors from the `@a2a-js/sdk` package instead
|
|
73
|
+
* @since 0.6.0
|
|
74
|
+
*/
|
|
75
|
+
export declare const INVALID_AGENT_RESPONSE: <T extends A2A.InvalidAgentResponseError>(data: T["error"]["data"]) => SystemError<T>;
|
|
76
|
+
/**
|
|
77
|
+
* @deprecated Use {@link describe.update.failed} instead
|
|
78
|
+
* @since 0.6.0
|
|
79
|
+
*/
|
|
80
|
+
export declare const FAILED_UPDATE: (taskId: string, contextId: string, messageId: string | undefined, errMessage: string) => A2A.TaskStatusUpdateEvent;
|
|
@@ -2,41 +2,94 @@
|
|
|
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
|
+
import * as describe from "../../create/describe.js";
|
|
7
|
+
import { formatJson } from "./utils.js";
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated Use errors from the `@a2a-js/sdk` package instead
|
|
10
|
+
* @since 0.6.0
|
|
11
|
+
*/
|
|
6
12
|
export class SystemError extends Error {
|
|
7
13
|
constructor(message, code, data) {
|
|
8
|
-
super(message);
|
|
14
|
+
super(message + " " + formatJson({ cause: data }));
|
|
9
15
|
// this.name = "RpcError";
|
|
10
16
|
this.message = message;
|
|
11
17
|
this.code = code;
|
|
12
18
|
this.data = data;
|
|
13
19
|
}
|
|
14
20
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
export const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
export const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
21
|
+
/**
|
|
22
|
+
* @deprecated Use errors from the `@a2a-js/sdk` package instead
|
|
23
|
+
* @since 0.6.0
|
|
24
|
+
*/
|
|
25
|
+
export const PARSE_ERROR = (data) => new SystemError("Invalid JSON payload", A2A.ErrorCodeParseError, data);
|
|
26
|
+
/**
|
|
27
|
+
* @deprecated Use errors from the `@a2a-js/sdk` package instead
|
|
28
|
+
* @since 0.6.0
|
|
29
|
+
*/
|
|
30
|
+
export const INVALID_REQUEST = (data) => new SystemError("Request payload validation error", A2A.ErrorCodeInvalidRequest, data);
|
|
31
|
+
/**
|
|
32
|
+
* @deprecated Use errors from the `@a2a-js/sdk` package instead
|
|
33
|
+
* @since 0.6.0
|
|
34
|
+
*/
|
|
35
|
+
export const METHOD_NOT_FOUND = (data) => new SystemError("Method not found", A2A.ErrorCodeMethodNotFound, data);
|
|
36
|
+
/**
|
|
37
|
+
* @deprecated Use errors from the `@a2a-js/sdk` package instead
|
|
38
|
+
* @since 0.6.0
|
|
39
|
+
*/
|
|
40
|
+
export const INVALID_PARAMS = (data) => new SystemError("Invalid parameters", A2A.ErrorCodeInvalidParams, data);
|
|
41
|
+
/**
|
|
42
|
+
* @deprecated Use errors from the `@a2a-js/sdk` package instead
|
|
43
|
+
* @since 0.6.0
|
|
44
|
+
*/
|
|
45
|
+
export const INTERNAL_ERROR = (data) => new SystemError("Internal error", A2A.ErrorCodeInternalError, data);
|
|
46
|
+
/**
|
|
47
|
+
* @deprecated Use errors from the `@a2a-js/sdk` package instead
|
|
48
|
+
* @since 0.6.0
|
|
49
|
+
*/
|
|
50
|
+
export const TASK_NOT_FOUND = (data) => new SystemError("Task not found", A2A.ErrorCodeTaskNotFound, data);
|
|
51
|
+
/**
|
|
52
|
+
* @deprecated Use errors from the `@a2a-js/sdk` package instead
|
|
53
|
+
* @since 0.6.0
|
|
54
|
+
*/
|
|
55
|
+
export const TASK_NOT_CANCELABLE = (data) => new SystemError("Task cannot be canceled", A2A.ErrorCodeTaskNotCancelable, data);
|
|
56
|
+
/**
|
|
57
|
+
* @deprecated Use errors from the `@a2a-js/sdk` package instead
|
|
58
|
+
* @since 0.6.0
|
|
59
|
+
*/
|
|
60
|
+
export const PUSH_NOTIFICATION_NOT_SUPPORTED = (data) => new SystemError("Push Notifications is not supported", A2A.ErrorCodePushNotificationNotSupported, data);
|
|
61
|
+
/**
|
|
62
|
+
* @deprecated Use errors from the `@a2a-js/sdk` package instead
|
|
63
|
+
* @since 0.6.0
|
|
64
|
+
*/
|
|
65
|
+
export const AUTHENTICATED_EXTENDED_CARD_NOT_CONFIGURED = (data) => new SystemError("Authenticated Extended Card is not configured", A2A.ErrorCodeAuthenticatedExtendedCardNotConfigured, data);
|
|
66
|
+
/**
|
|
67
|
+
* @deprecated Use errors from the `@a2a-js/sdk` package instead
|
|
68
|
+
* @since 0.6.0
|
|
69
|
+
*/
|
|
70
|
+
export const UNSUPPORTED_OPERATION = (data) => new SystemError("This operation is not supported", A2A.ErrorCodeUnsupportedOperation, data);
|
|
71
|
+
/**
|
|
72
|
+
* @deprecated Use errors from the `@a2a-js/sdk` package instead
|
|
73
|
+
* @since 0.6.0
|
|
74
|
+
*/
|
|
75
|
+
export const CONTENT_TYPE_NOT_SUPPORTED = (data) => new SystemError("Content type not supported", A2A.ErrorCodeContentTypeNotSupported, data);
|
|
76
|
+
/**
|
|
77
|
+
* @deprecated Use errors from the `@a2a-js/sdk` package instead
|
|
78
|
+
* @since 0.6.0
|
|
79
|
+
*/
|
|
80
|
+
export const INVALID_AGENT_RESPONSE = (data) => new SystemError("Invalid agent response", A2A.ErrorCodeInvalidAgentResponse, data);
|
|
81
|
+
/**
|
|
82
|
+
* @deprecated Use {@link describe.update.failed} instead
|
|
83
|
+
* @since 0.6.0
|
|
84
|
+
*/
|
|
85
|
+
export const FAILED_UPDATE = (taskId, contextId, messageId = "failed-update", errMessage) => {
|
|
86
|
+
return describe.update.failed({
|
|
87
|
+
taskId,
|
|
88
|
+
contextId,
|
|
89
|
+
final: true,
|
|
90
|
+
message: describe.message({
|
|
36
91
|
messageId,
|
|
37
|
-
role: "agent",
|
|
38
92
|
parts: [{ kind: "text", text: errMessage }],
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
});
|
|
93
|
+
}),
|
|
94
|
+
});
|
|
95
|
+
};
|
|
@@ -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
|
+
}
|