@artinet/sdk 0.5.18 → 0.6.0-preview.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -617
- package/dist/browser/browser.d.ts +1 -1
- package/dist/browser/browser.js +1 -1
- package/dist/browser/client/a2a-client.d.ts +19 -18
- package/dist/browser/client/a2a-client.js +20 -8
- package/dist/browser/config/index.d.ts +158 -0
- package/dist/browser/config/index.js +155 -0
- package/dist/browser/config/observability.d.ts +119 -0
- package/dist/browser/config/observability.js +35 -0
- package/dist/browser/create/agentcard-builder.d.ts +47 -0
- package/dist/browser/create/agentcard-builder.js +65 -0
- package/dist/browser/create/base.d.ts +4 -0
- package/dist/browser/create/describe.d.ts +8 -0
- package/dist/browser/create/describe.js +8 -0
- package/dist/browser/create/message-builder.d.ts +78 -0
- package/dist/browser/create/message-builder.js +108 -0
- package/dist/browser/create/part-builder.d.ts +60 -0
- package/dist/browser/create/part-builder.js +81 -0
- package/dist/browser/create/task-builder.d.ts +251 -0
- package/dist/browser/create/task-builder.js +379 -0
- package/dist/browser/transport/rpc/parser.d.ts +2 -2
- package/dist/browser/transport/rpc/parser.js +7 -6
- package/dist/browser/transport/rpc/rpc-client.d.ts +5 -5
- package/dist/browser/transport/rpc/rpc-client.js +6 -6
- package/dist/browser/transport/streaming/event-stream.d.ts +3 -3
- package/dist/browser/transport/streaming/event-stream.js +11 -10
- package/dist/browser/types/a2a/a2a.d.ts +382 -0
- package/dist/browser/types/a2a/a2a.js +14 -0
- package/dist/browser/types/a2a/index.d.ts +5 -0
- package/dist/browser/types/a2a/index.js +1 -0
- package/dist/browser/types/{interfaces/client.d.ts → client.d.ts} +25 -27
- package/dist/browser/types/core/core.d.ts +31 -0
- package/dist/browser/types/core/index.d.ts +1 -0
- package/dist/browser/types/core/index.js +1 -0
- package/dist/browser/types/index.d.ts +6 -3
- package/dist/browser/types/index.js +6 -3
- package/dist/browser/types/mcp/index.d.ts +1 -0
- package/dist/browser/types/mcp/index.js +1 -0
- package/dist/{types/interfaces/services/mcp/service.d.ts → browser/types/mcp/mcp.d.ts} +4 -3
- package/dist/browser/types/{interfaces/services/a2a/builder.js → mcp/mcp.js} +1 -1
- package/dist/browser/types/storage.d.ts +21 -0
- package/dist/browser/utils/common/constants.d.ts +2 -7
- package/dist/browser/utils/common/constants.js +5 -32
- package/dist/browser/utils/common/errors.d.ts +74 -18
- package/dist/browser/utils/common/errors.js +81 -28
- package/dist/browser/utils/common/utils.d.ts +23 -0
- package/dist/browser/utils/common/utils.js +32 -0
- package/dist/client/a2a-client.d.ts +19 -18
- package/dist/client/a2a-client.js +20 -8
- package/dist/config/default.d.ts +50 -0
- package/dist/config/default.js +62 -0
- package/dist/config/index.d.ts +158 -0
- package/dist/config/index.js +155 -0
- package/dist/config/observability.d.ts +119 -0
- package/dist/config/observability.js +35 -0
- package/dist/create/agent-builder.d.ts +77 -0
- package/dist/create/agent-builder.js +20 -0
- package/dist/create/agentcard-builder.d.ts +47 -0
- package/dist/create/agentcard-builder.js +66 -0
- package/dist/create/base.d.ts +4 -0
- package/dist/create/base.js +1 -0
- package/dist/create/create.d.ts +762 -0
- package/dist/create/create.js +556 -0
- package/dist/create/describe.d.ts +8 -0
- package/dist/create/describe.js +8 -0
- package/dist/create/index.d.ts +4 -0
- package/dist/create/index.js +4 -0
- package/dist/create/message-builder.d.ts +78 -0
- package/dist/create/message-builder.js +110 -0
- package/dist/create/part-builder.d.ts +60 -0
- package/dist/create/part-builder.js +84 -0
- package/dist/create/status-builder.d.ts +26 -0
- package/dist/create/status-builder.js +46 -0
- package/dist/create/task-builder.d.ts +251 -0
- package/dist/create/task-builder.js +384 -0
- package/dist/create/transform.d.ts +16 -0
- package/dist/create/transform.js +106 -0
- package/dist/extensions/otel.d.ts +98 -0
- package/dist/extensions/otel.js +190 -0
- package/dist/extensions/pino.d.ts +44 -0
- package/dist/extensions/pino.js +107 -0
- package/dist/extensions/winston.d.ts +47 -0
- package/dist/extensions/winston.js +114 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/server/express/errors.js +7 -11
- package/dist/server/express/middeware.d.ts +2 -2
- package/dist/server/express/middeware.js +26 -40
- package/dist/server/express/server.d.ts +14 -56
- package/dist/server/express/server.js +46 -35
- package/dist/services/a2a/execute.d.ts +11 -0
- package/dist/services/a2a/execute.js +32 -0
- package/dist/services/a2a/factory/context.d.ts +15 -128
- package/dist/services/a2a/factory/context.js +30 -136
- package/dist/services/a2a/factory/handler.d.ts +6 -0
- package/dist/services/a2a/factory/handler.js +14 -0
- package/dist/services/a2a/factory/index.d.ts +1 -3
- package/dist/services/a2a/factory/index.js +1 -3
- package/dist/services/a2a/factory/service.d.ts +20 -7
- package/dist/services/a2a/factory/service.js +5 -5
- package/dist/services/a2a/factory/state-machine.d.ts +11 -0
- package/dist/services/a2a/factory/state-machine.js +88 -0
- package/dist/services/a2a/handlers/artifact.d.ts +7 -0
- package/dist/services/a2a/handlers/artifact.js +28 -0
- package/dist/services/a2a/handlers/cancel-task.d.ts +11 -0
- package/dist/services/a2a/handlers/cancel-task.js +35 -0
- package/dist/services/a2a/handlers/get-task.d.ts +11 -0
- package/dist/services/a2a/handlers/get-task.js +13 -0
- package/dist/services/a2a/handlers/resubscribe-task.d.ts +19 -0
- package/dist/services/a2a/handlers/resubscribe-task.js +59 -0
- package/dist/services/a2a/handlers/send-message.d.ts +11 -0
- package/dist/services/a2a/handlers/send-message.js +31 -0
- package/dist/services/a2a/handlers/stream-message.d.ts +19 -0
- package/dist/services/a2a/handlers/stream-message.js +23 -0
- package/dist/services/a2a/handlers/update.d.ts +17 -0
- package/dist/services/a2a/handlers/update.js +119 -0
- package/dist/services/a2a/helpers/content.d.ts +6 -2
- package/dist/services/a2a/helpers/content.js +9 -1
- package/dist/services/a2a/helpers/history.d.ts +6 -2
- package/dist/services/a2a/helpers/history.js +4 -0
- package/dist/services/a2a/helpers/index.d.ts +3 -3
- package/dist/services/a2a/helpers/index.js +3 -3
- package/dist/services/a2a/helpers/part.d.ts +9 -9
- package/dist/services/a2a/helpers/references.d.ts +6 -0
- package/dist/services/a2a/helpers/references.js +22 -0
- package/dist/services/a2a/index.d.ts +9 -5
- package/dist/services/a2a/index.js +8 -5
- package/dist/services/a2a/managers.d.ts +23 -0
- package/dist/services/a2a/managers.js +101 -0
- package/dist/services/a2a/messenger.d.ts +35 -0
- package/dist/services/{core/managers/command.js → a2a/messenger.js} +27 -31
- package/dist/services/a2a/service.d.ts +45 -372
- package/dist/services/a2a/service.js +232 -84
- package/dist/services/a2a/state-machine.d.ts +18 -0
- package/dist/services/a2a/state-machine.js +78 -0
- package/dist/services/a2a/streams.d.ts +22 -0
- package/dist/services/a2a/streams.js +98 -0
- package/dist/services/core/index.d.ts +1 -2
- package/dist/services/core/index.js +1 -2
- package/dist/services/core/manager.d.ts +15 -0
- package/dist/services/core/manager.js +42 -0
- package/dist/services/mcp/service.d.ts +11 -15
- package/dist/services/mcp/service.js +16 -15
- package/dist/transport/index.d.ts +0 -1
- package/dist/transport/index.js +1 -1
- package/dist/transport/rpc/parser.d.ts +2 -2
- package/dist/transport/rpc/parser.js +7 -6
- package/dist/transport/rpc/rpc-client.d.ts +5 -5
- package/dist/transport/rpc/rpc-client.js +6 -6
- package/dist/transport/streaming/event-stream.d.ts +3 -3
- package/dist/transport/streaming/event-stream.js +11 -10
- package/dist/transport/trpc/a2a/factory/router.d.ts +479 -871
- package/dist/transport/trpc/a2a/factory/router.js +2 -2
- package/dist/transport/trpc/a2a/routes/info.d.ts +108 -8
- package/dist/transport/trpc/a2a/routes/info.js +6 -2
- package/dist/transport/trpc/a2a/routes/message/route.d.ts +113 -162
- package/dist/transport/trpc/a2a/routes/message/route.js +7 -13
- package/dist/transport/trpc/a2a/routes/tasks/route.d.ts +114 -212
- package/dist/transport/trpc/a2a/routes/tasks/route.js +16 -19
- package/dist/transport/trpc/a2a/trpc.d.ts +9 -253
- package/dist/types/a2a/a2a.d.ts +382 -0
- package/dist/types/a2a/a2a.js +14 -0
- package/dist/types/a2a/index.d.ts +5 -0
- package/dist/types/a2a/index.js +1 -0
- package/dist/types/{interfaces/client.d.ts → client.d.ts} +25 -27
- package/dist/types/core/core.d.ts +31 -0
- package/dist/types/core/core.js +1 -0
- package/dist/types/core/index.d.ts +1 -0
- package/dist/types/core/index.js +1 -0
- package/dist/types/index.d.ts +6 -3
- package/dist/types/index.js +6 -3
- package/dist/types/mcp/index.d.ts +1 -0
- package/dist/types/mcp/index.js +1 -0
- package/dist/{browser/types/interfaces/services/mcp/service.d.ts → types/mcp/mcp.d.ts} +4 -3
- package/dist/{browser/types/interfaces/services/a2a/context.js → types/mcp/mcp.js} +1 -1
- package/dist/types/storage.d.ts +21 -0
- package/dist/utils/common/constants.d.ts +2 -7
- package/dist/utils/common/constants.js +5 -32
- package/dist/utils/common/errors.d.ts +74 -18
- package/dist/utils/common/errors.js +81 -28
- package/dist/utils/common/parse.d.ts +7 -0
- package/dist/utils/common/parse.js +14 -0
- package/dist/utils/common/schema-validation.d.ts +2 -2
- package/dist/utils/common/schema-validation.js +7 -7
- package/dist/utils/common/utils.d.ts +23 -0
- package/dist/utils/common/utils.js +32 -0
- package/dist/utils/common/zAsyncIterable-v3.d.ts +1 -1
- package/dist/utils/common/zAsyncIterable-v3.js +2 -1
- package/dist/utils/index.d.ts +2 -3
- package/dist/utils/index.js +2 -3
- package/dist/utils/storage/file.d.ts +8 -17
- package/dist/utils/storage/file.js +44 -73
- package/package.json +76 -13
- package/dist/browser/services/a2a/helpers/message-builder.d.ts +0 -12
- package/dist/browser/services/a2a/helpers/message-builder.js +0 -61
- package/dist/browser/types/ext.d.ts +0 -13
- package/dist/browser/types/ext.js +0 -10
- package/dist/browser/types/interfaces/index.d.ts +0 -3
- package/dist/browser/types/interfaces/index.js +0 -3
- package/dist/browser/types/interfaces/services/a2a/builder.d.ts +0 -37
- package/dist/browser/types/interfaces/services/a2a/context.d.ts +0 -162
- package/dist/browser/types/interfaces/services/a2a/engine.d.ts +0 -7
- package/dist/browser/types/interfaces/services/a2a/engine.js +0 -5
- package/dist/browser/types/interfaces/services/a2a/index.d.ts +0 -5
- package/dist/browser/types/interfaces/services/a2a/index.js +0 -5
- package/dist/browser/types/interfaces/services/a2a/legacy.d.ts +0 -93
- package/dist/browser/types/interfaces/services/a2a/legacy.js +0 -5
- package/dist/browser/types/interfaces/services/a2a/service.d.ts +0 -413
- package/dist/browser/types/interfaces/services/a2a/service.js +0 -5
- package/dist/browser/types/interfaces/services/core/context/command.d.ts +0 -25
- package/dist/browser/types/interfaces/services/core/context/command.js +0 -5
- package/dist/browser/types/interfaces/services/core/context/context.d.ts +0 -207
- package/dist/browser/types/interfaces/services/core/context/context.js +0 -5
- package/dist/browser/types/interfaces/services/core/context/index.d.ts +0 -3
- package/dist/browser/types/interfaces/services/core/context/index.js +0 -3
- package/dist/browser/types/interfaces/services/core/context/types.d.ts +0 -11
- package/dist/browser/types/interfaces/services/core/context/types.js +0 -5
- package/dist/browser/types/interfaces/services/core/execution/engine.d.ts +0 -106
- package/dist/browser/types/interfaces/services/core/execution/engine.js +0 -5
- package/dist/browser/types/interfaces/services/core/execution/environment.d.ts +0 -11
- package/dist/browser/types/interfaces/services/core/execution/environment.js +0 -5
- package/dist/browser/types/interfaces/services/core/execution/execute.d.ts +0 -7
- package/dist/browser/types/interfaces/services/core/execution/execute.js +0 -5
- package/dist/browser/types/interfaces/services/core/execution/index.d.ts +0 -3
- package/dist/browser/types/interfaces/services/core/execution/index.js +0 -3
- package/dist/browser/types/interfaces/services/core/index.d.ts +0 -4
- package/dist/browser/types/interfaces/services/core/index.js +0 -4
- package/dist/browser/types/interfaces/services/core/managers/cancellation.d.ts +0 -9
- package/dist/browser/types/interfaces/services/core/managers/cancellation.js +0 -5
- package/dist/browser/types/interfaces/services/core/managers/connection.d.ts +0 -9
- package/dist/browser/types/interfaces/services/core/managers/connection.js +0 -5
- package/dist/browser/types/interfaces/services/core/managers/context.d.ts +0 -17
- package/dist/browser/types/interfaces/services/core/managers/context.js +0 -5
- package/dist/browser/types/interfaces/services/core/managers/event.d.ts +0 -328
- package/dist/browser/types/interfaces/services/core/managers/event.js +0 -5
- package/dist/browser/types/interfaces/services/core/managers/index.d.ts +0 -6
- package/dist/browser/types/interfaces/services/core/managers/index.js +0 -6
- package/dist/browser/types/interfaces/services/core/managers/stream.d.ts +0 -217
- package/dist/browser/types/interfaces/services/core/managers/stream.js +0 -5
- package/dist/browser/types/interfaces/services/core/managers/task.d.ts +0 -9
- package/dist/browser/types/interfaces/services/core/service.d.ts +0 -115
- package/dist/browser/types/interfaces/services/core/service.js +0 -5
- package/dist/browser/types/interfaces/services/index.d.ts +0 -4
- package/dist/browser/types/interfaces/services/index.js +0 -4
- package/dist/browser/types/interfaces/services/mcp/index.d.ts +0 -1
- package/dist/browser/types/interfaces/services/mcp/index.js +0 -1
- package/dist/browser/types/interfaces/services/mcp/service.js +0 -5
- package/dist/browser/types/interfaces/storage.d.ts +0 -8
- package/dist/browser/types/schemas/a2a/agent.d.ts +0 -2583
- package/dist/browser/types/schemas/a2a/agent.js +0 -323
- package/dist/browser/types/schemas/a2a/auth.d.ts +0 -908
- package/dist/browser/types/schemas/a2a/auth.js +0 -283
- package/dist/browser/types/schemas/a2a/error.d.ts +0 -396
- package/dist/browser/types/schemas/a2a/error.js +0 -163
- package/dist/browser/types/schemas/a2a/index.d.ts +0 -11
- package/dist/browser/types/schemas/a2a/index.js +0 -11
- package/dist/browser/types/schemas/a2a/kind.d.ts +0 -11
- package/dist/browser/types/schemas/a2a/kind.js +0 -20
- package/dist/browser/types/schemas/a2a/message.d.ts +0 -10343
- package/dist/browser/types/schemas/a2a/message.js +0 -130
- package/dist/browser/types/schemas/a2a/notification.d.ts +0 -1517
- package/dist/browser/types/schemas/a2a/notification.js +0 -203
- package/dist/browser/types/schemas/a2a/parameters.d.ts +0 -956
- package/dist/browser/types/schemas/a2a/parameters.js +0 -241
- package/dist/browser/types/schemas/a2a/protocol.d.ts +0 -14363
- package/dist/browser/types/schemas/a2a/protocol.js +0 -59
- package/dist/browser/types/schemas/a2a/rpc.d.ts +0 -182
- package/dist/browser/types/schemas/a2a/rpc.js +0 -126
- package/dist/browser/types/schemas/a2a/task.d.ts +0 -5886
- package/dist/browser/types/schemas/a2a/task.js +0 -134
- package/dist/browser/types/schemas/a2a/transport.d.ts +0 -31
- package/dist/browser/types/schemas/a2a/transport.js +0 -28
- package/dist/browser/types/schemas/index.d.ts +0 -1
- package/dist/browser/types/schemas/index.js +0 -1
- package/dist/browser/utils/logging/index.d.ts +0 -2
- package/dist/browser/utils/logging/index.js +0 -2
- package/dist/browser/utils/logging/log.d.ts +0 -33
- package/dist/browser/utils/logging/log.js +0 -75
- package/dist/browser/utils/logging/logger.d.ts +0 -18
- package/dist/browser/utils/logging/logger.js +0 -18
- package/dist/services/a2a/factory/builder.d.ts +0 -351
- package/dist/services/a2a/factory/builder.js +0 -365
- package/dist/services/a2a/factory/event.d.ts +0 -58
- package/dist/services/a2a/factory/event.js +0 -177
- package/dist/services/a2a/factory/method.d.ts +0 -6
- package/dist/services/a2a/factory/method.js +0 -14
- package/dist/services/a2a/helpers/agentcard-builder.d.ts +0 -7
- package/dist/services/a2a/helpers/agentcard-builder.js +0 -23
- package/dist/services/a2a/helpers/message-builder.d.ts +0 -12
- package/dist/services/a2a/helpers/message-builder.js +0 -61
- package/dist/services/a2a/managers/cancellation.d.ts +0 -11
- package/dist/services/a2a/managers/cancellation.js +0 -16
- package/dist/services/a2a/managers/connection.d.ts +0 -11
- package/dist/services/a2a/managers/connection.js +0 -16
- package/dist/services/a2a/managers/context.d.ts +0 -11
- package/dist/services/a2a/managers/context.js +0 -16
- package/dist/services/a2a/managers/index.d.ts +0 -5
- package/dist/services/a2a/managers/index.js +0 -5
- package/dist/services/a2a/managers/task.d.ts +0 -11
- package/dist/services/a2a/managers/task.js +0 -16
- package/dist/services/a2a/methods/cancel-task.d.ts +0 -7
- package/dist/services/a2a/methods/cancel-task.js +0 -43
- package/dist/services/a2a/methods/get-task.d.ts +0 -112
- package/dist/services/a2a/methods/get-task.js +0 -16
- package/dist/services/a2a/methods/resubscribe-task.d.ts +0 -7
- package/dist/services/a2a/methods/resubscribe-task.js +0 -80
- package/dist/services/a2a/methods/send-message.d.ts +0 -7
- package/dist/services/a2a/methods/send-message.js +0 -36
- package/dist/services/a2a/methods/stream-message.d.ts +0 -8
- package/dist/services/a2a/methods/stream-message.js +0 -21
- package/dist/services/a2a/state/index.d.ts +0 -3
- package/dist/services/a2a/state/index.js +0 -3
- package/dist/services/a2a/state/load.d.ts +0 -14
- package/dist/services/a2a/state/load.js +0 -71
- package/dist/services/a2a/state/process.d.ts +0 -7
- package/dist/services/a2a/state/process.js +0 -13
- package/dist/services/a2a/state/update/artifact.d.ts +0 -10
- package/dist/services/a2a/state/update/artifact.js +0 -39
- package/dist/services/a2a/state/update/index.d.ts +0 -2
- package/dist/services/a2a/state/update/index.js +0 -2
- package/dist/services/a2a/state/update/update.d.ts +0 -23
- package/dist/services/a2a/state/update/update.js +0 -123
- package/dist/services/core/execution/execute.d.ts +0 -6
- package/dist/services/core/execution/execute.js +0 -25
- package/dist/services/core/execution/index.d.ts +0 -1
- package/dist/services/core/execution/index.js +0 -1
- package/dist/services/core/managers/command.d.ts +0 -39
- package/dist/services/core/managers/event.d.ts +0 -18
- package/dist/services/core/managers/event.js +0 -56
- package/dist/services/core/managers/index.d.ts +0 -3
- package/dist/services/core/managers/index.js +0 -3
- package/dist/services/core/managers/stream.d.ts +0 -20
- package/dist/services/core/managers/stream.js +0 -77
- package/dist/types/ext.d.ts +0 -13
- package/dist/types/ext.js +0 -10
- package/dist/types/interfaces/index.d.ts +0 -3
- package/dist/types/interfaces/index.js +0 -3
- package/dist/types/interfaces/services/a2a/builder.d.ts +0 -37
- package/dist/types/interfaces/services/a2a/builder.js +0 -5
- package/dist/types/interfaces/services/a2a/context.d.ts +0 -162
- package/dist/types/interfaces/services/a2a/context.js +0 -5
- package/dist/types/interfaces/services/a2a/engine.d.ts +0 -7
- package/dist/types/interfaces/services/a2a/engine.js +0 -5
- package/dist/types/interfaces/services/a2a/index.d.ts +0 -5
- package/dist/types/interfaces/services/a2a/index.js +0 -5
- package/dist/types/interfaces/services/a2a/legacy.d.ts +0 -93
- package/dist/types/interfaces/services/a2a/legacy.js +0 -5
- package/dist/types/interfaces/services/a2a/service.d.ts +0 -413
- package/dist/types/interfaces/services/a2a/service.js +0 -5
- package/dist/types/interfaces/services/core/context/command.d.ts +0 -25
- package/dist/types/interfaces/services/core/context/command.js +0 -5
- package/dist/types/interfaces/services/core/context/context.d.ts +0 -207
- package/dist/types/interfaces/services/core/context/context.js +0 -5
- package/dist/types/interfaces/services/core/context/index.d.ts +0 -3
- package/dist/types/interfaces/services/core/context/index.js +0 -3
- package/dist/types/interfaces/services/core/context/types.d.ts +0 -11
- package/dist/types/interfaces/services/core/context/types.js +0 -5
- package/dist/types/interfaces/services/core/execution/engine.d.ts +0 -106
- package/dist/types/interfaces/services/core/execution/engine.js +0 -5
- package/dist/types/interfaces/services/core/execution/environment.d.ts +0 -11
- package/dist/types/interfaces/services/core/execution/environment.js +0 -5
- package/dist/types/interfaces/services/core/execution/execute.d.ts +0 -7
- package/dist/types/interfaces/services/core/execution/execute.js +0 -5
- package/dist/types/interfaces/services/core/execution/index.d.ts +0 -3
- package/dist/types/interfaces/services/core/execution/index.js +0 -3
- package/dist/types/interfaces/services/core/index.d.ts +0 -4
- package/dist/types/interfaces/services/core/index.js +0 -4
- package/dist/types/interfaces/services/core/managers/cancellation.d.ts +0 -9
- package/dist/types/interfaces/services/core/managers/cancellation.js +0 -5
- package/dist/types/interfaces/services/core/managers/connection.d.ts +0 -9
- package/dist/types/interfaces/services/core/managers/connection.js +0 -5
- package/dist/types/interfaces/services/core/managers/context.d.ts +0 -17
- package/dist/types/interfaces/services/core/managers/context.js +0 -5
- package/dist/types/interfaces/services/core/managers/event.d.ts +0 -328
- package/dist/types/interfaces/services/core/managers/event.js +0 -5
- package/dist/types/interfaces/services/core/managers/index.d.ts +0 -6
- package/dist/types/interfaces/services/core/managers/index.js +0 -6
- package/dist/types/interfaces/services/core/managers/stream.d.ts +0 -217
- package/dist/types/interfaces/services/core/managers/stream.js +0 -5
- package/dist/types/interfaces/services/core/managers/task.d.ts +0 -9
- package/dist/types/interfaces/services/core/service.d.ts +0 -115
- package/dist/types/interfaces/services/core/service.js +0 -5
- package/dist/types/interfaces/services/index.d.ts +0 -4
- package/dist/types/interfaces/services/index.js +0 -4
- package/dist/types/interfaces/services/mcp/index.d.ts +0 -1
- package/dist/types/interfaces/services/mcp/index.js +0 -1
- package/dist/types/interfaces/services/mcp/service.js +0 -5
- package/dist/types/interfaces/storage.d.ts +0 -8
- package/dist/types/schemas/a2a/agent.d.ts +0 -2583
- package/dist/types/schemas/a2a/agent.js +0 -323
- package/dist/types/schemas/a2a/auth.d.ts +0 -908
- package/dist/types/schemas/a2a/auth.js +0 -283
- package/dist/types/schemas/a2a/error.d.ts +0 -396
- package/dist/types/schemas/a2a/error.js +0 -163
- package/dist/types/schemas/a2a/index.d.ts +0 -11
- package/dist/types/schemas/a2a/index.js +0 -11
- package/dist/types/schemas/a2a/kind.d.ts +0 -11
- package/dist/types/schemas/a2a/kind.js +0 -20
- package/dist/types/schemas/a2a/message.d.ts +0 -10343
- package/dist/types/schemas/a2a/message.js +0 -130
- package/dist/types/schemas/a2a/notification.d.ts +0 -1517
- package/dist/types/schemas/a2a/notification.js +0 -203
- package/dist/types/schemas/a2a/parameters.d.ts +0 -956
- package/dist/types/schemas/a2a/parameters.js +0 -241
- package/dist/types/schemas/a2a/protocol.d.ts +0 -14363
- package/dist/types/schemas/a2a/protocol.js +0 -59
- package/dist/types/schemas/a2a/rpc.d.ts +0 -182
- package/dist/types/schemas/a2a/rpc.js +0 -126
- package/dist/types/schemas/a2a/task.d.ts +0 -5886
- package/dist/types/schemas/a2a/task.js +0 -134
- package/dist/types/schemas/a2a/transport.d.ts +0 -31
- package/dist/types/schemas/a2a/transport.js +0 -28
- package/dist/types/schemas/index.d.ts +0 -1
- package/dist/types/schemas/index.js +0 -1
- package/dist/utils/logging/index.d.ts +0 -2
- package/dist/utils/logging/index.js +0 -2
- package/dist/utils/logging/log.d.ts +0 -33
- package/dist/utils/logging/log.js +0 -75
- package/dist/utils/logging/logger.d.ts +0 -18
- package/dist/utils/logging/logger.js +0 -18
- package/dist/utils/storage/memory.d.ts +0 -25
- package/dist/utils/storage/memory.js +0 -47
- /package/dist/browser/{types/interfaces/services/core/managers/task.js → create/base.js} +0 -0
- /package/dist/browser/types/{interfaces/client.js → client.js} +0 -0
- /package/dist/{types/interfaces/services/core/managers/task.js → browser/types/core/core.js} +0 -0
- /package/dist/browser/types/{interfaces/services/protocol.d.ts → protocol.d.ts} +0 -0
- /package/dist/browser/types/{interfaces/services/protocol.js → protocol.js} +0 -0
- /package/dist/browser/types/{interfaces/storage.js → storage.js} +0 -0
- /package/dist/services/a2a/{methods → handlers}/index.d.ts +0 -0
- /package/dist/services/a2a/{methods → handlers}/index.js +0 -0
- /package/dist/types/{interfaces/client.js → client.js} +0 -0
- /package/dist/types/{interfaces/services/protocol.d.ts → protocol.d.ts} +0 -0
- /package/dist/types/{interfaces/services/protocol.js → protocol.js} +0 -0
- /package/dist/types/{interfaces/storage.js → storage.js} +0 -0
|
@@ -0,0 +1,762 @@
|
|
|
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
|
+
* **Key Features:**
|
|
13
|
+
* - Fluent API with method chaining (`.text()`, `.data()`, `.file()`, etc.)
|
|
14
|
+
* - Type-safe argument passing between steps via `args` carry pattern
|
|
15
|
+
* - Multiple output types: text, file, data, message, artifact, status, task
|
|
16
|
+
* - Agent-to-agent orchestration via `.sendMessage()`
|
|
17
|
+
* - Static value shortcuts for simple steps
|
|
18
|
+
* - Step skipping via `skip()` function
|
|
19
|
+
*
|
|
20
|
+
* **Basic Usage:**
|
|
21
|
+
* ```typescript
|
|
22
|
+
* import { cr8 } from "@artinet/sdk";
|
|
23
|
+
*
|
|
24
|
+
* const agent = cr8("MyAgent")
|
|
25
|
+
* .text(({ content }) => `You said: ${content}`)
|
|
26
|
+
* .data(({ content }) => ({ length: content?.length }))
|
|
27
|
+
* .agent;
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @module A2ABuilder
|
|
31
|
+
* @version 0.6.0-preview
|
|
32
|
+
* @since 0.5.6
|
|
33
|
+
* @author The Artinet Project
|
|
34
|
+
*/
|
|
35
|
+
import { A2A } from "../types/index.js";
|
|
36
|
+
import * as A from "./agent-builder.js";
|
|
37
|
+
import { ServiceParams } from "../services/a2a/factory/service.js";
|
|
38
|
+
import { describe } from "./index.js";
|
|
39
|
+
import { ServerParams } from "../server/index.js";
|
|
40
|
+
import { Service } from "../services/a2a/service.js";
|
|
41
|
+
import { MessageParams } from "./message-builder.js";
|
|
42
|
+
import { StatusUpdateParams, ArtifactUpdateParams, TaskParams } from "./task-builder.js";
|
|
43
|
+
import { A2AClient } from "../client/a2a-client.js";
|
|
44
|
+
/**
|
|
45
|
+
* Type alias for text-based workflow steps.
|
|
46
|
+
*
|
|
47
|
+
* This type represents a step that processes or generates text content
|
|
48
|
+
* within an agent workflow. Text steps are the most common type of step
|
|
49
|
+
* and are used for message processing, content generation, and text-based
|
|
50
|
+
* decision making.
|
|
51
|
+
*
|
|
52
|
+
* @template Input - Arguments received from previous step
|
|
53
|
+
* @template Carry - Arguments passed to next step
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```typescript
|
|
57
|
+
* // Simple text return
|
|
58
|
+
* const greetingStep: textStep = async ({ content }) => {
|
|
59
|
+
* return `Hello! You said: ${content}`;
|
|
60
|
+
* };
|
|
61
|
+
*
|
|
62
|
+
* // With carry args for next step
|
|
63
|
+
* const analyzeStep: textStep = async ({ content }) => {
|
|
64
|
+
* return {
|
|
65
|
+
* reply: `Analyzed: ${content}`,
|
|
66
|
+
* args: { sentiment: 'positive', length: content?.length ?? 0 }
|
|
67
|
+
* };
|
|
68
|
+
* };
|
|
69
|
+
* ```
|
|
70
|
+
*
|
|
71
|
+
* @public
|
|
72
|
+
* @since 0.5.6
|
|
73
|
+
*/
|
|
74
|
+
export type textStep<Input extends A.bargs = A.empty, Carry extends A.bargs = A.empty> = A.Step<A2A.TextPart["text"], Input, Carry>;
|
|
75
|
+
/**
|
|
76
|
+
* Type alias for file-based workflow steps.
|
|
77
|
+
*
|
|
78
|
+
* This type represents a step that processes or generates file content
|
|
79
|
+
* within an agent workflow. File steps handle document processing,
|
|
80
|
+
* file generation, and file-based data operations.
|
|
81
|
+
*
|
|
82
|
+
* @template Input - Arguments received from previous step
|
|
83
|
+
* @template Carry - Arguments passed to next step
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```typescript
|
|
87
|
+
* // Return file with URI
|
|
88
|
+
* const downloadStep: fileStep = async ({ content }) => {
|
|
89
|
+
* return { uri: `https://example.com/files/${content}.pdf` };
|
|
90
|
+
* };
|
|
91
|
+
*
|
|
92
|
+
* // Return file with bytes
|
|
93
|
+
* const generateStep: fileStep = async ({ args }) => {
|
|
94
|
+
* return {
|
|
95
|
+
* name: 'report.pdf',
|
|
96
|
+
* mimeType: 'application/pdf',
|
|
97
|
+
* bytes: generatePDF(args?.data)
|
|
98
|
+
* };
|
|
99
|
+
* };
|
|
100
|
+
*
|
|
101
|
+
* // Return multiple files
|
|
102
|
+
* const batchStep: fileStep = async () => {
|
|
103
|
+
* return [
|
|
104
|
+
* { uri: 'https://example.com/file1.pdf' },
|
|
105
|
+
* { uri: 'https://example.com/file2.pdf' }
|
|
106
|
+
* ];
|
|
107
|
+
* };
|
|
108
|
+
* ```
|
|
109
|
+
*
|
|
110
|
+
* @public
|
|
111
|
+
* @since 0.5.6
|
|
112
|
+
*/
|
|
113
|
+
export type fileStep<Input extends A.bargs = A.empty, Carry extends A.bargs = A.empty> = A.Step<A2A.FilePart["file"], Input, Carry>;
|
|
114
|
+
/**
|
|
115
|
+
* Type alias for data-based workflow steps.
|
|
116
|
+
*
|
|
117
|
+
* This type represents a step that processes or generates structured data
|
|
118
|
+
* within an agent workflow. Data steps handle JSON processing, API responses,
|
|
119
|
+
* and structured data transformations.
|
|
120
|
+
*
|
|
121
|
+
* @template Input - Arguments received from previous step
|
|
122
|
+
* @template Carry - Arguments passed to next step
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* ```typescript
|
|
126
|
+
* // Return structured data
|
|
127
|
+
* const analyzeStep: dataStep = async ({ content }) => {
|
|
128
|
+
* const analysis = await analyzeMessage(content);
|
|
129
|
+
* return {
|
|
130
|
+
* sentiment: analysis.sentiment,
|
|
131
|
+
* entities: analysis.entities,
|
|
132
|
+
* confidence: analysis.confidence
|
|
133
|
+
* };
|
|
134
|
+
* };
|
|
135
|
+
*
|
|
136
|
+
* // With carry args
|
|
137
|
+
* const processStep: dataStep = async ({ args }) => {
|
|
138
|
+
* return {
|
|
139
|
+
* reply: { processed: true, input: args?.rawData },
|
|
140
|
+
* args: { processedAt: Date.now() }
|
|
141
|
+
* };
|
|
142
|
+
* };
|
|
143
|
+
* ```
|
|
144
|
+
*
|
|
145
|
+
* @public
|
|
146
|
+
* @since 0.5.6
|
|
147
|
+
*/
|
|
148
|
+
export type dataStep<Input extends A.bargs = A.empty, Carry extends A.bargs = A.empty> = A.Step<A2A.DataPart["data"], Input, Carry>;
|
|
149
|
+
/**
|
|
150
|
+
* Type alias for message-based workflow steps.
|
|
151
|
+
*
|
|
152
|
+
* This type represents a step that constructs or transforms complete A2A messages.
|
|
153
|
+
* Message steps are useful when you need full control over the message structure,
|
|
154
|
+
* including role, parts, and metadata.
|
|
155
|
+
*
|
|
156
|
+
* @template Input - Arguments received from previous step
|
|
157
|
+
* @template Carry - Arguments passed to next step
|
|
158
|
+
*
|
|
159
|
+
* @example
|
|
160
|
+
* ```typescript
|
|
161
|
+
* // Return a string (auto-converted to message)
|
|
162
|
+
* const simpleStep: messageStep = async () => {
|
|
163
|
+
* return "Hello from the agent!";
|
|
164
|
+
* };
|
|
165
|
+
*
|
|
166
|
+
* // Return a full message object
|
|
167
|
+
* const fullStep: messageStep = async ({ context }) => {
|
|
168
|
+
* return {
|
|
169
|
+
* role: "agent",
|
|
170
|
+
* parts: [
|
|
171
|
+
* { kind: "text", text: "Here is your report:" },
|
|
172
|
+
* { kind: "file", file: { uri: "https://example.com/report.pdf" } }
|
|
173
|
+
* ]
|
|
174
|
+
* };
|
|
175
|
+
* };
|
|
176
|
+
* ```
|
|
177
|
+
*
|
|
178
|
+
* @public
|
|
179
|
+
* @since 0.6.0
|
|
180
|
+
*/
|
|
181
|
+
export type messageStep<Input extends A.bargs = A.empty, Carry extends A.bargs = A.empty> = A.Step<A.Stateless<MessageParams>, Input, Carry>;
|
|
182
|
+
/**
|
|
183
|
+
* Type alias for artifact-based workflow steps.
|
|
184
|
+
*
|
|
185
|
+
* This type represents a step that creates or updates artifacts within an agent
|
|
186
|
+
* workflow. Artifacts are persistent, versioned outputs that can be referenced
|
|
187
|
+
* across task sessions - useful for documents, generated files, or any content
|
|
188
|
+
* that should be retrievable later.
|
|
189
|
+
*
|
|
190
|
+
* @template Input - Arguments received from previous step
|
|
191
|
+
* @template Carry - Arguments passed to next step
|
|
192
|
+
*
|
|
193
|
+
* @example
|
|
194
|
+
* ```typescript
|
|
195
|
+
* // Create an artifact
|
|
196
|
+
* const createArtifact: artifactStep = async ({ context, args }) => {
|
|
197
|
+
* return {
|
|
198
|
+
* artifactId: `report-${context.taskId}`,
|
|
199
|
+
* name: "Analysis Report",
|
|
200
|
+
* parts: [{ kind: "text", text: args?.analysisResult }]
|
|
201
|
+
* };
|
|
202
|
+
* };
|
|
203
|
+
*
|
|
204
|
+
* // Using describe helper
|
|
205
|
+
* const helperStep: artifactStep = async ({ context }) => {
|
|
206
|
+
* return describe.artifact({
|
|
207
|
+
* artifactId: context.taskId,
|
|
208
|
+
* parts: [{ kind: "text", text: "Generated content" }]
|
|
209
|
+
* });
|
|
210
|
+
* };
|
|
211
|
+
* ```
|
|
212
|
+
*
|
|
213
|
+
* @public
|
|
214
|
+
* @since 0.6.0
|
|
215
|
+
*/
|
|
216
|
+
export type artifactStep<Input extends A.bargs = A.empty, Carry extends A.bargs = A.empty> = A.Step<A.Stateless<ArtifactUpdateParams>, Input, Carry>;
|
|
217
|
+
/**
|
|
218
|
+
* Type alias for status update workflow steps.
|
|
219
|
+
*
|
|
220
|
+
* This type represents a step that emits task status updates within an agent
|
|
221
|
+
* workflow. Status steps are useful for communicating progress, state changes,
|
|
222
|
+
* or intermediate results to the client during long-running operations.
|
|
223
|
+
*
|
|
224
|
+
* @template Input - Arguments received from previous step
|
|
225
|
+
* @template Carry - Arguments passed to next step
|
|
226
|
+
*
|
|
227
|
+
* @example
|
|
228
|
+
* ```typescript
|
|
229
|
+
* // Simple status string
|
|
230
|
+
* const progressStep: statusStep = async () => {
|
|
231
|
+
* return "working";
|
|
232
|
+
* };
|
|
233
|
+
*
|
|
234
|
+
* // Status with message
|
|
235
|
+
* const detailedStep: statusStep = async ({ args }) => {
|
|
236
|
+
* return {
|
|
237
|
+
* status: {
|
|
238
|
+
* state: A2A.TaskState.working,
|
|
239
|
+
* message: describe.message(`Processing step ${args?.step} of 5...`)
|
|
240
|
+
* }
|
|
241
|
+
* };
|
|
242
|
+
* };
|
|
243
|
+
*
|
|
244
|
+
* // Mark completion
|
|
245
|
+
* const completeStep: statusStep = async () => {
|
|
246
|
+
* return { status: { state: A2A.TaskState.completed } };
|
|
247
|
+
* };
|
|
248
|
+
* ```
|
|
249
|
+
*
|
|
250
|
+
* @public
|
|
251
|
+
* @since 0.6.0
|
|
252
|
+
*/
|
|
253
|
+
export type statusStep<Input extends A.bargs = A.empty, Carry extends A.bargs = A.empty> = A.Step<A.Stateless<StatusUpdateParams>, Input, Carry>;
|
|
254
|
+
/**
|
|
255
|
+
* Type alias for task-based workflow steps.
|
|
256
|
+
*
|
|
257
|
+
* This type represents a step that creates or manipulates complete A2A tasks.
|
|
258
|
+
* Task steps provide full control over the task object, including status,
|
|
259
|
+
* artifacts, and history. Useful for complex orchestration scenarios or
|
|
260
|
+
* when you need to return a complete task representation.
|
|
261
|
+
*
|
|
262
|
+
* @template Input - Arguments received from previous step
|
|
263
|
+
* @template Carry - Arguments passed to next step
|
|
264
|
+
*
|
|
265
|
+
* @example
|
|
266
|
+
* ```typescript
|
|
267
|
+
* // Return task from string
|
|
268
|
+
* const simpleTask: taskStep = async () => {
|
|
269
|
+
* return "Task completed successfully";
|
|
270
|
+
* };
|
|
271
|
+
*
|
|
272
|
+
* // Return full task object
|
|
273
|
+
* const fullTask: taskStep = async ({ context, args }) => {
|
|
274
|
+
* return describe.task({
|
|
275
|
+
* id: context.taskId,
|
|
276
|
+
* contextId: context.contextId,
|
|
277
|
+
* status: { state: A2A.TaskState.completed },
|
|
278
|
+
* artifacts: [args?.generatedArtifact]
|
|
279
|
+
* });
|
|
280
|
+
* };
|
|
281
|
+
*
|
|
282
|
+
* // With carry for chaining
|
|
283
|
+
* const chainTask: taskStep = async ({ context }) => {
|
|
284
|
+
* const task = describe.task({ id: context.taskId });
|
|
285
|
+
* return { reply: task, args: { taskSnapshot: task } };
|
|
286
|
+
* };
|
|
287
|
+
* ```
|
|
288
|
+
*
|
|
289
|
+
* @public
|
|
290
|
+
* @since 0.6.0
|
|
291
|
+
*/
|
|
292
|
+
export type taskStep<Input extends A.bargs = A.empty, Carry extends A.bargs = A.empty> = A.Step<A.Stateless<TaskParams>, Input, Carry>;
|
|
293
|
+
export type FactoryParams = Omit<ServiceParams, "engine" | "agentCard"> & Omit<ServerParams, "agent">;
|
|
294
|
+
/**
|
|
295
|
+
* Fluent builder for constructing A2A agent execution engines.
|
|
296
|
+
*
|
|
297
|
+
* AgentFactory provides a type-safe, fluent API for composing multi-step
|
|
298
|
+
* agent workflows. It supports method chaining to build complex agent behaviors
|
|
299
|
+
* from individual processing steps, with automatic type inference for carried
|
|
300
|
+
* arguments between steps.
|
|
301
|
+
*
|
|
302
|
+
* @template I - The arguments type received from previous steps (inferred automatically)
|
|
303
|
+
*
|
|
304
|
+
* @example
|
|
305
|
+
* ```typescript
|
|
306
|
+
* // Basic agent with text steps
|
|
307
|
+
* const agent = cr8("MyAgent")
|
|
308
|
+
* .text(({ content }) => `You said: ${content}`)
|
|
309
|
+
* .agent;
|
|
310
|
+
*
|
|
311
|
+
* // Agent with carried args between steps
|
|
312
|
+
* const agent = cr8("AnalysisAgent")
|
|
313
|
+
* .text(({ content }) => ({
|
|
314
|
+
* reply: `Analyzing: ${content}`,
|
|
315
|
+
* args: { originalContent: content }
|
|
316
|
+
* }))
|
|
317
|
+
* .data(({ args }) => ({
|
|
318
|
+
* wordCount: args?.originalContent?.split(' ').length,
|
|
319
|
+
* timestamp: Date.now()
|
|
320
|
+
* }))
|
|
321
|
+
* .text(({ args }) => `Analysis complete: ${args?.wordCount} words`)
|
|
322
|
+
* .agent;
|
|
323
|
+
*
|
|
324
|
+
* // Agent-to-agent orchestration
|
|
325
|
+
* const orchestrator = cr8("Orchestrator")
|
|
326
|
+
* .text("Starting multi-agent workflow...")
|
|
327
|
+
* .sendMessage({ agent: otherAgent, message: "Process this" })
|
|
328
|
+
* .text(({ args }) => `Got result: ${args?.task?.status.state}`)
|
|
329
|
+
* .agent;
|
|
330
|
+
* ```
|
|
331
|
+
*
|
|
332
|
+
* @public
|
|
333
|
+
* @since 0.5.6
|
|
334
|
+
*/
|
|
335
|
+
export declare class AgentFactory<I extends A.bargs = A.empty> implements A.AgentBuilder<I> {
|
|
336
|
+
private readonly _agentCard;
|
|
337
|
+
private readonly _params?;
|
|
338
|
+
private readonly _steps;
|
|
339
|
+
/**
|
|
340
|
+
* Protected constructor to enforce factory method usage.
|
|
341
|
+
* @param agentCard - The agent card to use
|
|
342
|
+
* @param params - The parameters to use
|
|
343
|
+
* @param steps - Initial steps array
|
|
344
|
+
*/
|
|
345
|
+
protected constructor(_agentCard: A2A.AgentCard, _params?: FactoryParams | undefined, _steps?: Array<A.Resolved<any, any, any, any, any>>);
|
|
346
|
+
/**
|
|
347
|
+
* Builds the step list for the workflow.
|
|
348
|
+
*
|
|
349
|
+
* @returns Array of workflow steps
|
|
350
|
+
* @throws Error if no steps have been added
|
|
351
|
+
*
|
|
352
|
+
* @example
|
|
353
|
+
* ```typescript
|
|
354
|
+
* const steps = cr8.steps;
|
|
355
|
+
* ```
|
|
356
|
+
*/
|
|
357
|
+
get steps(): Array<A.Resolved<any, any, any, any, any>>;
|
|
358
|
+
/**
|
|
359
|
+
* The {@link A2A.AgentCard} to use
|
|
360
|
+
* @returns The {@link A2A.AgentCard}
|
|
361
|
+
*/
|
|
362
|
+
get agentCard(): A2A.AgentCard;
|
|
363
|
+
/**
|
|
364
|
+
* The {@link FactoryParams} to use
|
|
365
|
+
* @returns The {@link FactoryParams}
|
|
366
|
+
*/
|
|
367
|
+
get params(): FactoryParams | undefined;
|
|
368
|
+
/**
|
|
369
|
+
* Creates an agent execution engine from the built workflow.
|
|
370
|
+
*
|
|
371
|
+
* @returns The {@link A2A.Engine}
|
|
372
|
+
*
|
|
373
|
+
* @example
|
|
374
|
+
* ```typescript
|
|
375
|
+
* const engine = builder.engine;
|
|
376
|
+
* // Use engine with service execution
|
|
377
|
+
* ```
|
|
378
|
+
*/
|
|
379
|
+
get engine(): A2A.Engine;
|
|
380
|
+
/**
|
|
381
|
+
* Creates a complete A2A agent using the built workflow.
|
|
382
|
+
*
|
|
383
|
+
* @param params - The {@link ServiceParams} to use
|
|
384
|
+
* @returns The {@link Service}
|
|
385
|
+
*
|
|
386
|
+
* @example
|
|
387
|
+
* ```typescript
|
|
388
|
+
* const agent = cr8({
|
|
389
|
+
* id: 'my-agent',
|
|
390
|
+
* name: 'Assistant Agent',
|
|
391
|
+
* capabilities: ['text-processing']
|
|
392
|
+
* }).agent;
|
|
393
|
+
* ```
|
|
394
|
+
*/
|
|
395
|
+
get agent(): Service;
|
|
396
|
+
get server(): {
|
|
397
|
+
app: import("express").Express;
|
|
398
|
+
agent: Service;
|
|
399
|
+
start: (_port?: number) => import("node:http").Server<typeof import("node:http").IncomingMessage, typeof import("node:http").ServerResponse>;
|
|
400
|
+
};
|
|
401
|
+
from(engine?: A2A.Engine): Service;
|
|
402
|
+
serve(engine?: A2A.Engine): {
|
|
403
|
+
app: import("express").Express;
|
|
404
|
+
agent: Service;
|
|
405
|
+
start: (_port?: number) => import("node:http").Server<typeof import("node:http").IncomingMessage, typeof import("node:http").ServerResponse>;
|
|
406
|
+
};
|
|
407
|
+
addStep<Ret extends A.AcceptedReturnValues = A.text, C extends A.bargs = A.empty, R extends A.rep<Ret, C> = A.rep<Ret, C>, Kind extends A.AcceptedKinds = "text">(step: A.Resolved<Ret, I, C, R, Kind>): AgentFactory<A.inC<R>>;
|
|
408
|
+
/**
|
|
409
|
+
* Adds a text processing step to the workflow.
|
|
410
|
+
*
|
|
411
|
+
* Text steps are the most common step type, producing text content that
|
|
412
|
+
* becomes a TextPart in the agent's response message.
|
|
413
|
+
*
|
|
414
|
+
* @param step - A text step function or static string value
|
|
415
|
+
* @returns New builder instance with updated type parameters
|
|
416
|
+
*
|
|
417
|
+
* @example
|
|
418
|
+
* ```typescript
|
|
419
|
+
* // Static text
|
|
420
|
+
* builder.text("Hello, world!")
|
|
421
|
+
*
|
|
422
|
+
* // Dynamic text from content
|
|
423
|
+
* builder.text(({ content }) => `You said: ${content}`)
|
|
424
|
+
*
|
|
425
|
+
* // With carried args
|
|
426
|
+
* builder.text(({ args }) => ({
|
|
427
|
+
* reply: `Processing ${args?.itemCount} items`,
|
|
428
|
+
* args: { processedAt: Date.now() }
|
|
429
|
+
* }))
|
|
430
|
+
* ```
|
|
431
|
+
*/
|
|
432
|
+
text<C extends A.bargs = A.empty>(text: A.text): AgentFactory<A.inC<A.rep<A.text, C>>>;
|
|
433
|
+
text<C extends A.bargs = A.empty>(step: textStep<I, C>): AgentFactory<A.inC<A.rep<A.text, C>>>;
|
|
434
|
+
/**
|
|
435
|
+
* Adds a file processing step to the workflow.
|
|
436
|
+
*
|
|
437
|
+
* File steps produce file content that becomes a FilePart in the agent's
|
|
438
|
+
* response. Files can be specified by URI or inline bytes/base64 content.
|
|
439
|
+
*
|
|
440
|
+
* @param step - A file step function or static file object
|
|
441
|
+
* @returns New builder instance with updated type parameters
|
|
442
|
+
*
|
|
443
|
+
* @example
|
|
444
|
+
* ```typescript
|
|
445
|
+
* // Static file by URI
|
|
446
|
+
* builder.file({ uri: "https://example.com/doc.pdf" })
|
|
447
|
+
*
|
|
448
|
+
* // Dynamic file generation
|
|
449
|
+
* builder.file(async ({ args }) => ({
|
|
450
|
+
* name: 'report.pdf',
|
|
451
|
+
* mimeType: 'application/pdf',
|
|
452
|
+
* bytes: await generatePDF(args?.data)
|
|
453
|
+
* }))
|
|
454
|
+
*
|
|
455
|
+
* // Multiple files
|
|
456
|
+
* builder.file(() => [
|
|
457
|
+
* { uri: "https://example.com/file1.pdf" },
|
|
458
|
+
* { uri: "https://example.com/file2.pdf" }
|
|
459
|
+
* ])
|
|
460
|
+
* ```
|
|
461
|
+
*/
|
|
462
|
+
file<C extends A.bargs = A.empty, R extends A.rep<A.file, C> = A.rep<A.file, C>>(file: A.file): AgentFactory<A.inC<A.rep<A.file, C>>>;
|
|
463
|
+
file<C extends A.bargs = A.empty, R extends A.rep<A.file, C> = A.rep<A.file, C>>(step: fileStep<I, C>): AgentFactory<A.inC<A.rep<A.file, C>>>;
|
|
464
|
+
/**
|
|
465
|
+
* Adds a data processing step to the workflow.
|
|
466
|
+
*
|
|
467
|
+
* Data steps produce structured JSON data that becomes a DataPart in the
|
|
468
|
+
* agent's response. Useful for returning complex objects, API responses,
|
|
469
|
+
* or any structured data.
|
|
470
|
+
*
|
|
471
|
+
* @param step - A data step function or static data object
|
|
472
|
+
* @returns New builder instance with updated type parameters
|
|
473
|
+
*
|
|
474
|
+
* @example
|
|
475
|
+
* ```typescript
|
|
476
|
+
* // Static data
|
|
477
|
+
* builder.data({ status: "ok", version: "1.0.0" })
|
|
478
|
+
*
|
|
479
|
+
* // Dynamic data
|
|
480
|
+
* builder.data(async ({ content }) => ({
|
|
481
|
+
* analysis: await analyzeText(content),
|
|
482
|
+
* timestamp: Date.now()
|
|
483
|
+
* }))
|
|
484
|
+
*
|
|
485
|
+
* // With carried args
|
|
486
|
+
* builder.data(({ args }) => ({
|
|
487
|
+
* reply: { result: args?.computedValue * 2 },
|
|
488
|
+
* args: { doubled: true }
|
|
489
|
+
* }))
|
|
490
|
+
* ```
|
|
491
|
+
*/
|
|
492
|
+
data<C extends A.bargs = A.empty>(data: A.data): AgentFactory<A.inC<A.rep<A.data, C>>>;
|
|
493
|
+
data<C extends A.bargs = A.empty>(step: dataStep<I, C>): AgentFactory<A.inC<A.rep<A.data, C>>>;
|
|
494
|
+
/**
|
|
495
|
+
* Adds a message step to the workflow.
|
|
496
|
+
*
|
|
497
|
+
* Message steps yield complete A2A messages with full control over role,
|
|
498
|
+
* parts, and metadata. Use when you need to construct complex multi-part
|
|
499
|
+
* messages or control the message structure directly.
|
|
500
|
+
*
|
|
501
|
+
* @param step - A message step function or static message/string
|
|
502
|
+
* @returns New builder instance with updated type parameters
|
|
503
|
+
*
|
|
504
|
+
* @example
|
|
505
|
+
* ```typescript
|
|
506
|
+
* // Simple string message
|
|
507
|
+
* builder.message("Hello from the agent!")
|
|
508
|
+
*
|
|
509
|
+
* // Full message with parts
|
|
510
|
+
* builder.message(({ context }) => ({
|
|
511
|
+
* role: "agent",
|
|
512
|
+
* parts: [
|
|
513
|
+
* { kind: "text", text: "Here are your files:" },
|
|
514
|
+
* { kind: "file", file: { uri: "https://example.com/doc.pdf" } }
|
|
515
|
+
* ]
|
|
516
|
+
* }))
|
|
517
|
+
*
|
|
518
|
+
* // Using describe helper
|
|
519
|
+
* builder.message(({ args }) => describe.message({
|
|
520
|
+
* role: "agent",
|
|
521
|
+
* parts: [{ kind: "text", text: args?.greeting }]
|
|
522
|
+
* }))
|
|
523
|
+
* ```
|
|
524
|
+
*/
|
|
525
|
+
message<C extends A.bargs = A.empty>(message: A.sMessage): AgentFactory<A.inC<A.rep<A.sMessage, C>>>;
|
|
526
|
+
message<C extends A.bargs = A.empty>(step: messageStep<I, C>): AgentFactory<A.inC<A.rep<A.sMessage, C>>>;
|
|
527
|
+
/**
|
|
528
|
+
* Adds an artifact step to the workflow.
|
|
529
|
+
*
|
|
530
|
+
* Artifact steps create persistent, versioned outputs that can be referenced
|
|
531
|
+
* across task sessions. Use for documents, generated files, or content that
|
|
532
|
+
* clients may need to retrieve later.
|
|
533
|
+
*
|
|
534
|
+
* @param step - An artifact step function or static artifact object
|
|
535
|
+
* @returns New builder instance with updated type parameters
|
|
536
|
+
*
|
|
537
|
+
* @example
|
|
538
|
+
* ```typescript
|
|
539
|
+
* // Static artifact
|
|
540
|
+
* builder.artifact(describe.artifact({
|
|
541
|
+
* artifactId: "report-001",
|
|
542
|
+
* parts: [{ kind: "text", text: "Report content" }]
|
|
543
|
+
* }))
|
|
544
|
+
*
|
|
545
|
+
* // Dynamic artifact
|
|
546
|
+
* builder.artifact(async ({ context, args }) => ({
|
|
547
|
+
* artifactId: `analysis-${context.taskId}`,
|
|
548
|
+
* name: "Analysis Results",
|
|
549
|
+
* parts: [{ kind: "data", data: args?.analysisData }]
|
|
550
|
+
* }))
|
|
551
|
+
* ```
|
|
552
|
+
*/
|
|
553
|
+
artifact<C extends A.bargs = A.empty>(step: artifactStep<I, C>): AgentFactory<A.inC<A.rep<A.sArtifact, C>>>;
|
|
554
|
+
artifact<C extends A.bargs = A.empty>(artifact: A.sArtifact): AgentFactory<A.inC<A.rep<A.sArtifact, C>>>;
|
|
555
|
+
/**
|
|
556
|
+
* Adds a status update step to the workflow.
|
|
557
|
+
*
|
|
558
|
+
* Status steps emit task state updates during execution. Use to communicate
|
|
559
|
+
* progress, intermediate states, or completion to clients. Supports simple
|
|
560
|
+
* state strings or full status objects with messages.
|
|
561
|
+
*
|
|
562
|
+
* @param step - A status step function, status object, or state string
|
|
563
|
+
* @returns New builder instance with updated type parameters
|
|
564
|
+
*
|
|
565
|
+
* @example
|
|
566
|
+
* ```typescript
|
|
567
|
+
* // Simple state string
|
|
568
|
+
* builder.status("working")
|
|
569
|
+
*
|
|
570
|
+
* // Status with message
|
|
571
|
+
* builder.status(({ args }) => ({
|
|
572
|
+
* status: {
|
|
573
|
+
* state: A2A.TaskState.working,
|
|
574
|
+
* message: describe.message(`Step ${args?.step} of 5 complete`)
|
|
575
|
+
* }
|
|
576
|
+
* }))
|
|
577
|
+
*
|
|
578
|
+
* // Mark completion
|
|
579
|
+
* builder.status(() => ({
|
|
580
|
+
* status: { state: A2A.TaskState.completed }
|
|
581
|
+
* }))
|
|
582
|
+
* ```
|
|
583
|
+
*/
|
|
584
|
+
status<C extends A.bargs = A.empty>(status: A.sUpdate): AgentFactory<A.inC<A.rep<A.sUpdate, C>>>;
|
|
585
|
+
status<C extends A.bargs = A.empty>(step: statusStep<I, C>): AgentFactory<A.inC<A.rep<A.sUpdate, C>>>;
|
|
586
|
+
/**
|
|
587
|
+
* Adds a task step to the workflow.
|
|
588
|
+
*
|
|
589
|
+
* Task steps yield complete A2A task objects. Use when you need full control
|
|
590
|
+
* over the task representation, including status, artifacts, and history.
|
|
591
|
+
* Particularly useful for orchestration scenarios or final task construction.
|
|
592
|
+
*
|
|
593
|
+
* @param step - A task step function, task object, or string
|
|
594
|
+
* @returns New builder instance with updated type parameters
|
|
595
|
+
*
|
|
596
|
+
* @example
|
|
597
|
+
* ```typescript
|
|
598
|
+
* // Simple string (auto-converted to task)
|
|
599
|
+
* builder.task("Operation completed")
|
|
600
|
+
*
|
|
601
|
+
* // Full task object
|
|
602
|
+
* builder.task(({ context }) => describe.task({
|
|
603
|
+
* id: context.taskId,
|
|
604
|
+
* contextId: context.contextId,
|
|
605
|
+
* status: { state: A2A.TaskState.completed }
|
|
606
|
+
* }))
|
|
607
|
+
*
|
|
608
|
+
* // With carried args
|
|
609
|
+
* builder.task(({ context }) => ({
|
|
610
|
+
* reply: describe.task({ id: context.taskId }),
|
|
611
|
+
* args: { completedAt: Date.now() }
|
|
612
|
+
* }))
|
|
613
|
+
* ```
|
|
614
|
+
*/
|
|
615
|
+
task<C extends A.bargs = A.empty>(task: A.sTask): AgentFactory<A.inC<A.rep<A.sTask, C>>>;
|
|
616
|
+
task<C extends A.bargs = A.empty>(step: taskStep<I, C>): AgentFactory<A.inC<A.rep<A.sTask, C>>>;
|
|
617
|
+
/**
|
|
618
|
+
* Adds an agent-to-agent orchestration step to the workflow.
|
|
619
|
+
*
|
|
620
|
+
* This step sends a message to another agent (local Service or remote A2AClient)
|
|
621
|
+
* and yields the response as a task. Enables multi-agent workflows where one
|
|
622
|
+
* agent delegates work to others.
|
|
623
|
+
*
|
|
624
|
+
* **Note:** This is currently a blocking call. Streaming responses are not
|
|
625
|
+
* yet supported in orchestration steps.
|
|
626
|
+
*
|
|
627
|
+
* @param agent_and_message - Configuration object with target agent and optional message
|
|
628
|
+
* @param agent_and_message.agent - The target agent (Service or A2AClient)
|
|
629
|
+
* @param agent_and_message.message - Message to send (defaults to context.userMessage)
|
|
630
|
+
* @returns New builder instance with task carry args (args.task)
|
|
631
|
+
*
|
|
632
|
+
* @example
|
|
633
|
+
* ```typescript
|
|
634
|
+
* // Delegate to another agent
|
|
635
|
+
* const orchestrator = cr8("Orchestrator")
|
|
636
|
+
* .text("Starting workflow...")
|
|
637
|
+
* .sendMessage({ agent: analysisAgent, message: "Analyze this data" })
|
|
638
|
+
* .text(({ args }) => `Analysis result: ${args?.task?.status.state}`)
|
|
639
|
+
* .agent;
|
|
640
|
+
*
|
|
641
|
+
* // Chain multiple agents
|
|
642
|
+
* const pipeline = cr8("Pipeline")
|
|
643
|
+
* .sendMessage({ agent: preprocessor })
|
|
644
|
+
* .sendMessage({ agent: analyzer })
|
|
645
|
+
* .sendMessage({ agent: postprocessor })
|
|
646
|
+
* .text(({ args }) => `Final result: ${args?.task?.status.message}`)
|
|
647
|
+
* .agent;
|
|
648
|
+
*
|
|
649
|
+
* // Forward user's message to another agent
|
|
650
|
+
* const proxy = cr8("Proxy")
|
|
651
|
+
* .sendMessage({ agent: targetAgent }) // uses context.userMessage
|
|
652
|
+
* .agent;
|
|
653
|
+
* ```
|
|
654
|
+
*/
|
|
655
|
+
sendMessage<Carry extends A.BaseArgs = {
|
|
656
|
+
task?: A2A.Task;
|
|
657
|
+
}>(agent_and_message: {
|
|
658
|
+
agent: Service | A2AClient;
|
|
659
|
+
message?: A.sMessage | string;
|
|
660
|
+
}): AgentFactory<A.inferCarry<A.Reply<A.Stateless<TaskParams>, Carry>>>;
|
|
661
|
+
/**
|
|
662
|
+
* Creates a new AgentFactory instance.
|
|
663
|
+
*
|
|
664
|
+
* @template Input - The initial arguments type
|
|
665
|
+
* @returns A new AgentFactory instance
|
|
666
|
+
*
|
|
667
|
+
* @example
|
|
668
|
+
* ```typescript
|
|
669
|
+
* const factory = AgentFactory.create(myCard, { params });
|
|
670
|
+
* ```
|
|
671
|
+
*/
|
|
672
|
+
static create<Input extends A.bargs = A.empty>(agentCard: describe.AgentCardParams, params?: FactoryParams): AgentFactory<Input>;
|
|
673
|
+
/**
|
|
674
|
+
* @deprecated Use engine instead
|
|
675
|
+
*/
|
|
676
|
+
createAgentEngine(): A2A.Engine;
|
|
677
|
+
/**
|
|
678
|
+
* @deprecated Use {@link agent} instead
|
|
679
|
+
*/
|
|
680
|
+
createAgent(params: Omit<ServiceParams, "engine">): Service;
|
|
681
|
+
}
|
|
682
|
+
/**
|
|
683
|
+
* Creates a new AgentFactory instance for building agent workflows.
|
|
684
|
+
*
|
|
685
|
+
* This is the primary entry point for the fluent builder API. Accepts an
|
|
686
|
+
* agent card (or name string) and optional factory parameters.
|
|
687
|
+
*
|
|
688
|
+
* @param agentCard - Agent card object or name string
|
|
689
|
+
* @param params - Optional factory parameters (basePath, port, etc.)
|
|
690
|
+
* @returns New AgentFactory instance
|
|
691
|
+
*
|
|
692
|
+
* @example
|
|
693
|
+
* ```typescript
|
|
694
|
+
* // Simple agent with name string
|
|
695
|
+
* const agent = cr8("MyAgent")
|
|
696
|
+
* .text(({ content }) => `Echo: ${content}`)
|
|
697
|
+
* .agent;
|
|
698
|
+
*
|
|
699
|
+
* // Agent with full card and params
|
|
700
|
+
* const agent = cr8(myAgentCard, { basePath: "/api" })
|
|
701
|
+
* .text("Hello!")
|
|
702
|
+
* .data(({ content }) => analyzeContent(content))
|
|
703
|
+
* .agent;
|
|
704
|
+
*
|
|
705
|
+
* // Get the engine directly
|
|
706
|
+
* const engine = cr8("Processor")
|
|
707
|
+
* .text("Processing...")
|
|
708
|
+
* .engine;
|
|
709
|
+
*
|
|
710
|
+
* // Create and start server
|
|
711
|
+
* const server = cr8("ServerAgent", { port: 3000 })
|
|
712
|
+
* .text("Ready to serve!")
|
|
713
|
+
* .server.start();
|
|
714
|
+
* ```
|
|
715
|
+
*
|
|
716
|
+
* @public
|
|
717
|
+
* @since 0.6.0
|
|
718
|
+
*/
|
|
719
|
+
export declare const cr8: typeof AgentFactory.create;
|
|
720
|
+
export declare const test: A.Resolved<any, any, any, any, any>[];
|
|
721
|
+
/**
|
|
722
|
+
* @deprecated Use cr8 instead
|
|
723
|
+
*/
|
|
724
|
+
export declare const AgentBuilder: typeof AgentFactory;
|
|
725
|
+
/**
|
|
726
|
+
* Creates an agent execution engine from a list of workflow steps.
|
|
727
|
+
*
|
|
728
|
+
* This function transforms a list of resolved step definitions into an executable
|
|
729
|
+
* A2A engine that processes contexts through the defined workflow. The engine
|
|
730
|
+
* is an async generator that yields updates as each step completes.
|
|
731
|
+
*
|
|
732
|
+
* **Execution Flow:**
|
|
733
|
+
* 1. Yields "submitted" status update
|
|
734
|
+
* 2. Executes each step in order, yielding transformed results
|
|
735
|
+
* 3. Passes carried args from one step to the next
|
|
736
|
+
* 4. Yields final task on completion
|
|
737
|
+
*
|
|
738
|
+
* @param stepsList - Array of resolved workflow steps (from AgentFactory.steps)
|
|
739
|
+
* @returns A2A.Engine async generator function
|
|
740
|
+
* @throws Error if stepsList is empty
|
|
741
|
+
*
|
|
742
|
+
* @example
|
|
743
|
+
* ```typescript
|
|
744
|
+
* // Typically accessed via AgentFactory
|
|
745
|
+
* const engine = cr8("MyAgent")
|
|
746
|
+
* .text("Hello")
|
|
747
|
+
* .data({ timestamp: Date.now() })
|
|
748
|
+
* .engine;
|
|
749
|
+
*
|
|
750
|
+
* // Or create manually from steps
|
|
751
|
+
* const engine = createStepEngine(factory.steps);
|
|
752
|
+
*
|
|
753
|
+
* // Execute the engine
|
|
754
|
+
* for await (const update of engine(context)) {
|
|
755
|
+
* console.log(update.kind, update);
|
|
756
|
+
* }
|
|
757
|
+
* ```
|
|
758
|
+
*
|
|
759
|
+
* @public
|
|
760
|
+
* @since 0.5.6
|
|
761
|
+
*/
|
|
762
|
+
export declare function createStepEngine(stepsList: A.Resolved[]): A2A.Engine;
|