@perkos/perkos-a2a 0.8.7 → 0.8.9

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,cAAc,YAAY,CAAC;AAuB3B,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,GAAG,EAAE,GAAG,QAmexC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,cAAc,YAAY,CAAC;AAuB3B,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,GAAG,EAAE,GAAG,QAofxC"}
package/dist/index.js CHANGED
@@ -26829,11 +26829,12 @@ var A2AServer = class {
26829
26829
  this.logger.info(
26830
26830
  `[perkos-a2a] Task ${taskId} received from ${task.metadata?.fromAgent}`
26831
26831
  );
26832
- this.processTask(task);
26832
+ void this.processTask(task);
26833
26833
  return this.success(rpcId, task);
26834
26834
  }
26835
26835
  async processTask(task) {
26836
26836
  task.status = { state: "working", timestamp: (/* @__PURE__ */ new Date()).toISOString() };
26837
+ this.tasks.set(task.id, structuredClone(task));
26837
26838
  const textParts = task.messages.flatMap((m) => m.parts || []).filter((p) => p.kind === "text").map((p) => p.text).join("\n");
26838
26839
  try {
26839
26840
  if (this.messageInjector) {
@@ -26847,6 +26848,7 @@ var A2AServer = class {
26847
26848
  artifactId: randomUUID3(),
26848
26849
  parts: [{ kind: "text", text: "Task accepted and dispatched for execution" }]
26849
26850
  });
26851
+ this.tasks.set(task.id, structuredClone(task));
26850
26852
  } else {
26851
26853
  const fs = await import("fs");
26852
26854
  const taskDir = this.config.workspacePath || `${homedir()}/.openclaw/workspace/memory`;
@@ -26872,6 +26874,7 @@ var A2AServer = class {
26872
26874
  artifactId: randomUUID3(),
26873
26875
  parts: [{ kind: "text", text: `Task queued: ${taskFile}` }]
26874
26876
  });
26877
+ this.tasks.set(task.id, structuredClone(task));
26875
26878
  }
26876
26879
  if (this.taskResultHandler) {
26877
26880
  await this.taskResultHandler(task, textParts);
@@ -26881,6 +26884,7 @@ var A2AServer = class {
26881
26884
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
26882
26885
  };
26883
26886
  }
26887
+ this.tasks.set(task.id, structuredClone(task));
26884
26888
  this.logger.info(`[perkos-a2a] Task ${task.id} completed`);
26885
26889
  } catch (err) {
26886
26890
  const msg = err instanceof Error ? err.message : String(err);
@@ -26896,16 +26900,17 @@ var A2AServer = class {
26896
26900
  }
26897
26901
  };
26898
26902
  }
26903
+ this.tasks.set(task.id, structuredClone(task));
26899
26904
  this.logger.error(`[perkos-a2a] Task ${task.id} failed: ${msg}`);
26900
26905
  }
26901
26906
  }
26902
26907
  handleGetTask(params, rpcId) {
26903
26908
  const task = this.tasks.get(params?.id);
26904
26909
  if (!task) return this.error(rpcId, 404, "Task not found");
26905
- return this.success(rpcId, task);
26910
+ return this.success(rpcId, structuredClone(task));
26906
26911
  }
26907
26912
  handleListTasks(rpcId) {
26908
- const allTasks = Array.from(this.tasks.values()).sort(
26913
+ const allTasks = Array.from(this.tasks.values()).map((task) => structuredClone(task)).sort(
26909
26914
  (a, b) => new Date(b.status.timestamp).getTime() - new Date(a.status.timestamp).getTime()
26910
26915
  );
26911
26916
  return this.success(rpcId, { tasks: allTasks, nextPageToken: "" });
@@ -27218,7 +27223,23 @@ function register(api) {
27218
27223
  prompt,
27219
27224
  timeoutMs: api.runtime.agent.resolveAgentTimeoutMs(cfg)
27220
27225
  });
27221
- const finalText = (result?.meta?.finalAssistantVisibleText || result?.payloads?.map((p) => p?.text).filter(Boolean).join("\n\n") || "").trim();
27226
+ const payloadText = result?.payloads?.map((p) => p?.text).filter(Boolean).join("\n\n") || "";
27227
+ const finalText = (result?.meta?.finalAssistantVisibleText || payloadText || "").trim();
27228
+ task.artifacts.push({
27229
+ kind: "artifact",
27230
+ artifactId: randomUUID4(),
27231
+ parts: [{
27232
+ kind: "text",
27233
+ text: JSON.stringify({
27234
+ debug: "embedded-run-result",
27235
+ stopReason: result?.meta?.stopReason || null,
27236
+ finalAssistantVisibleText: result?.meta?.finalAssistantVisibleText || null,
27237
+ payloadText: payloadText || null,
27238
+ didSendViaMessagingTool: result?.didSendViaMessagingTool || false,
27239
+ payloadCount: Array.isArray(result?.payloads) ? result.payloads.length : 0
27240
+ }, null, 2)
27241
+ }]
27242
+ });
27222
27243
  if (finalText) {
27223
27244
  task.artifacts.push({
27224
27245
  kind: "artifact",