@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,329 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 The Artinet Project
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @fileoverview Core Event Manager Interface Definitions
|
|
7
|
+
*
|
|
8
|
+
* This module defines interfaces for managing events throughout the execution lifecycle
|
|
9
|
+
* of core services. It provides type-safe event handling, lifecycle management, and
|
|
10
|
+
* state transitions for command execution contexts.
|
|
11
|
+
*
|
|
12
|
+
* @module CoreEventManager
|
|
13
|
+
* @version 0.5.7
|
|
14
|
+
* @since 0.5.6
|
|
15
|
+
* @author The Artinet Project
|
|
16
|
+
*/
|
|
17
|
+
import { EventEmitter } from "events";
|
|
18
|
+
import { CoreCommand, CoreState, CoreUpdate, CoreContext } from "../context/index.js";
|
|
19
|
+
/**
|
|
20
|
+
* Configuration options for EventManager lifecycle callbacks.
|
|
21
|
+
*
|
|
22
|
+
* This interface defines optional callback functions that are invoked during
|
|
23
|
+
* different phases of command execution, providing hooks for custom logic
|
|
24
|
+
* and state management throughout the execution lifecycle.
|
|
25
|
+
*
|
|
26
|
+
* @template TCommand - The command type, must extend CoreCommand
|
|
27
|
+
* @template TState - The state type, must extend CoreState
|
|
28
|
+
* @template TUpdate - The update type, must extend CoreUpdate
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* const eventOptions: EventManagerOptions<MyCommand, MyState, MyUpdate> = {
|
|
33
|
+
* onStart: async (context) => {
|
|
34
|
+
* console.log('Execution started for context:', context.contextId);
|
|
35
|
+
* return initialState;
|
|
36
|
+
* },
|
|
37
|
+
* onUpdate: async (current, update) => {
|
|
38
|
+
* console.log('Processing update:', update);
|
|
39
|
+
* return { ...current, lastUpdate: update };
|
|
40
|
+
* },
|
|
41
|
+
* onComplete: async (finalState) => {
|
|
42
|
+
* console.log('Execution completed successfully');
|
|
43
|
+
* }
|
|
44
|
+
* };
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* @public
|
|
48
|
+
* @since 0.5.6
|
|
49
|
+
*/
|
|
50
|
+
export interface EventManagerOptions<TCommand extends CoreCommand = CoreCommand, TState extends CoreState = CoreState, TUpdate extends CoreUpdate = CoreUpdate> {
|
|
51
|
+
/**
|
|
52
|
+
* Called when execution starts for a new context.
|
|
53
|
+
*
|
|
54
|
+
* This callback is invoked at the beginning of command execution,
|
|
55
|
+
* allowing for initialization of state and setup of execution context.
|
|
56
|
+
*
|
|
57
|
+
* @param context - The execution context containing command and environment data
|
|
58
|
+
* @returns Promise resolving to the initial state for this execution
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```typescript
|
|
62
|
+
* onStart: async (context) => {
|
|
63
|
+
* const userId = context.command.metadata?.userId;
|
|
64
|
+
* return {
|
|
65
|
+
* userId,
|
|
66
|
+
* startTime: new Date(),
|
|
67
|
+
* status: 'initializing'
|
|
68
|
+
* };
|
|
69
|
+
* }
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
readonly onStart?: (context: CoreContext<TCommand, TState, TUpdate>) => Promise<TState>;
|
|
73
|
+
/**
|
|
74
|
+
* Called when execution is cancelled.
|
|
75
|
+
*
|
|
76
|
+
* This callback handles cleanup and state updates when an execution
|
|
77
|
+
* is cancelled before completion, ensuring proper resource cleanup.
|
|
78
|
+
*
|
|
79
|
+
* @param current - The current state at the time of cancellation
|
|
80
|
+
* @param update - The update that triggered the cancellation
|
|
81
|
+
* @returns Promise that resolves when cancellation handling is complete
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```typescript
|
|
85
|
+
* onCancel: async (current, update) => {
|
|
86
|
+
* await cleanupResources(current.resourceIds);
|
|
87
|
+
* await logCancellation(current.userId, update.reason);
|
|
88
|
+
* }
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
readonly onCancel?: (current: TState, update: TUpdate) => Promise<void>;
|
|
92
|
+
/**
|
|
93
|
+
* Called for each update during execution.
|
|
94
|
+
*
|
|
95
|
+
* This is the primary callback for processing updates and evolving state
|
|
96
|
+
* throughout the execution lifecycle. It receives the current state and
|
|
97
|
+
* an update, returning the new state.
|
|
98
|
+
*
|
|
99
|
+
* @param current - The current state before applying the update
|
|
100
|
+
* @param update - The update to be processed
|
|
101
|
+
* @returns Promise resolving to the new state after applying the update
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* ```typescript
|
|
105
|
+
* onUpdate: async (current, update) => {
|
|
106
|
+
* switch (update.type) {
|
|
107
|
+
* case 'progress':
|
|
108
|
+
* return { ...current, progress: update.progress };
|
|
109
|
+
* case 'data':
|
|
110
|
+
* return { ...current, data: [...current.data, update.data] };
|
|
111
|
+
* default:
|
|
112
|
+
* return current;
|
|
113
|
+
* }
|
|
114
|
+
* }
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
readonly onUpdate?: (current: TState, update: TUpdate) => Promise<TState>;
|
|
118
|
+
/**
|
|
119
|
+
* Called when an error occurs during execution.
|
|
120
|
+
*
|
|
121
|
+
* This callback handles error scenarios, allowing for custom error processing,
|
|
122
|
+
* logging, and recovery strategies.
|
|
123
|
+
*
|
|
124
|
+
* @param current - The current state when the error occurred
|
|
125
|
+
* @param error - The error that occurred (can be any type)
|
|
126
|
+
* @returns Promise that resolves when error handling is complete
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* ```typescript
|
|
130
|
+
* onError: async (current, error) => {
|
|
131
|
+
* console.error('Execution error:', error);
|
|
132
|
+
* await notifyAdministrators(error, current);
|
|
133
|
+
* await saveErrorLog(current.contextId, error);
|
|
134
|
+
* }
|
|
135
|
+
* ```
|
|
136
|
+
*/
|
|
137
|
+
readonly onError?: (current: TState, error: any) => Promise<void>;
|
|
138
|
+
/**
|
|
139
|
+
* Called when execution completes successfully.
|
|
140
|
+
*
|
|
141
|
+
* This callback is invoked upon successful completion of command execution,
|
|
142
|
+
* allowing for cleanup, final state processing, and completion notifications.
|
|
143
|
+
*
|
|
144
|
+
* @param current - The final state after successful completion
|
|
145
|
+
* @returns Promise that resolves when completion handling is done
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* ```typescript
|
|
149
|
+
* onComplete: async (finalState) => {
|
|
150
|
+
* await saveResults(finalState.results);
|
|
151
|
+
* await notifyCompletion(finalState.userId);
|
|
152
|
+
* await cleanupTemporaryResources();
|
|
153
|
+
* }
|
|
154
|
+
* ```
|
|
155
|
+
*/
|
|
156
|
+
readonly onComplete?: (current: TState) => Promise<void>;
|
|
157
|
+
/**
|
|
158
|
+
* Optional state getter function.
|
|
159
|
+
*
|
|
160
|
+
* @deprecated This property may be removed in future versions.
|
|
161
|
+
* Use the EventManagerInterface.getState method instead.
|
|
162
|
+
*
|
|
163
|
+
* @returns The current state
|
|
164
|
+
*/
|
|
165
|
+
readonly getState?: () => TState;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Event map defining the structure of events emitted by EventManager.
|
|
169
|
+
*
|
|
170
|
+
* This interface maps event names to their corresponding argument tuples,
|
|
171
|
+
* providing type safety for event emission and subscription.
|
|
172
|
+
*
|
|
173
|
+
* @template TCommand - The command type, must extend CoreCommand
|
|
174
|
+
* @template TState - The state type, must extend CoreState
|
|
175
|
+
* @template TUpdate - The update type, must extend CoreUpdate
|
|
176
|
+
*
|
|
177
|
+
* @example
|
|
178
|
+
* ```typescript
|
|
179
|
+
* // Event manager will emit these events with the specified argument types
|
|
180
|
+
* eventManager.on('start', (command: TCommand, state: TState) => {
|
|
181
|
+
* console.log('Execution started');
|
|
182
|
+
* });
|
|
183
|
+
*
|
|
184
|
+
* eventManager.on('update', (state: TState, update: TUpdate) => {
|
|
185
|
+
* console.log('State updated');
|
|
186
|
+
* });
|
|
187
|
+
* ```
|
|
188
|
+
*
|
|
189
|
+
* @public
|
|
190
|
+
* @since 0.5.6
|
|
191
|
+
*/
|
|
192
|
+
export interface EventManagerMap<TCommand extends CoreCommand = CoreCommand, TState extends CoreState = CoreState, TUpdate extends CoreUpdate = CoreUpdate> {
|
|
193
|
+
/** Emitted when execution starts - [command, initialState] */
|
|
194
|
+
start: [TCommand, TState];
|
|
195
|
+
/** Emitted when execution is cancelled - [cancelUpdate] */
|
|
196
|
+
cancel: [TUpdate];
|
|
197
|
+
/** Emitted when state is updated - [currentState, update] */
|
|
198
|
+
update: [TState, TUpdate];
|
|
199
|
+
/** Emitted when an error occurs - [error, currentState] */
|
|
200
|
+
error: [any, TState];
|
|
201
|
+
/** Emitted when execution completes - [finalState] */
|
|
202
|
+
complete: [TState];
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Main interface for EventManager implementations.
|
|
206
|
+
*
|
|
207
|
+
* This interface extends EventEmitter to provide typed event handling
|
|
208
|
+
* and defines the contract for managing execution lifecycle events.
|
|
209
|
+
* Implementations must handle state transitions, error scenarios, and
|
|
210
|
+
* provide access to current execution state.
|
|
211
|
+
*
|
|
212
|
+
* @template TCommand - The command type, must extend CoreCommand
|
|
213
|
+
* @template TState - The state type, must extend CoreState
|
|
214
|
+
* @template TUpdate - The update type, must extend CoreUpdate
|
|
215
|
+
*
|
|
216
|
+
* @example
|
|
217
|
+
* ```typescript
|
|
218
|
+
* class MyEventManager implements EventManagerInterface<MyCommand, MyState, MyUpdate> {
|
|
219
|
+
* constructor(
|
|
220
|
+
* public readonly contextId: string,
|
|
221
|
+
* private options: EventManagerOptions<MyCommand, MyState, MyUpdate>
|
|
222
|
+
* ) {
|
|
223
|
+
* super();
|
|
224
|
+
* }
|
|
225
|
+
*
|
|
226
|
+
* async onUpdate(update: MyUpdate): Promise<MyState> {
|
|
227
|
+
* const current = this.getState();
|
|
228
|
+
* const newState = await this.options.onUpdate?.(current, update) ?? current;
|
|
229
|
+
* this.emit('update', newState, update);
|
|
230
|
+
* return newState;
|
|
231
|
+
* }
|
|
232
|
+
*
|
|
233
|
+
* // ... other method implementations
|
|
234
|
+
* }
|
|
235
|
+
* ```
|
|
236
|
+
*
|
|
237
|
+
* @public
|
|
238
|
+
* @since 0.5.6
|
|
239
|
+
*/
|
|
240
|
+
export interface EventManagerInterface<TCommand extends CoreCommand = CoreCommand, TState extends CoreState = CoreState, TUpdate extends CoreUpdate = CoreUpdate> extends EventEmitter<EventManagerMap<TCommand, TState, TUpdate>> {
|
|
241
|
+
/**
|
|
242
|
+
* Unique identifier for this execution context.
|
|
243
|
+
*
|
|
244
|
+
* This ID is used to track and manage the specific execution instance
|
|
245
|
+
* throughout its lifecycle.
|
|
246
|
+
*/
|
|
247
|
+
readonly contextId: string;
|
|
248
|
+
/**
|
|
249
|
+
* Optional callback for handling execution start.
|
|
250
|
+
*
|
|
251
|
+
* When present, this function is called to initialize state for a new execution.
|
|
252
|
+
*
|
|
253
|
+
* @param context - The execution context
|
|
254
|
+
* @returns Promise resolving to initial state
|
|
255
|
+
*/
|
|
256
|
+
readonly onStart?: (context: CoreContext<TCommand, TState, TUpdate>) => Promise<TState>;
|
|
257
|
+
/**
|
|
258
|
+
* Handles execution cancellation.
|
|
259
|
+
*
|
|
260
|
+
* This method processes cancellation requests and performs necessary cleanup.
|
|
261
|
+
*
|
|
262
|
+
* @param update - The update that triggered cancellation
|
|
263
|
+
* @returns Promise that resolves when cancellation is complete
|
|
264
|
+
*
|
|
265
|
+
* @example
|
|
266
|
+
* ```typescript
|
|
267
|
+
* await eventManager.onCancel(cancellationUpdate);
|
|
268
|
+
* ```
|
|
269
|
+
*/
|
|
270
|
+
readonly onCancel: (update: TUpdate) => Promise<void>;
|
|
271
|
+
/**
|
|
272
|
+
* Processes state updates during execution.
|
|
273
|
+
*
|
|
274
|
+
* This is the primary method for handling state evolution throughout
|
|
275
|
+
* the execution lifecycle.
|
|
276
|
+
*
|
|
277
|
+
* @param update - The update to process
|
|
278
|
+
* @returns Promise resolving to the new state
|
|
279
|
+
*
|
|
280
|
+
* @example
|
|
281
|
+
* ```typescript
|
|
282
|
+
* const newState = await eventManager.onUpdate(progressUpdate);
|
|
283
|
+
* ```
|
|
284
|
+
*/
|
|
285
|
+
readonly onUpdate: (update: TUpdate) => Promise<TState>;
|
|
286
|
+
/**
|
|
287
|
+
* Handles errors that occur during execution.
|
|
288
|
+
*
|
|
289
|
+
* This method processes error scenarios and performs error recovery logic.
|
|
290
|
+
*
|
|
291
|
+
* @param error - The error that occurred
|
|
292
|
+
* @returns Promise that resolves when error handling is complete
|
|
293
|
+
*
|
|
294
|
+
* @example
|
|
295
|
+
* ```typescript
|
|
296
|
+
* await eventManager.onError(new Error('Something went wrong'));
|
|
297
|
+
* ```
|
|
298
|
+
*/
|
|
299
|
+
readonly onError: (error: any) => Promise<void>;
|
|
300
|
+
/**
|
|
301
|
+
* Handles successful completion of execution.
|
|
302
|
+
*
|
|
303
|
+
* This method is called when execution completes successfully and
|
|
304
|
+
* performs final cleanup and notification tasks.
|
|
305
|
+
*
|
|
306
|
+
* @returns Promise that resolves when completion handling is done
|
|
307
|
+
*
|
|
308
|
+
* @example
|
|
309
|
+
* ```typescript
|
|
310
|
+
* await eventManager.onComplete();
|
|
311
|
+
* ```
|
|
312
|
+
*/
|
|
313
|
+
onComplete: () => Promise<void>;
|
|
314
|
+
/**
|
|
315
|
+
* Gets the current execution state.
|
|
316
|
+
*
|
|
317
|
+
* @deprecated This method may be removed in future versions.
|
|
318
|
+
* Consider using state management through the context instead.
|
|
319
|
+
*
|
|
320
|
+
* @returns The current state
|
|
321
|
+
*
|
|
322
|
+
* @example
|
|
323
|
+
* ```typescript
|
|
324
|
+
* const currentState = eventManager.getState();
|
|
325
|
+
* ```
|
|
326
|
+
*/
|
|
327
|
+
readonly getState: () => TState;
|
|
328
|
+
}
|
|
329
|
+
//# sourceMappingURL=event.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../../../../../../../src/types/interfaces/services/core/managers/event.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EACL,WAAW,EACX,SAAS,EACT,UAAU,EACV,WAAW,EACZ,MAAM,qBAAqB,CAAC;AAE7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,WAAW,mBAAmB,CAClC,QAAQ,SAAS,WAAW,GAAG,WAAW,EAC1C,MAAM,SAAS,SAAS,GAAG,SAAS,EACpC,OAAO,SAAS,UAAU,GAAG,UAAU;IAEvC;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,CACjB,OAAO,EAAE,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,KAC5C,OAAO,CAAC,MAAM,CAAC,CAAC;IAErB;;;;;;;;;;;;;;;;;OAiBG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAExE;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAE1E;;;;;;;;;;;;;;;;;;OAkBG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAElE;;;;;;;;;;;;;;;;;OAiBG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzD;;;;;;;OAOG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,MAAM,CAAC;CAClC;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,WAAW,eAAe,CAC9B,QAAQ,SAAS,WAAW,GAAG,WAAW,EAC1C,MAAM,SAAS,SAAS,GAAG,SAAS,EACpC,OAAO,SAAS,UAAU,GAAG,UAAU;IAEvC,8DAA8D;IAC9D,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC1B,2DAA2D;IAC3D,MAAM,EAAE,CAAC,OAAO,CAAC,CAAC;IAClB,6DAA6D;IAC7D,MAAM,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1B,2DAA2D;IAC3D,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IACrB,sDAAsD;IACtD,QAAQ,EAAE,CAAC,MAAM,CAAC,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,WAAW,qBAAqB,CACpC,QAAQ,SAAS,WAAW,GAAG,WAAW,EAC1C,MAAM,SAAS,SAAS,GAAG,SAAS,EACpC,OAAO,SAAS,UAAU,GAAG,UAAU,CACvC,SAAQ,YAAY,CAAC,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IAChE;;;;;OAKG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAE3B;;;;;;;OAOG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,CACjB,OAAO,EAAE,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,KAC5C,OAAO,CAAC,MAAM,CAAC,CAAC;IAErB;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtD;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAExD;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAEhD;;;;;;;;;;;;OAYG;IACH,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAEhC;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,MAAM,CAAC;CACjC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/types/interfaces/services/core/managers/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 The Artinet Project
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @fileoverview Core Stream Manager Interface Definition
|
|
7
|
+
*
|
|
8
|
+
* This module defines the interface for managing execution streams in the core service
|
|
9
|
+
* framework. It provides functionality for handling async execution, update collection,
|
|
10
|
+
* and streaming results from execution engines to consumers.
|
|
11
|
+
*
|
|
12
|
+
* @module CoreStreamManager
|
|
13
|
+
* @version 0.5.7
|
|
14
|
+
* @since 0.5.6
|
|
15
|
+
* @author The Artinet Project
|
|
16
|
+
*/
|
|
17
|
+
import { CoreCommand, CoreState, CoreUpdate } from "../../../../index.js";
|
|
18
|
+
import { CoreContext } from "../context/index.js";
|
|
19
|
+
import { ExecutionEngine } from "../execution/index.js";
|
|
20
|
+
import { ServiceInterface } from "../service.js";
|
|
21
|
+
/**
|
|
22
|
+
* Interface for managing execution streams and update collection.
|
|
23
|
+
*
|
|
24
|
+
* The StreamManager is responsible for coordinating the execution of commands
|
|
25
|
+
* through execution engines, collecting updates as they are produced, and
|
|
26
|
+
* providing a streaming interface for consumers to receive real-time updates.
|
|
27
|
+
*
|
|
28
|
+
* This interface supports both push-based update collection and pull-based
|
|
29
|
+
* streaming, making it suitable for various execution patterns including
|
|
30
|
+
* long-running tasks, batch operations, and real-time processing.
|
|
31
|
+
*
|
|
32
|
+
* @template TCommand - The command type, must extend CoreCommand
|
|
33
|
+
* @template TState - The state type, must extend CoreState
|
|
34
|
+
* @template TUpdate - The update type, must extend CoreUpdate
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```typescript
|
|
38
|
+
* class MyStreamManager implements StreamManagerInterface<MyCommand, MyState, MyUpdate> {
|
|
39
|
+
* private updates: MyUpdate[] = [];
|
|
40
|
+
* private completed = false;
|
|
41
|
+
*
|
|
42
|
+
* constructor(
|
|
43
|
+
* private contextId: string,
|
|
44
|
+
* private context: CoreContext<MyCommand, MyState, MyUpdate>
|
|
45
|
+
* ) {}
|
|
46
|
+
*
|
|
47
|
+
* async *stream(engine: ExecutionEngine<MyCommand, MyState, MyUpdate>) {
|
|
48
|
+
* for await (const update of engine(this.context)) {
|
|
49
|
+
* this.addUpdate(update);
|
|
50
|
+
* yield update;
|
|
51
|
+
* }
|
|
52
|
+
* this.setCompleted();
|
|
53
|
+
* }
|
|
54
|
+
*
|
|
55
|
+
* // ... implement other interface methods
|
|
56
|
+
* }
|
|
57
|
+
* ```
|
|
58
|
+
*
|
|
59
|
+
* @public
|
|
60
|
+
* @since 0.5.6
|
|
61
|
+
*/
|
|
62
|
+
export interface StreamManagerInterface<TCommand extends CoreCommand = CoreCommand, TState extends CoreState = CoreState, TUpdate extends CoreUpdate = CoreUpdate> {
|
|
63
|
+
/**
|
|
64
|
+
* Gets the unique identifier for the execution context.
|
|
65
|
+
*
|
|
66
|
+
* This ID is used to track and correlate updates with their specific
|
|
67
|
+
* execution instance across the system.
|
|
68
|
+
*
|
|
69
|
+
* @returns The context ID string
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```typescript
|
|
73
|
+
* const contextId = streamManager.getContextId();
|
|
74
|
+
* console.log(`Processing execution: ${contextId}`);
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
getContextId(): string;
|
|
78
|
+
/**
|
|
79
|
+
* Adds an update to the internal update collection.
|
|
80
|
+
*
|
|
81
|
+
* This method is typically called by execution engines or other
|
|
82
|
+
* components to record updates as they occur during execution.
|
|
83
|
+
* Updates are stored in order and can be retrieved later.
|
|
84
|
+
*
|
|
85
|
+
* @param update - The update to add to the collection
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```typescript
|
|
89
|
+
* const progressUpdate: MyUpdate = {
|
|
90
|
+
* type: 'progress',
|
|
91
|
+
* progress: 0.5,
|
|
92
|
+
* message: 'Halfway complete'
|
|
93
|
+
* };
|
|
94
|
+
* streamManager.addUpdate(progressUpdate);
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
addUpdate(update: TUpdate): void;
|
|
98
|
+
/**
|
|
99
|
+
* Retrieves all updates that have been collected so far.
|
|
100
|
+
*
|
|
101
|
+
* Returns a copy of the internal update collection, providing
|
|
102
|
+
* access to the complete execution history up to this point.
|
|
103
|
+
*
|
|
104
|
+
* @returns Array of all collected updates in chronological order
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```typescript
|
|
108
|
+
* const allUpdates = streamManager.getUpdates();
|
|
109
|
+
* console.log(`Collected ${allUpdates.length} updates so far`);
|
|
110
|
+
*
|
|
111
|
+
* // Process updates
|
|
112
|
+
* for (const update of allUpdates) {
|
|
113
|
+
* processUpdate(update);
|
|
114
|
+
* }
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
getUpdates(): TUpdate[];
|
|
118
|
+
/**
|
|
119
|
+
* Checks whether the execution has completed.
|
|
120
|
+
*
|
|
121
|
+
* This flag indicates whether the execution engine has finished
|
|
122
|
+
* processing and no more updates will be produced.
|
|
123
|
+
*
|
|
124
|
+
* @returns True if execution is complete, false if still running
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* ```typescript
|
|
128
|
+
* if (streamManager.isCompleted()) {
|
|
129
|
+
* console.log('Execution finished');
|
|
130
|
+
* finalizeResults(streamManager.getUpdates());
|
|
131
|
+
* } else {
|
|
132
|
+
* console.log('Execution still in progress...');
|
|
133
|
+
* }
|
|
134
|
+
* ```
|
|
135
|
+
*/
|
|
136
|
+
isCompleted(): boolean;
|
|
137
|
+
/**
|
|
138
|
+
* Marks the execution as completed.
|
|
139
|
+
*
|
|
140
|
+
* This method is called when the execution engine has finished
|
|
141
|
+
* processing, indicating that no more updates will be produced.
|
|
142
|
+
* It triggers any completion-related cleanup or finalization.
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* ```typescript
|
|
146
|
+
* // Called by execution engine when done
|
|
147
|
+
* await executeTask();
|
|
148
|
+
* streamManager.setCompleted();
|
|
149
|
+
* ```
|
|
150
|
+
*/
|
|
151
|
+
setCompleted(): void;
|
|
152
|
+
/**
|
|
153
|
+
* Gets the current execution context.
|
|
154
|
+
*
|
|
155
|
+
* Returns the context object that contains command, state, and
|
|
156
|
+
* execution environment information for this stream.
|
|
157
|
+
*
|
|
158
|
+
* @returns The execution context
|
|
159
|
+
*
|
|
160
|
+
* @example
|
|
161
|
+
* ```typescript
|
|
162
|
+
* const context = streamManager.getExecutionContext();
|
|
163
|
+
* const command = context.command;
|
|
164
|
+
* const currentState = context.State();
|
|
165
|
+
* ```
|
|
166
|
+
*/
|
|
167
|
+
getExecutionContext(): CoreContext<TCommand, TState, TUpdate>;
|
|
168
|
+
/**
|
|
169
|
+
* Sets or updates the execution context.
|
|
170
|
+
*
|
|
171
|
+
* This method allows updating the context during execution,
|
|
172
|
+
* which may be necessary for dynamic execution scenarios.
|
|
173
|
+
*
|
|
174
|
+
* @param executionContext - The new execution context to set
|
|
175
|
+
*
|
|
176
|
+
* @example
|
|
177
|
+
* ```typescript
|
|
178
|
+
* const updatedContext = createNewContext(command, newState);
|
|
179
|
+
* streamManager.setExecutionContext(updatedContext);
|
|
180
|
+
* ```
|
|
181
|
+
*/
|
|
182
|
+
setExecutionContext(executionContext: CoreContext<TCommand, TState, TUpdate>): void;
|
|
183
|
+
/**
|
|
184
|
+
* Creates an async generator stream for real-time update consumption.
|
|
185
|
+
*
|
|
186
|
+
* This is the primary method for executing commands and streaming results.
|
|
187
|
+
* It runs the provided execution engine with the current context and
|
|
188
|
+
* yields updates as they are produced, providing a real-time stream
|
|
189
|
+
* of execution progress.
|
|
190
|
+
*
|
|
191
|
+
* @param engine - The execution engine to run
|
|
192
|
+
* @param service - Optional service interface for additional functionality
|
|
193
|
+
* @returns AsyncGenerator that yields updates as they occur
|
|
194
|
+
*
|
|
195
|
+
* @example
|
|
196
|
+
* ```typescript
|
|
197
|
+
* // Basic streaming
|
|
198
|
+
* for await (const update of streamManager.stream(myEngine)) {
|
|
199
|
+
* console.log('Received update:', update);
|
|
200
|
+
* await processUpdate(update);
|
|
201
|
+
* }
|
|
202
|
+
*
|
|
203
|
+
* // With service integration
|
|
204
|
+
* const service = createMyService();
|
|
205
|
+
* for await (const update of streamManager.stream(myEngine, service)) {
|
|
206
|
+
* await service.handleUpdate(update);
|
|
207
|
+
* yield update; // Re-yield to downstream consumers
|
|
208
|
+
* }
|
|
209
|
+
* ```
|
|
210
|
+
*
|
|
211
|
+
* @remarks
|
|
212
|
+
* The stream will continue yielding updates until the execution engine
|
|
213
|
+
* completes. The StreamManager automatically handles update collection
|
|
214
|
+
* and completion status during streaming.
|
|
215
|
+
*/
|
|
216
|
+
stream(engine: ExecutionEngine<TCommand, TState, TUpdate>, service?: ServiceInterface<TCommand, TState, TUpdate>): AsyncGenerator<TUpdate>;
|
|
217
|
+
}
|
|
218
|
+
//# sourceMappingURL=stream.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../../../../../../src/types/interfaces/services/core/managers/stream.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,6BAAyB;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,MAAM,WAAW,sBAAsB,CACrC,QAAQ,SAAS,WAAW,GAAG,WAAW,EAC1C,MAAM,SAAS,SAAS,GAAG,SAAS,EACpC,OAAO,SAAS,UAAU,GAAG,UAAU;IAEvC;;;;;;;;;;;;;OAaG;IACH,YAAY,IAAI,MAAM,CAAC;IAEvB;;;;;;;;;;;;;;;;;;OAkBG;IACH,SAAS,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IAEjC;;;;;;;;;;;;;;;;;;OAkBG;IACH,UAAU,IAAI,OAAO,EAAE,CAAC;IAExB;;;;;;;;;;;;;;;;;OAiBG;IACH,WAAW,IAAI,OAAO,CAAC;IAEvB;;;;;;;;;;;;;OAaG;IACH,YAAY,IAAI,IAAI,CAAC;IAErB;;;;;;;;;;;;;;OAcG;IACH,mBAAmB,IAAI,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IAE9D;;;;;;;;;;;;;OAaG;IACH,mBAAmB,CACjB,gBAAgB,EAAE,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,GACvD,IAAI,CAAC;IAER;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACH,MAAM,CACJ,MAAM,EAAE,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAClD,OAAO,CAAC,EAAE,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,GACpD,cAAc,CAAC,OAAO,CAAC,CAAC;CAC5B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 The Artinet Project
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
export interface TaskManagerInterface<TaskType extends {} = {}> {
|
|
6
|
+
getState(id: string): Promise<TaskType | undefined> | TaskType | undefined;
|
|
7
|
+
setState(id: string, data: TaskType): Promise<void> | void;
|
|
8
|
+
getStates(): Promise<string[]> | string[];
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=task.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task.d.ts","sourceRoot":"","sources":["../../../../../../../src/types/interfaces/services/core/managers/task.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,oBAAoB,CAAC,QAAQ,SAAS,EAAE,GAAG,EAAE;IAC5D,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC,GAAG,QAAQ,GAAG,SAAS,CAAC;IAC3E,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAC3D,SAAS,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC;CAC3C"}
|