@artinet/sdk 0.6.2 → 0.6.4

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.
@@ -305,13 +305,20 @@ export class AgentFactory {
305
305
  if (args) {
306
306
  /**We extract the parts of the first A2A protocol object we encounter in the args */
307
307
  if (args.task || args.message || args.update) {
308
- const parts = A2A.MessageSchema.safeParse(args.message).data?.parts ??
309
- A2A.TaskSchema.safeParse(args.task).data?.status?.message?.parts ??
310
- A2A.TaskStatusUpdateEventSchema.safeParse(args.update).data?.status
311
- ?.message?.parts ??
312
- A2A.TaskArtifactUpdateEventSchema.safeParse(args.update).data
313
- ?.artifact?.parts ??
314
- [];
308
+ const parts = [];
309
+ if (args.message) {
310
+ parts.push(...(A2A.MessageSchema.safeParse(args.message).data?.parts ?? []));
311
+ }
312
+ if (args.task) {
313
+ parts.push(...(A2A.TaskSchema.safeParse(args.task).data?.status?.message
314
+ ?.parts ?? []));
315
+ }
316
+ if (args.update) {
317
+ parts.push(...(A2A.TaskStatusUpdateEventSchema.safeParse(args.update).data
318
+ ?.status?.message?.parts ?? []));
319
+ parts.push(...(A2A.TaskArtifactUpdateEventSchema.safeParse(args.update).data
320
+ ?.artifact?.parts ?? []));
321
+ }
315
322
  parts.forEach((part) => {
316
323
  messageSendParams.message.parts.unshift(part);
317
324
  });
@@ -84,7 +84,7 @@ export function Task() {
84
84
  throw new Error("Array of tasks is not supported");
85
85
  }
86
86
  const task = typeof payload === "string" ? describe.task(payload) : payload;
87
- yield describe.task({ ...task, taskId, contextId });
87
+ yield describe.task({ ...task, id: taskId, contextId });
88
88
  return;
89
89
  };
90
90
  }
@@ -36,6 +36,10 @@ export const handleTaskUpdate = async ({ context, task, update, }) => {
36
36
  cause: validated,
37
37
  });
38
38
  }
39
+ //TODO: Enforce State Transitions
40
+ if (validated.status?.message) {
41
+ updateHistory(task, validated.status.message);
42
+ }
39
43
  task = { ...task, ...validated };
40
44
  if (context.userMessage) {
41
45
  updateHistory(task, context.userMessage);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@artinet/sdk",
3
- "version": "0.6.2",
3
+ "version": "0.6.4",
4
4
  "description": "A TypeScript SDK for building collaborative AI agents.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",