@ganglion/xacpx 0.23.0-beta.3 → 0.23.0-beta.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.
@@ -3529,6 +3529,7 @@ function buildToolUseEvent(update, driver) {
3529
3529
  const content = update.content;
3530
3530
  const rawOutput = update.rawOutput ?? claudeToolResponse;
3531
3531
  const locations = update.locations;
3532
+ const machineToolName = (isClaudeDriver ? update._meta?.claudeCode?.toolName?.trim() : "") || (driver === "qoder" ? update._meta?.qoder?.toolName?.trim() : "") || (driver === "codex" ? codexMcpMachineToolName(update.rawInput) : "") || (driver === "cursor" ? machineToolNameFromCursorInput(update.rawInput) : "") || undefined;
3532
3533
  const parentToolCallId = claudeMeta?.parentToolUseId?.trim() || update.parentToolCallId?.trim();
3533
3534
  const isSubagent = claudeMeta?.toolName === "Agent" || driver === "qoder" && update._meta?.qoder?.toolName === "Agent" || driver === "kimi" && isKimiSubagentInput(rawInput) || driver === "codex" && isCodexSubagentMeta(update._meta?.codex?.subagent) || driver === "cursor" && isCursorSubagentInput(rawInput, title);
3534
3535
  return {
@@ -3536,6 +3537,7 @@ function buildToolUseEvent(update, driver) {
3536
3537
  ...parentToolCallId ? { parentToolCallId } : {},
3537
3538
  ...isSubagent ? { isSubagent: true } : {},
3538
3539
  toolName,
3540
+ ...machineToolName ? { machineToolName } : {},
3539
3541
  kind,
3540
3542
  ...summary ? { summary } : {},
3541
3543
  ...rawInput !== undefined ? { rawInput } : {},
@@ -3545,6 +3547,26 @@ function buildToolUseEvent(update, driver) {
3545
3547
  status
3546
3548
  };
3547
3549
  }
3550
+ function codexMcpMachineToolName(rawInput) {
3551
+ if (!isRecord2(rawInput))
3552
+ return "";
3553
+ const server = rawInput.server;
3554
+ const tool = rawInput.tool;
3555
+ if (typeof server !== "string" || server.trim().length === 0)
3556
+ return "";
3557
+ if (typeof tool !== "string" || tool.trim().length === 0)
3558
+ return "";
3559
+ return tool.trim();
3560
+ }
3561
+ function machineToolNameFromCursorInput(rawInput) {
3562
+ if (!isRecord2(rawInput))
3563
+ return;
3564
+ const declared = rawInput[CURSOR_TOOL_NAME_KEY];
3565
+ if (typeof declared !== "string")
3566
+ return;
3567
+ const trimmed = declared.trim();
3568
+ return trimmed.length > 0 ? trimmed : undefined;
3569
+ }
3548
3570
  function normalizeCursorPlanUpdate(state, update) {
3549
3571
  if (state.driver !== "cursor")
3550
3572
  return;
@@ -208,8 +208,17 @@ export interface ToolUseEvent {
208
208
  parentToolCallId?: string;
209
209
  /** This tool call represents a delegated subagent task rather than an ordinary tool. */
210
210
  isSubagent?: boolean;
211
- /** Free-form tool name from the agent (e.g. "Read File", "Bash"). */
211
+ /** Free-form tool name from the agent (e.g. "Read File", "Bash"). This is the
212
+ * ACP DISPLAY title — a human phrase, not a stable protocol identity, and may
213
+ * differ from the underlying machine tool name on every driver. Presentation
214
+ * only; NEVER use for protocol/tool-identity decisions (see machineToolName). */
212
215
  toolName: string;
216
+ /** Stable machine tool name extracted from provider metadata (Claude
217
+ * `_meta.claudeCode.toolName`, Qoder `_meta.qoder.toolName`, Cursor
218
+ * `rawInput._toolName`). Absent when the driver exposes none (e.g. Codex).
219
+ * This is the ONLY field protocol-level tool identification (agent_send
220
+ * correlation) may match on when present. */
221
+ machineToolName?: string;
213
222
  /** Coarse classifier produced by the transport from the agent's tool kind; channels use it to pick an icon. */
214
223
  kind: ToolUseKind;
215
224
  /** Best-effort one-line summary derived from `rawInput`. */
package/dist/cli.js CHANGED
@@ -28529,7 +28529,12 @@ function buildXacpxMcpToolRegistry(input) {
28529
28529
  } else if (completion === "result") {
28530
28530
  completionHint = " xacpx will return the peer's final result to this session when it completes. Do not poll or send acknowledgement messages.";
28531
28531
  }
28532
- return createSuccessResult(`Peer message ${receipt.messageId} accepted with status=${receipt.status}${receipt.modeUsed ? ` via ${receipt.modeUsed}` : ""}.${completionHint}`, receipt);
28532
+ const receiptMarker = `xacpx-agent-send-receipt:v1 ${JSON.stringify({
28533
+ messageId: receipt.messageId,
28534
+ status: receipt.status
28535
+ })}`;
28536
+ return createSuccessResult(`Peer message ${receipt.messageId} accepted with status=${receipt.status}${receipt.modeUsed ? ` via ${receipt.modeUsed}` : ""}.${completionHint}
28537
+ ${receiptMarker}`, receipt);
28533
28538
  })
28534
28539
  });
