@cleocode/lafs 2026.3.74 → 2026.4.3

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 (143) hide show
  1. package/LICENSE +0 -0
  2. package/README.md +97 -68
  3. package/dist/schemas/v1/agent-card.schema.json +230 -0
  4. package/dist/schemas/v1/conformance-profiles.json +0 -0
  5. package/dist/schemas/v1/context-ledger.schema.json +70 -0
  6. package/dist/schemas/v1/discovery.schema.json +132 -0
  7. package/dist/schemas/v1/envelope.schema.json +0 -0
  8. package/dist/schemas/v1/error-registry.json +0 -0
  9. package/dist/src/a2a/bindings/grpc.d.ts +118 -11
  10. package/dist/src/a2a/bindings/grpc.d.ts.map +1 -0
  11. package/dist/src/a2a/bindings/grpc.js +80 -8
  12. package/dist/src/a2a/bindings/grpc.js.map +1 -0
  13. package/dist/src/a2a/bindings/http.d.ts +131 -15
  14. package/dist/src/a2a/bindings/http.d.ts.map +1 -0
  15. package/dist/src/a2a/bindings/http.js +101 -14
  16. package/dist/src/a2a/bindings/http.js.map +1 -0
  17. package/dist/src/a2a/bindings/index.d.ts +83 -9
  18. package/dist/src/a2a/bindings/index.d.ts.map +1 -0
  19. package/dist/src/a2a/bindings/index.js +74 -6
  20. package/dist/src/a2a/bindings/index.js.map +1 -0
  21. package/dist/src/a2a/bindings/jsonrpc.d.ts +194 -9
  22. package/dist/src/a2a/bindings/jsonrpc.d.ts.map +1 -0
  23. package/dist/src/a2a/bindings/jsonrpc.js +155 -10
  24. package/dist/src/a2a/bindings/jsonrpc.js.map +1 -0
  25. package/dist/src/a2a/bridge.d.ts +237 -44
  26. package/dist/src/a2a/bridge.d.ts.map +1 -0
  27. package/dist/src/a2a/bridge.js +187 -48
  28. package/dist/src/a2a/bridge.js.map +1 -0
  29. package/dist/src/a2a/extensions.d.ts +222 -12
  30. package/dist/src/a2a/extensions.d.ts.map +1 -0
  31. package/dist/src/a2a/extensions.js +178 -13
  32. package/dist/src/a2a/extensions.js.map +1 -0
  33. package/dist/src/a2a/index.d.ts +10 -7
  34. package/dist/src/a2a/index.d.ts.map +1 -0
  35. package/dist/src/a2a/index.js +24 -27
  36. package/dist/src/a2a/index.js.map +1 -0
  37. package/dist/src/a2a/streaming.d.ts +276 -3
  38. package/dist/src/a2a/streaming.d.ts.map +1 -0
  39. package/dist/src/a2a/streaming.js +255 -11
  40. package/dist/src/a2a/streaming.js.map +1 -0
  41. package/dist/src/a2a/task-lifecycle.d.ts +341 -20
  42. package/dist/src/a2a/task-lifecycle.d.ts.map +1 -0
  43. package/dist/src/a2a/task-lifecycle.js +327 -26
  44. package/dist/src/a2a/task-lifecycle.js.map +1 -0
  45. package/dist/src/budgetEnforcement.d.ts +93 -20
  46. package/dist/src/budgetEnforcement.d.ts.map +1 -0
  47. package/dist/src/budgetEnforcement.js +146 -31
  48. package/dist/src/budgetEnforcement.js.map +1 -0
  49. package/dist/src/circuit-breaker/index.d.ts +260 -10
  50. package/dist/src/circuit-breaker/index.d.ts.map +1 -0
  51. package/dist/src/circuit-breaker/index.js +226 -14
  52. package/dist/src/circuit-breaker/index.js.map +1 -0
  53. package/dist/src/cli.d.ts +1 -0
  54. package/dist/src/cli.d.ts.map +1 -0
  55. package/dist/src/cli.js +12 -11
  56. package/dist/src/cli.js.map +1 -0
  57. package/dist/src/compliance.d.ts +180 -3
  58. package/dist/src/compliance.d.ts.map +1 -0
  59. package/dist/src/compliance.js +114 -13
  60. package/dist/src/compliance.js.map +1 -0
  61. package/dist/src/conformance.d.ts +55 -2
  62. package/dist/src/conformance.d.ts.map +1 -0
  63. package/dist/src/conformance.js +124 -76
  64. package/dist/src/conformance.js.map +1 -0
  65. package/dist/src/conformanceProfiles.d.ts +68 -1
  66. package/dist/src/conformanceProfiles.d.ts.map +1 -0
  67. package/dist/src/conformanceProfiles.js +53 -1
  68. package/dist/src/conformanceProfiles.js.map +1 -0
  69. package/dist/src/deprecationRegistry.d.ts +82 -1
  70. package/dist/src/deprecationRegistry.d.ts.map +1 -0
  71. package/dist/src/deprecationRegistry.js +58 -7
  72. package/dist/src/deprecationRegistry.js.map +1 -0
  73. package/dist/src/discovery.d.ts +347 -65
  74. package/dist/src/discovery.d.ts.map +1 -0
  75. package/dist/src/discovery.js +130 -72
  76. package/dist/src/discovery.js.map +1 -0
  77. package/dist/src/envelope.d.ts +262 -9
  78. package/dist/src/envelope.d.ts.map +1 -0
  79. package/dist/src/envelope.js +179 -15
  80. package/dist/src/envelope.js.map +1 -0
  81. package/dist/src/errorRegistry.d.ts +163 -3
  82. package/dist/src/errorRegistry.d.ts.map +1 -0
  83. package/dist/src/errorRegistry.js +119 -3
  84. package/dist/src/errorRegistry.js.map +1 -0
  85. package/dist/src/fieldExtraction.d.ts +128 -27
  86. package/dist/src/fieldExtraction.d.ts.map +1 -0
  87. package/dist/src/fieldExtraction.js +100 -27
  88. package/dist/src/fieldExtraction.js.map +1 -0
  89. package/dist/src/flagResolver.d.ts +77 -10
  90. package/dist/src/flagResolver.d.ts.map +1 -0
  91. package/dist/src/flagResolver.js +22 -5
  92. package/dist/src/flagResolver.js.map +1 -0
  93. package/dist/src/flagSemantics.d.ts +80 -4
  94. package/dist/src/flagSemantics.d.ts.map +1 -0
  95. package/dist/src/flagSemantics.js +78 -11
  96. package/dist/src/flagSemantics.js.map +1 -0
  97. package/dist/src/health/index.d.ts +103 -9
  98. package/dist/src/health/index.d.ts.map +1 -0
  99. package/dist/src/health/index.js +75 -26
  100. package/dist/src/health/index.js.map +1 -0
  101. package/dist/src/index.d.ts +34 -23
  102. package/dist/src/index.d.ts.map +1 -0
  103. package/dist/src/index.js +40 -28
  104. package/dist/src/index.js.map +1 -0
  105. package/dist/src/mviProjection.d.ts +43 -6
  106. package/dist/src/mviProjection.d.ts.map +1 -0
  107. package/dist/src/mviProjection.js +32 -5
  108. package/dist/src/mviProjection.js.map +1 -0
  109. package/dist/src/native-loader.d.ts +49 -0
  110. package/dist/src/native-loader.d.ts.map +1 -0
  111. package/dist/src/native-loader.js +56 -0
  112. package/dist/src/native-loader.js.map +1 -0
  113. package/dist/src/problemDetails.d.ts +71 -4
  114. package/dist/src/problemDetails.d.ts.map +1 -0
  115. package/dist/src/problemDetails.js +27 -3
  116. package/dist/src/problemDetails.js.map +1 -0
  117. package/dist/src/shutdown/index.d.ts +103 -9
  118. package/dist/src/shutdown/index.d.ts.map +1 -0
  119. package/dist/src/shutdown/index.js +78 -12
  120. package/dist/src/shutdown/index.js.map +1 -0
  121. package/dist/src/tokenEstimator.d.ts +98 -11
  122. package/dist/src/tokenEstimator.d.ts.map +1 -0
  123. package/dist/src/tokenEstimator.js +91 -13
  124. package/dist/src/tokenEstimator.js.map +1 -0
  125. package/dist/src/types.d.ts +477 -11
  126. package/dist/src/types.d.ts.map +1 -0
  127. package/dist/src/types.js +76 -2
  128. package/dist/src/types.js.map +1 -0
  129. package/dist/src/validateEnvelope.d.ts +61 -2
  130. package/dist/src/validateEnvelope.d.ts.map +1 -0
  131. package/dist/src/validateEnvelope.js +81 -14
  132. package/dist/src/validateEnvelope.js.map +1 -0
  133. package/dist/tsconfig.build.tsbuildinfo +1 -0
  134. package/lafs.md +3 -4
  135. package/package.json +14 -12
  136. package/schemas/v1/agent-card.schema.json +0 -0
  137. package/schemas/v1/conformance-profiles.json +0 -0
  138. package/schemas/v1/context-ledger.schema.json +0 -0
  139. package/schemas/v1/discovery.schema.json +0 -0
  140. package/schemas/v1/envelope.schema.json +0 -0
  141. package/schemas/v1/error-registry.json +0 -0
  142. package/dist/src/mcpAdapter.d.ts +0 -28
  143. package/dist/src/mcpAdapter.js +0 -281
