@clawos-dev/clawd 0.2.192-beta.386.33a5833 → 0.2.192-beta.388.6551a3f

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.
@@ -39549,8 +39549,6 @@ async function handlePersonaDispatchToolCall(input, ctx) {
39549
39549
  log("personaDispatch tool entered", {
39550
39550
  targetPersona: input.targetPersona,
39551
39551
  promptLen: input.prompt.length,
39552
- hasTargetSessionId: Boolean(input.targetSessionId),
39553
- hasTargetDeviceId: Boolean(input.targetDeviceId),
39554
39552
  sessionId: ctx.sessionId,
39555
39553
  daemonUrl: ctx.daemonUrl
39556
39554
  });
@@ -39580,9 +39578,7 @@ async function handlePersonaDispatchToolCall(input, ctx) {
39580
39578
  targetPersona: input.targetPersona,
39581
39579
  prompt: input.prompt,
39582
39580
  // 跨设备:非空时透传,daemon run handler 据此走 A 角色转发分支。
39583
- ...input.targetDeviceId ? { targetDeviceId: input.targetDeviceId } : {},
39584
- // 精确寻址:非空时透传,daemon 校验权限并走 resumeDispatchedSession 路径。
39585
- ...input.targetSessionId ? { targetSessionId: input.targetSessionId } : {}
39581
+ ...input.targetDeviceId ? { targetDeviceId: input.targetDeviceId } : {}
39586
39582
  })
39587
39583
  });
39588
39584
  } catch (err) {
@@ -39611,19 +39607,10 @@ async function handlePersonaDispatchToolCall(input, ctx) {
39611
39607
  };
39612
39608
  }
39613
39609
  const outcome = json.result.outcome;
39614
- const dispatchedSessionId = json.result.dispatchedSessionId;
39615
- log("personaDispatch resolved", {
39616
- outcomeKind: outcome.kind,
39617
- dispatchedSessionId
39618
- });
39619
- const idTail = `
39620
-
39621
- (dispatchedSessionId: ${dispatchedSessionId} \u2014 pass this as targetSessionId in a follow-up call to reuse this same B session.)`;
39610
+ log("personaDispatch resolved", { outcomeKind: outcome.kind });
39622
39611
  if (outcome.kind === "failure") {
39623
39612
  return {
39624
- content: [
39625
- { type: "text", text: `Dispatch failed: ${outcome.reason}${idTail}` }
39626
- ],
39613
+ content: [{ type: "text", text: `Dispatch failed: ${outcome.reason}` }],
39627
39614
  isError: true
39628
39615
  };
39629
39616
  }
