@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
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2025 The Artinet Project
|
|
3
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
*/
|
|
5
|
-
import { getCurrentTimestamp } from "../../../../utils/index.js";
|
|
6
|
-
import { logError } from "../../../../utils/logging/index.js";
|
|
7
|
-
import { processArtifactUpdate } from "./artifact.js";
|
|
8
|
-
export var UpdateKind;
|
|
9
|
-
(function (UpdateKind) {
|
|
10
|
-
UpdateKind["Message"] = "message";
|
|
11
|
-
UpdateKind["Task"] = "task";
|
|
12
|
-
UpdateKind["StatusUpdate"] = "status-update";
|
|
13
|
-
UpdateKind["ArtifactUpdate"] = "artifact-update";
|
|
14
|
-
})(UpdateKind || (UpdateKind = {}));
|
|
15
|
-
const isMessageInHistory = (task, message) => {
|
|
16
|
-
return task.history?.find((msg) => msg.messageId === message.messageId);
|
|
17
|
-
};
|
|
18
|
-
const updateHistory = (current, updateMessage) => {
|
|
19
|
-
if (!isMessageInHistory(current.task, updateMessage)) {
|
|
20
|
-
// current.history = [...(current.history ?? []), updateMessage]; deprecating history
|
|
21
|
-
current.task.history = [...(current.task.history ?? []), updateMessage];
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
export const updateMessage = async (props) => {
|
|
25
|
-
const { context, update } = props;
|
|
26
|
-
if (!update || update.kind !== UpdateKind.Message) {
|
|
27
|
-
logError("updateMessage", "Invalid update", update);
|
|
28
|
-
return false;
|
|
29
|
-
}
|
|
30
|
-
context.latestUserMessage = update;
|
|
31
|
-
return true;
|
|
32
|
-
};
|
|
33
|
-
export const updateTask = async (props) => {
|
|
34
|
-
const { context, current, update } = props;
|
|
35
|
-
if (!update || update.kind !== UpdateKind.Task) {
|
|
36
|
-
logError("updateTask", "Invalid update kind", update);
|
|
37
|
-
return false;
|
|
38
|
-
}
|
|
39
|
-
current.task = { ...current.task, ...update };
|
|
40
|
-
if (context.latestUserMessage &&
|
|
41
|
-
!isMessageInHistory(current.task, context.latestUserMessage)) {
|
|
42
|
-
//todo seems that we can use updateHistory here instead (will change after we deprecate history fully & add update specific tests)
|
|
43
|
-
current.task.history = [
|
|
44
|
-
context.latestUserMessage,
|
|
45
|
-
...(current.task.history ?? []),
|
|
46
|
-
];
|
|
47
|
-
// current.history = [context.latestUserMessage, ...(current.history ?? [])]; deprecating history
|
|
48
|
-
}
|
|
49
|
-
return true;
|
|
50
|
-
};
|
|
51
|
-
export const updateTaskStatusUpdate = async (props) => {
|
|
52
|
-
const { current, update } = props;
|
|
53
|
-
if (!update || update.kind !== UpdateKind.StatusUpdate) {
|
|
54
|
-
logError("updateTaskStatusUpdate", "Invalid update kind", update);
|
|
55
|
-
return false;
|
|
56
|
-
}
|
|
57
|
-
if (current.task.id === update.taskId) {
|
|
58
|
-
current.task.status = update.status;
|
|
59
|
-
current.task.status.timestamp = getCurrentTimestamp();
|
|
60
|
-
if (update.status.message) {
|
|
61
|
-
updateHistory(current, update.status.message);
|
|
62
|
-
}
|
|
63
|
-
return true;
|
|
64
|
-
}
|
|
65
|
-
logError("updateTaskStatusUpdate", "Invalid task id", update);
|
|
66
|
-
return false;
|
|
67
|
-
};
|
|
68
|
-
export const updateTaskArtifactUpdate = async (props) => {
|
|
69
|
-
const { current, update } = props;
|
|
70
|
-
if (!update || update.kind !== UpdateKind.ArtifactUpdate) {
|
|
71
|
-
logError("updateTaskArtifactUpdate", "Invalid update kind", update);
|
|
72
|
-
return false;
|
|
73
|
-
}
|
|
74
|
-
if (current.task.id === update.taskId) {
|
|
75
|
-
current.task.artifacts = processArtifactUpdate(update.append ?? false, current.task.artifacts ?? [], update.artifact);
|
|
76
|
-
return true;
|
|
77
|
-
}
|
|
78
|
-
logError("updateTaskArtifactUpdate", "Invalid task id", update); //we should never get here, but just in case
|
|
79
|
-
return true;
|
|
80
|
-
};
|
|
81
|
-
export const updateState = async (props) => {
|
|
82
|
-
const { context, current, update } = props;
|
|
83
|
-
if (!update || !update.kind) {
|
|
84
|
-
logError("update", "Invalid update", update);
|
|
85
|
-
return false;
|
|
86
|
-
}
|
|
87
|
-
if (!current || !current.task || !current.task.id) {
|
|
88
|
-
logError("update", "Invalid current", current);
|
|
89
|
-
return false;
|
|
90
|
-
}
|
|
91
|
-
if (!context || !context.contextId) {
|
|
92
|
-
logError("update", "Invalid context", context);
|
|
93
|
-
return false;
|
|
94
|
-
}
|
|
95
|
-
switch (update.kind) {
|
|
96
|
-
case UpdateKind.Message:
|
|
97
|
-
return updateMessage({
|
|
98
|
-
context,
|
|
99
|
-
current,
|
|
100
|
-
update: update,
|
|
101
|
-
});
|
|
102
|
-
case UpdateKind.Task:
|
|
103
|
-
return updateTask({
|
|
104
|
-
context,
|
|
105
|
-
current,
|
|
106
|
-
update: update,
|
|
107
|
-
});
|
|
108
|
-
case UpdateKind.StatusUpdate:
|
|
109
|
-
return updateTaskStatusUpdate({
|
|
110
|
-
context,
|
|
111
|
-
current,
|
|
112
|
-
update: update,
|
|
113
|
-
});
|
|
114
|
-
case UpdateKind.ArtifactUpdate:
|
|
115
|
-
return updateTaskArtifactUpdate({
|
|
116
|
-
context,
|
|
117
|
-
current,
|
|
118
|
-
update: update,
|
|
119
|
-
});
|
|
120
|
-
default:
|
|
121
|
-
return false;
|
|
122
|
-
}
|
|
123
|
-
};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2025 The Artinet Project
|
|
3
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
*/
|
|
5
|
-
import { ExecutionEngine, CoreState, CoreUpdate, CoreContext, CoreCommand } from "../../../types/index.js";
|
|
6
|
-
export declare const coreExecute: <TCommand extends CoreCommand = CoreCommand, TUpdate extends CoreUpdate = CoreUpdate, TState extends CoreState = CoreState, TContext extends CoreContext<TCommand, TState, TUpdate> = CoreContext<TCommand, TState, TUpdate>>(engine: ExecutionEngine<TCommand, TState, TUpdate>, context: TContext) => Promise<void>;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2025 The Artinet Project
|
|
3
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
*/
|
|
5
|
-
export const coreExecute = async (engine, context) => {
|
|
6
|
-
try {
|
|
7
|
-
if (context.events.onStart) {
|
|
8
|
-
await context.events.onStart(context);
|
|
9
|
-
}
|
|
10
|
-
for await (const update of engine(context)) {
|
|
11
|
-
if (context.isCancelled() || context.signal.aborted) {
|
|
12
|
-
await context.events.onCancel(update);
|
|
13
|
-
break;
|
|
14
|
-
}
|
|
15
|
-
await context.events.onUpdate(update);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
catch (error) {
|
|
19
|
-
context.events.onError(error);
|
|
20
|
-
throw error;
|
|
21
|
-
}
|
|
22
|
-
finally {
|
|
23
|
-
context.events.onComplete();
|
|
24
|
-
}
|
|
25
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./execute.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./execute.js";
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2025 The Artinet Project
|
|
3
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
*/
|
|
5
|
-
import { CoreCommand, CommandChannelInterface, CommandChannelProxyInterface, CommandChannelMap } from "../../../types/index.js";
|
|
6
|
-
import { EventEmitter } from "events";
|
|
7
|
-
export declare class CommandChannel<TCommand extends CoreCommand = CoreCommand> extends EventEmitter<CommandChannelMap<TCommand>> implements CommandChannelInterface<TCommand> {
|
|
8
|
-
private readonly _command;
|
|
9
|
-
private commands;
|
|
10
|
-
private resolvers;
|
|
11
|
-
private done;
|
|
12
|
-
/**
|
|
13
|
-
* @param command - The initial command to send
|
|
14
|
-
* @note The initial command is tied to the channel and cannot be changed
|
|
15
|
-
*/
|
|
16
|
-
constructor(_command: TCommand);
|
|
17
|
-
/**
|
|
18
|
-
* @returns True if the channel is open
|
|
19
|
-
*/
|
|
20
|
-
get isOpen(): boolean;
|
|
21
|
-
/**
|
|
22
|
-
* @returns The list of commands
|
|
23
|
-
*/
|
|
24
|
-
get commandList(): TCommand[];
|
|
25
|
-
/**
|
|
26
|
-
* @returns The current command
|
|
27
|
-
*/
|
|
28
|
-
get command(): TCommand;
|
|
29
|
-
/**
|
|
30
|
-
* @returns The command channel as an async iterable
|
|
31
|
-
*/
|
|
32
|
-
[Symbol.asyncIterator](): AsyncIterableIterator<TCommand, TCommand, TCommand | undefined>;
|
|
33
|
-
valueOf(): TCommand;
|
|
34
|
-
send(command: TCommand): void;
|
|
35
|
-
close(): void;
|
|
36
|
-
next(): Promise<IteratorResult<TCommand>>;
|
|
37
|
-
return(value: TCommand): Promise<IteratorResult<TCommand>>;
|
|
38
|
-
static create<TCommand extends CoreCommand = CoreCommand>(command: TCommand): CommandChannelProxyInterface<TCommand>;
|
|
39
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2025 The Artinet Project
|
|
3
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
*/
|
|
5
|
-
import { EventEmitter } from "events";
|
|
6
|
-
import { EventManagerInterface, EventManagerOptions, CoreCommand, CoreState, CoreUpdate, CoreContext, EventManagerMap } from "../../../types/index.js";
|
|
7
|
-
export declare class EventManager<TCommand extends CoreCommand = CoreCommand, TState extends CoreState = CoreState, TUpdate extends CoreUpdate = CoreUpdate> extends EventEmitter<EventManagerMap<TCommand, TState, TUpdate>> implements EventManagerInterface<TCommand, TState, TUpdate> {
|
|
8
|
-
readonly contextId: string;
|
|
9
|
-
private currentState;
|
|
10
|
-
private options;
|
|
11
|
-
constructor(contextId: string, options?: EventManagerOptions<TCommand, TState, TUpdate>);
|
|
12
|
-
onStart: (context: CoreContext<TCommand, TState, TUpdate>) => Promise<TState>;
|
|
13
|
-
onCancel: (nextState: TUpdate) => Promise<void>;
|
|
14
|
-
onUpdate: (nextState: TUpdate) => Promise<TState>;
|
|
15
|
-
onError: (error: any) => Promise<void>;
|
|
16
|
-
onComplete: () => Promise<void>;
|
|
17
|
-
getState: () => TState;
|
|
18
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2025 The Artinet Project
|
|
3
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
*/
|
|
5
|
-
import { EventEmitter } from "events";
|
|
6
|
-
export class EventManager extends EventEmitter {
|
|
7
|
-
contextId;
|
|
8
|
-
currentState = {};
|
|
9
|
-
options;
|
|
10
|
-
constructor(contextId, options = {}) {
|
|
11
|
-
super();
|
|
12
|
-
this.contextId = contextId;
|
|
13
|
-
this.options = options;
|
|
14
|
-
}
|
|
15
|
-
onStart = async (context) => {
|
|
16
|
-
if (this.options.onStart) {
|
|
17
|
-
this.currentState = await this.options.onStart(context);
|
|
18
|
-
}
|
|
19
|
-
this.emit("start", context.command, this.currentState);
|
|
20
|
-
return this.currentState;
|
|
21
|
-
};
|
|
22
|
-
onCancel = async (nextState) => {
|
|
23
|
-
if (this.options.onCancel) {
|
|
24
|
-
await this.options.onCancel(this.currentState, nextState);
|
|
25
|
-
}
|
|
26
|
-
this.emit("cancel", nextState);
|
|
27
|
-
};
|
|
28
|
-
onUpdate = async (nextState) => {
|
|
29
|
-
if (this.options.onUpdate) {
|
|
30
|
-
this.currentState = await this.options.onUpdate(this.currentState, nextState);
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
this.currentState = nextState;
|
|
34
|
-
}
|
|
35
|
-
this.emit("update", this.currentState, nextState);
|
|
36
|
-
return this.currentState;
|
|
37
|
-
};
|
|
38
|
-
onError = async (error) => {
|
|
39
|
-
if (this.options.onError) {
|
|
40
|
-
await this.options.onError(this.currentState, error);
|
|
41
|
-
}
|
|
42
|
-
this.emit("error", error, this.currentState);
|
|
43
|
-
};
|
|
44
|
-
onComplete = async () => {
|
|
45
|
-
if (this.options.onComplete) {
|
|
46
|
-
await this.options.onComplete(this.currentState);
|
|
47
|
-
}
|
|
48
|
-
this.emit("complete", this.currentState);
|
|
49
|
-
};
|
|
50
|
-
getState = () => {
|
|
51
|
-
if (this.options.getState) {
|
|
52
|
-
return this.options.getState();
|
|
53
|
-
}
|
|
54
|
-
return this.currentState;
|
|
55
|
-
};
|
|
56
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2025 The Artinet Project
|
|
3
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
*/
|
|
5
|
-
import { StreamManagerInterface, ExecutionEngine, CoreContext, ServiceInterface, CoreCommand, CoreState, CoreUpdate } from "../../../types/index.js";
|
|
6
|
-
export declare class StreamManager<TCommand extends CoreCommand = CoreCommand, TState extends CoreState = CoreState, TUpdate extends CoreUpdate = CoreUpdate> implements StreamManagerInterface<TCommand, TState, TUpdate> {
|
|
7
|
-
private contextId;
|
|
8
|
-
private completed;
|
|
9
|
-
private updates;
|
|
10
|
-
private executionContext;
|
|
11
|
-
constructor(executionContext?: CoreContext<TCommand, TState, TUpdate>);
|
|
12
|
-
getContextId(): string;
|
|
13
|
-
addUpdate(update: TUpdate): void;
|
|
14
|
-
getUpdates(): TUpdate[];
|
|
15
|
-
isCompleted(): boolean;
|
|
16
|
-
setCompleted(): void;
|
|
17
|
-
getExecutionContext(): CoreContext<TCommand, TState, TUpdate>;
|
|
18
|
-
setExecutionContext(executionContext: CoreContext<TCommand, TState, TUpdate>): void;
|
|
19
|
-
stream(engine: ExecutionEngine<TCommand, TState, TUpdate>, service?: ServiceInterface<TCommand, TState, TUpdate>): AsyncGenerator<Awaited<NonNullable<TUpdate>>, void, unknown>;
|
|
20
|
-
}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2025 The Artinet Project
|
|
3
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
*/
|
|
5
|
-
import { coreExecute } from "../execution/execute.js";
|
|
6
|
-
export class StreamManager {
|
|
7
|
-
contextId = null;
|
|
8
|
-
completed = false;
|
|
9
|
-
updates = [];
|
|
10
|
-
executionContext = null;
|
|
11
|
-
constructor(executionContext) {
|
|
12
|
-
if (executionContext) {
|
|
13
|
-
this.executionContext = executionContext;
|
|
14
|
-
this.contextId = executionContext.events.contextId;
|
|
15
|
-
}
|
|
16
|
-
this.completed = false;
|
|
17
|
-
this.updates = [];
|
|
18
|
-
}
|
|
19
|
-
getContextId() {
|
|
20
|
-
if (!this.contextId) {
|
|
21
|
-
throw new Error("Context id not set");
|
|
22
|
-
}
|
|
23
|
-
return this.contextId;
|
|
24
|
-
}
|
|
25
|
-
addUpdate(update) {
|
|
26
|
-
this.updates.push(update);
|
|
27
|
-
}
|
|
28
|
-
getUpdates() {
|
|
29
|
-
return this.updates;
|
|
30
|
-
}
|
|
31
|
-
isCompleted() {
|
|
32
|
-
return this.completed;
|
|
33
|
-
}
|
|
34
|
-
setCompleted() {
|
|
35
|
-
this.completed = true;
|
|
36
|
-
}
|
|
37
|
-
getExecutionContext() {
|
|
38
|
-
if (!this.executionContext) {
|
|
39
|
-
throw new Error("Execution context not set");
|
|
40
|
-
}
|
|
41
|
-
return this.executionContext;
|
|
42
|
-
}
|
|
43
|
-
setExecutionContext(executionContext) {
|
|
44
|
-
this.executionContext = executionContext;
|
|
45
|
-
this.contextId = executionContext.events.contextId;
|
|
46
|
-
}
|
|
47
|
-
async *stream(engine, service) {
|
|
48
|
-
let executionError = null;
|
|
49
|
-
const context = this.getExecutionContext();
|
|
50
|
-
context.events.on("update", (_, update) => {
|
|
51
|
-
if (!context.isCancelled()) {
|
|
52
|
-
this.addUpdate(update);
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
const executePromise = (service ? service.execute(engine, context) : coreExecute(engine, context))
|
|
56
|
-
.catch((error) => {
|
|
57
|
-
executionError = error;
|
|
58
|
-
})
|
|
59
|
-
.finally(() => {
|
|
60
|
-
this.setCompleted();
|
|
61
|
-
});
|
|
62
|
-
while (!this.isCompleted() || this.getUpdates().length > 0) {
|
|
63
|
-
if (executionError) {
|
|
64
|
-
throw executionError;
|
|
65
|
-
}
|
|
66
|
-
if (this.getUpdates().length > 0) {
|
|
67
|
-
yield this.getUpdates().shift();
|
|
68
|
-
}
|
|
69
|
-
await new Promise((resolve) => setTimeout(resolve, 10));
|
|
70
|
-
}
|
|
71
|
-
await executePromise;
|
|
72
|
-
this.setCompleted();
|
|
73
|
-
if (executionError) {
|
|
74
|
-
throw executionError;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
package/dist/types/ext.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2025 The Artinet Project
|
|
3
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* For artinet specific conventions
|
|
7
|
-
* AgentInfo will expand to incorporate additional details required from other protocols
|
|
8
|
-
* (e.g. AgentFAQ(NANDA), AgentCard(A2A), etc.)
|
|
9
|
-
*/
|
|
10
|
-
export { AgentCardSchema as AgentInfoSchema } from "./schemas/a2a/index.js";
|
|
11
|
-
export type { AgentCard as AgentInfo } from "./schemas/a2a/index.js";
|
|
12
|
-
export type { A2AEngine as AgentEngine } from "./interfaces/services/a2a/index.js";
|
|
13
|
-
export type { A2AServiceInterface as Agent } from "./interfaces/services/a2a/index.js";
|
package/dist/types/ext.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2025 The Artinet Project
|
|
3
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* For artinet specific conventions
|
|
7
|
-
* AgentInfo will expand to incorporate additional details required from other protocols
|
|
8
|
-
* (e.g. AgentFAQ(NANDA), AgentCard(A2A), etc.)
|
|
9
|
-
*/
|
|
10
|
-
export { AgentCardSchema as AgentInfoSchema } from "./schemas/a2a/index.js";
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2025 The Artinet Project
|
|
3
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
*/
|
|
5
|
-
import { Context, Command, TextPart, DataPart, FilePart } from "../../../index.js";
|
|
6
|
-
/**
|
|
7
|
-
* Restricting to command for now, but could be extended to other types of commands in the future.
|
|
8
|
-
* When we shift to CoreCommand, move this into core.
|
|
9
|
-
*/
|
|
10
|
-
export interface StepArgs<TCommand extends Command = Command> {
|
|
11
|
-
command: TCommand;
|
|
12
|
-
context: Context;
|
|
13
|
-
}
|
|
14
|
-
export type StepParams<TCommand extends Command = Command, TInboundArgs extends readonly unknown[] = []> = StepArgs<TCommand> & Partial<{
|
|
15
|
-
content: string;
|
|
16
|
-
args: TInboundArgs;
|
|
17
|
-
}>;
|
|
18
|
-
export type StepOutput<TPart extends DataPart["data"] | FilePart["file"] | TextPart["text"]> = {
|
|
19
|
-
parts: Array<TPart> | TPart;
|
|
20
|
-
};
|
|
21
|
-
export type StepOutputWithForwardArgs<TPart extends DataPart["data"] | FilePart["file"] | TextPart["text"], TForwardArgs extends readonly unknown[] = []> = StepOutput<TPart> & {
|
|
22
|
-
args: TForwardArgs;
|
|
23
|
-
};
|
|
24
|
-
export type Step<TCommand extends Command = Command, TPart extends DataPart["data"] | FilePart["file"] | TextPart["text"] = TextPart["text"], TInboundArgs extends readonly unknown[] = [], TForwardArgs extends readonly unknown[] = [], TOutput extends StepOutput<TPart> | StepOutputWithForwardArgs<TPart, TForwardArgs> | Array<TPart> | TPart = StepOutput<TPart>> = (params: StepParams<TCommand, TInboundArgs>) => Promise<TOutput> | TOutput;
|
|
25
|
-
export type StepWithKind<TCommand extends Command = Command, TPart extends DataPart["data"] | FilePart["file"] | TextPart["text"] = TextPart["text"], TInboundArgs extends readonly unknown[] = [], TForwardArgs extends readonly unknown[] = [], TOutput extends StepOutput<TPart> | StepOutputWithForwardArgs<TPart, TForwardArgs> | Array<TPart> | TPart = StepOutput<TPart>, TKind extends "text" | "file" | "data" = "text"> = {
|
|
26
|
-
step: Step<TCommand, TPart, TInboundArgs, TForwardArgs, TOutput>;
|
|
27
|
-
kind: TKind;
|
|
28
|
-
};
|
|
29
|
-
export type OutArgsOf<O> = O extends StepOutputWithForwardArgs<any, infer A> ? A : [];
|
|
30
|
-
export interface StepBuilder<TCommand extends Command = Command, TInboundArgs extends readonly unknown[] = []> {
|
|
31
|
-
/**
|
|
32
|
-
* Add a step to the builder.
|
|
33
|
-
* @param step - The step to add.
|
|
34
|
-
* @returns A new builder with the step added.
|
|
35
|
-
*/
|
|
36
|
-
addStep<TPart extends DataPart["data"] | FilePart["file"] | TextPart["text"] = TextPart["text"], TForwardArgs extends readonly unknown[] = [], TOutput extends StepOutput<TPart> | StepOutputWithForwardArgs<TPart, TForwardArgs> | Array<TPart> | TPart = StepOutput<TPart>, TKind extends "text" | "file" | "data" = "text">(step: StepWithKind<TCommand, TPart, TInboundArgs, TForwardArgs, TOutput, TKind>): StepBuilder<TCommand, OutArgsOf<TOutput>>;
|
|
37
|
-
}
|
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2025 The Artinet Project
|
|
3
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @fileoverview A2A (Agent-to-Agent) Context Type Definitions
|
|
7
|
-
*
|
|
8
|
-
* This module provides type definitions for the Agent-to-Agent communication context,
|
|
9
|
-
* extending the core context types with A2A-specific functionality for task handling,
|
|
10
|
-
* message processing, and event management.
|
|
11
|
-
*
|
|
12
|
-
* @module A2AContext
|
|
13
|
-
* @version 0.5.7
|
|
14
|
-
* @since 0.5.6
|
|
15
|
-
* @author The Artinet Project
|
|
16
|
-
*/
|
|
17
|
-
import { type TaskStatusUpdateEvent, type TaskArtifactUpdateEvent, type Task, type Message, A2ARequest, MessageSendParams } from "../../../schemas/a2a/index.js";
|
|
18
|
-
import { CoreCommand, CoreState, CoreUpdate } from "../core/context/types.js";
|
|
19
|
-
import { CoreContext } from "../core/context/context.js";
|
|
20
|
-
import { TaskAndHistory } from "./legacy.js";
|
|
21
|
-
/**
|
|
22
|
-
* Represents the possible types of updates that can be yielded by a TaskHandler.
|
|
23
|
-
*
|
|
24
|
-
* This union type encompasses all event types that can be emitted during A2A
|
|
25
|
-
* task processing, providing a type-safe way to handle different update scenarios.
|
|
26
|
-
*
|
|
27
|
-
* @description Either a Message, Task, TaskStatusUpdateEvent, or TaskArtifactUpdateEvent.
|
|
28
|
-
*
|
|
29
|
-
* @public
|
|
30
|
-
* @since 0.5.6
|
|
31
|
-
*/
|
|
32
|
-
export type UpdateEvent = Message | Task | TaskStatusUpdateEvent | TaskArtifactUpdateEvent;
|
|
33
|
-
/**
|
|
34
|
-
* A2A Command type that extends CoreCommand with A2A-specific parameter constraints.
|
|
35
|
-
*
|
|
36
|
-
* This generic type provides type-safe command handling for A2A operations,
|
|
37
|
-
* ensuring that command parameters conform to the expected A2A request structure.
|
|
38
|
-
*
|
|
39
|
-
* @template TParams - The parameter type for the command, must extend A2ARequest params
|
|
40
|
-
* @default MessageSendParams - Default parameter type for message sending operations
|
|
41
|
-
*
|
|
42
|
-
* @example
|
|
43
|
-
* ```typescript
|
|
44
|
-
* // Using default MessageSendParams
|
|
45
|
-
* const messageCommand: Command = {
|
|
46
|
-
* type: 'send_message',
|
|
47
|
-
* params: { content: 'Hello', recipient: 'agent123' }
|
|
48
|
-
* };
|
|
49
|
-
*
|
|
50
|
-
* // Using custom parameter type
|
|
51
|
-
* interface CustomParams extends NonNullable<A2ARequest["params"]> {
|
|
52
|
-
* customField: string;
|
|
53
|
-
* }
|
|
54
|
-
* const customCommand: Command<CustomParams> = {
|
|
55
|
-
* type: 'custom_action',
|
|
56
|
-
* params: { customField: 'value' }
|
|
57
|
-
* };
|
|
58
|
-
* ```
|
|
59
|
-
*
|
|
60
|
-
* @public
|
|
61
|
-
* @since 0.5.6
|
|
62
|
-
*/
|
|
63
|
-
export type Command<TParams extends NonNullable<A2ARequest["params"]> = MessageSendParams> = CoreCommand<TParams>;
|
|
64
|
-
/**
|
|
65
|
-
* A2A State type that extends CoreState with task and history management.
|
|
66
|
-
*
|
|
67
|
-
* This type represents the state container for A2A operations, including
|
|
68
|
-
* task tracking and historical data management capabilities.
|
|
69
|
-
*
|
|
70
|
-
* @example
|
|
71
|
-
* ```typescript
|
|
72
|
-
* const state: State = {
|
|
73
|
-
* data: {
|
|
74
|
-
* currentTask: taskInstance,
|
|
75
|
-
* history: [...previousTasks]
|
|
76
|
-
* },
|
|
77
|
-
* metadata: {
|
|
78
|
-
* lastUpdated: new Date(),
|
|
79
|
-
* version: '1.0.0'
|
|
80
|
-
* }
|
|
81
|
-
* };
|
|
82
|
-
* ```
|
|
83
|
-
*
|
|
84
|
-
* @public
|
|
85
|
-
* @since 0.5.6
|
|
86
|
-
*/
|
|
87
|
-
export type State = CoreState<TaskAndHistory>;
|
|
88
|
-
/**
|
|
89
|
-
* A2A Update type that extends CoreUpdate with A2A-specific update events.
|
|
90
|
-
*
|
|
91
|
-
* This generic type provides type-safe update handling for A2A operations,
|
|
92
|
-
* ensuring that updates conform to the expected UpdateEvent structure.
|
|
93
|
-
*
|
|
94
|
-
* @template TUpdate - The update event type, must extend UpdateEvent
|
|
95
|
-
* @default UpdateEvent - Default update event type
|
|
96
|
-
*
|
|
97
|
-
* @example
|
|
98
|
-
* ```typescript
|
|
99
|
-
* // Using default UpdateEvent
|
|
100
|
-
* const update: Update = {
|
|
101
|
-
* type: 'task_status_update',
|
|
102
|
-
* payload: statusUpdateEvent
|
|
103
|
-
* };
|
|
104
|
-
*
|
|
105
|
-
* // Using specific update type
|
|
106
|
-
* const messageUpdate: Update<Message> = {
|
|
107
|
-
* type: 'message',
|
|
108
|
-
* payload: messageEvent
|
|
109
|
-
* };
|
|
110
|
-
* ```
|
|
111
|
-
*
|
|
112
|
-
* @public
|
|
113
|
-
* @since 0.5.6
|
|
114
|
-
*/
|
|
115
|
-
export type Update<TUpdate extends UpdateEvent = UpdateEvent> = CoreUpdate<TUpdate>;
|
|
116
|
-
/**
|
|
117
|
-
* A2A Context type that combines Command, State, and Update types for complete context management.
|
|
118
|
-
*
|
|
119
|
-
* This is the main context type for A2A operations, providing a comprehensive
|
|
120
|
-
* type-safe interface for handling commands, managing state, and processing updates
|
|
121
|
-
* within the Agent-to-Agent communication framework.
|
|
122
|
-
*
|
|
123
|
-
* @template TCommand - The command type, must extend Command
|
|
124
|
-
* @template TState - The state type, must extend State
|
|
125
|
-
* @template TUpdate - The update type, must extend Update<UpdateEvent>
|
|
126
|
-
*
|
|
127
|
-
* @default TCommand - Command<MessageSendParams>
|
|
128
|
-
* @default TState - State
|
|
129
|
-
* @default TUpdate - Update<UpdateEvent>
|
|
130
|
-
*
|
|
131
|
-
* @example
|
|
132
|
-
* ```typescript
|
|
133
|
-
* // Using default types
|
|
134
|
-
* const context: Context = {
|
|
135
|
-
* command: messageCommand,
|
|
136
|
-
* state: currentState,
|
|
137
|
-
* update: latestUpdate,
|
|
138
|
-
* // ... other context properties
|
|
139
|
-
* };
|
|
140
|
-
*
|
|
141
|
-
* // Using custom types
|
|
142
|
-
* interface CustomCommand extends Command<CustomParams> {
|
|
143
|
-
* priority: number;
|
|
144
|
-
* }
|
|
145
|
-
*
|
|
146
|
-
* const customContext: Context<CustomCommand, State, Update<Task>> = {
|
|
147
|
-
* command: customCommand,
|
|
148
|
-
* state: currentState,
|
|
149
|
-
* update: taskUpdate,
|
|
150
|
-
* // ... other context properties
|
|
151
|
-
* };
|
|
152
|
-
* ```
|
|
153
|
-
*
|
|
154
|
-
* @remarks
|
|
155
|
-
* This context type is designed to be the primary interface for A2A service
|
|
156
|
-
* implementations, providing type safety and ensuring proper handling of
|
|
157
|
-
* agent-to-agent communication patterns.
|
|
158
|
-
*
|
|
159
|
-
* @public
|
|
160
|
-
* @since 0.5.6
|
|
161
|
-
*/
|
|
162
|
-
export type Context<TCommand extends Command = Command<MessageSendParams>, TState extends State = State, TUpdate extends Update<UpdateEvent> = Update<UpdateEvent>> = CoreContext<TCommand, TState, TUpdate>;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2025 The Artinet Project
|
|
3
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
*/
|
|
5
|
-
import { ExecutionEngine } from "../core/execution/index.js";
|
|
6
|
-
import { Command, State, Update } from "./context.js";
|
|
7
|
-
export type A2AEngine = ExecutionEngine<Command, State, Update>;
|