@@ -4,6 +4,12 @@
4
4
  * State machine enforcement, task CRUD, and LAFS integration
5
5
  * for A2A Protocol v1.0+ compliance.
6
6
  *
7
+ * @remarks
8
+ * Implements the A2A task state machine with valid transitions, terminal
9
+ * state immutability, and context-based task grouping. Provides an
10
+ * in-memory TaskManager for managing task lifecycle and LAFS envelope
11
+ * attachment.
12
+ *
7
13
  * Reference: A2A spec Section 6 (Task Lifecycle)
8
14
  */
9
15
  import { createLafsArtifact } from './bridge.js';
@@ -25,39 +31,117 @@ export const INTERRUPTED_STATES = new Set([
25
31
  /** Valid state transitions (adjacency map). Terminal states have empty outgoing sets. */
26
32
  export const VALID_TRANSITIONS = new Map([
27
33
  ['submitted', new Set(['working', 'canceled', 'rejected', 'failed'])],
28
- ['working', new Set(['completed', 'failed', 'canceled', 'input-required', 'auth-required'])],
34
+ [
35
+ 'working',
36
+ new Set(['completed', 'failed', 'canceled', 'input-required', 'auth-required']),
37
+ ],
29
38
  ['input-required', new Set(['working', 'canceled', 'failed'])],
30
39
  ['auth-required', new Set(['working', 'canceled', 'failed'])],
31
40
  ['completed', new Set()],
32
41
  ['failed', new Set()],
33
42
  ['canceled', new Set()],
34
43
  ['rejected', new Set()],
35
- ['unknown', new Set(['submitted', 'working', 'input-required', 'completed', 'canceled', 'failed', 'rejected', 'auth-required'])],
44
+ [
45
+ 'unknown',
46
+ new Set([
47
+ 'submitted',
48
+ 'working',
49
+ 'input-required',
50
+ 'completed',
51
+ 'canceled',
52
+ 'failed',
53
+ 'rejected',
54
+ 'auth-required',
55
+ ]),
56
+ ],
36
57
  ]);
37
58
  // ============================================================================
38
59
  // State Functions
39
60
  // ============================================================================
40
- /** Check if a transition from one state to another is valid */
61
+ /**
62
+ * Check if a transition from one state to another is valid.
63
+ *
64
+ * @remarks
65
+ * Looks up the `from` state in the VALID_TRANSITIONS adjacency map and
66
+ * checks whether `to` is in the allowed set.
67
+ *
68
+ * @param from - Current task state
69
+ * @param to - Desired target state
70
+ * @returns True if the transition is allowed by the state machine
71
+ *
72
+ * @example
73
+ * ```typescript
74
+ * if (!isValidTransition('submitted', 'completed')) {
75
+ * throw new Error('Cannot go directly from submitted to completed');
76
+ * }
77
+ * ```
78
+ */
41
79
  export function isValidTransition(from, to) {
42
80
  const allowed = VALID_TRANSITIONS.get(from);
43
81
  return allowed ? allowed.has(to) : false;
44
82
  }
45
- /** Check if a state is terminal (no further transitions allowed) */
83
+ /**
84
+ * Check if a state is terminal (no further transitions allowed).
85
+ *
86
+ * @remarks
87
+ * Terminal states are `completed`, `failed`, `canceled`, and `rejected`.
88
+ *
89
+ * @param state - Task state to check
90
+ * @returns True if the state is terminal
91
+ *
92
+ * @example
93
+ * ```typescript
94
+ * if (isTerminalState(task.status.state)) {
95
+ * console.log('Task has reached a final state');
96
+ * }
97
+ * ```
98
+ */
46
99
  export function isTerminalState(state) {
47
100
  return TERMINAL_STATES.has(state);
48
101
  }
49
- /** Check if a state is interrupted (paused awaiting input) */
102
+ /**
103
+ * Check if a state is interrupted (paused awaiting input).
104
+ *
105
+ * @remarks
106
+ * Interrupted states are `input-required` and `auth-required`.
107
+ *
108
+ * @param state - Task state to check
109
+ * @returns True if the state indicates the task is waiting for external input
110
+ *
111
+ * @example
112
+ * ```typescript
113
+ * if (isInterruptedState(task.status.state)) {
114
+ * promptUserForInput(task);
115
+ * }
116
+ * ```
117
+ */
50
118
  export function isInterruptedState(state) {
51
119
  return INTERRUPTED_STATES.has(state);
52
120
  }
53
121
  // ============================================================================
54
122
  // Error Classes
55
123
  // ============================================================================
56
- /** Thrown when attempting an invalid state transition */
124
+ /**
125
+ * Thrown when attempting an invalid state transition.
126
+ *
127
+ * @remarks
128
+ * Captures the task ID, source state, and target state so callers can
129
+ * determine which transition was rejected.
130
+ */
57
131
  export class InvalidStateTransitionError extends Error {
132
+ /** ID of the task that failed the transition */
58
133
  taskId;
134
+ /** State the task was in when the transition was attempted */
59
135
  fromState;
136
+ /** State the task was being transitioned to */
60
137
  toState;
138
+ /**
139
+ * Create an InvalidStateTransitionError.
140
+ *
141
+ * @param taskId - ID of the task that failed the transition
142
+ * @param fromState - Current state of the task
143
+ * @param toState - Desired target state that was rejected
144
+ */
61
145
  constructor(taskId, fromState, toState) {
62
146
  super(`Invalid transition for task ${taskId}: ${fromState} -> ${toState}`);
63
147
  this.name = 'InvalidStateTransitionError';
@@ -66,10 +150,24 @@ export class InvalidStateTransitionError extends Error {
66
150
  this.toState = toState;
67
151
  }
68
152
  }
69
- /** Thrown when attempting to modify a task in a terminal state */
153
+ /**
154
+ * Thrown when attempting to modify a task in a terminal state.
155
+ *
156
+ * @remarks
157
+ * Tasks in terminal states (`completed`, `failed`, `canceled`, `rejected`)
158
+ * are immutable and cannot be modified further.
159
+ */
70
160
  export class TaskImmutabilityError extends Error {
161
+ /** ID of the task that cannot be modified */
71
162
  taskId;
163
+ /** Terminal state the task is in */
72
164
  terminalState;
165
+ /**
166
+ * Create a TaskImmutabilityError.
167
+ *
168
+ * @param taskId - ID of the task in terminal state
169
+ * @param terminalState - The terminal state preventing modification
170
+ */
73
171
  constructor(taskId, terminalState) {
74
172
  super(`Task ${taskId} is in terminal state ${terminalState} and cannot be modified`);
75
173
  this.name = 'TaskImmutabilityError';
@@ -77,18 +175,43 @@ export class TaskImmutabilityError extends Error {
77
175
  this.terminalState = terminalState;
78
176
  }
79
177
  }
80
- /** Thrown when a task is not found */
178
+ /**
179
+ * Thrown when a task is not found.
180
+ *
181
+ * @remarks
182
+ * Indicates a lookup by task ID failed because no task with that ID exists
183
+ * in the TaskManager's store.
184
+ */
81
185
  export class TaskNotFoundError extends Error {
186
+ /** ID of the task that was not found */
82
187
  taskId;
188
+ /**
189
+ * Create a TaskNotFoundError.
190
+ *
191
+ * @param taskId - ID of the task that was not found
192
+ */
83
193
  constructor(taskId) {
84
194
  super(`Task not found: ${taskId}`);
85
195
  this.name = 'TaskNotFoundError';
86
196
  this.taskId = taskId;
87
197
  }
88
198
  }
89
- /** Thrown when a refinement/follow-up task references invalid parent tasks */
199
+ /**
200
+ * Thrown when a refinement/follow-up task references invalid parent tasks.
201
+ *
202
+ * @remarks
203
+ * Occurs when referenced tasks do not exist or belong to a different
204
+ * context than the refinement task.
205
+ */
90
206
  export class TaskRefinementError extends Error {
207
+ /** IDs of the referenced tasks that caused the error */
91
208
  referenceTaskIds;
209
+ /**
210
+ * Create a TaskRefinementError.
211
+ *
212
+ * @param message - Descriptive error message
213
+ * @param referenceTaskIds - IDs of the invalid reference tasks
214
+ */
92
215
  constructor(message, referenceTaskIds) {
93
216
  super(message);
94
217
  this.name = 'TaskRefinementError';
@@ -99,7 +222,7 @@ export class TaskRefinementError extends Error {
99
222
  // ID Generation
100
223
  // ============================================================================
101
224
  function generateId() {
102
- return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
225
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
103
226
  const r = (Math.random() * 16) | 0;
104
227
  const v = c === 'x' ? r : (r & 0x3) | 0x8;
105
228
  return v.toString(16);
@@ -107,15 +230,39 @@ function generateId() {
107
230
  }
108
231
  /**
109
232
  * In-memory task manager implementing A2A task lifecycle.
233
+ *
234
+ * @remarks
110
235
  * Enforces valid state transitions and terminal state immutability.
236
+ * Tasks are indexed by both ID and context ID for efficient lookup.
237
+ * All returned Task objects are deep clones to prevent external mutation.
111
238
  */
112
239
  export class TaskManager {
240
+ /** Map of task ID to Task object */
113
241
  tasks = new Map();
242
+ /** Index mapping context ID to set of task IDs */
114
243
  contextIndex = new Map();
115
- /** Create a new task in the submitted state */
244
+ /**
245
+ * Create a new task in the submitted state.
246
+ *
247
+ * @remarks
248
+ * Generates a UUID for the task and resolves the context ID from options
249
+ * or referenced tasks. Validates that all reference tasks exist and share
250
+ * the same context.
251
+ *
252
+ * @param options - Task creation options including context, metadata, and references
253
+ * @returns Deep clone of the newly created task
254
+ *
255
+ * @example
256
+ * ```typescript
257
+ * const manager = new TaskManager();
258
+ * const task = manager.createTask({ contextId: 'ctx-1', metadata: { source: 'api' } });
259
+ * ```
260
+ */
116
261
  createTask(options) {
117
262
  const id = generateId();
118
- const resolvedContextId = options?.contextId ?? this.resolveContextForReferenceTasks(options?.referenceTaskIds) ?? generateId();
263
+ const resolvedContextId = options?.contextId ??
264
+ this.resolveContextForReferenceTasks(options?.referenceTaskIds) ??
265
+ generateId();
119
266
  const contextId = resolvedContextId;
120
267
  const referenceTaskIds = options?.referenceTaskIds ?? [];
121
268
  this.validateReferenceTasks(referenceTaskIds, contextId);
@@ -144,7 +291,23 @@ export class TaskManager {
144
291
  contextTasks.add(id);
145
292
  return structuredClone(task);
146
293
  }
147
- /** Create a refinement/follow-up task referencing existing task(s). */
294
+ /**
295
+ * Create a refinement/follow-up task referencing existing task(s).
296
+ *
297
+ * @remarks
298
+ * Delegates to {@link TaskManager.createTask} with the provided reference
299
+ * task IDs. The context ID is automatically resolved from the first
300
+ * referenced task.
301
+ *
302
+ * @param referenceTaskIds - IDs of parent tasks to reference
303
+ * @param options - Additional task creation options (excluding referenceTaskIds)
304
+ * @returns Deep clone of the newly created refinement task
305
+ *
306
+ * @example
307
+ * ```typescript
308
+ * const refined = manager.createRefinedTask(['task-1'], { parallelFollowUp: true });
309
+ * ```
310
+ */
148
311
  createRefinedTask(referenceTaskIds, options) {
149
312
  return this.createTask({
150
313
  ...options,
@@ -152,7 +315,22 @@ export class TaskManager {
152
315
  parallelFollowUp: options?.parallelFollowUp,
153
316
  });
154
317
  }
155
- /** Get a task by ID. Throws TaskNotFoundError if not found. */
318
+ /**
319
+ * Get a task by ID.
320
+ *
321
+ * @remarks
322
+ * Returns a deep clone of the task to prevent external mutation.
323
+ *
324
+ * @param taskId - ID of the task to retrieve
325
+ * @returns Deep clone of the requested task
326
+ * @throws {@link TaskNotFoundError} if no task with the given ID exists
327
+ *
328
+ * @example
329
+ * ```typescript
330
+ * const task = manager.getTask('some-task-id');
331
+ * console.log(task.status.state);
332
+ * ```
333
+ */
156
334
  getTask(taskId) {
157
335
  const task = this.tasks.get(taskId);
158
336
  if (!task) {
@@ -160,7 +338,25 @@ export class TaskManager {
160
338
  }
161
339
  return structuredClone(task);
162
340
  }
163
- /** List tasks with optional filtering and pagination */
341
+ /**
342
+ * List tasks with optional filtering and pagination.
343
+ *
344
+ * @remarks
345
+ * Supports filtering by context ID and state, with cursor-based
346
+ * pagination using the last seen task ID as a page token. Results
347
+ * are sorted by task ID for deterministic ordering.
348
+ *
349
+ * @param options - Filtering and pagination options
350
+ * @returns Paginated result with tasks and optional next page token
351
+ *
352
+ * @example
353
+ * ```typescript
354
+ * const result = manager.listTasks({ contextId: 'ctx-1', state: 'working', limit: 10 });
355
+ * for (const task of result.tasks) {
356
+ * console.log(task.id, task.status.state);
357
+ * }
358
+ * ```
359
+ */
164
360
  listTasks(options) {
165
361
  let taskIds;
166
362
  if (options?.contextId) {
@@ -172,7 +368,7 @@ export class TaskManager {
172
368
  }
173
369
  // Filter by state
174
370
  if (options?.state) {
175
- taskIds = taskIds.filter(id => {
371
+ taskIds = taskIds.filter((id) => {
176
372
  const task = this.tasks.get(id);
177
373
  return task && task.status.state === options.state;
178
374
  });
@@ -190,14 +386,29 @@ export class TaskManager {
190
386
  const limit = options?.limit ?? taskIds.length;
191
387
  const pageTaskIds = taskIds.slice(0, limit);
192
388
  const hasMore = taskIds.length > limit;
193
- const tasks = pageTaskIds.map(id => structuredClone(this.tasks.get(id)));
389
+ const tasks = pageTaskIds.map((id) => structuredClone(this.tasks.get(id)));
194
390
  const nextPageToken = hasMore ? pageTaskIds[pageTaskIds.length - 1] : undefined;
195
391
  return { tasks, nextPageToken };
196
392
  }
197
393
  /**
198
394
  * Update task status. Enforces valid transitions and terminal state immutability.
199
- * @throws InvalidStateTransitionError if the transition is not valid
200
- * @throws TaskImmutabilityError if the task is in a terminal state
395
+ *
396
+ * @remarks
397
+ * Validates that the transition is allowed by the state machine before
398
+ * applying. An optional message can be attached to the new status.
399
+ *
400
+ * @param taskId - ID of the task to update
401
+ * @param state - New state to transition to
402
+ * @param message - Optional message to attach to the status update
403
+ * @returns Deep clone of the updated task
404
+ * @throws {@link InvalidStateTransitionError} if the transition is not valid
405
+ * @throws {@link TaskImmutabilityError} if the task is in a terminal state
406
+ * @throws {@link TaskNotFoundError} if the task does not exist
407
+ *
408
+ * @example
409
+ * ```typescript
410
+ * const updated = manager.updateTaskStatus('task-1', 'working');
411
+ * ```
201
412
  */
202
413
  updateTaskStatus(taskId, state, message) {
203
414
  const task = this.tasks.get(taskId);
@@ -221,7 +432,22 @@ export class TaskManager {
221
432
  }
222
433
  /**
223
434
  * Add an artifact to a task.
224
- * @throws TaskImmutabilityError if the task is in a terminal state
435
+ *
436
+ * @remarks
437
+ * Appends the artifact to the task's artifacts array. The task must
438
+ * not be in a terminal state.
439
+ *
440
+ * @param taskId - ID of the task to add the artifact to
441
+ * @param artifact - Artifact to add
442
+ * @returns Deep clone of the updated task
443
+ * @throws {@link TaskImmutabilityError} if the task is in a terminal state
444
+ * @throws {@link TaskNotFoundError} if the task does not exist
445
+ *
446
+ * @example
447
+ * ```typescript
448
+ * const artifact = createLafsArtifact(envelope);
449
+ * manager.addArtifact('task-1', artifact);
450
+ * ```
225
451
  */
226
452
  addArtifact(taskId, artifact) {
227
453
  const task = this.tasks.get(taskId);
@@ -239,7 +465,21 @@ export class TaskManager {
239
465
  }
240
466
  /**
241
467
  * Add a message to task history.
242
- * @throws TaskImmutabilityError if the task is in a terminal state
468
+ *
469
+ * @remarks
470
+ * Appends the message to the task's history array. The task must
471
+ * not be in a terminal state.
472
+ *
473
+ * @param taskId - ID of the task to add the message to
474
+ * @param message - Message to add to history
475
+ * @returns Deep clone of the updated task
476
+ * @throws {@link TaskImmutabilityError} if the task is in a terminal state
477
+ * @throws {@link TaskNotFoundError} if the task does not exist
478
+ *
479
+ * @example
480
+ * ```typescript
481
+ * manager.addHistory('task-1', { role: 'agent', parts: [{ kind: 'text', text: 'Done' }] });
482
+ * ```
243
483
  */
244
484
  addHistory(taskId, message) {
245
485
  const task = this.tasks.get(taskId);
@@ -255,18 +495,62 @@ export class TaskManager {
255
495
  task.history.push(message);
256
496
  return structuredClone(task);
257
497
  }
258
- /** Cancel a task by transitioning to canceled state */
498
+ /**
499
+ * Cancel a task by transitioning to canceled state.
500
+ *
501
+ * @remarks
502
+ * Convenience wrapper around {@link TaskManager.updateTaskStatus} with `'canceled'`.
503
+ *
504
+ * @param taskId - ID of the task to cancel
505
+ * @returns Deep clone of the canceled task
506
+ * @throws {@link InvalidStateTransitionError} if cancellation is not valid from the current state
507
+ * @throws {@link TaskImmutabilityError} if the task is already in a terminal state
508
+ *
509
+ * @example
510
+ * ```typescript
511
+ * const canceled = manager.cancelTask('task-1');
512
+ * ```
513
+ */
259
514
  cancelTask(taskId) {
260
515
  return this.updateTaskStatus(taskId, 'canceled');
261
516
  }
262
- /** Get all tasks in a given context */
517
+ /**
518
+ * Get all tasks in a given context.
519
+ *
520
+ * @remarks
521
+ * Returns deep clones of all tasks sharing the specified context ID.
522
+ *
523
+ * @param contextId - Context ID to look up
524
+ * @returns Array of deep-cloned tasks in the context, or empty array if none
525
+ *
526
+ * @example
527
+ * ```typescript
528
+ * const tasks = manager.getTasksByContext('ctx-1');
529
+ * ```
530
+ */
263
531
  getTasksByContext(contextId) {
264
532
  const taskIds = this.contextIndex.get(contextId);
265
533
  if (!taskIds)
266
534
  return [];
267
- return [...taskIds].map(id => structuredClone(this.tasks.get(id)));
535
+ return [...taskIds].map((id) => structuredClone(this.tasks.get(id)));
268
536
  }
269
- /** Check if a task is in a terminal state */
537
+ /**
538
+ * Check if a task is in a terminal state.
539
+ *
540
+ * @remarks
541
+ * Retrieves the task and checks its current state against the terminal states set.
542
+ *
543
+ * @param taskId - ID of the task to check
544
+ * @returns True if the task is in a terminal state
545
+ * @throws {@link TaskNotFoundError} if the task does not exist
546
+ *
547
+ * @example
548
+ * ```typescript
549
+ * if (manager.isTerminal('task-1')) {
550
+ * console.log('Task is finished');
551
+ * }
552
+ * ```
553
+ */
270
554
  isTerminal(taskId) {
271
555
  const task = this.tasks.get(taskId);
272
556
  if (!task) {
@@ -274,6 +558,7 @@ export class TaskManager {
274
558
  }
275
559
  return isTerminalState(task.status.state);
276
560
  }
561
+ /** Derive a contextId from the first referenced task, if any reference tasks are provided. */
277
562
  resolveContextForReferenceTasks(referenceTaskIds) {
278
563
  if (!referenceTaskIds || referenceTaskIds.length === 0) {
279
564
  return undefined;
@@ -285,6 +570,7 @@ export class TaskManager {
285
570
  const first = this.tasks.get(firstId);
286
571
  return first?.contextId;
287
572
  }
573
+ /** Validate that all referenced tasks exist and share the same contextId. */
288
574
  validateReferenceTasks(referenceTaskIds, contextId) {
289
575
  if (referenceTaskIds.length === 0) {
290
576
  return;
@@ -305,9 +591,24 @@ export class TaskManager {
305
591
  // ============================================================================
306
592
  /**
307
593
  * Attach a LAFS envelope as an artifact to an A2A task.
308
- * Uses createLafsArtifact() from bridge.ts to wrap the envelope.
594
+ *
595
+ * @remarks
596
+ * Uses {@link createLafsArtifact} from bridge.ts to wrap the envelope
597
+ * in a properly formatted A2A artifact, then adds it to the task.
598
+ *
599
+ * @param manager - TaskManager instance managing the task
600
+ * @param taskId - ID of the task to attach the envelope to
601
+ * @param envelope - LAFS envelope to attach as an artifact
602
+ * @returns Deep clone of the updated task with the new artifact
603
+ *
604
+ * @example
605
+ * ```typescript
606
+ * const envelope: LAFSEnvelope = { success: true, result: { data: 'ok' }, error: null, _meta: meta };
607
+ * const updated = attachLafsEnvelope(manager, 'task-1', envelope);
608
+ * ```
309
609
  */
310
610
  export function attachLafsEnvelope(manager, taskId, envelope) {
311
611
  const artifact = createLafsArtifact(envelope);
312
612
  return manager.addArtifact(taskId, artifact);
313
613
  }
614
+ //# sourceMappingURL=task-lifecycle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task-lifecycle.js","sourceRoot":"","sources":["../../../src/a2a/task-lifecycle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,+EAA+E;AAC/E,kBAAkB;AAClB,+EAA+E;AAE/E,4DAA4D;AAC5D,MAAM,CAAC,MAAM,eAAe,GAA2B,IAAI,GAAG,CAAC;IAC7D,WAAW;IACX,QAAQ;IACR,UAAU;IACV,UAAU;CACX,CAAC,CAAC;AAEH,8DAA8D;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