@ganglion/xacpx 0.20.2 → 0.20.3-beta.0

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.
@@ -3524,18 +3524,19 @@ function buildToolUseEvent(update, driver) {
3524
3524
  function normalizeCursorPlanUpdate(state, update) {
3525
3525
  if (state.driver !== "cursor")
3526
3526
  return;
3527
- const title = normalizeCursorToolName(update.title);
3528
- if (!CURSOR_PLAN_TOOL_NAMES.has(title))
3527
+ if (!CURSOR_PLAN_TOOL_NAMES.has(cursorToolIdentity(update)))
3529
3528
  return;
3530
3529
  const input = cursorToolInput(update.rawInput);
3531
- if (!Array.isArray(input?.todos))
3530
+ const output = cursorToolInput(update.rawOutput);
3531
+ const todos = readCursorTodoList(input) ?? readCursorTodoList(output);
3532
+ if (todos === undefined)
3532
3533
  return;
3533
- const merge = input.merge === true;
3534
- if (input.todos.length === 0) {
3534
+ const merge = input?.merge === true || output?.merge === true;
3535
+ if (todos.length === 0) {
3535
3536
  state.cursorPlanEntries.clear();
3536
3537
  return [];
3537
3538
  }
3538
- const patches = input.todos.map((todo, index) => parseCursorPlanTodo(todo, index)).filter((todo) => todo !== undefined);
3539
+ const patches = todos.map((todo, index) => parseCursorPlanTodo(todo, index)).filter((todo) => todo !== undefined);
3539
3540
  if (patches.length === 0)
3540
3541
  return;
3541
3542
  if (!merge)
@@ -3555,6 +3556,15 @@ function normalizeCursorPlanUpdate(state, update) {
3555
3556
  }
3556
3557
  return [...state.cursorPlanEntries.values()];
3557
3558
  }
3559
+ function readCursorTodoList(input) {
3560
+ if (!input)
3561
+ return;
3562
+ for (const key of ["todos", "todoList"]) {
3563
+ if (Array.isArray(input[key]))
3564
+ return input[key];
3565
+ }
3566
+ return;
3567
+ }
3558
3568
  function parseCursorPlanTodo(value, index) {
3559
3569
  if (!isRecord2(value))
3560
3570
  return;
@@ -3612,6 +3622,11 @@ function cursorToolInput(rawInput) {
3612
3622
  function normalizeCursorToolName(title) {
3613
3623
  return (title ?? "").trim().toLowerCase().replace(/[\s_-]+/g, "");
3614
3624
  }
3625
+ function cursorToolIdentity(update) {
3626
+ const input = cursorToolInput(update.rawInput);
3627
+ const declared = typeof input?.[CURSOR_TOOL_NAME_KEY] === "string" ? input[CURSOR_TOOL_NAME_KEY] : undefined;
3628
+ return normalizeCursorToolName(declared ?? update.title);
3629
+ }
3615
3630
  function normalizeToolKind(update, driver) {
3616
3631
  const kindRaw = update?.kind?.trim().toLowerCase() ?? "";
3617
3632
  switch (kindRaw) {
@@ -3624,12 +3639,14 @@ function normalizeToolKind(update, driver) {
3624
3639
  }
3625
3640
  if (driver !== "cursor")
3626
3641
  return "other";
3627
- switch (normalizeCursorToolName(update?.title)) {
3642
+ switch (cursorToolIdentity(update ?? {})) {
3628
3643
  case "read":
3629
3644
  case "readfile":
3630
3645
  return "read";
3631
3646
  case "grep":
3632
3647
  case "glob":
3648
+ case "find":
3649
+ case "codebasesearch":
3633
3650
  case "search":
3634
3651
  return "search";
3635
3652
  case "shell":
@@ -3647,6 +3664,8 @@ function normalizeToolKind(update, driver) {
3647
3664
  case "runsubagent":
3648
3665
  case "switchmode":
3649
3666
  case "todowrite":
3667
+ case "updatetodos":
3668
+ case "todoread":
3650
3669
  case "createplan":
3651
3670
  case "updateplan":
3652
3671
  case "plan":
@@ -3656,8 +3675,7 @@ function normalizeToolKind(update, driver) {
3656
3675
  }
3657
3676
  }
3658
3677
  function isCursorSubagentInput(rawInput, title) {
3659
- const normalizedTitle = normalizeCursorToolName(title);
3660
- if (!CURSOR_SUBAGENT_TOOL_NAMES.has(normalizedTitle))
3678
+ if (!CURSOR_SUBAGENT_TOOL_NAMES.has(cursorToolIdentity({ title, rawInput })))
3661
3679
  return false;
3662
3680
  const input = cursorToolInput(rawInput);
3663
3681
  return input !== undefined && readFirstString(input, ["subagent_type", "subagentType", "agent", "agentType", "prompt", "instructions"]) !== undefined;
@@ -3832,7 +3850,7 @@ function isGenericToolTitle(kind, title) {
3832
3850
  }
3833
3851
  return false;
3834
3852
  }
3835
- var SENTENCE_TERMINAL_AT_END, PARAGRAPH_BOUNDARY_AT_END, PARAGRAPH_BOUNDARY_AT_START, LINE_BREAK_AT_END, LINE_BREAK_AT_START, PARTIAL_CRLF_PARAGRAPH_BOUNDARY_AT_END, CURSOR_PLAN_TOOL_NAMES, CURSOR_SUBAGENT_TOOL_NAMES, USAGE_BREAKDOWN_FIELDS;
3853
+ var SENTENCE_TERMINAL_AT_END, PARAGRAPH_BOUNDARY_AT_END, PARAGRAPH_BOUNDARY_AT_START, LINE_BREAK_AT_END, LINE_BREAK_AT_START, PARTIAL_CRLF_PARAGRAPH_BOUNDARY_AT_END, CURSOR_TOOL_NAME_KEY = "_toolName", CURSOR_PLAN_TOOL_NAMES, CURSOR_SUBAGENT_TOOL_NAMES, USAGE_BREAKDOWN_FIELDS;
3836
3854
  var init_streaming_prompt = __esm(() => {
3837
3855
  init_background_followup();
3838
3856
  init_tool_kind_emoji();
@@ -3842,7 +3860,14 @@ var init_streaming_prompt = __esm(() => {
3842
3860
  LINE_BREAK_AT_END = /\r?\n[\t ]*$/;
3843
3861
  LINE_BREAK_AT_START = /^[\t ]*\r?\n/;
3844
3862
  PARTIAL_CRLF_PARAGRAPH_BOUNDARY_AT_END = /\r?\n[\t ]*\r$/;
3845
- CURSOR_PLAN_TOOL_NAMES = new Set(["todowrite", "createplan", "updateplan", "plan"]);
3863
+ CURSOR_PLAN_TOOL_NAMES = new Set([
3864
+ "todowrite",
3865
+ "createplan",
3866
+ "updateplan",
3867
+ "plan",
3868
+ "updatetodos",
3869
+ "todoread"
3870
+ ]);
3846
3871
  CURSOR_SUBAGENT_TOOL_NAMES = new Set(["task", "delegate", "runsubagent", "subagent"]);
3847
3872
  USAGE_BREAKDOWN_FIELDS = [
3848
3873
  ["inputTokens", ["inputTokens", "input_tokens"]],
package/dist/cli.js CHANGED
@@ -52917,18 +52917,19 @@ function buildToolUseEvent(update, driver) {
52917
52917
  function normalizeCursorPlanUpdate(state, update) {
52918
52918
  if (state.driver !== "cursor")
52919
52919
  return;
52920
- const title = normalizeCursorToolName(update.title);
52921
- if (!CURSOR_PLAN_TOOL_NAMES.has(title))
52920
+ if (!CURSOR_PLAN_TOOL_NAMES.has(cursorToolIdentity(update)))
52922
52921
  return;
52923
52922
  const input = cursorToolInput(update.rawInput);
52924
- if (!Array.isArray(input?.todos))
52923
+ const output = cursorToolInput(update.rawOutput);
52924
+ const todos = readCursorTodoList(input) ?? readCursorTodoList(output);
52925
+ if (todos === undefined)
52925
52926
  return;
52926
- const merge2 = input.merge === true;
52927
- if (input.todos.length === 0) {
52927
+ const merge2 = input?.merge === true || output?.merge === true;
52928
+ if (todos.length === 0) {
52928
52929
  state.cursorPlanEntries.clear();
52929
52930
  return [];
52930
52931
  }
52931
- const patches = input.todos.map((todo, index) => parseCursorPlanTodo(todo, index)).filter((todo) => todo !== undefined);
52932
+ const patches = todos.map((todo, index) => parseCursorPlanTodo(todo, index)).filter((todo) => todo !== undefined);
52932
52933
  if (patches.length === 0)
52933
52934
  return;
52934
52935
  if (!merge2)
@@ -52948,6 +52949,15 @@ function normalizeCursorPlanUpdate(state, update) {
52948
52949
  }
52949
52950
  return [...state.cursorPlanEntries.values()];
52950
52951
  }
52952
+ function readCursorTodoList(input) {
52953
+ if (!input)
52954
+ return;
52955
+ for (const key of ["todos", "todoList"]) {
52956
+ if (Array.isArray(input[key]))
52957
+ return input[key];
52958
+ }
52959
+ return;
52960
+ }
52951
52961
  function parseCursorPlanTodo(value, index) {
52952
52962
  if (!isRecord4(value))
52953
52963
  return;
@@ -53005,6 +53015,11 @@ function cursorToolInput(rawInput) {
53005
53015
  function normalizeCursorToolName(title) {
53006
53016
  return (title ?? "").trim().toLowerCase().replace(/[\s_-]+/g, "");
53007
53017
  }
53018
+ function cursorToolIdentity(update) {
53019
+ const input = cursorToolInput(update.rawInput);
53020
+ const declared = typeof input?.[CURSOR_TOOL_NAME_KEY] === "string" ? input[CURSOR_TOOL_NAME_KEY] : undefined;
53021
+ return normalizeCursorToolName(declared ?? update.title);
53022
+ }
53008
53023
  function normalizeToolKind(update, driver) {
53009
53024
  const kindRaw = update?.kind?.trim().toLowerCase() ?? "";
53010
53025
  switch (kindRaw) {
@@ -53017,12 +53032,14 @@ function normalizeToolKind(update, driver) {
53017
53032
  }
53018
53033
  if (driver !== "cursor")
53019
53034
  return "other";
53020
- switch (normalizeCursorToolName(update?.title)) {
53035
+ switch (cursorToolIdentity(update ?? {})) {
53021
53036
  case "read":
53022
53037
  case "readfile":
53023
53038
  return "read";
53024
53039
  case "grep":
53025
53040
  case "glob":
53041
+ case "find":
53042
+ case "codebasesearch":
53026
53043
  case "search":
53027
53044
  return "search";
53028
53045
  case "shell":
@@ -53040,6 +53057,8 @@ function normalizeToolKind(update, driver) {
53040
53057
  case "runsubagent":
53041
53058
  case "switchmode":
53042
53059
  case "todowrite":
53060
+ case "updatetodos":
53061
+ case "todoread":
53043
53062
  case "createplan":
53044
53063
  case "updateplan":
53045
53064
  case "plan":
@@ -53049,8 +53068,7 @@ function normalizeToolKind(update, driver) {
53049
53068
  }
53050
53069
  }
53051
53070
  function isCursorSubagentInput(rawInput, title) {
53052
- const normalizedTitle = normalizeCursorToolName(title);
53053
- if (!CURSOR_SUBAGENT_TOOL_NAMES.has(normalizedTitle))
53071
+ if (!CURSOR_SUBAGENT_TOOL_NAMES.has(cursorToolIdentity({ title, rawInput })))
53054
53072
  return false;
53055
53073
  const input = cursorToolInput(rawInput);
53056
53074
  return input !== undefined && readFirstString(input, ["subagent_type", "subagentType", "agent", "agentType", "prompt", "instructions"]) !== undefined;
@@ -53225,7 +53243,7 @@ function isGenericToolTitle(kind, title) {
53225
53243
  }
53226
53244
  return false;
53227
53245
  }
53228
- var SENTENCE_TERMINAL_AT_END, PARAGRAPH_BOUNDARY_AT_END, PARAGRAPH_BOUNDARY_AT_START, LINE_BREAK_AT_END, LINE_BREAK_AT_START, PARTIAL_CRLF_PARAGRAPH_BOUNDARY_AT_END, CURSOR_PLAN_TOOL_NAMES, CURSOR_SUBAGENT_TOOL_NAMES, USAGE_BREAKDOWN_FIELDS;
53246
+ var SENTENCE_TERMINAL_AT_END, PARAGRAPH_BOUNDARY_AT_END, PARAGRAPH_BOUNDARY_AT_START, LINE_BREAK_AT_END, LINE_BREAK_AT_START, PARTIAL_CRLF_PARAGRAPH_BOUNDARY_AT_END, CURSOR_TOOL_NAME_KEY = "_toolName", CURSOR_PLAN_TOOL_NAMES, CURSOR_SUBAGENT_TOOL_NAMES, USAGE_BREAKDOWN_FIELDS;
53229
53247
  var init_streaming_prompt = __esm(() => {
53230
53248
  init_background_followup();
53231
53249
  init_tool_kind_emoji();
@@ -53235,7 +53253,14 @@ var init_streaming_prompt = __esm(() => {
53235
53253
  LINE_BREAK_AT_END = /\r?\n[\t ]*$/;
53236
53254
  LINE_BREAK_AT_START = /^[\t ]*\r?\n/;
53237
53255
  PARTIAL_CRLF_PARAGRAPH_BOUNDARY_AT_END = /\r?\n[\t ]*\r$/;
53238
- CURSOR_PLAN_TOOL_NAMES = new Set(["todowrite", "createplan", "updateplan", "plan"]);
53256
+ CURSOR_PLAN_TOOL_NAMES = new Set([
53257
+ "todowrite",
53258
+ "createplan",
53259
+ "updateplan",
53260
+ "plan",
53261
+ "updatetodos",
53262
+ "todoread"
53263
+ ]);
53239
53264
  CURSOR_SUBAGENT_TOOL_NAMES = new Set(["task", "delegate", "runsubagent", "subagent"]);
53240
53265
  USAGE_BREAKDOWN_FIELDS = [
53241
53266
  ["inputTokens", ["inputTokens", "input_tokens"]],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ganglion/xacpx",
3
- "version": "0.20.2",
3
+ "version": "0.20.3-beta.0",
4
4
  "description": "随时随地通过聊天频道(微信 / 飞书 / 元宝等)远程控制 `acpx` 上的 Claude Code、Codex 等 Agents。",
5
5
  "keywords": [
6
6
  "acpx",