@@ -39632,7 +39619,7 @@ async function handlePersonaDispatchToolCall(input, ctx) {
39632
39619
  Related files:
39633
39620
  ${outcome.filePaths.map((p) => `- ${p}`).join("\n")}` : "";
39634
39621
  return {
39635
- content: [{ type: "text", text: `${outcome.text}${paths}${idTail}` }]
39622
+ content: [{ type: "text", text: `${outcome.text}${paths}` }]
39636
39623
  };
39637
39624
  }
39638
39625
  async function handlePersonaDispatchCompleteToolCall(input, ctx) {
@@ -39641,16 +39628,16 @@ async function handlePersonaDispatchCompleteToolCall(input, ctx) {
39641
39628
  isFailure: Boolean(input.isFailure),
39642
39629
  textLen: input.text?.length ?? 0,
39643
39630
  filePathCount: input.filePaths?.length ?? 0,
39644
- sessionId: ctx.sessionId,
39631
+ dispatchId: ctx.dispatchId,
39645
39632
  daemonUrl: ctx.daemonUrl
39646
39633
  });
39647
- if (!ctx.sessionId) {
39648
- log("personaDispatchComplete CLAWD_SESSION_ID missing");
39634
+ if (!ctx.dispatchId) {
39635
+ log("personaDispatchComplete CLAWD_DISPATCH_ID missing");
39649
39636
  return {
39650
39637
  content: [
39651
39638
  {
39652
39639
  type: "text",
39653
- text: "Error: CLAWD_SESSION_ID env not set; daemon cannot resolve in-flight dispatch without sessionId."
39640
+ text: "Error: CLAWD_DISPATCH_ID env not set; this session was not dispatched."
39654
39641
  }
39655
39642
  ],
39656
39643
  isError: true
@@ -39665,15 +39652,14 @@ async function handlePersonaDispatchCompleteToolCall(input, ctx) {
39665
39652
  filePaths: input.filePaths
39666
39653
  };
39667
39654
  const url = `${ctx.daemonUrl}/api/rpc/personaDispatch.complete`;
39668
- log("personaDispatchComplete pre-fetch", { url, sessionId: ctx.sessionId });
39655
+ log("personaDispatchComplete pre-fetch", { url, hasSessionId: Boolean(ctx.sessionId) });
39656
+ const headers = { "content-type": "application/json" };
39657
+ if (ctx.sessionId) headers["x-clawd-session-id"] = ctx.sessionId;
39669
39658
  try {
39670
39659
  const res = await f(url, {
39671
39660
  method: "POST",
39672
- headers: {
39673
- "content-type": "application/json",
39674
- "x-clawd-session-id": ctx.sessionId
39675
- },
39676
- body: JSON.stringify({ outcome })
39661
+ headers,
39662
+ body: JSON.stringify({ dispatchId: ctx.dispatchId, outcome })
39677
39663
  });
39678
39664
  log("personaDispatchComplete post-fetch", { url, status: res.status });
39679
39665
  } catch (err) {
@@ -39697,10 +39683,12 @@ async function handlePersonaDispatchCompleteToolCall(input, ctx) {
39697
39683
  async function main() {
39698
39684
  const daemonUrl = process.env.CLAWD_DAEMON_URL;
39699
39685
  const sessionId = process.env.CLAWD_SESSION_ID;
39686
+ const dispatchId = process.env.CLAWD_DISPATCH_ID;
39700
39687
  log("boot", {
39701
39688
  pid: process.pid,
39702
39689
  hasDaemonUrl: Boolean(daemonUrl),
39703
39690
  hasSessionId: Boolean(sessionId),
39691
+ hasDispatchId: Boolean(dispatchId),
39704
39692
  logPath: DISPATCH_LOG ?? "(stderr)"
39705
39693
  });
39706
39694
  if (!daemonUrl) {
@@ -39717,7 +39705,7 @@ async function main() {
39717
39705
  "personaDispatch",
39718
39706
  {
39719
39707
  title: "Dispatch task to another persona",
39720
- description: "Delegate a task to another clawd persona. Use this when the user message contains `@persona/<id>` to hand the task off to that persona. The tool blocks until the other persona finishes and returns its result. To reuse the same B session (continue an earlier task), pass its dispatchedSessionId (from a previous call's output tail) as targetSessionId \u2014 cross-device continuation additionally requires the original targetDeviceId. Omit targetSessionId to spawn a fresh B session.",
39708
+ description: "Delegate a task to another clawd persona. Use this when the user message contains `@persona/<id>` to hand the task off to that persona. The tool blocks until the other persona finishes and returns its result.",
39721
39709
  inputSchema: {
39722
39710
  targetPersona: external_exports.string().describe("persona id (e.g. persona-app-builder)"),
39723
39711
  prompt: external_exports.string().describe(
@@ -39725,9 +39713,6 @@ async function main() {
39725
39713
  ),
39726
39714
  targetDeviceId: external_exports.string().optional().describe(
39727
39715
  "contact deviceId of the remote device when delegating cross-device (omit for a local persona)"
39728
- ),
39729
- targetSessionId: external_exports.string().optional().describe(
39730
- "existing B session id to reuse (from a previous dispatchedSessionId). Omit to spawn a fresh B session."
39731
39716
  )
39732
39717
  }
39733
39718
  },
@@ -39746,8 +39731,8 @@ async function main() {
39746
39731
  }
39747
39732
  },
39748
39733
  // sessionId 透传:complete RPC 必须带 x-clawd-session-id header(rpc-adapter 强制)。
39749
- // daemon 用该 sessionId 反查 PersonaDispatchManager 里该 B in-flight dispatchId 配对回 A waiter
39750
- async (input) => handlePersonaDispatchCompleteToolCall(input, { daemonUrl, sessionId })
39734
+ // B session cc env CLAWD_SESSION_ID = BsessionId
39735
+ async (input) => handlePersonaDispatchCompleteToolCall(input, { daemonUrl, sessionId, dispatchId })
39751
39736
  );
39752
39737
  await server.connect(new StdioServerTransport());
39753
39738
  }