28535
28540
  if (internalSessionTools && !isExternalCoordinator && !sourceHandle) {
@@ -56313,6 +56318,7 @@ function buildToolUseEvent(update, driver) {
56313
56318
  const content = update.content;
56314
56319
  const rawOutput = update.rawOutput ?? claudeToolResponse;
56315
56320
  const locations = update.locations;
56321
+ const machineToolName = (isClaudeDriver ? update._meta?.claudeCode?.toolName?.trim() : "") || (driver === "qoder" ? update._meta?.qoder?.toolName?.trim() : "") || (driver === "codex" ? codexMcpMachineToolName(update.rawInput) : "") || (driver === "cursor" ? machineToolNameFromCursorInput(update.rawInput) : "") || undefined;
56316
56322
  const parentToolCallId = claudeMeta?.parentToolUseId?.trim() || update.parentToolCallId?.trim();
56317
56323
  const isSubagent = claudeMeta?.toolName === "Agent" || driver === "qoder" && update._meta?.qoder?.toolName === "Agent" || driver === "kimi" && isKimiSubagentInput(rawInput) || driver === "codex" && isCodexSubagentMeta(update._meta?.codex?.subagent) || driver === "cursor" && isCursorSubagentInput(rawInput, title);
56318
56324
  return {
@@ -56320,6 +56326,7 @@ function buildToolUseEvent(update, driver) {
56320
56326
  ...parentToolCallId ? { parentToolCallId } : {},
56321
56327
  ...isSubagent ? { isSubagent: true } : {},
56322
56328
  toolName,
56329
+ ...machineToolName ? { machineToolName } : {},
56323
56330
  kind,
56324
56331
  ...summary ? { summary } : {},
56325
56332
  ...rawInput !== undefined ? { rawInput } : {},
@@ -56329,6 +56336,26 @@ function buildToolUseEvent(update, driver) {
56329
56336
  status
56330
56337
  };
56331
56338
  }
56339
+ function codexMcpMachineToolName(rawInput) {
56340
+ if (!isRecord5(rawInput))
56341
+ return "";
56342
+ const server = rawInput.server;
56343
+ const tool = rawInput.tool;
56344
+ if (typeof server !== "string" || server.trim().length === 0)
56345
+ return "";
56346
+ if (typeof tool !== "string" || tool.trim().length === 0)
56347
+ return "";
56348
+ return tool.trim();
56349
+ }
56350
+ function machineToolNameFromCursorInput(rawInput) {
56351
+ if (!isRecord5(rawInput))
56352
+ return;
56353
+ const declared = rawInput[CURSOR_TOOL_NAME_KEY];
56354
+ if (typeof declared !== "string")
56355
+ return;
56356
+ const trimmed = declared.trim();
56357
+ return trimmed.length > 0 ? trimmed : undefined;
56358
+ }
56332
56359
  function normalizeCursorPlanUpdate(state, update) {
56333
56360
  if (state.driver !== "cursor")
56334
56361
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ganglion/xacpx",
3
- "version": "0.23.0-beta.3",
3
+ "version": "0.23.0-beta.4",
4
4
  "description": "随时随地通过聊天频道(微信 / 飞书 / 元宝等)远程控制 `acpx` 上的 Claude Code、Codex 等 Agents。",
5
5
  "keywords": [
6
6
  "acpx",