@artinet/sdk 0.5.17 → 0.6.0-preview.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -557
- package/dist/browser/browser.d.ts +9 -0
- package/dist/browser/browser.js +10 -0
- package/dist/browser/client/a2a-client.d.ts +127 -0
- package/dist/browser/client/a2a-client.js +233 -0
- package/dist/browser/client/index.d.ts +1 -0
- package/dist/browser/client/index.js +1 -0
- package/dist/browser/config/index.d.ts +158 -0
- package/dist/browser/config/index.js +155 -0
- package/dist/browser/config/observability.d.ts +119 -0
- package/dist/browser/config/observability.js +35 -0
- package/dist/browser/services/a2a/helpers/message-builder.d.ts +17 -0
- package/dist/browser/services/a2a/helpers/message-builder.js +66 -0
- package/dist/browser/transport/rpc/parser.d.ts +15 -0
- package/dist/browser/transport/rpc/parser.js +48 -0
- package/dist/browser/transport/rpc/rpc-client.d.ts +80 -0
- package/dist/browser/transport/rpc/rpc-client.js +189 -0
- package/dist/browser/transport/streaming/event-stream.d.ts +25 -0
- package/dist/browser/transport/streaming/event-stream.js +100 -0
- package/dist/browser/types/a2a/a2a.d.ts +378 -0
- package/dist/browser/types/a2a/a2a.js +14 -0
- package/dist/browser/types/a2a/builder.d.ts +43 -0
- package/dist/browser/types/a2a/index.d.ts +3 -0
- package/dist/browser/types/a2a/index.js +2 -0
- package/dist/{types/interfaces → browser/types}/client.d.ts +25 -27
- package/dist/browser/types/core/core.d.ts +31 -0
- package/dist/browser/types/core/index.d.ts +1 -0
- package/dist/browser/types/core/index.js +1 -0
- package/dist/{types/interfaces/services → browser/types}/index.d.ts +3 -0
- package/dist/{types/interfaces/services → browser/types}/index.js +3 -0
- 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/mcp/mcp.js +5 -0
- package/dist/browser/types/storage.d.ts +21 -0
- package/dist/browser/types/utils/index.d.ts +1 -0
- package/dist/browser/types/utils/index.js +1 -0
- package/dist/browser/types/utils/transform.d.ts +64 -0
- package/dist/browser/types/utils/transform.js +35 -0
- package/dist/browser/utils/common/constants.d.ts +11 -0
- package/dist/browser/utils/common/constants.js +38 -0
- package/dist/browser/utils/common/errors.d.ts +24 -0
- package/dist/browser/utils/common/errors.js +42 -0
- package/dist/browser/utils/common/utils.d.ts +32 -0
- package/dist/browser/utils/common/utils.js +43 -0
- package/dist/client/a2a-client.d.ts +21 -19
- package/dist/client/a2a-client.js +30 -9
- package/dist/config/default.d.ts +50 -0
- package/dist/config/default.js +62 -0
- package/dist/config/index.d.ts +158 -0
- package/dist/config/index.js +155 -0
- package/dist/config/observability.d.ts +119 -0
- package/dist/config/observability.js +35 -0
- package/dist/extensions/otel.d.ts +98 -0
- package/dist/extensions/otel.js +190 -0
- package/dist/extensions/pino.d.ts +44 -0
- package/dist/extensions/pino.js +107 -0
- package/dist/extensions/winston.d.ts +47 -0
- package/dist/extensions/winston.js +114 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/server/express/errors.js +3 -3
- package/dist/server/express/middeware.d.ts +2 -2
- package/dist/server/express/middeware.js +36 -9
- package/dist/server/express/server.d.ts +9 -55
- package/dist/server/express/server.js +51 -32
- package/dist/services/a2a/execute.d.ts +6 -0
- package/dist/services/a2a/execute.js +25 -0
- package/dist/services/a2a/factory/builder.d.ts +21 -80
- package/dist/services/a2a/factory/builder.js +23 -13
- package/dist/services/a2a/factory/context.d.ts +15 -128
- package/dist/services/a2a/factory/context.js +31 -136
- package/dist/services/a2a/factory/handler.d.ts +6 -0
- package/dist/services/a2a/factory/{method.js → handler.js} +2 -2
- package/dist/services/a2a/factory/index.d.ts +1 -2
- package/dist/services/a2a/factory/index.js +1 -2
- package/dist/services/a2a/factory/service.d.ts +20 -7
- package/dist/services/a2a/factory/service.js +4 -4
- package/dist/services/a2a/factory/state-machine.d.ts +11 -0
- package/dist/services/a2a/factory/state-machine.js +66 -0
- package/dist/services/a2a/{state/update → handlers}/artifact.d.ts +4 -4
- package/dist/services/a2a/handlers/cancel-task.d.ts +11 -0
- package/dist/services/a2a/handlers/cancel-task.js +33 -0
- package/dist/services/a2a/handlers/get-task.d.ts +11 -0
- package/dist/services/a2a/handlers/get-task.js +13 -0
- package/dist/services/a2a/handlers/resubscribe-task.d.ts +11 -0
- package/dist/services/a2a/handlers/resubscribe-task.js +56 -0
- package/dist/services/a2a/handlers/send-message.d.ts +11 -0
- package/dist/services/a2a/handlers/send-message.js +35 -0
- package/dist/services/a2a/handlers/stream-message.d.ts +11 -0
- package/dist/services/a2a/handlers/stream-message.js +19 -0
- package/dist/services/a2a/handlers/update.d.ts +17 -0
- package/dist/services/a2a/handlers/update.js +114 -0
- package/dist/services/a2a/helpers/agentcard-builder.d.ts +9 -5
- package/dist/services/a2a/helpers/agentcard-builder.js +5 -0
- package/dist/services/a2a/helpers/content.d.ts +2 -2
- package/dist/services/a2a/helpers/content.js +4 -0
- package/dist/services/a2a/helpers/history.d.ts +6 -0
- package/dist/services/a2a/helpers/history.js +7 -0
- package/dist/services/a2a/helpers/index.d.ts +3 -1
- package/dist/services/a2a/helpers/index.js +3 -1
- package/dist/services/a2a/helpers/message-builder.d.ts +13 -8
- package/dist/services/a2a/helpers/message-builder.js +5 -0
- package/dist/services/a2a/helpers/part.d.ts +9 -9
- package/dist/services/a2a/helpers/references.d.ts +6 -0
- package/dist/services/a2a/helpers/references.js +22 -0
- package/dist/services/a2a/index.d.ts +9 -5
- package/dist/services/a2a/index.js +8 -5
- package/dist/services/a2a/managers.d.ts +23 -0
- package/dist/services/a2a/managers.js +95 -0
- package/dist/services/a2a/messenger.d.ts +35 -0
- package/dist/services/{core/managers/command.js → a2a/messenger.js} +27 -31
- package/dist/services/a2a/service.d.ts +41 -371
- package/dist/services/a2a/service.js +239 -70
- package/dist/services/a2a/state-machine.d.ts +18 -0
- package/dist/services/a2a/state-machine.js +76 -0
- package/dist/services/a2a/streams.d.ts +22 -0
- package/dist/services/a2a/streams.js +98 -0
- package/dist/services/core/index.d.ts +1 -2
- package/dist/services/core/index.js +1 -2
- package/dist/services/core/manager.d.ts +15 -0
- package/dist/services/core/manager.js +42 -0
- package/dist/services/mcp/service.d.ts +11 -15
- package/dist/services/mcp/service.js +16 -16
- 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 -7
- package/dist/transport/rpc/rpc-client.d.ts +5 -5
- package/dist/transport/rpc/rpc-client.js +7 -7
- package/dist/transport/streaming/event-stream.d.ts +3 -3
- package/dist/transport/streaming/event-stream.js +11 -10
- package/dist/transport/trpc/a2a/factory/router.d.ts +479 -871
- package/dist/transport/trpc/a2a/factory/router.js +2 -2
- package/dist/transport/trpc/a2a/routes/info.d.ts +108 -8
- package/dist/transport/trpc/a2a/routes/info.js +6 -2
- package/dist/transport/trpc/a2a/routes/message/route.d.ts +113 -162
- package/dist/transport/trpc/a2a/routes/message/route.js +7 -13
- package/dist/transport/trpc/a2a/routes/tasks/route.d.ts +114 -212
- package/dist/transport/trpc/a2a/routes/tasks/route.js +16 -19
- package/dist/transport/trpc/a2a/trpc.d.ts +9 -253
- package/dist/types/a2a/a2a.d.ts +378 -0
- package/dist/types/a2a/a2a.js +14 -0
- package/dist/types/a2a/builder.d.ts +43 -0
- package/dist/types/a2a/index.d.ts +3 -0
- package/dist/types/a2a/index.js +2 -0
- package/dist/types/client.d.ts +133 -0
- 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/types/mcp/mcp.d.ts +50 -0
- package/dist/types/mcp/mcp.js +5 -0
- package/dist/types/protocol.d.ts +33 -0
- package/dist/types/protocol.js +34 -0
- package/dist/types/storage.d.ts +21 -0
- package/dist/utils/common/constants.d.ts +7 -7
- package/dist/utils/common/constants.js +10 -10
- package/dist/utils/common/errors.d.ts +18 -17
- package/dist/utils/common/errors.js +14 -13
- 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 -0
- package/dist/utils/common/schema-validation.js +12 -0
- 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 +3 -3
- package/dist/utils/index.js +3 -3
- package/dist/utils/storage/file.d.ts +8 -17
- package/dist/utils/storage/file.js +44 -73
- package/package.json +86 -23
- package/dist/services/a2a/factory/event.d.ts +0 -58
- package/dist/services/a2a/factory/event.js +0 -177
- package/dist/services/a2a/factory/method.d.ts +0 -6
- package/dist/services/a2a/managers/cancellation.d.ts +0 -11
- package/dist/services/a2a/managers/cancellation.js +0 -16
- package/dist/services/a2a/managers/connection.d.ts +0 -11
- package/dist/services/a2a/managers/connection.js +0 -16
- package/dist/services/a2a/managers/context.d.ts +0 -11
- package/dist/services/a2a/managers/context.js +0 -16
- package/dist/services/a2a/managers/index.d.ts +0 -5
- package/dist/services/a2a/managers/index.js +0 -5
- package/dist/services/a2a/managers/task.d.ts +0 -11
- package/dist/services/a2a/managers/task.js +0 -16
- package/dist/services/a2a/methods/cancel-task.d.ts +0 -7
- package/dist/services/a2a/methods/cancel-task.js +0 -43
- package/dist/services/a2a/methods/get-task.d.ts +0 -112
- package/dist/services/a2a/methods/get-task.js +0 -14
- 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 -19
- package/dist/services/a2a/methods/stream-message.d.ts +0 -8
- package/dist/services/a2a/methods/stream-message.js +0 -21
- package/dist/services/a2a/state/index.d.ts +0 -3
- package/dist/services/a2a/state/index.js +0 -3
- package/dist/services/a2a/state/load.d.ts +0 -14
- package/dist/services/a2a/state/load.js +0 -71
- package/dist/services/a2a/state/process.d.ts +0 -7
- package/dist/services/a2a/state/process.js +0 -13
- package/dist/services/a2a/state/update/index.d.ts +0 -2
- package/dist/services/a2a/state/update/index.js +0 -2
- package/dist/services/a2a/state/update/update.d.ts +0 -23
- package/dist/services/a2a/state/update/update.js +0 -123
- package/dist/services/core/execution/execute.d.ts +0 -6
- package/dist/services/core/execution/execute.js +0 -25
- package/dist/services/core/execution/index.d.ts +0 -1
- package/dist/services/core/execution/index.js +0 -1
- package/dist/services/core/managers/command.d.ts +0 -39
- package/dist/services/core/managers/event.d.ts +0 -18
- package/dist/services/core/managers/event.js +0 -56
- package/dist/services/core/managers/index.d.ts +0 -3
- package/dist/services/core/managers/index.js +0 -3
- package/dist/services/core/managers/stream.d.ts +0 -20
- package/dist/services/core/managers/stream.js +0 -77
- package/dist/types/ext.d.ts +0 -13
- package/dist/types/ext.js +0 -10
- package/dist/types/interfaces/index.d.ts +0 -3
- package/dist/types/interfaces/index.js +0 -3
- package/dist/types/interfaces/services/a2a/builder.d.ts +0 -37
- package/dist/types/interfaces/services/a2a/context.d.ts +0 -162
- package/dist/types/interfaces/services/a2a/engine.d.ts +0 -7
- 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/service.d.ts +0 -409
- 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/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/{types/interfaces/services → browser/types}/a2a/builder.js +0 -0
- /package/dist/{types/interfaces → browser/types}/client.js +0 -0
- /package/dist/{types/interfaces/services/core/managers/task.js → browser/types/core/core.js} +0 -0
- /package/dist/{types/interfaces/services → browser/types}/protocol.d.ts +0 -0
- /package/dist/{types/interfaces/services → browser/types}/protocol.js +0 -0
- /package/dist/{types/interfaces → browser/types}/storage.js +0 -0
- /package/dist/services/a2a/{state/update → handlers}/artifact.js +0 -0
- /package/dist/services/a2a/{methods → handlers}/index.d.ts +0 -0
- /package/dist/services/a2a/{methods → handlers}/index.js +0 -0
- /package/dist/types/{interfaces/services/a2a/context.js → a2a/builder.js} +0 -0
- /package/dist/types/{interfaces/services/a2a/engine.js → client.js} +0 -0
- /package/dist/types/{interfaces/services/a2a/legacy.js → storage.js} +0 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 The Artinet Project
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @fileoverview MCP Service Interface Definition
|
|
7
|
+
*
|
|
8
|
+
* This module defines the MCP service interface that all MCP services
|
|
9
|
+
* must implement. It provides the contract for registering base tools and
|
|
10
|
+
* managing service lifecycle.
|
|
11
|
+
*
|
|
12
|
+
* @module MCPService
|
|
13
|
+
* @version 0.6.0-preview
|
|
14
|
+
* @since 0.5.7
|
|
15
|
+
* @author The Artinet Project
|
|
16
|
+
*/
|
|
17
|
+
import { core } from "../core/index.js";
|
|
18
|
+
/**
|
|
19
|
+
* Main interface for MCP service implementations.
|
|
20
|
+
*
|
|
21
|
+
* This interface extends the core ServiceInterface to provide
|
|
22
|
+
* a complete MCP service implementation. It includes base tool registration.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* class MyMCPService implements MCPServiceInterface {
|
|
27
|
+
* constructor(
|
|
28
|
+
* public agentCard: AgentCard,
|
|
29
|
+
* // ... other dependencies
|
|
30
|
+
* ) {}
|
|
31
|
+
*
|
|
32
|
+
* registerTools(uri: string) {
|
|
33
|
+
* // Register tools
|
|
34
|
+
* }
|
|
35
|
+
*
|
|
36
|
+
* // ... implement other MCP service methods
|
|
37
|
+
* }
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @public
|
|
41
|
+
* @since 0.5.7
|
|
42
|
+
*/
|
|
43
|
+
export interface Service extends Omit<core.Service, "execute"> {
|
|
44
|
+
/**
|
|
45
|
+
* Registers tools for the MCP service.
|
|
46
|
+
* @param uri - The URI of the agent card resource.
|
|
47
|
+
*/
|
|
48
|
+
registerTools?: (uri: string) => void;
|
|
49
|
+
}
|
|
50
|
+
export * from "@artinet/types/mcp";
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 The Artinet Project
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @description The protocol enum.
|
|
7
|
+
*/
|
|
8
|
+
export declare enum Protocol {
|
|
9
|
+
/**
|
|
10
|
+
* @description The A2A protocol.
|
|
11
|
+
*/
|
|
12
|
+
A2A = "a2a",
|
|
13
|
+
/**
|
|
14
|
+
* @description The MCP protocol.
|
|
15
|
+
*/
|
|
16
|
+
MCP = "mcp",
|
|
17
|
+
/**
|
|
18
|
+
* @description The ACP protocol.
|
|
19
|
+
*/
|
|
20
|
+
ACP = "acp",
|
|
21
|
+
/**
|
|
22
|
+
* @description The CHAT protocol.
|
|
23
|
+
*/
|
|
24
|
+
CHAT = "chat",
|
|
25
|
+
/**
|
|
26
|
+
* @description The NLWeb protocol.
|
|
27
|
+
*/
|
|
28
|
+
NLWEB = "nlweb",
|
|
29
|
+
/**
|
|
30
|
+
* @description The custom protocol for user-defined services.
|
|
31
|
+
*/
|
|
32
|
+
CUSTOM = "custom"
|
|
33
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 The Artinet Project
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @description The protocol enum.
|
|
7
|
+
*/
|
|
8
|
+
export var Protocol;
|
|
9
|
+
(function (Protocol) {
|
|
10
|
+
/**
|
|
11
|
+
* @description The A2A protocol.
|
|
12
|
+
*/
|
|
13
|
+
Protocol["A2A"] = "a2a";
|
|
14
|
+
/**
|
|
15
|
+
* @description The MCP protocol.
|
|
16
|
+
*/
|
|
17
|
+
Protocol["MCP"] = "mcp";
|
|
18
|
+
/**
|
|
19
|
+
* @description The ACP protocol.
|
|
20
|
+
*/
|
|
21
|
+
Protocol["ACP"] = "acp";
|
|
22
|
+
/**
|
|
23
|
+
* @description The CHAT protocol.
|
|
24
|
+
*/
|
|
25
|
+
Protocol["CHAT"] = "chat";
|
|
26
|
+
/**
|
|
27
|
+
* @description The NLWeb protocol.
|
|
28
|
+
*/
|
|
29
|
+
Protocol["NLWEB"] = "nlweb";
|
|
30
|
+
/**
|
|
31
|
+
* @description The custom protocol for user-defined services.
|
|
32
|
+
*/
|
|
33
|
+
Protocol["CUSTOM"] = "custom";
|
|
34
|
+
})(Protocol || (Protocol = {}));
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 The Artinet Project
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Interface for a store of data.
|
|
7
|
+
* @deprecated Use IStore instead
|
|
8
|
+
* @template T - The type of data to store
|
|
9
|
+
*/
|
|
10
|
+
export interface Store<T> {
|
|
11
|
+
set(data: T, id?: string): Promise<void>;
|
|
12
|
+
get(id: string): Promise<T | undefined>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Interface for a store of data.
|
|
16
|
+
* @template T - The type of data to store
|
|
17
|
+
*/
|
|
18
|
+
export interface IStore<T> {
|
|
19
|
+
set(id: string, data: T): Promise<void>;
|
|
20
|
+
get(id: string): Promise<T | undefined>;
|
|
21
|
+
}
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* Copyright 2025 The Artinet Project
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
6
|
-
export declare const STATUS_UPDATE: (taskId: string, contextId: string, status: TaskState, message?: Message, timestamp?: string, final?: boolean) => TaskStatusUpdateEvent;
|
|
7
|
-
export declare const WORKING_UPDATE: (taskId: string, contextId: string, message?: Message, timestamp?: string) => TaskStatusUpdateEvent;
|
|
8
|
-
export declare const CANCEL_UPDATE: (taskId: string, contextId: string, message?: Message, timestamp?: string) => TaskStatusUpdateEvent;
|
|
9
|
-
export declare const SUBMITTED_UPDATE: (taskId: string, contextId: string, message?: Message, timestamp?: string) => TaskStatusUpdateEvent;
|
|
10
|
-
export declare const FAILED_UPDATE_EVENT: (taskId: string, contextId: string, message?: Message, timestamp?: string) => TaskStatusUpdateEvent;
|
|
11
|
-
export declare const FINAL_STATES: TaskState[];
|
|
5
|
+
import { A2A } from "../../types/index.js";
|
|
6
|
+
export declare const STATUS_UPDATE: (taskId: string, contextId: string, status: A2A.TaskState, message?: A2A.Message, timestamp?: string, final?: boolean) => A2A.TaskStatusUpdateEvent;
|
|
7
|
+
export declare const WORKING_UPDATE: (taskId: string, contextId: string, message?: A2A.Message, timestamp?: string) => A2A.TaskStatusUpdateEvent;
|
|
8
|
+
export declare const CANCEL_UPDATE: (taskId: string, contextId: string, message?: A2A.Message, timestamp?: string) => A2A.TaskStatusUpdateEvent;
|
|
9
|
+
export declare const SUBMITTED_UPDATE: (taskId: string, contextId: string, message?: A2A.Message, timestamp?: string) => A2A.TaskStatusUpdateEvent;
|
|
10
|
+
export declare const FAILED_UPDATE_EVENT: (taskId: string, contextId: string, message?: A2A.Message, timestamp?: string) => A2A.TaskStatusUpdateEvent;
|
|
11
|
+
export declare const FINAL_STATES: A2A.TaskState[];
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Copyright 2025 The Artinet Project
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
6
|
-
import { getCurrentTimestamp } from "
|
|
5
|
+
import { A2A } from "../../types/index.js";
|
|
6
|
+
import { getCurrentTimestamp } from "./utils.js";
|
|
7
7
|
//todo: protocol specific so move to a2a folder
|
|
8
8
|
export const STATUS_UPDATE = (taskId, contextId, status, message, timestamp = getCurrentTimestamp(), final = false) => {
|
|
9
9
|
return {
|
|
@@ -19,20 +19,20 @@ export const STATUS_UPDATE = (taskId, contextId, status, message, timestamp = ge
|
|
|
19
19
|
};
|
|
20
20
|
};
|
|
21
21
|
export const WORKING_UPDATE = (taskId, contextId, message, timestamp) => {
|
|
22
|
-
return STATUS_UPDATE(taskId, contextId, TaskState.working, message, timestamp);
|
|
22
|
+
return STATUS_UPDATE(taskId, contextId, A2A.TaskState.working, message, timestamp);
|
|
23
23
|
};
|
|
24
24
|
export const CANCEL_UPDATE = (taskId, contextId, message, timestamp) => {
|
|
25
|
-
return STATUS_UPDATE(taskId, contextId, TaskState.canceled, message, timestamp, true);
|
|
25
|
+
return STATUS_UPDATE(taskId, contextId, A2A.TaskState.canceled, message, timestamp, true);
|
|
26
26
|
};
|
|
27
27
|
export const SUBMITTED_UPDATE = (taskId, contextId, message, timestamp) => {
|
|
28
|
-
return STATUS_UPDATE(taskId, contextId, TaskState.submitted, message, timestamp);
|
|
28
|
+
return STATUS_UPDATE(taskId, contextId, A2A.TaskState.submitted, message, timestamp);
|
|
29
29
|
};
|
|
30
30
|
export const FAILED_UPDATE_EVENT = (taskId, contextId, message, timestamp) => {
|
|
31
|
-
return STATUS_UPDATE(taskId, contextId, TaskState.failed, message, timestamp, true);
|
|
31
|
+
return STATUS_UPDATE(taskId, contextId, A2A.TaskState.failed, message, timestamp, true);
|
|
32
32
|
};
|
|
33
33
|
export const FINAL_STATES = [
|
|
34
|
-
TaskState.completed,
|
|
35
|
-
TaskState.failed,
|
|
36
|
-
TaskState.canceled,
|
|
37
|
-
TaskState.rejected,
|
|
34
|
+
A2A.TaskState.completed,
|
|
35
|
+
A2A.TaskState.failed,
|
|
36
|
+
A2A.TaskState.canceled,
|
|
37
|
+
A2A.TaskState.rejected,
|
|
38
38
|
];
|
|
@@ -2,22 +2,23 @@
|
|
|
2
2
|
* Copyright 2025 The Artinet Project
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
6
|
-
export declare class SystemError<T extends JSONRPCError> extends Error {
|
|
5
|
+
import { A2A, MCP } from "../../types/index.js";
|
|
6
|
+
export declare class SystemError<T extends MCP.JSONRPCError> extends Error {
|
|
7
7
|
message: string;
|
|
8
|
-
code: T["code"];
|
|
9
|
-
data: T["data"];
|
|
10
|
-
constructor(message: string, code: T["code"], data: T["data"]);
|
|
8
|
+
code: T["error"]["code"];
|
|
9
|
+
data: T["error"]["data"];
|
|
10
|
+
constructor(message: string, code: T["error"]["code"], data: T["error"]["data"]);
|
|
11
11
|
}
|
|
12
|
-
export declare const PARSE_ERROR: <T extends JSONParseError>(data: T["data"]) => SystemError<T>;
|
|
13
|
-
export declare const INVALID_REQUEST: <T extends InvalidRequestError>(data: T["data"]) => SystemError<T>;
|
|
14
|
-
export declare const METHOD_NOT_FOUND: <T extends MethodNotFoundError>(data: T["data"]) => SystemError<T>;
|
|
15
|
-
export declare const INVALID_PARAMS: <T extends InvalidParamsError>(data: T["data"]) => SystemError<T>;
|
|
16
|
-
export declare const INTERNAL_ERROR: <T extends InternalError>(data: T["data"]) => SystemError<T>;
|
|
17
|
-
export declare const TASK_NOT_FOUND: <T extends TaskNotFoundError>(data: T["data"]) => SystemError<T>;
|
|
18
|
-
export declare const TASK_NOT_CANCELABLE: <T extends TaskNotCancelableError>(data: T["data"]) => SystemError<T>;
|
|
19
|
-
export declare const PUSH_NOTIFICATION_NOT_SUPPORTED: <T extends A2AError>(data: T["data"]) => SystemError<T>;
|
|
20
|
-
export declare const
|
|
21
|
-
export declare const
|
|
22
|
-
export declare const
|
|
23
|
-
export declare const
|
|
12
|
+
export declare const PARSE_ERROR: <T extends A2A.JSONParseError>(data: T["error"]["data"]) => SystemError<T>;
|
|
13
|
+
export declare const INVALID_REQUEST: <T extends A2A.InvalidRequestError>(data: T["error"]["data"]) => SystemError<T>;
|
|
14
|
+
export declare const METHOD_NOT_FOUND: <T extends A2A.MethodNotFoundError>(data: T["error"]["data"]) => SystemError<T>;
|
|
15
|
+
export declare const INVALID_PARAMS: <T extends A2A.InvalidParamsError>(data: T["error"]["data"]) => SystemError<T>;
|
|
16
|
+
export declare const INTERNAL_ERROR: <T extends A2A.InternalError>(data: T["error"]["data"]) => SystemError<T>;
|
|
17
|
+
export declare const TASK_NOT_FOUND: <T extends A2A.TaskNotFoundError>(data: T["error"]["data"]) => SystemError<T>;
|
|
18
|
+
export declare const TASK_NOT_CANCELABLE: <T extends A2A.TaskNotCancelableError>(data: T["error"]["data"]) => SystemError<T>;
|
|
19
|
+
export declare const PUSH_NOTIFICATION_NOT_SUPPORTED: <T extends A2A.A2AError>(data: T["error"]["data"]) => SystemError<T>;
|
|
20
|
+
export declare const AUTHENTICATED_EXTENDED_CARD_NOT_CONFIGURED: <T extends A2A.AuthenticatedExtendedCardNotConfiguredError>(data: T["error"]["data"]) => SystemError<T>;
|
|
21
|
+
export declare const UNSUPPORTED_OPERATION: <T extends A2A.A2AError>(data: T["error"]["data"]) => SystemError<T>;
|
|
22
|
+
export declare const CONTENT_TYPE_NOT_SUPPORTED: <T extends A2A.ContentTypeNotSupportedError>(data: T["error"]["data"]) => SystemError<T>;
|
|
23
|
+
export declare const INVALID_AGENT_RESPONSE: <T extends A2A.InvalidAgentResponseError>(data: T["error"]["data"]) => SystemError<T>;
|
|
24
|
+
export declare const FAILED_UPDATE: (taskId: string, contextId: string, messageId: string | undefined, errMessage: string) => A2A.TaskStatusUpdateEvent;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright 2025 The Artinet Project
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
5
|
+
import { A2A } from "../../types/index.js";
|
|
6
6
|
export class SystemError extends Error {
|
|
7
7
|
message;
|
|
8
8
|
code;
|
|
@@ -16,24 +16,25 @@ export class SystemError extends Error {
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
// Factory methods for common errors
|
|
19
|
-
export const PARSE_ERROR = (data) => new SystemError("Invalid JSON payload", ErrorCodeParseError, data);
|
|
20
|
-
export const INVALID_REQUEST = (data) => new SystemError("Request payload validation error", ErrorCodeInvalidRequest, data);
|
|
21
|
-
export const METHOD_NOT_FOUND = (data) => new SystemError("Method not found", ErrorCodeMethodNotFound, data);
|
|
22
|
-
export const INVALID_PARAMS = (data) => new SystemError("Invalid parameters", ErrorCodeInvalidParams, data);
|
|
23
|
-
export const INTERNAL_ERROR = (data) => new SystemError("Internal error", ErrorCodeInternalError, data);
|
|
24
|
-
export const TASK_NOT_FOUND = (data) => new SystemError("Task not found", ErrorCodeTaskNotFound, data);
|
|
25
|
-
export const TASK_NOT_CANCELABLE = (data) => new SystemError("Task cannot be canceled", ErrorCodeTaskNotCancelable, data);
|
|
26
|
-
export const PUSH_NOTIFICATION_NOT_SUPPORTED = (data) => new SystemError("Push Notifications is not supported", ErrorCodePushNotificationNotSupported, data);
|
|
27
|
-
export const
|
|
28
|
-
export const
|
|
29
|
-
export const
|
|
19
|
+
export const PARSE_ERROR = (data) => new SystemError("Invalid JSON payload", A2A.ErrorCodeParseError, data);
|
|
20
|
+
export const INVALID_REQUEST = (data) => new SystemError("Request payload validation error", A2A.ErrorCodeInvalidRequest, data);
|
|
21
|
+
export const METHOD_NOT_FOUND = (data) => new SystemError("Method not found", A2A.ErrorCodeMethodNotFound, data);
|
|
22
|
+
export const INVALID_PARAMS = (data) => new SystemError("Invalid parameters", A2A.ErrorCodeInvalidParams, data);
|
|
23
|
+
export const INTERNAL_ERROR = (data) => new SystemError("Internal error", A2A.ErrorCodeInternalError, data);
|
|
24
|
+
export const TASK_NOT_FOUND = (data) => new SystemError("Task not found", A2A.ErrorCodeTaskNotFound, data);
|
|
25
|
+
export const TASK_NOT_CANCELABLE = (data) => new SystemError("Task cannot be canceled", A2A.ErrorCodeTaskNotCancelable, data);
|
|
26
|
+
export const PUSH_NOTIFICATION_NOT_SUPPORTED = (data) => new SystemError("Push Notifications is not supported", A2A.ErrorCodePushNotificationNotSupported, data);
|
|
27
|
+
export const AUTHENTICATED_EXTENDED_CARD_NOT_CONFIGURED = (data) => new SystemError("Authenticated Extended Card is not configured", A2A.ErrorCodeAuthenticatedExtendedCardNotConfigured, data);
|
|
28
|
+
export const UNSUPPORTED_OPERATION = (data) => new SystemError("This operation is not supported", A2A.ErrorCodeUnsupportedOperation, data);
|
|
29
|
+
export const CONTENT_TYPE_NOT_SUPPORTED = (data) => new SystemError("Content type not supported", A2A.ErrorCodeContentTypeNotSupported, data);
|
|
30
|
+
export const INVALID_AGENT_RESPONSE = (data) => new SystemError("Invalid agent response", A2A.ErrorCodeInvalidAgentResponse, data);
|
|
30
31
|
export const FAILED_UPDATE = (taskId, contextId, messageId = "failed-update", errMessage) => ({
|
|
31
32
|
taskId,
|
|
32
33
|
contextId,
|
|
33
34
|
kind: "status-update",
|
|
34
35
|
final: true,
|
|
35
36
|
status: {
|
|
36
|
-
state: TaskState.failed,
|
|
37
|
+
state: A2A.TaskState.failed,
|
|
37
38
|
message: {
|
|
38
39
|
messageId,
|
|
39
40
|
role: "agent",
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 The Artinet Project
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
import { z } from "zod/v4";
|
|
6
|
+
export declare function safeParse<T = any>(json: string): T;
|
|
7
|
+
export declare function safeParseSchema<T extends z.ZodSchema>(json: string, schema: T): Promise<z.infer<T>>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { validateSchema } from "./schema-validation.js";
|
|
2
|
+
import { logger } from "../../config/index.js";
|
|
3
|
+
export function safeParse(json) {
|
|
4
|
+
try {
|
|
5
|
+
return JSON.parse(json);
|
|
6
|
+
}
|
|
7
|
+
catch (error) {
|
|
8
|
+
logger.warn("safeParse error:", error, json);
|
|
9
|
+
return {};
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export async function safeParseSchema(json, schema) {
|
|
13
|
+
return await validateSchema(schema, safeParse(json));
|
|
14
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 The Artinet Project
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
import { INVALID_PARAMS } from "../index.js";
|
|
6
|
+
import { logger } from "../../config/index.js";
|
|
7
|
+
export async function validateSchema(schema, data) {
|
|
8
|
+
return await schema.parseAsync(data).catch((error) => {
|
|
9
|
+
logger.error("Schema validation failed", error);
|
|
10
|
+
throw INVALID_PARAMS(error);
|
|
11
|
+
});
|
|
12
|
+
}
|
|
@@ -7,3 +7,26 @@
|
|
|
7
7
|
* @returns The current timestamp as a string.
|
|
8
8
|
*/
|
|
9
9
|
export declare function getCurrentTimestamp(): string;
|
|
10
|
+
/**
|
|
11
|
+
* Sleeps for a given number of milliseconds.
|
|
12
|
+
* @param ms - The number of milliseconds to sleep.
|
|
13
|
+
* @returns A promise that resolves when the sleep is complete.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* await sleep(1000);
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare function sleep(ms: number): Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* Formats a JSON object into a string with indentation.
|
|
23
|
+
* @param json - The JSON object to format.
|
|
24
|
+
* @returns A string representation of the JSON object.
|
|
25
|
+
*/
|
|
26
|
+
export declare function formatJson(json: object): string;
|
|
27
|
+
/**
|
|
28
|
+
* Formats an error into a standard error object for logging.
|
|
29
|
+
* @param error - The error to format.
|
|
30
|
+
* @returns A standard error object.
|
|
31
|
+
*/
|
|
32
|
+
export declare function formatError(error: unknown): Error;
|
|
@@ -9,3 +9,35 @@
|
|
|
9
9
|
export function getCurrentTimestamp() {
|
|
10
10
|
return new Date().toISOString();
|
|
11
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* Sleeps for a given number of milliseconds.
|
|
14
|
+
* @param ms - The number of milliseconds to sleep.
|
|
15
|
+
* @returns A promise that resolves when the sleep is complete.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* await sleep(1000);
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export function sleep(ms) {
|
|
23
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Formats a JSON object into a string with indentation.
|
|
27
|
+
* @param json - The JSON object to format.
|
|
28
|
+
* @returns A string representation of the JSON object.
|
|
29
|
+
*/
|
|
30
|
+
export function formatJson(json) {
|
|
31
|
+
return JSON.stringify(json, null, 2);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Formats an error into a standard error object for logging.
|
|
35
|
+
* @param error - The error to format.
|
|
36
|
+
* @returns A standard error object.
|
|
37
|
+
*/
|
|
38
|
+
export function formatError(error) {
|
|
39
|
+
if (error instanceof Error) {
|
|
40
|
+
return error;
|
|
41
|
+
}
|
|
42
|
+
return new Error(String(error));
|
|
43
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TrackedEnvelope } from "@trpc/server";
|
|
2
|
-
import { z } from "zod";
|
|
2
|
+
import { z } from "zod/v3";
|
|
3
3
|
/**
|
|
4
4
|
* A Zod schema helper designed specifically for validating async iterables. This schema ensures that:
|
|
5
5
|
* 1. The value being validated is an async iterable.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { isTrackedEnvelope, tracked } from "@trpc/server";
|
|
2
|
-
import { z } from "zod";
|
|
2
|
+
import { z } from "zod/v3";
|
|
3
|
+
//!Maintain for backwards compatibility
|
|
3
4
|
// v3 version of: https://trpc.io/docs/server/subscriptions#output-validation
|
|
4
5
|
function isAsyncIterable(value) {
|
|
5
6
|
return !!value && typeof value === "object" && Symbol.asyncIterator in value;
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export * from "./common/constants.js";
|
|
6
6
|
export * from "./common/errors.js";
|
|
7
|
+
export * from "./common/schema-validation.js";
|
|
7
8
|
export * from "./common/utils.js";
|
|
8
|
-
export * from "./common/zAsyncIterable
|
|
9
|
-
export * from "./
|
|
9
|
+
export * from "./common/zAsyncIterable.js";
|
|
10
|
+
export * from "./common/parse.js";
|
|
10
11
|
export * from "./storage/file.js";
|
|
11
|
-
export * from "./storage/memory.js";
|
package/dist/utils/index.js
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export * from "./common/constants.js";
|
|
6
6
|
export * from "./common/errors.js";
|
|
7
|
+
export * from "./common/schema-validation.js";
|
|
7
8
|
export * from "./common/utils.js";
|
|
8
|
-
export * from "./common/zAsyncIterable
|
|
9
|
-
export * from "./
|
|
9
|
+
export * from "./common/zAsyncIterable.js";
|
|
10
|
+
export * from "./common/parse.js";
|
|
10
11
|
export * from "./storage/file.js";
|
|
11
|
-
export * from "./storage/memory.js";
|
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
* Copyright 2025 The Artinet Project
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
5
|
+
import { A2A } from "../../types/index.js";
|
|
6
|
+
import { Tasks } from "../../services/a2a/managers.js";
|
|
6
7
|
/**
|
|
7
8
|
* File-based implementation of the TaskStore interface.
|
|
8
9
|
* Stores tasks and their history as JSON files on disk.
|
|
9
10
|
*/
|
|
10
|
-
export declare class
|
|
11
|
+
export declare class Files extends Tasks {
|
|
11
12
|
private baseDir;
|
|
12
13
|
/**
|
|
13
14
|
* Creates a new FileStore.
|
|
@@ -20,12 +21,6 @@ export declare class FileStore implements TaskManagerInterface<TaskAndHistory> {
|
|
|
20
21
|
* @returns The full file path for the task JSON file
|
|
21
22
|
*/
|
|
22
23
|
private getTaskFilePath;
|
|
23
|
-
/**
|
|
24
|
-
* Constructs the file path for a task's history.
|
|
25
|
-
* @param taskId The task ID
|
|
26
|
-
* @returns The full file path for the history JSON file
|
|
27
|
-
*/
|
|
28
|
-
private getHistoryFilePath;
|
|
29
24
|
/**
|
|
30
25
|
* Ensures the base directory exists.
|
|
31
26
|
* @returns A promise that resolves when the directory exists.
|
|
@@ -44,23 +39,19 @@ export declare class FileStore implements TaskManagerInterface<TaskAndHistory> {
|
|
|
44
39
|
* @returns A promise resolving to the parsed data, or null if the file doesn't exist
|
|
45
40
|
*/
|
|
46
41
|
private readJsonFile;
|
|
47
|
-
/**
|
|
48
|
-
* Type guard to validate the structure of history file content.
|
|
49
|
-
* @param content The content to check
|
|
50
|
-
* @returns True if the content is a valid history file content
|
|
51
|
-
*/
|
|
52
|
-
private isHistoryFileContent;
|
|
53
42
|
/**
|
|
54
43
|
* Loads a task and its history by task ID.
|
|
55
44
|
* @param taskId The ID of the task to load.
|
|
56
45
|
* @returns A promise resolving to the task and history, or null if not found.
|
|
57
46
|
*/
|
|
58
|
-
|
|
47
|
+
get(taskId: string): Promise<A2A.Task | undefined>;
|
|
59
48
|
/**
|
|
60
49
|
* Saves a task and its history.
|
|
61
50
|
* @param data The task and history to save.
|
|
62
51
|
* @returns A promise that resolves when the save is complete.
|
|
63
52
|
*/
|
|
64
|
-
|
|
65
|
-
|
|
53
|
+
set(taskId: string, task?: A2A.Task): Promise<void>;
|
|
54
|
+
delete(taskId: string): Promise<void>;
|
|
55
|
+
has(taskId: string): Promise<boolean>;
|
|
56
|
+
list(): Promise<A2A.Task[]>;
|
|
66
57
|
}
|