@artinet/sdk 0.5.16 → 0.5.18

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.
Files changed (175) hide show
  1. package/README.md +108 -58
  2. package/dist/browser/browser.d.ts +9 -0
  3. package/dist/browser/browser.js +10 -0
  4. package/dist/browser/client/a2a-client.d.ts +126 -0
  5. package/dist/browser/client/a2a-client.js +221 -0
  6. package/dist/browser/client/index.d.ts +1 -0
  7. package/dist/browser/client/index.js +1 -0
  8. package/dist/browser/services/a2a/helpers/message-builder.d.ts +12 -0
  9. package/dist/browser/services/a2a/helpers/message-builder.js +61 -0
  10. package/dist/browser/transport/rpc/parser.d.ts +15 -0
  11. package/dist/browser/transport/rpc/parser.js +48 -0
  12. package/dist/browser/transport/rpc/rpc-client.d.ts +80 -0
  13. package/dist/browser/transport/rpc/rpc-client.js +189 -0
  14. package/dist/browser/transport/streaming/event-stream.d.ts +25 -0
  15. package/dist/browser/transport/streaming/event-stream.js +99 -0
  16. package/dist/browser/types/ext.d.ts +13 -0
  17. package/dist/browser/types/ext.js +10 -0
  18. package/dist/browser/types/index.d.ts +4 -0
  19. package/dist/browser/types/index.js +4 -0
  20. package/dist/browser/types/interfaces/client.d.ts +135 -0
  21. package/dist/browser/types/interfaces/client.js +5 -0
  22. package/dist/browser/types/interfaces/index.d.ts +3 -0
  23. package/dist/browser/types/interfaces/index.js +3 -0
  24. package/dist/browser/types/interfaces/services/a2a/builder.d.ts +37 -0
  25. package/dist/browser/types/interfaces/services/a2a/builder.js +5 -0
  26. package/dist/browser/types/interfaces/services/a2a/context.d.ts +162 -0
  27. package/dist/browser/types/interfaces/services/a2a/context.js +5 -0
  28. package/dist/browser/types/interfaces/services/a2a/engine.d.ts +7 -0
  29. package/dist/browser/types/interfaces/services/a2a/engine.js +5 -0
  30. package/dist/browser/types/interfaces/services/a2a/index.d.ts +5 -0
  31. package/dist/browser/types/interfaces/services/a2a/index.js +5 -0
  32. package/dist/browser/types/interfaces/services/a2a/legacy.d.ts +93 -0
  33. package/dist/browser/types/interfaces/services/a2a/legacy.js +5 -0
  34. package/dist/browser/types/interfaces/services/a2a/service.d.ts +413 -0
  35. package/dist/browser/types/interfaces/services/a2a/service.js +5 -0
  36. package/dist/browser/types/interfaces/services/core/context/command.d.ts +25 -0
  37. package/dist/browser/types/interfaces/services/core/context/command.js +5 -0
  38. package/dist/browser/types/interfaces/services/core/context/context.d.ts +207 -0
  39. package/dist/browser/types/interfaces/services/core/context/context.js +5 -0
  40. package/dist/browser/types/interfaces/services/core/context/index.d.ts +3 -0
  41. package/dist/browser/types/interfaces/services/core/context/index.js +3 -0
  42. package/dist/browser/types/interfaces/services/core/context/types.d.ts +11 -0
  43. package/dist/browser/types/interfaces/services/core/context/types.js +5 -0
  44. package/dist/browser/types/interfaces/services/core/execution/engine.d.ts +106 -0
  45. package/dist/browser/types/interfaces/services/core/execution/engine.js +5 -0
  46. package/dist/browser/types/interfaces/services/core/execution/environment.d.ts +11 -0
  47. package/dist/browser/types/interfaces/services/core/execution/environment.js +5 -0
  48. package/dist/browser/types/interfaces/services/core/execution/execute.d.ts +7 -0
  49. package/dist/browser/types/interfaces/services/core/execution/execute.js +5 -0
  50. package/dist/browser/types/interfaces/services/core/execution/index.d.ts +3 -0
  51. package/dist/browser/types/interfaces/services/core/execution/index.js +3 -0
  52. package/dist/browser/types/interfaces/services/core/index.d.ts +4 -0
  53. package/dist/browser/types/interfaces/services/core/index.js +4 -0
  54. package/dist/browser/types/interfaces/services/core/managers/cancellation.d.ts +9 -0
  55. package/dist/browser/types/interfaces/services/core/managers/cancellation.js +5 -0
  56. package/dist/browser/types/interfaces/services/core/managers/connection.d.ts +9 -0
  57. package/dist/browser/types/interfaces/services/core/managers/connection.js +5 -0
  58. package/dist/browser/types/interfaces/services/core/managers/context.d.ts +17 -0
  59. package/dist/browser/types/interfaces/services/core/managers/context.js +5 -0
  60. package/dist/browser/types/interfaces/services/core/managers/event.d.ts +328 -0
  61. package/dist/browser/types/interfaces/services/core/managers/event.js +5 -0
  62. package/dist/browser/types/interfaces/services/core/managers/index.d.ts +6 -0
  63. package/dist/browser/types/interfaces/services/core/managers/index.js +6 -0
  64. package/dist/browser/types/interfaces/services/core/managers/stream.d.ts +217 -0
  65. package/dist/browser/types/interfaces/services/core/managers/stream.js +5 -0
  66. package/dist/browser/types/interfaces/services/core/managers/task.d.ts +9 -0
  67. package/dist/browser/types/interfaces/services/core/managers/task.js +1 -0
  68. package/dist/browser/types/interfaces/services/core/service.d.ts +115 -0
  69. package/dist/browser/types/interfaces/services/core/service.js +5 -0
  70. package/dist/browser/types/interfaces/services/index.d.ts +4 -0
  71. package/dist/browser/types/interfaces/services/index.js +4 -0
  72. package/dist/browser/types/interfaces/services/mcp/index.d.ts +1 -0
  73. package/dist/browser/types/interfaces/services/mcp/index.js +1 -0
  74. package/dist/browser/types/interfaces/services/mcp/service.d.ts +49 -0
  75. package/dist/browser/types/interfaces/services/mcp/service.js +5 -0
  76. package/dist/browser/types/interfaces/services/protocol.d.ts +33 -0
  77. package/dist/browser/types/interfaces/services/protocol.js +34 -0
  78. package/dist/browser/types/interfaces/storage.d.ts +8 -0
  79. package/dist/browser/types/interfaces/storage.js +5 -0
  80. package/dist/browser/types/schemas/a2a/agent.d.ts +2583 -0
  81. package/dist/browser/types/schemas/a2a/agent.js +323 -0
  82. package/dist/browser/types/schemas/a2a/auth.d.ts +908 -0
  83. package/dist/browser/types/schemas/a2a/auth.js +283 -0
  84. package/dist/browser/types/schemas/a2a/error.d.ts +396 -0
  85. package/dist/browser/types/schemas/a2a/error.js +163 -0
  86. package/dist/browser/types/schemas/a2a/index.d.ts +11 -0
  87. package/dist/browser/types/schemas/a2a/index.js +11 -0
  88. package/dist/browser/types/schemas/a2a/kind.d.ts +11 -0
  89. package/dist/browser/types/schemas/a2a/kind.js +20 -0
  90. package/dist/browser/types/schemas/a2a/message.d.ts +10343 -0
  91. package/dist/browser/types/schemas/a2a/message.js +130 -0
  92. package/dist/browser/types/schemas/a2a/notification.d.ts +1517 -0
  93. package/dist/browser/types/schemas/a2a/notification.js +203 -0
  94. package/dist/browser/types/schemas/a2a/parameters.d.ts +956 -0
  95. package/dist/browser/types/schemas/a2a/parameters.js +241 -0
  96. package/dist/browser/types/schemas/a2a/protocol.d.ts +14363 -0
  97. package/dist/browser/types/schemas/a2a/protocol.js +59 -0
  98. package/dist/browser/types/schemas/a2a/rpc.d.ts +182 -0
  99. package/dist/browser/types/schemas/a2a/rpc.js +126 -0
  100. package/dist/browser/types/schemas/a2a/task.d.ts +5886 -0
  101. package/dist/browser/types/schemas/a2a/task.js +134 -0
  102. package/dist/browser/types/schemas/a2a/transport.d.ts +31 -0
  103. package/dist/browser/types/schemas/a2a/transport.js +28 -0
  104. package/dist/browser/types/schemas/index.d.ts +1 -0
  105. package/dist/browser/types/schemas/index.js +1 -0
  106. package/dist/browser/types/utils/index.d.ts +1 -0
  107. package/dist/browser/types/utils/index.js +1 -0
  108. package/dist/browser/types/utils/transform.d.ts +64 -0
  109. package/dist/browser/types/utils/transform.js +35 -0
  110. package/dist/browser/utils/common/constants.d.ts +11 -0
  111. package/dist/browser/utils/common/constants.js +38 -0
  112. package/dist/browser/utils/common/errors.d.ts +24 -0
  113. package/dist/browser/utils/common/errors.js +42 -0
  114. package/dist/browser/utils/common/utils.d.ts +9 -0
  115. package/dist/browser/utils/common/utils.js +11 -0
  116. package/dist/browser/utils/logging/index.d.ts +2 -0
  117. package/dist/browser/utils/logging/index.js +2 -0
  118. package/dist/browser/utils/logging/log.d.ts +33 -0
  119. package/dist/browser/utils/logging/log.js +75 -0
  120. package/dist/browser/utils/logging/logger.d.ts +18 -0
  121. package/dist/browser/utils/logging/logger.js +18 -0
  122. package/dist/client/a2a-client.d.ts +2 -1
  123. package/dist/client/a2a-client.js +13 -4
  124. package/dist/server/express/errors.js +1 -1
  125. package/dist/server/express/middeware.d.ts +2 -2
  126. package/dist/server/express/middeware.js +26 -6
  127. package/dist/server/express/server.d.ts +26 -25
  128. package/dist/server/express/server.js +32 -6
  129. package/dist/services/a2a/factory/builder.d.ts +24 -24
  130. package/dist/services/a2a/factory/builder.js +6 -1
  131. package/dist/services/a2a/factory/service.js +2 -1
  132. package/dist/services/a2a/helpers/agentcard-builder.d.ts +7 -0
  133. package/dist/services/a2a/helpers/agentcard-builder.js +23 -0
  134. package/dist/services/a2a/helpers/history.d.ts +2 -0
  135. package/dist/services/a2a/helpers/history.js +3 -0
  136. package/dist/services/a2a/helpers/index.d.ts +3 -0
  137. package/dist/services/a2a/helpers/index.js +3 -0
  138. package/dist/services/a2a/methods/get-task.d.ts +46 -46
  139. package/dist/services/a2a/methods/get-task.js +2 -0
  140. package/dist/services/a2a/methods/send-message.js +18 -1
  141. package/dist/services/a2a/service.d.ts +154 -153
  142. package/dist/services/a2a/service.js +20 -6
  143. package/dist/services/mcp/service.js +0 -1
  144. package/dist/transport/rpc/parser.js +2 -2
  145. package/dist/transport/rpc/rpc-client.js +2 -2
  146. package/dist/transport/trpc/a2a/factory/router.d.ts +1084 -1084
  147. package/dist/transport/trpc/a2a/routes/info.d.ts +36 -36
  148. package/dist/transport/trpc/a2a/routes/message/route.d.ts +225 -225
  149. package/dist/transport/trpc/a2a/routes/tasks/route.d.ts +257 -257
  150. package/dist/transport/trpc/a2a/trpc.d.ts +120 -120
  151. package/dist/types/interfaces/services/a2a/service.d.ts +6 -1
  152. package/dist/types/schemas/a2a/agent.d.ts +818 -818
  153. package/dist/types/schemas/a2a/agent.js +1 -23
  154. package/dist/types/schemas/a2a/auth.d.ts +197 -197
  155. package/dist/types/schemas/a2a/auth.js +4 -19
  156. package/dist/types/schemas/a2a/error.d.ts +24 -24
  157. package/dist/types/schemas/a2a/message.d.ts +4499 -4499
  158. package/dist/types/schemas/a2a/message.js +2 -10
  159. package/dist/types/schemas/a2a/notification.d.ts +403 -403
  160. package/dist/types/schemas/a2a/notification.js +3 -7
  161. package/dist/types/schemas/a2a/parameters.d.ts +264 -264
  162. package/dist/types/schemas/a2a/parameters.js +1 -14
  163. package/dist/types/schemas/a2a/protocol.d.ts +5988 -5988
  164. package/dist/types/schemas/a2a/rpc.d.ts +20 -20
  165. package/dist/types/schemas/a2a/rpc.js +0 -5
  166. package/dist/types/schemas/a2a/task.d.ts +2513 -2513
  167. package/dist/types/schemas/a2a/task.js +10 -11
  168. package/dist/utils/common/constants.js +1 -1
  169. package/dist/utils/common/errors.d.ts +2 -1
  170. package/dist/utils/common/errors.js +2 -1
  171. package/dist/utils/common/schema-validation.d.ts +2 -0
  172. package/dist/utils/common/schema-validation.js +12 -0
  173. package/dist/utils/index.d.ts +1 -0
  174. package/dist/utils/index.js +1 -0
  175. package/package.json +20 -17
