@artinet/sdk 0.5.5 → 0.5.7
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/CHANGELOG.md +128 -20
- package/README.md +542 -212
- package/dist/client/a2a-client.js +6 -1
- package/dist/client/a2a-client.js.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/server/express/errors.js +51 -0
- package/dist/server/express/errors.js.map +1 -0
- package/dist/server/express/index.js +4 -0
- package/dist/server/express/index.js.map +1 -0
- package/dist/server/express/middeware.js +116 -0
- package/dist/server/express/middeware.js.map +1 -0
- package/dist/server/express/server.js +80 -0
- package/dist/server/express/server.js.map +1 -0
- package/dist/server/index.js +1 -7
- package/dist/server/index.js.map +1 -1
- package/dist/services/a2a/factory/builder.js +392 -0
- package/dist/services/a2a/factory/builder.js.map +1 -0
- package/dist/services/a2a/factory/context.js +151 -0
- package/dist/services/a2a/factory/context.js.map +1 -0
- package/dist/services/a2a/factory/event.js +182 -0
- package/dist/services/a2a/factory/event.js.map +1 -0
- package/dist/services/a2a/factory/index.js +6 -0
- package/dist/services/a2a/factory/index.js.map +1 -0
- package/dist/services/a2a/factory/method.js +15 -0
- package/dist/services/a2a/factory/method.js.map +1 -0
- package/dist/services/a2a/factory/service.js +12 -0
- package/dist/services/a2a/factory/service.js.map +1 -0
- package/dist/services/a2a/helpers/index.js +2 -0
- package/dist/services/a2a/helpers/index.js.map +1 -0
- package/dist/services/a2a/helpers/part.js +47 -0
- package/dist/services/a2a/helpers/part.js.map +1 -0
- package/dist/services/a2a/index.js +5 -1
- package/dist/services/a2a/index.js.map +1 -1
- package/dist/services/a2a/managers/cancellation.js +17 -0
- package/dist/services/a2a/managers/cancellation.js.map +1 -0
- package/dist/services/a2a/managers/connection.js +17 -0
- package/dist/services/a2a/managers/connection.js.map +1 -0
- package/dist/services/a2a/managers/context.js +17 -0
- package/dist/services/a2a/managers/context.js.map +1 -0
- package/dist/services/a2a/managers/index.js +6 -0
- package/dist/services/a2a/managers/index.js.map +1 -0
- package/dist/services/a2a/managers/task.js +17 -0
- package/dist/services/a2a/managers/task.js.map +1 -0
- package/dist/services/a2a/methods/cancel-task.js +47 -0
- package/dist/services/a2a/methods/cancel-task.js.map +1 -0
- package/dist/services/a2a/methods/get-task.js +15 -0
- package/dist/services/a2a/methods/get-task.js.map +1 -0
- package/dist/services/a2a/methods/index.js +6 -0
- package/dist/services/a2a/methods/index.js.map +1 -0
- package/dist/services/a2a/methods/resubscribe-task.js +77 -0
- package/dist/services/a2a/methods/resubscribe-task.js.map +1 -0
- package/dist/services/a2a/methods/send-message.js +20 -0
- package/dist/services/a2a/methods/send-message.js.map +1 -0
- package/dist/services/a2a/methods/stream-message.js +39 -0
- package/dist/services/a2a/methods/stream-message.js.map +1 -0
- package/dist/services/a2a/service.js +82 -236
- package/dist/services/a2a/service.js.map +1 -1
- package/dist/services/a2a/state/index.js +4 -0
- package/dist/services/a2a/state/index.js.map +1 -0
- package/dist/services/a2a/state/load.js +43 -0
- package/dist/services/a2a/state/load.js.map +1 -0
- package/dist/services/a2a/state/process.js +14 -0
- package/dist/services/a2a/state/process.js.map +1 -0
- package/dist/services/a2a/state/update/artifact.js +40 -0
- package/dist/services/a2a/state/update/artifact.js.map +1 -0
- package/dist/services/a2a/state/update/index.js +3 -0
- package/dist/services/a2a/state/update/index.js.map +1 -0
- package/dist/{server/lib/update/base.js → services/a2a/state/update/update.js} +23 -9
- package/dist/services/a2a/state/update/update.js.map +1 -0
- package/dist/services/core/execution/execute.js +26 -0
- package/dist/services/core/execution/execute.js.map +1 -0
- package/dist/services/core/execution/index.js +2 -0
- package/dist/services/core/execution/index.js.map +1 -0
- package/dist/services/core/index.js +3 -0
- package/dist/services/core/index.js.map +1 -0
- package/dist/services/core/managers/command.js +95 -0
- package/dist/services/core/managers/command.js.map +1 -0
- package/dist/services/core/managers/event.js +57 -0
- package/dist/services/core/managers/event.js.map +1 -0
- package/dist/services/core/managers/index.js +4 -0
- package/dist/services/core/managers/index.js.map +1 -0
- package/dist/services/core/managers/stream.js +78 -0
- package/dist/services/core/managers/stream.js.map +1 -0
- package/dist/services/index.js +3 -1
- package/dist/services/index.js.map +1 -1
- package/dist/services/mcp/service.js +114 -66
- package/dist/services/mcp/service.js.map +1 -1
- package/dist/transport/index.js +1 -1
- package/dist/transport/index.js.map +1 -1
- package/dist/transport/rpc/parser.js +13 -5
- package/dist/transport/rpc/parser.js.map +1 -1
- package/dist/transport/rpc/rpc-client.js +10 -2
- package/dist/transport/rpc/rpc-client.js.map +1 -1
- package/dist/transport/streaming/event-stream.js +5 -1
- package/dist/transport/streaming/event-stream.js.map +1 -1
- package/dist/transport/trpc/a2a/factory/index.js +2 -0
- package/dist/transport/trpc/a2a/factory/index.js.map +1 -0
- package/dist/transport/trpc/a2a/factory/router.js +17 -0
- package/dist/transport/trpc/a2a/factory/router.js.map +1 -0
- package/dist/transport/trpc/a2a/index.js +4 -0
- package/dist/transport/trpc/a2a/index.js.map +1 -0
- package/dist/transport/trpc/a2a/routes/index.js +4 -0
- package/dist/transport/trpc/a2a/routes/index.js.map +1 -0
- package/dist/transport/trpc/a2a/routes/info.js +10 -0
- package/dist/transport/trpc/a2a/routes/info.js.map +1 -0
- package/dist/transport/trpc/a2a/routes/message/index.js +2 -0
- package/dist/transport/trpc/a2a/routes/message/index.js.map +1 -0
- package/dist/transport/trpc/a2a/routes/message/route.js +38 -0
- package/dist/transport/trpc/a2a/routes/message/route.js.map +1 -0
- package/dist/transport/trpc/a2a/routes/tasks/index.js +2 -0
- package/dist/transport/trpc/a2a/routes/tasks/index.js.map +1 -0
- package/dist/transport/trpc/a2a/routes/tasks/route.js +71 -0
- package/dist/transport/trpc/a2a/routes/tasks/route.js.map +1 -0
- package/dist/transport/trpc/a2a/trpc.js +36 -0
- package/dist/transport/trpc/a2a/trpc.js.map +1 -0
- package/dist/transport/trpc/index.js +2 -0
- package/dist/transport/trpc/index.js.map +1 -0
- package/dist/types/client/a2a-client.d.ts +5 -1
- package/dist/types/client/a2a-client.d.ts.map +1 -1
- package/dist/types/ext.js +11 -0
- package/dist/types/ext.js.map +1 -0
- package/dist/types/index.d.ts +3 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +3 -4
- package/dist/types/index.js.map +1 -1
- package/dist/types/interfaces/client.js +6 -0
- package/dist/types/interfaces/client.js.map +1 -0
- package/dist/types/interfaces/index.js +4 -0
- package/dist/types/interfaces/index.js.map +1 -0
- package/dist/types/interfaces/services/a2a/builder.js +6 -0
- package/dist/types/interfaces/services/a2a/builder.js.map +1 -0
- package/dist/types/interfaces/services/a2a/context.js +6 -0
- package/dist/types/interfaces/services/a2a/context.js.map +1 -0
- package/dist/types/interfaces/services/a2a/engine.js +6 -0
- package/dist/types/interfaces/services/a2a/engine.js.map +1 -0
- package/dist/types/interfaces/services/a2a/index.js +6 -0
- package/dist/types/interfaces/services/a2a/index.js.map +1 -0
- package/dist/types/interfaces/services/a2a/legacy.js +6 -0
- package/dist/types/interfaces/services/a2a/legacy.js.map +1 -0
- package/dist/types/interfaces/services/a2a/service.js +6 -0
- package/dist/types/interfaces/services/a2a/service.js.map +1 -0
- package/dist/types/interfaces/services/core/context/command.js +6 -0
- package/dist/types/interfaces/services/core/context/command.js.map +1 -0
- package/dist/types/interfaces/services/core/context/context.js +6 -0
- package/dist/types/interfaces/services/core/context/context.js.map +1 -0
- package/dist/types/interfaces/services/core/context/index.js +4 -0
- package/dist/types/interfaces/services/core/context/index.js.map +1 -0
- package/dist/types/interfaces/services/core/context/types.js +6 -0
- package/dist/types/interfaces/services/core/context/types.js.map +1 -0
- package/dist/types/interfaces/services/core/execution/engine.js +6 -0
- package/dist/types/interfaces/services/core/execution/engine.js.map +1 -0
- package/dist/types/interfaces/services/core/execution/environment.js +6 -0
- package/dist/types/interfaces/services/core/execution/environment.js.map +1 -0
- package/dist/types/interfaces/services/core/execution/execute.js +6 -0
- package/dist/types/interfaces/services/core/execution/execute.js.map +1 -0
- package/dist/types/interfaces/services/core/execution/index.js +4 -0
- package/dist/types/interfaces/services/core/execution/index.js.map +1 -0
- package/dist/types/interfaces/services/core/index.js +5 -0
- package/dist/types/interfaces/services/core/index.js.map +1 -0
- package/dist/types/interfaces/services/core/managers/cancellation.js +6 -0
- package/dist/types/interfaces/services/core/managers/cancellation.js.map +1 -0
- package/dist/types/interfaces/services/core/managers/connection.js +6 -0
- package/dist/types/interfaces/services/core/managers/connection.js.map +1 -0
- package/dist/types/interfaces/services/core/managers/context.js +6 -0
- package/dist/types/interfaces/services/core/managers/context.js.map +1 -0
- package/dist/types/interfaces/services/core/managers/event.js +6 -0
- package/dist/types/interfaces/services/core/managers/event.js.map +1 -0
- package/dist/types/interfaces/services/core/managers/index.js +7 -0
- package/dist/types/interfaces/services/core/managers/index.js.map +1 -0
- package/dist/types/interfaces/services/core/managers/stream.js +6 -0
- package/dist/types/interfaces/services/core/managers/stream.js.map +1 -0
- package/dist/types/interfaces/services/core/managers/task.js +2 -0
- package/dist/types/interfaces/services/core/managers/task.js.map +1 -0
- package/dist/types/interfaces/services/core/service.js +6 -0
- package/dist/types/interfaces/services/core/service.js.map +1 -0
- package/dist/types/interfaces/services/index.js +5 -0
- package/dist/types/interfaces/services/index.js.map +1 -0
- package/dist/types/interfaces/services/mcp/index.js +2 -0
- package/dist/types/interfaces/services/mcp/index.js.map +1 -0
- package/dist/types/interfaces/services/mcp/service.js +6 -0
- package/dist/types/interfaces/services/mcp/service.js.map +1 -0
- package/dist/types/{services → interfaces/services}/protocol.js +4 -0
- package/dist/types/interfaces/services/protocol.js.map +1 -0
- package/dist/types/interfaces/storage.js +6 -0
- package/dist/types/interfaces/storage.js.map +1 -0
- package/dist/types/schemas/a2a/agent.js +325 -0
- package/dist/types/schemas/a2a/agent.js.map +1 -0
- package/dist/types/schemas/a2a/auth.js +284 -0
- package/dist/types/schemas/a2a/auth.js.map +1 -0
- package/dist/types/schemas/a2a/error.js +119 -0
- package/dist/types/schemas/a2a/error.js.map +1 -1
- package/dist/types/schemas/a2a/index.js +8 -4
- package/dist/types/schemas/a2a/index.js.map +1 -1
- package/dist/types/schemas/a2a/kind.js +21 -0
- package/dist/types/schemas/a2a/kind.js.map +1 -0
- package/dist/types/schemas/a2a/message.js +130 -1
- package/dist/types/schemas/a2a/message.js.map +1 -1
- package/dist/types/schemas/a2a/notification.js +203 -1
- package/dist/types/schemas/a2a/notification.js.map +1 -1
- package/dist/types/schemas/a2a/parameters.js +241 -1
- package/dist/types/schemas/a2a/parameters.js.map +1 -1
- package/dist/types/schemas/a2a/protocol.js +60 -0
- package/dist/types/schemas/a2a/protocol.js.map +1 -0
- package/dist/types/schemas/a2a/rpc.js +126 -1
- package/dist/types/schemas/a2a/rpc.js.map +1 -1
- package/dist/types/schemas/a2a/task.js +131 -12
- package/dist/types/schemas/a2a/task.js.map +1 -1
- package/dist/types/schemas/a2a/transport.js +29 -0
- package/dist/types/schemas/a2a/transport.js.map +1 -0
- package/dist/types/schemas/deployment/index.js +3 -0
- package/dist/types/schemas/deployment/index.js.map +1 -0
- package/dist/types/schemas/deployment/proxy.js +6 -0
- package/dist/types/schemas/deployment/proxy.js.map +1 -0
- package/dist/types/schemas/deployment/request.js +88 -0
- package/dist/types/schemas/deployment/request.js.map +1 -0
- package/dist/types/schemas/index.js +1 -0
- package/dist/types/schemas/index.js.map +1 -1
- package/dist/types/server/express/errors.d.ts +10 -0
- package/dist/types/server/express/errors.d.ts.map +1 -0
- package/dist/types/server/express/index.d.ts +4 -0
- package/dist/types/server/express/index.d.ts.map +1 -0
- package/dist/types/server/express/middeware.d.ts +8 -0
- package/dist/types/server/express/middeware.d.ts.map +1 -0
- package/dist/types/server/express/server.d.ts +71 -0
- package/dist/types/server/express/server.d.ts.map +1 -0
- package/dist/types/server/index.d.ts +1 -7
- package/dist/types/server/index.d.ts.map +1 -1
- package/dist/types/services/a2a/factory/builder.d.ts +352 -0
- package/dist/types/services/a2a/factory/builder.d.ts.map +1 -0
- package/dist/types/services/a2a/factory/context.d.ts +133 -0
- package/dist/types/services/a2a/factory/context.d.ts.map +1 -0
- package/dist/types/services/a2a/factory/event.d.ts +59 -0
- package/dist/types/services/a2a/factory/event.d.ts.map +1 -0
- package/dist/types/services/a2a/factory/index.d.ts +6 -0
- package/dist/types/services/a2a/factory/index.d.ts.map +1 -0
- package/dist/types/services/a2a/factory/method.d.ts +7 -0
- package/dist/types/services/a2a/factory/method.d.ts.map +1 -0
- package/dist/types/services/a2a/factory/service.d.ts +10 -0
- package/dist/types/services/a2a/factory/service.d.ts.map +1 -0
- package/dist/types/services/a2a/helpers/index.d.ts +2 -0
- package/dist/types/services/a2a/helpers/index.d.ts.map +1 -0
- package/dist/types/services/a2a/helpers/part.d.ts +49 -0
- package/dist/types/services/a2a/helpers/part.d.ts.map +1 -0
- package/dist/types/services/a2a/index.d.ts +5 -1
- package/dist/types/services/a2a/index.d.ts.map +1 -1
- package/dist/types/services/a2a/managers/cancellation.d.ts +12 -0
- package/dist/types/services/a2a/managers/cancellation.d.ts.map +1 -0
- package/dist/types/services/a2a/managers/connection.d.ts +12 -0
- package/dist/types/services/a2a/managers/connection.d.ts.map +1 -0
- package/dist/types/services/a2a/managers/context.d.ts +12 -0
- package/dist/types/services/a2a/managers/context.d.ts.map +1 -0
- package/dist/types/services/a2a/managers/index.d.ts +6 -0
- package/dist/types/services/a2a/managers/index.d.ts.map +1 -0
- package/dist/types/services/a2a/managers/task.d.ts +12 -0
- package/dist/types/services/a2a/managers/task.d.ts.map +1 -0
- package/dist/types/services/a2a/methods/cancel-task.d.ts +8 -0
- package/dist/types/services/a2a/methods/cancel-task.d.ts.map +1 -0
- package/dist/types/services/a2a/methods/get-task.d.ts +113 -0
- package/dist/types/services/a2a/methods/get-task.d.ts.map +1 -0
- package/dist/types/services/a2a/methods/index.d.ts +6 -0
- package/dist/types/services/a2a/methods/index.d.ts.map +1 -0
- package/dist/types/services/a2a/methods/resubscribe-task.d.ts +8 -0
- package/dist/types/services/a2a/methods/resubscribe-task.d.ts.map +1 -0
- package/dist/types/services/a2a/methods/send-message.d.ts +8 -0
- package/dist/types/services/a2a/methods/send-message.d.ts.map +1 -0
- package/dist/types/services/a2a/methods/stream-message.d.ts +9 -0
- package/dist/types/services/a2a/methods/stream-message.d.ts.map +1 -0
- package/dist/types/services/a2a/service.d.ts +374 -41
- package/dist/types/services/a2a/service.d.ts.map +1 -1
- package/dist/types/services/a2a/state/index.d.ts +4 -0
- package/dist/types/services/a2a/state/index.d.ts.map +1 -0
- package/dist/types/services/a2a/state/load.d.ts +15 -0
- package/dist/types/services/a2a/state/load.d.ts.map +1 -0
- package/dist/types/services/a2a/state/process.d.ts +8 -0
- package/dist/types/services/a2a/state/process.d.ts.map +1 -0
- package/dist/types/services/a2a/state/update/artifact.d.ts +11 -0
- package/dist/types/services/a2a/state/update/artifact.d.ts.map +1 -0
- package/dist/types/services/a2a/state/update/index.d.ts +3 -0
- package/dist/types/services/a2a/state/update/index.d.ts.map +1 -0
- package/dist/types/services/a2a/state/update/update.d.ts +24 -0
- package/dist/types/services/a2a/state/update/update.d.ts.map +1 -0
- package/dist/types/services/core/execution/execute.d.ts +7 -0
- package/dist/types/services/core/execution/execute.d.ts.map +1 -0
- package/dist/types/services/core/execution/index.d.ts +2 -0
- package/dist/types/services/core/execution/index.d.ts.map +1 -0
- package/dist/types/services/core/index.d.ts +3 -0
- package/dist/types/services/core/index.d.ts.map +1 -0
- package/dist/types/services/core/managers/command.d.ts +40 -0
- package/dist/types/services/core/managers/command.d.ts.map +1 -0
- package/dist/types/services/core/managers/event.d.ts +19 -0
- package/dist/types/services/core/managers/event.d.ts.map +1 -0
- package/dist/types/services/core/managers/index.d.ts +4 -0
- package/dist/types/services/core/managers/index.d.ts.map +1 -0
- package/dist/types/services/core/managers/stream.d.ts +21 -0
- package/dist/types/services/core/managers/stream.d.ts.map +1 -0
- package/dist/types/services/index.d.ts +3 -1
- package/dist/types/services/index.d.ts.map +1 -1
- package/dist/types/services/mcp/service.d.ts +23 -22
- package/dist/types/services/mcp/service.d.ts.map +1 -1
- package/dist/types/transport/index.d.ts +1 -1
- package/dist/types/transport/index.d.ts.map +1 -1
- package/dist/types/transport/rpc/parser.d.ts +5 -1
- package/dist/types/transport/rpc/parser.d.ts.map +1 -1
- package/dist/types/transport/rpc/rpc-client.d.ts +5 -1
- package/dist/types/transport/rpc/rpc-client.d.ts.map +1 -1
- package/dist/types/transport/streaming/event-stream.d.ts +5 -1
- package/dist/types/transport/streaming/event-stream.d.ts.map +1 -1
- package/dist/types/transport/trpc/a2a/factory/index.d.ts +2 -0
- package/dist/types/transport/trpc/a2a/factory/index.d.ts.map +1 -0
- package/dist/types/transport/trpc/a2a/factory/router.d.ts +2631 -0
- package/dist/types/transport/trpc/a2a/factory/router.d.ts.map +1 -0
- package/dist/types/transport/trpc/a2a/index.d.ts +4 -0
- package/dist/types/transport/trpc/a2a/index.d.ts.map +1 -0
- package/dist/types/transport/trpc/a2a/routes/index.d.ts +4 -0
- package/dist/types/transport/trpc/a2a/routes/index.d.ts.map +1 -0
- package/dist/types/transport/trpc/a2a/routes/info.d.ts +102 -0
- package/dist/types/transport/trpc/a2a/routes/info.d.ts.map +1 -0
- package/dist/types/transport/trpc/a2a/routes/message/index.d.ts +2 -0
- package/dist/types/transport/trpc/a2a/routes/message/index.d.ts.map +1 -0
- package/dist/types/transport/trpc/a2a/routes/message/route.d.ts +523 -0
- package/dist/types/transport/trpc/a2a/routes/message/route.d.ts.map +1 -0
- package/dist/types/transport/trpc/a2a/routes/tasks/index.d.ts +2 -0
- package/dist/types/transport/trpc/a2a/routes/tasks/index.d.ts.map +1 -0
- package/dist/types/transport/trpc/a2a/routes/tasks/route.d.ts +646 -0
- package/dist/types/transport/trpc/a2a/routes/tasks/route.d.ts.map +1 -0
- package/dist/types/transport/trpc/a2a/trpc.d.ts +272 -0
- package/dist/types/transport/trpc/a2a/trpc.d.ts.map +1 -0
- package/dist/types/transport/trpc/index.d.ts +2 -0
- package/dist/types/transport/trpc/index.d.ts.map +1 -0
- package/dist/types/types/ext.d.ts +14 -0
- package/dist/types/types/ext.d.ts.map +1 -0
- package/dist/types/types/index.d.ts +3 -4
- package/dist/types/types/index.d.ts.map +1 -1
- package/dist/types/types/{client.d.ts → interfaces/client.d.ts} +7 -2
- package/dist/types/types/interfaces/client.d.ts.map +1 -0
- package/dist/types/types/interfaces/index.d.ts +4 -0
- package/dist/types/types/interfaces/index.d.ts.map +1 -0
- package/dist/types/types/interfaces/services/a2a/builder.d.ts +37 -0
- package/dist/types/types/interfaces/services/a2a/builder.d.ts.map +1 -0
- package/dist/types/types/interfaces/services/a2a/context.d.ts +163 -0
- package/dist/types/types/interfaces/services/a2a/context.d.ts.map +1 -0
- package/dist/types/types/interfaces/services/a2a/engine.d.ts +8 -0
- package/dist/types/types/interfaces/services/a2a/engine.d.ts.map +1 -0
- package/dist/types/types/interfaces/services/a2a/index.d.ts +6 -0
- package/dist/types/types/interfaces/services/a2a/index.d.ts.map +1 -0
- package/dist/types/types/interfaces/services/a2a/legacy.d.ts +90 -0
- package/dist/types/types/interfaces/services/a2a/legacy.d.ts.map +1 -0
- package/dist/types/types/interfaces/services/a2a/service.d.ts +409 -0
- package/dist/types/types/interfaces/services/a2a/service.d.ts.map +1 -0
- package/dist/types/types/interfaces/services/core/context/command.d.ts +26 -0
- package/dist/types/types/interfaces/services/core/context/command.d.ts.map +1 -0
- package/dist/types/types/interfaces/services/core/context/context.d.ts +208 -0
- package/dist/types/types/interfaces/services/core/context/context.d.ts.map +1 -0
- package/dist/types/types/interfaces/services/core/context/index.d.ts +4 -0
- package/dist/types/types/interfaces/services/core/context/index.d.ts.map +1 -0
- package/dist/types/types/interfaces/services/core/context/types.d.ts +12 -0
- package/dist/types/types/interfaces/services/core/context/types.d.ts.map +1 -0
- package/dist/types/types/interfaces/services/core/execution/engine.d.ts +107 -0
- package/dist/types/types/interfaces/services/core/execution/engine.d.ts.map +1 -0
- package/dist/types/types/interfaces/services/core/execution/environment.d.ts +12 -0
- package/dist/types/types/interfaces/services/core/execution/environment.d.ts.map +1 -0
- package/dist/types/types/interfaces/services/core/execution/execute.d.ts +8 -0
- package/dist/types/types/interfaces/services/core/execution/execute.d.ts.map +1 -0
- package/dist/types/types/interfaces/services/core/execution/index.d.ts +4 -0
- package/dist/types/types/interfaces/services/core/execution/index.d.ts.map +1 -0
- package/dist/types/types/interfaces/services/core/index.d.ts +5 -0
- package/dist/types/types/interfaces/services/core/index.d.ts.map +1 -0
- package/dist/types/types/interfaces/services/core/managers/cancellation.d.ts +10 -0
- package/dist/types/types/interfaces/services/core/managers/cancellation.d.ts.map +1 -0
- package/dist/types/types/interfaces/services/core/managers/connection.d.ts +10 -0
- package/dist/types/types/interfaces/services/core/managers/connection.d.ts.map +1 -0
- package/dist/types/types/interfaces/services/core/managers/context.d.ts +18 -0
- package/dist/types/types/interfaces/services/core/managers/context.d.ts.map +1 -0
- package/dist/types/types/interfaces/services/core/managers/event.d.ts +329 -0
- package/dist/types/types/interfaces/services/core/managers/event.d.ts.map +1 -0
- package/dist/types/types/interfaces/services/core/managers/index.d.ts +7 -0
- package/dist/types/types/interfaces/services/core/managers/index.d.ts.map +1 -0
- package/dist/types/types/interfaces/services/core/managers/stream.d.ts +218 -0
- package/dist/types/types/interfaces/services/core/managers/stream.d.ts.map +1 -0
- package/dist/types/types/interfaces/services/core/managers/task.d.ts +10 -0
- package/dist/types/types/interfaces/services/core/managers/task.d.ts.map +1 -0
- package/dist/types/types/interfaces/services/core/service.d.ts +116 -0
- package/dist/types/types/interfaces/services/core/service.d.ts.map +1 -0
- package/dist/types/types/interfaces/services/index.d.ts +5 -0
- package/dist/types/types/interfaces/services/index.d.ts.map +1 -0
- package/dist/types/types/interfaces/services/mcp/index.d.ts +2 -0
- package/dist/types/types/interfaces/services/mcp/index.d.ts.map +1 -0
- package/dist/types/types/interfaces/services/mcp/service.d.ts +50 -0
- package/dist/types/types/interfaces/services/mcp/service.d.ts.map +1 -0
- package/dist/types/types/{services → interfaces/services}/protocol.d.ts +4 -0
- package/dist/types/types/interfaces/services/protocol.d.ts.map +1 -0
- package/dist/types/types/interfaces/storage.d.ts +9 -0
- package/dist/types/types/interfaces/storage.d.ts.map +1 -0
- package/dist/types/types/schemas/a2a/agent.d.ts +2584 -0
- package/dist/types/types/schemas/a2a/agent.d.ts.map +1 -0
- package/dist/types/types/schemas/a2a/auth.d.ts +909 -0
- package/dist/types/types/schemas/a2a/auth.d.ts.map +1 -0
- package/dist/types/types/schemas/a2a/error.d.ts +349 -27
- package/dist/types/types/schemas/a2a/error.d.ts.map +1 -1
- package/dist/types/types/schemas/a2a/index.d.ts +8 -216
- package/dist/types/types/schemas/a2a/index.d.ts.map +1 -1
- package/dist/types/types/schemas/a2a/kind.d.ts +12 -0
- package/dist/types/types/schemas/a2a/kind.d.ts.map +1 -0
- package/dist/types/types/schemas/a2a/message.d.ts +10309 -55
- package/dist/types/types/schemas/a2a/message.d.ts.map +1 -1
- package/dist/types/types/schemas/a2a/notification.d.ts +1480 -49
- package/dist/types/types/schemas/a2a/notification.d.ts.map +1 -1
- package/dist/types/types/schemas/a2a/parameters.d.ts +878 -109
- package/dist/types/types/schemas/a2a/parameters.d.ts.map +1 -1
- package/dist/types/types/schemas/a2a/protocol.d.ts +14364 -0
- package/dist/types/types/schemas/a2a/protocol.d.ts.map +1 -0
- package/dist/types/types/schemas/a2a/rpc.d.ts +135 -56
- package/dist/types/types/schemas/a2a/rpc.d.ts.map +1 -1
- package/dist/types/types/schemas/a2a/task.d.ts +5841 -206
- package/dist/types/types/schemas/a2a/task.d.ts.map +1 -1
- package/dist/types/types/schemas/a2a/transport.d.ts +32 -0
- package/dist/types/types/schemas/a2a/transport.d.ts.map +1 -0
- package/dist/types/types/schemas/deployment/index.d.ts +3 -0
- package/dist/types/types/schemas/deployment/index.d.ts.map +1 -0
- package/dist/types/types/{proxy.d.ts → schemas/deployment/proxy.d.ts} +6 -2
- package/dist/types/types/schemas/deployment/proxy.d.ts.map +1 -0
- package/dist/types/types/schemas/deployment/request.d.ts +2848 -0
- package/dist/types/types/schemas/deployment/request.d.ts.map +1 -0
- package/dist/types/types/utils/index.d.ts +2 -0
- package/dist/types/types/utils/index.d.ts.map +1 -0
- package/dist/types/types/{transform.d.ts → utils/transform.d.ts} +4 -0
- package/dist/types/types/utils/transform.d.ts.map +1 -0
- package/dist/types/utils/api/register.d.ts +4 -0
- package/dist/types/utils/api/register.d.ts.map +1 -1
- package/dist/types/utils/common/constants.d.ts +8 -4
- package/dist/types/utils/common/constants.d.ts.map +1 -1
- package/dist/types/utils/common/errors.d.ts +6 -12
- package/dist/types/utils/common/errors.d.ts.map +1 -1
- package/dist/types/utils/common/utils.d.ts +4 -14
- package/dist/types/utils/common/utils.d.ts.map +1 -1
- package/dist/types/utils/common/zAsyncIterable-v3.d.ts +25 -0
- package/dist/types/utils/common/zAsyncIterable-v3.d.ts.map +1 -0
- package/dist/types/utils/common/zAsyncIterable.d.ts +23 -0
- package/dist/types/utils/common/zAsyncIterable.d.ts.map +1 -0
- package/dist/types/utils/deployment/agents.d.ts +5 -1
- package/dist/types/utils/deployment/agents.d.ts.map +1 -1
- package/dist/types/utils/deployment/bundler.d.ts +4 -0
- package/dist/types/utils/deployment/bundler.d.ts.map +1 -1
- package/dist/types/utils/deployment/full-deployment.d.ts +12 -2
- package/dist/types/utils/deployment/full-deployment.d.ts.map +1 -1
- package/dist/types/utils/deployment/index.d.ts +5 -0
- package/dist/types/utils/deployment/index.d.ts.map +1 -0
- package/dist/types/utils/deployment/task-wrapper.d.ts +6 -2
- package/dist/types/utils/deployment/task-wrapper.d.ts.map +1 -1
- package/dist/types/utils/deployment/test-deployment.d.ts +7 -2
- package/dist/types/utils/deployment/test-deployment.d.ts.map +1 -1
- package/dist/types/utils/index.d.ts +4 -6
- package/dist/types/utils/index.d.ts.map +1 -1
- package/dist/types/utils/index.js +2 -0
- package/dist/types/utils/index.js.map +1 -0
- package/dist/types/utils/logging/index.d.ts +3 -0
- package/dist/types/utils/logging/index.d.ts.map +1 -0
- package/dist/types/utils/logging/log.d.ts +4 -0
- package/dist/types/utils/logging/log.d.ts.map +1 -1
- package/dist/types/utils/logging/logger.d.ts +4 -0
- package/dist/types/utils/logging/logger.d.ts.map +1 -1
- package/dist/types/{server/lib → utils}/storage/file.d.ts +9 -4
- package/dist/types/utils/storage/file.d.ts.map +1 -0
- package/dist/types/{server/lib → utils}/storage/memory.d.ts +9 -4
- package/dist/types/utils/storage/memory.d.ts.map +1 -0
- package/dist/types/{transform.js → utils/transform.js} +2 -1
- package/dist/types/utils/transform.js.map +1 -0
- package/dist/utils/api/register.js +4 -0
- package/dist/utils/api/register.js.map +1 -1
- package/dist/utils/common/constants.js +20 -11
- package/dist/utils/common/constants.js.map +1 -1
- package/dist/utils/common/errors.js +7 -40
- package/dist/utils/common/errors.js.map +1 -1
- package/dist/utils/common/utils.js +4 -46
- package/dist/utils/common/utils.js.map +1 -1
- package/dist/utils/common/zAsyncIterable-v3.js +39 -0
- package/dist/utils/common/zAsyncIterable-v3.js.map +1 -0
- package/dist/utils/common/zAsyncIterable.js +41 -0
- package/dist/utils/common/zAsyncIterable.js.map +1 -0
- package/dist/utils/deployment/agents.js +4 -0
- package/dist/utils/deployment/agents.js.map +1 -1
- package/dist/utils/deployment/bundler.js +4 -0
- package/dist/utils/deployment/bundler.js.map +1 -1
- package/dist/utils/deployment/full-deployment.js +6 -2
- package/dist/utils/deployment/full-deployment.js.map +1 -1
- package/dist/utils/deployment/index.js +5 -0
- package/dist/utils/deployment/index.js.map +1 -0
- package/dist/utils/deployment/task-wrapper.js +4 -0
- package/dist/utils/deployment/task-wrapper.js.map +1 -1
- package/dist/utils/deployment/test-deployment.js +15 -7
- package/dist/utils/deployment/test-deployment.js.map +1 -1
- package/dist/utils/index.js +10 -6
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/logging/index.js +3 -0
- package/dist/utils/logging/index.js.map +1 -0
- package/dist/utils/logging/log.js +4 -0
- package/dist/utils/logging/log.js.map +1 -1
- package/dist/utils/logging/logger.js +13 -0
- package/dist/utils/logging/logger.js.map +1 -1
- package/dist/{server/lib → utils}/storage/file.js +17 -6
- package/dist/utils/storage/file.js.map +1 -0
- package/dist/{server/lib → utils}/storage/memory.js +15 -5
- package/dist/utils/storage/memory.js.map +1 -0
- package/package.json +18 -7
- package/dist/server/a2a-server.js +0 -237
- package/dist/server/a2a-server.js.map +0 -1
- package/dist/server/interfaces/params.js +0 -3
- package/dist/server/interfaces/params.js.map +0 -1
- package/dist/server/interfaces/server.js +0 -2
- package/dist/server/interfaces/server.js.map +0 -1
- package/dist/server/interfaces/store.js +0 -18
- package/dist/server/interfaces/store.js.map +0 -1
- package/dist/server/lib/express-server.js +0 -252
- package/dist/server/lib/express-server.js.map +0 -1
- package/dist/server/lib/json-middleware.js +0 -3
- package/dist/server/lib/json-middleware.js.map +0 -1
- package/dist/server/lib/middleware/a2a-methods.js +0 -140
- package/dist/server/lib/middleware/a2a-methods.js.map +0 -1
- package/dist/server/lib/middleware/factory.js +0 -59
- package/dist/server/lib/middleware/factory.js.map +0 -1
- package/dist/server/lib/state.js +0 -80
- package/dist/server/lib/state.js.map +0 -1
- package/dist/server/lib/storage/file.js.map +0 -1
- package/dist/server/lib/storage/memory.js.map +0 -1
- package/dist/server/lib/update/base.js.map +0 -1
- package/dist/services/a2a/repository.js +0 -160
- package/dist/services/a2a/repository.js.map +0 -1
- package/dist/services/manager.js +0 -61
- package/dist/services/manager.js.map +0 -1
- package/dist/transport/streaming/stream.js +0 -111
- package/dist/transport/streaming/stream.js.map +0 -1
- package/dist/types/client.js +0 -2
- package/dist/types/client.js.map +0 -1
- package/dist/types/express.js +0 -2
- package/dist/types/express.js.map +0 -1
- package/dist/types/extended-schema.js +0 -7
- package/dist/types/extended-schema.js.map +0 -1
- package/dist/types/proxy.js +0 -2
- package/dist/types/proxy.js.map +0 -1
- package/dist/types/schemas/a2a/auth/auth.js +0 -2
- package/dist/types/schemas/a2a/auth/auth.js.map +0 -1
- package/dist/types/schemas/a2a/auth/base.js +0 -2
- package/dist/types/schemas/a2a/auth/base.js.map +0 -1
- package/dist/types/schemas/a2a/auth/index.js +0 -4
- package/dist/types/schemas/a2a/auth/index.js.map +0 -1
- package/dist/types/schemas/a2a/auth/oauth.js +0 -2
- package/dist/types/schemas/a2a/auth/oauth.js.map +0 -1
- package/dist/types/schemas/a2a/ref.js +0 -25
- package/dist/types/schemas/a2a/ref.js.map +0 -1
- package/dist/types/server/a2a-server.d.ts +0 -145
- package/dist/types/server/a2a-server.d.ts.map +0 -1
- package/dist/types/server/interfaces/params.d.ts +0 -109
- package/dist/types/server/interfaces/params.d.ts.map +0 -1
- package/dist/types/server/interfaces/server.d.ts +0 -35
- package/dist/types/server/interfaces/server.d.ts.map +0 -1
- package/dist/types/server/interfaces/store.d.ts +0 -35
- package/dist/types/server/interfaces/store.d.ts.map +0 -1
- package/dist/types/server/lib/express-server.d.ts +0 -59
- package/dist/types/server/lib/express-server.d.ts.map +0 -1
- package/dist/types/server/lib/json-middleware.d.ts +0 -3
- package/dist/types/server/lib/json-middleware.d.ts.map +0 -1
- package/dist/types/server/lib/middleware/a2a-methods.d.ts +0 -7
- package/dist/types/server/lib/middleware/a2a-methods.d.ts.map +0 -1
- package/dist/types/server/lib/middleware/factory.d.ts +0 -12
- package/dist/types/server/lib/middleware/factory.d.ts.map +0 -1
- package/dist/types/server/lib/state.d.ts +0 -20
- package/dist/types/server/lib/state.d.ts.map +0 -1
- package/dist/types/server/lib/storage/file.d.ts.map +0 -1
- package/dist/types/server/lib/storage/memory.d.ts.map +0 -1
- package/dist/types/server/lib/update/base.d.ts +0 -21
- package/dist/types/server/lib/update/base.d.ts.map +0 -1
- package/dist/types/services/a2a/repository.d.ts +0 -77
- package/dist/types/services/a2a/repository.d.ts.map +0 -1
- package/dist/types/services/a2a/repository.js +0 -2
- package/dist/types/services/a2a/repository.js.map +0 -1
- package/dist/types/services/a2a/service.js +0 -2
- package/dist/types/services/a2a/service.js.map +0 -1
- package/dist/types/services/context.js +0 -29
- package/dist/types/services/context.js.map +0 -1
- package/dist/types/services/dispatcher.js +0 -33
- package/dist/types/services/dispatcher.js.map +0 -1
- package/dist/types/services/index.js +0 -9
- package/dist/types/services/index.js.map +0 -1
- package/dist/types/services/manager.d.ts +0 -44
- package/dist/types/services/manager.d.ts.map +0 -1
- package/dist/types/services/manager.js +0 -2
- package/dist/types/services/manager.js.map +0 -1
- package/dist/types/services/mcp/service.js +0 -8
- package/dist/types/services/mcp/service.js.map +0 -1
- package/dist/types/services/protocol.js.map +0 -1
- package/dist/types/services/service.js +0 -2
- package/dist/types/services/service.js.map +0 -1
- package/dist/types/transform.js.map +0 -1
- package/dist/types/transport/streaming/stream.d.ts +0 -42
- package/dist/types/transport/streaming/stream.d.ts.map +0 -1
- package/dist/types/types/client.d.ts.map +0 -1
- package/dist/types/types/express.d.ts +0 -66
- package/dist/types/types/express.d.ts.map +0 -1
- package/dist/types/types/extended-schema.d.ts +0 -174
- package/dist/types/types/extended-schema.d.ts.map +0 -1
- package/dist/types/types/proxy.d.ts.map +0 -1
- package/dist/types/types/schemas/a2a/auth/auth.d.ts +0 -80
- package/dist/types/types/schemas/a2a/auth/auth.d.ts.map +0 -1
- package/dist/types/types/schemas/a2a/auth/base.d.ts +0 -16
- package/dist/types/types/schemas/a2a/auth/base.d.ts.map +0 -1
- package/dist/types/types/schemas/a2a/auth/index.d.ts +0 -4
- package/dist/types/types/schemas/a2a/auth/index.d.ts.map +0 -1
- package/dist/types/types/schemas/a2a/auth/oauth.d.ts +0 -124
- package/dist/types/types/schemas/a2a/auth/oauth.d.ts.map +0 -1
- package/dist/types/types/schemas/a2a/ref.d.ts +0 -2057
- package/dist/types/types/schemas/a2a/ref.d.ts.map +0 -1
- package/dist/types/types/services/a2a/repository.d.ts +0 -85
- package/dist/types/types/services/a2a/repository.d.ts.map +0 -1
- package/dist/types/types/services/a2a/service.d.ts +0 -29
- package/dist/types/types/services/a2a/service.d.ts.map +0 -1
- package/dist/types/types/services/context.d.ts +0 -167
- package/dist/types/types/services/context.d.ts.map +0 -1
- package/dist/types/types/services/dispatcher.d.ts +0 -20
- package/dist/types/types/services/dispatcher.d.ts.map +0 -1
- package/dist/types/types/services/index.d.ts +0 -9
- package/dist/types/types/services/index.d.ts.map +0 -1
- package/dist/types/types/services/manager.d.ts +0 -42
- package/dist/types/types/services/manager.d.ts.map +0 -1
- package/dist/types/types/services/mcp/service.d.ts +0 -57
- package/dist/types/types/services/mcp/service.d.ts.map +0 -1
- package/dist/types/types/services/protocol.d.ts.map +0 -1
- package/dist/types/types/services/service.d.ts +0 -35
- package/dist/types/types/services/service.d.ts.map +0 -1
- package/dist/types/types/transform.d.ts.map +0 -1
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 The Artinet Project
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @fileoverview A2A Agent Builder and Execution Engine Factory
|
|
7
|
+
*
|
|
8
|
+
* This module provides a fluent builder API for constructing A2A agents and
|
|
9
|
+
* execution engines. It enables declarative definition of multi-step agent
|
|
10
|
+
* workflows with type-safe step composition and automatic execution orchestration.
|
|
11
|
+
*
|
|
12
|
+
* @module A2ABuilder
|
|
13
|
+
* @version 0.5.7
|
|
14
|
+
* @since 0.5.6
|
|
15
|
+
* @author The Artinet Project
|
|
16
|
+
*/
|
|
17
|
+
import { StepBuilder, Step, StepOutput, StepOutputWithForwardArgs, MessageSendParams, TextPart, DataPart, FilePart, AgentEngine, StepWithKind, FactoryParams } from "../../../types/index.js";
|
|
18
|
+
/**
|
|
19
|
+
* Type alias for text-based workflow steps.
|
|
20
|
+
*
|
|
21
|
+
* This type represents a step that processes or generates text content
|
|
22
|
+
* within an agent workflow. Text steps are the most common type of step
|
|
23
|
+
* and are used for message processing, content generation, and text-based
|
|
24
|
+
* decision making.
|
|
25
|
+
*
|
|
26
|
+
* @template TCommand - The command type, defaults to MessageSendParams
|
|
27
|
+
* @template TPart - The text part type, defaults to TextPart["text"]
|
|
28
|
+
* @template TInboundArgs - Arguments received from previous step
|
|
29
|
+
* @template TForwardArgs - Arguments passed to next step
|
|
30
|
+
* @template TOutput - The output type of the step
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* const greetingStep: textStep = async ({ command, context, args }) => {
|
|
35
|
+
* const userName = command.message.metadata?.userName || 'there';
|
|
36
|
+
* return `Hello, ${userName}! How can I help you today?`;
|
|
37
|
+
* };
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @public
|
|
41
|
+
* @since 0.5.6
|
|
42
|
+
*/
|
|
43
|
+
export type textStep<TCommand extends MessageSendParams = MessageSendParams, TPart extends TextPart["text"] = TextPart["text"], TInboundArgs extends readonly unknown[] = [], TForwardArgs extends readonly unknown[] = [], TOutput extends StepOutput<TPart> | StepOutputWithForwardArgs<TPart, TForwardArgs> | Array<TPart> | TPart = StepOutput<TPart>> = Step<TCommand, TPart, TInboundArgs, TForwardArgs, TOutput>;
|
|
44
|
+
/**
|
|
45
|
+
* Type alias for file-based workflow steps.
|
|
46
|
+
*
|
|
47
|
+
* This type represents a step that processes or generates file content
|
|
48
|
+
* within an agent workflow. File steps handle document processing,
|
|
49
|
+
* file generation, and file-based data operations.
|
|
50
|
+
*
|
|
51
|
+
* @template TCommand - The command type, defaults to MessageSendParams
|
|
52
|
+
* @template TPart - The file part type, defaults to FilePart["file"]
|
|
53
|
+
* @template TInboundArgs - Arguments received from previous step
|
|
54
|
+
* @template TForwardArgs - Arguments passed to next step
|
|
55
|
+
* @template TOutput - The output type of the step
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```typescript
|
|
59
|
+
* const documentStep: fileStep = async ({ command, context, args }) => {
|
|
60
|
+
* const content = generateDocument(command.message.content);
|
|
61
|
+
* return {
|
|
62
|
+
* name: 'report.pdf',
|
|
63
|
+
* mimeType: 'application/pdf',
|
|
64
|
+
* bytes: content
|
|
65
|
+
* };
|
|
66
|
+
* };
|
|
67
|
+
* ```
|
|
68
|
+
*
|
|
69
|
+
* @public
|
|
70
|
+
* @since 0.5.6
|
|
71
|
+
*/
|
|
72
|
+
export type fileStep<TCommand extends MessageSendParams = MessageSendParams, TPart extends FilePart["file"] = FilePart["file"], TInboundArgs extends readonly unknown[] = [], TForwardArgs extends readonly unknown[] = [], TOutput extends StepOutput<TPart> | StepOutputWithForwardArgs<TPart, TForwardArgs> | Array<TPart> | TPart = StepOutput<TPart>> = Step<TCommand, TPart, TInboundArgs, TForwardArgs, TOutput>;
|
|
73
|
+
/**
|
|
74
|
+
* Type alias for data-based workflow steps.
|
|
75
|
+
*
|
|
76
|
+
* This type represents a step that processes or generates structured data
|
|
77
|
+
* within an agent workflow. Data steps handle JSON processing, API responses,
|
|
78
|
+
* and structured data transformations.
|
|
79
|
+
*
|
|
80
|
+
* @template TCommand - The command type, defaults to MessageSendParams
|
|
81
|
+
* @template TPart - The data part type, defaults to DataPart["data"]
|
|
82
|
+
* @template TInboundArgs - Arguments received from previous step
|
|
83
|
+
* @template TForwardArgs - Arguments passed to next step
|
|
84
|
+
* @template TOutput - The output type of the step
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```typescript
|
|
88
|
+
* const analyzeStep: dataStep = async ({ command, context, args }) => {
|
|
89
|
+
* const analysis = await analyzeMessage(command.message.content);
|
|
90
|
+
* return {
|
|
91
|
+
* sentiment: analysis.sentiment,
|
|
92
|
+
* entities: analysis.entities,
|
|
93
|
+
* confidence: analysis.confidence
|
|
94
|
+
* };
|
|
95
|
+
* };
|
|
96
|
+
* ```
|
|
97
|
+
*
|
|
98
|
+
* @public
|
|
99
|
+
* @since 0.5.6
|
|
100
|
+
*/
|
|
101
|
+
export type dataStep<TCommand extends MessageSendParams = MessageSendParams, TPart extends DataPart["data"] = DataPart["data"], TInboundArgs extends readonly unknown[] = [], TForwardArgs extends readonly unknown[] = [], TOutput extends StepOutput<TPart> | StepOutputWithForwardArgs<TPart, TForwardArgs> | Array<TPart> | TPart = StepOutput<TPart>> = Step<TCommand, TPart, TInboundArgs, TForwardArgs, TOutput>;
|
|
102
|
+
/**
|
|
103
|
+
* Utility type to extract forward arguments from step output.
|
|
104
|
+
*
|
|
105
|
+
* This helper type extracts the forward arguments type from a step output,
|
|
106
|
+
* enabling proper type chaining between workflow steps.
|
|
107
|
+
*
|
|
108
|
+
* @template O - The output type to extract arguments from
|
|
109
|
+
* @internal
|
|
110
|
+
*/
|
|
111
|
+
type OutArgsOf<O> = O extends StepOutputWithForwardArgs<any, infer A> ? A : [];
|
|
112
|
+
/**
|
|
113
|
+
* Fluent builder for constructing A2A agent execution engines.
|
|
114
|
+
*
|
|
115
|
+
* The EngineBuilder provides a type-safe, fluent API for composing multi-step
|
|
116
|
+
* agent workflows. It supports method chaining to build complex agent behaviors
|
|
117
|
+
* from individual processing steps, with automatic type inference and validation.
|
|
118
|
+
*
|
|
119
|
+
* @template TCommand - The command type, defaults to MessageSendParams
|
|
120
|
+
* @template TInboundArgs - The arguments type received from previous steps
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* ```typescript
|
|
124
|
+
* const agent = EngineBuilder.create()
|
|
125
|
+
* .text(async ({ command }) => {
|
|
126
|
+
* return `Processing: ${command.message.content}`;
|
|
127
|
+
* })
|
|
128
|
+
* .data(async ({ args }) => {
|
|
129
|
+
* return { processed: true, timestamp: Date.now() };
|
|
130
|
+
* })
|
|
131
|
+
* .text(async ({ args }) => {
|
|
132
|
+
* return `Completed at ${new Date(args[0].timestamp)}`;
|
|
133
|
+
* })
|
|
134
|
+
* .createAgent({ agentCard: myAgentCard });
|
|
135
|
+
* ```
|
|
136
|
+
*
|
|
137
|
+
* @public
|
|
138
|
+
* @since 0.5.6
|
|
139
|
+
*/
|
|
140
|
+
export declare class EngineBuilder<TCommand extends MessageSendParams = MessageSendParams, TInboundArgs extends readonly unknown[] = []> implements StepBuilder<TCommand, TInboundArgs> {
|
|
141
|
+
private steps;
|
|
142
|
+
/**
|
|
143
|
+
* Private constructor to enforce factory method usage.
|
|
144
|
+
*
|
|
145
|
+
* @param steps - Initial steps array
|
|
146
|
+
*/
|
|
147
|
+
private constructor();
|
|
148
|
+
/**
|
|
149
|
+
* Creates a new EngineBuilder instance.
|
|
150
|
+
*
|
|
151
|
+
* @template TCommand - The command type for the builder
|
|
152
|
+
* @template TInboundArgs - The initial arguments type
|
|
153
|
+
* @returns A new EngineBuilder instance
|
|
154
|
+
*
|
|
155
|
+
* @example
|
|
156
|
+
* ```typescript
|
|
157
|
+
* const builder = EngineBuilder.create<MyCommand, [string, number]>();
|
|
158
|
+
* ```
|
|
159
|
+
*/
|
|
160
|
+
static create<TCommand extends MessageSendParams = MessageSendParams, TInboundArgs extends readonly unknown[] = []>(): EngineBuilder<TCommand, TInboundArgs>;
|
|
161
|
+
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>): EngineBuilder<TCommand, OutArgsOf<TOutput>>;
|
|
162
|
+
/**
|
|
163
|
+
* Adds a text processing step to the workflow.
|
|
164
|
+
*
|
|
165
|
+
* @template TPart - The text part type
|
|
166
|
+
* @template TForwardArgs - Arguments to forward to next step
|
|
167
|
+
* @template TOutput - The output type of the step
|
|
168
|
+
* @param step - The text step implementation
|
|
169
|
+
* @returns New builder instance with updated type parameters
|
|
170
|
+
*
|
|
171
|
+
* @example
|
|
172
|
+
* ```typescript
|
|
173
|
+
* builder.text(async ({ command, args }) => {
|
|
174
|
+
* return `Hello, ${command.message.content}!`;
|
|
175
|
+
* });
|
|
176
|
+
* ```
|
|
177
|
+
*/
|
|
178
|
+
text<TPart extends TextPart["text"] = TextPart["text"], TForwardArgs extends readonly unknown[] = [], TOutput extends StepOutput<TPart> | StepOutputWithForwardArgs<TPart, TForwardArgs> | Array<TPart> | TPart = StepOutput<TPart>>(step: textStep<TCommand, TPart, TInboundArgs, TForwardArgs, TOutput>): EngineBuilder<TCommand, OutArgsOf<TOutput>>;
|
|
179
|
+
/**
|
|
180
|
+
* Adds a file processing step to the workflow.
|
|
181
|
+
*
|
|
182
|
+
* @template TPart - The file part type
|
|
183
|
+
* @template TForwardArgs - Arguments to forward to next step
|
|
184
|
+
* @template TOutput - The output type of the step
|
|
185
|
+
* @param step - The file step implementation
|
|
186
|
+
* @returns New builder instance with updated type parameters
|
|
187
|
+
*
|
|
188
|
+
* @example
|
|
189
|
+
* ```typescript
|
|
190
|
+
* builder.file(async ({ command, args }) => {
|
|
191
|
+
* return {
|
|
192
|
+
* name: 'output.txt',
|
|
193
|
+
* mimeType: 'text/plain',
|
|
194
|
+
* bytes: Buffer.from(command.message.content)
|
|
195
|
+
* };
|
|
196
|
+
* });
|
|
197
|
+
* ```
|
|
198
|
+
*/
|
|
199
|
+
file<TPart extends FilePart["file"] = FilePart["file"], TForwardArgs extends readonly unknown[] = [], TOutput extends StepOutput<TPart> | StepOutputWithForwardArgs<TPart, TForwardArgs> | Array<TPart> | TPart = StepOutput<TPart>>(step: fileStep<TCommand, TPart, TInboundArgs, TForwardArgs, TOutput>): EngineBuilder<TCommand, OutArgsOf<TOutput>>;
|
|
200
|
+
/**
|
|
201
|
+
* Adds a data processing step to the workflow.
|
|
202
|
+
*
|
|
203
|
+
* @template TPart - The data part type
|
|
204
|
+
* @template TForwardArgs - Arguments to forward to next step
|
|
205
|
+
* @template TOutput - The output type of the step
|
|
206
|
+
* @param step - The data step implementation
|
|
207
|
+
* @returns New builder instance with updated type parameters
|
|
208
|
+
*
|
|
209
|
+
* @example
|
|
210
|
+
* ```typescript
|
|
211
|
+
* builder.data(async ({ command, args }) => {
|
|
212
|
+
* return {
|
|
213
|
+
* analysis: analyzeText(command.message.content),
|
|
214
|
+
* timestamp: Date.now()
|
|
215
|
+
* };
|
|
216
|
+
* });
|
|
217
|
+
* ```
|
|
218
|
+
*/
|
|
219
|
+
data<TPart extends DataPart["data"] = DataPart["data"], TForwardArgs extends readonly unknown[] = [], TOutput extends StepOutput<TPart> | StepOutputWithForwardArgs<TPart, TForwardArgs> | Array<TPart> | TPart = StepOutput<TPart>>(step: dataStep<TCommand, TPart, TInboundArgs, TForwardArgs, TOutput>): EngineBuilder<TCommand, OutArgsOf<TOutput>>;
|
|
220
|
+
/**
|
|
221
|
+
* Creates a complete A2A agent using the built workflow.
|
|
222
|
+
*
|
|
223
|
+
* @param params - Agent factory parameters (excluding engine)
|
|
224
|
+
* @returns Configured A2A agent instance
|
|
225
|
+
*
|
|
226
|
+
* @example
|
|
227
|
+
* ```typescript
|
|
228
|
+
* const agent = builder.createAgent({
|
|
229
|
+
* agentCard: {
|
|
230
|
+
* id: 'my-agent',
|
|
231
|
+
* name: 'Assistant Agent',
|
|
232
|
+
* capabilities: ['text-processing']
|
|
233
|
+
* }
|
|
234
|
+
* });
|
|
235
|
+
* ```
|
|
236
|
+
*/
|
|
237
|
+
createAgent(params: Omit<FactoryParams, "engine">): import("../service.js").A2AService;
|
|
238
|
+
/**
|
|
239
|
+
* Creates an agent execution engine from the built workflow.
|
|
240
|
+
*
|
|
241
|
+
* @returns Agent execution engine function
|
|
242
|
+
*
|
|
243
|
+
* @example
|
|
244
|
+
* ```typescript
|
|
245
|
+
* const engine = builder.createAgentEngine();
|
|
246
|
+
* // Use engine with service execution
|
|
247
|
+
* ```
|
|
248
|
+
*/
|
|
249
|
+
createAgentEngine(): AgentEngine;
|
|
250
|
+
/**
|
|
251
|
+
* Builds the step list for the workflow.
|
|
252
|
+
*
|
|
253
|
+
* @returns Array of workflow steps
|
|
254
|
+
* @throws Error if no steps have been added
|
|
255
|
+
*
|
|
256
|
+
* @example
|
|
257
|
+
* ```typescript
|
|
258
|
+
* const steps = builder.build();
|
|
259
|
+
* ```
|
|
260
|
+
*/
|
|
261
|
+
build(): StepWithKind<TCommand, any, any, any, any, any>[];
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Convenience factory function for creating an agent builder with default parameters.
|
|
265
|
+
*
|
|
266
|
+
* @returns New EngineBuilder instance with MessageSendParams command type
|
|
267
|
+
*
|
|
268
|
+
* @example
|
|
269
|
+
* ```typescript
|
|
270
|
+
* const agent = AgentBuilder()
|
|
271
|
+
* .text(async ({ command }) => `Hello ${command.message.content}!`)
|
|
272
|
+
* .createAgent({ agentCard: myCard });
|
|
273
|
+
* ```
|
|
274
|
+
*
|
|
275
|
+
* @public
|
|
276
|
+
* @since 0.5.6
|
|
277
|
+
*/
|
|
278
|
+
export declare const AgentBuilder: () => EngineBuilder<{
|
|
279
|
+
message: {
|
|
280
|
+
kind: "message";
|
|
281
|
+
parts: ({
|
|
282
|
+
file: {
|
|
283
|
+
bytes: string;
|
|
284
|
+
name?: string | undefined;
|
|
285
|
+
mimeType?: string | undefined;
|
|
286
|
+
uri?: undefined;
|
|
287
|
+
} | {
|
|
288
|
+
uri: string;
|
|
289
|
+
name?: string | undefined;
|
|
290
|
+
mimeType?: string | undefined;
|
|
291
|
+
bytes?: undefined;
|
|
292
|
+
};
|
|
293
|
+
kind: "file";
|
|
294
|
+
metadata?: Record<string, unknown> | undefined;
|
|
295
|
+
} | {
|
|
296
|
+
text: string;
|
|
297
|
+
kind: "text";
|
|
298
|
+
metadata?: Record<string, unknown> | undefined;
|
|
299
|
+
} | {
|
|
300
|
+
data: Record<string, unknown>;
|
|
301
|
+
kind: "data";
|
|
302
|
+
metadata?: Record<string, unknown> | undefined;
|
|
303
|
+
})[];
|
|
304
|
+
role: "user" | "agent";
|
|
305
|
+
messageId: string;
|
|
306
|
+
metadata?: Record<string, unknown> | undefined;
|
|
307
|
+
extensions?: string[] | undefined;
|
|
308
|
+
referenceTaskIds?: string[] | undefined;
|
|
309
|
+
taskId?: string | undefined;
|
|
310
|
+
contextId?: string | undefined;
|
|
311
|
+
};
|
|
312
|
+
metadata?: Record<string, unknown> | undefined;
|
|
313
|
+
configuration?: {
|
|
314
|
+
historyLength?: number | undefined;
|
|
315
|
+
pushNotificationConfig?: {
|
|
316
|
+
url: string;
|
|
317
|
+
id?: string | undefined;
|
|
318
|
+
token?: string | undefined;
|
|
319
|
+
authentication?: {
|
|
320
|
+
schemes: string[];
|
|
321
|
+
credentials?: string | undefined;
|
|
322
|
+
} | undefined;
|
|
323
|
+
} | undefined;
|
|
324
|
+
acceptedOutputModes?: string[] | undefined;
|
|
325
|
+
blocking?: boolean | undefined;
|
|
326
|
+
} | undefined;
|
|
327
|
+
}, []>;
|
|
328
|
+
/**
|
|
329
|
+
* Creates an agent execution engine from a list of workflow steps.
|
|
330
|
+
*
|
|
331
|
+
* This function transforms a list of step definitions into an executable
|
|
332
|
+
* agent engine that processes commands through the defined workflow,
|
|
333
|
+
* yielding updates as each step completes.
|
|
334
|
+
*
|
|
335
|
+
* @param stepsList - Array of workflow steps to execute
|
|
336
|
+
* @returns Agent execution engine function
|
|
337
|
+
*
|
|
338
|
+
* @example
|
|
339
|
+
* ```typescript
|
|
340
|
+
* const steps = [
|
|
341
|
+
* { kind: 'text', step: greetingStep },
|
|
342
|
+
* { kind: 'data', step: analysisStep }
|
|
343
|
+
* ];
|
|
344
|
+
* const engine = createAgentExecutor(steps);
|
|
345
|
+
* ```
|
|
346
|
+
*
|
|
347
|
+
* @public
|
|
348
|
+
* @since 0.5.6
|
|
349
|
+
*/
|
|
350
|
+
export declare function createAgentExecutor(stepsList: StepWithKind[]): AgentEngine;
|
|
351
|
+
export {};
|
|
352
|
+
//# sourceMappingURL=builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../../../../src/services/a2a/factory/builder.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 The Artinet Project
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @fileoverview A2A Context Factory Functions
|
|
7
|
+
*
|
|
8
|
+
* This module provides factory functions for creating A2A execution contexts
|
|
9
|
+
* and command channels. It handles the composition of various context components
|
|
10
|
+
* including command proxies, event managers, and cancellation mechanisms.
|
|
11
|
+
*
|
|
12
|
+
* @module A2AContextFactory
|
|
13
|
+
* @version 0.5.7
|
|
14
|
+
* @since 0.5.6
|
|
15
|
+
* @author The Artinet Project
|
|
16
|
+
*/
|
|
17
|
+
import { Command, ReceiveCommandProxyInterface, State, Update, Context, A2AServiceInterface, ContextManagerInterface, EventManagerOptions } from "../../../types/index.js";
|
|
18
|
+
/**
|
|
19
|
+
* Creates a command channel proxy for the given command.
|
|
20
|
+
*
|
|
21
|
+
* This function wraps a command in a proxy interface that provides
|
|
22
|
+
* controlled access to command data and may add additional functionality
|
|
23
|
+
* such as validation, logging, or transformation.
|
|
24
|
+
*
|
|
25
|
+
* @template TCommand - The command type, must extend Command
|
|
26
|
+
* @param request - The command to wrap in a proxy
|
|
27
|
+
* @returns Command proxy interface for the request
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* const command: MessageSendParams = {
|
|
32
|
+
* message: {
|
|
33
|
+
* content: 'Hello, world!',
|
|
34
|
+
* recipient: 'agent-123'
|
|
35
|
+
* }
|
|
36
|
+
* };
|
|
37
|
+
*
|
|
38
|
+
* const commandProxy = createCommandChannel(command);
|
|
39
|
+
* // Use commandProxy to access command data safely
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @public
|
|
43
|
+
* @since 0.5.6
|
|
44
|
+
*/
|
|
45
|
+
export declare function createCommandChannel<TCommand extends Command = Command>(request: TCommand): ReceiveCommandProxyInterface<TCommand>;
|
|
46
|
+
/**
|
|
47
|
+
* Creates a complete A2A execution context for command processing.
|
|
48
|
+
*
|
|
49
|
+
* This is the main factory function for creating execution contexts in the A2A
|
|
50
|
+
* framework. It assembles all the necessary components including command proxy,
|
|
51
|
+
* event management, cancellation handling, and state management into a cohesive
|
|
52
|
+
* execution environment.
|
|
53
|
+
*
|
|
54
|
+
* The context serves as the primary execution environment passed to execution
|
|
55
|
+
* engines and provides access to all the resources and capabilities needed
|
|
56
|
+
* for command processing.
|
|
57
|
+
*
|
|
58
|
+
* @template TCommand - The command type, must extend Command
|
|
59
|
+
* @template TState - The state type, must extend State
|
|
60
|
+
* @template TUpdate - The update type, must extend Update
|
|
61
|
+
*
|
|
62
|
+
* @param request - The command to execute
|
|
63
|
+
* @param service - The A2A service instance
|
|
64
|
+
* @param contextManager - Manager for context lifecycle
|
|
65
|
+
* @param abortSignal - Optional abort signal for cancellation
|
|
66
|
+
* @param contextId - Optional context ID (generates UUID if not provided)
|
|
67
|
+
* @param eventOverrides - Optional event manager configuration overrides
|
|
68
|
+
* @returns Fully configured execution context
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```typescript
|
|
72
|
+
* // Basic context creation
|
|
73
|
+
* const context = createContext(
|
|
74
|
+
* messageCommand,
|
|
75
|
+
* a2aService,
|
|
76
|
+
* contextManager
|
|
77
|
+
* );
|
|
78
|
+
*
|
|
79
|
+
* // Execute with the context
|
|
80
|
+
* for await (const update of engine(context)) {
|
|
81
|
+
* console.log('Update:', update);
|
|
82
|
+
* }
|
|
83
|
+
* ```
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```typescript
|
|
87
|
+
* // Context creation with custom options
|
|
88
|
+
* const abortController = new AbortController();
|
|
89
|
+
* const customEventOptions = {
|
|
90
|
+
* onStart: async (ctx) => {
|
|
91
|
+
* console.log('Custom start handler');
|
|
92
|
+
* return initialState;
|
|
93
|
+
* }
|
|
94
|
+
* };
|
|
95
|
+
*
|
|
96
|
+
* const context = createContext(
|
|
97
|
+
* command,
|
|
98
|
+
* service,
|
|
99
|
+
* contextManager,
|
|
100
|
+
* abortController.signal,
|
|
101
|
+
* 'custom-context-id',
|
|
102
|
+
* customEventOptions
|
|
103
|
+
* );
|
|
104
|
+
*
|
|
105
|
+
* // Cancel after 30 seconds
|
|
106
|
+
* setTimeout(() => abortController.abort(), 30000);
|
|
107
|
+
* ```
|
|
108
|
+
*
|
|
109
|
+
* @remarks
|
|
110
|
+
* **Context Lifecycle:**
|
|
111
|
+
* 1. Command proxy is created to wrap the incoming request
|
|
112
|
+
* 2. Event manager is instantiated with service and override options
|
|
113
|
+
* 3. Cancellation mechanisms are configured (abort signal + service cancellation)
|
|
114
|
+
* 4. State accessor is bound to the event manager
|
|
115
|
+
* 5. Complete context is registered with the context manager
|
|
116
|
+
*
|
|
117
|
+
* **Cancellation Handling:**
|
|
118
|
+
* The context provides multiple cancellation mechanisms:
|
|
119
|
+
* - AbortSignal for standard cancellation patterns
|
|
120
|
+
* - Service-level cancellation tracking
|
|
121
|
+
* - Combined cancellation status through isCancelled()
|
|
122
|
+
*
|
|
123
|
+
* **Event Management:**
|
|
124
|
+
* The context includes an event manager that handles:
|
|
125
|
+
* - Execution lifecycle events (start, update, complete, error)
|
|
126
|
+
* - State transitions and persistence
|
|
127
|
+
* - Custom event handling through overrides
|
|
128
|
+
*
|
|
129
|
+
* @public
|
|
130
|
+
* @since 0.5.6
|
|
131
|
+
*/
|
|
132
|
+
export declare function createContext<TCommand extends Command = Command, TState extends State = State, TUpdate extends Update = Update>(request: TCommand, service: A2AServiceInterface<TCommand, TState, TUpdate>, contextManager: ContextManagerInterface<TCommand, TState, TUpdate>, abortSignal?: AbortSignal, contextId?: string, eventOverrides?: EventManagerOptions<TCommand, TState, TUpdate>): Context<TCommand, TState, TUpdate>;
|
|
133
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../../src/services/a2a/factory/context.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,OAAO,EACP,4BAA4B,EAC5B,KAAK,EACL,MAAM,EACN,OAAO,EACP,mBAAmB,EACnB,uBAAuB,EACvB,mBAAmB,EAEpB,gCAAyB;AAK1B;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,SAAS,OAAO,GAAG,OAAO,EACrE,OAAO,EAAE,QAAQ,GAChB,4BAA4B,CAAC,QAAQ,CAAC,CAExC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqFG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,SAAS,OAAO,GAAG,OAAO,EAClC,MAAM,SAAS,KAAK,GAAG,KAAK,EAC5B,OAAO,SAAS,MAAM,GAAG,MAAM,EAE/B,OAAO,EAAE,QAAQ,EACjB,OAAO,EAAE,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EACvD,cAAc,EAAE,uBAAuB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAClE,WAAW,GAAE,WAA0C,EACvD,SAAS,GAAE,MAAiB,EAC5B,cAAc,CAAC,EAAE,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,GAC9D,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,CA8BpC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 The Artinet Project
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @fileoverview A2A Event Manager Factory
|
|
7
|
+
*
|
|
8
|
+
* This module provides factory functions for creating A2A-specific event managers
|
|
9
|
+
* that handle the complete lifecycle of agent-to-agent communication tasks.
|
|
10
|
+
* It integrates with the core event management system while providing A2A-specific
|
|
11
|
+
* behavior for state management, task tracking, and error handling.
|
|
12
|
+
*
|
|
13
|
+
* @module A2AEventFactory
|
|
14
|
+
* @version 0.5.7
|
|
15
|
+
* @since 0.5.6
|
|
16
|
+
* @author The Artinet Project
|
|
17
|
+
*/
|
|
18
|
+
import { EventManager } from "../../core/managers/event.js";
|
|
19
|
+
import { Command, State, Update, A2AServiceInterface, EventManagerOptions } from "../../../types/index.js";
|
|
20
|
+
/**
|
|
21
|
+
* Creates an A2A-specific event manager with integrated task and state management.
|
|
22
|
+
*
|
|
23
|
+
* This factory function creates an event manager tailored for A2A operations,
|
|
24
|
+
* providing comprehensive lifecycle management for agent-to-agent communication
|
|
25
|
+
* tasks. It handles state persistence, task tracking, error scenarios, and
|
|
26
|
+
* cancellation while integrating with the broader A2A service framework.
|
|
27
|
+
*
|
|
28
|
+
* @template TCommand - The command type, must extend Command
|
|
29
|
+
* @template TState - The state type, must extend State
|
|
30
|
+
* @template TUpdate - The update type, must extend Update
|
|
31
|
+
*
|
|
32
|
+
* @param service - The A2A service instance for state and connection management
|
|
33
|
+
* @param id - Optional context ID (generates UUID if not provided)
|
|
34
|
+
* @param eventOverrides - Optional event handling overrides
|
|
35
|
+
* @returns Configured EventManager instance for A2A operations
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```typescript
|
|
39
|
+
* const eventManager = createEventManager(
|
|
40
|
+
* a2aService,
|
|
41
|
+
* 'context-123',
|
|
42
|
+
* {
|
|
43
|
+
* onStart: async (context) => {
|
|
44
|
+
* console.log('A2A task starting');
|
|
45
|
+
* return await initializeA2AState(context);
|
|
46
|
+
* },
|
|
47
|
+
* onComplete: async (finalState) => {
|
|
48
|
+
* console.log('A2A task completed');
|
|
49
|
+
* await notifyCompletion(finalState);
|
|
50
|
+
* }
|
|
51
|
+
* }
|
|
52
|
+
* );
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* @public
|
|
56
|
+
* @since 0.5.6
|
|
57
|
+
*/
|
|
58
|
+
export declare function createEventManager<TCommand extends Command = Command, TState extends State = State, TUpdate extends Update = Update>(service: A2AServiceInterface<TCommand, TState, TUpdate>, id?: string, eventOverrides?: EventManagerOptions<TCommand, TState, TUpdate>): EventManager<TCommand, TState, TUpdate>;
|
|
59
|
+
//# sourceMappingURL=event.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../../../../../src/services/a2a/factory/event.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,YAAY,EAAE,qCAA0C;AACjE,OAAO,EACL,OAAO,EACP,KAAK,EACL,MAAM,EACN,mBAAmB,EACnB,mBAAmB,EAOpB,gCAAyB;AAW1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,SAAS,OAAO,GAAG,OAAO,EAClC,MAAM,SAAS,KAAK,GAAG,KAAK,EAC5B,OAAO,SAAS,MAAM,GAAG,MAAM,EAE/B,OAAO,EAAE,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EACvD,EAAE,CAAC,EAAE,MAAM,EACX,cAAc,CAAC,EAAE,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,GAC9D,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,CA+JzC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/services/a2a/factory/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 The Artinet Project
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
import { MethodOptions } from "../../../types/index.js";
|
|
6
|
+
export declare function createMethods(methods?: Partial<MethodOptions>): MethodOptions;
|
|
7
|
+
//# sourceMappingURL=method.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"method.d.ts","sourceRoot":"","sources":["../../../../../src/services/a2a/factory/method.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,gCAAyB;AASjD,wBAAgB,aAAa,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,aAAa,CAQ7E"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 The Artinet Project
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
import { FactoryParams } from "../../../types/index.js";
|
|
6
|
+
import { A2AService } from "../service.js";
|
|
7
|
+
export declare function createService(params: FactoryParams): A2AService;
|
|
8
|
+
export declare const createAgent: typeof createService;
|
|
9
|
+
export type AgentImpl = ReturnType<typeof createAgent>;
|
|
10
|
+
//# sourceMappingURL=service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../../../src/services/a2a/factory/service.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAA0B,gCAAyB;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAS3C,wBAAgB,aAAa,CAAC,MAAM,EAAE,aAAa,cAWlD;AACD,eAAO,MAAM,WAAW,sBAAgB,CAAC;AACzC,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/services/a2a/helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 The Artinet Project
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
import { Part, TextPart, FilePart, DataPart, Message } from "../../../types/schemas/a2a/index.js";
|
|
6
|
+
/**
|
|
7
|
+
* Extracts and aggregates the text, file, and data contents from an array of Part objects.
|
|
8
|
+
*
|
|
9
|
+
* @param parts - An array of Part objects, which may include text, file, or data kinds.
|
|
10
|
+
* @returns An object containing:
|
|
11
|
+
* - text: Concatenated string of all text parts.
|
|
12
|
+
* - file: Array of file contents from file parts.
|
|
13
|
+
* - data: Array of data contents from data parts.
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* This utility is used to normalize and access the payloads of message parts
|
|
17
|
+
* in a structured way for downstream processing.
|
|
18
|
+
*/
|
|
19
|
+
export declare const getParts: (parts: Part[]) => {
|
|
20
|
+
text: TextPart["text"];
|
|
21
|
+
file: FilePart["file"][];
|
|
22
|
+
data: DataPart["data"][];
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Extracts and aggregates the text, file, and data payloads from a Message's parts array.
|
|
26
|
+
*
|
|
27
|
+
* @param message - The Message object containing an array of Part objects (text, file, or data).
|
|
28
|
+
* @returns An object with the following properties:
|
|
29
|
+
* - text: A single string containing the concatenated text from all text parts.
|
|
30
|
+
* - file: An array of file payloads from all file parts.
|
|
31
|
+
* - data: An array of data payloads from all data parts.
|
|
32
|
+
*
|
|
33
|
+
* @remarks
|
|
34
|
+
* This utility function is intended to simplify downstream processing by normalizing
|
|
35
|
+
* the payloads of a Message's parts into a structured object. It is especially useful
|
|
36
|
+
* when handling user input or agent responses that may include multiple content types.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* const payload = getPayload(message);
|
|
40
|
+
* console.log(payload.text); // "Hello world"
|
|
41
|
+
* console.log(payload.file); // [<file1>, <file2>]
|
|
42
|
+
* console.log(payload.data); // [<data1>, <data2>]
|
|
43
|
+
*/
|
|
44
|
+
export declare const getPayload: (message: Message) => {
|
|
45
|
+
text: TextPart["text"];
|
|
46
|
+
file: FilePart["file"][];
|
|
47
|
+
data: DataPart["data"][];
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=part.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"part.d.ts","sourceRoot":"","sources":["../../../../../src/services/a2a/helpers/part.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACL,IAAI,EACJ,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,OAAO,EACR,4CAAqC;AACtC;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,QAAQ,GACnB,OAAO,IAAI,EAAE,KACZ;IACD,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IACvB,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;IACzB,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;CAU1B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,UAAU,GACrB,SAAS,OAAO,KACf;IACD,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IACvB,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;IACzB,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;CAG1B,CAAC"}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
export * from "./
|
|
1
|
+
export * from "./factory/index.js";
|
|
2
|
+
export * from "./helpers/index.js";
|
|
3
|
+
export * from "./managers/index.js";
|
|
4
|
+
export * from "./methods/index.js";
|
|
5
|
+
export * from "./state/index.js";
|
|
2
6
|
export * from "./service.js";
|
|
3
7
|
//# sourceMappingURL=index.d.ts.map
|