@@ -0,0 +1,217 @@
1
+ /**
2
+ * Copyright 2025 The Artinet Project
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ /**
6
+ * @fileoverview Core Stream Manager Interface Definition
7
+ *
8
+ * This module defines the interface for managing execution streams in the core service
9
+ * framework. It provides functionality for handling async execution, update collection,
10
+ * and streaming results from execution engines to consumers.
11
+ *
12
+ * @module CoreStreamManager
13
+ * @version 0.5.7
14
+ * @since 0.5.6
15
+ * @author The Artinet Project
16
+ */
17
+ import { CoreCommand, CoreState, CoreUpdate } from "../../../../index.js";
18
+ import { CoreContext } from "../context/index.js";
19
+ import { ExecutionEngine } from "../execution/index.js";
20
+ import { ServiceInterface } from "../service.js";
21
+ /**
22
+ * Interface for managing execution streams and update collection.
23
+ *
24
+ * The StreamManager is responsible for coordinating the execution of commands
25
+ * through execution engines, collecting updates as they are produced, and
26
+ * providing a streaming interface for consumers to receive real-time updates.
27
+ *
28
+ * This interface supports both push-based update collection and pull-based
29
+ * streaming, making it suitable for various execution patterns including
30
+ * long-running tasks, batch operations, and real-time processing.
31
+ *
32
+ * @template TCommand - The command type, must extend CoreCommand
33
+ * @template TState - The state type, must extend CoreState
34
+ * @template TUpdate - The update type, must extend CoreUpdate
35
+ *
36
+ * @example
37
+ * ```typescript
38
+ * class MyStreamManager implements StreamManagerInterface<MyCommand, MyState, MyUpdate> {
39
+ * private updates: MyUpdate[] = [];
40
+ * private completed = false;
41
+ *
42
+ * constructor(
43
+ * private contextId: string,
44
+ * private context: CoreContext<MyCommand, MyState, MyUpdate>
45
+ * ) {}
46
+ *
47
+ * async *stream(engine: ExecutionEngine<MyCommand, MyState, MyUpdate>) {
48
+ * for await (const update of engine(this.context)) {
49
+ * this.addUpdate(update);
50
+ * yield update;
51
+ * }
52
+ * this.setCompleted();
53
+ * }
54
+ *
55
+ * // ... implement other interface methods
56
+ * }
57
+ * ```
58
+ *
59
+ * @public
60
+ * @since 0.5.6
61
+ */
62
+ export interface StreamManagerInterface<TCommand extends CoreCommand = CoreCommand, TState extends CoreState = CoreState, TUpdate extends CoreUpdate = CoreUpdate> {
63
+ /**
64
+ * Gets the unique identifier for the execution context.
65
+ *
66
+ * This ID is used to track and correlate updates with their specific
67
+ * execution instance across the system.
68
+ *
69
+ * @returns The context ID string
70
+ *
71
+ * @example
72
+ * ```typescript
73
+ * const contextId = streamManager.getContextId();
74
+ * console.log(`Processing execution: ${contextId}`);
75
+ * ```
76
+ */
77
+ getContextId(): string;
78
+ /**
79
+ * Adds an update to the internal update collection.
80
+ *
81
+ * This method is typically called by execution engines or other
82
+ * components to record updates as they occur during execution.
83
+ * Updates are stored in order and can be retrieved later.
84
+ *
85
+ * @param update - The update to add to the collection
86
+ *
87
+ * @example
88
+ * ```typescript
89
+ * const progressUpdate: MyUpdate = {
90
+ * type: 'progress',
91
+ * progress: 0.5,
92
+ * message: 'Halfway complete'
93
+ * };
94
+ * streamManager.addUpdate(progressUpdate);
95
+ * ```
96
+ */
97
+ addUpdate(update: TUpdate): void;
98
+ /**
99
+ * Retrieves all updates that have been collected so far.
100
+ *
101
+ * Returns a copy of the internal update collection, providing
102
+ * access to the complete execution history up to this point.
103
+ *
104
+ * @returns Array of all collected updates in chronological order
105
+ *
106
+ * @example
107
+ * ```typescript
108
+ * const allUpdates = streamManager.getUpdates();
109
+ * console.log(`Collected ${allUpdates.length} updates so far`);
110
+ *
111
+ * // Process updates
112
+ * for (const update of allUpdates) {
113
+ * processUpdate(update);
114
+ * }
115
+ * ```
116
+ */
117
+ getUpdates(): TUpdate[];
118
+ /**
119
+ * Checks whether the execution has completed.
120
+ *
121
+ * This flag indicates whether the execution engine has finished
122
+ * processing and no more updates will be produced.
123
+ *
124
+ * @returns True if execution is complete, false if still running
125
+ *
126
+ * @example
127
+ * ```typescript
128
+ * if (streamManager.isCompleted()) {
129
+ * console.log('Execution finished');
130
+ * finalizeResults(streamManager.getUpdates());
131
+ * } else {
132
+ * console.log('Execution still in progress...');
133
+ * }
134
+ * ```
135
+ */
136
+ isCompleted(): boolean;
137
+ /**
138
+ * Marks the execution as completed.
139
+ *
140
+ * This method is called when the execution engine has finished
141
+ * processing, indicating that no more updates will be produced.
142
+ * It triggers any completion-related cleanup or finalization.
143
+ *
144
+ * @example
145
+ * ```typescript
146
+ * // Called by execution engine when done
147
+ * await executeTask();
148
+ * streamManager.setCompleted();
149
+ * ```
150
+ */
151
+ setCompleted(): void;
152
+ /**
153
+ * Gets the current execution context.
154
+ *
155
+ * Returns the context object that contains command, state, and
156
+ * execution environment information for this stream.
157
+ *
158
+ * @returns The execution context
159
+ *
160
+ * @example
161
+ * ```typescript
162
+ * const context = streamManager.getExecutionContext();
163
+ * const command = context.command;
164
+ * const currentState = context.State();
165
+ * ```
166
+ */
167
+ getExecutionContext(): CoreContext<TCommand, TState, TUpdate>;
168
+ /**
169
+ * Sets or updates the execution context.
170
+ *
171
+ * This method allows updating the context during execution,
172
+ * which may be necessary for dynamic execution scenarios.
173
+ *
174
+ * @param executionContext - The new execution context to set
175
+ *
176
+ * @example
177
+ * ```typescript
178
+ * const updatedContext = createNewContext(command, newState);
179
+ * streamManager.setExecutionContext(updatedContext);
180
+ * ```
181
+ */
182
+ setExecutionContext(executionContext: CoreContext<TCommand, TState, TUpdate>): void;
183
+ /**
184
+ * Creates an async generator stream for real-time update consumption.
185
+ *
186
+ * This is the primary method for executing commands and streaming results.
187
+ * It runs the provided execution engine with the current context and
188
+ * yields updates as they are produced, providing a real-time stream
189
+ * of execution progress.
190
+ *
191
+ * @param engine - The execution engine to run
192
+ * @param service - Optional service interface for additional functionality
193
+ * @returns AsyncGenerator that yields updates as they occur
194
+ *
195
+ * @example
196
+ * ```typescript
197
+ * // Basic streaming
198
+ * for await (const update of streamManager.stream(myEngine)) {
199
+ * console.log('Received update:', update);
200
+ * await processUpdate(update);
201
+ * }
202
+ *
203
+ * // With service integration
204
+ * const service = createMyService();
205
+ * for await (const update of streamManager.stream(myEngine, service)) {
206
+ * await service.handleUpdate(update);
207
+ * yield update; // Re-yield to downstream consumers
208
+ * }
209
+ * ```
210
+ *
211
+ * @remarks
212
+ * The stream will continue yielding updates until the execution engine
213
+ * completes. The StreamManager automatically handles update collection
214
+ * and completion status during streaming.
215
+ */
216
+ stream(engine: ExecutionEngine<TCommand, TState, TUpdate>, service?: ServiceInterface<TCommand, TState, TUpdate>): AsyncGenerator<TUpdate>;
217
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Copyright 2025 The Artinet Project
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ export {};
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Copyright 2025 The Artinet Project
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ export interface TaskManagerInterface<TaskType extends {} = {}> {
6
+ getState(id: string): Promise<TaskType | undefined> | TaskType | undefined;
7
+ setState(id: string, data: TaskType): Promise<void> | void;
8
+ getStates(): Promise<string[]> | string[];
9
+ }
@@ -0,0 +1,115 @@
1
+ /**
2
+ * Copyright 2025 The Artinet Project
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ /**
6
+ * @fileoverview Core Service Interface Definition
7
+ *
8
+ * This module defines the fundamental service interface that all core services
9
+ * must implement. It provides the contract for executing commands through
10
+ * execution engines and managing service lifecycle.
11
+ *
12
+ * @module CoreService
13
+ * @version 0.5.7
14
+ * @since 0.5.6
15
+ * @author The Artinet Project
16
+ */
17
+ import { CoreContext, CoreCommand, CoreState, CoreUpdate } from "./context/index.js";
18
+ import { ExecutionEngine } from "./execution/index.js";
19
+ /**
20
+ * Core service interface defining the contract for all service implementations.
21
+ *
22
+ * Services are responsible for orchestrating command execution through execution
23
+ * engines, managing the execution lifecycle, and providing a consistent interface
24
+ * for starting and stopping operations. This interface serves as the foundation
25
+ * for all service types in the core framework.
26
+ *
27
+ * The service acts as a coordinator between execution engines and the broader
28
+ * system, handling concerns like resource management, execution tracking, and
29
+ * graceful shutdown while delegating the actual command processing to engines.
30
+ *
31
+ * @public
32
+ * @since 0.5.6
33
+ */
34
+ export interface ServiceInterface<TCommand extends CoreCommand = CoreCommand, TState extends CoreState = CoreState, TUpdate extends CoreUpdate = CoreUpdate> {
35
+ /**
36
+ * Executes a command using the provided execution engine and context.
37
+ *
38
+ * This is the primary method for processing commands. The service receives
39
+ * an execution engine (which defines how to process the command) and a
40
+ * context (which contains the command, state, and execution environment).
41
+ *
42
+ * The service is responsible for:
43
+ * - Coordinating the execution process
44
+ * - Managing resources during execution
45
+ * - Handling the stream of updates from the engine
46
+ * - Ensuring proper cleanup on completion or failure
47
+ *
48
+ * @param engine - The execution engine that will process the command
49
+ * @param context - The execution context containing command and environment
50
+ * @returns Promise that resolves when execution is complete
51
+ *
52
+ * @throws Should handle and wrap any execution errors appropriately
53
+ *
54
+ * @example
55
+ * ```typescript
56
+ * // Basic execution
57
+ * await service.execute(myEngine, executionContext);
58
+ *
59
+ * // With error handling
60
+ * try {
61
+ * await service.execute(myEngine, executionContext);
62
+ * } catch (error) {
63
+ * console.error('Execution failed:', error);
64
+ * await handleExecutionError(error, executionContext);
65
+ * }
66
+ * ```
67
+ *
68
+ * @example
69
+ * ```typescript
70
+ * // Service implementation with update handling
71
+ * async execute(engine, context) {
72
+ * const updates: TUpdate[] = [];
73
+ *
74
+ * try {
75
+ * for await (const update of engine(context)) {
76
+ * updates.push(update);
77
+ * await this.notifySubscribers(update);
78
+ *
79
+ * if (context.isCancelled()) {
80
+ * console.log('Execution cancelled');
81
+ * break;
82
+ * }
83
+ * }
84
+ * } catch (error) {
85
+ * await this.handleExecutionError(error, context);
86
+ * throw error;
87
+ * }
88
+ *
89
+ * console.log(`Execution completed with ${updates.length} updates`);
90
+ * }
91
+ * ```
92
+ */
93
+ execute: (engine: ExecutionEngine<TCommand, TState, TUpdate>, context: CoreContext<TCommand, TState, TUpdate>) => Promise<void>;
94
+ /**
95
+ * Stops the service and performs cleanup operations.
96
+ *
97
+ * This method is called to gracefully shut down the service, ensuring that
98
+ * all active executions are properly terminated and resources are cleaned up.
99
+ * Implementation should handle stopping active executions, releasing resources,
100
+ * and preparing for service shutdown.
101
+ *
102
+ * The stop method should be idempotent - calling it multiple times should
103
+ * not cause errors or unexpected behavior.
104
+ *
105
+ * @returns Promise that resolves when the service has been stopped and cleaned up
106
+ *
107
+ * @example
108
+ * ```typescript
109
+ * // Graceful shutdown
110
+ * await service.stop();
111
+ * console.log('Service stopped successfully');
112
+ * ```
113
+ */
114
+ stop: () => Promise<void>;
115
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Copyright 2025 The Artinet Project
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ export {};
@@ -0,0 +1,4 @@
1
+ export * from "./a2a/index.js";
2
+ export * from "./core/index.js";
3
+ export * from "./mcp/index.js";
4
+ export * from "./protocol.js";
@@ -0,0 +1,4 @@
1
+ export * from "./a2a/index.js";
2
+ export * from "./core/index.js";
3
+ export * from "./mcp/index.js";
4
+ export * from "./protocol.js";
@@ -0,0 +1 @@
1
+ export * from "./service.js";
@@ -0,0 +1 @@
1
+ export * from "./service.js";
@@ -0,0 +1,49 @@
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.5.7
14
+ * @since 0.5.7
15
+ * @author The Artinet Project
16
+ */
17
+ import { ServiceInterface } 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 MCPServiceInterface extends Omit<ServiceInterface, "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
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Copyright 2025 The Artinet Project
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ export {};
@@ -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,8 @@
1
+ /**
2
+ * Copyright 2025 The Artinet Project
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ export interface Store<T> {
6
+ set(data: T, id?: string): Promise<void>;
7
+ get(id: string): Promise<T | undefined>;
8
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Copyright 2025 The Artinet Project
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ export {};